public void RequestAdSources(List <string> zoneIds = null) { if (_requestingAdSources) { return; } _requestingAdSources = true; string adSourcesRequestUrl = Settings.mediationEndpoint + "/v1/games/" + Engine.Instance.AppId + "/adSources"; //string adSourcesRequestUrl = Settings.serverEndpoint + "/testAdSources.json"; adSourcesRequestUrl = Utils.addUrlParameters(adSourcesRequestUrl, new Dictionary <string, object>() { { "zones", zoneIds != null ? String.Join(",", zoneIds.ToArray()) : null }, { "config", configId } }); HTTPRequest request = new HTTPRequest("POST", adSourcesRequestUrl); request.addHeader("Content-Type", "application/json"); string payload = MiniJSON.Json.Serialize(new Dictionary <string, object>() { { "lastServerTimestamp", ConfigManager.Instance.serverTimestamp }, { "adTimes", ZoneManager.Instance.GetConsumeTimes(ConfigManager.Instance.serverTimestamp) } }); request.setPayload(payload); Utils.LogDebug("Requesting new ad sources from " + adSourcesRequestUrl + " with payload: " + payload); Event.EventManager.sendMediationAdSourcesEvent(Engine.Instance.AppId); HTTPManager.sendRequest(request, HandleAdSourcesResponse, retryDelays, 20 * 60); }
public void downloadJson() { string requestURLString = requestURL(); HTTPRequest jsonRequest = new HTTPRequest("POST", requestURLString); jsonRequest.addHeader("Content-Type", "application/json"); string jsonInfo = jsonPayload(); jsonRequest.setPayload(jsonInfo); HTTPManager.sendRequest(jsonRequest, HTTPJsonCallback, retryDelays, 20 * 60); }
public void execute(System.Action <bool> eventCallback) { callback = eventCallback; HTTPRequest req = new HTTPRequest("POST", url); req.addHeader("Content-Type", "application/json"); req.setPayload(jsonData); HTTPManager.sendRequest(req, HTTPCallback, retryDelayTable, deadlineDelay); }
public void RequestConfig() { if (_requestingConfig) { return; } _requestingConfig = true; string configRequestUrl = Settings.mediationEndpoint + "/v1/games/" + Engine.Instance.AppId + "/config"; //string configRequestUrl = Settings.serverEndpoint + "/testConfig.json"; HTTPRequest request = new HTTPRequest("POST", configRequestUrl); request.addHeader("Content-Type", "application/json"); if (configId != null) { request.addHeader("If-None-Match", configId); } request.setPayload(DeviceInfo.getJson()); Utils.LogDebug("Requesting new config from " + configRequestUrl); HTTPManager.sendRequest(request, HandleConfigResponse, retryDelays, 20 * 60); }