ClientIdentity
Class in @sascom/jsclient.
API catalogue · @sascom/jsclient · Class
class ClientIdentityWhat a client says it is, on every request (the X-BIMworks-Client header) and as the first message of its
WebSocket. Immutable: every with… returns a new identity.
Members#
| Member | Kind | Description |
|---|---|---|
| constructor | Method | |
| get | Method | A field by its wire key: sdk, v, app, parts, rt, inst, … |
| header | Method | The value of X-BIMworks-Client. |
| hello | Method | The socket's first message: {"hb": true, "client": header()}. |
| userAgent | Method | bimworks-/ (; ) , for runtimes that may set a User-Agent. |
| withApplication | Method | The application that uses the SDK, sent as app (letters, digits and . _ + -; anything else becomes _). |
| withBuild | Method | The build's version, time (UTC, ISO 8601) and commit; a version of "DEV" or nothing is sent as dev. |
| withoutPlatform | Method | Without the runtime and the platform. |
| withPart | Method | A BIM.works package that uses the client, e.g. a viewer, sent in parts. |
| withSpec | Method | For an SDK generated from the OpenAPI spec: the spec's version, its SHA-256 prefix, generator/version. |
| create | Method | A new identity for this SDK id (js, web, …) with this runtime, its platform and a fresh instance id. |
constructor#
constructor()get#
get(key: string): string | undefinedA field by its wire key: sdk, v, app, parts, rt, inst, …
Parameters#
| Name | Type | Description |
|---|---|---|
key |
string |
header#
header(): stringThe value of X-BIMworks-Client.
hello#
hello(): stringThe socket's first message: {"hb": true, "client": header()}.
userAgent#
userAgent(): stringbimworks-<sdk>/<v> (<runtime>; <os>) <app>, for runtimes that may set a User-Agent.
withApplication#
withApplication(name: string | null, version?: string | null): ClientIdentityThe application that uses the SDK, sent as app (letters, digits and . _ + -; anything else becomes _).
Parameters#
| Name | Type | Description |
|---|---|---|
name |
string | null |
|
version |
string | null |
withBuild#
withBuild(version: string | null, built?: string | null, commit?: string | null): ClientIdentityThe build's version, time (UTC, ISO 8601) and commit; a version of "DEV" or nothing is sent as dev.
Parameters#
| Name | Type | Description |
|---|---|---|
version |
string | null |
|
built |
string | null |
|
commit |
string | null |
withoutPlatform#
withoutPlatform(): ClientIdentityWithout the runtime and the platform.
withPart#
withPart(name: string, version?: string | null): ClientIdentityA BIM.works package that uses the client, e.g. a viewer, sent in parts.
Parameters#
| Name | Type | Description |
|---|---|---|
name |
string |
|
version |
string | null |
withSpec#
withSpec(spec: string | null, specSha?: string | null, generator?: string | null): ClientIdentityFor an SDK generated from the OpenAPI spec: the spec's version, its SHA-256 prefix, generator/version.
Parameters#
| Name | Type | Description |
|---|---|---|
spec |
string | null |
|
specSha |
string | null |
|
generator |
string | null |
create#
static create(sdk: string, lang: string): ClientIdentityA new identity for this SDK id (js, web, …) with this runtime, its platform and a fresh instance id.
Parameters#
| Name | Type | Description |
|---|---|---|
sdk |
string |
|
lang |
string |