Пример #1
0
 internal Task <ListedResponse <T> > AccessApiArrayAsyncImpl <T>(MethodType type, string url, IEnumerable <KeyValuePair <string, object> > parameters, CancellationToken cancellationToken, string jsonPath)
 {
     return(this.SendRequestAsyncImpl(type, InternalUtils.GetUrl(this.ConnectionOptions, url), parameters, cancellationToken)
            .ContinueWith(
                t => InternalUtils.ReadResponse(t, s => new ListedResponse <T>(CoreBase.ConvertArray <T>(s, jsonPath)), cancellationToken),
                cancellationToken
                ).Unwrap());
 }
Пример #2
0
 internal Task <T> AccessApiAsyncImpl <T>(MethodType type, string url, IEnumerable <KeyValuePair <string, object> > parameters, CancellationToken cancellationToken, string jsonPath)
 {
     return(this.SendRequestAsyncImpl(type, InternalUtils.GetUrl(url), parameters, cancellationToken)
            .ContinueWith(
                t => InternalUtils.ReadResponse(t, s => CoreBase.Convert <T>(s, jsonPath), cancellationToken),
                cancellationToken
                ).Unwrap().CheckCanceled(cancellationToken));
 }
Пример #3
0
        internal T AccessJsonParameteredApiImpl <T>(string url, IEnumerable <KeyValuePair <string, object> > parameters, string[] jsonMap, string jsonPath, string urlPrefix, string urlSuffix)
        {
            var connectionOptions = this.ConnectionOptions;

            if (urlPrefix != null || urlSuffix != null)
            {
                connectionOptions = this.ConnectionOptions.Clone();

                if (urlPrefix != null)
                {
                    connectionOptions.UrlPrefix = urlPrefix;
                }

                if (urlSuffix != null)
                {
                    connectionOptions.UrlSuffix = urlSuffix;
                }
            }

            using (var response = this.SendJsonRequest(InternalUtils.GetUrl(connectionOptions, url), parameters, jsonMap))
                return(InternalUtils.ReadResponse <T>(response, jsonPath));
        }
Пример #4
0
 internal T AccessApiImpl <T>(MethodType type, string url, IEnumerable <KeyValuePair <string, object> > parameters, string jsonPath)
 {
     using (var response = this.SendRequestImpl(type, InternalUtils.GetUrl(this.ConnectionOptions, url), parameters))
         return(InternalUtils.ReadResponse <T>(response, jsonPath));
 }
Пример #5
0
 internal T AccessJsonParameteredApiImpl <T>(string url, IEnumerable <KeyValuePair <string, object> > parameters, string[] jsonMap, string jsonPath)
 {
     using (var response = this.SendJsonRequest(InternalUtils.GetUrl(this.ConnectionOptions, url), parameters, jsonMap))
         return(InternalUtils.ReadResponse <T>(response, jsonPath));
 }