Instruction file imported from lootlocker/unity-sdk (
.github/instructions/Runtime/Game/Requests.instructions.md). Copyright stays with the author.
Scoped instructions: Runtime/Game/Requests/ (request implementations)
- Follow the established split:
- DTOs/response models in
namespace LootLocker.Requests. - Request methods in
namespace LootLockerinsidepublic partial class LootLockerAPIManager.
- DTOs/response models in
- Responses should inherit
LootLockerResponseand use property names that match server JSON (commonlysnake_case), as seen throughout this folder. - Validate inputs early. For an unserializable/missing body, return a consistent error response via
LootLockerResponseFactoryand invokeonCompleteonce. - Serialize request bodies with
LootLockerJson.SerializeObject(...)(never call Newtonsoft/ZeroDep JSON APIs directly). - Build endpoints via
LootLockerEndPoints+EndPointClass.WithPathParameter(s); avoid manual string concatenation for path params. - For query parameters, prefer
LootLocker.Utilities.HTTP.QueryParamaterBuilderwhen available; otherwise ensure values are URL-encoded (for exampleWebUtility.UrlEncode). - Use the standard transport pattern:
LootLockerServerRequest.CallAPI(..., onComplete: (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); }, useAuthToken: true/false)- Keep
useAuthTokenconsistent with the endpoint’s auth requirements and nearby examples. This variable is almost alwaystrue.
- Keep methods small and consistent with surrounding files; don’t move DTOs or rename existing public types unless explicitly requested.