From 8f6e340442ba45ffa66d52a86ebb5db26de93fc1 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sun, 11 Feb 2024 13:49:47 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=83=9F=E3=83=A5=E3=83=BC=E3=83=88API?= =?UTF-8?q?=E3=81=AE=E5=AE=9A=E7=BE=A9=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/openapi/mastodon.yaml | 577 +++++++++++++++++++++++ 1 file changed, 577 insertions(+) diff --git a/src/main/resources/openapi/mastodon.yaml b/src/main/resources/openapi/mastodon.yaml index f4c5875b..96552a1a 100644 --- a/src/main/resources/openapi/mastodon.yaml +++ b/src/main/resources/openapi/mastodon.yaml @@ -21,6 +21,8 @@ tags: description: media - name: notification description: notification + - name: filter + description: filter paths: /api/v2/instance: @@ -922,6 +924,410 @@ paths: schema: type: object + /api/v2/filters: + get: + tags: + - filter + security: + - OAuth2: + - "read:filters" + responses: + 200: + description: 成功 + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Filter" + post: + tags: + - filter + security: + - OAuth2: + - "write:filters" + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/FilterPostRequest" + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/Filter" + + /api/v2/filters/{id}: + get: + tags: + - filter + security: + - OAuth2: + - "read:filters" + parameters: + - in: path + name: id + required: true + schema: + type: string + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/Filter" + put: + tags: + - filter + security: + - OAuth2: + - "write:filters" + parameters: + - in: path + name: id + required: true + schema: + type: string + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/FilterPutRequest" + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/Filter" + delete: + tags: + - filter + security: + - OAuth2: + - "write:filters" + parameters: + - in: path + name: id + required: true + schema: + type: string + responses: + 200: + description: 成功 + content: + application/json: + schema: + type: object + + /api/v2/filters/{filter_id}/keywords: + get: + tags: + - filter + security: + - OAuth2: + - "read:filters" + parameters: + - in: path + name: filter_id + required: true + schema: + type: string + responses: + 200: + description: 成功 + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/FilterKeyword" + post: + tags: + - filter + security: + - OAuth2: + - "write:filters" + parameters: + - in: path + name: filter_id + required: true + schema: + type: string + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/FilterKeywordsPostRequest" + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/FilterKeyword" + + /api/v2/filters/keywords/{id}: + get: + tags: + - filter + security: + - OAuth2: + - "read:filters" + parameters: + - in: path + name: id + required: true + schema: + type: string + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/FilterKeyword" + + put: + tags: + - filter + security: + - OAuth2: + - "write:filters" + parameters: + - in: path + name: id + required: true + schema: + type: string + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/FilterKeywordsPutRequest" + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/FilterKeyword" + + delete: + tags: + - filter + security: + - OAuth2: + - "write:filters" + parameters: + - in: path + name: id + required: true + schema: + type: string + responses: + 200: + description: 成功 + content: + application/json: + schema: + type: object + /api/v2/filters/{filter_id}/statuses: + get: + tags: + - filter + security: + - OAuth2: + - "read:filters" + parameters: + - in: path + name: filter_id + required: true + schema: + type: string + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/FilterStatus" + post: + tags: + - filter + security: + - OAuth2: + - "write:filters" + parameters: + - in: path + name: filter_id + required: true + schema: + type: string + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/FilterStatusRequest" + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/FilterStatus" + + /api/v2/filters/statuses/{id}: + get: + tags: + - filter + security: + - OAuth2: + - "read:filters" + parameters: + - in: path + name: filter_id + required: true + schema: + type: string + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/FilterStatus" + delete: + tags: + - filter + security: + - OAuth2: + - "write:filters" + parameters: + - in: path + name: filter_id + required: true + schema: + type: string + responses: + 200: + description: 成功 + content: + application/json: + schema: + type: object + + + /api/v1/filters: + get: + tags: + - filter + security: + - OAuth2: + - "read:filters" + responses: + 200: + description: 成功 + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/V1Filter" + post: + tags: + - filter + security: + - OAuth2: + - "write:filters" + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/V1Filter" + + /api/v1/filters/{id}: + get: + tags: + - filter + security: + - OAuth2: + - "read:filters" + parameters: + - in: path + name: id + required: true + schema: + type: string + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/V1FilterPostRequest" + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/V1Filter" + put: + tags: + - filter + security: + - OAuth2: + - "write:filters" + parameters: + - in: path + name: id + required: true + schema: + type: string + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/V1FilterPutRequest" + responses: + 200: + description: 成功 + content: + application/json: + schema: + $ref: "#/components/schemas/V1Filter" + delete: + tags: + - filter + security: + - OAuth2: + - "write:filters" + parameters: + - in: path + name: id + required: true + schema: + type: string + responses: + 200: + description: 成功 + content: + application/json: + schema: + type: object + + components: schemas: V1MediaRequest: @@ -1518,6 +1924,177 @@ components: status_id: type: string + V1Filter: + type: object + properties: + id: + type: string + phrase: + type: string + context: + type: array + items: + enum: + - home + - notifications + - thread + - public + - account + expires_at: + type: string + irreversible: + type: boolean + whole_word: + type: boolean + + V1FilterPostRequest: + type: object + properties: + phrase: + type: string + context: + type: array + items: + type: string + enum: + - home + - notifications + - public + - thread + - account + irreversible: + type: boolean + whole_word: + type: boolean + expires_in: + type: integer + + V1FilterPutRequest: + type: object + properties: + phrase: + type: string + context: + type: array + items: + type: string + enum: + - home + - notifications + - public + - thread + - account + irreversible: + type: boolean + whole_word: + type: boolean + expires_in: + type: integer + + FilterPostRequest: + type: object + properties: + title: + type: string + context: + type: array + items: + type: string + enum: + - home + - notifications + - public + - thread + - account + filter_action: + type: string + enum: + - warn + - hide + expires_in: + type: integer + keywords_attributes: + type: array + items: + $ref: "#/components/schemas/FilterPostRequestKeyword" + + FilterPostRequestKeyword: + type: object + properties: + keyword: + type: string + whole_word: + type: boolean + regex: + type: boolean + + FilterKeywordsPostRequest: + type: object + properties: + keyword: + type: string + whole_word: + type: boolean + regex: + type: boolean + + FilterKeywordsPutRequest: + type: object + properties: + keyword: + type: string + whole_word: + type: boolean + regex: + type: boolean + + FilterPutRequest: + type: object + properties: + title: + type: string + context: + type: array + items: + type: string + enum: + - homa + - notifications + - public + - thread + - account + filter_action: + type: string + enum: + - warn + - hide + expires_in: + type: integer + keywords_attributes: + type: array + items: + $ref: "#/components/schemas/FilterPubRequestKeyword" + + FilterPubRequestKeyword: + type: object + properties: + keyword: + type: string + whole_word: + type: boolean + regex: + type: boolean + id: + type: string + _destroy: + type: boolean + + FilterStatusRequest: + type: object + properties: + status_id: + type: string + Instance: type: object properties: