aboutsummaryrefslogtreecommitdiffhomepage
path: root/typespec/fortee/main.tsp
diff options
context:
space:
mode:
Diffstat (limited to 'typespec/fortee/main.tsp')
-rw-r--r--typespec/fortee/main.tsp45
1 files changed, 45 insertions, 0 deletions
diff --git a/typespec/fortee/main.tsp b/typespec/fortee/main.tsp
new file mode 100644
index 0000000..03683a7
--- /dev/null
+++ b/typespec/fortee/main.tsp
@@ -0,0 +1,45 @@
+import "@typespec/http";
+import "@typespec/openapi";
+import "@typespec/openapi3";
+
+using TypeSpec.Http;
+using TypeSpec.OpenAPI;
+
+@service(#{
+ title: "fortee API",
+})
+@info(#{
+ version: "0.1.0",
+})
+namespace ForteeApi;
+
+@route("/api/user/login")
+@post
+@operationId("postLogin")
+op postLogin(
+ @header contentType: "application/x-www-form-urlencoded",
+ @body body: {
+ username: string;
+ password: string;
+ },
+): {
+ @body body: {
+ loggedIn: boolean;
+ user?: {
+ username: string;
+ };
+ };
+};
+
+@route("/api/user/view/{username}")
+@get
+@operationId("getUser")
+op getUser(@path username: string): {
+ @body body: {
+ uuid: string;
+ username: string;
+ avatar_url: string;
+ };
+} | {
+ @statusCode statusCode: 404;
+};