Add some api docs

This commit is contained in:
2025-11-20 18:20:07 -06:00
parent c71c73bb77
commit 9da78e364c
18 changed files with 599 additions and 125 deletions

View File

@@ -0,0 +1,12 @@
func Pages.Api()
{
var html = <null>
<h1>Developers</h1>
<ul>
<a class="underline" href="./api-v1">
API v1
</a>
</ul>
</null>;
return Components.Shell("Api",html,4);
}

View File

@@ -0,0 +1,27 @@
func Pages.ApiV1()
{
var html = <null>
<h1>Api V1</h1>
<each(var r : apiv1_routes)>
<fieldset>
<legend>{r.method} {r.route}</legend>
<h6>Query Parameters</h6>
<each(var qp : r.queryParams)>
<div>{qp.name} ({qp.type}): {qp.description}</div>
</each>
<h6>Description</h6>
<plink(r.description)>
</fieldset>
</each>
</null>;
return Components.Shell("Api V1",html,4);
}
var apiv1_routes = Json.Decode(embed("apiv1_routes.json").ToString());

View File

@@ -20,6 +20,9 @@ func Pages.List(tytd,ctx)
<h1>{name}</h1>
</div>
</div>
<raw(Components.PersonalListDescription(tytd,name,false))>
<each(var item : res)>
<raw(Components.DownloadedVideo(item))>
</each>

View File

@@ -19,7 +19,7 @@ func Pages.PlaylistInfo(tytd,ctx)
<h1>{res.title}</h1>
</div>
<div class="max">
<a href={$"./channel?id={Net.Http.UrlEncode(res.channelId)}"}>{res.channelTitle}</a>
<a class="underline" href={$"./channel?id={Net.Http.UrlEncode(res.channelId)}"}>{res.channelTitle}</a>
</div>
</div>
<each(var item : res.items)>

View File

@@ -60,6 +60,8 @@ func Pages.Settings(tytd,ctx)
<footer>
<button>Save</button>
</footer>
<a class="button responsive" href="./api/v1/database.db"><i>download</i> Download Database</a>
</form>;
return Components.Shell("Settings",html ,3);

View File

@@ -19,7 +19,7 @@ func Pages.VideoInfo(tytd,ctx)
</div>
<div class="min">
<h4>{vi.title}</h4>
<a href={$"./channel?id={Net.Http.UrlEncode(vi.channelId)}"}>{vi.author}</a>
<a class="underline" href={$"./channel?id={Net.Http.UrlEncode(vi.channelId)}"}>{vi.author}</a>
<p>{vi.shortDescription}</p>
</div>