From 03676b10feca2638f1aeb54ab7191e72fbe9bb6e Mon Sep 17 00:00:00 2001 From: rito528 <39003544+rito528@users.noreply.github.com> Date: Wed, 21 Aug 2024 00:51:42 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20session=20=E3=81=AB=E9=96=A2=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=A8=E3=83=B3=E3=83=89=E3=83=9D=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=92=E5=AE=9A=E7=BE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/endpoints/session.tsp | 41 +++++++++++++++++++++++++++++++++++++++ src/main.tsp | 1 + 2 files changed, 42 insertions(+) create mode 100644 src/endpoints/session.tsp diff --git a/src/endpoints/session.tsp b/src/endpoints/session.tsp new file mode 100644 index 0000000..164e49a --- /dev/null +++ b/src/endpoints/session.tsp @@ -0,0 +1,41 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "../models/errors.tsp"; +import "../models/user.tsp"; + +using TypeSpec.Http; +using TypeSpec.Rest; + +namespace SeichiPortalApiSchema; + +@tag("Sessions") +@route("/session") +namespace Session { + @post + @summary("セッションを開始する") + op create(): { + @statusCode statusCode: 200; + + /** + * `SEICHI_PORTAL__SESSION_ID` という名前の Cookie に30分間有効なセッション ID を設定します。 + */ + @header SetCookie: string; + } | { + @statusCode statusCode: 401 | 500; + @body body: Error; + }; + + @delete + @summary("セッションを終了する") + op delete(): { + @statusCode statusCode: 200; + + /** + * `SEICHI_PORTAL__SESSION_ID` という名前の Cookie に30分間有効なセッション ID を削除します。 + */ + @header SetCookie: string; + } | { + @statusCode statusCode: 401 | 500; + @body body: Error; + }; +} diff --git a/src/main.tsp b/src/main.tsp index 35cb9d5..84533fb 100644 --- a/src/main.tsp +++ b/src/main.tsp @@ -1,5 +1,6 @@ import "./endpoints/forms.tsp"; import "./endpoints/users.tsp"; +import "./endpoints/session.tsp"; import "@typespec/openapi"; using TypeSpec.Http;