Imgur.API.Endpoints.Impl.AccountEndpoint.GetAccountSettingsAsync C# (CSharp) Method

GetAccountSettingsAsync() public method

Returns the account settings. OAuth authentication required.
/// Thrown when a null reference is passed to a method that does not accept it as a /// valid argument. /// Thrown when an error is found in a response from an Imgur endpoint. Thrown when an error is found in a response from a Mashape endpoint.
public GetAccountSettingsAsync ( ) : Task
return Task
        public async Task<IAccountSettings> GetAccountSettingsAsync()
        {
            if (ApiClient.OAuth2Token == null)
                throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);

            var url = "account/me/settings";

            using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
            {
                var settings = await SendRequestAsync<AccountSettings>(request).ConfigureAwait(false);
                return settings;
            }
        }

Usage Example

コード例 #1
0
        public async Task GetAccountSettingsAsync_IsTrue()
        {
            var client = new ImgurClient(ClientId, ClientSecret, await GetOAuth2Token());
            var endpoint = new AccountEndpoint(client);

            var settings = await endpoint.GetAccountSettingsAsync();

            Assert.IsFalse(settings.PublicImages);
        }
All Usage Examples Of Imgur.API.Endpoints.Impl.AccountEndpoint::GetAccountSettingsAsync