@hexagramio/saga-ts - v0.9.434-4
Table of contents
Classes
Interfaces
- Authentication
- CreateBot
- CreateMessage
- CreateProperty
- EventMap
- HTTPDeleteCommand
- HTTPGetCommand
- HTTPPostPutCommand
- List
- ReadBot
- ReadMessage
- ReadProperty
- Tags
- UpdateBot
Type Aliases
Functions
HTTP Commands
- AddBotPropertyCommand
- AddGlobalsPropertyCommand
- AddUserPropertyCommand
- CreateBotCommand
- CreateBotsCommand
- CreateGenerateBasicUserCommand
- CreateTestUserCommand
- DeleteBotCommand
- DeleteTestDataCommand
- GetBotCommand
- GetBuildVersionCommand
- GetDeleteCommand
- GetGlobalsCommand
- GetUserCommand
- ListBotsCommand
- ListUsersCommand
- LoginUserCommand
- RefreshTokenCommand
- RegisterUserCommand
- TriggerBuildCommand
- UpdateBotCommand
- UpdateUserCommand
- WhoAmICommand
Socket Commands
- JoinBotCommand
- JoinGlobalsCommand
- JoinUserCommand
- LeaveBotCommand
- LeaveGlobalsCommand
- LeaveUserCommand
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
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
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
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
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
CreateGenerateBasicUserCommand
▸ CreateGenerateBasicUserCommand(data?
): HTTPCommand
<ReadUser
>
Command to create a generated user
Parameters
Name | Type |
---|---|
data |
BasicUser |
Returns
CreateTestUserCommand
▸ CreateTestUserCommand(username?
): HTTPCommand
<ReadUser
>
Command to create a test user
Parameters
Name | Type |
---|---|
username? |
string |
Returns
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
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
GetGlobalsCommand
▸ GetGlobalsCommand(accessToken
): HTTPCommand
<[ReadProperty
]>
Add a bot property command
Parameters
Name | Type | Description |
---|---|---|
accessToken |
string |
the required accessToken |
Returns
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
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
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
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
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
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
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
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
JoinGlobalsCommand
▸ JoinGlobalsCommand(): SocketJoinCommand
A command to join globals properties updates
Returns
JoinUserCommand
▸ JoinUserCommand(_id
): SocketJoinCommand
A command to join a users realtime socket
Parameters
Name | Type | Description |
---|---|---|
_id |
string |
the id of the user |
Returns
LeaveBotCommand
▸ LeaveBotCommand(_id
): SocketJoinCommand
A command to leave a bots realtime socket
Parameters
Name | Type | Description |
---|---|---|
_id |
string |
id of the bot |
Returns
LeaveGlobalsCommand
▸ LeaveGlobalsCommand(): SocketJoinCommand
A command to leave globals properties updates
Returns
LeaveUserCommand
▸ LeaveUserCommand(_id
): SocketJoinCommand
A command to leave a users realtime socket
Parameters
Name | Type | Description |
---|---|---|
_id |
string |
the id of the user |