Manual Reference Source
public class | source

Client

Extends:

events~EventEmitter → Client

The Client class is used to connect to the server and retrieve information about available services and jobs.

Example:

// Obtain Client object from GSF.
const Client = GSF.client({address:'MyServer',port:9191});

Constructor Summary

Public Constructor
public

constructor(clientOptions: ClientOptions)

Member Summary

Public Members
public

The API root endpoint.

public

The server url.

public

The server address/name.

public

The headers to use in requests

public

The server port.

public

The protocol to use.

public

The API root url.

Private Members
private

_events: *

Method Summary

Public Methods
public

job(jobId: string, progressCallback: function(info: JobProgressInfo), startedCallback: function(info: JobStartedInfo)): Job

Retrieves job object based on the job ID.

public

jobInfoList(jobListOptions: JobListOptions): Promise<JobInfoList, error>

Retrieves an array of job info objects.

public

jobs(jobListOptions: JobListOptions): Promise<Job[], error>

Retrieves an array of jobs on the server.

public

service(serviceName: string): Service

Returns the Service object based on service name.

public

services(): Promise<Service[], error>

Retrieves an array of available services from the server.

Public Constructors

public constructor(clientOptions: ClientOptions) source

Params:

NameTypeAttributeDescription
clientOptions ClientOptions

The object containing server information.

Emit:

JobCompleted

JobSucceeded

JobFailed

JobProgress

JobStarted

JobAccepted

Public Members

public APIRoot: string source

The API root endpoint. If none, set to empty string.

public URL: string source

The server url.

public address: string source

The server address/name.

public headers: Object source

The headers to use in requests

public port: number source

The server port.

public protocol: string source

The protocol to use.

public rootURL: string source

The API root url.

Private Members

private _events: * source

Public Methods

public job(jobId: string, progressCallback: function(info: JobProgressInfo), startedCallback: function(info: JobStartedInfo)): Job source

Retrieves job object based on the job ID.

Params:

NameTypeAttributeDescription
jobId string

The id of the job from which to retrieve the job object.

progressCallback function(info: JobProgressInfo)
  • optional

The callback to handle job progress.

startedCallback function(info: JobStartedInfo)
  • optional

The callback that is called when the job starts. For more reliable job started information, listen to the GSF JobStarted events as this callback may not always get called. In some cases the job can start before the callback is registered.

Return:

Job

Returns job object.

public jobInfoList(jobListOptions: JobListOptions): Promise<JobInfoList, error> source

Retrieves an array of job info objects.

Params:

NameTypeAttributeDescription
jobListOptions JobListOptions

Object containing options for filtering job list.

Return:

Promise<JobInfoList, error>

Returns a Promise to a JobInfoList object.

public jobs(jobListOptions: JobListOptions): Promise<Job[], error> source

Retrieves an array of jobs on the server.

Params:

NameTypeAttributeDescription
jobListOptions JobListOptions

Object containing options for filtering job list.

Return:

Promise<Job[], error>

Returns a Promise to an array of jobs that exist on the server.

public service(serviceName: string): Service source

Returns the Service object based on service name.

Params:

NameTypeAttributeDescription
serviceName string

The name of the service.

Return:

Service

The Service object.

public services(): Promise<Service[], error> source

Retrieves an array of available services from the server.

Return:

Promise<Service[], error>

Returns a Promise to an array of available Service objects.