Retrieve
Retrieve
client.vals.files.retrieve(stringvalId, FileRetrieveParamsquery, RequestOptionsoptions?): PageCursorURL<idstringlinksLinksnamestringpathstringtypeunionupdatedAtstringversionnumberFileRetrieveResponse>
get/v2/vals/{val_id}/files
Get metadata for files and directories in a val. If path is an empty string, returns files at the root directory.
Parameters
valIdstring
formatuuid
querylimitnumberoffsetnumberpathstringrecursivebooleanbranch_idstringversionnumberFileRetrieveParams
Returns
FileRetrieveResponse
A File or Directory's Metadata
import ValTown from '@valtown/sdk';
const client = new ValTown();
// Automatically fetches more pages as needed.
for await (const fileRetrieveResponse of client.vals.files.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
limit: 1,
offset: 0,
path: 'path',
recursive: true,
})) {
console.log(fileRetrieveResponse.id);
}
200 Example
{
"data": [
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"links": {
"html": "https://example.com",
"module": "https://example.com",
"self": "https://example.com",
"endpoint": "https://example.com"
},
"name": "name",
"path": "path",
"type": "directory",
"updatedAt": "2019-12-27T18:11:19.117Z",
"version": 0
}
],
"links": {
"self": "https://example.com",
"next": "https://example.com",
"prev": "https://example.com"
}
}