Skip to content

Commit

Permalink
Add TS SDK page to the docs (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kus authored Sep 19, 2022
1 parent 92766d7 commit 34647c6
Show file tree
Hide file tree
Showing 3 changed files with 450 additions and 4 deletions.
30 changes: 26 additions & 4 deletions Tzkt.Api/Swagger/Swagger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,32 @@ public static void AddOpenApiDocument(this IServiceCollection services)
Name = "Get Started",
Description = File.Exists("Swagger/WsGetStarted.md")
? File.ReadAllText("Swagger/WsGetStarted.md")
: null
: null,
ExtensionData = new Dictionary<string, object>{{"x-tagGroup", "ws"}}
});
document.Tags.Add(new NSwag.OpenApiTag
{
Name = "Subscriptions",
Description = File.Exists("Swagger/WsSubscriptions.md")
? File.ReadAllText("Swagger/WsSubscriptions.md")
: null
: null,
ExtensionData = new Dictionary<string, object>{{"x-tagGroup", "ws"}}
});
document.Tags.Add(new NSwag.OpenApiTag
{
Name = "Examples",
Description = File.Exists("Swagger/WsExamples.md")
? File.ReadAllText("Swagger/WsExamples.md")
: null
: null,
ExtensionData = new Dictionary<string, object>{{"x-tagGroup", "ws"}}
});
document.Tags.Add(new NSwag.OpenApiTag
{
Name = "Typescript SDK",
Description = File.Exists("Swagger/TypescriptSdk.md")
? File.ReadAllText("Swagger/TypescriptSdk.md")
: null,
ExtensionData = new Dictionary<string, object>{{"x-tagGroup", "sdk"}}
});
document.ExtensionData = new Dictionary<string, object>
{
Expand All @@ -70,7 +81,18 @@ public static void AddOpenApiDocument(this IServiceCollection services)
new
{
name = "WebSocket API",
tags = document.Tags.Select(x => x.Name).ToList()
tags = document.Tags
.Where(x => x.ExtensionData["x-tagGroup"].Equals("ws"))
.Select(x => x.Name)
.ToList()
},
new
{
name = "Libraries",
tags = document.Tags
.Where(x => x.ExtensionData["x-tagGroup"].Equals("sdk"))
.Select(x => x.Name)
.ToList()
}
}
}
Expand Down
Loading

0 comments on commit 34647c6

Please sign in to comment.