Skip to content

Commit

Permalink
WIP TypeSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
pijng committed Feb 20, 2025
1 parent 0fee4bc commit c2c57df
Show file tree
Hide file tree
Showing 5 changed files with 4,901 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ go.work

moonlogs
dist/
node_modules/
67 changes: 67 additions & 0 deletions main.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import "@typespec/http";

using TypeSpec.Http;

@service({
title: "Moonlogs",
#suppress "deprecated" "Use global version atm"
version: "v1.18.6"
})
namespace Moonlogs;

model Meta {
page: integer;
count: integer;
pages: integer;
}

model Response<Data> {
success: boolean;
code: string;
error: string;
data: Data;
meta: Meta;
}

model Schema {
id: integer;
title: string;
description: string;
name: string;
fields: SchemaField[];
kinds: SchemaKind[];
tag_id: integer;
renetention_days: integer;
}

model SchemaField {
title: string;
name: string;
}

model SchemaKind {
title: string;
name: string;
}

@route("/api/schemas")
@tag("Schemas")
interface Schemas {
/** List all schemas */
@get list(): Response<Schema[]>;

/** Get schema by id */
@get read(@path id: string): Response<Schema>;

// /** Create a widget */
// @post create(@body body: Widget): Widget | Error;

// /** Update a widget */
// @patch update(@path id: string, @body body: Widget): Widget | Error;

// /** Delete a widget */
// @delete delete(@path id: string): void | Error;

// /** Analyze a widget */
// @route("{id}/analyze") @post analyze(@path id: string): AnalyzeResult | Error;
}
Loading

0 comments on commit c2c57df

Please sign in to comment.