-
Notifications
You must be signed in to change notification settings - Fork 0
Docs
- OctyneError
-
An error sent back by Octyne after making a request.
- Client
-
The Octyne API client.
-
OctyneApi(url, info) ⇒
Client
-
A function to initialise an Octyne API {Client}. Requires either a username/password pair or a token.
An error sent back by Octyne after making a request.
Kind: global class
Properties
Name | Type | Description |
---|---|---|
code | number |
The HTTP response code sent by Octyne. |
name | string |
Constant set to the value OctyneError. |
The constructor for an OctyneError.
Param | Type | Description |
---|---|---|
message | string |
The error message sent by Octyne. |
code | number |
The HTTP response code sent by Octyne. |
Kind: instance method of OctyneError
Returns: string
- The error in string format.
The Octyne API client.
Kind: global class
Properties
Name | Type | Description |
---|---|---|
info | Object |
An object containing the URL, username, password and token to Octyne. |
info.url | string |
The URL to the Octyne instance. |
[info.username] | string |
The username of the Octyne user. |
[info.password] | string |
The password of the Octyne user. |
[info.token] | string |
The token of the Octyne user. |
-
Client
- new OctyneClient(url, info)
-
.getServers() ⇒
Object
-
.login() ⇒
Promise.<void>
-
.logout() ⇒
Promise.<void>
-
.getTicket() ⇒
Promise.<string>
-
.openConsole(server, [ticket]) ⇒
Promise.<WebSocket>
-
.startServer(server) ⇒
Promise.<void>
-
.stopServer(server) ⇒
Promise.<void>
-
.getFile(server, file, stream) ⇒
Promise.<Buffer>
|ReadableStream
-
.getFiles(server, directory) ⇒
Promise.<Array.<Object>>
-
.createFolder(server, directory) ⇒
Promise.<void>
-
.moveFile(server, oldpath, newpath) ⇒
Promise.<void>
-
.copyFile(server, oldpath, newpath) ⇒
Promise.<void>
-
.renameFile(server, oldpath, newname) ⇒
Promise.<void>
-
.deleteFile(server, path) ⇒
Promise.<void>
-
.getServer(server) ⇒
Promise.<Object>
-
.request(endpoint, options) ⇒
Promise.<Object>
The constructor for the Octyne API client. Requires either a username/password pair or a token.
Param | Type | Description |
---|---|---|
url | string |
The URL to the Octyne instance. |
info | Object |
An object containing either a username/password pair or an Octyne token. |
[info.username] | string |
A string containing the username to log into Octyne with. |
[info.password] | string |
A string containing the password to log into Octyne with. |
[info.token] | string |
A string containing the token to authenticate to Octyne with. |
Get all the servers running on this Octyne instance. The object returned has server names as keys, and numbers as the status for the server. 0 indicates offline, 1 indicates online, 2 indicated crashed.
Kind: instance method of Client
Returns: Object
- Returns an object containing server names as keys, and a number as value.
Logs into Octyne using the username/password pair provided and retrieves the token and saves it.
Kind: instance method of Client
Returns: Promise.<void>
- A Promise which resolves when login succeeds, and rejects if failed.
Invalidates the stored token by logging out of Octyne.
Kind: instance method of Client
Returns: Promise.<void>
- A Promise which resolves after logout, and rejects if failed.
Returns an Octyne one-time ticket which is used for console/file downloads on browser. They expire within 120 seconds and can only be used by the IP address that requested it.
Kind: instance method of Client
Returns: Promise.<string>
- A Promise which resolves with a string containing the ticket.
Connects to the console of a process running on Octyne, and returns a WebSocket connection in a Promise.
Kind: instance method of Client
Returns: Promise.<WebSocket>
- A Promise which resolves with a WebSocket when the connection succeeds.
Param | Type | Description |
---|---|---|
server | string |
The name of the Octyne server, which console is to be connected to. |
[ticket] |
string | boolean
|
If an Octyne ticket should be used. If a string is passed, it is used as ticket. Default: window !== 'undefined' |
Starts a process on Octyne, given the name of the process.
Kind: instance method of Client
Returns: Promise.<void>
- A Promise which resolves after the request, and rejects on error.
Param | Type | Description |
---|---|---|
server | string |
The name of the Octyne process to start. |
Stops a process on Octyne, given the name of the process.
Kind: instance method of Client
Returns: Promise.<void>
- A Promise which resolves after the request, and rejects on error.
Param | Type | Description |
---|---|---|
server | string |
The name of the Octyne process to stop. |
Get a file from an Octyne server process directory.
Kind: instance method of Client
Returns: Promise.<Buffer>
| ReadableStream
- A ReadableStream if stream is true, else a Promise with a Buffer, with the file data.
Param | Type | Description |
---|---|---|
server | string |
The name of the Octyne server from which to get the file. |
file | string |
The path to the file to download. |
stream | boolean |
Whether or not to return a ReadableStream (performant for large files). If Octyne responds with an non-2xx HTTP status code, this option will be ignored. |
Gets the contents of the provided folder in an Octyne server process directory. Each file in the array returned is in the following format: { name: string, size: number, lastModified: number, folder: boolean, mimeType: string }
Kind: instance method of Client
Returns: Promise.<Array.<Object>>
- A Promise containing an array of objects, in the format given in the description.
Param | Type | Description |
---|---|---|
server | string |
The name of the Octyne server from which to get the folder contents. |
directory | string |
Path to the folder in the Octyne server process directory. |
Creates a folder in an Octyne server process directory.
Kind: instance method of Client
Returns: Promise.<void>
- A Promise which resolves on success and rejects on failure.
Param | Type | Description |
---|---|---|
server | string |
The name of the Octyne server where the folder needs to be created. |
directory | string |
Path to the directory which needs to be created. |
Moves a file/folder within an Octyne server process directory.
Kind: instance method of Client
Returns: Promise.<void>
- A Promise which resolves on success and rejects on failure.
Param | Type | Description |
---|---|---|
server | string |
The name of the Octyne server wherein which the file/folder needs to be moved. |
oldpath | string |
The path where the current file/folder is located. |
newpath | string |
The new path where the file/folder needs to be moved. |
Copies a file/folder within an Octyne server process directory.
Kind: instance method of Client
Returns: Promise.<void>
- A Promise which resolves on success and rejects on failure.
Param | Type | Description |
---|---|---|
server | string |
The name of the Octyne server wherein which the file/folder needs to be moved. |
oldpath | string |
The path where the current file/folder is located. |
newpath | string |
The new path where the file/folder needs to be copied to. |
Renames a file/folder in an Octyne server process directory.
Kind: instance method of Client
Returns: Promise.<void>
- A Promise which resolves on success and rejects on failure.
Param | Type | Description |
---|---|---|
server | string |
The name of the Octyne server where the file/folder needs to be renamed. |
oldpath | string |
The path where the current file/folder is located. |
newname | string |
The new name of the file/folder. |
Deletes a file/folder in an Octyne server process directory.
Kind: instance method of Client
Returns: Promise.<void>
- A Promise which resolves on success and rejects on failure.
Param | Type | Description |
---|---|---|
server | string |
The name of the Octyne server where the file/folder needs to be deleted. |
path | string |
Path to the file/folder which needs to be created. |
Gets info on an Octyne server process. The Object returned is: { status, cpuUsage, memoryUsage, totalMemory, uptime, serverVersion } where only serverVersion is a string.
Kind: instance method of Client
Returns: Promise.<Object>
- A Promise containing an Octyne server process object.
Param | Type | Description |
---|---|---|
server | string |
The name of the Octyne server process. |
Make a manual request to an Octyne endpoint.
Kind: instance method of Client
Returns: Promise.<Object>
- A Promise containing the JSON response.
Param | Type | Description |
---|---|---|
endpoint | string |
The Octyne endpoint to make a request to. |
options | Object |
The options to pass to the fetch function. |
OctyneApi(url, info) ⇒ Client
A function to initialise an Octyne API {Client}. Requires either a username/password pair or a token.
Kind: global function
Returns: Client
- Returns an Octyne API {Client}.
Param | Type | Description |
---|---|---|
url | String |
The URL to the Octyne instance. |
info | Object |
An object containing either a username/password pair or an Octyne token. |
[info.username] | String |
A string containing the username to log into Octyne with. |
[info.password] | String |
A string containing the password to log into Octyne with. |
[info.token] | String |
A string containing the token to authenticate to Octyne with. |