diff --git a/docs/get-task-status.mdx b/docs/get-task-status.mdx new file mode 100644 index 0000000..40ee3af --- /dev/null +++ b/docs/get-task-status.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /upscayl-cloud/us-central1/getTaskStatus +--- \ No newline at end of file diff --git a/docs/get-upload-url.mdx b/docs/get-upload-url.mdx new file mode 100644 index 0000000..29cf0af --- /dev/null +++ b/docs/get-upload-url.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /upscayl-cloud/us-central1/getUploadUrl +--- \ No newline at end of file diff --git a/docs/get-upscayl-history.mdx b/docs/get-upscayl-history.mdx new file mode 100644 index 0000000..6b540c2 --- /dev/null +++ b/docs/get-upscayl-history.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /upscayl-cloud/us-central1/getUpscaylHistory +--- \ No newline at end of file diff --git a/docs/mint.json b/docs/mint.json index 54a7b44..707db8d 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -46,6 +46,9 @@ { "group": "Get Started", "pages": ["introduction"] + },{ + "group": "API Reference", + "pages": ["get-task-status", "get-upload-url", "get-upscayl-history", "start-a-new-task", "resize-an-image"] } ], "footerSocials": { diff --git a/docs/openapi.yaml b/docs/openapi.yaml new file mode 100644 index 0000000..538a3a3 --- /dev/null +++ b/docs/openapi.yaml @@ -0,0 +1,541 @@ +--- +openapi: 3.0.0 +info: + title: Upscayl Cloud API Documentation + version: 1.0.0 +paths: + /upscayl-cloud/us-central1/getUploadUrl: + post: + operationId: getUploadUrl + summary: Get upload URL + requestBody: + content: + application/json: + schema: + type: object + properties: + originalFileName: + type: string + description: The original file name + example: file.jpeg + fileType: + type: string + description: The file type + example: image/jpeg + fileSize: + type: number + description: The file size in bytes + example: 123456 + responses: + "200": + description: Successful operation + content: + application/json: + schema: + type: object + properties: + status: + type: string + example: success + data: + type: object + properties: + uploadURL: + type: string + example: http://example.com/upload + fileName: + type: string + example: example.jpg + fileType: + type: string + example: image/jpeg + fileSize: + type: number + example: 12345 + originalFileName: + type: string + example: original.jpg + path: + type: string + example: /path/to/file + createdAt: + type: number + example: 1633024800000 + expiresAt: + type: number + example: 1654560800000 + "400": + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + message: + type: string + examples: + InvalidFileType: + value: + error: InvalidFileType + message: "Bad Request: Invalid File Type" + MissingUserID: + value: + error: MissingUserID + message: "Bad Request: Missing User ID" + MissingOriginalFileName: + value: + error: MissingOriginalFileName + message: "Bad Request: Missing Original File Name" + "500": + description: Internal server error + content: + text/plain: + schema: + type: string + example: Internal Server Error + /upscayl-cloud/us-central1/getUpscaylHistory: + post: + operationId: getUpscaylHistory + summary: Get Upscayl History + requestBody: + content: + application/json: + schema: + type: object + properties: + timestampOffset: + type: number + description: The timestamp offset + example: 1633024800000 + batch: + type: boolean + description: The batch mode status + example: true + failed: + type: boolean + description: The failed status + example: false + limit: + type: number + description: The limit for the number of records to retrieve + example: 10 + processed: + type: string + description: The processed status + example: processing + responses: + "200": + description: Successful operation + content: + application/json: + schema: + type: object + properties: + status: + type: string + example: "success" + data: + type: array + items: + type: object + properties: + batchMode: + type: boolean + createdAt: + type: number + endedAt: + type: number + enhanceFace: + type: boolean + error: + type: string + files: + type: array + items: + type: object + properties: + fileName: + type: string + fileType: + type: string + path: + type: string + createdAt: + type: number + expiresAt: + type: number + originalFileName: + type: string + fileSize: + type: number + downloadLink: + type: string + thumbnailLink: + type: string + finalFileSize: + type: number + processedFileName: + type: string + dimensions: + type: object + properties: + width: + type: number + height: + type: number + id: + type: string + model: + type: string + progress: + type: string + scale: + type: string + status: + type: string + userId: + type: string + saveImageAs: + type: string + enum: ["png", "jpg", "webp"] + compression: + type: number + creditsDeducted: + type: boolean + "400": + description: Bad request + content: + text/plain: + schema: + type: string + example: "Bad Request: Missing User ID" + "204": + description: No content + content: + text/plain: + schema: + type: string + example: "No data found" + "500": + description: Internal server error + content: + text/plain: + schema: + type: string + example: "Error getting data" + /upscayl-cloud/us-central1/getTaskStatus: + post: + operationId: getTaskStatus + summary: Get Task Status + requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + userId: + type: string + description: The user ID + example: kB4EFDHo2bWAvVthqaU8vMufCMY2 + taskId: + type: string + description: The task ID + example: 30a89e69-c702-4247-9905-f0a53dfa45ab + responses: + "200": + description: Successful operation + content: + application/json: + schema: + type: object + properties: + status: + type: string + example: "success" + data: + type: object + properties: + batchMode: + type: boolean + description: Indicates if batch mode is enabled + createdAt: + type: number + description: Timestamp when the task was created + endedAt: + type: number + description: Timestamp when the task ended + enhanceFace: + type: boolean + description: Indicates if face enhancement is enabled + error: + type: string + description: Error message if any + files: + type: array + items: + type: object + properties: + fileName: + type: string + fileType: + type: string + path: + type: string + createdAt: + type: number + expiresAt: + type: number + originalFileName: + type: string + fileSize: + type: number + downloadLink: + type: string + thumbnailLink: + type: string + finalFileSize: + type: number + processedFileName: + type: string + dimensions: + type: object + properties: + width: + type: number + height: + type: number + id: + type: string + description: The task ID + model: + type: string + description: The model used for the task + progress: + type: string + description: The progress of the task + scale: + type: string + description: The scale of the task + status: + type: string + description: The status of the task + userId: + type: string + description: The user ID + saveImageAs: + type: string + enum: ["png", "jpg", "webp"] + description: The format to save the image as + compression: + type: number + description: The compression level + creditsDeducted: + type: boolean + description: Indicates if credits were deducted + "400": + description: Bad request + content: + text/plain: + schema: + type: string + example: "Bad Request: Missing User ID or Task ID" + "404": + description: Not found + content: + text/plain: + schema: + type: string + examples: + noDocument: + value: "No such document" + noFiles: + value: "No files found" + noUser: + value: "User not found" + "500": + description: Internal server error + content: + text/plain: + schema: + type: string + examples: + genericError: + value: "Error getting data" + linkGenerationError: + value: "Error generating links for images" + /upscayl-cloud/us-central1/startTask: + post: + operationId: startTask + summary: Start a new task + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + userId: + type: string + description: The user ID + example: kB4EFDHo2bWAvVthqaU8vMufCMY2 + files: + type: array + items: + type: string + format: binary + enhanceFace: + type: boolean + description: Whether to enhance faces in the image + example: false + model: + type: string + description: The model to use for the task + example: digital-art + scale: + type: string + description: The scale factor for the task + example: "4" + compression: + type: number + description: The compression level + example: 0 + saveImageAs: + type: string + enum: ["png", "jpg", "webp"] + description: The format to save the image as + example: jpg + file: + type: string + format: binary + description: A single file to upload + responses: + "200": + description: Successful operation + content: + application/json: + schema: + type: object + properties: + status: + type: string + example: "success" + data: + type: object + properties: + message: + type: string + example: "Task request sent successfully" + taskId: + type: string + example: "30a89e69-c702-4247-9905-f0a53dfa45ab" + "400": + description: Bad request + content: + text/plain: + schema: + type: string + examples: + missingUserId: + value: "Bad Request: Missing User ID" + missingFiles: + value: "Bad Request: Missing Files" + missingModelName: + value: "Bad Request: Missing Model Name" + missingScale: + value: "Bad Request: Missing Scale" + missingImageOptions: + value: "Bad Request: Missing Image Options" + "402": + description: Payment required + content: + text/plain: + schema: + type: string + example: "Insufficient credits" + "500": + description: Internal server error + content: + text/plain: + schema: + type: string + example: "Error contacting the server" + /upscayl-cloud/us-central1/resize-image: + post: + summary: Resize an image + description: Resizes an image based on the provided scale factor and uploads it back to S3. + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + file: + type: object + properties: + fileName: + type: string + description: The name of the file to be resized. + example: 0f143eca-f21f-4309-bee5-2eb6a101cdd7.jpeg + fileType: + type: string + description: The MIME type of the file. + example: image/jpeg + required: + - fileName + - fileType + scale: + type: number + description: The scale factor to resize the image. + example: 0.5 + userId: + type: string + description: The ID of the user. + example: kB4EFDHo2bWAvVthqaU8vMufCMY2 + required: + - file + - scale + responses: + "200": + description: Image resized successfully + content: + text/plain: + schema: + type: string + example: "Image Resized Successfully" + "400": + description: Bad Request + content: + text/plain: + schema: + type: string + examples: + invalidFileType: + value: "Bad Request: Invalid File Type" + missingUserId: + value: "Bad Request: Missing User ID" + missingScale: + value: "Bad Request: Missing Scale" + missingImageOptions: + value: "Bad Request: Missing Image Options" + "402": + description: Payment required + content: + text/plain: + schema: + type: string + example: "Insufficient credits" + "500": + description: Internal server error + content: + text/plain: + schema: + type: string + example: "Error contacting the server" diff --git a/docs/resize-an-image.mdx b/docs/resize-an-image.mdx new file mode 100644 index 0000000..87e3a77 --- /dev/null +++ b/docs/resize-an-image.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /upscayl-cloud/us-central1/resize-image +--- \ No newline at end of file diff --git a/docs/start-a-new-task.mdx b/docs/start-a-new-task.mdx new file mode 100644 index 0000000..1956a5f --- /dev/null +++ b/docs/start-a-new-task.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /upscayl-cloud/us-central1/startTask +--- \ No newline at end of file