Skip to content

Commit

Permalink
📝 Add generate upload url endpoint api doc
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jun 20, 2024
1 parent 918836d commit 033f52e
Show file tree
Hide file tree
Showing 11 changed files with 432 additions and 82 deletions.
20 changes: 20 additions & 0 deletions apps/docs/api-reference/chat/generate-upload-url.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: 'Generate upload URL'
openapi: POST /v2/generate-upload-url
---

The `presignedUrl` and `formData` fields can be then used to upload the file to the S3 bucket, directly from the browser if necessary. Here is an example:

```js
// data contains the presignedUrl and formData fields from the response

const formData = new FormData()
Object.entries(data.formData).forEach(([key, value]) => {
formData.append(key, value)
})
formData.append('file', file)
const upload = await fetch(data.presignedUrl, {
method: 'POST',
body: formData,
})
```
1 change: 1 addition & 0 deletions apps/docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
"api-reference/chat/start-preview-chat",
"api-reference/chat/continue-chat",
"api-reference/chat/save-logs",
"api-reference/chat/generate-upload-url",
"api-reference/chat/update-typebot-in-session"
]
},
Expand Down
84 changes: 84 additions & 0 deletions apps/docs/openapi/builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,20 @@
},
{}
]
},
"waitForEvent": {
"type": "object",
"properties": {
"isEnabled": {
"type": "boolean"
},
"name": {
"type": "string"
},
"saveDataInVariableId": {
"type": "string"
}
}
}
}
}
Expand Down Expand Up @@ -4595,6 +4609,20 @@
},
{}
]
},
"waitForEvent": {
"type": "object",
"properties": {
"isEnabled": {
"type": "boolean"
},
"name": {
"type": "string"
},
"saveDataInVariableId": {
"type": "string"
}
}
}
}
}
Expand Down Expand Up @@ -8054,6 +8082,20 @@
},
{}
]
},
"waitForEvent": {
"type": "object",
"properties": {
"isEnabled": {
"type": "boolean"
},
"name": {
"type": "string"
},
"saveDataInVariableId": {
"type": "string"
}
}
}
}
}
Expand Down Expand Up @@ -16555,6 +16597,20 @@
},
{}
]
},
"waitForEvent": {
"type": "object",
"properties": {
"isEnabled": {
"type": "boolean"
},
"name": {
"type": "string"
},
"saveDataInVariableId": {
"type": "string"
}
}
}
}
}
Expand Down Expand Up @@ -22853,6 +22909,20 @@
},
{}
]
},
"waitForEvent": {
"type": "object",
"properties": {
"isEnabled": {
"type": "boolean"
},
"name": {
"type": "string"
},
"saveDataInVariableId": {
"type": "string"
}
}
}
}
}
Expand Down Expand Up @@ -25681,6 +25751,20 @@
},
{}
]
},
"waitForEvent": {
"type": "object",
"properties": {
"isEnabled": {
"type": "boolean"
},
"name": {
"type": "string"
},
"saveDataInVariableId": {
"type": "string"
}
}
}
}
}
Expand Down
125 changes: 124 additions & 1 deletion apps/docs/openapi/viewer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2310,7 +2310,7 @@
},
"/v1/generate-upload-url": {
"post": {
"operationId": "generateUploadUrl",
"operationId": "generateUploadUrlV1",
"summary": "Generate upload URL",
"description": "Used to upload anything from the client to S3 bucket",
"requestBody": {
Expand Down Expand Up @@ -2424,6 +2424,87 @@
}
}
},
"/v2/generate-upload-url": {
"post": {
"operationId": "generateUploadUrl",
"summary": "Generate upload URL",
"description": "Used to upload anything from the client to S3 bucket",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"sessionId": {
"type": "string"
},
"fileName": {
"type": "string"
},
"fileType": {
"type": "string"
}
},
"required": [
"sessionId",
"fileName"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"presignedUrl": {
"type": "string"
},
"formData": {
"type": "object",
"additionalProperties": {}
},
"fileUrl": {
"type": "string"
}
},
"required": [
"presignedUrl",
"formData",
"fileUrl"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v1/sessions/{sessionId}/updateTypebot": {
"post": {
"operationId": "updateTypebotInSession",
Expand Down Expand Up @@ -3389,6 +3470,20 @@
},
{}
]
},
"waitForEvent": {
"type": "object",
"properties": {
"isEnabled": {
"type": "boolean"
},
"name": {
"type": "string"
},
"saveDataInVariableId": {
"type": "string"
}
}
}
}
}
Expand Down Expand Up @@ -7536,6 +7631,20 @@
},
{}
]
},
"waitForEvent": {
"type": "object",
"properties": {
"isEnabled": {
"type": "boolean"
},
"name": {
"type": "string"
},
"saveDataInVariableId": {
"type": "string"
}
}
}
}
}
Expand Down Expand Up @@ -12720,6 +12829,20 @@
"url": {
"type": "string"
},
"waitForEvent": {
"type": "object",
"properties": {
"isEnabled": {
"type": "boolean"
},
"name": {
"type": "string"
},
"saveDataInVariableId": {
"type": "string"
}
}
},
"height": {
"type": "number"
}
Expand Down
Loading

0 comments on commit 033f52e

Please sign in to comment.