コード例 #1
0
        public static async ValueTask SerializeAsync(
            ISchema schema,
            Stream stream,
            bool indented = true,
            CancellationToken cancellationToken = default)
        {
            if (schema is null)
            {
                throw new ArgumentNullException(nameof(schema));
            }

            if (stream is null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            DocumentNode document = SerializeSchema(schema);
            await document.PrintToAsync(stream, indented, cancellationToken).ConfigureAwait(false);
        }
コード例 #2
0
        public async Task DownloadSchemaAsync(
            HttpClient client,
            Stream stream,
            CancellationToken cancellationToken = default)
        {
            if (client is null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            if (stream is null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            DocumentNode document = await DownloadSchemaAsync(
                client, cancellationToken)
                                    .ConfigureAwait(false);

            await document
            .PrintToAsync(stream, true, cancellationToken)
            .ConfigureAwait(false);
        }