private async Task <PNResult <PNMembershipsResult> > GetMembershipsList(string uuid, PNPageObject page, int limit, bool includeCount, string includeOptions, string filter, List <string> sort, Dictionary <string, object> externalQueryParam) { PNResult <PNMembershipsResult> ret = new PNResult <PNMembershipsResult>(); if (string.IsNullOrEmpty(uuid)) { uuid = config.Uuid; } PNPageObject internalPage; if (page == null) { internalPage = new PNPageObject(); } else { internalPage = page; } IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildGetAllMembershipsRequest("GET", "", uuid, internalPage.Next, internalPage.Prev, limit, includeCount, includeOptions, filter, sort, externalQueryParam); RequestState <PNMembershipsResult> requestState = new RequestState <PNMembershipsResult>(); requestState.ResponseType = PNOperationType.PNGetMembershipsOperation; requestState.Reconnect = false; requestState.EndPointOperation = this; requestState.UsePostMethod = false; Tuple <string, PNStatus> JsonAndStatusTuple = await UrlProcessRequest(request, requestState, false).ConfigureAwait(false); ret.Status = JsonAndStatusTuple.Item2; string json = JsonAndStatusTuple.Item1; if (!string.IsNullOrEmpty(json)) { List <object> resultList = ProcessJsonResponse(requestState, json); ResponseBuilder responseBuilder = new ResponseBuilder(config, jsonLibrary, pubnubLog); PNMembershipsResult responseResult = responseBuilder.JsonToObject <PNMembershipsResult>(resultList, true); if (responseResult != null) { ret.Result = responseResult; } } return(ret); }
private void GetMembershipsList(string uuid, PNPageObject page, int limit, bool includeCount, string includeOptions, string filter, List <string> sort, Dictionary <string, object> externalQueryParam, PNCallback <PNMembershipsResult> callback) { if (string.IsNullOrEmpty(uuid)) { uuid = config.Uuid; } PNPageObject internalPage; if (page == null) { internalPage = new PNPageObject(); } else { internalPage = page; } IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildGetAllMembershipsRequest("GET", "", uuid, internalPage.Next, internalPage.Prev, limit, includeCount, includeOptions, filter, sort, externalQueryParam); RequestState <PNMembershipsResult> requestState = new RequestState <PNMembershipsResult>(); requestState.ResponseType = PNOperationType.PNGetMembershipsOperation; requestState.PubnubCallback = callback; requestState.Reconnect = false; requestState.EndPointOperation = this; requestState.UsePostMethod = false; UrlProcessRequest(request, requestState, false).ContinueWith(r => { string json = r.Result.Item1; if (!string.IsNullOrEmpty(json)) { List <object> result = ProcessJsonResponse(requestState, json); ProcessResponseCallbacks(result, requestState); } else { if (r.Result.Item2 != null) { callback.OnResponse(null, r.Result.Item2); } } }, TaskContinuationOptions.ExecuteSynchronously).Wait(); }
private void GetMembershipsList(string userId, PNPage page, int limit, bool includeCount, string includeOptions, Dictionary <string, object> externalQueryParam, PNCallback <PNGetMembershipsResult> callback) { if (callback == null) { throw new ArgumentException("Missing callback"); } PNPage internalPage; if (page == null) { internalPage = new PNPage(); } else { internalPage = page; } IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr); urlBuilder.PubnubInstanceId = (PubnubInstance != null) ? PubnubInstance.InstanceId : ""; Uri request = urlBuilder.BuildGetAllMembershipsRequest(userId, internalPage.Next, internalPage.Prev, limit, includeCount, includeOptions, externalQueryParam); RequestState <PNGetMembershipsResult> requestState = new RequestState <PNGetMembershipsResult>(); requestState.ResponseType = PNOperationType.PNGetMembershipsOperation; requestState.PubnubCallback = callback; requestState.Reconnect = false; requestState.EndPointOperation = this; string json = ""; requestState.UsePostMethod = false; json = UrlProcessRequest <PNGetMembershipsResult>(request, requestState, false); if (!string.IsNullOrEmpty(json)) { List <object> result = ProcessJsonResponse <PNGetMembershipsResult>(requestState, json); ProcessResponseCallbacks(result, requestState); } }