diff --git a/bundled.json b/bundled.json index aead56bc..3bacd01c 100644 --- a/bundled.json +++ b/bundled.json @@ -97057,6 +97057,7 @@ "properties": { "regexs": { "type": "array", + "maxItems": 10000, "items": { "type": "string" } @@ -97096,6 +97097,7 @@ "properties": { "regexs": { "type": "array", + "maxItems": 10000, "items": { "type": "string" } @@ -97183,6 +97185,35 @@ "type": "string" } } + }, + { + "name": "category", + "in": "query", + "description": "The category of block words to export. Defaults to content.", + "required": false, + "schema": { + "type": "string", + "enum": [ + "content", + "user" + ], + "default": "content" + } + }, + { + "name": "sortBy", + "in": "query", + "description": "Sort order for blacklist rules.", + "required": false, + "schema": { + "type": "string", + "enum": [ + "firstCreated", + "lastCreated", + "lastUpdated" + ], + "default": "firstCreated" + } } ], "responses": { @@ -97519,6 +97550,7 @@ "properties": { "regexs": { "type": "array", + "maxItems": 10000, "items": { "type": "string" } @@ -97582,6 +97614,50 @@ } } }, + "422": { + "description": "Unprocessable Content.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "code": { + "type": "number" + }, + "message": { + "type": "string" + }, + "data": { + "type": "object", + "properties": { + "detail": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object" + } + ] + } + } + } + } + }, + "example": { + "status": "error", + "code": 500000, + "message": "Parameters validation error!." + } + } + } + }, "500": { "description": "Unexpected error.", "content": { @@ -97968,6 +98044,241 @@ } } }, + "/api/v2/blacklist/export": { + "get": { + "summary": "Export blacklist rules as a text file.", + "tags": [ + "Moderation" + ], + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "Export all blacklist rules for the network as a plain-text file, one word per line. Filtered by category.\n\nRequires admin authentication with the `ManageModerationSetting` permission.\n", + "parameters": [ + { + "name": "Authorization", + "in": "header", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "category", + "in": "query", + "description": "The category of block words to export. Defaults to content.", + "required": false, + "schema": { + "type": "string", + "enum": [ + "content", + "user" + ], + "default": "content" + } + } + ], + "responses": { + "200": { + "description": "Plain-text file with one blacklist word per line.", + "headers": { + "Content-Disposition": { + "schema": { + "type": "string" + }, + "example": "attachment; filename=\"block-words-content.txt\"" + } + }, + "content": { + "text/plain": { + "schema": { + "type": "string", + "example": "badword1\nbadword2\nbadword3\n" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "code": { + "type": "number" + }, + "message": { + "type": "string" + }, + "data": { + "type": "object", + "properties": { + "detail": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object" + } + ] + } + } + } + } + }, + "example": { + "status": "error", + "code": 400100, + "message": "Unauthorized" + } + } + } + }, + "403": { + "description": "No permission to access this resource.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "code": { + "type": "number" + }, + "message": { + "type": "string" + }, + "data": { + "type": "object", + "properties": { + "detail": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object" + } + ] + } + } + } + } + }, + "example": { + "status": "error", + "code": 400300, + "message": "Forbidden error." + } + } + } + }, + "422": { + "description": "Unprocessable Content.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "code": { + "type": "number" + }, + "message": { + "type": "string" + }, + "data": { + "type": "object", + "properties": { + "detail": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object" + } + ] + } + } + } + } + }, + "example": { + "status": "error", + "code": 500000, + "message": "Parameters validation error!." + } + } + } + }, + "500": { + "description": "Unexpected error.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "code": { + "type": "number" + }, + "message": { + "type": "string" + }, + "data": { + "type": "object", + "properties": { + "detail": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object" + } + ] + } + } + } + } + }, + "example": { + "status": "error", + "code": 500, + "message": "Unexpected error" + } + } + } + } + } + } + }, "/api/v2/moderation-settings": { "get": { "summary": "get a moderation setting", @@ -98717,6 +99028,7 @@ "properties": { "regexs": { "type": "array", + "maxItems": 10000, "items": { "type": "string" } @@ -99842,6 +100154,50 @@ } } }, + "422": { + "description": "Unprocessable Content.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "code": { + "type": "number" + }, + "message": { + "type": "string" + }, + "data": { + "type": "object", + "properties": { + "detail": { + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object" + } + ] + } + } + } + } + }, + "example": { + "status": "error", + "code": 500000, + "message": "Parameters validation error!." + } + } + } + }, "500": { "description": "Unexpected error.", "content": { diff --git a/swagger.yaml b/swagger.yaml index 64511ae7..951a9473 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -256,6 +256,8 @@ paths: $ref: "./v2/moderation/index.yaml#/blacklist-records" /api/v2/blacklist/records/{ruleId}: $ref: "./v2/moderation/index.yaml#/blacklist-records_ruleId" + /api/v2/blacklist/export: + $ref: "./v2/moderation/index.yaml#/blacklist-export" /api/v2/moderation-settings: $ref: "./v2/moderation/index.yaml#/settings" /api/v2/whitelist/records: diff --git a/v1/moderation/request.yaml b/v1/moderation/request.yaml index 574f285a..867dbbfa 100644 --- a/v1/moderation/request.yaml +++ b/v1/moderation/request.yaml @@ -7,6 +7,7 @@ blacklist-records-request-payload: properties: regexs: type: "array" + maxItems: 10000 items: type: "string" required: diff --git a/v2/moderation/index.yaml b/v2/moderation/index.yaml index 7e67bfdf..bc850a26 100644 --- a/v2/moderation/index.yaml +++ b/v2/moderation/index.yaml @@ -10,6 +10,8 @@ blacklist-records: - $ref: "./parameter.yaml#/authorization" - $ref: "./parameter.yaml#/content-type" - $ref: "./parameter.yaml#/regexs" + - $ref: "./parameter.yaml#/category" + - $ref: "./parameter.yaml#/sortBy" responses: 200: $ref: "./response.yaml#/blacklist-records-get-response-payload-200" @@ -53,6 +55,8 @@ blacklist-records: description: "OK" 404: $ref: "../../global/error.yaml#/NotFoundError404" + 422: + $ref: "../../global/error.yaml#/UnProcessableError" 500: $ref: "../../global/error.yaml#/UnexpectedError500" delete: @@ -96,6 +100,39 @@ blacklist-records_ruleId: 500: $ref: "../../global/error.yaml#/UnexpectedError500" +blacklist-export: + get: + summary: "Export blacklist rules as a text file." + tags: + - "Moderation" + security: + - ApiKeyAuth: [] + description: "Export all blacklist rules for the network as a plain-text file, one word per line. Filtered by category.\n\nRequires admin authentication with the `ManageModerationSetting` permission.\n" + parameters: + - $ref: "./parameter.yaml#/authorization" + - $ref: "./parameter.yaml#/category" + responses: + 200: + description: "Plain-text file with one blacklist word per line." + headers: + Content-Disposition: + schema: + type: "string" + example: 'attachment; filename="block-words-content.txt"' + content: + text/plain: + schema: + type: "string" + example: "badword1\nbadword2\nbadword3\n" + 401: + $ref: "../../global/error.yaml#/UnAuthorizedError" + 403: + $ref: "../../global/error.yaml#/ForbiddenError" + 422: + $ref: "../../global/error.yaml#/UnProcessableError" + 500: + $ref: "../../global/error.yaml#/UnexpectedError500" + whitelist-records: get: summary: "get rules of whitelist." diff --git a/v2/moderation/parameter.yaml b/v2/moderation/parameter.yaml index 0b5d07f6..8f610ea6 100644 --- a/v2/moderation/parameter.yaml +++ b/v2/moderation/parameter.yaml @@ -36,3 +36,28 @@ ruleId: required: true schema: type: string + +category: + name: "category" + in: "query" + description: "The category of block words to export. Defaults to content." + required: false + schema: + type: "string" + enum: + - "content" + - "user" + default: "content" + +sortBy: + name: "sortBy" + in: "query" + description: "Sort order for blacklist rules." + required: false + schema: + type: "string" + enum: + - "firstCreated" + - "lastCreated" + - "lastUpdated" + default: "firstCreated" diff --git a/v2/moderation/request.yaml b/v2/moderation/request.yaml index b86289c3..5b55c08d 100644 --- a/v2/moderation/request.yaml +++ b/v2/moderation/request.yaml @@ -23,6 +23,7 @@ records-post-request-payload: properties: regexs: type: "array" + maxItems: 10000 items: type: "string" isMatchExactWord: diff --git a/v3/moderation/index.yaml b/v3/moderation/index.yaml index edef79ab..7a35f609 100644 --- a/v3/moderation/index.yaml +++ b/v3/moderation/index.yaml @@ -112,6 +112,8 @@ blocklists: $ref: "./response.yaml#/common-response-200" 400: $ref: "../../global/error.yaml#/BadRequestError" + 422: + $ref: "../../global/error.yaml#/UnProcessableError" 500: $ref: "../../global/error.yaml#/UnexpectedError"