Add missing API client documentation and fix S3 upload endpoints to make them consistent
This commit is contained in:
parent
9a813dbb29
commit
bd04d627d2
|
@ -71,7 +71,12 @@
|
|||
const upload = async () => {
|
||||
loading = true
|
||||
try {
|
||||
const res = await API.externalUpload(datasourceId, bucket, key, data)
|
||||
const res = await API.externalUpload({
|
||||
datasourceId,
|
||||
bucket,
|
||||
key,
|
||||
data,
|
||||
})
|
||||
notificationStore.actions.success("File uploaded successfully")
|
||||
loading = false
|
||||
return res
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
export const buildAppEndpoints = API => ({
|
||||
/**
|
||||
* Fetches screen definition for an app.
|
||||
* @param appId the ID of the app to fetch from
|
||||
*/
|
||||
fetchAppPackage: async appId => {
|
||||
return await API.get({
|
||||
|
|
|
@ -26,8 +26,11 @@ export const buildAttachmentEndpoints = API => ({
|
|||
|
||||
/**
|
||||
* Generates a signed URL to upload a file to an external datasource.
|
||||
* @param datasourceId the ID of the datasource to upload to
|
||||
* @param bucket the name of the bucket to upload to
|
||||
* @param key the name of the file to upload to
|
||||
*/
|
||||
getSignedDatasourceURL: async (datasourceId, bucket, key) => {
|
||||
getSignedDatasourceURL: async ({ datasourceId, bucket, key }) => {
|
||||
return await API.post({
|
||||
url: `/api/attachments/${datasourceId}/url`,
|
||||
body: { bucket, key },
|
||||
|
@ -36,13 +39,17 @@ export const buildAttachmentEndpoints = API => ({
|
|||
|
||||
/**
|
||||
* Uploads a file to an external datasource.
|
||||
* @param datasourceId the ID of the datasource to upload to
|
||||
* @param bucket the name of the bucket to upload to
|
||||
* @param key the name of the file to upload to
|
||||
* @param data the file to upload
|
||||
*/
|
||||
externalUpload: async (datasourceId, bucket, key, data) => {
|
||||
const { signedUrl, publicUrl } = await API.getSignedDatasourceURL(
|
||||
externalUpload: async ({ datasourceId, bucket, key, data }) => {
|
||||
const { signedUrl, publicUrl } = await API.getSignedDatasourceURL({
|
||||
datasourceId,
|
||||
bucket,
|
||||
key
|
||||
)
|
||||
key,
|
||||
})
|
||||
await API.put({
|
||||
url: signedUrl,
|
||||
body: data,
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
export const buildAutomationEndpoints = API => ({
|
||||
/**
|
||||
* Executes an automation. Must have "App Action" trigger.
|
||||
* @param automationId the ID of the automation to trigger
|
||||
* @param fields the fields to trigger the automation with
|
||||
*/
|
||||
triggerAutomation: async ({ automationId, fields }) => {
|
||||
return await API.post({
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
export const buildRelationshipEndpoints = API => ({
|
||||
/**
|
||||
* Fetches related rows for a certain field of a certain row.
|
||||
* @param tableId the ID of the table to fetch from
|
||||
* @param rowId the ID of the row to fetch related rows for
|
||||
* @param fieldName the name of the relationship field
|
||||
*/
|
||||
fetchRelationshipData: async ({ tableId, rowId, fieldName }) => {
|
||||
if (!tableId || !rowId) {
|
||||
|
|
|
@ -8,6 +8,9 @@ export const buildRouteEndpoints = API => ({
|
|||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Fetches all routes for the current app.
|
||||
*/
|
||||
fetchAppRoutes: async () => {
|
||||
return await API.get({
|
||||
url: "/api/routing",
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
export const buildRowEndpoints = API => ({
|
||||
/**
|
||||
* Fetches data about a certain row in a table.
|
||||
* @param tableId the ID of the table to fetch from
|
||||
* @param rowId the ID of the row to fetch
|
||||
*/
|
||||
fetchRow: async ({ tableId, rowId }) => {
|
||||
if (!tableId || !rowId) {
|
||||
|
@ -13,7 +15,8 @@ export const buildRowEndpoints = API => ({
|
|||
},
|
||||
|
||||
/**
|
||||
* Creates a row in a table.
|
||||
* Creates or updates a row in a table.
|
||||
* @param row the row to save
|
||||
*/
|
||||
saveRow: async row => {
|
||||
if (!row?.tableId) {
|
||||
|
@ -27,6 +30,9 @@ export const buildRowEndpoints = API => ({
|
|||
|
||||
/**
|
||||
* Deletes a row from a table.
|
||||
* @param tableId the ID of the table to delete from
|
||||
* @param rowId the ID of the row to delete
|
||||
* @param revId the rev of the row to delete
|
||||
*/
|
||||
deleteRow: async ({ tableId, rowId, revId }) => {
|
||||
if (!tableId || !rowId || !revId) {
|
||||
|
|
|
@ -2,6 +2,7 @@ export const buildTableEndpoints = API => ({
|
|||
/**
|
||||
* Fetches a table definition.
|
||||
* Since definitions cannot change at runtime, the result is cached.
|
||||
* @param tableId the ID of the table to fetch
|
||||
*/
|
||||
fetchTableDefinition: async tableId => {
|
||||
return await API.get({
|
||||
|
@ -12,6 +13,7 @@ export const buildTableEndpoints = API => ({
|
|||
|
||||
/**
|
||||
* Fetches all rows from a table.
|
||||
* @param tableId the ID of the table for fetch
|
||||
*/
|
||||
fetchTableData: async tableId => {
|
||||
return await API.get({ url: `/api/${tableId}/rows` })
|
||||
|
@ -19,6 +21,14 @@ export const buildTableEndpoints = API => ({
|
|||
|
||||
/**
|
||||
* Searches a table using Lucene.
|
||||
* @param tableId the ID of the table to search
|
||||
* @param query the lucene search query
|
||||
* @param bookmark the current pagination bookmark
|
||||
* @param limit the number of rows to retrieve
|
||||
* @param sort the field to sort by
|
||||
* @param sortOrder the order to sort by
|
||||
* @param sortType the type to sort by, either numerically or alphabetically
|
||||
* @param paginate whether to paginate the data
|
||||
*/
|
||||
searchTable: async ({
|
||||
tableId,
|
||||
|
|
Loading…
Reference in New Issue