Beispiel #1
0
        protected async Task <IClientBaseResponse <T> > GetAsync <T>(string url, string query = "", MemoryCacheOptions options = null)
        {
            if (options == null)
            {
                options = new MemoryCacheOptions();
            }
            var requestUri = Client.BuildUri(url, query);

            var result = await Client.GetAsync <T>(requestUri);

            return(result);
        }
Beispiel #2
0
        public async Task <Client> GetClientAsync(string clientName)
        {
            string       callee   = Callee(clientName);
            JsonResponse response = await _json.GetAsync(callee);

            switch (response.StatusCode)
            {
            case HttpStatusCode.NotFound:
                return(null);

            case HttpStatusCode.OK:
                return(new Client(_json, callee, clientName, response.Content.ToStringValues()));

            default:
                response.StatusCode.Throw();
                return(null);
            }
        }
Beispiel #3
0
        public async Task <Alias> GetAliasAsync(string emailAddress)
        {
            string       callee   = Callee(emailAddress);
            JsonResponse response = await _json.GetAsync(callee);

            switch (response.StatusCode)
            {
            case HttpStatusCode.NotFound:
                return(null);

            case HttpStatusCode.OK:
                return(new Alias(_json, callee, emailAddress, response.Content["confirmToken"]?.ToString()));

            default:
                response.StatusCode.Throw();
                return(null);
            }
        }