Hideout/src/main/resources/openapi/api.yaml

429 lines
10 KiB
YAML

openapi: 3.0.3
info:
title: Hideout API
description: Hideout API
version: 1.0.0
servers:
- url: 'https://test-hideout.usbharu.dev/api/internal/v1'
paths:
/posts:
get:
summary: 権限に応じて投稿一覧を返す
security:
- { }
- BearerAuth: [ ]
responses:
200:
description: 成功
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/PostResponse"
401:
$ref: "#/components/responses/Unauthorized"
403:
$ref: "#/components/responses/Forbidden"
429:
$ref: "#/components/responses/TooManyRequests"
post:
summary: 投稿する
security:
- BearerAuth: [ ]
requestBody:
description: 投稿する内容
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/PostRequest"
responses:
200:
description: 成功
headers:
Location:
description: 作成した投稿のURL
schema:
type: string
format: uri
401:
$ref: "#/components/responses/Unauthorized"
429:
$ref: "#/components/responses/TooManyRequests"
/posts/{postId}:
get:
summary: 権限に応じてIDの投稿を返す
security:
- { }
- BearerAuth: [ ]
parameters:
- $ref: "#/components/parameters/postId"
responses:
200:
description: 成功
content:
application/json:
schema:
$ref: "#/components/schemas/PostResponse"
401:
$ref: "#/components/responses/Unauthorized"
403:
$ref: "#/components/responses/Forbidden"
404:
$ref: "#/components/responses/NotFoundOrForbidden"
429:
$ref: "#/components/responses/TooManyRequests"
/users/{userName}/posts:
get:
summary: 権限に応じてユーザーの投稿一覧を返す
security:
- { }
- BearerAuth: [ ]
parameters:
- $ref: "#/components/parameters/userName"
responses:
200:
description: 成功
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/PostResponse"
401:
$ref: "#/components/responses/Unauthorized"
403:
$ref: "#/components/responses/Forbidden"
429:
$ref: "#/components/responses/TooManyRequests"
/users/{userName}/posts/{postId}:
get:
summary: 権限に応じてIDの投稿を返す
description: userNameが間違っていても取得できます。
security:
- { }
- BearerAuth: [ ]
parameters:
- $ref: "#/components/parameters/userName"
- $ref: "#/components/parameters/postId"
responses:
200:
description: 成功
content:
application/json:
schema:
$ref: "#/components/schemas/PostResponse"
401:
$ref: "#/components/responses/Unauthorized"
403:
$ref: "#/components/responses/Forbidden"
404:
$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/UserResponse"
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/UserResponse"
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/UserResponse"
post:
summary: ユーザーをフォローする
security:
- BearerAuth: [ ]
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/UserResponse"
/login:
post:
summary: ログインする
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserLogin"
responses:
200:
description: ログイン成功
content:
application/json:
schema:
$ref: "#/components/schemas/JwtToken"
/refresh-token:
post:
summary: 期限切れトークンの再発行をする
responses:
200:
description: トークンの再発行に成功
content:
application/json:
schema:
$ref: "#/components/schemas/JwtToken"
/auth-check:
get:
summary: 認証チェック
responses:
200:
description: 認証に成功
content:
text/plain:
schema:
type: string
components:
responses:
Unauthorized:
description: トークンが無効
Forbidden:
description: 権限がない
NotFoundOrForbidden:
description: 存在しないか権限がない
NotFound:
description: 存在しない
TooManyRequests:
description: レートリミット
parameters:
postId:
name: postId
in: path
description: 投稿ID
required: true
schema:
type: integer
format: int64
userName:
name: userName
in: path
description: ユーザーIDまたはAcctなど @name@domain name@domain name
required: true
schema:
type: string
schemas:
Visibility:
type: string
enum:
- public
- unlisted
- followers
- direct
UserResponse:
type: object
required:
- id
- name
- domain
- screenName
- description
- url
- createdAt
properties:
id:
type: number
format: int64
readOnly: true
name:
type: string
domain:
type: string
readOnly: true
screenName:
type: string
description:
type: string
nullable: true
url:
type: string
readOnly: true
createdAt:
type: number
readOnly: true
PostResponse:
type: object
required:
- id
- user
- text
- createdAt
- visibility
- url
- sensitive
properties:
id:
type: integer
format: int64
readOnly: true
user:
$ref: "#/components/schemas/UserResponse"
overview:
type: string
text:
type: string
createdAt:
type: integer
format: int64
readOnly: true
visibility:
$ref: "#/components/schemas/Visibility"
url:
type: string
format: uri
readOnly: true
repostId:
type: integer
format: int64
readOnly: true
replyId:
type: integer
format: int64
readOnly: true
sensitive:
type: boolean
PostRequest:
type: object
properties:
overview:
type: string
text:
type: string
visibility:
$ref: "#/components/schemas/Visibility"
repostId:
type: integer
format: int64
replyId:
type: integer
format: int64
sensitive:
type: boolean
JwtToken:
type: object
properties:
token:
type: string
refreshToken:
type: string
RefreshToken:
type: object
properties:
refreshToken:
type: string
UserLogin:
type: object
properties:
username:
type: string
password:
type: string
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT