Reference·JavaScript · @sascom/jsclientJavaScript

ClientIdentity

Class in @sascom/jsclient.

API catalogue · @sascom/jsclient · Class

TypeScript#
class ClientIdentity

What 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#

TypeScript#
constructor()

get#

TypeScript#
get(key: string): string | undefined

A field by its wire key: sdk, v, app, parts, rt, inst, …

Parameters#

Name Type Description
key string

header#

TypeScript#
header(): string

The value of X-BIMworks-Client.

hello#

TypeScript#
hello(): string

The socket's first message: {"hb": true, "client": header()}.

userAgent#

TypeScript#
userAgent(): string

bimworks-<sdk>/<v> (<runtime>; <os>) <app>, for runtimes that may set a User-Agent.

withApplication#

TypeScript#
withApplication(name: string | null, version?: string | null): ClientIdentity

The 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#

TypeScript#
withBuild(version: string | null, built?: string | null, commit?: string | null): ClientIdentity

The 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#

TypeScript#
withoutPlatform(): ClientIdentity

Without the runtime and the platform.

withPart#

TypeScript#
withPart(name: string, version?: string | null): ClientIdentity

A BIM.works package that uses the client, e.g. a viewer, sent in parts.

Parameters#

Name Type Description
name string
version string | null

withSpec#

TypeScript#
withSpec(spec: string | null, specSha?: string | null, generator?: string | null): ClientIdentity

For 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#

TypeScript#
static create(sdk: string, lang: string): ClientIdentity

A 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