コード例 #1
0
        public async Task <ProductDto> Get(int id)
        {
            var client   = _proxyHttpClient.Get(ProxyHttpClient.CatalogAPI);
            var response = await client.GetAsync($"products/v1/{id}");

            response.EnsureSuccessStatusCode();

            return(await response.Content.ReadAsAsync <ProductDto>());
        }
コード例 #2
0
        public async Task <DataCollection <StoreDto> > Paged(int page)
        {
            var client   = _proxyHttpClient.Get(ProxyHttpClient.CatalogAPI);
            var response = await client.GetAsync($"stores/v1?page={page}&pageSize=5");

            response.EnsureSuccessStatusCode();

            return(await response.Content.ReadAsAsync <DataCollection <StoreDto> >());
        }
コード例 #3
0
        public async Task <AccessTokenAuthModel> Authenticate(LoginAuthModel model)
        {
            var client   = _proxyHttpClient.Get(ProxyHttpClient.AuthAPI);
            var response = await client.PostAsJsonAsync("auth/login", model);

            response.EnsureSuccessStatusCode();

            return(await response.Content.ReadAsAsync <AccessTokenAuthModel>());
        }