跳到主要内容

Client Mail API Reference

Mail is a service that helps developers send in-game mails with attachments to players asynchronously through the PGOS web portal or virtual server. Game client can pull mails, mark mails, delete mails and claim the attachment in mails.

API List

APIDescription
GetMailListGet mail list by category, category 'All' represents all categories.
DeleteMailByIdDelete mail by mail ID.
DeleteReadMailByCategoryDelete read mails by category.
MarkMailAsReadByIdMark mail as read by id.
MarkMailAsReadByCategoryMark mail as read by category.
ClaimMailAttachmentByIdClaim mail attachments by mail ID.
ClaimMailAttachmentByCategoryClaim mail attachments by category.
GetMailBadgeNumGet the number of unread mails.

Event List

EventDescription
SetOnBadgeNumOfMailThe event will be triggered when player login PGOS or the total unread count of mails changes.
SetOnReceiveNewMailThe event will be triggered when a new mail is received.

API Details

GetMailList

Get mail list by category, category 'All' represents all categories.

/**
* Get mail list by category, category 'All' represents all categories.
*
* @param params Request parameters for get mail list.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void GetMailList(
const GetMailListParams& params,
PgosDataCallback<GetMailListResult> result_callback);

Parameters:

ParamTypeDescription
paramsconst GetMailListParams&Request parameters for get mail list.
result_callbackPgosDataCallback<GetMailListResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

DeleteMailById

Delete mail by mail ID.

/**
* Delete mail by mail ID.
*
* @param mail_ids Mail IDs.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void DeleteMailById(
const pgos::pvector<pgos::pstring>& mail_ids,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
mail_idsconst std::vector<std::string>&Mail IDs.
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

DeleteReadMailByCategory

Delete read mails by category.

/**
* Delete read mails by category.
*
* @param category Mail category, category 'All' represents all categories.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void DeleteReadMailByCategory(
MailCategory category,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
categoryMailCategoryMail category, category 'All' represents all categories.
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

MarkMailAsReadById

Mark mail as read by id.

/**
* Mark mail as read by id.
*
* @param mail_ids Mail IDs.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void MarkMailAsReadById(
const pgos::pvector<pgos::pstring>& mail_ids,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
mail_idsconst std::vector<std::string>&Mail IDs.
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

MarkMailAsReadByCategory

Mark mail as read by category.

/**
* Mark mail as read by category.
*
* @param category Mail category, category 'All' represents all categories.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void MarkMailAsReadByCategory(
MailCategory category,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
categoryMailCategoryMail category, category 'All' represents all categories.
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

ClaimMailAttachmentById

Claim mail attachments by mail ID.

/**
* Claim mail attachments by mail ID.
*
* @param mail_ids Mail IDs.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void ClaimMailAttachmentById(
const pgos::pvector<pgos::pstring>& mail_ids,
PgosDataCallback<ClaimMailAttachmentResult> result_callback);

Parameters:

ParamTypeDescription
mail_idsconst std::vector<std::string>&Mail IDs.
result_callbackPgosDataCallback<ClaimMailAttachmentResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

ClaimMailAttachmentByCategory

Claim mail attachments by category.

/**
* Claim mail attachments by category.
*
* @param category Mail category, category 'All' represents all categories.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void ClaimMailAttachmentByCategory(
MailCategory category,
PgosDataCallback<ClaimMailAttachmentResult> result_callback);

Parameters:

ParamTypeDescription
categoryMailCategoryMail category, category 'All' represents all categories.
result_callbackPgosDataCallback<ClaimMailAttachmentResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

GetMailBadgeNum

Get the number of unread mails.

/**
* Get the number of unread mails.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void GetMailBadgeNum(
PgosDataCallback<GetMailBadgeNumResult> result_callback);

Parameters:

ParamTypeDescription
result_callbackPgosDataCallback<GetMailBadgeNumResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

Event Details

SetOnBadgeNumOfMail

The event will be triggered when player login PGOS or the total unread count of mails changes.

/**
* OnSetOnBadgeNumOfMail:
* The event will be triggered when player login PGOS or the total unread count of mails changes.
*
* @param event Result of the event
*/
void SetOnBadgeNumOfMail(
const BadgeNumOfMailEvt& event);

Parameters:

ParamTypeDescription
eventconst BadgeNumOfMailEvt&Result of the event

SetOnReceiveNewMail

The event will be triggered when a new mail is received.

/**
* OnSetOnReceiveNewMail:
* The event will be triggered when a new mail is received.
*
* @param event Result of the event
*/
void SetOnReceiveNewMail(
const ReceiveNewMailEvt& event);

Parameters:

ParamTypeDescription
eventconst ReceiveNewMailEvt&Result of the event