Imgur.API.Endpoints.Impl.GalleryEndpoint.ReportGalleryItemAsync C# (CSharp) Method

ReportGalleryItemAsync() public method

Report an item in the gallery. 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 ReportGalleryItemAsync ( string galleryItemId, ReportReason reason ) : Task
galleryItemId string The gallery item id.
reason ReportReason A reason why content is inappropriate.
return Task
        public async Task<bool> ReportGalleryItemAsync(string galleryItemId, ReportReason reason)
        {
            if (string.IsNullOrWhiteSpace(galleryItemId))
                throw new ArgumentNullException(nameof(galleryItemId));

            if (ApiClient.OAuth2Token == null)
                throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);

            var url = $"gallery/{galleryItemId}/report";

            using (var request = RequestBuilder.ReportItemRequest(url, reason))
            {
                var reported = await SendRequestAsync<bool>(request).ConfigureAwait(false);
                return reported;
            }
        }