mirror of
https://gitlab.com/bramw/baserow.git
synced 2024-11-21 23:37:55 +00:00
58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
export default (client) => {
|
|
return {
|
|
fetchAll(databaseId) {
|
|
return client.get(`/database/tables/database/${databaseId}/`)
|
|
},
|
|
create(
|
|
databaseId,
|
|
values,
|
|
initialData = null,
|
|
firstRowHeader = false,
|
|
config = null
|
|
) {
|
|
if (initialData !== null) {
|
|
values.data = initialData
|
|
values.first_row_header = firstRowHeader
|
|
}
|
|
|
|
return client.post(
|
|
`/database/tables/database/${databaseId}/async/`,
|
|
values,
|
|
config
|
|
)
|
|
},
|
|
createSync(databaseId, values, initialData = null, firstRowHeader = false) {
|
|
if (initialData !== null) {
|
|
values.data = initialData
|
|
values.first_row_header = firstRowHeader
|
|
}
|
|
|
|
return client.post(`/database/tables/database/${databaseId}/`, values)
|
|
},
|
|
importData(tableId, data, config = null) {
|
|
return client.post(
|
|
`/database/tables/${tableId}/import/async/`,
|
|
{ data },
|
|
config
|
|
)
|
|
},
|
|
get(tableId) {
|
|
return client.get(`/database/tables/${tableId}/`)
|
|
},
|
|
update(tableId, values) {
|
|
return client.patch(`/database/tables/${tableId}/`, values)
|
|
},
|
|
order(databaseId, order) {
|
|
return client.post(`/database/tables/database/${databaseId}/order/`, {
|
|
table_ids: order,
|
|
})
|
|
},
|
|
asyncDuplicate(tableId) {
|
|
return client.post(`/database/tables/${tableId}/duplicate/async/`)
|
|
},
|
|
delete(tableId) {
|
|
return client.delete(`/database/tables/${tableId}/`)
|
|
},
|
|
}
|
|
}
|