-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.227.0
- Loading branch information
1 parent
66f8097
commit 4ad64d8
Showing
12 changed files
with
169 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
|
||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost when | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
#nullable enable | ||
namespace Api.Utils | ||
{ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
public class AnyDeserializer : JsonConverter | ||
{ | ||
public override bool CanConvert(Type objectType) | ||
{ | ||
return (objectType == typeof(Dictionary<string, object>)); | ||
} | ||
|
||
public override bool CanWrite => false; | ||
|
||
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override object ReadJson( | ||
JsonReader reader, | ||
Type objectType, | ||
object? existingValue, | ||
JsonSerializer serializer | ||
) | ||
{ | ||
return ParseTokenIntoDictionary(JToken.Load(reader)); | ||
} | ||
|
||
private Dictionary<string, object?> ParseTokenIntoDictionary(JToken token) | ||
{ | ||
var dict = new Dictionary<string, object?>(); | ||
|
||
foreach (var child in token.Children<JProperty>()) | ||
{ | ||
|
||
object? val = null; | ||
if (child.Value is JObject) | ||
{ | ||
val = ParseTokenIntoDictionary(child.Value); | ||
} | ||
else if (child.Value is JArray) | ||
{ | ||
val = ParseTokenIntoList(child.Value); | ||
} | ||
else if (child.Value != null) | ||
{ | ||
val = ((JValue)child.Value).Value; | ||
} | ||
|
||
dict[child.Name] = val; | ||
} | ||
|
||
return dict; | ||
} | ||
|
||
private List<object?> ParseTokenIntoList(JToken token) | ||
{ | ||
var list = new List<object?>(); | ||
|
||
foreach (var child in token.Children()) | ||
{ | ||
if (child is JObject) | ||
{ | ||
list.Add((object)ParseTokenIntoDictionary(child)); | ||
} | ||
else if (child is JArray) | ||
{ | ||
list.Add((object)ParseTokenIntoList(child)); | ||
} | ||
else | ||
{ | ||
list.Add(((JValue)child).Value); | ||
} | ||
} | ||
|
||
return list; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.