示例#1
0
        private void GetUserList(PNPage page, int limit, bool includeCount, bool includeCustom, Dictionary <string, object> externalQueryParam, PNCallback <PNGetUsersResult> 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.BuildGetAllUsersRequest(internalPage.Next, internalPage.Prev, limit, includeCount, includeCustom, externalQueryParam);

            RequestState <PNGetUsersResult> requestState = new RequestState <PNGetUsersResult>();

            requestState.ResponseType      = PNOperationType.PNGetUsersOperation;
            requestState.PubnubCallback    = callback;
            requestState.Reconnect         = false;
            requestState.EndPointOperation = this;

            string json = "";

            requestState.UsePostMethod = false;
            json = UrlProcessRequest <PNGetUsersResult>(request, requestState, false);

            if (!string.IsNullOrEmpty(json))
            {
                List <object> result = ProcessJsonResponse <PNGetUsersResult>(requestState, json);
                ProcessResponseCallbacks(result, requestState);
            }
        }