From 7e0c46fcc9e324c26ff75827140bc97b4f94838f Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Mon, 12 Jun 2023 17:33:31 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=81=9D=E3=81=AE=E4=BB=96=E3=81=AEope?= =?UTF-8?q?napi=E3=82=82=E6=9B=B8=E3=81=84=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/openapi/api.yaml | 138 +++++++++++++++++++++++++++- 1 file changed, 133 insertions(+), 5 deletions(-) diff --git a/src/main/resources/openapi/api.yaml b/src/main/resources/openapi/api.yaml index 0bfacf33..f0a817dd 100644 --- a/src/main/resources/openapi/api.yaml +++ b/src/main/resources/openapi/api.yaml @@ -53,7 +53,7 @@ paths: $ref: "#/components/responses/TooManyRequests" /posts/{postId}: get: - summary: 権限に応じてIDの投稿を取得 + summary: 権限に応じてIDの投稿を返す security: - { } - BearerAuth: [ ] @@ -71,7 +71,7 @@ paths: 403: $ref: "#/components/responses/Forbidden" 404: - $ref: "#/components/responses/NotFound" + $ref: "#/components/responses/NotFoundOrForbidden" 429: $ref: "#/components/responses/TooManyRequests" /users/{userName}/posts: @@ -100,7 +100,7 @@ paths: /users/{userName}/posts/{postId}: get: - summary: 権限に応じてIDの投稿を取得 + summary: 権限に応じてIDの投稿を返す description: userNameが間違っていても取得できます。 security: - { } @@ -120,18 +120,124 @@ paths: 403: $ref: "#/components/responses/Forbidden" 404: - $ref: "#/components/responses/NotFound" + $ref: "#/components/responses/NotFoundOrForbidden" 429: $ref: "#/components/responses/TooManyRequests" + /users: + get: + summary: ユーザー一覧を返す + security: + - { } + responses: + 200: + description: 成功 + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/User" + + post: + summary: ユーザーを作成する + security: + - { } + requestBody: + description: 作成するユーザーの詳細 + required: true + content: + application/json: + schema: + type: object + properties: + username: + type: string + password: + type: string + responses: + 201: + description: ユーザーが作成された + headers: + Location: + description: 作成されたユーザーのURL + schema: + type: string + format: url + 400: + description: ユーザー名が既に仕様されている。またはリクエストが異常 + + /users/{userName}: + get: + summary: ユーザーの詳細を返す + security: + - { } + - BearerAuth: [ ] + parameters: + - $ref: "#/components/parameters/userName" + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/User" + 404: + $ref: "#/components/responses/NotFound" + + /users/{userName}/followers: + get: + summary: ユーザーのフォロワー一覧を返す + parameters: + - $ref: "#/components/parameters/userName" + responses: + 200: + description: 成功 + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/User" + post: + summary: ユーザーをフォローする + parameters: + - $ref: "#/components/parameters/userName" + responses: + 200: + description: 成功 + 202: + description: 受け付けられたが完了していない + 401: + $ref: "#/components/responses/Unauthorized" + 404: + $ref: "#/components/responses/NotFound" + + /users/{userName}/following: + get: + summary: ユーザーのフォロイー一覧を返す + parameters: + - $ref: "#/components/parameters/userName" + responses: + 200: + description: 成功 + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/User" + components: responses: Unauthorized: description: トークンが無効 Forbidden: description: 権限がない - NotFound: + NotFoundOrForbidden: description: 存在しないか権限がない + NotFound: + description: 存在しない TooManyRequests: description: レートリミット @@ -153,6 +259,28 @@ components: type: string schemas: + User: + type: object + properties: + id: + type: number + format: int64 + readOnly: true + name: + type: string + domain: + type: string + readOnly: true + screenName: + type: string + description: + type: string + url: + type: string + readOnly: true + createdAt: + type: number + readOnly: true Post: type: object properties: