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
| API | Description |
|---|---|
| GetMailList | Get mail list by category, category 'All' represents all categories. |
| DeleteMailById | Delete mail by mail ID. |
| DeleteReadMailByCategory | Delete read mails by category. |
| MarkMailAsReadById | Mark mail as read by id. |
| MarkMailAsReadByCategory | Mark mail as read by category. |
| ClaimMailAttachmentById | Claim mail attachments by mail ID. |
| ClaimMailAttachmentByCategory | Claim mail attachments by category. |
| GetMailBadgeNum | Get the number of unread mails. |
Event List
| Event | Description |
|---|---|
| SetOnBadgeNumOfMail | The event will be triggered when player login PGOS or the total unread count of mails changes. |
| SetOnReceiveNewMail | The 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:
| Param | Type | Description |
|---|---|---|
| params | const GetMailListParams& | Request parameters for get mail list. |
| result_callback | PgosDataCallback<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:
| Param | Type | Description |
|---|---|---|
| mail_ids | const std::vector<std::string>& | Mail IDs. |
| result_callback | PgosCallback | The 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:
| Param | Type | Description |
|---|---|---|
| category | MailCategory | Mail category, category 'All' represents all categories. |
| result_callback | PgosCallback | The 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:
| Param | Type | Description |
|---|---|---|
| mail_ids | const std::vector<std::string>& | Mail IDs. |
| result_callback | PgosCallback | The 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:
| Param | Type | Description |
|---|---|---|
| category | MailCategory | Mail category, category 'All' represents all categories. |
| result_callback | PgosCallback | The 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:
| Param | Type | Description |
|---|---|---|
| mail_ids | const std::vector<std::string>& | Mail IDs. |
| result_callback | PgosDataCallback<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:
| Param | Type | Description |
|---|---|---|
| category | MailCategory | Mail category, category 'All' represents all categories. |
| result_callback | PgosDataCallback<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:
| Param | Type | Description |
|---|---|---|
| result_callback | PgosDataCallback<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:
| Param | Type | Description |
|---|---|---|
| event | const 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:
| Param | Type | Description |
|---|---|---|
| event | const ReceiveNewMailEvt& | Result of the event |