Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions docs/api-reference/queryclient/spaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,38 @@ To create a space programmatically, you can call the following query.
smplrClient.createSpace({
name: string
notes?: string
}): Promise<{
sid: string
}>
}): Promise<{ sid: string }>
```

With `sid` the [Smplrspace ID](/guides/sid) of the space.

- `name` is the name of the space to create.
- `notes` - _optional_ - are internal team notes attached to the space.

## setSpaceStatus

You can call the following query to programmatically publish, set as draft, or archive a space.

```ts
smplrClient.setSpaceStatus({
spaceId: string;
status: 'published' | 'draft' | 'archived'
}): Promise<{ status: string }>
```

- `spaceId` - unique identifier of the space in Smplrspace, something like "spc_xxx". Refer to the [page on SIDs](/guides/sid) to learn more.
- `status` - one of the possible statuses, with "published" corresponding to "live" in the platform.

## deleteSpace

You can call the following query to programmatically delete a space.

```ts
smplrClient.deleteSpace(spaceId: string): Promise<void>
```

- `spaceId` - unique identifier of the space in Smplrspace, something like "spc_xxx". Refer to the [page on SIDs](/guides/sid) to learn more.


## listSpaces

Expand Down
14 changes: 8 additions & 6 deletions docs/api-reference/space/data-layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,23 @@ space.addIconDataLayer({
}
...customData: object
}]
icon: {
url: string
width: number
height: number
}
icon: IconSource | (dataElement: object) => IconSource // see IconSource below
width?: number | (dataElement: object) => number
onDrag?: ({ data: object }) => void
onDrop?: ({ data: object; position: object }) => void
disableElevationCorrection?: boolean
}) => DataLayerController

interface IconSource {
url: string
width: number
height: number
}
```

- `id` is a unique identifier for this layer which is used for updates.
- `data` is an array of objects (refered to as data elements) to be rendered. Each element **must** have an `id` (unique identifier within the data array) and a `position`. Elements can also contain any additional custom data used for rendering options.
- `icon` provides information about the icon file to use. Icons must be self-hosted, `width` and `height` indicate the dimensions of the icon available at `url`. Only PNG and JPEG files are supported.
- `icon` provides information about the icon file to use. Icons must be self-hosted, `width` and `height` indicate the dimensions of the icon available at `url`. Only PNG and JPEG files are supported. It can be defined as a "source" for all elements or per element with a function that takes each element as argument and returns the "source" for that element.
- `width` - _optional_ - defines the width of the icon to render in meters. It can be defined as a number for all elements or per element with a function that takes each element as argument and returns the width for that element. _Default value: 1m._
- `onDrag, onDrop` - _optional_ - providing either or both handlers will make data elements of the layer draggable. Each handler takes the dragged data element as argument. `onDrop` also receives the new position of the element so it can be updated in your app state and database.
- `disableElevationCorrection` - _optional_
Expand Down
16 changes: 16 additions & 0 deletions docs/api-reference/space/space.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,22 @@ space.takeScreenshot({
- `forceRetinaPixelRatio` - _optional_ - can be set to true to force the image resolution to be **2x** the set width/height. _Default value: false_.
- `forceNonRetinaPixelRatio` - _optional_ - can be set to true to force the image resolution to be **1x** the set width/height. _Default value: false_.

### Get a screenshot as a JS File

This method will return the screenshot as a [Javascript `File` object](https://developer.mozilla.org/en-US/docs/Web/API/File). It can be used to upload the file as [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) to your own backend, or to perform other programmatic manipulations.

```ts
space.takeScreenshotToFile({
mode: '3d-scene' | 'full-viewer'
width?: number
height?: number
forceRetinaPixelRatio?: boolean
forceNonRetinaPixelRatio?: boolean
}) => Promise<string>
```

All arguments are the same as [`takeScreenshot`](#download-a-screenshot)

### Get a screenshot as Base64 string

This method will return a string containing the [Base64 encoded image](https://b64encode.com/blog/what-is-a-base64-image-and-how-to-encode-it/) that you can manipulate, upload, or download as per your specific requirements.
Expand Down
4 changes: 3 additions & 1 deletion docs/guides/sid.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ _TL;DR: better DX and better UX._

```
spc_ space
prj_ project
rpt_ report
rpg_ report page
prj_ project
ds_ data source
eqmt_ equipment
```

That's it, pretty short list ;). More will come soon.
Expand Down