Skip to content

Commit 078f6de

Browse files
authored
Merge pull request #127 from Space-DF/feat/api-public-device
feat: api public device
2 parents 77b21b3 + af16666 commit 078f6de

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

api.doc.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3367,6 +3367,75 @@ console.log(listResponse.results);
33673367

33683368
</details>
33693369

3370+
<details>
3371+
<summary><strong>listPublic</strong></summary>
3372+
3373+
List public device spaces with optional filtering, ordering, and pagination.
3374+
3375+
**Signature:**
3376+
3377+
```typescript
3378+
listPublic(params?: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<DeviceSpacesListResponse>
3379+
```
3380+
3381+
**Parameters:**
3382+
3383+
- `params` _(ListParamsResponse, optional)_: Query parameters for filtering, ordering, and pagination:
3384+
- `ordering` _(string, optional)_: Which field to use when ordering the results.
3385+
- `search` _(string, optional)_: A search term to filter results.
3386+
- `limit` _(integer, optional)_: Number of results to return per page.
3387+
- `offset` _(integer, optional)_: The initial index from which to return the results.
3388+
- `options` _(Core.RequestOptions, optional)_: Additional request options.
3389+
3390+
**Returns:** `Promise<DeviceSpacesListResponse>`
3391+
3392+
**Response shape:**
3393+
3394+
- `count` _(integer)_: Total number of device spaces matching the query.
3395+
- `next` _(string | null)_: URL to the next page of results, or `null`.
3396+
- `previous` _(string | null)_: URL to the previous page of results, or `null`.
3397+
- `results` _(DeviceSpacesParams[])_: Array of device space objects.
3398+
3399+
**Example:**
3400+
3401+
```typescript
3402+
const publicDeviceSpaces = await client.deviceSpaces.listPublic({
3403+
ordering: 'name',
3404+
limit: 10,
3405+
offset: 0,
3406+
});
3407+
console.log(publicDeviceSpaces.results);
3408+
```
3409+
3410+
</details>
3411+
3412+
<details>
3413+
<summary><strong>retrievePublic</strong></summary>
3414+
3415+
Retrieve a public device space by its ID.
3416+
3417+
**Signature:**
3418+
3419+
```typescript
3420+
retrievePublic(id: string, options?: Core.RequestOptions): Core.APIPromise<DeviceSpacesParams>
3421+
```
3422+
3423+
**Parameters:**
3424+
3425+
- `id` _(string)_: A UUID string identifying this device space.
3426+
- `options` _(Core.RequestOptions, optional)_: Additional request options.
3427+
3428+
**Returns:** `Promise<DeviceSpacesParams>`
3429+
3430+
**Example:**
3431+
3432+
```typescript
3433+
const publicDeviceSpace = await client.deviceSpaces.retrievePublic('3fa85f64-5717-4562-b3fc-2c963f66afa6');
3434+
console.log(publicDeviceSpace.name);
3435+
```
3436+
3437+
</details>
3438+
33703439
<details>
33713440
<summary><strong>retrieveByDeviceId</strong></summary>
33723441

src/resources/device/device-spaces.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ export class DeviceSpaces extends APIResource {
2525
});
2626
}
2727

28+
listPublic(params: ListParamsResponse = {}, options?: Core.RequestOptions): Core.APIPromise<DeviceSpacesListResponse> {
29+
return this._client.get(`/public/device-spaces`, {
30+
query: params,
31+
...options,
32+
});
33+
}
34+
35+
retrievePublic(id: string, options?: Core.RequestOptions): Core.APIPromise<DeviceSpacesParams> {
36+
return this._client.get(`/public/device-spaces/${id}`, options);
37+
}
38+
2839
retrieveByDeviceId(deviceId: string, options?: Core.RequestOptions): Core.APIPromise<DeviceSpacesParams> {
2940
return this._client.get(`/device-spaces/device/${deviceId}`, options);
3041
}

0 commit comments

Comments
 (0)