/// <summary> /// Synchronize with DLC entitlements in PSN Store. /// </summary> /// <param name="PSSyncModel"> Contains ServiceLabel needed for PlayStation DLC sync</param> /// <param name="callback"> Returns a Result via callback when completed</param> public void SyncPSNDLC(PlayStationDLCSync PSSyncModel, ResultCallback callback) { Report.GetFunctionLog(this.GetType().Name); if (!this.session.IsValid()) { callback.TryError(ErrorCode.IsNotLoggedIn); return; } this.coroutineRunner.Run( this.api.SyncPSNDLC( this.@namespace, this.session.UserId, this.session.AuthorizationToken, PSSyncModel, callback )); }
public IEnumerator SyncPSNDLC(string @namespace, string userId, string userAccessToken, PlayStationDLCSync playStationDLCSync, 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!"); var request = HttpRequestBuilder .CreatePut(this.baseUrl + "/public/namespaces/{namespace}/users/{userId}/dlc/psn/sync") .WithPathParam("namespace", @namespace) .WithPathParam("userId", userId) .WithBearerAuth(userAccessToken) .WithContentType(MediaType.ApplicationJson) .WithBody(string.Format("{\"serviceLabel\": \"{0}\"}", playStationDLCSync.serviceLabel)) .GetResult(); IHttpResponse response = null; yield return(this.httpClient.SendRequest(request, rsp => response = rsp)); var result = response.TryParse(); callback.Try(result); }