From 8da1c9346bfb6ad871da9957e327fcc750397482 Mon Sep 17 00:00:00 2001
From: Quaternions <krakow20@gmail.com>
Date: Tue, 25 Mar 2025 16:45:30 -0700
Subject: [PATCH] openapi: add session endpoints

---
 openapi.yaml | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/openapi.yaml b/openapi.yaml
index 1c75f06..e086cfa 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -6,6 +6,8 @@ info:
 servers:
   - url: https://submissions.strafes.net/v1
 tags:
+  - name: Session
+    description: Session operations
   - name: Submissions
     description: Submission operations
   - name: Scripts
@@ -15,6 +17,63 @@ tags:
 security:
   - cookieAuth: []
 paths:
+  /session/user:
+    get:
+      summary: Get information about the currently logged in user
+      operationId: sessionUser
+      tags:
+        - Session
+      responses:
+        "200":
+          description: Successful response
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/User"
+        default:
+          description: General Error
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Error"
+  /session/roles:
+    get:
+      summary: Get list of roles for the current session
+      operationId: sessionRoles
+      tags:
+        - Session
+      responses:
+        "200":
+          description: Successful response
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Roles"
+        default:
+          description: General Error
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Error"
+  /session/validate:
+    get:
+      summary: Ask if the current session is valid
+      operationId: sessionValidate
+      tags:
+        - Session
+      responses:
+        "200":
+          description: Successful response
+          content:
+            application/json:
+              schema:
+                type: boolean
+        default:
+          description: General Error
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/Error"
   /submissions:
     get:
       summary: Get list of submissions
@@ -619,6 +678,30 @@ components:
         ID:
           type: integer
           format: int64
+    Roles:
+      required:
+      - Roles
+      type: object
+      properties:
+        Roles:
+          type: integer
+          format: int32
+    User:
+      required:
+      - UserID
+      - Username
+      - AvatarURL
+      type: object
+      properties:
+        UserID:
+          type: integer
+          format: int64
+        Username:
+          type: string
+          maxLength: 128
+        AvatarURL:
+          type: string
+          maxLength: 256
     Submission:
       required:
       - ID