Saga Documentation 0.9.434-4

@hexagramio/saga-ts - v0.9.434-4

Table of contents

Classes

Interfaces

Type Aliases

Functions

HTTP Commands

Socket Commands

User Types

Type Aliases

HTTPCommand

Ƭ HTTPCommand<T>: HTTPGetCommand<T> | HTTPPostPutCommand<T> | HTTPDeleteCommand<T>

Type parameters

Name
T

SocketCommand

Ƭ SocketCommand: SocketJoinCommand

The discriminating union type of socket commands, for it just contains the join commands, but the intent is to hold other socket commands as well


SocketJoinCommand

Ƭ SocketJoinCommand: Object

A socket join command

Type declaration

Name Type
id? string
join boolean
method "/users" | "/bots" | "/globals" | "/jobs/runnable_calls" | "/jobs/versions" | "/scripts/runnable_calls" | "/scripts/versions" | "/system" | "/npm_packages"

Functions

sendHTTPCommand

sendHTTPCommand<T>(baseURL, command): Promise<T>

Send the HTTP Command to the host with the given baseURL

Throws

an APIError if the operations fails

Type parameters

Name
T

Parameters

Name Type Description
baseURL URL the baseURL of the HTTP Api, i.e 'https://example.api.hexagram.io'
command HTTPCommand<T> the actual command to send

Returns

Promise<T>

a promise containing the response from the command

HTTP Commands

AddBotPropertyCommand

AddBotPropertyCommand(accessToken, data): HTTPCommand<ReadProperty>

Add a bot property command

Parameters

Name Type Description
accessToken string the required accessToken
data CreateProperty the property

Returns

HTTPCommand<ReadProperty>


AddGlobalsPropertyCommand

AddGlobalsPropertyCommand(accessToken, data): HTTPCommand<ReadProperty>

Add a bot property command

Parameters

Name Type Description
accessToken string the required accessToken
data CreateProperty the property

Returns

HTTPCommand<ReadProperty>


AddUserPropertyCommand

AddUserPropertyCommand(accessToken, data): HTTPCommand<ReadProperty>

Add a bot property command

Parameters

Name Type Description
accessToken string the required accessToken
data CreateProperty the property

Returns

HTTPCommand<ReadProperty>


CreateBotCommand

CreateBotCommand(accessToken, data): HTTPCommand<ReadBot>

Create a new bot command

Parameters

Name Type Description
accessToken string the required accessToken
data CreateBot a CreateBot Object

Returns

HTTPCommand<ReadBot>


CreateBotsCommand

CreateBotsCommand(accessToken, data): HTTPCommand<ReadBot[]>

Create an array of bots command

Parameters

Name Type Description
accessToken string the required accessToken
data CreateBot[] a CreateBot Object array

Returns

HTTPCommand<ReadBot[]>


CreateGenerateBasicUserCommand

CreateGenerateBasicUserCommand(data?): HTTPCommand<ReadUser>

Command to create a generated user

Parameters

Name Type
data BasicUser

Returns

HTTPCommand<ReadUser>


CreateTestUserCommand

CreateTestUserCommand(username?): HTTPCommand<ReadUser>

Command to create a test user

Parameters

Name Type
username? string

Returns

HTTPCommand<ReadUser>


DeleteBotCommand

DeleteBotCommand(accessToken, _id): HTTPCommand<{ ok: true }>

Delete a bot command

Parameters

Name Type Description
accessToken string the required accessToken
_id string -

Returns

HTTPCommand<{ ok: true }>


DeleteTestDataCommand

DeleteTestDataCommand(accessToken): HTTPCommand<{ ok: 1 }>

Command to remove all data flagged with test_data from the saga

Parameters

Name Type Description
accessToken string the required accessToken

Returns

HTTPCommand<{ ok: 1 }>


GetBotCommand

GetBotCommand(accessToken, id): HTTPCommand<ReadBot>

Get a bot command

Parameters

Name Type Description
accessToken string the required accessToken
id string the id of the bot

Returns

HTTPCommand<ReadBot>


GetBuildVersionCommand

GetBuildVersionCommand(accessToken): HTTPCommand<{ version: string }>

Command to return the current saga build version

Parameters

Name Type Description
accessToken string the required accessToken

Returns

HTTPCommand<{ version: string }>


GetDeleteCommand

GetDeleteCommand(accessToken, id): HTTPCommand<ReadUser>

Delete a user command

Parameters

Name Type Description
accessToken string the required accessToken
id string the id of the user

Returns

HTTPCommand<ReadUser>


GetGlobalsCommand

GetGlobalsCommand(accessToken): HTTPCommand<[ReadProperty]>

Add a bot property command

Parameters

Name Type Description
accessToken string the required accessToken

Returns

HTTPCommand<[ReadProperty]>


GetUserCommand

GetUserCommand(accessToken, id): HTTPCommand<ReadUser>

Get a user command

Parameters

Name Type Description
accessToken string the required accessToken
id string the id of the user

Returns

HTTPCommand<ReadUser>


ListBotsCommand

ListBotsCommand(accessToken, search?): HTTPCommand<List<ReadBot>>

List Bots command

Parameters

Name Type Description
accessToken string the required accessToken
search? string search criteria for bots

Returns

HTTPCommand<List<ReadBot>>


ListUsersCommand

ListUsersCommand(accessToken, search?): HTTPCommand<List<ReadUser>>

List Users command

Parameters

Name Type Description
accessToken string the required accessToken
search? string search criteria for ysers

Returns

HTTPCommand<List<ReadUser>>


LoginUserCommand

LoginUserCommand(data): HTTPCommand<ReadUser & Authentication>

Command to login a user

Parameters

Name Type
data LoginUser

Returns

HTTPCommand<ReadUser & Authentication>


RefreshTokenCommand

RefreshTokenCommand(refreshToken, id): HTTPCommand<Authentication>

Refresh token command

Parameters

Name Type Description
refreshToken string the refresh token *
id string the id of the user

Returns

HTTPCommand<Authentication>


RegisterUserCommand

RegisterUserCommand(data): HTTPCommand<ReadUser & Authentication>

Create command to register a user

Parameters

Name Type
data RegisterUser

Returns

HTTPCommand<ReadUser & Authentication>


TriggerBuildCommand

TriggerBuildCommand(accessToken): HTTPCommand<{ version: string }>

Command to trigger a saga rebuild

Parameters

Name Type Description
accessToken string the required accessToken

Returns

HTTPCommand<{ version: string }>


UpdateBotCommand

UpdateBotCommand(accessToken, data): HTTPCommand<ReadBot>

Update the bot command

Parameters

Name Type Description
accessToken string the required accessToken
data UpdateBot the bot needing to be updated, the _id of the bot is used to select the bot

Returns

HTTPCommand<ReadBot>


UpdateUserCommand

UpdateUserCommand(accessToken, data): HTTPCommand<ReadUser>

Update the user command

Parameters

Name Type Description
accessToken string the required accessToken
data UpdateUser the user needing to be updated, the _id of the user is used to select the user

Returns

HTTPCommand<ReadUser>


WhoAmICommand

WhoAmICommand(accessToken): HTTPCommand<ReadUser>

Creates a command to get the user associated with the given accessToken

Parameters

Name Type Description
accessToken string the required accessToken

Returns

HTTPCommand<ReadUser>

Socket Commands

JoinBotCommand

JoinBotCommand(_id): SocketJoinCommand

A command to join a bots realtime socket

Parameters

Name Type Description
_id string id of the bot

Returns

SocketJoinCommand


JoinGlobalsCommand

JoinGlobalsCommand(): SocketJoinCommand

A command to join globals properties updates

Returns

SocketJoinCommand


JoinUserCommand

JoinUserCommand(_id): SocketJoinCommand

A command to join a users realtime socket

Parameters

Name Type Description
_id string the id of the user

Returns

SocketJoinCommand


LeaveBotCommand

LeaveBotCommand(_id): SocketJoinCommand

A command to leave a bots realtime socket

Parameters

Name Type Description
_id string id of the bot

Returns

SocketJoinCommand


LeaveGlobalsCommand

LeaveGlobalsCommand(): SocketJoinCommand

A command to leave globals properties updates

Returns

SocketJoinCommand


LeaveUserCommand

LeaveUserCommand(_id): SocketJoinCommand

A command to leave a users realtime socket

Parameters

Name Type Description
_id string the id of the user

Returns

SocketJoinCommand