@xmobitea/gn-typescript-client 2.6.13-tsc → 2.6.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +37 -0
- package/README.MD +420 -1
- package/dist/gearn.js.client.js +71354 -0
- package/dist/gearn.js.client.min.js +2 -0
- package/dist/gearn.js.client.min.js.LICENSE.txt +14 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +58386 -339
- package/dist/runtime/GNNetwork.d.ts +687 -3
- package/dist/runtime/GNNetworkAuthenticateApi.d.ts +327 -0
- package/dist/runtime/GNNetworkCharacterPlayerApi.d.ts +1026 -0
- package/dist/runtime/GNNetworkCloudScriptApi.d.ts +141 -0
- package/dist/runtime/GNNetworkContentApi.d.ts +243 -0
- package/dist/runtime/GNNetworkDashboardApi.d.ts +221 -0
- package/dist/runtime/GNNetworkGamePlayerApi.d.ts +1033 -0
- package/dist/runtime/GNNetworkGroupApi.d.ts +783 -0
- package/dist/runtime/GNNetworkInventoryApi.d.ts +673 -0
- package/dist/runtime/GNNetworkMasterPlayerApi.d.ts +1614 -6
- package/dist/runtime/GNNetworkMultiplayerApi.d.ts +234 -0
- package/dist/runtime/GNNetworkStoreInventoryApi.d.ts +309 -0
- package/dist/runtime/common/Action0.d.ts +30 -0
- package/dist/runtime/common/Action1.d.ts +32 -0
- package/dist/runtime/common/Action2.d.ts +21 -0
- package/dist/runtime/common/Action3.d.ts +16 -0
- package/dist/runtime/common/Action4.d.ts +17 -0
- package/dist/runtime/common/GNData.d.ts +368 -0
- package/dist/runtime/config/GNServerSettings.d.ts +442 -12
- package/dist/runtime/constant/Commands.d.ts +80 -0
- package/dist/runtime/constant/EventCode.d.ts +48 -0
- package/dist/runtime/constant/OperationCode.d.ts +74 -1
- package/dist/runtime/constant/ReturnCode.d.ts +72 -0
- package/dist/runtime/constant/enumType/ExecuteResponseStatus.d.ts +31 -0
- package/dist/runtime/constant/enumType/FriendStatus.d.ts +39 -0
- package/dist/runtime/constant/enumType/GoogleLoginType.d.ts +23 -0
- package/dist/runtime/constant/enumType/GroupStatus.d.ts +32 -0
- package/dist/runtime/constant/enumType/InvalidMemberType.d.ts +75 -0
- package/dist/runtime/constant/enumType/ItemType.d.ts +23 -0
- package/dist/runtime/constant/enumType/MatchStatus.d.ts +30 -0
- package/dist/runtime/constant/enumType/MatchmakingMemberStatus.d.ts +24 -0
- package/dist/runtime/constant/enumType/MatchmakingTicketStatus.d.ts +34 -0
- package/dist/runtime/constant/enumType/OwnerType.d.ts +40 -0
- package/dist/runtime/constant/enumType/PermissionDataItem.d.ts +22 -0
- package/dist/runtime/constant/enumType/PushPlatformType.d.ts +18 -0
- package/dist/runtime/constant/enumType/RequestRole.d.ts +32 -0
- package/dist/runtime/constant/enumType/RequestType.d.ts +70 -0
- package/dist/runtime/constant/enumType/StoreItemType.d.ts +21 -0
- package/dist/runtime/constant/enumType/StoreReceiveType.d.ts +30 -0
- package/dist/runtime/constant/errorCode/ErrorCode.d.ts +190 -8
- package/dist/runtime/constant/parameterCode/ParameterCode.d.ts +35 -5
- package/dist/runtime/entity/DataMember.d.ts +338 -0
- package/dist/runtime/entity/GNMetadata.d.ts +101 -0
- package/dist/runtime/entity/InvalidMember.d.ts +28 -0
- package/dist/runtime/entity/OperationEvent.d.ts +49 -0
- package/dist/runtime/entity/OperationRequest.d.ts +108 -0
- package/dist/runtime/entity/OperationResponse.d.ts +110 -0
- package/dist/runtime/entity/models/AuthenticateModels.d.ts +115 -0
- package/dist/runtime/entity/models/AuthenticateRequestModels.d.ts +131 -0
- package/dist/runtime/entity/models/AuthenticateResponseModels.d.ts +131 -0
- package/dist/runtime/entity/models/CharacterPlayerModels.d.ts +625 -1
- package/dist/runtime/entity/models/CharacterPlayerRequestModels.d.ts +972 -0
- package/dist/runtime/entity/models/CharacterPlayerResponseModels.d.ts +332 -0
- package/dist/runtime/entity/models/CloudScriptModels.d.ts +109 -0
- package/dist/runtime/entity/models/CloudScriptRequestModels.d.ts +107 -0
- package/dist/runtime/entity/models/CloudScriptResponseModels.d.ts +46 -0
- package/dist/runtime/entity/models/ContentModels.d.ts +124 -0
- package/dist/runtime/entity/models/ContentRequestModels.d.ts +152 -0
- package/dist/runtime/entity/models/ContentResponseModels.d.ts +58 -0
- package/dist/runtime/entity/models/DashboardModels.d.ts +371 -8
- package/dist/runtime/entity/models/DashboardRequestModels.d.ts +172 -0
- package/dist/runtime/entity/models/DashboardResponseModels.d.ts +170 -0
- package/dist/runtime/entity/models/GamePlayerModels.d.ts +644 -1
- package/dist/runtime/entity/models/GamePlayerRequestModels.d.ts +959 -0
- package/dist/runtime/entity/models/GamePlayerResponseModels.d.ts +333 -1
- package/dist/runtime/entity/models/GenericModels.d.ts +94 -0
- package/dist/runtime/entity/models/GroupModels.d.ts +484 -2
- package/dist/runtime/entity/models/GroupRequestModels.d.ts +737 -0
- package/dist/runtime/entity/models/GroupResponseModels.d.ts +254 -0
- package/dist/runtime/entity/models/InventoryModels.d.ts +415 -0
- package/dist/runtime/entity/models/InventoryRequestModels.d.ts +629 -0
- package/dist/runtime/entity/models/InventoryResponseModels.d.ts +218 -0
- package/dist/runtime/entity/models/MasterPlayerModels.d.ts +1065 -3
- package/dist/runtime/entity/models/MasterPlayerRequestModels.d.ts +1560 -6
- package/dist/runtime/entity/models/MasterPlayerResponseModels.d.ts +532 -1
- package/dist/runtime/entity/models/MultiplayerModels.d.ts +199 -0
- package/dist/runtime/entity/models/MultiplayerRequestModels.d.ts +196 -0
- package/dist/runtime/entity/models/MultiplayerResponseModels.d.ts +74 -0
- package/dist/runtime/entity/models/StoreInventoryModels.d.ts +262 -0
- package/dist/runtime/entity/models/StoreInventoryRequestModels.d.ts +268 -0
- package/dist/runtime/entity/models/StoreInventoryResponseModels.d.ts +98 -0
- package/dist/runtime/entity/request/CustomOperationRequest.d.ts +99 -0
- package/dist/runtime/entity/response/CustomOperationResponse.d.ts +118 -0
- package/dist/runtime/entity/response/GetAuthInfoResponse.d.ts +53 -0
- package/dist/runtime/entity/response/HealthCheckResponse.d.ts +56 -0
- package/dist/runtime/entity/response/UploadFileResponse.d.ts +19 -0
- package/dist/runtime/helper/CodeHelper.d.ts +122 -0
- package/dist/runtime/helper/ConverterService.d.ts +74 -0
- package/dist/runtime/helper/EnumUtility.d.ts +63 -0
- package/dist/runtime/helper/GNSupport.d.ts +64 -4
- package/dist/runtime/helper/GNUtils.d.ts +54 -0
- package/dist/runtime/helper/MessagePackConverterService.d.ts +48 -0
- package/dist/runtime/helper/OperationHelper.d.ts +51 -0
- package/dist/runtime/helper/StorageService.d.ts +48 -8
- package/dist/runtime/logger/GNDebug.d.ts +117 -0
- package/dist/runtime/networking/AuthenticateStatus.d.ts +64 -0
- package/dist/runtime/networking/IPeer.d.ts +83 -0
- package/dist/runtime/networking/NetworkingPeer.d.ts +256 -1
- package/dist/runtime/networking/OperationPending.d.ts +112 -0
- package/dist/runtime/networking/PeerBase.d.ts +231 -0
- package/dist/runtime/networking/handler/IServerEventHandler.d.ts +84 -0
- package/dist/runtime/networking/handler/OnCharacterPlayerFriendUpdateEventHandler.d.ts +69 -0
- package/dist/runtime/networking/handler/OnCharacterPlayerGroupUpdateEventHandler.d.ts +49 -0
- package/dist/runtime/networking/handler/OnGamePlayerFriendUpdateEventHandler.d.ts +50 -0
- package/dist/runtime/networking/handler/OnGamePlayerGroupUpdateEventHandler.d.ts +41 -0
- package/dist/runtime/networking/handler/OnGroupMemberUpdateEventHandler.d.ts +47 -0
- package/dist/runtime/networking/handler/OnGroupMessageUpdateEventHandler.d.ts +46 -0
- package/dist/runtime/networking/http/HttpPeer.d.ts +173 -0
- package/dist/runtime/networking/http/NetworkingHttpPeerBase.d.ts +87 -0
- package/dist/runtime/networking/http/NetworkingPeerAxiosRequest.d.ts +113 -0
- package/dist/runtime/networking/socket/NetworkingPeerSocketIOClient.d.ts +145 -0
- package/dist/runtime/networking/socket/NetworkingSocketPeerBase.d.ts +198 -0
- package/dist/runtime/networking/socket/SocketPeer.d.ts +155 -0
- package/dist/runtime/typescript/ServiceUpdate.d.ts +46 -0
- package/docs/AI_CHEATSHEET.md +211 -0
- package/docs/COOKBOOK.md +912 -0
- package/docs/RULES.md +307 -0
- package/docs/ai-manifest.json +725 -0
- package/docs/guides/AUTHENTICATE.md +246 -0
- package/docs/guides/CHARACTER_PLAYER.md +439 -0
- package/docs/guides/CLOUDSCRIPT.md +335 -0
- package/docs/guides/COCOS_CREATOR_INTEGRATION.md +150 -0
- package/docs/guides/CONTENT.md +291 -0
- package/docs/guides/DASHBOARD.md +262 -0
- package/docs/guides/GAME_PLAYER.md +473 -0
- package/docs/guides/GROUP.md +412 -0
- package/docs/guides/INVENTORY.md +375 -0
- package/docs/guides/MASTER_PLAYER.md +458 -0
- package/docs/guides/MULTIPLAYER.md +303 -0
- package/docs/guides/STORE_INVENTORY.md +313 -0
- package/docs/llms-full.txt +43 -0
- package/docs/reference/API_AUTHENTICATE.md +75 -0
- package/docs/reference/API_CHARACTER_PLAYER.md +226 -0
- package/docs/reference/API_CLOUDSCRIPT.md +82 -0
- package/docs/reference/API_CONTENT.md +88 -0
- package/docs/reference/API_DASHBOARD.md +82 -0
- package/docs/reference/API_GAME_PLAYER.md +223 -0
- package/docs/reference/API_GROUP.md +187 -0
- package/docs/reference/API_INDEX.md +57 -0
- package/docs/reference/API_INVENTORY.md +169 -0
- package/docs/reference/API_MASTER_PLAYER.md +323 -0
- package/docs/reference/API_MULTIPLAYER.md +97 -0
- package/docs/reference/API_STORE_INVENTORY.md +109 -0
- package/docs/reference/CONFIG.md +107 -0
- package/docs/reference/DTO_INDEX.md +2543 -0
- package/docs/reference/ENUMS.md +433 -0
- package/docs/reference/ERROR_HANDLING.md +159 -0
- package/docs/reference/EVENTS.md +188 -0
- package/docs/reference/PERMISSION_RULES.md +55 -0
- package/docs/reference/dto/AUTHENTICATE.md +619 -0
- package/docs/reference/dto/CHARACTER_PLAYER.md +3686 -0
- package/docs/reference/dto/CLOUDSCRIPT.md +400 -0
- package/docs/reference/dto/CONTENT.md +548 -0
- package/docs/reference/dto/DASHBOARD.md +1980 -0
- package/docs/reference/dto/GAME_PLAYER.md +3631 -0
- package/docs/reference/dto/GENERIC.md +151 -0
- package/docs/reference/dto/GROUP.md +2842 -0
- package/docs/reference/dto/INVENTORY.md +2385 -0
- package/docs/reference/dto/MASTER_PLAYER.md +6024 -0
- package/docs/reference/dto/MULTIPLAYER.md +850 -0
- package/docs/reference/dto/STORE_INVENTORY.md +1262 -0
- package/llms.txt +47 -0
- package/package.json +11 -2
- package/GNServerSettings.debug.json +0 -21
- package/dist/runtime/GNNetwork.js +0 -273
- package/dist/runtime/GNNetworkAuthenticateApi.js +0 -122
- package/dist/runtime/GNNetworkCharacterPlayerApi.js +0 -968
- package/dist/runtime/GNNetworkCloudScriptApi.js +0 -104
- package/dist/runtime/GNNetworkContentApi.js +0 -140
- package/dist/runtime/GNNetworkDashboardApi.js +0 -170
- package/dist/runtime/GNNetworkGamePlayerApi.js +0 -950
- package/dist/runtime/GNNetworkGroupApi.js +0 -734
- package/dist/runtime/GNNetworkInventoryApi.js +0 -626
- package/dist/runtime/GNNetworkMasterPlayerApi.js +0 -1550
- package/dist/runtime/GNNetworkMultiplayerApi.js +0 -194
- package/dist/runtime/GNNetworkStoreInventoryApi.js +0 -266
- package/dist/runtime/common/Action0.js +0 -1
- package/dist/runtime/common/Action1.js +0 -1
- package/dist/runtime/common/Action2.js +0 -1
- package/dist/runtime/common/Action3.js +0 -1
- package/dist/runtime/common/Action4.js +0 -1
- package/dist/runtime/common/GNData.js +0 -209
- package/dist/runtime/config/GNServerSettings.js +0 -156
- package/dist/runtime/constant/Commands.js +0 -20
- package/dist/runtime/constant/EventCode.js +0 -8
- package/dist/runtime/constant/OperationCode.js +0 -221
- package/dist/runtime/constant/ReturnCode.js +0 -14
- package/dist/runtime/constant/enumType/ExecuteResponseStatus.js +0 -8
- package/dist/runtime/constant/enumType/FriendStatus.js +0 -7
- package/dist/runtime/constant/enumType/GoogleLoginType.js +0 -5
- package/dist/runtime/constant/enumType/GroupStatus.js +0 -7
- package/dist/runtime/constant/enumType/InvalidMemberType.js +0 -18
- package/dist/runtime/constant/enumType/ItemType.js +0 -5
- package/dist/runtime/constant/enumType/MatchmakingMemberStatus.js +0 -6
- package/dist/runtime/constant/enumType/MatchmakingTicketStatus.js +0 -8
- package/dist/runtime/constant/enumType/OwnerType.js +0 -9
- package/dist/runtime/constant/enumType/PermissionDataItem.js +0 -5
- package/dist/runtime/constant/enumType/PushPlatformType.js +0 -5
- package/dist/runtime/constant/enumType/RequestRole.js +0 -6
- package/dist/runtime/constant/enumType/RequestType.js +0 -15
- package/dist/runtime/constant/enumType/StoreItemType.js +0 -5
- package/dist/runtime/constant/enumType/StoreReceiveType.js +0 -8
- package/dist/runtime/constant/errorCode/ErrorCode.js +0 -52
- package/dist/runtime/constant/parameterCode/ParameterCode.js +0 -617
- package/dist/runtime/entity/DataMember.js +0 -208
- package/dist/runtime/entity/GNMetadata.js +0 -11
- package/dist/runtime/entity/InvalidMember.js +0 -1
- package/dist/runtime/entity/OperationEvent.js +0 -24
- package/dist/runtime/entity/OperationRequest.js +0 -42
- package/dist/runtime/entity/OperationResponse.js +0 -73
- package/dist/runtime/entity/models/AuthenticateModels.js +0 -426
- package/dist/runtime/entity/models/AuthenticateRequestModels.js +0 -188
- package/dist/runtime/entity/models/AuthenticateResponseModels.js +0 -131
- package/dist/runtime/entity/models/CharacterPlayerModels.js +0 -1433
- package/dist/runtime/entity/models/CharacterPlayerRequestModels.js +0 -1386
- package/dist/runtime/entity/models/CharacterPlayerResponseModels.js +0 -376
- package/dist/runtime/entity/models/CloudScriptModels.js +0 -197
- package/dist/runtime/entity/models/CloudScriptRequestModels.js +0 -138
- package/dist/runtime/entity/models/CloudScriptResponseModels.js +0 -40
- package/dist/runtime/entity/models/ContentModels.js +0 -203
- package/dist/runtime/entity/models/ContentRequestModels.js +0 -190
- package/dist/runtime/entity/models/ContentResponseModels.js +0 -54
- package/dist/runtime/entity/models/DashboardModels.js +0 -3002
- package/dist/runtime/entity/models/DashboardRequestModels.js +0 -268
- package/dist/runtime/entity/models/DashboardResponseModels.js +0 -187
- package/dist/runtime/entity/models/GamePlayerModels.js +0 -1591
- package/dist/runtime/entity/models/GamePlayerRequestModels.js +0 -1360
- package/dist/runtime/entity/models/GamePlayerResponseModels.js +0 -369
- package/dist/runtime/entity/models/GenericModels.js +0 -177
- package/dist/runtime/entity/models/GroupModels.js +0 -1135
- package/dist/runtime/entity/models/GroupRequestModels.js +0 -1048
- package/dist/runtime/entity/models/GroupResponseModels.js +0 -285
- package/dist/runtime/entity/models/InventoryModels.js +0 -915
- package/dist/runtime/entity/models/InventoryRequestModels.js +0 -892
- package/dist/runtime/entity/models/InventoryResponseModels.js +0 -243
- package/dist/runtime/entity/models/MasterPlayerModels.js +0 -2573
- package/dist/runtime/entity/models/MasterPlayerRequestModels.js +0 -2228
- package/dist/runtime/entity/models/MasterPlayerResponseModels.js +0 -607
- package/dist/runtime/entity/models/MultiplayerModels.js +0 -404
- package/dist/runtime/entity/models/MultiplayerRequestModels.js +0 -268
- package/dist/runtime/entity/models/MultiplayerResponseModels.js +0 -75
- package/dist/runtime/entity/models/StoreInventoryModels.js +0 -797
- package/dist/runtime/entity/models/StoreInventoryRequestModels.js +0 -372
- package/dist/runtime/entity/models/StoreInventoryResponseModels.js +0 -103
- package/dist/runtime/entity/request/CustomOperationRequest.js +0 -24
- package/dist/runtime/entity/response/CustomOperationResponse.js +0 -29
- package/dist/runtime/entity/response/GetAuthInfoResponse.js +0 -2
- package/dist/runtime/entity/response/HealthCheckResponse.js +0 -2
- package/dist/runtime/entity/response/UploadFileResponse.js +0 -2
- package/dist/runtime/helper/CodeHelper.js +0 -63
- package/dist/runtime/helper/ConverterService.js +0 -275
- package/dist/runtime/helper/EnumUtility.js +0 -33
- package/dist/runtime/helper/GNSupport.js +0 -47
- package/dist/runtime/helper/GNUtils.js +0 -72
- package/dist/runtime/helper/MessagePackConverterService.js +0 -9
- package/dist/runtime/helper/OperationHelper.js +0 -24
- package/dist/runtime/helper/StorageService.js +0 -62
- package/dist/runtime/logger/GNDebug.js +0 -29
- package/dist/runtime/networking/AuthenticateStatus.js +0 -14
- package/dist/runtime/networking/IPeer.js +0 -1
- package/dist/runtime/networking/NetworkingPeer.js +0 -210
- package/dist/runtime/networking/OperationPending.js +0 -53
- package/dist/runtime/networking/PeerBase.js +0 -161
- package/dist/runtime/networking/handler/IServerEventHandler.js +0 -13
- package/dist/runtime/networking/handler/OnCharacterPlayerFriendUpdateEventHandler.js +0 -39
- package/dist/runtime/networking/handler/OnCharacterPlayerGroupUpdateEventHandler.js +0 -39
- package/dist/runtime/networking/handler/OnGamePlayerFriendUpdateEventHandler.js +0 -39
- package/dist/runtime/networking/handler/OnGamePlayerGroupUpdateEventHandler.js +0 -39
- package/dist/runtime/networking/handler/OnGroupMemberUpdateEventHandler.js +0 -35
- package/dist/runtime/networking/handler/OnGroupMessageUpdateEventHandler.js +0 -43
- package/dist/runtime/networking/http/HttpPeer.js +0 -123
- package/dist/runtime/networking/http/NetworkingHttpPeerBase.js +0 -9
- package/dist/runtime/networking/http/NetworkingPeerAxiosRequest.js +0 -179
- package/dist/runtime/networking/socket/NetworkingPeerSocketIOClient.js +0 -130
- package/dist/runtime/networking/socket/NetworkingSocketPeerBase.js +0 -165
- package/dist/runtime/networking/socket/SocketPeer.js +0 -115
- package/dist/runtime/typescript/ServiceUpdate.js +0 -22
- package/docs/COCOS_CREATOR_INTEGRATION.md +0 -116
- package/examples/cocos-creator/GearNExample.ts.txt +0 -176
- package/srcSwift/Package.swift +0 -32
- package/srcSwift/Sources/GearN/runtime/GNNetwork.swift +0 -530
- package/srcSwift/Sources/GearN/runtime/GNNetworkAuthenticateApi.swift +0 -178
- package/srcSwift/Sources/GearN/runtime/GNNetworkCharacterPlayerApi.swift +0 -1162
- package/srcSwift/Sources/GearN/runtime/GNNetworkCloudScriptApi.swift +0 -154
- package/srcSwift/Sources/GearN/runtime/GNNetworkContentApi.swift +0 -208
- package/srcSwift/Sources/GearN/runtime/GNNetworkDashboardApi.swift +0 -240
- package/srcSwift/Sources/GearN/runtime/GNNetworkGamePlayerApi.swift +0 -1369
- package/srcSwift/Sources/GearN/runtime/GNNetworkGroupApi.swift +0 -1100
- package/srcSwift/Sources/GearN/runtime/GNNetworkInventoryApi.swift +0 -937
- package/srcSwift/Sources/GearN/runtime/GNNetworkMasterPlayerApi.swift +0 -2323
- package/srcSwift/Sources/GearN/runtime/GNNetworkMultiplayerApi.swift +0 -298
- package/srcSwift/Sources/GearN/runtime/GNNetworkStoreInventoryApi.swift +0 -397
- package/srcSwift/Sources/GearN/runtime/common/Action0.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/Action1.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/Action2.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/Action3.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/Action4.swift +0 -3
- package/srcSwift/Sources/GearN/runtime/common/GNArray.swift +0 -204
- package/srcSwift/Sources/GearN/runtime/common/GNData.swift +0 -108
- package/srcSwift/Sources/GearN/runtime/common/GNHashtable.swift +0 -200
- package/srcSwift/Sources/GearN/runtime/config/GNServerSettings.swift +0 -95
- package/srcSwift/Sources/GearN/runtime/constant/Commands.swift +0 -28
- package/srcSwift/Sources/GearN/runtime/constant/EventCode.swift +0 -10
- package/srcSwift/Sources/GearN/runtime/constant/OperationCode.swift +0 -252
- package/srcSwift/Sources/GearN/runtime/constant/ReturnCode.swift +0 -19
- package/srcSwift/Sources/GearN/runtime/constant/enumType/ExecuteResponseStatus.swift +0 -9
- package/srcSwift/Sources/GearN/runtime/constant/enumType/FriendStatus.swift +0 -8
- package/srcSwift/Sources/GearN/runtime/constant/enumType/GoogleLoginType.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/GroupStatus.swift +0 -8
- package/srcSwift/Sources/GearN/runtime/constant/enumType/InvalidMemberType.swift +0 -19
- package/srcSwift/Sources/GearN/runtime/constant/enumType/ItemType.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/MatchmakingMemberStatus.swift +0 -7
- package/srcSwift/Sources/GearN/runtime/constant/enumType/MatchmakingTicketStatus.swift +0 -9
- package/srcSwift/Sources/GearN/runtime/constant/enumType/OwnerType.swift +0 -10
- package/srcSwift/Sources/GearN/runtime/constant/enumType/PermissionDataItem.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/PushPlatformType.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/RequestRole.swift +0 -7
- package/srcSwift/Sources/GearN/runtime/constant/enumType/RequestType.swift +0 -16
- package/srcSwift/Sources/GearN/runtime/constant/enumType/StoreItemType.swift +0 -6
- package/srcSwift/Sources/GearN/runtime/constant/enumType/StoreReceiveType.swift +0 -9
- package/srcSwift/Sources/GearN/runtime/constant/errorCode/ErrorCode.swift +0 -58
- package/srcSwift/Sources/GearN/runtime/constant/parameterCode/ParameterCode.swift +0 -672
- package/srcSwift/Sources/GearN/runtime/entity/DataMember.swift +0 -196
- package/srcSwift/Sources/GearN/runtime/entity/GNMetadata.swift +0 -9
- package/srcSwift/Sources/GearN/runtime/entity/InvalidMember.swift +0 -11
- package/srcSwift/Sources/GearN/runtime/entity/OperationEvent.swift +0 -38
- package/srcSwift/Sources/GearN/runtime/entity/OperationHelper.swift +0 -28
- package/srcSwift/Sources/GearN/runtime/entity/OperationRequest.swift +0 -62
- package/srcSwift/Sources/GearN/runtime/entity/OperationResponse.swift +0 -98
- package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateModels.swift +0 -351
- package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateRequestModels.swift +0 -81
- package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateResponseModels.swift +0 -108
- package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerModels.swift +0 -1045
- package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerRequestModels.swift +0 -821
- package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerResponseModels.swift +0 -588
- package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptModels.swift +0 -187
- package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptRequestModels.swift +0 -84
- package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptResponseModels.swift +0 -59
- package/srcSwift/Sources/GearN/runtime/entity/models/ContentModels.swift +0 -195
- package/srcSwift/Sources/GearN/runtime/entity/models/ContentRequestModels.swift +0 -116
- package/srcSwift/Sources/GearN/runtime/entity/models/ContentResponseModels.swift +0 -81
- package/srcSwift/Sources/GearN/runtime/entity/models/DashboardModels.swift +0 -426
- package/srcSwift/Sources/GearN/runtime/entity/models/DashboardRequestModels.swift +0 -160
- package/srcSwift/Sources/GearN/runtime/entity/models/DashboardResponseModels.swift +0 -82
- package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerModels.swift +0 -1334
- package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerRequestModels.swift +0 -643
- package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerResponseModels.swift +0 -213
- package/srcSwift/Sources/GearN/runtime/entity/models/GenericModels.swift +0 -171
- package/srcSwift/Sources/GearN/runtime/entity/models/GroupModels.swift +0 -850
- package/srcSwift/Sources/GearN/runtime/entity/models/GroupRequestModels.swift +0 -485
- package/srcSwift/Sources/GearN/runtime/entity/models/GroupResponseModels.swift +0 -165
- package/srcSwift/Sources/GearN/runtime/entity/models/InventoryModels.swift +0 -679
- package/srcSwift/Sources/GearN/runtime/entity/models/InventoryRequestModels.swift +0 -413
- package/srcSwift/Sources/GearN/runtime/entity/models/InventoryResponseModels.swift +0 -141
- package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerModels.swift +0 -378
- package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerRequestModels.swift +0 -147
- package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerResponseModels.swift +0 -318
- package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerModels.swift +0 -319
- package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerRequestModels.swift +0 -125
- package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerResponseModels.swift +0 -45
- package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryModels.swift +0 -633
- package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryRequestModels.swift +0 -173
- package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryResponseModels.swift +0 -61
- package/srcSwift/Sources/GearN/runtime/entity/request/CustomOperationRequest.swift +0 -42
- package/srcSwift/Sources/GearN/runtime/entity/response/CustomOperationResponse.swift +0 -49
- package/srcSwift/Sources/GearN/runtime/entity/response/GetAuthInfoResponse.swift +0 -43
- package/srcSwift/Sources/GearN/runtime/entity/response/HealthCheckResponse.swift +0 -86
- package/srcSwift/Sources/GearN/runtime/entity/response/UploadFileResponse.swift +0 -15
- package/srcSwift/Sources/GearN/runtime/helper/CodeHelper.swift +0 -107
- package/srcSwift/Sources/GearN/runtime/helper/ConverterService.swift +0 -98
- package/srcSwift/Sources/GearN/runtime/helper/EnumUtility.swift +0 -34
- package/srcSwift/Sources/GearN/runtime/helper/GNSupport.swift +0 -41
- package/srcSwift/Sources/GearN/runtime/helper/GNUtils.swift +0 -66
- package/srcSwift/Sources/GearN/runtime/helper/MessagePackConverterService.swift +0 -21
- package/srcSwift/Sources/GearN/runtime/helper/StorageService.swift +0 -29
- package/srcSwift/Sources/GearN/runtime/logger/GNDebug.swift +0 -33
- package/srcSwift/Sources/GearN/runtime/networking/AuthenticateStatus.swift +0 -24
- package/srcSwift/Sources/GearN/runtime/networking/IPeer.swift +0 -8
- package/srcSwift/Sources/GearN/runtime/networking/NetworkingPeer.swift +0 -368
- package/srcSwift/Sources/GearN/runtime/networking/OperationPending.swift +0 -81
- package/srcSwift/Sources/GearN/runtime/networking/PeerBase.swift +0 -228
- package/srcSwift/Sources/GearN/runtime/networking/handler/IServerEventHandler.swift +0 -20
- package/srcSwift/Sources/GearN/runtime/networking/http/HttpPeer.swift +0 -226
- package/srcSwift/Sources/GearN/runtime/networking/http/HttpTypes.swift +0 -24
- package/srcSwift/Sources/GearN/runtime/networking/http/NetworkingHttpPeerBase.swift +0 -13
- package/srcSwift/Sources/GearN/runtime/networking/http/NetworkingPeerUrlSession.swift +0 -125
- package/srcSwift/Sources/GearN/runtime/networking/request/NetRequest.swift +0 -19
- package/srcSwift/Sources/GearN/runtime/networking/response/NetResponse.swift +0 -13
- package/srcSwift/Sources/GearN/runtime/networking/socket/NetworkingPeerSocketIOClient.swift +0 -244
- package/srcSwift/Sources/GearN/runtime/networking/socket/NetworkingSocketPeerBase.swift +0 -59
- package/srcSwift/Sources/GearN/runtime/networking/socket/SocketPeer.swift +0 -136
- package/tsconfig-build.cocos.json +0 -31
- package/webpack.config.cocos.mjs +0 -78
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
# MasterPlayerApi
|
|
2
|
+
|
|
3
|
+
Tài liệu này dành cho AI code assistant và AI agent nội bộ. Mục tiêu là chọn đúng namespace `client/server/admin`, phân biệt đúng flow hồ sơ với flow link identity, và không sinh sai request ở các nhóm `infoRequestParam`, leaderboard, log, push notification và socket operation event.
|
|
4
|
+
|
|
5
|
+
## 1. Scope
|
|
6
|
+
|
|
7
|
+
- Áp dụng cho:
|
|
8
|
+
- `GNNetwork.masterPlayer`
|
|
9
|
+
- `GNNetwork.masterPlayer.server`
|
|
10
|
+
- `GNNetwork.masterPlayer.admin`
|
|
11
|
+
- Toàn bộ method hiện tại của `MasterPlayerApi` đều gửi qua HTTP.
|
|
12
|
+
- `MasterPlayerApi` có đủ 3 role thật:
|
|
13
|
+
- `GNNetwork.masterPlayer` -> `RequestRole.Client`
|
|
14
|
+
- `GNNetwork.masterPlayer.server` -> `RequestRole.Server`
|
|
15
|
+
- `GNNetwork.masterPlayer.admin` -> `RequestRole.Admin`
|
|
16
|
+
- Nếu không truyền `overrideSecretKey`, SDK sẽ tự lấy secret key theo role tương ứng.
|
|
17
|
+
- Chỉ dùng namespace `.server` khi bạn đã cấu hình `secretKey` với `permission rules` `server` hợp lệ trong `GNServerSettings`, hoặc chủ động truyền `overrideSecretKey`.
|
|
18
|
+
- Chỉ dùng namespace `.admin` khi bạn đã cấu hình `secretKey` với `permission rules` `admin` hợp lệ trong `GNServerSettings`, hoặc chủ động truyền `overrideSecretKey`.
|
|
19
|
+
- Rule chuẩn để chọn `client/server/admin` và hiểu `self/other-self` xem [RULES](../RULES.md#3-route--trust-boundary-của-caller). Không tự suy diễn route chỉ từ target ownership.
|
|
20
|
+
- Với hầu hết flow thao tác trên một player cụ thể:
|
|
21
|
+
- `client` cho phép `userId?`
|
|
22
|
+
- `server/admin` bắt buộc `userId`
|
|
23
|
+
- Rule thực tế:
|
|
24
|
+
- ở `client`, bỏ `userId` sẽ target master player hiện đang auth
|
|
25
|
+
- ở `server/admin`, phải truyền `userId` rõ ràng cho target player
|
|
26
|
+
- `MasterPlayerApi` là nhóm account/profile/identity của master player. Không dùng nhóm này để thao tác game player, character player, group, inventory item hoặc matchmaking.
|
|
27
|
+
- Public package hiện không export event handler socket riêng cho `MasterPlayerApi`.
|
|
28
|
+
|
|
29
|
+
## 2. Hard Rules
|
|
30
|
+
|
|
31
|
+
- Luôn ưu tiên `async/await`. Mặc định dùng `*Async()`.
|
|
32
|
+
- Bắt buộc đã `GNNetwork.init(settings)` trước khi gọi.
|
|
33
|
+
- Không dùng socket transport cho các method của `MasterPlayerApi`.
|
|
34
|
+
- Chọn namespace theo trust boundary:
|
|
35
|
+
- app/player -> `GNNetwork.masterPlayer`
|
|
36
|
+
- trusted backend/service -> `GNNetwork.masterPlayer.server`
|
|
37
|
+
- dashboard/ops/tooling -> `GNNetwork.masterPlayer.admin`
|
|
38
|
+
- Với `client`, chỉ nên bỏ `userId` khi thao tác trên master player hiện tại.
|
|
39
|
+
- Với `server/admin`, mọi flow self-target có `userId` đều phải truyền giá trị này rõ ràng.
|
|
40
|
+
- `getPlayerInformationAsync`, toàn bộ `getPlayersWith*Async`, `getStatisticsLeaderboardAroundPlayerAsync`, `getStatisticsLeaderboardAsync`, `getCurrencyLeaderboardAsync`, `getCreateLeaderboardAsync` và `getLastLoginLeaderboardAsync` đều bắt buộc có `infoRequestParam`.
|
|
41
|
+
- `getPlayerCurrencyAsync` dùng `playerCurrencyKeys`, `getPlayerDataAsync` dùng `playerDataKeys`, `getPlayerStatisticsAsync` dùng `playerStatisticsKeys`.
|
|
42
|
+
- `InfoRequestParam` cũng có `playerCurrencyKeys`, `playerDataKeys`, `playerStatisticsKeys`, nhưng chỉ dùng để điều khiển payload của flow tổng hợp và search. Không được trộn lẫn mục đích giữa getter chuyên biệt và `infoRequestParam`.
|
|
43
|
+
- `getPlayersWithDisplayNameAsync`, `getPlayersWithSegmentAsync` và `getPlayersWithTagAsync` phân trang bằng `skip/limit`.
|
|
44
|
+
- `getCurrencyLogAsync` và `getStatisticsLogAsync` phân trang bằng `token`, không dùng `skip`.
|
|
45
|
+
- `changePlayerCurrencyAsync` và `changePlayerStatisticsAsync` là delta change, không phải set tuyệt đối.
|
|
46
|
+
- `changeAccountPasswordAsync` bắt buộc có `currentPassword`. `resetAccountPasswordAsync` không cần `currentPassword`.
|
|
47
|
+
- `updateTsLastLoginAsync` chỉ cập nhật dữ liệu last login, không làm mới auth token hoặc socket auth.
|
|
48
|
+
- `sendSocketOperationEventAsync` là HTTP wrapper để backend phát socket event tới player, không phải client-side socket send trực tiếp.
|
|
49
|
+
- `linkGoogleAsync` phải map `type` bằng `GoogleLoginType`.
|
|
50
|
+
- `addPushNotificationAsync` phải map `platformType` bằng `PushPlatformType`.
|
|
51
|
+
- `SetAvatarRequestData.type` hiện là số thô; package không export enum avatar public tương ứng.
|
|
52
|
+
|
|
53
|
+
## 3. Chọn Namespace
|
|
54
|
+
|
|
55
|
+
| Namespace | Role thật | `userId` behavior | Dùng khi nào |
|
|
56
|
+
| --- | --- | --- | --- |
|
|
57
|
+
| `GNNetwork.masterPlayer` | `Client` | Có thể bỏ `userId` để target player hiện tại | player app thao tác trên account/profile của chính user hiện tại |
|
|
58
|
+
| `GNNetwork.masterPlayer.server` | `Server` | Phải truyền `userId` ở các flow self-target | trusted backend, game server, worker xử lý account/profile |
|
|
59
|
+
| `GNNetwork.masterPlayer.admin` | `Admin` | Phải truyền `userId` ở các flow self-target | GM tool, dashboard, migration, vận hành dữ liệu player |
|
|
60
|
+
|
|
61
|
+
Rule nhanh:
|
|
62
|
+
|
|
63
|
+
- Logic chạy trong app public: ưu tiên `GNNetwork.masterPlayer`.
|
|
64
|
+
- Logic chạy trong backend tin cậy: ưu tiên `GNNetwork.masterPlayer.server`.
|
|
65
|
+
- Logic quản trị hoặc vận hành dữ liệu: ưu tiên `GNNetwork.masterPlayer.admin`.
|
|
66
|
+
- Không chọn `client` chỉ vì code ngắn hơn nếu operation thuộc trust boundary của backend.
|
|
67
|
+
|
|
68
|
+
## 4. Chọn Method
|
|
69
|
+
|
|
70
|
+
### Đọc 1 master player hoặc 1 phần hồ sơ
|
|
71
|
+
|
|
72
|
+
| Method | Dùng khi nào | Cần truyền gì | Nhận được gì | Ghi chú |
|
|
73
|
+
| --- | --- | --- | --- | --- |
|
|
74
|
+
| `getAvatarAsync` | Cần đọc avatar | `userId?` | `MasterPlayerResponseData` | `avatar.type` hiện là số thô | `Ok`, `MasterPlayerNotFound` |
|
|
75
|
+
| `getCountryCodeAsync` | Cần đọc quốc gia | `userId?` | `MasterPlayerResponseData` | Kết quả ở `infoResponseParameters.countryCode` | `Ok`, `MasterPlayerNotFound` |
|
|
76
|
+
| `getCustomDataAsync` | Cần đọc custom data | `userId?`, `customDataKeys?` | `MasterPlayerResponseData` | Có thể filter theo key | `Ok`, `MasterPlayerNotFound` |
|
|
77
|
+
| `getDisplayNameAsync` | Cần đọc display name | `userId?` | `MasterPlayerResponseData` | Kết quả ở `infoResponseParameters.displayName` | `Ok`, `MasterPlayerNotFound` |
|
|
78
|
+
| `getEmailAsync` | Cần đọc email | `userId?` | `MasterPlayerResponseData` | Kết quả ở `infoResponseParameters.email` | `Ok`, `MasterPlayerNotFound` |
|
|
79
|
+
| `getExternalAsync` | Cần đọc toàn bộ external identity đã link | `userId?` | `MasterPlayerResponseData` | Kết quả ở `infoResponseParameters.external` | `Ok`, `MasterPlayerNotFound` |
|
|
80
|
+
| `getIpAddressCreateAsync` | Cần đọc IP lúc tạo account | `userId?` | `MasterPlayerResponseData` | Trường này thường nhạy cảm, ưu tiên backend/admin | `Ok`, `MasterPlayerNotFound` |
|
|
81
|
+
| `getPlayerBanAsync` | Cần đọc trạng thái ban | `userId?` | `MasterPlayerResponseData` | Kết quả ở `infoResponseParameters.playerBan` | `Ok`, `MasterPlayerNotFound` |
|
|
82
|
+
| `getPlayerCurrencyAsync` | Cần đọc player currencies | `userId?`, `playerCurrencyKeys?` | `MasterPlayerResponseData` | Không dùng `infoRequestParam` | `Ok`, `MasterPlayerNotFound` |
|
|
83
|
+
| `getPlayerDataAsync` | Cần đọc player data | `userId?`, `playerDataKeys?` | `MasterPlayerResponseData` | Không dùng `infoRequestParam` | `Ok`, `MasterPlayerNotFound` |
|
|
84
|
+
| `getPlayerInformationAsync` | Cần lấy nhiều field hồ sơ trong một lần gọi | `userId?`, `infoRequestParam` | `MasterPlayerResponseData` | Flow đọc tổng hợp quan trọng nhất | `Ok`, `MasterPlayerNotFound` |
|
|
85
|
+
| `getPlayerStatisticsAsync` | Cần đọc statistics theo key | `userId?`, `playerStatisticsKeys?` | `MasterPlayerResponseData` | Không dùng `infoRequestParam` | `Ok`, `MasterPlayerNotFound` |
|
|
86
|
+
| `getSegmentAsync` | Cần đọc segment | `userId?` | `MasterPlayerResponseData` | Kết quả ở `infoResponseParameters.segments` | `Ok`, `MasterPlayerNotFound` |
|
|
87
|
+
| `getTagAsync` | Cần đọc tag theo key | `userId?`, `tagKeys` | `MasterPlayerResponseData` | Không query theo value | `Ok`, `MasterPlayerNotFound` |
|
|
88
|
+
| `getTsCreateAsync` | Cần đọc thời điểm tạo account | `userId?` | `MasterPlayerResponseData` | Kết quả ở `infoResponseParameters.tsCreate` | `Ok`, `MasterPlayerNotFound` |
|
|
89
|
+
| `getTsLastLoginAsync` | Cần đọc lần login gần nhất | `userId?` | `MasterPlayerResponseData` | Kết quả ở `infoResponseParameters.tsLastLogin` | `Ok`, `MasterPlayerNotFound` |
|
|
90
|
+
| `getPushNotificationAsync` | Cần đọc danh sách push token đã đăng ký | `userId?` | `MasterPlayerResponseData` | Dữ liệu nằm ở `infoResponseParameters.pushNotifications`, không phải `results` | `Ok`, `MasterPlayerNotFound` |
|
|
91
|
+
|
|
92
|
+
### Search player, leaderboard và log
|
|
93
|
+
|
|
94
|
+
| Method | Dùng khi nào | Cần truyền gì | Nhận được gì | Ghi chú | ErrorCode
|
|
95
|
+
| --- | --- | --- | --- | --- | --- |
|
|
96
|
+
| `getPlayersWithAppleAsync` | Tìm player theo `appleId` | `appleIds[]`, `infoRequestParam` | `GetPlayersWithAppleResponseData` | Mỗi phần tử trả `appleId`, `userId`, `infoResponseParameters` | `Ok` |
|
|
97
|
+
| `getPlayersWithFacebookAsync` | Tìm player theo `facebookId` | `facebookIds[]`, `infoRequestParam` | `GetPlayersWithFacebookResponseData` | Không dùng cho Google | `Ok` |
|
|
98
|
+
| `getPlayersWithGenericServiceAsync` | Tìm player theo external service tự định nghĩa | `serviceName`, `genericIds[]`, `infoRequestParam` | `GetPlayersWithGenericServiceResponseData` | Dùng khi backend quản external provider riêng | `Ok` |
|
|
99
|
+
| `getPlayersWithGoogleAsync` | Tìm player theo `googleId` | `googleIds[]`, `infoRequestParam` | `GetPlayersWithGoogleResponseData` | Không dùng cho Google Play Games | `Ok` |
|
|
100
|
+
| `getPlayersWithGooglePlayGameServiceAsync` | Tìm player theo Google Play Games `playerId` | `playerIds[]`, `infoRequestParam` | `GetPlayersWithGooglePlayGameServiceResponseData` | Khác với Google account thường | `Ok` |
|
|
101
|
+
| `getPlayersWithGameCenterAsync` | Tìm player theo Game Center `playerId` | `playerIds[]`, `infoRequestParam` | `GetPlayersWithGameCenterResponseData` | Chỉ dành cho Apple Game Center | `Ok` |
|
|
102
|
+
| `getPlayersWithDisplayNameAsync` | Tìm player theo tên hiển thị | `keyword`, `infoRequestParam`, `skip?`, `limit?` | `MasterPlayersWithUserIdResponseData` | Phân trang bằng `skip/limit` | `Ok` |
|
|
103
|
+
| `getPlayersWithSegmentAsync` | Tìm player theo segment | `value`, `infoRequestParam`, `skip?`, `limit?` | `MasterPlayersWithUserIdResponseData` | Query theo exact segment value | `Ok` |
|
|
104
|
+
| `getPlayersWithTagAsync` | Tìm player theo tag | `key`, `value`, `infoRequestParam`, `skip?`, `limit?` | `MasterPlayersWithUserIdResponseData` | Query theo cặp `key/value` | `Ok`, `KeyNotFound` |
|
|
105
|
+
| `getStatisticsLeaderboardAroundPlayerAsync` | Cần bảng xếp hạng quanh một player cụ thể | `userId?`, `key`, `infoRequestParam`, `skip?`, `limit?`, `loadFromCache?` | `GetStatisticsLeaderboardResponseData` | Ở `server/admin` phải truyền `userId` | `Ok`, `KeyNotFound` |
|
|
106
|
+
| `getStatisticsLeaderboardAsync` | Cần bảng xếp hạng statistics toàn cục theo key | `key`, `infoRequestParam`, `skip?`, `limit?`, `loadFromCache?`, `version?` | `GetStatisticsLeaderboardResponseData` | `version` chỉ có ở method này | `Ok`, `KeyNotFound`, `VersionInvalid` |
|
|
107
|
+
| `getCurrencyLeaderboardAsync` | Cần bảng xếp hạng currency theo key | `key`, `infoRequestParam`, `skip?`, `limit?`, `loadFromCache?` | `GetCurrencyLeaderboardResponseData` | Không có `version` | `Ok`, `KeyNotFound` |
|
|
108
|
+
| `getCreateLeaderboardAsync` | Cần bảng xếp hạng theo thời điểm tạo account | `infoRequestParam`, `skip?`, `limit?`, `loadFromCache?` | `GetCreateLeaderboardResponseData` | Không cần `key` | `Ok` |
|
|
109
|
+
| `getLastLoginLeaderboardAsync` | Cần bảng xếp hạng theo lần login gần nhất | `infoRequestParam`, `skip?`, `limit?`, `loadFromCache?` | `GetLastLoginLeaderboardResponseData` | Không cần `key` | `Ok` |
|
|
110
|
+
| `getStatisticsLogAsync` | Cần audit statistics log | `keys?`, `userId?`, `limit?`, `token?` | `GetStatisticsLogResponseData` | Phân trang bằng `token` | `Ok` |
|
|
111
|
+
| `getCurrencyLogAsync` | Cần audit currency log | `keys?`, `userId?`, `limit?`, `token?` | `GetCurrencyLogResponseData` | Phân trang bằng `token` | `Ok` |
|
|
112
|
+
|
|
113
|
+
### Link và unlink identity
|
|
114
|
+
|
|
115
|
+
| Method | Dùng khi nào | Cần truyền gì | Nhận được gì | Ghi chú | ErrorCode
|
|
116
|
+
| --- | --- | --- | --- | --- | --- |
|
|
117
|
+
| `linkAccountAsync` | Link account/password truyền thống | `userId?`, `username`, `password`, `forceLink?` | `MasterPlayerResponseData` | Dùng khi muốn gắn username/password vào player hiện tại | `Ok`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
118
|
+
| `linkCustomIdAsync` | Link custom id của hệ thống riêng | `userId?`, `customId`, `forceLink?` | `MasterPlayerResponseData` | Không phải device id | `Ok`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
119
|
+
| `linkAppleAsync` | Link Apple Sign-In | `userId?`, `token`, `forceLink?` | `MasterPlayerResponseData` | Token đến từ Apple login flow | `Ok`, `VerifyTokenError`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
120
|
+
| `linkFacebookAsync` | Link Facebook login | `userId?`, `token`, `forceLink?` | `MasterPlayerResponseData` | Không dùng cho Google | `Ok`, `VerifyTokenError`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
121
|
+
| `linkGoogleAsync` | Link Google account | `userId?`, `token`, `type`, `forceLink?` | `MasterPlayerResponseData` | `type` phải map bằng `GoogleLoginType` | `Ok`, `VerifyTokenError`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
122
|
+
| `linkGooglePlayGameServiceAsync` | Link Google Play Games | `userId?`, `token`, `forceLink?` | `MasterPlayerResponseData` | Khác với Google account thường | `Ok`, `VerifyTokenError`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
123
|
+
| `linkGameCenterAsync` | Link Game Center | `userId?`, `playerId`, `name`, `publicKeyUrl`, `signature`, `salt`, `timestamp`, `forceLink?` | `MasterPlayerResponseData` | Cần full verification bundle | `Ok`, `VerifyTokenError`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
124
|
+
| `linkGenericServiceAsync` | Link external provider tự định nghĩa | `userId?`, `serviceName`, `serviceData`, `forceLink?` | `GenericServiceMasterPlayerResponseData` | Có thể có `errorMessage` ở response | `Ok`, `VerifyFailed`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
125
|
+
| `linkCustomDeviceIdAsync` | Link custom device id | `userId?`, `customDeviceId`, `forceLink?` | `MasterPlayerResponseData` | Thuộc nhóm device | `Ok`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
126
|
+
| `linkAndroidDeviceIdAsync` | Link Android device id | `userId?`, `androidDeviceId`, `forceLink?` | `MasterPlayerResponseData` | Thuộc nhóm device | `Ok`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
127
|
+
| `linkiOSDeviceIdAsync` | Link iOS device id | `userId?`, `iOSDeviceId`, `forceLink?` | `MasterPlayerResponseData` | Thuộc nhóm device | `Ok`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
128
|
+
| `linkWindowsPhoneDeviceIdAsync` | Link Windows Phone device id | `userId?`, `windowsPhoneDeviceId`, `forceLink?` | `MasterPlayerResponseData` | Thuộc nhóm device | `Ok`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
129
|
+
| `linkWindowsDeviceIdAsync` | Link Windows device id | `userId?`, `windowsDeviceId`, `forceLink?` | `MasterPlayerResponseData` | Thuộc nhóm device | `Ok`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
130
|
+
| `linkLinuxDeviceIdAsync` | Link Linux device id | `userId?`, `linuxDeviceId`, `forceLink?` | `MasterPlayerResponseData` | Thuộc nhóm device | `Ok`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
131
|
+
| `linkMacOSDeviceIdAsync` | Link macOS device id | `userId?`, `macOSDeviceId`, `forceLink?` | `MasterPlayerResponseData` | Thuộc nhóm device | `Ok`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
132
|
+
| `linkEditorDeviceIdAsync` | Link editor device id | `userId?`, `editorDeviceId`, `forceLink?` | `MasterPlayerResponseData` | Hữu ích cho dev/editor flow | `Ok`, `ExternalLinkedOtherAccount`, `ExternalLinkedOtherValue`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
133
|
+
| `unlinkAccountAsync` | Gỡ account/password đã link | `userId?`, `username` | `EmptyResponseData` | Không cần password ở flow unlink | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
134
|
+
| `unlinkCustomIdAsync` | Gỡ custom id | `userId?`, `customId` | `EmptyResponseData` | | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
135
|
+
| `unlinkAppleAsync` | Gỡ Apple identity | `userId?`, `appleId` | `EmptyResponseData` | | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
136
|
+
| `unlinkFacebookAsync` | Gỡ Facebook identity | `userId?`, `facebookId` | `EmptyResponseData` | | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
137
|
+
| `unlinkGoogleAsync` | Gỡ Google identity | `userId?`, `googleId` | `EmptyResponseData` | | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
138
|
+
| `unlinkGooglePlayGameServiceAsync` | Gỡ Google Play Games identity | `userId?`, `playerId` | `EmptyResponseData` | | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
139
|
+
| `unlinkGameCenterAsync` | Gỡ Game Center identity | `userId?`, `playerId` | `EmptyResponseData` | | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
140
|
+
| `unlinkGenericServiceAsync` | Gỡ external provider tự định nghĩa | `userId?`, `serviceName`, `serviceId` | `EmptyResponseData` | Cần đúng cặp `serviceName/serviceId` | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
141
|
+
| `unlinkCustomDeviceIdAsync` | Gỡ custom device id | `userId?`, `customDeviceId` | `EmptyResponseData` | Thuộc nhóm device | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
142
|
+
| `unlinkAndroidDeviceIdAsync` | Gỡ Android device id | `userId?`, `androidDeviceId` | `EmptyResponseData` | Thuộc nhóm device | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
143
|
+
| `unlinkiOSDeviceIdAsync` | Gỡ iOS device id | `userId?`, `iOSDeviceId` | `EmptyResponseData` | Thuộc nhóm device | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
144
|
+
| `unlinkWindowsPhoneDeviceIdAsync` | Gỡ Windows Phone device id | `userId?`, `windowsPhoneDeviceId` | `EmptyResponseData` | Thuộc nhóm device | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
145
|
+
| `unlinkWindowsDeviceIdAsync` | Gỡ Windows device id | `userId?`, `windowsDeviceId` | `EmptyResponseData` | Thuộc nhóm device | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
146
|
+
| `unlinkLinuxDeviceIdAsync` | Gỡ Linux device id | `userId?`, `linuxDeviceId` | `EmptyResponseData` | Thuộc nhóm device | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
147
|
+
| `unlinkMacOSDeviceIdAsync` | Gỡ macOS device id | `userId?`, `macOSDeviceId` | `EmptyResponseData` | Thuộc nhóm device | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
148
|
+
| `unlinkEditorDeviceIdAsync` | Gỡ editor device id | `userId?`, `editorDeviceId` | `EmptyResponseData` | Thuộc nhóm device | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
149
|
+
|
|
150
|
+
### Mutation hồ sơ, account và outbound operation
|
|
151
|
+
|
|
152
|
+
| Method | Dùng khi nào | Cần truyền gì | Nhận được gì | Ghi chú | ErrorCode
|
|
153
|
+
| --- | --- | --- | --- | --- | --- |
|
|
154
|
+
| `addSegmentAsync` | Gắn thêm segment | `userId?`, `value` | `EmptyResponseData` | Thêm một segment value | `Ok`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
155
|
+
| `removeSegmentAsync` | Gỡ segment | `userId?`, `value` | `EmptyResponseData` | Xóa theo exact value | `Ok`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
156
|
+
| `setTagAsync` | Set hoặc upsert tag | `userId?`, `key`, `value` | `EmptyResponseData` | | `Ok`, `KeyNotFound`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
157
|
+
| `removeTagAsync` | Xóa tag theo key | `userId?`, `key` | `EmptyResponseData` | Không truyền `value` | `Ok`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
158
|
+
| `setAvatarAsync` | Set avatar | `userId?`, `type`, `value` | `EmptyResponseData` | `type` chưa có enum public | `Ok`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
159
|
+
| `setCountryCodeAsync` | Set country code | `userId?`, `countryCode` | `EmptyResponseData` | | `Ok`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
160
|
+
| `setCustomDataAsync` | Set custom data theo nhiều key | `userId?`, `customDatas[]` | `MasterPlayerResponseData` | | `Ok`, `KeyNotFound`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
161
|
+
| `setDisplayNameAsync` | Set display name | `userId?`, `displayName`, `uniqueDisplayName?` | `EmptyResponseData` | Có option ép unique | `Ok`, `MasterPlayerNotFound`, `DisplayNameUsed`, `PlayerBan` |
|
|
162
|
+
| `setEmailAsync` | Set email | `userId?`, `email` | `EmptyResponseData` | | `Ok`, `MasterPlayerNotFound`, `PlayerBan`, `EmailInvalid` |
|
|
163
|
+
| `setPlayerBanAsync` | Ban player đến thời điểm cụ thể | `userId?`, `tsExpire`, `reason` | `EmptyResponseData` | Nên dùng ở backend/admin | `Ok`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
164
|
+
| `changePlayerCurrencyAsync` | Cộng/trừ currency | `userId?`, `playerCurrencies[]`, `log?` | `MasterPlayerResponseData` | Đây là delta change | `Ok`, `NotEnoughCurrency`, `KeyNotFound`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
165
|
+
| `setPlayerDataAsync` | Set player data theo nhiều key | `userId?`, `playerDatas[]` | `MasterPlayerResponseData` | | `Ok`, `KeyNotFound`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
166
|
+
| `changePlayerStatisticsAsync` | Cộng/trừ statistics | `userId?`, `playerStatistics[]`, `log?` | `MasterPlayerResponseData` | Đây là delta change | `Ok`, `KeyNotFound`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
167
|
+
| `updateTsLastLoginAsync` | Cập nhật timestamp last login | `userId?` | `EmptyResponseData` | Không refresh session | `Ok`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
168
|
+
| `changeAccountPasswordAsync` | Đổi password có xác thực password cũ | `userId?`, `currentPassword`, `password` | `EmptyResponseData` | Flow an toàn hơn nếu user biết password hiện tại | `Ok`, `AccountPasswordWrong`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
169
|
+
| `resetAccountPasswordAsync` | Reset password không cần password cũ | `userId?`, `password` | `EmptyResponseData` | Nên ưu tiên backend/admin | `Ok`, `ExternalNotLinked`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
170
|
+
| `sendSocketOperationEventAsync` | Yêu cầu backend đẩy socket event tới player | `userId?`, `eventCode`, `eventParameters?` | `EmptyResponseData` | Bản thân method vẫn là HTTP | `Ok`, `PlayerBan` |
|
|
171
|
+
| `sendEmailAsync` | Gửi email tới player | `userId?`, `subject`, `contentHtml` | `EmptyResponseData` | Nên ưu tiên backend/admin | `Ok`, `AccountNotFound`, `PlayerBan`, `EmailInvalid` |
|
|
172
|
+
| `addPushNotificationAsync` | Đăng ký một push token mới | `userId?`, `token`, `platformType` | `AddPushNotificationResponseData` | `platformType` map bằng `PushPlatformType` | `Ok`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
173
|
+
| `removePushNotificationAsync` | Xóa một push registration | `userId?`, `pushId` | `EmptyResponseData` | `pushId` lấy từ `addPushNotificationAsync` hoặc `getPushNotificationAsync` | `Ok`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
174
|
+
| `sendPushNotificationAsync` | Gửi push notification tới player | `userId?`, `title`, `body`, `badge?`, `sound?`, `icon?`, `data?` | `SendPushNotificationResponseData` | Response có `message` | `Ok`, `MasterPlayerNotFound`, `PlayerBan` |
|
|
175
|
+
|
|
176
|
+
## 5. Enum Và Reference
|
|
177
|
+
|
|
178
|
+
- DTO fields: [reference/dto/MASTER_PLAYER.md](../reference/dto/MASTER_PLAYER.md). Method table: [reference/API_MASTER_PLAYER.md](../reference/API_MASTER_PLAYER.md).
|
|
179
|
+
- Enums: [GoogleLoginType](../reference/ENUMS.md#googlelogintype), [PushPlatformType](../reference/ENUMS.md#pushplatformtype).
|
|
180
|
+
- Fallback `dist` chỉ khi reference docs chưa đủ: `dist/runtime/entity/models/MasterPlayer*.d.ts`, `dist/runtime/entity/models/GenericModels.d.ts`.
|
|
181
|
+
- `LinkGoogleRequestData.type` nên map bằng `GoogleLoginType`.
|
|
182
|
+
- `AddPushNotificationRequestData.platformType` và `PushNotificationItem.platformType` nên map bằng `PushPlatformType`.
|
|
183
|
+
- `SetAvatarRequestData.type` và `InfoResponseParameters.avatar.type` hiện chưa có enum public tương ứng.
|
|
184
|
+
|
|
185
|
+
## 6. InfoRequestParam Rules
|
|
186
|
+
|
|
187
|
+
`MasterPlayerModels.InfoRequestParam` điều khiển payload trả về trong:
|
|
188
|
+
|
|
189
|
+
- `getPlayerInformationAsync`
|
|
190
|
+
- `getPlayersWithAppleAsync`
|
|
191
|
+
- `getPlayersWithFacebookAsync`
|
|
192
|
+
- `getPlayersWithGenericServiceAsync`
|
|
193
|
+
- `getPlayersWithGoogleAsync`
|
|
194
|
+
- `getPlayersWithGooglePlayGameServiceAsync`
|
|
195
|
+
- `getPlayersWithGameCenterAsync`
|
|
196
|
+
- `getPlayersWithDisplayNameAsync`
|
|
197
|
+
- `getPlayersWithSegmentAsync`
|
|
198
|
+
- `getPlayersWithTagAsync`
|
|
199
|
+
- `getStatisticsLeaderboardAroundPlayerAsync`
|
|
200
|
+
- `getStatisticsLeaderboardAsync`
|
|
201
|
+
- `getCurrencyLeaderboardAsync`
|
|
202
|
+
- `getCreateLeaderboardAsync`
|
|
203
|
+
- `getLastLoginLeaderboardAsync`
|
|
204
|
+
|
|
205
|
+
Rule cứng:
|
|
206
|
+
|
|
207
|
+
- Không truyền `null`.
|
|
208
|
+
- Không bật toàn bộ field một cách mù quáng.
|
|
209
|
+
- Chỉ bật field mà màn hình hoặc flow hiện tại thật sự cần.
|
|
210
|
+
- Nếu cần filter dữ liệu con, dùng đúng field filter:
|
|
211
|
+
- `playerDataKeys`
|
|
212
|
+
- `playerCurrencyKeys`
|
|
213
|
+
- `playerStatisticsKeys`
|
|
214
|
+
- `customDataKeys`
|
|
215
|
+
- `tagKeys`
|
|
216
|
+
- Nếu chỉ cần một field nhỏ như email, display name, player data hay statistics, ưu tiên getter chuyên biệt.
|
|
217
|
+
|
|
218
|
+
Các field thường dùng:
|
|
219
|
+
|
|
220
|
+
- `external`
|
|
221
|
+
- `segments`
|
|
222
|
+
- `customDatas`
|
|
223
|
+
- `displayName`
|
|
224
|
+
- `avatar`
|
|
225
|
+
- `tsCreate`
|
|
226
|
+
- `tags`
|
|
227
|
+
- `playerBan`
|
|
228
|
+
- `playerCurrencies`
|
|
229
|
+
- `playerStatistics`
|
|
230
|
+
- `playerDatas`
|
|
231
|
+
- `ipAddressCreate`
|
|
232
|
+
- `countryCode`
|
|
233
|
+
- `email`
|
|
234
|
+
- `tsLastLogin`
|
|
235
|
+
- `pushNotifications`
|
|
236
|
+
|
|
237
|
+
## 7. Decision Rules
|
|
238
|
+
|
|
239
|
+
- Cần đọc nhiều field profile trong một lần gọi: dùng `getPlayerInformationAsync`.
|
|
240
|
+
- Cần đọc đúng một field nhỏ: ưu tiên getter chuyên biệt như `getDisplayNameAsync`, `getEmailAsync`, `getPlayerDataAsync`.
|
|
241
|
+
- Cần tìm player theo external identity cụ thể: chọn đúng method theo provider, không được dùng lẫn Apple, Google, Google Play Games, Facebook, Game Center, Generic Service.
|
|
242
|
+
- Cần đọc leaderboard quanh một player cụ thể: dùng `getStatisticsLeaderboardAroundPlayerAsync`.
|
|
243
|
+
- Cần leaderboard statistics toàn cục: dùng `getStatisticsLeaderboardAsync`.
|
|
244
|
+
- Cần leaderboard theo currency: dùng `getCurrencyLeaderboardAsync`.
|
|
245
|
+
- Cần leaderboard theo thời điểm tạo account: dùng `getCreateLeaderboardAsync`.
|
|
246
|
+
- Cần leaderboard theo lần login gần nhất: dùng `getLastLoginLeaderboardAsync`.
|
|
247
|
+
- Cần link identity mới vào current player: dùng nhóm `link*Async`.
|
|
248
|
+
- Cần gỡ identity đã link: dùng nhóm `unlink*Async`.
|
|
249
|
+
- Cần đổi password khi user biết password hiện tại: dùng `changeAccountPasswordAsync`.
|
|
250
|
+
- Cần reset password từ backend/admin: dùng `resetAccountPasswordAsync`.
|
|
251
|
+
- Cần delta currency hoặc statistics: dùng `changePlayerCurrencyAsync` hoặc `changePlayerStatisticsAsync`.
|
|
252
|
+
- Cần push token registration: dùng `addPushNotificationAsync`.
|
|
253
|
+
- Cần lấy push token list hiện tại: dùng `getPushNotificationAsync`.
|
|
254
|
+
- Cần gửi dữ liệu realtime vào socket của player: dùng `sendSocketOperationEventAsync`, nhưng phải nhớ receiver cần có socket session hợp lệ.
|
|
255
|
+
|
|
256
|
+
## 8. Response Rules
|
|
257
|
+
|
|
258
|
+
Tất cả typed response của `MasterPlayerApi` đều có:
|
|
259
|
+
|
|
260
|
+
- `returnCode`
|
|
261
|
+
- `debugMessage`
|
|
262
|
+
- `invalidMembers`
|
|
263
|
+
- `errorCode`
|
|
264
|
+
- `responseData`
|
|
265
|
+
|
|
266
|
+
Rule kiểm tra response:
|
|
267
|
+
|
|
268
|
+
```ts
|
|
269
|
+
if (response.hasReturnCodeError()) {
|
|
270
|
+
throw new Error(response.debugMessage);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (response.errorCode !== ErrorCode.Ok) {
|
|
274
|
+
throw new Error(`Business error: ${response.errorCode}`);
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Những response chính AI cần nhớ:
|
|
279
|
+
|
|
280
|
+
- Hầu hết getter đơn lẻ trả `MasterPlayerResponseData` và dữ liệu nằm trong `responseData.infoResponseParameters`.
|
|
281
|
+
- `getPlayersWithDisplayNameAsync`, `getPlayersWithSegmentAsync`, `getPlayersWithTagAsync` trả `responseData.results`, mỗi phần tử có `userId` và `infoResponseParameters`.
|
|
282
|
+
- `getPlayersWithAppleAsync`, `getPlayersWithFacebookAsync`, `getPlayersWithGoogleAsync`, `getPlayersWithGenericServiceAsync`, `getPlayersWithGooglePlayGameServiceAsync`, `getPlayersWithGameCenterAsync` trả `results` kèm identifier của provider.
|
|
283
|
+
- `getStatisticsLeaderboardAroundPlayerAsync`, `getStatisticsLeaderboardAsync`, `getCurrencyLeaderboardAsync`, `getCreateLeaderboardAsync`, `getLastLoginLeaderboardAsync` trả `responseData.results` với `userId`, `position`, `backupValue?`, `infoResponseParameters`.
|
|
284
|
+
- `getStatisticsLeaderboardAsync` còn có thêm `responseData.tsCreate`.
|
|
285
|
+
- `getStatisticsLogAsync` và `getCurrencyLogAsync` trả `responseData.results` và có thể có `responseData.token`.
|
|
286
|
+
- `linkGenericServiceAsync` trả `GenericServiceMasterPlayerResponseData`; ngoài `infoResponseParameters` còn có thể có `errorMessage`.
|
|
287
|
+
- `getPushNotificationAsync` trả `MasterPlayerResponseData`; danh sách push nằm ở `responseData.infoResponseParameters.pushNotifications`.
|
|
288
|
+
- `addPushNotificationAsync` trả `AddPushNotificationResponseData` với `pushId`.
|
|
289
|
+
- `sendPushNotificationAsync` trả `SendPushNotificationResponseData` với `message`.
|
|
290
|
+
- `addSegmentAsync`, `removeSegmentAsync`, `setTagAsync`, `removeTagAsync`, `changeAccountPasswordAsync`, `resetAccountPasswordAsync`, `setAvatarAsync`, `setCountryCodeAsync`, `setDisplayNameAsync`, `setEmailAsync`, `setPlayerBanAsync`, `updateTsLastLoginAsync`, toàn bộ `unlink*Async`, `sendSocketOperationEventAsync`, `sendEmailAsync`, `removePushNotificationAsync` trả `EmptyResponseData`.
|
|
291
|
+
- `setCustomDataAsync`, `changePlayerCurrencyAsync`, `setPlayerDataAsync`, `changePlayerStatisticsAsync` và đa số `link*Async` trả `MasterPlayerResponseData`.
|
|
292
|
+
|
|
293
|
+
## 9. Cảnh Báo Implementation Hiện Tại
|
|
294
|
+
|
|
295
|
+
- Public package hiện không export event handler socket riêng cho `MasterPlayerApi`.
|
|
296
|
+
- Nếu bạn cần nhận socket event do `sendSocketOperationEventAsync` phát ra, bạn phải dựa vào hệ event socket chung ở tầng khác hoặc spec backend riêng.
|
|
297
|
+
- `setAvatarAsync` và `InfoResponseParameters.avatar.type` vẫn dùng số thô, chưa có enum public tương ứng.
|
|
298
|
+
- `linkGenericServiceAsync` là case đặc biệt vì response data có thể chứa `errorMessage`.
|
|
299
|
+
- `getPushNotificationAsync` không trả `results`; dữ liệu nằm trong `infoResponseParameters.pushNotifications`.
|
|
300
|
+
- Package có expose `sendEmailAsync`, `sendPushNotificationAsync`, `sendSocketOperationEventAsync` ở cả `client`, `server`, `admin`, nhưng trong production nên ưu tiên `server/admin` cho các flow có trust boundary cao.
|
|
301
|
+
|
|
302
|
+
## 10. Best Practices
|
|
303
|
+
|
|
304
|
+
- Dùng getter chuyên biệt khi chỉ cần một field nhỏ.
|
|
305
|
+
- Với query lớn, giữ `infoRequestParam` tối giản để giảm payload.
|
|
306
|
+
- Trong app public, ưu tiên self-flow và tránh để client trực tiếp gọi các operation ops-heavy như email/push nếu không có lý do rõ ràng.
|
|
307
|
+
- Với `changePlayerCurrencyAsync` và `changePlayerStatisticsAsync`, luôn truyền `log` nếu flow cần audit.
|
|
308
|
+
- Với `getCurrencyLogAsync` và `getStatisticsLogAsync`, nên truyền ít nhất `keys` hoặc `userId` trong production để tránh query quá rộng.
|
|
309
|
+
- Với `forceLink`, chỉ bật khi flow ownership merge/reclaim đã được thiết kế rõ.
|
|
310
|
+
- Với `linkGameCenterAsync`, chuẩn bị đầy đủ verification bundle từ platform trước khi gọi SDK.
|
|
311
|
+
- Với `sendSocketOperationEventAsync`, chỉ dùng khi bạn biết receiver đang connect socket và đã auth socket thành công.
|
|
312
|
+
|
|
313
|
+
## 11. Ví Dụ Khuyến Nghị
|
|
314
|
+
|
|
315
|
+
### Đọc thông tin master player hiện tại với `infoRequestParam` tối giản
|
|
316
|
+
|
|
317
|
+
```ts
|
|
318
|
+
import {
|
|
319
|
+
ErrorCode,
|
|
320
|
+
GNNetwork,
|
|
321
|
+
MasterPlayerModels,
|
|
322
|
+
} from "@xmobitea/gn-typescript-client";
|
|
323
|
+
|
|
324
|
+
const infoRequestParam = new MasterPlayerModels.InfoRequestParam();
|
|
325
|
+
infoRequestParam.displayName = true;
|
|
326
|
+
infoRequestParam.email = true;
|
|
327
|
+
infoRequestParam.playerCurrencies = true;
|
|
328
|
+
infoRequestParam.playerCurrencyKeys = ["gold"];
|
|
329
|
+
|
|
330
|
+
const request = new MasterPlayerModels.GetPlayerInformationRequestData();
|
|
331
|
+
request.infoRequestParam = infoRequestParam;
|
|
332
|
+
|
|
333
|
+
const response = await GNNetwork.masterPlayer.getPlayerInformationAsync(request);
|
|
334
|
+
|
|
335
|
+
if (response.hasReturnCodeError()) {
|
|
336
|
+
throw new Error(response.debugMessage);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (response.errorCode !== ErrorCode.Ok) {
|
|
340
|
+
throw new Error(`Business error: ${response.errorCode}`);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const playerInfo = response.responseData.infoResponseParameters;
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Link Google account với `GoogleLoginType`
|
|
347
|
+
|
|
348
|
+
```ts
|
|
349
|
+
import {
|
|
350
|
+
ErrorCode,
|
|
351
|
+
GNNetwork,
|
|
352
|
+
GoogleLoginType,
|
|
353
|
+
MasterPlayerModels,
|
|
354
|
+
} from "@xmobitea/gn-typescript-client";
|
|
355
|
+
|
|
356
|
+
const request = new MasterPlayerModels.LinkGoogleRequestData();
|
|
357
|
+
request.token = "google-id-token";
|
|
358
|
+
request.type = GoogleLoginType.IdToken;
|
|
359
|
+
request.forceLink = false;
|
|
360
|
+
|
|
361
|
+
const response = await GNNetwork.masterPlayer.linkGoogleAsync(request);
|
|
362
|
+
|
|
363
|
+
if (response.hasReturnCodeError()) {
|
|
364
|
+
throw new Error(response.debugMessage);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (response.errorCode !== ErrorCode.Ok) {
|
|
368
|
+
throw new Error(`Business error: ${response.errorCode}`);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const playerInfo = response.responseData.infoResponseParameters;
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Backend đọc leaderboard quanh một player cụ thể
|
|
375
|
+
|
|
376
|
+
```ts
|
|
377
|
+
import {
|
|
378
|
+
ErrorCode,
|
|
379
|
+
GNNetwork,
|
|
380
|
+
MasterPlayerModels,
|
|
381
|
+
} from "@xmobitea/gn-typescript-client";
|
|
382
|
+
|
|
383
|
+
const infoRequestParam = new MasterPlayerModels.InfoRequestParam();
|
|
384
|
+
infoRequestParam.displayName = true;
|
|
385
|
+
|
|
386
|
+
const request = new MasterPlayerModels.ServerGetStatisticsLeaderboardAroundPlayerRequestData();
|
|
387
|
+
request.userId = "1234567890";
|
|
388
|
+
request.key = "rankScore";
|
|
389
|
+
request.infoRequestParam = infoRequestParam;
|
|
390
|
+
request.limit = 20;
|
|
391
|
+
|
|
392
|
+
const response = await GNNetwork.masterPlayer.server.getStatisticsLeaderboardAroundPlayerAsync(request);
|
|
393
|
+
|
|
394
|
+
if (response.hasReturnCodeError()) {
|
|
395
|
+
throw new Error(response.debugMessage);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (response.errorCode !== ErrorCode.Ok) {
|
|
399
|
+
throw new Error(`Business error: ${response.errorCode}`);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
const leaderboard = response.responseData.results;
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### Đăng ký push token với `PushPlatformType`
|
|
406
|
+
|
|
407
|
+
```ts
|
|
408
|
+
import {
|
|
409
|
+
ErrorCode,
|
|
410
|
+
GNNetwork,
|
|
411
|
+
MasterPlayerModels,
|
|
412
|
+
PushPlatformType,
|
|
413
|
+
} from "@xmobitea/gn-typescript-client";
|
|
414
|
+
|
|
415
|
+
const request = new MasterPlayerModels.AddPushNotificationRequestData();
|
|
416
|
+
request.token = "device-push-token";
|
|
417
|
+
request.platformType = PushPlatformType.Android;
|
|
418
|
+
|
|
419
|
+
const response = await GNNetwork.masterPlayer.addPushNotificationAsync(request);
|
|
420
|
+
|
|
421
|
+
if (response.hasReturnCodeError()) {
|
|
422
|
+
throw new Error(response.debugMessage);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (response.errorCode !== ErrorCode.Ok) {
|
|
426
|
+
throw new Error(`Business error: ${response.errorCode}`);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
const pushId = response.responseData.pushId;
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## 12. Anti-Patterns
|
|
433
|
+
|
|
434
|
+
- Không dùng `MasterPlayerApi` để thao tác game player, character player, group hoặc inventory item.
|
|
435
|
+
- Không chọn sai provider method khi search identity.
|
|
436
|
+
- Không bỏ `infoRequestParam` ở các method bắt buộc.
|
|
437
|
+
- Không dùng `skip` để phân trang `getCurrencyLogAsync` hoặc `getStatisticsLogAsync`.
|
|
438
|
+
- Không dùng `token` để phân trang `getPlayersWithDisplayNameAsync`, `getPlayersWithSegmentAsync`, `getPlayersWithTagAsync`.
|
|
439
|
+
- Không hardcode `type = 1` hoặc `type = 2` cho `linkGoogleAsync` khi package đã export `GoogleLoginType`.
|
|
440
|
+
- Không hardcode `platformType = 1` hoặc `2` cho push khi package đã export `PushPlatformType`.
|
|
441
|
+
- Không giả định `sendSocketOperationEventAsync` là thao tác gửi qua socket trực tiếp từ client.
|
|
442
|
+
- Không giả định `getPushNotificationAsync` trả `results`.
|
|
443
|
+
- Không bật `forceLink` một cách mù quáng.
|
|
444
|
+
- Không bỏ qua kiểm tra `hasReturnCodeError()` và `errorCode`.
|
|
445
|
+
|
|
446
|
+
## 13. AI Checklist
|
|
447
|
+
|
|
448
|
+
- Đã `GNNetwork.init(settings)` chưa.
|
|
449
|
+
- Đã chọn đúng namespace `masterPlayer` / `masterPlayer.server` / `masterPlayer.admin` chưa.
|
|
450
|
+
- Nếu đang ở `server/admin`, đã truyền `userId` cho flow self-target chưa.
|
|
451
|
+
- Nếu đang ở `client`, có thật sự muốn target current authenticated player không.
|
|
452
|
+
- Nếu method yêu cầu `infoRequestParam`, đã truyền object này chưa.
|
|
453
|
+
- Nếu đang đọc field nhỏ, có cần getter chuyên biệt thay vì `getPlayerInformationAsync` không.
|
|
454
|
+
- Nếu đang link Google, đã dùng `GoogleLoginType` chưa.
|
|
455
|
+
- Nếu đang đăng ký push token, đã dùng `PushPlatformType` chưa.
|
|
456
|
+
- Nếu đang lấy log, có dùng `token` cho page tiếp chưa.
|
|
457
|
+
- Nếu đang gửi socket event, receiver có socket session hợp lệ không.
|
|
458
|
+
- Có kiểm tra `hasReturnCodeError()` trước `errorCode` chưa.
|