/// <summary> /// Synchronize Xbox inventory's DLC items. /// </summary> /// <param name="XboxDLCSync"> Contains XSTSToken needed for Xbox DLC sync</param> /// <param name="callback"> Returns a Result via callback when completed</param> public void SyncXBoxDLC(XBoxDLCSync XboxDLCSync, ResultCallback callback) { Report.GetFunctionLog(this.GetType().Name); if (!this.session.IsValid()) { callback.TryError(ErrorCode.IsNotLoggedIn); return; } this.coroutineRunner.Run( this.api.SyncXBoxDLC( this.@namespace, this.session.UserId, this.session.AuthorizationToken, XboxDLCSync, callback )); }
public IEnumerator SyncXBoxDLC(string @namespace, string userId, string userAccessToken, XBoxDLCSync XBoxDLCSync, ResultCallback callback) { Assert.IsNotNull(@namespace, "Can't sync DLC item! Namespace parameter is null!"); Assert.IsNotNull(userId, "Can't sync DLC item! UserId parameter is null!"); Assert.IsNotNull(userAccessToken, "Can't sync DLC item! userAccessToken parameter is null!"); string content = "{}"; if (!string.IsNullOrEmpty(XBoxDLCSync.xstsToken)) { content = string.Format("{\"xstsToken\": \"{0}\"}", XBoxDLCSync.xstsToken); } var request = HttpRequestBuilder .CreatePut(this.baseUrl + "/public/namespaces/{namespace}/users/{userId}/dlc/xbl/sync") .WithPathParam("namespace", @namespace) .WithPathParam("userId", userId) .WithBearerAuth(userAccessToken) .WithContentType(MediaType.ApplicationJson) .WithBody(content) .GetResult(); IHttpResponse response = null; yield return(this.httpClient.SendRequest(request, rsp => response = rsp)); var result = response.TryParse(); callback.Try(result); }