예제 #1
0
        public async IAsyncEnumerable <Comment> GetCommentsAsync([EnumeratorCancellation] CancellationToken cancellation = default)
        {
            var response = await _client.Api.GetIllustCommentsAsync(authToken : await _client.CheckTokenAsync(),
                                                                    illustId : Id,
                                                                    cancellation : cancellation).ConfigureAwait(false);

            while (response is not null)
            {
                foreach (var c in response.Comments)
                {
                    yield return(new Comment(_client, this, c));
                }

                response = await _client.Api.GetNextPageAsync(await _client.CheckTokenAsync(),
                                                              response,
                                                              cancellation).ConfigureAwait(false);
            }
        }