Client
Class in @sascom/jsclient.
API catalogue · @sascom/jsclient · Class
Members#
| Member | Kind | Description |
|---|---|---|
| constructor | Method | |
| auth | Property | The login of this client, null before a login; change it with setAuth() |
| status | Property | |
| addConnectionRestoredListener | Method | |
| download | Method | Starts a browser download of such a stream |
| followJob | Method | Follows a job through the app's follow task (input job_uuid): a live task, it attaches again after a reconnect. |
| getDownloadUrl | Method | The URL that downloads a stream the server returned (a descriptor from a task's response, or a URL) |
| getServerInfo | Method | |
| getTask | Method | |
| isExpired | Method | |
| onNodeChanged | Method | When a reconnect lands on another node, or on a restarted one: tasks that ran there were lost (TASK_LOST_NODE_CHANGED). |
| post | Method | |
| post | Method | |
| post | Method | |
| setAuth | Method | |
| setDefaultErrorHandler | Method | Where the error of a task without an error callback goes; the client calls its error(error, request, response) |
| validateAndSetAuth | Method |
constructor#
TypeScript#
constructor(clientFactory: ClientFactory, settings: ClientFactorySettings)Parameters#
| Name | Type | Description |
|---|---|---|
clientFactory |
ClientFactory | |
settings |
ClientFactorySettings |
auth#
The login of this client, null before a login; change it with setAuth()
status#
TypeScript#
public readonly status: "closed" | "new" | "open"addConnectionRestoredListener#
TypeScript#
public addConnectionRestoredListener(listener: () => void): voidParameters#
| Name | Type | Description |
|---|---|---|
listener |
() => void |
download#
TypeScript#
public download(streamDescriptor: string | { filename?: string; type: string; [key: string]: unknown }): voidStarts a browser download of such a stream
Parameters#
| Name | Type | Description |
|---|---|---|
streamDescriptor |
string | { filename?: string; type: string; [key: string]: unknown } |
followJob#
TypeScript#
public followJob(projectName: string, taskName: string, jobId: string, input?: Record<string, unknown>): TaskFollows a job through the app's follow task (input job_uuid): a live task, it attaches again after a reconnect.
Parameters#
| Name | Type | Description |
|---|---|---|
projectName |
string |
|
taskName |
string |
|
jobId |
string |
|
input |
Record<string, unknown> |
getDownloadUrl#
TypeScript#
public getDownloadUrl(streamDescriptor: string | { filename?: string; type: string; [key: string]: unknown }): stringThe URL that downloads a stream the server returned (a descriptor from a task's response, or a URL)
Parameters#
| Name | Type | Description |
|---|---|---|
streamDescriptor |
string | { filename?: string; type: string; [key: string]: unknown } |
getServerInfo#
TypeScript#
public getServerInfo(): ServerInfo | nullgetTask#
Parameters#
| Name | Type | Description |
|---|---|---|
id |
string |
|
name |
string |
|
nodeId |
string |
isExpired#
Parameters#
| Name | Type | Description |
|---|---|---|
auth |
AuthToken |
onNodeChanged#
TypeScript#
public onNodeChanged(listener: (current: ServerInfo, previous: ServerInfo | null) => void): voidWhen a reconnect lands on another node, or on a restarted one: tasks that ran there were lost (TASK_LOST_NODE_CHANGED).
Parameters#
| Name | Type | Description |
|---|---|---|
listener |
(current: ServerInfo, previous: ServerInfo | null) => void |
post#
TypeScript#
public post(projectName: string, taskName: string, input?: unknown, auth?: AuthToken): TaskParameters#
| Name | Type | Description |
|---|---|---|
projectName |
string |
|
taskName |
string |
|
input |
unknown |
|
auth |
AuthToken |
post#
Parameters#
| Name | Type | Description |
|---|---|---|
projectName |
string |
|
input |
unknown |
|
auth |
AuthToken |
post#
TypeScript#
public post(projectName: string, taskName: string, input?: unknown, auth?: AuthToken): TaskParameters#
| Name | Type | Description |
|---|---|---|
projectName |
string |
|
taskName |
string |
|
input |
unknown |
|
auth |
AuthToken |
setAuth#
Parameters#
| Name | Type | Description |
|---|---|---|
auth |
AuthToken |
setDefaultErrorHandler#
TypeScript#
public setDefaultErrorHandler(defaultErrorHandler: { error: (error: unknown, request: unknown, response: unknown) => void }): voidWhere the error of a task without an error callback goes; the client calls its error(error, request, response)
Parameters#
| Name | Type | Description |
|---|---|---|
defaultErrorHandler |
{ error: (error: unknown, request: unknown, response: unknown) => void } |
validateAndSetAuth#
Parameters#
| Name | Type | Description |
|---|---|---|
auth |
AuthToken |