public static void SubsequentRequests(Action <LootLockerSubsequentRequestsResponse> onComplete) { EndPointClass endPoint = LootLockerEndPointsAdmin.current.subsequentRequests; LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, null, (serverResponse) => { LootLockerSubsequentRequestsResponse response = new LootLockerSubsequentRequestsResponse(); if (string.IsNullOrEmpty(serverResponse.Error)) { response = JsonConvert.DeserializeObject <LootLockerSubsequentRequestsResponse>(serverResponse.text); response.text = serverResponse.text; onComplete?.Invoke(response); } else { response.message = serverResponse.message; response.Error = serverResponse.Error; onComplete?.Invoke(response); } }, useAuthToken: true, callerRole: LootLocker.LootLockerEnums.LootLockerCallerRole.Admin); }
protected override void RefreshTokenAndCompleteCall(LootLockerServerRequest cacheServerRequest, Action <LootLockerResponse> OnServerResponse) { var authRequest = new LootLockerInitialAuthRequest(); authRequest.email = activeConfig.email; authRequest.password = activeConfig.password; LootLockerAPIManagerAdmin.InitialAuthenticationRequest(authRequest, (response) => { if (response.success) { Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("x-auth-token", activeConfig.token); cacheServerRequest.extraHeaders = headers; if (cacheServerRequest.retryCount < 4) { SendRequest(cacheServerRequest, OnServerResponse); cacheServerRequest.retryCount++; } else { LootLockerSDKAdminManager.DebugMessage("Admin token refresh failed"); LootLockerResponse res = new LootLockerResponse(); res.statusCode = 401; res.Error = "Admin token Expired"; res.hasError = true; OnServerResponse?.Invoke(res); } } else { LootLockerSDKAdminManager.DebugMessage("Admin token refresh failed", true); LootLockerResponse res = new LootLockerResponse(); res.statusCode = 401; res.Error = "Admin token Expired"; res.hasError = true; OnServerResponse?.Invoke(res); } }); }
public static void GettingAllEvents(LootLockerGetRequest lootLockerGetRequest, Action <LootLockerGettingAllEventsResponse> onComplete) { EndPointClass endPoint = LootLockerEndPointsAdmin.current.gettingAllEvents; string getVariable = string.Format(endPoint.endPoint, lootLockerGetRequest.getRequests[0]); LootLockerServerRequest.CallAPI(getVariable, endPoint.httpMethod, "", (serverResponse) => { LootLockerGettingAllEventsResponse response = new LootLockerGettingAllEventsResponse(); if (string.IsNullOrEmpty(serverResponse.Error)) { response = JsonConvert.DeserializeObject <LootLockerGettingAllEventsResponse>(serverResponse.text); response.text = serverResponse.text; onComplete?.Invoke(response); } else { response.message = serverResponse.message; response.Error = serverResponse.Error; onComplete?.Invoke(response); } }, useAuthToken: true, callerRole: LootLocker.LootLockerEnums.LootLockerCallerRole.Admin); }
public static void DeleteFile(string fileId, Action <LootLockerDeleteFileResponse> onComplete) { var endPointInfo = LootLockerEndPointsAdmin.current.deleteFile; string getVariable = string.Format(endPointInfo.endPoint, LootLockerBaseServerAPI.activeConfig.gameID, fileId); LootLockerServerRequest.CallAPI(getVariable, endPointInfo.httpMethod, "", (serverResponse) => { var response = new LootLockerDeleteFileResponse(); if (string.IsNullOrEmpty(serverResponse.Error)) { response = JsonConvert.DeserializeObject <LootLockerDeleteFileResponse>(serverResponse.text); response.text = serverResponse.text; onComplete?.Invoke(response); } else { response.message = serverResponse.message; response.Error = serverResponse.Error; onComplete?.Invoke(response); } }, useAuthToken: true, callerRole: LootLocker.LootLockerEnums.LootLockerCallerRole.Admin); }
public static void CreateTriggers(LootLockerCreateTriggersRequest requestData, LootLockerGetRequest data, Action <LootLockerListTriggersResponse> onComplete) { string json = ""; if (requestData == null) { return; } else { json = JsonConvert.SerializeObject(requestData); } EndPointClass endPoint = LootLockerEndPoints.current.createTriggers; string getVariable = string.Format(endPoint.endPoint, data.getRequests[0]); LootLockerServerRequest.CallAPI(getVariable, endPoint.httpMethod, json, (serverResponse) => { var response = new LootLockerListTriggersResponse(); if (string.IsNullOrEmpty(serverResponse.Error)) { response = JsonConvert.DeserializeObject <LootLockerListTriggersResponse>(serverResponse.text); response.text = serverResponse.text; onComplete?.Invoke(response); } else { response.text = serverResponse.text; response.message = serverResponse.message; response.Error = serverResponse.Error; onComplete?.Invoke(response); } }, useAuthToken: true, callerRole: LootLocker.LootLockerEnums.LootLockerCallerRole.Admin); }
public static void RemoveTwoFactorAuthentication(LootLockerVerifyTwoFactorAuthenticationRequest data, Action <LootLockerRemoveTwoFactorAuthenticationResponse> onComplete) { string json = ""; if (data == null) { return; } else { json = JsonConvert.SerializeObject(data); } Debug.Log("Removing 2FA with json: " + json); EndPointClass endPoint = LootLockerEndPointsAdmin.current.removeTwoFactorAuthentication; LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, json, (serverResponse) => { var response = new LootLockerRemoveTwoFactorAuthenticationResponse(); if (string.IsNullOrEmpty(serverResponse.Error)) { response = JsonConvert.DeserializeObject <LootLockerRemoveTwoFactorAuthenticationResponse>(serverResponse.text); response.text = serverResponse.text; onComplete?.Invoke(response); } else { response.text = serverResponse.text; response.message = serverResponse.message; response.Error = serverResponse.Error; onComplete?.Invoke(response); } }, useAuthToken: true, callerRole: LootLocker.LootLockerEnums.LootLockerCallerRole.Admin); }
public static void UpdatingEvent(LootLockerGetRequest lootLockerGetRequest, Dictionary <string, object> requestData, Action <LootLockerCreatingEventResponse> onComplete) { string json = ""; if (requestData == null) { return; } else { json = JsonConvert.SerializeObject(requestData); } EndPointClass endPoint = LootLockerEndPointsAdmin.current.updatingEvent; string getVariable = string.Format(endPoint.endPoint, lootLockerGetRequest.getRequests[0]); LootLockerServerRequest.CallAPI(getVariable, endPoint.httpMethod, json, (serverResponse) => { LootLockerCreatingEventResponse response = new LootLockerCreatingEventResponse(); if (string.IsNullOrEmpty(serverResponse.Error)) { Debug.Log("Server response for updating event: " + serverResponse.text); Debug.Log("Server response code: " + serverResponse.statusCode); response = JsonConvert.DeserializeObject <LootLockerCreatingEventResponse>(serverResponse.text); response.text = serverResponse.text; onComplete?.Invoke(response); } else { response.message = serverResponse.message; response.Error = serverResponse.Error; onComplete?.Invoke(response); } }, useAuthToken: true, callerRole: LootLocker.LootLockerEnums.LootLockerCallerRole.Admin); }
public static void UpdatingMaps(LootLockerGetRequest lootLockerGetRequest, LootLockerCreatingMapsRequest data, Action <LootLockerCreatingMapsResponse> onComplete) { string json = ""; if (data == null) { return; } else { json = JsonConvert.SerializeObject(data); } var o = (JObject)JsonConvert.DeserializeObject(json); EndPointClass endPoint = LootLockerEndPointsAdmin.current.updatingMaps; string getVariable = string.Format(endPoint.endPoint, lootLockerGetRequest.getRequests[0]); LootLockerServerRequest.CallAPI(getVariable, endPoint.httpMethod, o.ToString(), (serverResponse) => { LootLockerCreatingMapsResponse response = new LootLockerCreatingMapsResponse(); if (string.IsNullOrEmpty(serverResponse.Error)) { response = JsonConvert.DeserializeObject <LootLockerCreatingMapsResponse>(serverResponse.text); response.text = serverResponse.text; onComplete?.Invoke(response); } else { response.message = serverResponse.message; response.Error = serverResponse.Error; onComplete?.Invoke(response); } }, useAuthToken: true, callerRole: LootLocker.LootLockerEnums.LootLockerCallerRole.Admin); }