From ef96ad303ae8eb2cebe4b5be1d5056312a17326d Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Tue, 18 Feb 2025 22:34:25 +0100 Subject: [PATCH] Add: open api schema --- schema.yml | 822 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 822 insertions(+) create mode 100644 schema.yml diff --git a/schema.yml b/schema.yml new file mode 100644 index 0000000..96f3ef3 --- /dev/null +++ b/schema.yml @@ -0,0 +1,822 @@ +openapi: 3.0.3 +info: + title: Gallery-Archivist 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 + description: |- + Takes a set of user credentials and returns an access and refresh JSON web + token pair to prove the authentication of those credentials. + tags: + - auth + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TokenObtainPair' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/TokenObtainPair' + multipart/form-data: + schema: + $ref: '#/components/schemas/TokenObtainPair' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TokenObtainPair' + description: '' + /api/auth/token/refresh/: + post: + operationId: auth_token_refresh_create + description: |- + Takes a refresh type JSON web token and returns an access type JSON web + token if the refresh token is valid. + tags: + - auth + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TokenRefresh' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/TokenRefresh' + multipart/form-data: + schema: + $ref: '#/components/schemas/TokenRefresh' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TokenRefresh' + description: '' + /api/creators/: + get: + operationId: creators_list + tags: + - creators + security: + - cookieAuth: [] + - jwtAuth: [] + responses: + '200': + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/CreatorList' + description: '' + /api/creators/{creator_id}/: + get: + operationId: creators_retrieve + parameters: + - in: path + name: creator_id + schema: + type: string + required: true + tags: + - creators + security: + - cookieAuth: [] + - jwtAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CreatorDetails' + description: '' + /api/images/: + get: + operationId: images_list + tags: + - images + security: + - cookieAuth: [] + - jwtAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Image' + description: '' + post: + operationId: images_create + tags: + - images + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Image' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/Image' + multipart/form-data: + schema: + $ref: '#/components/schemas/Image' + required: true + security: + - cookieAuth: [] + - jwtAuth: [] + - {} + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/Image' + description: '' + /api/images/{id}/: + get: + operationId: images_retrieve + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this image. + required: true + tags: + - images + security: + - cookieAuth: [] + - jwtAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Image' + description: '' + put: + operationId: images_update + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this image. + required: true + tags: + - images + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Image' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/Image' + multipart/form-data: + schema: + $ref: '#/components/schemas/Image' + required: true + security: + - cookieAuth: [] + - jwtAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Image' + description: '' + patch: + operationId: images_partial_update + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this image. + required: true + tags: + - images + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PatchedImage' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/PatchedImage' + multipart/form-data: + schema: + $ref: '#/components/schemas/PatchedImage' + security: + - cookieAuth: [] + - jwtAuth: [] + - {} + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Image' + description: '' + delete: + operationId: images_destroy + parameters: + - in: path + name: id + schema: + type: integer + description: A unique integer value identifying this image. + required: true + tags: + - images + security: + - cookieAuth: [] + - jwtAuth: [] + - {} + responses: + '204': + description: No response body + /api/posts/: + get: + operationId: posts_list + tags: + - posts + security: + - cookieAuth: [] + - jwtAuth: [] + responses: + '200': + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PostPreview' + description: '' + /api/posts/{post_id}/: + get: + operationId: posts_retrieve + 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_2 + parameters: + - in: path + name: source_site + schema: + type: string + required: true + tags: + - posts + security: + - cookieAuth: [] + - jwtAuth: [] + responses: + '200': + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PostPreview' + description: '' + /api/posts/{source_site}/{creator_slug_or_id}/: + get: + operationId: posts_list_3 + parameters: + - in: path + name: creator_slug_or_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: + type: array + items: + $ref: '#/components/schemas/PostPreview' + description: '' + /api/posts/{source_site}/{creator_slug_or_id}/{category}: + get: + operationId: posts_list_4 + parameters: + - in: path + name: category + schema: + type: string + required: true + - in: path + name: creator_slug_or_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: + type: array + items: + $ref: '#/components/schemas/PostPreview' + description: '' + /api/protected/: + get: + operationId: protected_retrieve + tags: + - protected + security: + - cookieAuth: [] + - jwtAuth: [] + responses: + '200': + description: No response body + /api/user/profile/: + get: + operationId: user_profile_retrieve + description: Retrieve and update the authenticated user's profile. + tags: + - user + security: + - cookieAuth: [] + - jwtAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: '' + put: + operationId: user_profile_update + description: Retrieve and update the authenticated user's profile. + tags: + - user + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/User' + multipart/form-data: + schema: + $ref: '#/components/schemas/User' + required: true + security: + - cookieAuth: [] + - jwtAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: '' + patch: + operationId: user_profile_partial_update + description: Retrieve and update the authenticated user's profile. + tags: + - user + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PatchedUser' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/PatchedUser' + multipart/form-data: + schema: + $ref: '#/components/schemas/PatchedUser' + security: + - cookieAuth: [] + - jwtAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: '' +components: + schemas: + CreatorDetails: + type: object + properties: + creator_id: + type: string + nullable: true + maxLength: 128 + slug: + type: string + maxLength: 64 + name: + type: string + maxLength: 64 + mature: + type: boolean + avatar_url: + type: string + nullable: true + readOnly: true + banner_url: + type: string + nullable: true + readOnly: true + description: + type: array + items: + type: object + additionalProperties: + type: string + readOnly: true + date: + type: object + additionalProperties: + type: string + readOnly: true + categories: + type: array + items: + type: object + additionalProperties: + type: string + readOnly: true + required: + - avatar_url + - banner_url + - categories + - date + - description + - name + - slug + CreatorList: + type: object + properties: + creator_id: + type: string + nullable: true + maxLength: 128 + source_site: + type: string + readOnly: true + slug: + type: string + maxLength: 64 + name: + type: string + maxLength: 64 + mature: + type: boolean + date: + type: object + additionalProperties: + type: string + readOnly: true + description: + type: string + nullable: true + readOnly: true + avatar_url: + type: string + readOnly: true + banner_url: + type: string + readOnly: true + required: + - avatar_url + - banner_url + - date + - description + - name + - slug + - source_site + Image: + type: object + properties: + id: + type: integer + readOnly: true + title: + type: string + maxLength: 255 + image: + type: string + format: uri + uploaded_at: + type: string + format: date-time + readOnly: true + required: + - id + - image + - title + - uploaded_at + Logout: + type: object + properties: + refresh: + type: string + required: + - refresh + PatchedImage: + type: object + properties: + id: + type: integer + readOnly: true + title: + type: string + maxLength: 255 + image: + type: string + format: uri + uploaded_at: + type: string + format: date-time + readOnly: true + PatchedUser: + type: object + properties: + username: + type: string + description: Required. 150 characters or fewer. Letters, digits and @/./+/-/_ + only. + pattern: ^[\w.@+-]+$ + maxLength: 150 + email: + type: string + format: email + title: Email address + maxLength: 254 + first_name: + type: string + maxLength: 150 + last_name: + type: string + maxLength: 150 + profile: + $ref: '#/components/schemas/UserProfile' + Post: + type: object + properties: + post_id: + type: string + maxLength: 128 + title: + type: string + maxLength: 64 + description: + type: object + additionalProperties: + type: string + readOnly: true + source_site: + type: object + additionalProperties: + type: string + readOnly: true + creator: + type: object + additionalProperties: + type: string + readOnly: true + date: + type: object + additionalProperties: + type: string + readOnly: true + mature: + type: boolean + media: + type: array + items: + type: object + additionalProperties: + type: string + readOnly: true + tags: + type: array + items: + type: string + readOnly: true + required: + - creator + - date + - description + - media + - post_id + - source_site + - tags + - title + PostPreview: + type: object + properties: + post_id: + type: string + maxLength: 128 + mature: + type: boolean + title: + type: string + maxLength: 64 + description: + type: string + nullable: true + readOnly: true + source_site: + type: object + additionalProperties: + type: string + readOnly: true + category: + type: array + items: + type: object + additionalProperties: + type: string + readOnly: true + creator: + type: object + additionalProperties: + type: string + nullable: true + readOnly: true + date: + type: object + additionalProperties: + type: string + readOnly: true + media: + type: array + items: + type: object + additionalProperties: + type: string + readOnly: true + tags: + type: array + items: + type: string + readOnly: true + required: + - category + - creator + - date + - description + - media + - post_id + - source_site + - tags + - title + TokenObtainPair: + type: object + properties: + username: + type: string + writeOnly: true + password: + type: string + writeOnly: true + access: + type: string + readOnly: true + refresh: + type: string + readOnly: true + required: + - access + - password + - refresh + - username + TokenRefresh: + type: object + properties: + access: + type: string + readOnly: true + refresh: + type: string + writeOnly: true + required: + - access + - refresh + User: + type: object + properties: + username: + type: string + description: Required. 150 characters or fewer. Letters, digits and @/./+/-/_ + only. + pattern: ^[\w.@+-]+$ + maxLength: 150 + email: + type: string + format: email + title: Email address + maxLength: 254 + first_name: + type: string + maxLength: 150 + last_name: + type: string + maxLength: 150 + profile: + $ref: '#/components/schemas/UserProfile' + required: + - profile + - username + UserProfile: + type: object + properties: + show_mature: + type: boolean + securitySchemes: + cookieAuth: + type: apiKey + in: cookie + name: sessionid + jwtAuth: + type: http + scheme: bearer + bearerFormat: JWT