Example #1
0
        private void GetSingleSpace(string spaceId, bool includeCustom, Dictionary <string, object> externalQueryParam, PNCallback <PNGetSpaceResult> callback)
        {
            if (callback == null)
            {
                throw new ArgumentException("Missing callback");
            }
            if (string.IsNullOrEmpty(spaceId))
            {
                throw new ArgumentException("Missing spaceId");
            }

            IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr);

            urlBuilder.PubnubInstanceId = (PubnubInstance != null) ? PubnubInstance.InstanceId : "";
            Uri request = urlBuilder.BuildGetSingleSpaceRequest(spaceId, includeCustom, externalQueryParam);

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

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

            string json = "";

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

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