コード例 #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);
        }
コード例 #2
0
ファイル: Alias.cs プロジェクト: morphologue/IdentityWsClient
        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);
            }
        }
コード例 #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);
            }
        }