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 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); }
public async Task UpdateAccountSettingsAsync_True() { var mockUrl = "https://api.imgur.com/3/account/me/settings"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockAccountEndpointResponses.UpdateAccountSettings) }; var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new AccountEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var updated = await endpoint.UpdateAccountSettingsAsync().ConfigureAwait(false); Assert.True(updated); }
public async Task UpdateAccountSettingsAsync_OAuth2Null_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new AccountEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.UpdateAccountSettingsAsync().ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }