UNPKG

harrogateclient

Version:

A simple node.js client for Kipr Harrogate on their Wallaby's.

494 lines (344 loc) 17.7 kB
## Classes <dl> <dt><a href="#User">User</a></dt> <dd></dd> <dt><a href="#Project">Project</a></dt> <dd></dd> <dt><a href="#ProjectInfo">ProjectInfo</a></dt> <dd></dd> <dt><a href="#File">File</a></dt> <dd></dd> <dt><a href="#HarrogateClient">HarrogateClient</a></dt> <dd></dd> </dl> <a name="User"></a> ## User **Kind**: global class * [User](#User) * [new User(name, del, getProjects, addProject, deleteProject)](#new_User_new) * [.name](#User+name) : <code>string</code> * [.delete()](#User+delete) ⇒ <code>Promise.&lt;void, error&gt;</code> * [.getProjects()](#User+getProjects) ⇒ <code>Promise.&lt;Array.&lt;Project&gt;, error&gt;</code> * [.addProject(projectname)](#User+addProject) ⇒ <code>Promise.&lt;Project, error&gt;</code> * [.deleteProject(projectname)](#User+deleteProject) ⇒ <code>Promise.&lt;void, error&gt;</code> <a name="new_User_new"></a> ### new User(name, del, getProjects, addProject, deleteProject) Creates an User object. | Param | Type | Description | | --- | --- | --- | | name | <code>string</code> | name of the user | | del | <code>function</code> | function to delete the user | | getProjects | <code>function</code> | function to get the projects of the user | | addProject | <code>function</code> | function to add a project | | deleteProject | <code>function</code> | function to delete a project | <a name="User+name"></a> ### user.name : <code>string</code> name of the User **Kind**: instance property of [<code>User</code>](#User) <a name="User+delete"></a> ### user.delete() ⇒ <code>Promise.&lt;void, error&gt;</code> Deletes the user. **Kind**: instance method of [<code>User</code>](#User) <a name="User+getProjects"></a> ### user.getProjects() ⇒ <code>Promise.&lt;Array.&lt;Project&gt;, error&gt;</code> Get the projects of the user. **Kind**: instance method of [<code>User</code>](#User) <a name="User+addProject"></a> ### user.addProject(projectname) ⇒ <code>Promise.&lt;Project, error&gt;</code> Adds a project. **Kind**: instance method of [<code>User</code>](#User) | Param | Type | Description | | --- | --- | --- | | projectname | <code>string</code> | name of the new project | <a name="User+deleteProject"></a> ### user.deleteProject(projectname) ⇒ <code>Promise.&lt;void, error&gt;</code> Deletes a project. **Kind**: instance method of [<code>User</code>](#User) | Param | Type | Description | | --- | --- | --- | | projectname | <code>string</code> | name of the project | <a name="Project"></a> ## Project **Kind**: global class * [Project](#Project) * [new Project(name, user, del, compile, getInformation)](#new_Project_new) * [.name](#Project+name) : <code>string</code> * [.user](#Project+user) : <code>string</code> * [.delete()](#Project+delete) ⇒ <code>Promise.&lt;void, error&gt;</code> * [.compile()](#Project+compile) ⇒ <code>Promise.&lt;{stdout: string, stderr: string}, error&gt;</code> * [.getInformation()](#Project+getInformation) ⇒ <code>Promise.&lt;ProjectInfo, error&gt;</code> <a name="new_Project_new"></a> ### new Project(name, user, del, compile, getInformation) Creates a Project object. | Param | Type | Description | | --- | --- | --- | | name | <code>string</code> | name of the project | | user | <code>string</code> | owner of the project | | del | <code>function</code> | function to delete the project | | compile | <code>function</code> | function to compile the project | | getInformation | <code>function</code> | function to get project information | <a name="Project+name"></a> ### project.name : <code>string</code> name of the project **Kind**: instance property of [<code>Project</code>](#Project) <a name="Project+user"></a> ### project.user : <code>string</code> owner of the project **Kind**: instance property of [<code>Project</code>](#Project) <a name="Project+delete"></a> ### project.delete() ⇒ <code>Promise.&lt;void, error&gt;</code> Deletes the project. **Kind**: instance method of [<code>Project</code>](#Project) <a name="Project+compile"></a> ### project.compile() ⇒ <code>Promise.&lt;{stdout: string, stderr: string}, error&gt;</code> Compiles the project. **Kind**: instance method of [<code>Project</code>](#Project) <a name="Project+getInformation"></a> ### project.getInformation() ⇒ <code>Promise.&lt;ProjectInfo, error&gt;</code> Gets information about the project. **Kind**: instance method of [<code>Project</code>](#Project) <a name="ProjectInfo"></a> ## ProjectInfo **Kind**: global class * [ProjectInfo](#ProjectInfo) * [new ProjectInfo(include, source, data, addFile)](#new_ProjectInfo_new) * [.include](#ProjectInfo+include) : [<code>Array.&lt;File&gt;</code>](#File) * [.source](#ProjectInfo+source) : [<code>Array.&lt;File&gt;</code>](#File) * [.data](#ProjectInfo+data) : [<code>Array.&lt;File&gt;</code>](#File) * [.addFile(dir, name)](#ProjectInfo+addFile) ⇒ <code>Promise.&lt;File, error&gt;</code> <a name="new_ProjectInfo_new"></a> ### new ProjectInfo(include, source, data, addFile) Creates a ProjectInfo object. | Param | Type | Description | | --- | --- | --- | | include | [<code>Array.&lt;File&gt;</code>](#File) | array of include files | | source | [<code>Array.&lt;File&gt;</code>](#File) | array of source files | | data | [<code>Array.&lt;File&gt;</code>](#File) | array of data files | | addFile | <code>function</code> | function to add a file | <a name="ProjectInfo+include"></a> ### projectInfo.include : [<code>Array.&lt;File&gt;</code>](#File) array of include files **Kind**: instance property of [<code>ProjectInfo</code>](#ProjectInfo) <a name="ProjectInfo+source"></a> ### projectInfo.source : [<code>Array.&lt;File&gt;</code>](#File) Array of source files **Kind**: instance property of [<code>ProjectInfo</code>](#ProjectInfo) <a name="ProjectInfo+data"></a> ### projectInfo.data : [<code>Array.&lt;File&gt;</code>](#File) Array of data files **Kind**: instance property of [<code>ProjectInfo</code>](#ProjectInfo) <a name="ProjectInfo+addFile"></a> ### projectInfo.addFile(dir, name) ⇒ <code>Promise.&lt;File, error&gt;</code> Adds a file to the project. **Kind**: instance method of [<code>ProjectInfo</code>](#ProjectInfo) | Param | Type | Description | | --- | --- | --- | | dir | <code>string</code> | name of the directory | | name | <code>string</code> | name of the file | <a name="File"></a> ## File **Kind**: global class * [File](#File) * [new File(name, path, load, del, save)](#new_File_new) * [.name](#File+name) : <code>string</code> * [.path](#File+path) : <code>string</code> * [.load()](#File+load) ⇒ <code>Promise.&lt;string, error&gt;</code> * [.delete()](#File+delete) ⇒ <code>Promise.&lt;void, error&gt;</code> * [.save(content)](#File+save) ⇒ <code>Promise.&lt;void, error&gt;</code> <a name="new_File_new"></a> ### new File(name, path, load, del, save) Creates a File object. | Param | Type | Description | | --- | --- | --- | | name | <code>string</code> | name of the file | | path | <code>string</code> | path to the file | | load | <code>function</code> | function to load the file | | del | <code>function</code> | function to delete the file | | save | <code>function</code> | function to save new content to the file | <a name="File+name"></a> ### file.name : <code>string</code> name of the file **Kind**: instance property of [<code>File</code>](#File) <a name="File+path"></a> ### file.path : <code>string</code> path of the file **Kind**: instance property of [<code>File</code>](#File) <a name="File+load"></a> ### file.load() ⇒ <code>Promise.&lt;string, error&gt;</code> Loads the content of the File. **Kind**: instance method of [<code>File</code>](#File) <a name="File+delete"></a> ### file.delete() ⇒ <code>Promise.&lt;void, error&gt;</code> Deletes the file. **Kind**: instance method of [<code>File</code>](#File) <a name="File+save"></a> ### file.save(content) ⇒ <code>Promise.&lt;void, error&gt;</code> Saves content to the file. **Kind**: instance method of [<code>File</code>](#File) | Param | Type | Description | | --- | --- | --- | | content | <code>string</code> | new content | <a name="HarrogateClient"></a> ## HarrogateClient **Kind**: global class * [HarrogateClient](#HarrogateClient) * [new HarrogateClient(ip)](#new_HarrogateClient_new) * [.url](#HarrogateClient+url) : <code>string</code> * [.getUsers()](#HarrogateClient+getUsers) ⇒ <code>Promise.&lt;Array.&lt;User&gt;, error&gt;</code> * [.addUser(username)](#HarrogateClient+addUser) ⇒ <code>Promise.&lt;User, error&gt;</code> * [.deleteUser(username)](#HarrogateClient+deleteUser) ⇒ <code>Promise.&lt;void, error&gt;</code> * [.allProjects()](#HarrogateClient+allProjects) ⇒ <code>Promise.&lt;Array.&lt;Project&gt;, error&gt;</code> * [.getProjects(username)](#HarrogateClient+getProjects) ⇒ <code>Promise.&lt;Array.&lt;Project&gt;, error&gt;</code> * [.addProject(username, projectname)](#HarrogateClient+addProject) ⇒ <code>Promise.&lt;Project, error&gt;</code> * [.deleteProject(username, projectname)](#HarrogateClient+deleteProject) ⇒ <code>Promise.&lt;void, error&gt;</code> * [.compile(username, projectname)](#HarrogateClient+compile) ⇒ <code>Promise.&lt;{stdout: string, stderr: string}, error&gt;</code> * [.getProjectInformation(username, project)](#HarrogateClient+getProjectInformation) ⇒ <code>Promise.&lt;ProjectInfo, error&gt;</code> * [.loadFile(username, project, dir, name)](#HarrogateClient+loadFile) ⇒ <code>Promise.&lt;string, error&gt;</code> * [.loadFilePath(filepath)](#HarrogateClient+loadFilePath) ⇒ <code>Promise.&lt;string, error&gt;</code> * [.addFile(username, project, dir, name)](#HarrogateClient+addFile) ⇒ <code>Promise.&lt;File, error&gt;</code> * [.addFilePath(filepath)](#HarrogateClient+addFilePath) ⇒ <code>Promise.&lt;File, error&gt;</code> * [.deleteFile(username, project, dir, name)](#HarrogateClient+deleteFile) ⇒ <code>Promise.&lt;void, error&gt;</code> * [.deleteFilePath(filepath)](#HarrogateClient+deleteFilePath) ⇒ <code>Promise.&lt;void, error&gt;</code> * [.saveFile(username, project, dir, name, content)](#HarrogateClient+saveFile) ⇒ <code>Promise.&lt;void, error&gt;</code> * [.saveFilePath(filepath, content)](#HarrogateClient+saveFilePath) ⇒ <code>Promise.&lt;void, error&gt;</code> <a name="new_HarrogateClient_new"></a> ### new HarrogateClient(ip) Creates a HarrogateClient object | Param | Type | Description | | --- | --- | --- | | ip | <code>string</code> | The ip adress/url of the Harrogate Server | <a name="HarrogateClient+url"></a> ### harrogateClient.url : <code>string</code> url of the Harrogate Server **Kind**: instance property of [<code>HarrogateClient</code>](#HarrogateClient) <a name="HarrogateClient+getUsers"></a> ### harrogateClient.getUsers() ⇒ <code>Promise.&lt;Array.&lt;User&gt;, error&gt;</code> Gets an array of all users. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) <a name="HarrogateClient+addUser"></a> ### harrogateClient.addUser(username) ⇒ <code>Promise.&lt;User, error&gt;</code> Adds a new Uuer. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | username | <code>string</code> | name of the user | <a name="HarrogateClient+deleteUser"></a> ### harrogateClient.deleteUser(username) ⇒ <code>Promise.&lt;void, error&gt;</code> Deletes an user. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | username | <code>string</code> | name of the user | <a name="HarrogateClient+allProjects"></a> ### harrogateClient.allProjects() ⇒ <code>Promise.&lt;Array.&lt;Project&gt;, error&gt;</code> Gets the projects of all users. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) <a name="HarrogateClient+getProjects"></a> ### harrogateClient.getProjects(username) ⇒ <code>Promise.&lt;Array.&lt;Project&gt;, error&gt;</code> Gets the projects of a specific user. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | username | <code>string</code> | name of the user | <a name="HarrogateClient+addProject"></a> ### harrogateClient.addProject(username, projectname) ⇒ <code>Promise.&lt;Project, error&gt;</code> Adds a project. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | username | <code>string</code> | name of the user | | projectname | <code>string</code> | name of the new project | <a name="HarrogateClient+deleteProject"></a> ### harrogateClient.deleteProject(username, projectname) ⇒ <code>Promise.&lt;void, error&gt;</code> Deletes a project. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | username | <code>string</code> | name of the user | | projectname | <code>string</code> | name of the project | <a name="HarrogateClient+compile"></a> ### harrogateClient.compile(username, projectname) ⇒ <code>Promise.&lt;{stdout: string, stderr: string}, error&gt;</code> Compiles a project. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | username | <code>string</code> | name of the user | | projectname | <code>string</code> | name of the project | <a name="HarrogateClient+getProjectInformation"></a> ### harrogateClient.getProjectInformation(username, project) ⇒ <code>Promise.&lt;ProjectInfo, error&gt;</code> Gets information of a project. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | username | <code>string</code> | name of the user | | project | <code>string</code> | name of the project | <a name="HarrogateClient+loadFile"></a> ### harrogateClient.loadFile(username, project, dir, name) ⇒ <code>Promise.&lt;string, error&gt;</code> Loads the content of a file. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | username | <code>string</code> | name of the user | | project | <code>string</code> | name of the project | | dir | <code>string</code> | name of the directory | | name | <code>string</code> | name of the file | <a name="HarrogateClient+loadFilePath"></a> ### harrogateClient.loadFilePath(filepath) ⇒ <code>Promise.&lt;string, error&gt;</code> Loads the content of a file. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | filepath | <code>string</code> | path of the file | <a name="HarrogateClient+addFile"></a> ### harrogateClient.addFile(username, project, dir, name) ⇒ <code>Promise.&lt;File, error&gt;</code> Adds a file. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | username | <code>string</code> | name of the user | | project | <code>string</code> | name of the project | | dir | <code>string</code> | name of the directory | | name | <code>string</code> | name of the file | <a name="HarrogateClient+addFilePath"></a> ### harrogateClient.addFilePath(filepath) ⇒ <code>Promise.&lt;File, error&gt;</code> Adds a file. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | filepath | <code>string</code> | path of the file | <a name="HarrogateClient+deleteFile"></a> ### harrogateClient.deleteFile(username, project, dir, name) ⇒ <code>Promise.&lt;void, error&gt;</code> Deletes a file. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | username | <code>string</code> | name of the user | | project | <code>string</code> | name of the project | | dir | <code>string</code> | name of the directory | | name | <code>string</code> | name of the file | <a name="HarrogateClient+deleteFilePath"></a> ### harrogateClient.deleteFilePath(filepath) ⇒ <code>Promise.&lt;void, error&gt;</code> Deletes a file. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | filepath | <code>string</code> | path of the file | <a name="HarrogateClient+saveFile"></a> ### harrogateClient.saveFile(username, project, dir, name, content) ⇒ <code>Promise.&lt;void, error&gt;</code> Saves a file. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | username | <code>string</code> | name of the user | | project | <code>string</code> | name of the project | | dir | <code>string</code> | name of the directory | | name | <code>string</code> | name of the file | | content | <code>string</code> | contant to save | <a name="HarrogateClient+saveFilePath"></a> ### harrogateClient.saveFilePath(filepath, content) ⇒ <code>Promise.&lt;void, error&gt;</code> Saves a file. **Kind**: instance method of [<code>HarrogateClient</code>](#HarrogateClient) | Param | Type | Description | | --- | --- | --- | | filepath | <code>string</code> | path of the file | | content | <code>string</code> | contant to save |