跳到主要内容

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
OnBadgeNumOfMailThe event will be triggered when player login PGOS or the total unread count of mails changes.
OnReceiveNewMailThe 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:

ParamTypeDescription
Paramsconst FPgosClientGetMailListParams&Request parameters for get mail list.
ResultCallbackTFunction<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:

ParamTypeDescription
MailIdsconst TArray<FString>&Mail IDs.
ResultCallbackTFunction<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:

ParamTypeDescription
CategoryEPgosClientMailCategoryMail category, category 'All' represents all categories.
ResultCallbackTFunction<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:

ParamTypeDescription
MailIdsconst TArray<FString>&Mail IDs.
ResultCallbackTFunction<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:

ParamTypeDescription
CategoryEPgosClientMailCategoryMail category, category 'All' represents all categories.
ResultCallbackTFunction<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:

ParamTypeDescription
MailIdsconst TArray<FString>&Mail IDs.
ResultCallbackTFunction<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:

ParamTypeDescription
CategoryEPgosClientMailCategoryMail category, category 'All' represents all categories.
ResultCallbackTFunction<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:

ParamTypeDescription
ResultCallbackTFunction<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: