@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.
Files changed (286) hide show
  1. package/AGENTS.md +37 -0
  2. package/README.MD +420 -1
  3. package/dist/gearn.js.client.js +25056 -1056
  4. package/dist/gearn.js.client.min.js +1 -1
  5. package/dist/index.d.ts +30 -0
  6. package/dist/index.js +24236 -212
  7. package/dist/runtime/GNNetwork.d.ts +687 -3
  8. package/dist/runtime/GNNetworkAuthenticateApi.d.ts +327 -0
  9. package/dist/runtime/GNNetworkCharacterPlayerApi.d.ts +1026 -0
  10. package/dist/runtime/GNNetworkCloudScriptApi.d.ts +141 -0
  11. package/dist/runtime/GNNetworkContentApi.d.ts +243 -0
  12. package/dist/runtime/GNNetworkDashboardApi.d.ts +221 -0
  13. package/dist/runtime/GNNetworkGamePlayerApi.d.ts +1033 -0
  14. package/dist/runtime/GNNetworkGroupApi.d.ts +783 -0
  15. package/dist/runtime/GNNetworkInventoryApi.d.ts +673 -0
  16. package/dist/runtime/GNNetworkMasterPlayerApi.d.ts +1614 -6
  17. package/dist/runtime/GNNetworkMultiplayerApi.d.ts +234 -0
  18. package/dist/runtime/GNNetworkStoreInventoryApi.d.ts +309 -0
  19. package/dist/runtime/common/Action0.d.ts +30 -0
  20. package/dist/runtime/common/Action1.d.ts +32 -0
  21. package/dist/runtime/common/Action2.d.ts +21 -0
  22. package/dist/runtime/common/Action3.d.ts +16 -0
  23. package/dist/runtime/common/Action4.d.ts +17 -0
  24. package/dist/runtime/common/GNData.d.ts +368 -0
  25. package/dist/runtime/config/GNServerSettings.d.ts +442 -12
  26. package/dist/runtime/constant/Commands.d.ts +80 -0
  27. package/dist/runtime/constant/EventCode.d.ts +48 -0
  28. package/dist/runtime/constant/OperationCode.d.ts +74 -1
  29. package/dist/runtime/constant/ReturnCode.d.ts +72 -0
  30. package/dist/runtime/constant/enumType/ExecuteResponseStatus.d.ts +31 -0
  31. package/dist/runtime/constant/enumType/FriendStatus.d.ts +39 -0
  32. package/dist/runtime/constant/enumType/GoogleLoginType.d.ts +23 -0
  33. package/dist/runtime/constant/enumType/GroupStatus.d.ts +32 -0
  34. package/dist/runtime/constant/enumType/InvalidMemberType.d.ts +75 -0
  35. package/dist/runtime/constant/enumType/ItemType.d.ts +23 -0
  36. package/dist/runtime/constant/enumType/MatchStatus.d.ts +30 -0
  37. package/dist/runtime/constant/enumType/MatchmakingMemberStatus.d.ts +24 -0
  38. package/dist/runtime/constant/enumType/MatchmakingTicketStatus.d.ts +34 -0
  39. package/dist/runtime/constant/enumType/OwnerType.d.ts +40 -0
  40. package/dist/runtime/constant/enumType/PermissionDataItem.d.ts +22 -0
  41. package/dist/runtime/constant/enumType/PushPlatformType.d.ts +18 -0
  42. package/dist/runtime/constant/enumType/RequestRole.d.ts +32 -0
  43. package/dist/runtime/constant/enumType/RequestType.d.ts +70 -0
  44. package/dist/runtime/constant/enumType/StoreItemType.d.ts +21 -0
  45. package/dist/runtime/constant/enumType/StoreReceiveType.d.ts +30 -0
  46. package/dist/runtime/constant/errorCode/ErrorCode.d.ts +190 -8
  47. package/dist/runtime/constant/parameterCode/ParameterCode.d.ts +35 -5
  48. package/dist/runtime/entity/DataMember.d.ts +338 -0
  49. package/dist/runtime/entity/GNMetadata.d.ts +101 -0
  50. package/dist/runtime/entity/InvalidMember.d.ts +28 -0
  51. package/dist/runtime/entity/OperationEvent.d.ts +49 -0
  52. package/dist/runtime/entity/OperationRequest.d.ts +108 -0
  53. package/dist/runtime/entity/OperationResponse.d.ts +110 -0
  54. package/dist/runtime/entity/models/AuthenticateModels.d.ts +115 -0
  55. package/dist/runtime/entity/models/AuthenticateRequestModels.d.ts +131 -0
  56. package/dist/runtime/entity/models/AuthenticateResponseModels.d.ts +131 -0
  57. package/dist/runtime/entity/models/CharacterPlayerModels.d.ts +625 -1
  58. package/dist/runtime/entity/models/CharacterPlayerRequestModels.d.ts +972 -0
  59. package/dist/runtime/entity/models/CharacterPlayerResponseModels.d.ts +332 -0
  60. package/dist/runtime/entity/models/CloudScriptModels.d.ts +109 -0
  61. package/dist/runtime/entity/models/CloudScriptRequestModels.d.ts +107 -0
  62. package/dist/runtime/entity/models/CloudScriptResponseModels.d.ts +46 -0
  63. package/dist/runtime/entity/models/ContentModels.d.ts +124 -0
  64. package/dist/runtime/entity/models/ContentRequestModels.d.ts +152 -0
  65. package/dist/runtime/entity/models/ContentResponseModels.d.ts +58 -0
  66. package/dist/runtime/entity/models/DashboardModels.d.ts +371 -8
  67. package/dist/runtime/entity/models/DashboardRequestModels.d.ts +172 -0
  68. package/dist/runtime/entity/models/DashboardResponseModels.d.ts +170 -0
  69. package/dist/runtime/entity/models/GamePlayerModels.d.ts +644 -1
  70. package/dist/runtime/entity/models/GamePlayerRequestModels.d.ts +959 -0
  71. package/dist/runtime/entity/models/GamePlayerResponseModels.d.ts +333 -1
  72. package/dist/runtime/entity/models/GenericModels.d.ts +94 -0
  73. package/dist/runtime/entity/models/GroupModels.d.ts +484 -2
  74. package/dist/runtime/entity/models/GroupRequestModels.d.ts +737 -0
  75. package/dist/runtime/entity/models/GroupResponseModels.d.ts +254 -0
  76. package/dist/runtime/entity/models/InventoryModels.d.ts +415 -0
  77. package/dist/runtime/entity/models/InventoryRequestModels.d.ts +629 -0
  78. package/dist/runtime/entity/models/InventoryResponseModels.d.ts +218 -0
  79. package/dist/runtime/entity/models/MasterPlayerModels.d.ts +1065 -3
  80. package/dist/runtime/entity/models/MasterPlayerRequestModels.d.ts +1560 -6
  81. package/dist/runtime/entity/models/MasterPlayerResponseModels.d.ts +532 -1
  82. package/dist/runtime/entity/models/MultiplayerModels.d.ts +199 -0
  83. package/dist/runtime/entity/models/MultiplayerRequestModels.d.ts +196 -0
  84. package/dist/runtime/entity/models/MultiplayerResponseModels.d.ts +74 -0
  85. package/dist/runtime/entity/models/StoreInventoryModels.d.ts +262 -0
  86. package/dist/runtime/entity/models/StoreInventoryRequestModels.d.ts +268 -0
  87. package/dist/runtime/entity/models/StoreInventoryResponseModels.d.ts +98 -0
  88. package/dist/runtime/entity/request/CustomOperationRequest.d.ts +99 -0
  89. package/dist/runtime/entity/response/CustomOperationResponse.d.ts +118 -0
  90. package/dist/runtime/entity/response/GetAuthInfoResponse.d.ts +53 -0
  91. package/dist/runtime/entity/response/HealthCheckResponse.d.ts +56 -0
  92. package/dist/runtime/entity/response/UploadFileResponse.d.ts +19 -0
  93. package/dist/runtime/helper/CodeHelper.d.ts +122 -0
  94. package/dist/runtime/helper/ConverterService.d.ts +74 -0
  95. package/dist/runtime/helper/EnumUtility.d.ts +63 -0
  96. package/dist/runtime/helper/GNSupport.d.ts +64 -4
  97. package/dist/runtime/helper/GNUtils.d.ts +54 -0
  98. package/dist/runtime/helper/MessagePackConverterService.d.ts +48 -0
  99. package/dist/runtime/helper/OperationHelper.d.ts +51 -0
  100. package/dist/runtime/helper/StorageService.d.ts +48 -8
  101. package/dist/runtime/logger/GNDebug.d.ts +117 -0
  102. package/dist/runtime/networking/AuthenticateStatus.d.ts +64 -0
  103. package/dist/runtime/networking/IPeer.d.ts +83 -0
  104. package/dist/runtime/networking/NetworkingPeer.d.ts +256 -1
  105. package/dist/runtime/networking/OperationPending.d.ts +112 -0
  106. package/dist/runtime/networking/PeerBase.d.ts +231 -0
  107. package/dist/runtime/networking/handler/IServerEventHandler.d.ts +84 -0
  108. package/dist/runtime/networking/handler/OnCharacterPlayerFriendUpdateEventHandler.d.ts +69 -0
  109. package/dist/runtime/networking/handler/OnCharacterPlayerGroupUpdateEventHandler.d.ts +49 -0
  110. package/dist/runtime/networking/handler/OnGamePlayerFriendUpdateEventHandler.d.ts +50 -0
  111. package/dist/runtime/networking/handler/OnGamePlayerGroupUpdateEventHandler.d.ts +41 -0
  112. package/dist/runtime/networking/handler/OnGroupMemberUpdateEventHandler.d.ts +47 -0
  113. package/dist/runtime/networking/handler/OnGroupMessageUpdateEventHandler.d.ts +46 -0
  114. package/dist/runtime/networking/http/HttpPeer.d.ts +173 -0
  115. package/dist/runtime/networking/http/NetworkingHttpPeerBase.d.ts +87 -0
  116. package/dist/runtime/networking/http/NetworkingPeerAxiosRequest.d.ts +113 -0
  117. package/dist/runtime/networking/socket/NetworkingPeerSocketIOClient.d.ts +145 -0
  118. package/dist/runtime/networking/socket/NetworkingSocketPeerBase.d.ts +198 -0
  119. package/dist/runtime/networking/socket/SocketPeer.d.ts +155 -0
  120. package/dist/runtime/typescript/ServiceUpdate.d.ts +46 -0
  121. package/docs/AI_CHEATSHEET.md +211 -0
  122. package/docs/COOKBOOK.md +912 -0
  123. package/docs/RULES.md +307 -0
  124. package/docs/ai-manifest.json +725 -0
  125. package/docs/guides/AUTHENTICATE.md +246 -0
  126. package/docs/guides/CHARACTER_PLAYER.md +439 -0
  127. package/docs/guides/CLOUDSCRIPT.md +335 -0
  128. package/docs/guides/COCOS_CREATOR_INTEGRATION.md +150 -0
  129. package/docs/guides/CONTENT.md +291 -0
  130. package/docs/guides/DASHBOARD.md +262 -0
  131. package/docs/guides/GAME_PLAYER.md +473 -0
  132. package/docs/guides/GROUP.md +412 -0
  133. package/docs/guides/INVENTORY.md +375 -0
  134. package/docs/guides/MASTER_PLAYER.md +458 -0
  135. package/docs/guides/MULTIPLAYER.md +303 -0
  136. package/docs/guides/STORE_INVENTORY.md +313 -0
  137. package/docs/llms-full.txt +43 -0
  138. package/docs/reference/API_AUTHENTICATE.md +75 -0
  139. package/docs/reference/API_CHARACTER_PLAYER.md +226 -0
  140. package/docs/reference/API_CLOUDSCRIPT.md +82 -0
  141. package/docs/reference/API_CONTENT.md +88 -0
  142. package/docs/reference/API_DASHBOARD.md +82 -0
  143. package/docs/reference/API_GAME_PLAYER.md +223 -0
  144. package/docs/reference/API_GROUP.md +187 -0
  145. package/docs/reference/API_INDEX.md +57 -0
  146. package/docs/reference/API_INVENTORY.md +169 -0
  147. package/docs/reference/API_MASTER_PLAYER.md +323 -0
  148. package/docs/reference/API_MULTIPLAYER.md +97 -0
  149. package/docs/reference/API_STORE_INVENTORY.md +109 -0
  150. package/docs/reference/CONFIG.md +107 -0
  151. package/docs/reference/DTO_INDEX.md +2543 -0
  152. package/docs/reference/ENUMS.md +433 -0
  153. package/docs/reference/ERROR_HANDLING.md +159 -0
  154. package/docs/reference/EVENTS.md +188 -0
  155. package/docs/reference/PERMISSION_RULES.md +55 -0
  156. package/docs/reference/dto/AUTHENTICATE.md +619 -0
  157. package/docs/reference/dto/CHARACTER_PLAYER.md +3686 -0
  158. package/docs/reference/dto/CLOUDSCRIPT.md +400 -0
  159. package/docs/reference/dto/CONTENT.md +548 -0
  160. package/docs/reference/dto/DASHBOARD.md +1980 -0
  161. package/docs/reference/dto/GAME_PLAYER.md +3631 -0
  162. package/docs/reference/dto/GENERIC.md +151 -0
  163. package/docs/reference/dto/GROUP.md +2842 -0
  164. package/docs/reference/dto/INVENTORY.md +2385 -0
  165. package/docs/reference/dto/MASTER_PLAYER.md +6024 -0
  166. package/docs/reference/dto/MULTIPLAYER.md +850 -0
  167. package/docs/reference/dto/STORE_INVENTORY.md +1262 -0
  168. package/llms.txt +47 -0
  169. package/package.json +12 -3
  170. package/GNServerSettings.debug.json +0 -21
  171. package/docs/COCOS_CREATOR_INTEGRATION.md +0 -116
  172. package/examples/cocos-creator/GearNExample.ts.txt +0 -176
  173. package/srcSwift/Package.swift +0 -32
  174. package/srcSwift/Sources/GearN/runtime/GNNetwork.swift +0 -530
  175. package/srcSwift/Sources/GearN/runtime/GNNetworkAuthenticateApi.swift +0 -178
  176. package/srcSwift/Sources/GearN/runtime/GNNetworkCharacterPlayerApi.swift +0 -1162
  177. package/srcSwift/Sources/GearN/runtime/GNNetworkCloudScriptApi.swift +0 -154
  178. package/srcSwift/Sources/GearN/runtime/GNNetworkContentApi.swift +0 -208
  179. package/srcSwift/Sources/GearN/runtime/GNNetworkDashboardApi.swift +0 -240
  180. package/srcSwift/Sources/GearN/runtime/GNNetworkGamePlayerApi.swift +0 -1369
  181. package/srcSwift/Sources/GearN/runtime/GNNetworkGroupApi.swift +0 -1100
  182. package/srcSwift/Sources/GearN/runtime/GNNetworkInventoryApi.swift +0 -937
  183. package/srcSwift/Sources/GearN/runtime/GNNetworkMasterPlayerApi.swift +0 -2323
  184. package/srcSwift/Sources/GearN/runtime/GNNetworkMultiplayerApi.swift +0 -298
  185. package/srcSwift/Sources/GearN/runtime/GNNetworkStoreInventoryApi.swift +0 -397
  186. package/srcSwift/Sources/GearN/runtime/common/Action0.swift +0 -3
  187. package/srcSwift/Sources/GearN/runtime/common/Action1.swift +0 -3
  188. package/srcSwift/Sources/GearN/runtime/common/Action2.swift +0 -3
  189. package/srcSwift/Sources/GearN/runtime/common/Action3.swift +0 -3
  190. package/srcSwift/Sources/GearN/runtime/common/Action4.swift +0 -3
  191. package/srcSwift/Sources/GearN/runtime/common/GNArray.swift +0 -204
  192. package/srcSwift/Sources/GearN/runtime/common/GNData.swift +0 -108
  193. package/srcSwift/Sources/GearN/runtime/common/GNHashtable.swift +0 -200
  194. package/srcSwift/Sources/GearN/runtime/config/GNServerSettings.swift +0 -95
  195. package/srcSwift/Sources/GearN/runtime/constant/Commands.swift +0 -28
  196. package/srcSwift/Sources/GearN/runtime/constant/EventCode.swift +0 -10
  197. package/srcSwift/Sources/GearN/runtime/constant/OperationCode.swift +0 -252
  198. package/srcSwift/Sources/GearN/runtime/constant/ReturnCode.swift +0 -19
  199. package/srcSwift/Sources/GearN/runtime/constant/enumType/ExecuteResponseStatus.swift +0 -9
  200. package/srcSwift/Sources/GearN/runtime/constant/enumType/FriendStatus.swift +0 -8
  201. package/srcSwift/Sources/GearN/runtime/constant/enumType/GoogleLoginType.swift +0 -6
  202. package/srcSwift/Sources/GearN/runtime/constant/enumType/GroupStatus.swift +0 -8
  203. package/srcSwift/Sources/GearN/runtime/constant/enumType/InvalidMemberType.swift +0 -19
  204. package/srcSwift/Sources/GearN/runtime/constant/enumType/ItemType.swift +0 -6
  205. package/srcSwift/Sources/GearN/runtime/constant/enumType/MatchmakingMemberStatus.swift +0 -7
  206. package/srcSwift/Sources/GearN/runtime/constant/enumType/MatchmakingTicketStatus.swift +0 -9
  207. package/srcSwift/Sources/GearN/runtime/constant/enumType/OwnerType.swift +0 -10
  208. package/srcSwift/Sources/GearN/runtime/constant/enumType/PermissionDataItem.swift +0 -6
  209. package/srcSwift/Sources/GearN/runtime/constant/enumType/PushPlatformType.swift +0 -6
  210. package/srcSwift/Sources/GearN/runtime/constant/enumType/RequestRole.swift +0 -7
  211. package/srcSwift/Sources/GearN/runtime/constant/enumType/RequestType.swift +0 -16
  212. package/srcSwift/Sources/GearN/runtime/constant/enumType/StoreItemType.swift +0 -6
  213. package/srcSwift/Sources/GearN/runtime/constant/enumType/StoreReceiveType.swift +0 -9
  214. package/srcSwift/Sources/GearN/runtime/constant/errorCode/ErrorCode.swift +0 -58
  215. package/srcSwift/Sources/GearN/runtime/constant/parameterCode/ParameterCode.swift +0 -672
  216. package/srcSwift/Sources/GearN/runtime/entity/DataMember.swift +0 -196
  217. package/srcSwift/Sources/GearN/runtime/entity/GNMetadata.swift +0 -9
  218. package/srcSwift/Sources/GearN/runtime/entity/InvalidMember.swift +0 -11
  219. package/srcSwift/Sources/GearN/runtime/entity/OperationEvent.swift +0 -38
  220. package/srcSwift/Sources/GearN/runtime/entity/OperationHelper.swift +0 -28
  221. package/srcSwift/Sources/GearN/runtime/entity/OperationRequest.swift +0 -62
  222. package/srcSwift/Sources/GearN/runtime/entity/OperationResponse.swift +0 -98
  223. package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateModels.swift +0 -351
  224. package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateRequestModels.swift +0 -81
  225. package/srcSwift/Sources/GearN/runtime/entity/models/AuthenticateResponseModels.swift +0 -108
  226. package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerModels.swift +0 -1045
  227. package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerRequestModels.swift +0 -821
  228. package/srcSwift/Sources/GearN/runtime/entity/models/CharacterPlayerResponseModels.swift +0 -588
  229. package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptModels.swift +0 -187
  230. package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptRequestModels.swift +0 -84
  231. package/srcSwift/Sources/GearN/runtime/entity/models/CloudScriptResponseModels.swift +0 -59
  232. package/srcSwift/Sources/GearN/runtime/entity/models/ContentModels.swift +0 -195
  233. package/srcSwift/Sources/GearN/runtime/entity/models/ContentRequestModels.swift +0 -116
  234. package/srcSwift/Sources/GearN/runtime/entity/models/ContentResponseModels.swift +0 -81
  235. package/srcSwift/Sources/GearN/runtime/entity/models/DashboardModels.swift +0 -426
  236. package/srcSwift/Sources/GearN/runtime/entity/models/DashboardRequestModels.swift +0 -160
  237. package/srcSwift/Sources/GearN/runtime/entity/models/DashboardResponseModels.swift +0 -82
  238. package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerModels.swift +0 -1334
  239. package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerRequestModels.swift +0 -643
  240. package/srcSwift/Sources/GearN/runtime/entity/models/GamePlayerResponseModels.swift +0 -213
  241. package/srcSwift/Sources/GearN/runtime/entity/models/GenericModels.swift +0 -171
  242. package/srcSwift/Sources/GearN/runtime/entity/models/GroupModels.swift +0 -850
  243. package/srcSwift/Sources/GearN/runtime/entity/models/GroupRequestModels.swift +0 -485
  244. package/srcSwift/Sources/GearN/runtime/entity/models/GroupResponseModels.swift +0 -165
  245. package/srcSwift/Sources/GearN/runtime/entity/models/InventoryModels.swift +0 -679
  246. package/srcSwift/Sources/GearN/runtime/entity/models/InventoryRequestModels.swift +0 -413
  247. package/srcSwift/Sources/GearN/runtime/entity/models/InventoryResponseModels.swift +0 -141
  248. package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerModels.swift +0 -378
  249. package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerRequestModels.swift +0 -147
  250. package/srcSwift/Sources/GearN/runtime/entity/models/MasterPlayerResponseModels.swift +0 -318
  251. package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerModels.swift +0 -319
  252. package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerRequestModels.swift +0 -125
  253. package/srcSwift/Sources/GearN/runtime/entity/models/MultiplayerResponseModels.swift +0 -45
  254. package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryModels.swift +0 -633
  255. package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryRequestModels.swift +0 -173
  256. package/srcSwift/Sources/GearN/runtime/entity/models/StoreInventoryResponseModels.swift +0 -61
  257. package/srcSwift/Sources/GearN/runtime/entity/request/CustomOperationRequest.swift +0 -42
  258. package/srcSwift/Sources/GearN/runtime/entity/response/CustomOperationResponse.swift +0 -49
  259. package/srcSwift/Sources/GearN/runtime/entity/response/GetAuthInfoResponse.swift +0 -43
  260. package/srcSwift/Sources/GearN/runtime/entity/response/HealthCheckResponse.swift +0 -86
  261. package/srcSwift/Sources/GearN/runtime/entity/response/UploadFileResponse.swift +0 -15
  262. package/srcSwift/Sources/GearN/runtime/helper/CodeHelper.swift +0 -107
  263. package/srcSwift/Sources/GearN/runtime/helper/ConverterService.swift +0 -98
  264. package/srcSwift/Sources/GearN/runtime/helper/EnumUtility.swift +0 -34
  265. package/srcSwift/Sources/GearN/runtime/helper/GNSupport.swift +0 -41
  266. package/srcSwift/Sources/GearN/runtime/helper/GNUtils.swift +0 -66
  267. package/srcSwift/Sources/GearN/runtime/helper/MessagePackConverterService.swift +0 -21
  268. package/srcSwift/Sources/GearN/runtime/helper/StorageService.swift +0 -29
  269. package/srcSwift/Sources/GearN/runtime/logger/GNDebug.swift +0 -33
  270. package/srcSwift/Sources/GearN/runtime/networking/AuthenticateStatus.swift +0 -24
  271. package/srcSwift/Sources/GearN/runtime/networking/IPeer.swift +0 -8
  272. package/srcSwift/Sources/GearN/runtime/networking/NetworkingPeer.swift +0 -368
  273. package/srcSwift/Sources/GearN/runtime/networking/OperationPending.swift +0 -81
  274. package/srcSwift/Sources/GearN/runtime/networking/PeerBase.swift +0 -228
  275. package/srcSwift/Sources/GearN/runtime/networking/handler/IServerEventHandler.swift +0 -20
  276. package/srcSwift/Sources/GearN/runtime/networking/http/HttpPeer.swift +0 -226
  277. package/srcSwift/Sources/GearN/runtime/networking/http/HttpTypes.swift +0 -24
  278. package/srcSwift/Sources/GearN/runtime/networking/http/NetworkingHttpPeerBase.swift +0 -13
  279. package/srcSwift/Sources/GearN/runtime/networking/http/NetworkingPeerUrlSession.swift +0 -125
  280. package/srcSwift/Sources/GearN/runtime/networking/request/NetRequest.swift +0 -19
  281. package/srcSwift/Sources/GearN/runtime/networking/response/NetResponse.swift +0 -13
  282. package/srcSwift/Sources/GearN/runtime/networking/socket/NetworkingPeerSocketIOClient.swift +0 -244
  283. package/srcSwift/Sources/GearN/runtime/networking/socket/NetworkingSocketPeerBase.swift +0 -59
  284. package/srcSwift/Sources/GearN/runtime/networking/socket/SocketPeer.swift +0 -136
  285. package/tsconfig-build.cocos.json +0 -31
  286. package/webpack.config.cocos.mjs +0 -78
@@ -0,0 +1,291 @@
1
+ # ContentApi
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`, truyền đúng payload cho `GNNetwork.content*`, và không sinh sai sequence ở flow upload/download file.
4
+
5
+ ## 1. Scope
6
+
7
+ - Áp dụng cho:
8
+ - `GNNetwork.content`
9
+ - `GNNetwork.content.server`
10
+ - `GNNetwork.content.admin`
11
+ - Toàn bộ method hiện tại của `ContentApi` đều gửi qua HTTP.
12
+ - `ContentApi` có đủ 3 role thật:
13
+ - `GNNetwork.content` -> `RequestRole.Client`
14
+ - `GNNetwork.content.server` -> `RequestRole.Server`
15
+ - `GNNetwork.content.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 semantics permission xem [RULES](../RULES.md#3-route--trust-boundary-của-caller). Với nhóm này, không tự suy diễn route chỉ từ target ownership.
20
+ - Payload shape giữa `client`, `server`, `admin` của cùng một operation là giống nhau; khác biệt chính là role.
21
+ - `ContentApi` không upload byte trực tiếp. Nó chỉ quản lý metadata và token cho flow file; phần upload byte thật đi qua `GNNetwork.uploadFileAsync(...)`.
22
+
23
+ ## 2. Hard Rules
24
+
25
+ - Luôn ưu tiên `async/await`. Mặc định dùng `*Async()`.
26
+ - Bắt buộc đã `GNNetwork.init(settings)` trước khi gọi.
27
+ - Không dùng socket cho `ContentApi`.
28
+ - Chọn namespace theo đúng role của actor hiện tại. Không gọi nhầm `client` khi bạn đang sinh code cho server job hoặc admin tool.
29
+ - Flow upload file đúng là:
30
+ 1. `createNewFileUploadInfoAsync(...)`
31
+ 2. lấy `fileId` từ response
32
+ 3. `GNNetwork.uploadFileAsync(fileId, bytes, filename, mimetype)`
33
+ - Flow download file đúng là:
34
+ 1. `requestDownloadFileUploadInfoAsync(...)`
35
+ 2. lấy `downloadToken` từ response
36
+ 3. `GNNetwork.getDownloadFileUrl(downloadToken)`
37
+ - `setContentDataAsync(...)` bắt buộc có `configs`.
38
+ - `removeFileUploadInfoAsync(...)` là thao tác mutate/xóa metadata file. Chỉ gọi khi có chủ đích rõ ràng.
39
+
40
+ ## 3. Chọn Namespace
41
+
42
+ | Namespace | Role thật | Dùng khi nào |
43
+ | --- | --- | --- |
44
+ | `GNNetwork.content` | `Client` | | flow từ client/player app |
45
+ | `GNNetwork.content.server` | `Server` | | server worker, backend integration, trusted service |
46
+ | `GNNetwork.content.admin` | `Admin` | | dashboard, backoffice, tooling quản trị |
47
+
48
+ Rule nhanh:
49
+
50
+ - Nếu code chạy trong game client: ưu tiên `GNNetwork.content`.
51
+ - Nếu code chạy ở trusted backend hoặc worker: ưu tiên `GNNetwork.content.server`.
52
+ - Nếu code chạy ở dashboard/tool vận hành: ưu tiên `GNNetwork.content.admin`.
53
+ - Chỉ dùng `overrideSecretKey` khi bạn cố ý override hành vi mặc định theo role.
54
+
55
+ ## 4. Chọn Method
56
+
57
+ | Method | Dùng khi nào | Cần truyền gì | Nhận được gì | Ghi chú | ErrorCode
58
+ | --- | --- | --- | --- | --- | --- |
59
+ | `getContentDataAsync` | Đọc content config theo key hoặc label | `keys?`, `label?` | `GetContentDataResponseData` | Dùng cho config/content data, không phải file binary | `Ok`, `GameNotFound` |
60
+ | `setContentDataAsync` | Tạo hoặc cập nhật content config | `configs`, `label?` | `EmptyResponseData` | Mỗi config cần `key` và `data` | `Ok`, `GameNotFound` |
61
+ | `createNewFileUploadInfoAsync` | Xin cấp `fileId` cho một file sẽ upload | `fileName` | `FileIdUploadResponseData` | Không upload byte ở bước này | `Ok` |
62
+ | `getFileUploadInfoListAsync` | Liệt kê metadata file upload | `skip?`, `limit?` | `GetFileUploadInfoListResponseData` | Phân trang mềm | `Ok` |
63
+ | `getFileUploadInfoAsync` | Xem chi tiết metadata của một file | `fileId` | `GetFileUploadInfoResponseData` | Trả cả `removeStatus`, `tsUploadExpire`, `fileUpload?` | `Ok`, `FileNotFound` |
64
+ | `removeFileUploadInfoAsync` | Gỡ metadata hoặc đánh dấu remove cho file | `fileId`, `reason?` | `EmptyResponseData` | Không phải API upload delete byte trực tiếp | `Ok`, `FileNotFound` |
65
+ | `requestDownloadFileUploadInfoAsync` | Xin download token cho file | `fileId` | `RequestDownloadFileUploadInfoResponseData` | Dùng tiếp với `GNNetwork.getDownloadFileUrl(...)` | `Ok`, `FileNotFound`, `FileNotUpload` |
66
+
67
+ ## 5. Decision Rules
68
+
69
+ - Cần config dạng key/value structured: dùng `getContentDataAsync` hoặc `setContentDataAsync`.
70
+ - Cần upload file mới: dùng `createNewFileUploadInfoAsync` trước, sau đó `GNNetwork.uploadFileAsync`.
71
+ - Cần liệt kê file đã có: dùng `getFileUploadInfoListAsync`.
72
+ - Cần inspect một file cụ thể: dùng `getFileUploadInfoAsync`.
73
+ - Cần cấp link download: dùng `requestDownloadFileUploadInfoAsync`, không tự ghép URL thủ công từ `fileId`.
74
+ - Cần bỏ metadata file: dùng `removeFileUploadInfoAsync`.
75
+ - Cần thao tác cùng operation nhưng khác quyền: giữ nguyên tên method, đổi namespace cho đúng role.
76
+
77
+ ## 6. Request Rules và Reference
78
+
79
+ - DTO fields: [reference/dto/CONTENT.md](../reference/dto/CONTENT.md). Method table: [reference/API_CONTENT.md](../reference/API_CONTENT.md).
80
+ - Fallback `dist` chỉ khi reference docs chưa đủ: `dist/runtime/entity/models/Content*.d.ts`.
81
+ - `GetContentDataRequestData.keys` là optional.
82
+ - Suy luận từ model: nếu bỏ `keys`, backend có thể trả tập content rộng hơn theo `label` hoặc default scope.
83
+ - Nếu backend spec không chốt rõ hành vi này, AI không được tự mặc định lấy toàn bộ content.
84
+ - `GetContentDataRequestData.label` là optional và có `defaultValue: ""`.
85
+ - `SetContentDataRequestData.configs` là mảng bắt buộc.
86
+ - `ContentDataParam.key` là bắt buộc.
87
+ - `GetFileUploadInfoListRequestData.limit` mặc định `10`, min `1`, max `100`.
88
+ - `GetFileUploadInfoRequestData.fileId`, `RemoveFileUploadInfoRequestData.fileId`, `RequestDownloadFileUploadInfoRequestData.fileId` đều yêu cầu đúng độ dài `15`.
89
+ - `CreateNewFileUploadInfoRequestData.fileName` là bắt buộc, min `5`, max `50`.
90
+
91
+ ## 7. Upload và Download Sequence
92
+
93
+ ### Upload
94
+
95
+ 1. Gọi `createNewFileUploadInfoAsync` để xin `fileId`.
96
+ 2. Gọi `GNNetwork.uploadFileAsync(fileId, bytes, filename, mimetype)` để upload nội dung thật.
97
+ 3. Nếu cần kiểm tra lại metadata sau upload, gọi `getFileUploadInfoAsync`.
98
+
99
+ ### Download
100
+
101
+ 1. Gọi `requestDownloadFileUploadInfoAsync` với `fileId`.
102
+ 2. Lấy `downloadToken` từ response.
103
+ 3. Gọi `GNNetwork.getDownloadFileUrl(downloadToken)` để tạo URL download.
104
+
105
+ Rule cứng:
106
+
107
+ - Không gọi `GNNetwork.uploadFileAsync` trước khi có `fileId`.
108
+ - Không tự tạo download URL từ `fileId`.
109
+ - Không nhầm `getContentDataAsync` với file download; đây là 2 loại dữ liệu khác nhau.
110
+
111
+ ## 8. Response Rules
112
+
113
+ Tất cả typed response của `ContentApi` đều có:
114
+
115
+ - `returnCode`
116
+ - `debugMessage`
117
+ - `invalidMembers`
118
+ - `errorCode`
119
+ - `responseData`
120
+
121
+ Rule kiểm tra response:
122
+
123
+ ```ts
124
+ if (response.hasReturnCodeError()) {
125
+ throw new Error(response.debugMessage);
126
+ }
127
+
128
+ if (response.errorCode !== ErrorCode.Ok) {
129
+ throw new Error(`Business error: ${response.errorCode}`);
130
+ }
131
+ ```
132
+
133
+ Những response chính AI cần nhớ:
134
+
135
+ - `createNewFileUploadInfoAsync` trả `responseData.fileId`.
136
+ - `getContentDataAsync` trả `responseData.configs`.
137
+ - `getFileUploadInfoListAsync` trả `responseData.results`.
138
+ - `getFileUploadInfoAsync` trả `fileName`, `tsCreate`, `removeStatus`, `tsUploadExpire?`, `fileUpload?`.
139
+ - `requestDownloadFileUploadInfoAsync` trả `responseData.downloadToken`.
140
+ - `setContentDataAsync` và `removeFileUploadInfoAsync` trả `EmptyResponseData`.
141
+
142
+ ## 9. Best Practices
143
+
144
+ - Chọn đúng namespace ngay từ đầu để SDK tự chọn đúng secret key.
145
+ - Với `getContentDataAsync`, truyền `keys` cụ thể nếu bạn biết mình cần gì.
146
+ - Với `setContentDataAsync`, chỉ gửi những config thật sự muốn cập nhật.
147
+ - Sau `createNewFileUploadInfoAsync`, dùng luôn `fileId` vừa nhận để upload; không cache lỏng lẻo qua nhiều bước nếu không cần.
148
+ - Với `getFileUploadInfoListAsync`, giữ `limit` nhỏ và phân trang dần.
149
+ - Với `removeFileUploadInfoAsync`, truyền `reason` nếu workflow của bạn cần audit rõ lý do.
150
+
151
+ ## 10. Ví dụ Khuyến Nghị
152
+
153
+ ### Client đọc content theo key
154
+
155
+ ```ts
156
+ import {
157
+ GNNetwork,
158
+ ContentModels,
159
+ ErrorCode,
160
+ } from "@xmobitea/gn-typescript-client";
161
+
162
+ const request = new ContentModels.GetContentDataRequestData();
163
+ request.keys = ["homepage", "shop"];
164
+ request.label = "public";
165
+
166
+ const response = await GNNetwork.content.getContentDataAsync(request);
167
+
168
+ if (response.hasReturnCodeError()) {
169
+ throw new Error(response.debugMessage);
170
+ }
171
+
172
+ if (response.errorCode !== ErrorCode.Ok) {
173
+ throw new Error(`Business error: ${response.errorCode}`);
174
+ }
175
+
176
+ const configs = response.responseData.configs;
177
+ ```
178
+
179
+ ### Server set content data
180
+
181
+ ```ts
182
+ import {
183
+ GNHashtable,
184
+ GNNetwork,
185
+ ContentModels,
186
+ ErrorCode,
187
+ } from "@xmobitea/gn-typescript-client";
188
+
189
+ const config = new ContentModels.ContentDataParam();
190
+ config.key = "maintenance";
191
+ config.data = GNHashtable.builder()
192
+ .add("enabled", true)
193
+ .add("message", "Server maintenance at 22:00")
194
+ .build();
195
+
196
+ const request = new ContentModels.ServerSetContentDataRequestData();
197
+ request.configs = [config];
198
+ request.label = "ops";
199
+
200
+ const response = await GNNetwork.content.server.setContentDataAsync(request);
201
+
202
+ if (response.hasReturnCodeError()) {
203
+ throw new Error(response.debugMessage);
204
+ }
205
+
206
+ if (response.errorCode !== ErrorCode.Ok) {
207
+ throw new Error(`Business error: ${response.errorCode}`);
208
+ }
209
+ ```
210
+
211
+ ### Upload file đúng sequence
212
+
213
+ ```ts
214
+ import {
215
+ GNNetwork,
216
+ ContentModels,
217
+ ErrorCode,
218
+ } from "@xmobitea/gn-typescript-client";
219
+
220
+ const createRequest = new ContentModels.CreateNewFileUploadInfoRequestData();
221
+ createRequest.fileName = "banner.png";
222
+
223
+ const createResponse = await GNNetwork.content.createNewFileUploadInfoAsync(createRequest);
224
+
225
+ if (createResponse.hasReturnCodeError()) {
226
+ throw new Error(createResponse.debugMessage);
227
+ }
228
+
229
+ if (createResponse.errorCode !== ErrorCode.Ok) {
230
+ throw new Error(`Business error: ${createResponse.errorCode}`);
231
+ }
232
+
233
+ const fileId = createResponse.responseData.fileId;
234
+ const bytes = new Uint8Array([1, 2, 3]);
235
+
236
+ const uploadResponse = await GNNetwork.uploadFileAsync(
237
+ fileId,
238
+ bytes,
239
+ "banner.png",
240
+ "image/png",
241
+ );
242
+
243
+ if (uploadResponse.error) {
244
+ throw new Error(uploadResponse.error);
245
+ }
246
+ ```
247
+
248
+ ### Xin download URL từ fileId
249
+
250
+ ```ts
251
+ import {
252
+ GNNetwork,
253
+ ContentModels,
254
+ ErrorCode,
255
+ } from "@xmobitea/gn-typescript-client";
256
+
257
+ const request = new ContentModels.RequestDownloadFileUploadInfoRequestData();
258
+ request.fileId = "123456789012345";
259
+
260
+ const response = await GNNetwork.content.requestDownloadFileUploadInfoAsync(request);
261
+
262
+ if (response.hasReturnCodeError()) {
263
+ throw new Error(response.debugMessage);
264
+ }
265
+
266
+ if (response.errorCode !== ErrorCode.Ok) {
267
+ throw new Error(`Business error: ${response.errorCode}`);
268
+ }
269
+
270
+ const url = GNNetwork.getDownloadFileUrl(response.responseData.downloadToken);
271
+ ```
272
+
273
+ ## 11. Anti-Patterns
274
+
275
+ - Không gọi `GNNetwork.uploadFileAsync` trước khi có `fileId`.
276
+ - Không dùng `getContentDataAsync` để đọc file binary.
277
+ - Không tự ghép URL download từ `fileId`.
278
+ - Không gọi nhầm namespace role.
279
+ - Không request `getContentDataAsync` không giới hạn nếu bạn chưa chắc backend sẽ trả bao nhiêu dữ liệu.
280
+ - Không bỏ qua kiểm tra `returnCode` và `errorCode`.
281
+ - Không dùng callback style mặc định khi codebase đã support `async/await`.
282
+
283
+ ## 12. AI Checklist
284
+
285
+ - Đã `GNNetwork.init(settings)` chưa.
286
+ - Có chọn đúng namespace `content` / `content.server` / `content.admin` chưa.
287
+ - Có nhớ rằng `ContentApi` chỉ đi qua HTTP không.
288
+ - Nếu đang upload file, đã gọi `createNewFileUploadInfoAsync` trước chưa.
289
+ - Nếu đang download file, có dùng `requestDownloadFileUploadInfoAsync` rồi `getDownloadFileUrl(...)` chưa.
290
+ - Nếu đang set content, `configs` đã có đầy đủ `key` và `data` chưa.
291
+ - Có kiểm tra `hasReturnCodeError()` trước `errorCode` chưa.
@@ -0,0 +1,262 @@
1
+ # DashboardApi
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 method của `GNNetwork.dashboard`, truyền đúng input, hiểu đúng scope quản trị của nhóm này và không sinh code sai secret key.
4
+
5
+ ## 1. Scope
6
+
7
+ - Chỉ áp dụng cho `GNNetwork.dashboard`.
8
+ - Không áp dụng cho `GNNetwork.dashboard.server` và `GNNetwork.dashboard.admin` vì hiện tại 2 namespace này rỗng, không có method public.
9
+ - Toàn bộ method hiện tại của `DashboardApi` đều gửi qua HTTP.
10
+ - Toàn bộ request wrapper hiện tại của `DashboardApi` đều dùng `RequestType.Dashboard` với `RequestRole.Client`.
11
+ - Hệ quả rất quan trọng ở tầng SDK: nếu không truyền `overrideSecretKey`, request sẽ mặc định gắn `secretKey`
12
+ - Rule chuẩn để chọn `client/server/admin` và hiểu semantics permission xem [RULES](../RULES.md#3-route--trust-boundary-của-caller), nhưng `DashboardApi` là ngoại lệ vì public SDK wrapper này vẫn đi qua `RequestRole.Client`.
13
+ - Trong triển khai GearN Server hiện tại, sau `loginByAdminAccountAsync` thành công backend middleware sẽ resolve secret context và quyền riêng của admin từ `authToken` cho các request dashboard tiếp theo.
14
+ - Đây là nhóm API dành cho dashboard, backoffice, provisioning, analytics và maintenance. Không dùng thay cho gameplay API của player.
15
+ - Nếu cần login player, dùng `AuthenticateApi`. Nếu cần data/player runtime, dùng group tương ứng khác.
16
+
17
+ ## 2. Hard Rules
18
+
19
+ - Luôn ưu tiên `async/await`. Mặc định dùng `GNNetwork.dashboard.*Async()`.
20
+ - Bắt buộc đã `GNNetwork.init(settings)` trước khi gọi.
21
+ - Không dùng `GNNetwork.dashboard.server.*` hoặc `GNNetwork.dashboard.admin.*` vì hiện chưa có method nào để gọi.
22
+ - Với triển khai GearN Server hiện tại, quyền admin riêng của account sau login được backend middleware resolve từ `authToken`, không phải do SDK tự đổi sang admin secret key local.
23
+ - Chỉ truyền `overrideSecretKey` khi bạn cố ý bypass flow mặc định ở trên.
24
+ - `DashboardApi` không có flow socket. Không dùng `connectSocket()` hay `sendRequestAuthSocket()` cho nhóm này.
25
+ - `loginByAdminAccountAsync` là entrypoint hợp lý để lấy admin auth token trước khi gọi các operation quản trị khác.
26
+ - `loginByAdminAccountAsync` chỉ trả `authToken`. Không giả định response có `userId`.
27
+ - `deleteInDatabaseAsync` và `resetStatisticsLeaderboardAsync` là operation phá hủy hoặc reset dữ liệu. Chỉ dùng khi có chủ đích vận hành rõ ràng.
28
+
29
+ ## 3. Chọn Method
30
+
31
+ ### Auth và quản trị admin account
32
+
33
+ | Method | Dùng khi nào | Cần truyền gì | Nhận được gì | Ghi chú | ErrorCode
34
+ | --- | --- | --- | --- | --- | --- |
35
+ | `loginByAdminAccountAsync` | Login dashboard/admin tool | `username`, `password` | `LoginByAdminAccountResponseData` | Response chỉ có `authToken` | `Ok`, `AccountNotFound` |
36
+ | `changePasswordAdminAccountAsync` | Admin hiện tại tự đổi mật khẩu của chính mình | `currentPassword`, `password` | `EmptyResponseData` | Nên dùng sau khi đã login | `Ok`, `AccountNotFound` |
37
+ | `getAdminAccountListAsync` | Liệt kê admin account | request rỗng | `GetAdminAccountListResponseData` | Dùng cho màn hình quản trị account | `Ok` |
38
+ | `createAdminAccountAsync` | Tạo admin account mới | `username`, `password`, `secretKey` | `CreateAdminAccountResponseData` | Response trả danh sách `userId` tạo ra | `Ok`, `AccountUsernameExists` |
39
+ | `getUsernameAdminAccountAsync` | Tìm username từ `userId` admin | `userId` | `GetUsernameAdminAccountResponseData` | Dùng khi chỉ có `userId` | `Ok`, `AccountNotFound` |
40
+ | `setPasswordAdminAccountAsync` | Đặt lại mật khẩu cho admin khác | `userId`, `password` | `EmptyResponseData` | Không dùng cho self-service đổi mật khẩu | `Ok`, `AccountNotFound` |
41
+ | `setSecretKeyAdminAccountAsync` | Gán hoặc đổi secret key của admin account | `userId`, `secretKey` | `EmptyResponseData` | Thao tác nhạy cảm | `Ok`, `AccountNotFound`, `SecretInfoNotFound` |
42
+ | `removeAdminAccountAsync` | Xóa admin account | `userId` | `EmptyResponseData` | Destructive | `Ok`, `AccountNotFound` |
43
+
44
+ ### Quản lý game và cấu hình
45
+
46
+ | Method | Dùng khi nào | Cần truyền gì | Nhận được gì | Ghi chú | ErrorCode
47
+ | --- | --- | --- | --- | --- | --- |
48
+ | `getGameListAsync` | Liệt kê game id hiện có | request rỗng | `GetGameListResponseData` | Dùng trước khi chọn `gameId` | `Ok` |
49
+ | `createGameAsync` | Tạo game mới | `gameId` | `GameWithGameIdResponseData` | Chỉ tạo identity cơ bản của game | `Ok`, `GameExists` |
50
+ | `getGameInformationAsync` | Đọc metadata và settings của một game | `gameId` | `GetGameInformationResponseData` | Trả `gameName`, `gameDescription`, `gameSettings`, `matchmakingQueueSettings` | `Ok`, `GameNotFound` |
51
+ | `setGameInformationAsync` | Cập nhật metadata/settings của game | `gameId` và field cần đổi | `EmptyResponseData` | Chỉ set field thật sự cần đổi | `Ok`, `GameNotFound` |
52
+ | `getMasterGameSettingsAsync` | Đọc global settings của server/game platform | request rỗng | `GetMasterGameSettingsResponseData` | Trả `thirtPartySettings`, `masterPlayerSettings`, `emailSettings`, `pushNotificationSettings` | `Ok` |
53
+ | `setMasterGameSettingsAsync` | Cập nhật global settings | hashtable settings cần đổi | `EmptyResponseData` | Không nên gửi full object nếu không cần | `Ok` |
54
+ | `getServerGameDataAsync` | Lấy snapshot số lượng entity và version của một game | `gameId` và các boolean flag cần lấy | `GetServerGameDataResponseData` | Chỉ bật các flag cần thiết để giảm payload | `Ok` |
55
+
56
+ ### Secret key và permission
57
+
58
+ | Method | Dùng khi nào | Cần truyền gì | Nhận được gì | Ghi chú | ErrorCode
59
+ | --- | --- | --- | --- | --- | --- |
60
+ | `getSecretInfoListAsync` | Liệt kê secret key theo role | request rỗng | `GetSecretInfoListResponseData` | Trả `secretKeys` | `Ok` |
61
+ | `getSecretInfoInformationAsync` | Xem chi tiết một secret key | `secretKey` | `GetSecretInfoInformationResponseData` | Trả `gameId`, `permissionParam`, `tsExpire`, `remove` | `Ok`, `SecretInfoNotFound` |
62
+ | `createSecretInfoAsync` | Tạo secret key mới và tùy chọn `secretKey`, `gameId`, `permissionParam` | `SecretInfoWithSecretKeyResponseData` | `secretKey` đang optional trong model; AI có thể bỏ qua nếu muốn backend sinh key | `Ok`, `SecretInfoExists` |
63
+ | `setSecretInfoInformationAsync` | Cập nhật expire, description, permission hoặc remove flag của secret key | `secretKey` và field cần đổi | `EmptyResponseData` | Dùng để revoke hoặc thay permission | `Ok`, `SecretInfoNotFound` |
64
+
65
+ ### Analytics, logs và callback
66
+
67
+ | Method | Dùng khi nào | Cần truyền gì | Nhận được gì | Ghi chú | ErrorCode
68
+ | --- | --- | --- | --- | --- | --- |
69
+ | `getAnalyticsAsync` | Lấy analytics tổng hợp | các boolean flag cần lấy, `timestamp?` | `GetAnalyticsResponseData` | Không bật tất cả flag một cách mù quáng | `Ok`, `ItemNotFound` |
70
+ | `getServerLogAsync` | Lấy log server dạng phân trang | `skip?`, `limit?` | `GetServerLogResponseData` | Model mặc định `skip = 0`, `limit = 50` | `Ok` |
71
+ | `getEventCallbackCloudScriptAsync` | Liệt kê callback CloudScript theo event | request rỗng | `GetEventCallbackCloudScriptResponseData` | Dùng để inspect cấu hình hiện tại | `Ok` |
72
+ | `setEventCallbackCloudScriptAsync` | Tạo hoặc sửa callback CloudScript theo event | `eventName`, `script` | `SetEventCallbackCloudScriptResponseData` | Response có `errorMessage` | `Ok`, `ExecuteError` |
73
+ | `getBackupStatisticsLeaderboardVersionAsync` | Liệt kê version backup của leaderboard | `gameId`, `type`, `key` | `GetBackupStatisticsLeaderboardVersionResponseData` | `type` phải lấy từ `OwnerType` | `Ok`, `OwnerNotFound` |
74
+
75
+ ### Maintenance và thao tác phá hủy
76
+
77
+ | Method | Dùng khi nào | Cần truyền gì | Nhận được gì | Ghi chú | ErrorCode
78
+ | --- | --- | --- | --- | --- | --- |
79
+ | `resetStatisticsLeaderboardAsync` | Reset một version leaderboard | `type`, `key`, `version`, `gameId`, `log?`, `catalogId?` | `EmptyResponseData` | Destructive; chỉ dùng khi operator đã chốt loại leaderboard | `Ok`, `KeyNotFound`, `OwnerTypeNotSupport`, `VersionInvalid` |
80
+ | `deleteInDatabaseAsync` | Xóa dữ liệu trực tiếp theo loại và id | `type`, `id`, `gameId`, `log?` | `EmptyResponseData` | `type` phải lấy từ `OwnerType` | `Ok`, `ItemNotFound` |
81
+
82
+ ## 4. Decision Rules
83
+
84
+ - Cần login admin: dùng `loginByAdminAccountAsync` trước.
85
+ - Cần đổi mật khẩu của chính admin hiện tại: dùng `changePasswordAdminAccountAsync`.
86
+ - Cần quản lý admin account khác: dùng bộ `getAdminAccountListAsync`, `createAdminAccountAsync`, `getUsernameAdminAccountAsync`, `setPasswordAdminAccountAsync`, `setSecretKeyAdminAccountAsync`, `removeAdminAccountAsync`.
87
+ - Cần tạo game mới: dùng `createGameAsync`, sau đó `setGameInformationAsync` nếu cần metadata/settings.
88
+ - Cần đọc hoặc cập nhật cấu hình global: dùng `getMasterGameSettingsAsync` hoặc `setMasterGameSettingsAsync`.
89
+ - Cần quản lý secret key: bắt đầu từ `getSecretInfoListAsync` hoặc `getSecretInfoInformationAsync`, sau đó mới `createSecretInfoAsync` hoặc `setSecretInfoInformationAsync`.
90
+ - Cần analytics hoặc log: dùng `getAnalyticsAsync`, `getServerLogAsync`, `getServerGameDataAsync` với payload tối giản.
91
+ - Cần callback CloudScript theo event: dùng `getEventCallbackCloudScriptAsync` để inspect trước, rồi `setEventCallbackCloudScriptAsync`.
92
+ - Cần reset leaderboard hoặc xóa dữ liệu: chỉ dùng khi operator đã xác nhận chính xác `type`, `key`, `version`, `id`, `gameId` và hậu quả.
93
+
94
+ ## 5. Request Rules và Reference
95
+
96
+ - DTO fields: [reference/dto/DASHBOARD.md](../reference/dto/DASHBOARD.md). Method table: [reference/API_DASHBOARD.md](../reference/API_DASHBOARD.md).
97
+ - Enums: [OwnerType](../reference/ENUMS.md#ownertype).
98
+ - Fallback `dist` chỉ khi reference docs chưa đủ: `dist/runtime/entity/models/Dashboard*.d.ts`.
99
+ - `DashboardApi` hiện `type` phải lấy từ `OwnerType` trong `resetStatisticsLeaderboard` hoặc `deleteInDatabase`.
100
+ - Nếu codebase hiện tại không có constant nghiệp vụ cho các numeric field đó, AI không được tự bịa giá trị.
101
+ - `GetServerLogRequestData` có phân trang mềm bằng `skip` và `limit`; không request log vô hạn.
102
+ - `GetAnalyticsRequestData` và `GetServerGameDataRequestData` đều dùng nhiều boolean flag để điều khiển payload; chỉ bật field thật sự cần.
103
+
104
+ ## 6. Response Rules
105
+
106
+ Tất cả typed response của `DashboardApi` đều có các field low-level giống các nhóm API khác:
107
+
108
+ - `returnCode`
109
+ - `debugMessage`
110
+ - `invalidMembers`
111
+ - `errorCode`
112
+ - `responseData`
113
+
114
+ Rule kiểm tra response:
115
+
116
+ ```ts
117
+ if (response.hasReturnCodeError()) {
118
+ throw new Error(response.debugMessage);
119
+ }
120
+
121
+ if (response.errorCode !== ErrorCode.Ok) {
122
+ throw new Error(`Business error: ${response.errorCode}`);
123
+ }
124
+ ```
125
+
126
+ Những response quan trọng AI cần nhớ:
127
+
128
+ - `loginByAdminAccountAsync` trả `LoginByAdminAccountResponseData` với `authToken`.
129
+ - `createAdminAccountAsync` trả `CreateAdminAccountResponseData` chứa danh sách `userId`.
130
+ - `getGameInformationAsync` trả metadata/settings đầy đủ của game.
131
+ - `getMasterGameSettingsAsync` trả các hashtable settings cấp hệ thống.
132
+ - `getSecretInfoListAsync` trả danh sách secret key theo từng role.
133
+ - `setEventCallbackCloudScriptAsync` trả `errorMessage` trong `responseData`; cần kiểm tra nếu backend trả message lỗi nghiệp vụ.
134
+ - Nhiều operation mutate chỉ trả `EmptyResponseData`. Đừng mong đợi payload chi tiết sau khi set/remove/reset/delete.
135
+
136
+ Ghi chú quan trọng:
137
+
138
+ - `loginByAdminAccountAsync` có thể giúp SDK cache `authToken`.
139
+ - Trong triển khai GearN Server hiện tại, chính `authToken` này là thứ backend middleware dùng để resolve secret context và quyền riêng của admin cho các request dashboard tiếp theo.
140
+ - Không có bằng chứng từ response model rằng flow này cũng trả `userId`, nên AI không được giả định `GNNetwork.getAuthenticateStatus().getUserId()` sẽ có giá trị mới sau login admin.
141
+
142
+ ## 7. Best Practices
143
+
144
+ - Với admin/dashboard flow, mặc định login trước rồi mới gọi các operation còn lại.
145
+ - Sau khi login admin thành công, ưu tiên để các request dashboard tiếp theo đi theo `authToken` đã cache thay vì cố tự override secret key.
146
+ - Chỉ truyền `overrideSecretKey` khi bạn cố ý bypass flow middleware mặc định đó.
147
+ - Với analytics và snapshot data, chỉ bật các flag thật sự cần để giảm payload.
148
+ - Với game provisioning, tách `createGameAsync` và `setGameInformationAsync` thành 2 bước rõ ràng.
149
+ - Với secret management, inspect trước bằng `getSecretInfoListAsync` hoặc `getSecretInfoInformationAsync` rồi mới mutate.
150
+ - Với `createSecretInfoAsync`, có thể bỏ qua `secretKey` nếu backend của bạn cho phép sinh tự động; đây là suy luận hợp lý từ model vì field đang optional và response trả lại `secretKey`.
151
+ - Với operation phá hủy dữ liệu, luôn ghi `log` nếu backend/workflow của bạn dùng trường này để audit.
152
+
153
+ ## 8. Ví dụ Khuyến Nghị
154
+
155
+ ### Login admin
156
+
157
+ ```ts
158
+ import {
159
+ GNNetwork,
160
+ DashboardModels,
161
+ ErrorCode,
162
+ } from "@xmobitea/gn-typescript-client";
163
+
164
+ const request = new DashboardModels.LoginByAdminAccountRequestData();
165
+ request.username = "gnadmin";
166
+ request.password = "123456";
167
+
168
+ const response = await GNNetwork.dashboard.loginByAdminAccountAsync(request);
169
+
170
+ if (response.hasReturnCodeError()) {
171
+ throw new Error(response.debugMessage);
172
+ }
173
+
174
+ if (response.errorCode !== ErrorCode.Ok) {
175
+ throw new Error(`Business error: ${response.errorCode}`);
176
+ }
177
+
178
+ const adminAuthToken = GNNetwork.getAuthenticateStatus().getAuthToken();
179
+ ```
180
+
181
+ ### Tạo game rồi cập nhật metadata
182
+
183
+ ```ts
184
+ import {
185
+ GNNetwork,
186
+ DashboardModels,
187
+ ErrorCode,
188
+ } from "@xmobitea/gn-typescript-client";
189
+
190
+ const createRequest = new DashboardModels.CreateGameRequestData();
191
+ createRequest.gameId = "demo-game";
192
+
193
+ const createResponse = await GNNetwork.dashboard.createGameAsync(createRequest);
194
+
195
+ if (createResponse.hasReturnCodeError()) {
196
+ throw new Error(createResponse.debugMessage);
197
+ }
198
+
199
+ if (createResponse.errorCode !== ErrorCode.Ok) {
200
+ throw new Error(`Business error: ${createResponse.errorCode}`);
201
+ }
202
+
203
+ const updateRequest = new DashboardModels.SetGameInformationRequestData();
204
+ updateRequest.gameId = "demo-game";
205
+ updateRequest.gameName = "Demo Game";
206
+ updateRequest.gameDescription = "Internal demo project";
207
+
208
+ const updateResponse = await GNNetwork.dashboard.setGameInformationAsync(updateRequest);
209
+
210
+ if (updateResponse.hasReturnCodeError()) {
211
+ throw new Error(updateResponse.debugMessage);
212
+ }
213
+
214
+ if (updateResponse.errorCode !== ErrorCode.Ok) {
215
+ throw new Error(`Business error: ${updateResponse.errorCode}`);
216
+ }
217
+ ```
218
+
219
+ ### Tạo secret key cho server role
220
+
221
+ ```ts
222
+ import {
223
+ GNNetwork,
224
+ DashboardModels,
225
+ RequestRole,
226
+ ErrorCode,
227
+ } from "@xmobitea/gn-typescript-client";
228
+
229
+ const request = new DashboardModels.CreateSecretInfoRequestData();
230
+ request.gameId = "demo-game";
231
+
232
+ const response = await GNNetwork.dashboard.createSecretInfoAsync(request);
233
+
234
+ if (response.hasReturnCodeError()) {
235
+ throw new Error(response.debugMessage);
236
+ }
237
+
238
+ if (response.errorCode !== ErrorCode.Ok) {
239
+ throw new Error(`Business error: ${response.errorCode}`);
240
+ }
241
+
242
+ const generatedSecretKey = response.responseData.secretKey;
243
+ ```
244
+
245
+ ## 9. Anti-Patterns
246
+
247
+ - Không gọi `GNNetwork.dashboard.server` hoặc `GNNetwork.dashboard.admin`.
248
+ - Không bỏ qua bước `loginByAdminAccountAsync` rồi vẫn mong backend tự hiểu request dashboard là admin request.
249
+ - Không dùng `DashboardApi` như gameplay API cho client/player thường.
250
+ - Không gọi `deleteInDatabaseAsync` hoặc `resetStatisticsLeaderboardAsync` nếu chưa có xác nhận vận hành rõ ràng.
251
+ - Không request full analytics/full snapshot nếu chỉ cần một vài metric.
252
+ - Không giả định `loginByAdminAccountAsync` trả `userId`.
253
+ - Không dùng callback style mặc định khi codebase đã support `async/await`.
254
+
255
+ ## 10. AI Checklist
256
+
257
+ - Đã `GNNetwork.init(settings)` chưa.
258
+ - Có đang dùng đúng `GNNetwork.dashboard.*Async()` không.
259
+ - Có nhớ rằng toàn bộ `DashboardApi` hiện dùng `RequestRole.Client` và HTTP không.
260
+ - Có cần login admin trước khi gọi operation hiện tại không.
261
+ - Nếu operation là destructive, đã có xác nhận rõ về hậu quả chưa.
262
+ - Có kiểm tra `hasReturnCodeError()` trước `errorCode` chưa.