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 |
|---|---|
| OnBadgeNumOfMail | The event will be triggered when player login PGOS or the total unread count of mails changes. |
| OnReceiveNewMail | 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 ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void GetMailList(
const FPgosClientGetMailListParams& Params,
TFunction<void(const FPgosResult& Ret, const FPgosClientGetMailListResult* Data)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| Params | const FPgosClientGetMailListParams& | Request parameters for get mail list. |
| ResultCallback | TFunction<void(const FPgosResult& Ret, const FPgosClientGetMailListResult* Data)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
Return: void
DeleteMailById
Delete mail by mail ID.
/**
* Delete mail by mail ID.
*
* @param MailIds Mail IDs.
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void DeleteMailById(
const TArray<FString>& MailIds,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| MailIds | const TArray<FString>& | Mail IDs. |
| ResultCallback | TFunction<void(const FPgosResult& Ret)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
Return: void
DeleteReadMailByCategory
Delete read mails by category.
/**
* Delete read mails by category.
*
* @param Category Mail category, category 'All' represents all categories.
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void DeleteReadMailByCategory(
EPgosClientMailCategory Category,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| Category | EPgosClientMailCategory | Mail category, category 'All' represents all categories. |
| ResultCallback | TFunction<void(const FPgosResult& Ret)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
Return: void
MarkMailAsReadById
Mark mail as read by id.
/**
* Mark mail as read by id.
*
* @param MailIds Mail IDs.
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void MarkMailAsReadById(
const TArray<FString>& MailIds,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| MailIds | const TArray<FString>& | Mail IDs. |
| ResultCallback | TFunction<void(const FPgosResult& Ret)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
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 ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void MarkMailAsReadByCategory(
EPgosClientMailCategory Category,
TFunction<void(const FPgosResult& Ret)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| Category | EPgosClientMailCategory | Mail category, category 'All' represents all categories. |
| ResultCallback | TFunction<void(const FPgosResult& Ret)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
Return: void
ClaimMailAttachmentById
Claim mail attachments by mail ID.
/**
* Claim mail attachments by mail ID.
*
* @param MailIds Mail IDs.
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void ClaimMailAttachmentById(
const TArray<FString>& MailIds,
TFunction<void(const FPgosResult& Ret, const FPgosClientClaimMailAttachmentResult* Data)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| MailIds | const TArray<FString>& | Mail IDs. |
| ResultCallback | TFunction<void(const FPgosResult& Ret, const FPgosClientClaimMailAttachmentResult* Data)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
Return: void
ClaimMailAttachmentByCategory
Claim mail attachments by category.
/**
* Claim mail attachments by category.
*
* @param Category Mail category, category 'All' represents all categories.
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void ClaimMailAttachmentByCategory(
EPgosClientMailCategory Category,
TFunction<void(const FPgosResult& Ret, const FPgosClientClaimMailAttachmentResult* Data)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| Category | EPgosClientMailCategory | Mail category, category 'All' represents all categories. |
| ResultCallback | TFunction<void(const FPgosResult& Ret, const FPgosClientClaimMailAttachmentResult* Data)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
Return: void
GetMailBadgeNum
Get the number of unread mails.
/**
* Get the number of unread mails.
*
* @param ResultCallback The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject.
*/
void GetMailBadgeNum(
TFunction<void(const FPgosResult& Ret, const FPgosClientGetMailBadgeNumResult* Data)> ResultCallback) const;
Parameters:
| Param | Type | Description |
|---|---|---|
| ResultCallback | TFunction<void(const FPgosResult& Ret, const FPgosClientGetMailBadgeNumResult* Data)> | The result callback after the API execution ends, and it will be called in the GAME THREAD. For lifetime safety, it is recommended to use the CreateWeakCallback provided in PgosSDKCpp.h to create a lambda bound to an UObject. |
Return: void
Event Details
OnBadgeNumOfMail
The event will be triggered when player login PGOS or the total unread count of mails changes.
/**
* OnBadgeNumOfMail:
* The event will be triggered when player login PGOS or the total unread count of mails changes.
*
* @param Event Result of the event
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnBadgeNumOfMail, const FPgosClientBadgeNumOfMailEvt& /*Event*/);
FOnBadgeNumOfMail& OnBadgeNumOfMail() { return BadgeNumOfMailDelegate; }
Type Reference:
OnReceiveNewMail
The event will be triggered when a new mail is received.
/**
* OnReceiveNewMail:
* The event will be triggered when a new mail is received.
*
* @param Event Result of the event
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnReceiveNewMail, const FPgosClientReceiveNewMailEvt& /*Event*/);
FOnReceiveNewMail& OnReceiveNewMail() { return ReceiveNewMailDelegate; }
Type Reference: