@xmobitea/gn-typescript-client 2.6.13 → 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 +25056 -1056
- package/dist/gearn.js.client.min.js +1 -1
- package/dist/index.d.ts +30 -0
- package/dist/index.js +24236 -212
- 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 +12 -3
- package/GNServerSettings.debug.json +0 -21
- 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,433 @@
|
|
|
1
|
+
# Reference: Enums
|
|
2
|
+
|
|
3
|
+
Toàn bộ enum public export từ `@xmobitea/gn-typescript-client`. Mỗi bảng liệt kê tên, giá trị numeric thật, và ý nghĩa business.
|
|
4
|
+
|
|
5
|
+
**Rule cứng cho AI consumer:**
|
|
6
|
+
|
|
7
|
+
- So sánh giá trị bằng chính symbol của enum (`ReturnCode.Ok`), không hardcode số.
|
|
8
|
+
- Không giả định success là `0`. Success ở cả 2 tầng là `1` (`ReturnCode.Ok === 1`, `ErrorCode.Ok === 1`).
|
|
9
|
+
- Nếu backend trả về giá trị không có trong bảng này, xử lý như unknown và log lại; không suy diễn.
|
|
10
|
+
|
|
11
|
+
## Mục lục
|
|
12
|
+
|
|
13
|
+
- [ReturnCode](#returncode) — transport/gateway
|
|
14
|
+
- [ErrorCode](#errorcode) — business domain
|
|
15
|
+
- [RequestRole](#requestrole)
|
|
16
|
+
- [RequestType](#requesttype)
|
|
17
|
+
- [MessageType](#messagetype)
|
|
18
|
+
- [PostType](#posttype)
|
|
19
|
+
- [LogType](#logtype)
|
|
20
|
+
- [FriendStatus](#friendstatus)
|
|
21
|
+
- [GroupStatus](#groupstatus)
|
|
22
|
+
- [GoogleLoginType](#googlelogintype)
|
|
23
|
+
- [InvalidMemberType](#invalidmembertype)
|
|
24
|
+
- [ItemType](#itemtype)
|
|
25
|
+
- [OwnerType](#ownertype)
|
|
26
|
+
- [PushPlatformType](#pushplatformtype)
|
|
27
|
+
- [MatchmakingMemberStatus](#matchmakingmemberstatus)
|
|
28
|
+
- [MatchmakingTicketStatus](#matchmakingticketstatus)
|
|
29
|
+
- [MatchStatus](#matchstatus)
|
|
30
|
+
- [ExecuteResponseStatus](#executeresponsestatus)
|
|
31
|
+
- [StoreItemType](#storeitemtype)
|
|
32
|
+
- [StoreReceiveType](#storereceivetype)
|
|
33
|
+
- [PermissionDataItem](#permissiondataitem)
|
|
34
|
+
- [FieldDataType](#fielddatatype)
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## ReturnCode
|
|
39
|
+
|
|
40
|
+
Transport/gateway return code trả trong `OperationResponse.getReturnCode()`. **Luôn kiểm tra trước `errorCode`.**
|
|
41
|
+
|
|
42
|
+
Class import: `import { ReturnCode } from "@xmobitea/gn-typescript-client"` — các member là static readonly numbers.
|
|
43
|
+
|
|
44
|
+
| Name | Value | Meaning |
|
|
45
|
+
|------|-------|---------|
|
|
46
|
+
| `SecretInvalid` | -10 | Secret key sai / thiếu / không khớp route hoặc game context |
|
|
47
|
+
| `MaxSizeRequestReject` | -9 | Payload vượt size tối đa backend chấp nhận |
|
|
48
|
+
| `MaxRequestReject` | -8 | Caller vượt rate limit |
|
|
49
|
+
| `MaxCCUReject` | -7 | Vượt giới hạn concurrent user/session |
|
|
50
|
+
| `OperationNotAuthorized` | -6 | Operation tồn tại nhưng caller không đủ quyền với role/target |
|
|
51
|
+
| `InvalidRequestParameters` | -5 | Request shape hoặc field invalid; inspect `invalidMembers` |
|
|
52
|
+
| `OperationInvalid` | -4 | Operation code không tồn tại hoặc không hợp lệ với request type/role |
|
|
53
|
+
| `InternalServerError` | -3 | Backend lỗi unhandled trước khi produce valid business response |
|
|
54
|
+
| `OperationNotAllow` | -2 | Operation tồn tại + secret hợp lệ, nhưng permission rule không cho chạy ở target context |
|
|
55
|
+
| `OperationTimeout` | -1 | Request timeout; có thể do SDK timeout layer hoặc backend |
|
|
56
|
+
| `UnknownError` | 0 | Request fail, không có mapped return code cụ thể |
|
|
57
|
+
| `Ok` | 1 | Protocol-level thành công; vẫn phải check `errorCode` trong response |
|
|
58
|
+
|
|
59
|
+
Xem thêm: [ERROR_HANDLING.md](ERROR_HANDLING.md).
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## ErrorCode
|
|
64
|
+
|
|
65
|
+
Business domain error code, nằm trong response payload khi `returnCode === ReturnCode.Ok`. Chỉ trust khi đã pass tầng `ReturnCode`.
|
|
66
|
+
|
|
67
|
+
Class import: `import { ErrorCode } from "@xmobitea/gn-typescript-client"` — các member là static readonly numbers.
|
|
68
|
+
|
|
69
|
+
| Name | Value | Meaning | Typical context |
|
|
70
|
+
|------|-------|---------|-----------------|
|
|
71
|
+
| `Ok` | 1 | Business operation thành công | mọi response happy path |
|
|
72
|
+
| `AccountNotFound` | 2 | Username/account không tồn tại | login flows |
|
|
73
|
+
| `AccountPasswordWrong` | 3 | Password sai | login by account |
|
|
74
|
+
| `AccountUsernameExists` | 4 | Username đã tồn tại | register |
|
|
75
|
+
| `VerifyTokenError` | 5 | Token không verify/decode được | refresh token, social login |
|
|
76
|
+
| `VerifyFailed` | 6 | External/provider verification fail | social login, receipt |
|
|
77
|
+
| `CharacterPlayerNotFound` | 7 | Character player không tồn tại | character APIs |
|
|
78
|
+
| `NotEnoughCurrency` | 8 | Wallet/owner thiếu currency | store purchase, transfer |
|
|
79
|
+
| `KeyNotFound` | 9 | Key không tồn tại trong target data set | data/profile get |
|
|
80
|
+
| `ItemNotFound` | 10 | Inventory item không tồn tại | inventory APIs |
|
|
81
|
+
| `CatalogIdNotFound` | 11 | Catalog id không tồn tại | content/store |
|
|
82
|
+
| `GroupNotFound` | 12 | Group không tồn tại | group APIs |
|
|
83
|
+
| `OwnerNotFound` | 13 | Owner entity không tồn tại | cross-domain writes |
|
|
84
|
+
| `ClassIdNotFound` | 14 | Class id không tồn tại | content config |
|
|
85
|
+
| `MemberNotFound` | 15 | Group member / relation member không tồn tại | group / friend APIs |
|
|
86
|
+
| `PlayerNotMember` | 16 | Player không phải member của group | group write APIs |
|
|
87
|
+
| `GamePlayerNotFound` | 17 | Game player không tồn tại | game player APIs |
|
|
88
|
+
| `FileNotFound` | 18 | File metadata hoặc physical file không tồn tại | content APIs |
|
|
89
|
+
| `FileNotUpload` | 19 | File metadata tồn tại nhưng content chưa upload | content APIs |
|
|
90
|
+
| `OwnerTypeNotSupport` | 20 | Owner type không support cho operation | cross-domain writes |
|
|
91
|
+
| `ItemNotStackable` | 21 | Item không stackable, thao tác amount invalid | inventory APIs |
|
|
92
|
+
| `GameNotFound` | 22 | Game không tồn tại | dashboard APIs |
|
|
93
|
+
| `GameExists` | 23 | Game đã tồn tại (không tạo lại được) | dashboard create game |
|
|
94
|
+
| `SecretInfoNotFound` | 24 | Secret-info record không tồn tại | dashboard secret mgmt |
|
|
95
|
+
| `SecretInfoExists` | 25 | Secret-info record đã tồn tại | dashboard secret mgmt |
|
|
96
|
+
| `ExternalNotLinked` | 26 | External identity chưa link account hiện tại | external identity unlink |
|
|
97
|
+
| `ExternalLinkedOtherAccount` | 27 | External identity đã link account khác | external identity link |
|
|
98
|
+
| `ExternalLinkedOtherValue` | 28 | External provider/value pair conflict giá trị đã link | external identity link |
|
|
99
|
+
| `MasterPlayerNotFound` | 29 | Master player không tồn tại | master player APIs |
|
|
100
|
+
| `StoreItemNotFound` | 30 | Store item không tồn tại | store APIs |
|
|
101
|
+
| `BuyerNotFound` | 31 | Buyer entity không tồn tại | store buy/present |
|
|
102
|
+
| `CanNotBuyThisStoreItem` | 32 | Store item không mua được ở state/buyer hiện tại | store buy |
|
|
103
|
+
| `ExceptionWhenValidateReceipt` | 33 | Exception khi validate receipt | store receipt validate |
|
|
104
|
+
| `StoreInvalid` | 34 | Store/provider config invalid | store receipt validate |
|
|
105
|
+
| `ReceiptInvalid` | 35 | Receipt invalid | store receipt validate |
|
|
106
|
+
| `StoreItemRemoved` | 36 | Store item đã removed, không dùng purchase flow nữa | store APIs |
|
|
107
|
+
| `DisplayNameUsed` | 37 | Display name đã có người dùng | player profile update |
|
|
108
|
+
| `PlayerBan` | 38 | Player hiện bị ban | login / gameplay |
|
|
109
|
+
| `MatchmakingTicketNotFound` | 39 | Matchmaking ticket không tồn tại | multiplayer APIs |
|
|
110
|
+
| `MatchmakingTicketAlreadyCompleted` | 40 | Ticket đã completed, không modify được | multiplayer APIs |
|
|
111
|
+
| `MatchmakingPlayerNotJoinedTicket` | 41 | Player không phải member của ticket | multiplayer APIs |
|
|
112
|
+
| `MatchNotFound` | 42 | Match không tồn tại | multiplayer query match |
|
|
113
|
+
| `MatchmakingPlayerJoinedOtherTicket` | 43 | Player đã join ticket khác (conflict) | multiplayer create ticket |
|
|
114
|
+
| `MatchmakingQueueNotFound` | 44 | Matchmaking queue không tồn tại | multiplayer APIs |
|
|
115
|
+
| `TicketSizeError` | 45 | Ticket size vi phạm queue config | multiplayer create ticket |
|
|
116
|
+
| `ExecuteError` | 46 | CloudScript function fail khi execute | cloudscript execute |
|
|
117
|
+
| `VersionInvalid` | 47 | CloudScript version invalid/unavailable | cloudscript APIs |
|
|
118
|
+
| `EmailInvalid` | 48 | Email sai format/semantically invalid | register, profile update |
|
|
119
|
+
| `StoreItemPurchasedAndNonConsumable` | 49 | Buyer đã own non-consumable này rồi | store buy |
|
|
120
|
+
| `StoreItemExists` | 50 | Store item đã tồn tại (không tạo lại được) | dashboard store mgmt |
|
|
121
|
+
|
|
122
|
+
Xem thêm: [ERROR_HANDLING.md](ERROR_HANDLING.md).
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## RequestRole
|
|
127
|
+
|
|
128
|
+
Trust boundary của caller. Chọn route theo caller thật (client app / trusted backend / admin tool), không theo mối quan hệ với target.
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
export enum RequestRole {
|
|
132
|
+
Admin = 1,
|
|
133
|
+
Server = 2,
|
|
134
|
+
Client = 3,
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
| Name | Value | Meaning |
|
|
139
|
+
|------|-------|---------|
|
|
140
|
+
| `Admin` | 1 | Admin tool / backoffice / GM tool / migration tool |
|
|
141
|
+
| `Server` | 2 | Trusted backend: game server, internal service, worker, cron, webhook |
|
|
142
|
+
| `Client` | 3 | Player app / client code |
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## RequestType
|
|
147
|
+
|
|
148
|
+
Top-level domain phân loại route khi build transport path.
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
export enum RequestType {
|
|
152
|
+
Custom = 0,
|
|
153
|
+
Authenticate = 1,
|
|
154
|
+
CharacterPlayer = 2,
|
|
155
|
+
Content = 3,
|
|
156
|
+
GamePlayer = 4,
|
|
157
|
+
Group = 5,
|
|
158
|
+
Inventory = 6,
|
|
159
|
+
MasterPlayer = 7,
|
|
160
|
+
StoreInventory = 8,
|
|
161
|
+
Dashboard = 9,
|
|
162
|
+
Multiplayer = 10,
|
|
163
|
+
CloudScript = 11,
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
| Name | Value |
|
|
168
|
+
|------|-------|
|
|
169
|
+
| `Custom` | 0 |
|
|
170
|
+
| `Authenticate` | 1 |
|
|
171
|
+
| `CharacterPlayer` | 2 |
|
|
172
|
+
| `Content` | 3 |
|
|
173
|
+
| `GamePlayer` | 4 |
|
|
174
|
+
| `Group` | 5 |
|
|
175
|
+
| `Inventory` | 6 |
|
|
176
|
+
| `MasterPlayer` | 7 |
|
|
177
|
+
| `StoreInventory` | 8 |
|
|
178
|
+
| `Dashboard` | 9 |
|
|
179
|
+
| `Multiplayer` | 10 |
|
|
180
|
+
| `CloudScript` | 11 |
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## MessageType
|
|
185
|
+
|
|
186
|
+
Payload encoding preferred bởi transport.
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
export enum MessageType {
|
|
190
|
+
Json = 1,
|
|
191
|
+
MsgPack = 2,
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
| Name | Value | Notes |
|
|
196
|
+
|------|-------|-------|
|
|
197
|
+
| `Json` | 1 | Browser-safe mọi trường hợp |
|
|
198
|
+
| `MsgPack` | 2 | Compact binary; browser HTTP tự fallback sang JSON |
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## PostType
|
|
203
|
+
|
|
204
|
+
Low-level HTTP body encoding dùng bởi `HttpPeer`. App tích hợp thông thường không cần truyền trực tiếp enum này.
|
|
205
|
+
|
|
206
|
+
| Name | Value | Notes |
|
|
207
|
+
|------|-------|-------|
|
|
208
|
+
| `Json` | 0 | UTF-8 JSON request/response body |
|
|
209
|
+
| `MsgPack` | 1 | Binary MessagePack request/response body |
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## LogType
|
|
214
|
+
|
|
215
|
+
Verbosity cho `GNDebug`.
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
export enum LogType {
|
|
219
|
+
Off = 0,
|
|
220
|
+
Exception = 1,
|
|
221
|
+
Error = 2,
|
|
222
|
+
Warning = 3,
|
|
223
|
+
All = 4,
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
| Name | Value |
|
|
228
|
+
|------|-------|
|
|
229
|
+
| `Off` | 0 |
|
|
230
|
+
| `Exception` | 1 |
|
|
231
|
+
| `Error` | 2 |
|
|
232
|
+
| `Warning` | 3 |
|
|
233
|
+
| `All` | 4 |
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## FriendStatus
|
|
238
|
+
|
|
239
|
+
Lifecycle state của quan hệ bạn bè.
|
|
240
|
+
|
|
241
|
+
| Name | Value | Meaning |
|
|
242
|
+
|------|-------|---------|
|
|
243
|
+
| `Friend` | 1 | Đã là bạn |
|
|
244
|
+
| `WaitingAccept` | 2 | Đang chờ mình accept incoming request |
|
|
245
|
+
| `SentRequestAndWaitingAccept` | 3 | Mình đã gửi request, chờ bên kia accept |
|
|
246
|
+
| `NotFriend` | 4 | Không có quan hệ bạn bè |
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## GroupStatus
|
|
251
|
+
|
|
252
|
+
Lifecycle state của quan hệ group membership.
|
|
253
|
+
|
|
254
|
+
| Name | Value | Meaning |
|
|
255
|
+
|------|-------|---------|
|
|
256
|
+
| `Member` | 1 | Đã là member active |
|
|
257
|
+
| `WaitingAccept` | 2 | Đang chờ group accept join request từ bên mình |
|
|
258
|
+
| `SentRequestAndWaitingAccept` | 3 | Đã gửi join request, chờ group approve |
|
|
259
|
+
| `NotMember` | 4 | Chưa là member |
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## GoogleLoginType
|
|
264
|
+
|
|
265
|
+
Loại credential Google được cung cấp cho login/link flow.
|
|
266
|
+
|
|
267
|
+
| Name | Value | Meaning |
|
|
268
|
+
|------|-------|---------|
|
|
269
|
+
| `AccessToken` | 1 | OAuth access token |
|
|
270
|
+
| `IdToken` | 2 | OpenID Connect ID token |
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## InvalidMemberType
|
|
275
|
+
|
|
276
|
+
Category lỗi validation expose qua `res.invalidMembers`. Chỉ xuất hiện khi `res.returnCode === ReturnCode.InvalidRequestParameters`.
|
|
277
|
+
|
|
278
|
+
| Name | Value | Meaning |
|
|
279
|
+
|------|-------|---------|
|
|
280
|
+
| `UnknownError` | 1 | Không map được category cụ thể |
|
|
281
|
+
| `DataRequired` | 2 | Field required nhưng thiếu |
|
|
282
|
+
| `TypeInvalid` | 3 | Runtime type không match expected |
|
|
283
|
+
| `StringNull` | 4 | Required string null/empty |
|
|
284
|
+
| `StringMinLength` | 5 | String ngắn hơn min length |
|
|
285
|
+
| `StringMaxLength` | 6 | String dài hơn max length |
|
|
286
|
+
| `NumberMinValue` | 7 | Number thấp hơn min value |
|
|
287
|
+
| `NumberMaxValue` | 8 | Number cao hơn max value |
|
|
288
|
+
| `NumberMustInt` | 9 | Number phải integer nhưng nhận non-integer |
|
|
289
|
+
| `GNHashtableNull` | 10 | `GNHashtable` required null |
|
|
290
|
+
| `GNHashtableMinLength` | 11 | `GNHashtable` ít entry hơn min |
|
|
291
|
+
| `GNHashtableMaxLength` | 12 | `GNHashtable` nhiều entry hơn max |
|
|
292
|
+
| `GNArrayNull` | 13 | `GNArray` required null |
|
|
293
|
+
| `GNArrayMinLength` | 14 | `GNArray` ít item hơn min |
|
|
294
|
+
| `GNArrayMaxLength` | 15 | `GNArray` nhiều item hơn max |
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## ItemType
|
|
299
|
+
|
|
300
|
+
Kiểu inventory item hỗ trợ stacking hay không.
|
|
301
|
+
|
|
302
|
+
| Name | Value | Meaning |
|
|
303
|
+
|------|-------|---------|
|
|
304
|
+
| `NonStackable` | 1 | Mỗi instance unique, track riêng |
|
|
305
|
+
| `Stackable` | 2 | Nhiều unit gộp chung amount |
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## OwnerType
|
|
310
|
+
|
|
311
|
+
Top-level entity owner của resource.
|
|
312
|
+
|
|
313
|
+
| Name | Value | Meaning |
|
|
314
|
+
|------|-------|---------|
|
|
315
|
+
| `MasterPlayer` | 1 | Master-player account |
|
|
316
|
+
| `GamePlayer` | 2 | Game-player entity |
|
|
317
|
+
| `CharacterPlayer` | 3 | Character-player entity |
|
|
318
|
+
| `Group` | 4 | Group entity |
|
|
319
|
+
| `Inventory` | 5 | Inventory item khác |
|
|
320
|
+
| `StoreInventory` | 6 | Store-inventory entity |
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## PushPlatformType
|
|
325
|
+
|
|
326
|
+
Mobile push platform.
|
|
327
|
+
|
|
328
|
+
| Name | Value |
|
|
329
|
+
|------|-------|
|
|
330
|
+
| `Android` | 1 |
|
|
331
|
+
| `iOS` | 2 |
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## MatchmakingMemberStatus
|
|
336
|
+
|
|
337
|
+
State của 1 member trong matchmaking ticket.
|
|
338
|
+
|
|
339
|
+
| Name | Value | Meaning |
|
|
340
|
+
|------|-------|---------|
|
|
341
|
+
| `Pending` | 1 | Declared nhưng chưa join/confirm |
|
|
342
|
+
| `Joined` | 2 | Đã join ticket |
|
|
343
|
+
| `Canceled` | 3 | Hủy tham gia ticket |
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## MatchmakingTicketStatus
|
|
348
|
+
|
|
349
|
+
Lifecycle state của matchmaking ticket.
|
|
350
|
+
|
|
351
|
+
| Name | Value | Meaning |
|
|
352
|
+
|------|-------|---------|
|
|
353
|
+
| `WaitingForMembers` | 1 | Chờ tất cả member declared join |
|
|
354
|
+
| `WaitingForMatch` | 2 | Đủ member, chờ matchmaking engine tìm match |
|
|
355
|
+
| `WaitingForServer` | 3 | Đã có match, chờ server allocation |
|
|
356
|
+
| `Matched` | 4 | Complete → pointer sang match |
|
|
357
|
+
| `Canceled` | 5 | Ticket bị hủy, không produce match |
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## MatchStatus
|
|
362
|
+
|
|
363
|
+
Lifecycle state của match record sau khi matchmaking tạo match.
|
|
364
|
+
|
|
365
|
+
| Name | Value | Meaning |
|
|
366
|
+
|------|-------|---------|
|
|
367
|
+
| `WaitingForServer` | 1 | Match đã tạo nhưng server allocation chưa sẵn sàng |
|
|
368
|
+
| `Matched` | 2 | Server đã sẵn sàng; app có thể tiếp tục flow connect theo backend contract |
|
|
369
|
+
| `Canceled` | 3 | Match bị hủy trước khi hoàn tất |
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## ExecuteResponseStatus
|
|
374
|
+
|
|
375
|
+
Status CloudScript execute function.
|
|
376
|
+
|
|
377
|
+
| Name | Value | Meaning |
|
|
378
|
+
|------|-------|---------|
|
|
379
|
+
| `Ok` | 1 | Execute thành công |
|
|
380
|
+
| `Exception` | 2 | Execute nhưng function throw exception |
|
|
381
|
+
| `FunctionNameNotFound` | 3 | Function name không tồn tại trong version |
|
|
382
|
+
| `VersionInvalid` | 4 | Version invalid/không execute được |
|
|
383
|
+
| `Timeout` | 5 | Function vượt thời gian cho phép |
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## StoreItemType
|
|
388
|
+
|
|
389
|
+
Kiểu store item: mua 1 lần hay nhiều lần.
|
|
390
|
+
|
|
391
|
+
| Name | Value | Meaning |
|
|
392
|
+
|------|-------|---------|
|
|
393
|
+
| `NonConsumable` | 1 | Chỉ own 1 bản persistent |
|
|
394
|
+
| `Consumable` | 2 | Mua lại và tiêu thụ nhiều lần |
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## StoreReceiveType
|
|
399
|
+
|
|
400
|
+
Cách store item được trao cho buyer.
|
|
401
|
+
|
|
402
|
+
| Name | Value | Meaning |
|
|
403
|
+
|------|-------|---------|
|
|
404
|
+
| `Buy` | 1 | Buy flow trong game bình thường |
|
|
405
|
+
| `Present` | 2 | Present/gift flow |
|
|
406
|
+
| `AppleAppStore` | 3 | Apple App Store receipt validation |
|
|
407
|
+
| `FacebookStore` | 4 | Facebook Store receipt validation |
|
|
408
|
+
| `GooglePlayStore` | 5 | Google Play receipt validation |
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## PermissionDataItem
|
|
413
|
+
|
|
414
|
+
Cách config 1 data item có thể ghi lại sau khi tạo.
|
|
415
|
+
|
|
416
|
+
| Name | Value | Meaning |
|
|
417
|
+
|------|-------|---------|
|
|
418
|
+
| `ReadOnly` | 1 | Read được nhưng write flow thường không ghi đè |
|
|
419
|
+
| `CanOverride` | 2 | Write được, ghi đè giá trị cũ |
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## FieldDataType
|
|
424
|
+
|
|
425
|
+
Runtime metadata type ghi nhận bởi decorator `DataMember`. App tích hợp SDK bình thường hiếm khi cần đọc trực tiếp enum này.
|
|
426
|
+
|
|
427
|
+
| Name | Value | Meaning |
|
|
428
|
+
|------|-------|---------|
|
|
429
|
+
| `Boolean` | 0 | Field boolean |
|
|
430
|
+
| `Number` | 1 | Field number |
|
|
431
|
+
| `String` | 2 | Field string |
|
|
432
|
+
| `Array` | 3 | Field array |
|
|
433
|
+
| `Object` | 4 | Field class/object |
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Reference: Error Handling
|
|
2
|
+
|
|
3
|
+
Mọi response từ GearN backend đi qua 2 tầng kiểm tra. AI consumer phải check đủ cả hai, đúng thứ tự.
|
|
4
|
+
|
|
5
|
+
## Pattern bắt buộc
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { AuthenticateModels, ErrorCode, GNNetwork, ReturnCode } from "@xmobitea/gn-typescript-client";
|
|
9
|
+
|
|
10
|
+
const request = new AuthenticateModels.LoginByAccountRequestData();
|
|
11
|
+
request.username = username;
|
|
12
|
+
request.password = password;
|
|
13
|
+
request.infoRequestParam = new AuthenticateModels.InfoRequestParam();
|
|
14
|
+
|
|
15
|
+
const res = await GNNetwork.authenticate.loginByAccountAsync(request);
|
|
16
|
+
|
|
17
|
+
// 1. Kiểm tra returnCode (transport/gateway)
|
|
18
|
+
if (res.returnCode !== ReturnCode.Ok) {
|
|
19
|
+
handleTransportFailure(res);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// 2. Kiểm tra errorCode (business domain)
|
|
24
|
+
if (res.errorCode !== ErrorCode.Ok) {
|
|
25
|
+
handleDomainFailure(res);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 3. Happy path: trust typed payload
|
|
30
|
+
useResult(res.responseData);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Typed response (trả từ mọi `*Async()` và callback path) expose field `public`:
|
|
34
|
+
|
|
35
|
+
- `res.returnCode: number` — tầng 1
|
|
36
|
+
- `res.errorCode: number` — tầng 2 (chỉ set khi `returnCode === Ok`)
|
|
37
|
+
- `res.invalidMembers: InvalidMember[]` — khi `returnCode === InvalidRequestParameters`
|
|
38
|
+
- `res.debugMessage: string` — backend debug message
|
|
39
|
+
- `res.responseData: T` — typed payload, chỉ set khi `returnCode === Ok`
|
|
40
|
+
|
|
41
|
+
**Rule cứng:**
|
|
42
|
+
|
|
43
|
+
- Không skip tầng 1 để đọc thẳng `errorCode`. Nếu `returnCode !== Ok`, `errorCode` và typed parameters **không đáng tin**.
|
|
44
|
+
- Không giả định success là `0`. Success ở cả hai tầng là `1` (`ReturnCode.Ok === 1`, `ErrorCode.Ok === 1`).
|
|
45
|
+
- Không hardcode số. Luôn so sánh bằng symbol `ReturnCode.*` / `ErrorCode.*`.
|
|
46
|
+
- `Async` method vẫn return response object (không throw) — reject chỉ xảy ra khi transport layer lỗi thực sự (network down, serialization fail).
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Tầng 1: `ReturnCode`
|
|
51
|
+
|
|
52
|
+
Kiểm tra bằng `res.returnCode`. So sánh bằng enum symbol. Giá trị numeric: [ENUMS.md § ReturnCode](ENUMS.md#returncode).
|
|
53
|
+
|
|
54
|
+
| ReturnCode | Khi nào gặp | Recommended action |
|
|
55
|
+
|------------|-------------|--------------------|
|
|
56
|
+
| `Ok` | Happy path | Sang tầng 2 check `errorCode` |
|
|
57
|
+
| `UnknownError` | Backend fail nhưng không map code cụ thể | Log + show lỗi chung; không retry tự động |
|
|
58
|
+
| `OperationTimeout` | Request timeout (SDK hoặc backend) | Retry với backoff nếu operation idempotent; báo user nếu không |
|
|
59
|
+
| `OperationNotAllow` | Permission rule của secret key không cho chạy operation ở target context | Sai route (`client/server/admin`) hoặc secret thiếu `selfEnable`/`otherSelfEnable`/`serverSelfEnable`/`adminSelfEnable`. Không retry — fix config. Checklist chi tiết: [RULES.md § 6](../RULES.md#6-permission-flags) |
|
|
60
|
+
| `InternalServerError` | Backend crash internal | Log + show lỗi chung; có thể retry 1 lần rồi escalate |
|
|
61
|
+
| `OperationInvalid` | Operation code không tồn tại / sai với request type + role | Sai namespace: kiểm tra đang gọi đúng `GNNetwork.<domain>.<method>`. Không retry |
|
|
62
|
+
| `InvalidRequestParameters` | Request shape / field invalid | Đọc `res.invalidMembers`; fix field rồi gửi lại |
|
|
63
|
+
| `OperationNotAuthorized` | Caller không auth với role/target resource | Kiểm tra `authToken` hợp lệ; re-login hoặc refresh token |
|
|
64
|
+
| `MaxCCUReject` | Vượt concurrent user limit | Backoff + retry; escalate lên ops nếu recurring |
|
|
65
|
+
| `MaxRequestReject` | Vượt rate limit | Exponential backoff retry; xem lại client usage pattern |
|
|
66
|
+
| `MaxSizeRequestReject` | Payload vượt max size | Không retry; giảm size request (paginate, split) |
|
|
67
|
+
| `SecretInvalid` | Secret key sai / thiếu / không khớp game | Fix cấu hình `GNServerSettingsOptions`, không retry |
|
|
68
|
+
|
|
69
|
+
### Khi gặp `InvalidRequestParameters`
|
|
70
|
+
|
|
71
|
+
Response expose thêm `res.invalidMembers: InvalidMember[]`:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
interface InvalidMember {
|
|
75
|
+
code: string; // tên field (ParameterCode)
|
|
76
|
+
invalidMemberType: InvalidMemberType;
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`InvalidMemberType` xem [ENUMS.md § InvalidMemberType](ENUMS.md#invalidmembertype). Ví dụ parse:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
if (res.returnCode === ReturnCode.InvalidRequestParameters) {
|
|
84
|
+
for (const im of res.invalidMembers ?? []) {
|
|
85
|
+
console.warn(`field ${im.code} invalid: type=${im.invalidMemberType}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Tầng 2: `ErrorCode`
|
|
93
|
+
|
|
94
|
+
Chỉ check sau khi `returnCode === ReturnCode.Ok`. Lấy qua `response.errorCode` (field public trên typed response class).
|
|
95
|
+
|
|
96
|
+
Bảng đầy đủ 50 giá trị xem [ENUMS.md § ErrorCode](ENUMS.md#errorcode). Pattern xử lý chung:
|
|
97
|
+
|
|
98
|
+
| ErrorCode family | Pattern |
|
|
99
|
+
|------------------|---------|
|
|
100
|
+
| `Ok` | Dùng data trong response |
|
|
101
|
+
| `*NotFound` (2, 7, 9–19, 22, 24, 29, 30, 31, 39, 42, 44) | Entity không tồn tại — thường hiện message user-friendly, không retry |
|
|
102
|
+
| `*Exists` / `*HadBeen*` (4, 23, 25, 36, 49, 50) | Conflict trạng thái — hiện UX "đã tồn tại" / "đã mua", không retry |
|
|
103
|
+
| `*Invalid` (5, 6, 34, 35, 47, 48) | Input hoặc external data invalid — user sửa lại rồi thử lại |
|
|
104
|
+
| `AccountPasswordWrong` (3), `PlayerBan` (38) | Auth fail nghiệp vụ — show rõ cho user, không retry cùng input |
|
|
105
|
+
| `NotEnoughCurrency` (8), `CanNotBuyThisStoreItem` (32) | Điều kiện business không đủ — UX hướng dẫn user nạp/thử item khác |
|
|
106
|
+
| `ExternalLinked*` (27, 28) | Identity conflict — UX hướng dẫn unlink/choose account |
|
|
107
|
+
| `MatchmakingPlayerJoinedOtherTicket` (43), `MatchmakingTicketAlreadyCompleted` (40) | State transition không hợp lệ — poll state mới rồi retry logic |
|
|
108
|
+
| `ExecuteError` (46) | CloudScript throw — đọc payload execute response để debug |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## `Return` vs `Error` — quyết định nhanh
|
|
113
|
+
|
|
114
|
+
| Tình huống | Layer | Xử lý |
|
|
115
|
+
|------------|-------|-------|
|
|
116
|
+
| User offline, request không đến server | — (reject Promise / transport exception) | Retry với backoff |
|
|
117
|
+
| SSL/cert fail | — (reject Promise) | Báo ops; không retry tự động |
|
|
118
|
+
| Timeout | `ReturnCode.OperationTimeout` | Retry nếu idempotent |
|
|
119
|
+
| Sai secret key | `ReturnCode.SecretInvalid` | Fix config |
|
|
120
|
+
| Thiếu permission | `ReturnCode.OperationNotAllow` / `OperationNotAuthorized` | Fix route + secret permission |
|
|
121
|
+
| Field invalid | `ReturnCode.InvalidRequestParameters` | Parse `invalidMembers` |
|
|
122
|
+
| Username sai | `ErrorCode.AccountNotFound` | UX login fail |
|
|
123
|
+
| Password sai | `ErrorCode.AccountPasswordWrong` | UX login fail |
|
|
124
|
+
| Thiếu tiền | `ErrorCode.NotEnoughCurrency` | UX nạp tiền |
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Promise vs Callback
|
|
129
|
+
|
|
130
|
+
Cả 2 pattern **không throw** trên business/transport error:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
// Callback
|
|
134
|
+
GNNetwork.authenticate.loginByAccount(data, (res) => {
|
|
135
|
+
if (res.returnCode !== ReturnCode.Ok) return;
|
|
136
|
+
if (res.errorCode !== ErrorCode.Ok) return;
|
|
137
|
+
useResult(res.responseData);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// Async
|
|
141
|
+
try {
|
|
142
|
+
const res = await GNNetwork.authenticate.loginByAccountAsync(data);
|
|
143
|
+
if (res.returnCode !== ReturnCode.Ok) return;
|
|
144
|
+
if (res.errorCode !== ErrorCode.Ok) return;
|
|
145
|
+
useResult(res.responseData);
|
|
146
|
+
} catch (e) {
|
|
147
|
+
// chỉ đến đây khi transport layer throw (network exception, serialization fail)
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Mặc định ưu tiên `*Async`.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Liên kết
|
|
156
|
+
|
|
157
|
+
- Enum đầy đủ: [ENUMS.md](ENUMS.md)
|
|
158
|
+
- Route / permission: [RULES.md § 3](../RULES.md#3-route--trust-boundary-của-caller)
|
|
159
|
+
- Self / other-self: [RULES.md § 4](../RULES.md#4-self-vs-other-self-chỉ-áp-dụng-trên-route-client)
|