openapi: '3.0.3' info: title: API for SNS version: 1.0.0 tags: - name: post description: 投稿・TL 関連 - name: user description: 自分でないユーザーに対する操作 - name: follows description: フォロー関連 - name: settings description: アカウントの設定 paths: /api/posts: post: tags: - post summary: ポストする description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: ポストの内容 content: application/json: schema: $ref: '#/components/schemas/postContent' responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/post' /api/posts/{postId}: get: tags: - post summary: 一つのポストを取得する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] parameters: - in: path name: postId required: true schema: type: string description: postId responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/postDetail' delete: tags: - post summary: ポストを削除する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] parameters: - in: path name: postId required: true schema: type: string description: postId responses: '204': description: no content /api/posts/{postId}/likes: get: tags: - post summary: ポストにいいねした人を取得する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] parameters: - in: path name: postId required: true schema: type: string description: postId responses: '200': description: successful operation content: application/json: schema: type: array items: $ref: '#/components/schemas/user' /api/posts/like: put: tags: - post summary: ポストにいいねする description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: いいねしたいポスト content: application/json: schema: $ref: '#/components/schemas/postId' responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/postId' /api/posts/unlike: put: tags: - post summary: ポストへのいいねを取り消す description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: いいねを取り消したいポスト content: application/json: schema: $ref: '#/components/schemas/postId' responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/postId' /api/posts/comments: post: tags: - post summary: コメントする description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: コメントの内容 content: application/json: schema: $ref: '#/components/schemas/createComment' responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/comment' /api/posts/comments/{commentId}: delete: tags: - post summary: コメントを削除する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] parameters: - in: path name: commentId required: true schema: type: string description: commentId responses: '204': description: no content /api/posts/replies: post: tags: - post summary: リプライする description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: リプライの内容 content: application/json: schema: $ref: '#/components/schemas/createReply' responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/reply' /api/posts/replies/{replyId}: delete: tags: - post summary: リプライを削除する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] parameters: - in: path name: replyId required: true schema: type: string description: replyId responses: '204': description: no content /api/posts/timeline: get: tags: - post summary: タイムラインを取得する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] parameters: - in: query name: cursor required: false schema: type: string description: カーソルページネーション用 - in: query name: limit required: false schema: type: number description: カーソルページネーション用 responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/postsWithCursor' /api/posts/notifications: get: tags: - post summary: 通知を取得する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] parameters: - in: query name: cursor required: false schema: type: string description: カーソルページネーション用 - in: query name: limit required: false schema: type: number description: カーソルページネーション用 responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/postNotificationsWithCursor' /api/posts/notifications/confirm: put: tags: - post summary: 通知を確認済みにする description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: 確認済みにする通知 content: application/json: schema: type: object properties: postNotificationIds: type: array items: type: string responses: '200': description: successful operation content: application/json: schema: type: object properties: postNotificationIds: type: array items: type: string /api/users/{userName}: get: tags: - user summary: ユーザーのプロフィールを取得する description: Authorization ヘッダーは必要ありません security: - bearerAuth: [] parameters: - in: path name: userName required: true schema: type: string description: userName responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/userDetail' # 軽量化のため以下のエンドポイントは使わず、Cloudflare R2 のバケットを直接見に行く # /api/users/{userName}/icon -> '#/components/schemas/url' # /api/users/{userName}/bgImage -> '#/components/schemas/url' /api/users/{userName}/posts: get: tags: - user summary: ユーザーのポスト一覧を取得する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] parameters: - in: path name: userName required: true schema: type: string description: userName - in: query name: cursor required: false schema: type: string description: カーソルページネーション用 - in: query name: limit required: false schema: type: number description: カーソルページネーション用 responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/postsWithCursor' /api/users/{userName}/mutuals: get: tags: - user summary: ユーザーとの相互フォローを取得する description: Authorization ヘッダーは必要ありません security: - bearerAuth: [] parameters: - in: path name: userName required: true schema: type: string description: userName responses: '200': description: successful operation content: application/json: schema: type: array items: $ref: '#/components/schemas/user' /api/follows/follow: put: tags: - follows summary: ユーザーをフォローする description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: フォローしたいユーザー content: application/json: schema: $ref: '#/components/schemas/userName' responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/userName' /api/follows/unfollow: put: tags: - follows summary: ユーザーのフォローを外す description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: フォロー解除したいユーザー content: application/json: schema: $ref: '#/components/schemas/userName' responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/userName' /api/follows/requests: get: tags: - follows summary: フォローリクエストを取得する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] responses: '200': description: successful operation content: application/json: schema: type: array items: $ref: '#/components/schemas/user' /api/follows/reject: put: tags: - follows summary: フォローリクエストを拒否する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: フォローリクエストを拒否したいユーザー content: application/json: schema: $ref: '#/components/schemas/userName' responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/userName' /api/settings/profile: get: tags: - settings summary: プロフィールを取得する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/profile' put: tags: - settings summary: プロフィールを設定する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: プロフィールの内容 content: application/json: schema: $ref: '#/components/schemas/userSettings' responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/userSettings' /api/settings/profile/userName: put: tags: - settings summary: ユーザー名を変更する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: 新しいユーザー名 content: application/json: schema: $ref: '#/components/schemas/userName' responses: '200': description: successful operation content: application/json: schema: $ref: '#/components/schemas/userName' /api/settings/profile/icon: put: tags: - settings summary: アイコンを設定する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: アイコン画像 content: multipart/form-data: schema: type: string format: binary responses: '204': description: no content /api/settings/profile/bgImage: put: tags: - settings summary: 背景画像を設定する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] requestBody: description: 背景画像 content: multipart/form-data: schema: type: string format: binary responses: '204': description: no content /api/settings/account: delete: tags: - settings summary: アカウントを削除する description: Authorization ヘッダーを必要とします security: - bearerAuth: [] responses: '204': description: no content components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT schemas: userName: type: object properties: userName: type: string userSettings: type: object properties: displayName: type: string biography: type: string userDisplay: type: object properties: userName: type: string displayName: type: string iconUrl: type: string bgImageUrl: type: string profile: type: object properties: userName: type: string displayName: type: string biography: type: string iconUrl: type: string bgImageUrl: type: string user: type: object properties: userName: type: string displayName: type: string biography: type: string createdAt: type: string format: date-time followingStatus: type: string iconUrl: type: string bgImageUrl: type: string userDetail: type: object properties: userName: type: string displayName: type: string biography: type: string createdAt: type: string format: date-time mutuals: type: integer followingStatus: type: string iconUrl: type: string bgImageUrl: type: string url: type: object properties: url: type: string postId: type: object properties: postId: type: string postContent: type: object properties: content: type: string post: type: object properties: postId: type: string poster: $ref: '#/components/schemas/userDisplay' content: type: string likes: type: integer liked: type: boolean comments: type: integer createdAt: type: string format: date-time postDetail: type: object properties: postId: type: string poster: $ref: '#/components/schemas/userDisplay' content: type: string likes: type: integer liked: type: boolean comments: type: array items: $ref: '#/components/schemas/comment' createdAt: type: string format: date-time postsWithCursor: type: object properties: posts: type: array items: $ref: '#/components/schemas/post' nextCursor: type: string createComment: type: object properties: postId: type: string content: type: string comment: type: object properties: commentId: type: string commenter: $ref: '#/components/schemas/userDisplay' content: type: string replies: type: array items: $ref: '#/components/schemas/reply' createdAt: type: string format: date-time createReply: type: object properties: commentId: type: string content: type: string reply: type: object properties: replyId: type: string replier: $ref: '#/components/schemas/userDisplay' content: type: string createdAt: type: string format: date-time postNotification: type: object properties: postNotificationId: type: string reactedPostId: type: string reactedPostContent: type: string notifier: $ref: '#/components/schemas/userDisplay' notificationType: type: string content: type: string confirmed: type: boolean createdAt: type: string format: date-time postNotificationsWithCursor: type: object properties: postNotifications: type: array items: $ref: '#/components/schemas/postNotification' nextCursor: type: string