예제 #1
0
        public async Task <UserModel> GetUserByAccessTokenAsync(string accessToken)
        {
            apiClient
            .CreateRequestMessage(HttpMethod.Get, ApiRoutes.UserAccount)
            .AddAuthorization(accessToken);

            var response = await apiClient.SendRequestAsync();

            return(await response.TryFetchContentAsync <UserModel>());
        }
예제 #2
0
        protected async Task <TResponseContent> GetRequestAsync <TResponseContent>(string uri)
            where TResponseContent : new()
        {
            ApiClient
            .CreateRequestMessage(HttpMethod.Get, uri)
            .AddAuthorization(await GetTokenAsync());

            var response = await ApiClient.SendRequestAsync();

            return((response.StatusCode == HttpStatusCode.NotFound)
                ? new TResponseContent()
                : await response.TryFetchContentAsync <TResponseContent>());
        }