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

UpdateAccountSettingsAsync() public method

Updates the account settings for a given user. 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 UpdateAccountSettingsAsync ( string bio = null, bool publicImages = null, bool messagingEnabled = null, AlbumPrivacy albumPrivacy = null, bool acceptedGalleryTerms = null, string username = null, bool showMature = null, bool newsletterSubscribed = null ) : Task
bio string The biography of the user, is displayed in the gallery profile page.
publicImages bool Set the users images to private or public by default.
messagingEnabled bool Allows the user to enable / disable private messages.
albumPrivacy AlbumPrivacy Sets the default privacy level of albums the users creates.
acceptedGalleryTerms bool The user agreement to the Imgur Gallery terms.
username string A valid Imgur username (between 4 and 63 alphanumeric characters).
showMature bool Toggle display of mature images in gallery list endpoints.
newsletterSubscribed bool Toggle subscription to email newsletter.
return Task
        public async Task<bool> UpdateAccountSettingsAsync(
            string bio = null,
            bool? publicImages = null,
            bool? messagingEnabled = null,
            AlbumPrivacy? albumPrivacy = null,
            bool? acceptedGalleryTerms = null,
            string username = null,
            bool? showMature = null,
            bool? newsletterSubscribed = null)
        {
            if (ApiClient.OAuth2Token == null)
                throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);

            var url = "account/me/settings";

            using (
                var request = RequestBuilder.UpdateAccountSettingsRequest(url, bio, publicImages, messagingEnabled,
                    albumPrivacy, acceptedGalleryTerms, username, showMature, newsletterSubscribed))
            {
                var updated = await SendRequestAsync<bool>(request).ConfigureAwait(false);
                return updated;
            }
        }

Usage Example

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

            var updated =
                await
                    endpoint.UpdateAccountSettingsAsync("ImgurClient_" + DateTimeOffset.UtcNow, false,
                        albumPrivacy: AlbumPrivacy.Hidden);

            Assert.IsTrue(updated);
        }
All Usage Examples Of Imgur.API.Endpoints.Impl.AccountEndpoint::UpdateAccountSettingsAsync