Skip to content

Commit b6af22a

Browse files
authored
Merge pull request #6665 from keboola/ms/dmd-903-list-workspace-objects
DMD-903 List workspace objects
2 parents 1935ab7 + 03524bd commit b6af22a

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

apiary.apib

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5974,6 +5974,43 @@ Returns an array of jobs instead of a single job.
59745974
}
59755975
]
59765976
5977+
## Workspace Objects [/v2/storage/branch/{branch_id}/workspaces/{workspace_id}/objects]
5978+
5979+
### List Development Branch Workspace Objects [GET]
5980+
5981+
Returns a list of objects (tables and views) present in the workspace schema in [Development Branch](#reference/development-branches). Supported on Snowflake and BigQuery backends.
5982+
5983+
+ Parameters
5984+
+ branch_id (required) - Id of the development branch
5985+
+ workspace_id (required, number) - Workspace ID
5986+
5987+
+ Request
5988+
+ Headers
5989+
5990+
X-StorageApi-Token: your_token
5991+
5992+
+ Response 200 (application/json)
5993+
5994+
+ Body
5995+
5996+
[
5997+
{
5998+
"name": "MY_TABLE",
5999+
"type": "table"
6000+
},
6001+
{
6002+
"name": "MY_VIEW",
6003+
"type": "view"
6004+
}
6005+
]
6006+
6007+
+ Response 404 (application/json)
6008+
6009+
+ Response 422 (application/json)
6010+
6011+
Returned when the workspace backend is not supported.
6012+
6013+
59776014
## Data Structures
59786015
59796016
### Workspace

src/Keboola/StorageApi/Workspaces.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,22 @@ public function getWorkspace(int|string $id): array
102102
return $result;
103103
}
104104

105+
/**
106+
* @return list<array{name: string, type: 'table'|'view'}>
107+
*/
108+
public function listObjects(int $workspaceId): array
109+
{
110+
/**
111+
* @var list<array{
112+
* name: string,
113+
* type: 'table'|'view'
114+
* }> $result
115+
*/
116+
$result = $this->client->apiGet("workspaces/{$workspaceId}/objects");
117+
118+
return $result;
119+
}
120+
105121
/**
106122
* @param int $id
107123
* @param array $options (boolean) async

0 commit comments

Comments
 (0)