Overview¶
For now, Dataflow resources SDK is only accessible from Function resources.
This SDK enables the usage of various Dataflow-related actions, including the retrieval / removal of documents and views as well.
Usage¶
Initialization¶
In order to init the SDK, 2 parameters are required :
- Dataflow id : may be retrieved from the browser address bar when on the dataflow screen
- Access Token : Authentication token
const accessToken = "..."
const dataflowId = "..."
const dataflow = new Dataflow(accessToken, dataflowId)
Méthodes¶
List documents¶
// All documents
result = await dataflow.documents()
// with a query
result = await dataflow.documents({ "where": { "city": "Toulouse" } })
// first page only
result = await dataflow.documents({ "page": 1, "perPage": 10 })
List views¶
// All views
result = await dataflow.views()
List documents from a view¶
// All documents
result = await dataflow.viewDocuments('viewName')
// first page only
result = await dataflow.viewDocuments('viewName', { "page": 1, "perPage": 10 })
Create a document¶
result = await dataflow.create({ name: 'Martin', 'city': 'Toulouse' })
Update a document¶
result = await dataflow.update('docId', { name: 'Martin', 'city': 'Tolosa' })
Create / update a view¶
result = await dataflow.updateView('viewName', {
"query": {
"city": "Toulouse",
},
"columns": ["city"]
})
Delete a document¶
result = await dataflow.delete('docId')