using EonaCat.DoxaApi.Models; using System.Text.Json; namespace EonaCat.DoxaApi.Interop { // This file is part of the EonaCat project(s) which is released under the Apache License. // See the LICENSE file or go to https://EonaCat.com/license for full license details. public static class DoxaApiImporter { public static ApiDocument Import(string json) { return JsonSerializer.Deserialize(json) ?? throw new InvalidOperationException("Invalid DoxaApi spec."); } public static async Task ImportAsync(Stream stream) { var doc = await JsonSerializer.DeserializeAsync(stream); return doc ?? throw new InvalidOperationException("Invalid DoxaApi spec."); } } }