diff --git a/schema.yml b/schema.yml index cff57ea..61bf8f4 100644 --- a/schema.yml +++ b/schema.yml @@ -1,36 +1,9 @@ openapi: 3.0.3 info: - title: Gallery-Archivist API + title: Gallery-Archiver API version: 1.0.0 description: A tool for archiving online galleries paths: - /api/auth/logout/: - post: - operationId: auth_logout_create - tags: - - auth - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Logout' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/Logout' - multipart/form-data: - schema: - $ref: '#/components/schemas/Logout' - required: true - security: - - cookieAuth: [] - - jwtAuth: [] - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/Logout' - description: '' /api/auth/token/: post: operationId: auth_token_create @@ -58,6 +31,33 @@ paths: schema: $ref: '#/components/schemas/TokenObtainPair' description: '' + /api/auth/token/blacklist/: + post: + operationId: auth_token_blacklist_create + description: |- + Takes a token and blacklists it. Must be used with the + `rest_framework_simplejwt.token_blacklist` app installed. + tags: + - auth + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TokenBlacklist' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/TokenBlacklist' + multipart/form-data: + schema: + $ref: '#/components/schemas/TokenBlacklist' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TokenBlacklist' + description: '' /api/auth/token/refresh/: post: operationId: auth_token_refresh_create @@ -123,6 +123,102 @@ paths: schema: $ref: '#/components/schemas/CreatorDetails' description: '' + /api/files/{file_hash}/: + get: + operationId: files_retrieve + description: Handle GET requests for file serving. + parameters: + - in: query + name: d + schema: + type: string + description: Download flag (0 = download, otherwise inline) + - in: path + name: file_hash + schema: + type: string + required: true + - in: query + name: t + schema: + type: string + description: Thumbnail size (sx, sm, md, lg, xl) + - in: query + name: token + schema: + type: string + description: JWT token for authentication (alternative to Authorization header) + tags: + - files + security: + - cookieAuth: [] + - jwtAuth: [] + responses: + '200': + description: File returned successfully + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: '' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: '' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: '' + /api/files/{file_hash}/info/: + get: + operationId: files_info_retrieve + description: Return file metadata. + parameters: + - in: path + name: file_hash + schema: + type: string + required: true + - in: query + name: token + schema: + type: string + description: JWT token for authentication (alternative to Authorization header) + tags: + - files + security: + - cookieAuth: [] + - jwtAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PostFile' + description: '' + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: '' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: '' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: '' /api/posts/: get: operationId: posts_list_all @@ -151,27 +247,6 @@ paths: schema: $ref: '#/components/schemas/PaginatedPostPreviewList' description: '' - /api/posts/{post_id}/: - get: - operationId: posts_retrieve_by_id - parameters: - - in: path - name: post_id - schema: - type: string - required: true - tags: - - posts - security: - - cookieAuth: [] - - jwtAuth: [] - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/Post' - description: '' /api/posts/{source_site}/: get: operationId: posts_list_by_source @@ -317,6 +392,32 @@ paths: schema: $ref: '#/components/schemas/Post' description: '' + /api/posts/{source_site}/{post_id}/: + get: + operationId: posts_retrieve_by_id + parameters: + - in: path + name: post_id + schema: + type: string + required: true + - in: path + name: source_site + schema: + type: string + required: true + tags: + - posts + security: + - cookieAuth: [] + - jwtAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Post' + description: '' /api/user/profile/: get: operationId: user_profile_retrieve @@ -481,13 +582,15 @@ components: - name - slug - source_site - Logout: + ErrorResponse: type: object + description: Serializer for error responses. properties: - refresh: + error: type: string + description: Error message required: - - refresh + - error PaginatedPostPreviewList: type: object required: @@ -589,6 +692,36 @@ components: - source_site - tags - title + PostFile: + type: object + description: Serializer for PostFileModel. + properties: + hash_blake3: + type: string + maxLength: 128 + file_type: + type: string + maxLength: 16 + file: + type: string + format: uri + thumbnail: + type: string + format: uri + filename: + type: string + readOnly: true + thumbnails: + type: string + readOnly: true + download_url: + type: string + readOnly: true + required: + - download_url + - filename + - hash_blake3 + - thumbnails PostPreview: type: object properties: @@ -654,6 +787,14 @@ components: - source_site - tags - title + TokenBlacklist: + type: object + properties: + refresh: + type: string + writeOnly: true + required: + - refresh TokenObtainPair: type: object properties: