Mako/MakoClient.Extensions.cs
/// <summary>
///     Gets the details of a spotlight from its ID which contains the article information, introduction, and illustrations
/// </summary>
/// <param name="spotlightId">The ID of the spotlight</param>
/// <returns>A <see cref="Task{TResult}" /> contains the result of the operation</returns>
Gets the details of a spotlight from its ID which contains the article information, introduction, and illustrations
Gets the details of a spotlight from its ID which contains the article information introduction and illustrations
public async Task<SpotlightDetail?> GetSpotlightDetailAsync(string spotlightId)
        {
            EnsureNotCancelled();
            var result = (await GetMakoHttpClient(MakoApiKind.WebApi)
                    .GetStringResultAsync($"/ajax/showcase/article?article_id={spotlightId}",
                        message => MakoNetworkException.FromHttpResponseMessageAsync(message, Configuration.Bypass))
                    .ConfigureAwait(false))
                .GetOrThrow().FromJson<PixivSpotlightDetailResponse>();
            if (result?.ResponseBody is null)
            {
                return null;
            }
            var illustrations = await (result.ResponseBody.First().Illusts?.SelectNotNull(illust => Task.Run(() => GetIllustrationFromIdAsync(illust.IllustId.ToString()))).WhenAll()
                                       ?? Task.FromResult(Array.Empty<Illustration>())).ConfigureAwait(false);
            var entry = result.ResponseBody.First().Entry;
            return new SpotlightDetail(new SpotlightArticle
            {
                Id = long.Parse(entry?.Id ?? "0"),
                Title = entry?.Title,
                ArticleUrl = entry?.ArticleUrl,
                PublishDate = DateTimeOffset.FromUnixTimeSeconds(entry?.PublishDate ?? 0),
                Thumbnail = result.ResponseBody.First().ThumbnailUrl
            }, entry?.Intro ?? string.Empty, illustrations);
        }
public async Task < SpotlightDetail ? > GetSpotlightDetailAsync ( string spotlightId ) { EnsureNotCancelled ( ) ; var result = ( await GetMakoHttpClient ( MakoApiKind . WebApi ) . GetStringResultAsync ( $" /ajax/showcase/article?article_id= { spotlightId } " , message => MakoNetworkException . FromHttpResponseMessageAsync ( message , Configuration . Bypass ) ) . ConfigureAwait ( false ) ) . GetOrThrow ( ) . FromJson < PixivSpotlightDetailResponse > ( ) ; if ( result ? . ResponseBody is null ) { return null ; } var illustrations = await ( result . ResponseBody . First ( ) . Illusts ? . SelectNotNull ( illust => Task . Run ( ( ) => GetIllustrationFromIdAsync ( illust . IllustId . ToString ( ) ) ) ) . WhenAll ( ) ?? Task . FromResult ( Array . Empty < Illustration > ( ) ) ) . ConfigureAwait ( false ) ; var entry = result . ResponseBody . First ( ) . Entry ; return new SpotlightDetail ( new SpotlightArticle { Id = long . Parse ( entry ? . Id ?? " " ) , Title = entry ? . Title , ArticleUrl = entry ? . ArticleUrl , PublishDate = DateTimeOffset . FromUnixTimeSeconds ( entry ? . PublishDate ?? 0 ) , Thumbnail = result . ResponseBody . First ( ) . ThumbnailUrl } , entry ? . Intro ?? string . Empty , illustrations ) ; }
Gets the details of a spotlight from its ID which contains the article information, introduction, and illustrations
Gets the details of a spotlight from its ID which contains the article information introduction and illustrations
A  contains the result of the operation
A contains the result of the operation
spotlightId
string
The ID of the spotlight
The ID of the spotlight