From 1f75b1bf1722bf5c358583f5bd9d6a98a174de62 Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Tue, 18 Mar 2025 22:44:12 +0100 Subject: [PATCH] Update: the api schema --- schema.yml | 321 +++++++++++++++++++---------------------------------- 1 file changed, 113 insertions(+), 208 deletions(-) diff --git a/schema.yml b/schema.yml index 96f3ef3..cff57ea 100644 --- a/schema.yml +++ b/schema.yml @@ -123,162 +123,22 @@ paths: 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 + operationId: posts_list_all + parameters: + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - name: page_size + required: false + in: query + description: Number of results to return per page. + schema: + type: integer tags: - posts security: @@ -289,13 +149,11 @@ paths: content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/PostPreview' + $ref: '#/components/schemas/PaginatedPostPreviewList' description: '' /api/posts/{post_id}/: get: - operationId: posts_retrieve + operationId: posts_retrieve_by_id parameters: - in: path name: post_id @@ -316,8 +174,20 @@ paths: description: '' /api/posts/{source_site}/: get: - operationId: posts_list_2 + operationId: posts_list_by_source parameters: + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - name: page_size + required: false + in: query + description: Number of results to return per page. + schema: + type: integer - in: path name: source_site schema: @@ -333,19 +203,29 @@ paths: content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/PostPreview' + $ref: '#/components/schemas/PaginatedPostPreviewList' description: '' /api/posts/{source_site}/{creator_slug_or_id}/: get: - operationId: posts_list_3 + operationId: posts_list_by_source_and_creator parameters: - in: path name: creator_slug_or_id schema: type: string required: true + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - name: page_size + required: false + in: query + description: Number of results to return per page. + schema: + type: integer - in: path name: source_site schema: @@ -361,13 +241,11 @@ paths: content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/PostPreview' + $ref: '#/components/schemas/PaginatedPostPreviewList' description: '' /api/posts/{source_site}/{creator_slug_or_id}/{category}: get: - operationId: posts_list_4 + operationId: posts_list_by_source_creator_and_category parameters: - in: path name: category @@ -379,6 +257,18 @@ paths: schema: type: string required: true + - name: page + required: false + in: query + description: A page number within the paginated result set. + schema: + type: integer + - name: page_size + required: false + in: query + description: Number of results to return per page. + schema: + type: integer - in: path name: source_site schema: @@ -394,21 +284,39 @@ paths: content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/PostPreview' + $ref: '#/components/schemas/PaginatedPostPreviewList' description: '' - /api/protected/: + /api/posts/{source_site}/{creator_slug_or_id}/{post_id}/: get: - operationId: protected_retrieve + operationId: posts_retrieve_by_site_creator_id + parameters: + - in: path + name: creator_slug_or_id + schema: + type: string + required: true + - in: path + name: post_id + schema: + type: string + required: true + - in: path + name: source_site + schema: + type: string + required: true tags: - - protected + - posts security: - cookieAuth: [] - jwtAuth: [] responses: '200': - description: No response body + content: + application/json: + schema: + $ref: '#/components/schemas/Post' + description: '' /api/user/profile/: get: operationId: user_profile_retrieve @@ -559,9 +467,11 @@ components: readOnly: true avatar_url: type: string + nullable: true readOnly: true banner_url: type: string + nullable: true readOnly: true required: - avatar_url @@ -571,27 +481,6 @@ components: - 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: @@ -599,22 +488,29 @@ components: type: string required: - refresh - PatchedImage: + PaginatedPostPreviewList: type: object + required: + - count + - results properties: - id: + count: type: integer - readOnly: true - title: - type: string - maxLength: 255 - image: + example: 123 + next: type: string + nullable: true format: uri - uploaded_at: + example: http://api.example.org/accounts/?page=4 + previous: type: string - format: date-time - readOnly: true + nullable: true + format: uri + example: http://api.example.org/accounts/?page=2 + results: + type: array + items: + $ref: '#/components/schemas/PostPreview' PatchedUser: type: object properties: @@ -644,8 +540,11 @@ components: type: string maxLength: 128 title: - type: string - maxLength: 64 + type: object + additionalProperties: + type: string + nullable: true + readOnly: true description: type: object additionalProperties: @@ -660,6 +559,7 @@ components: type: object additionalProperties: type: string + nullable: true readOnly: true date: type: object @@ -699,7 +599,8 @@ components: type: boolean title: type: string - maxLength: 64 + nullable: true + readOnly: true description: type: string nullable: true @@ -727,6 +628,9 @@ components: additionalProperties: type: string readOnly: true + media_count: + type: integer + readOnly: true media: type: array items: @@ -745,6 +649,7 @@ components: - date - description - media + - media_count - post_id - source_site - tags