harrogateclient
Version:
A simple node.js client for Kipr Harrogate on their Wallaby's.
494 lines (344 loc) • 17.7 kB
Markdown
## 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.<void, error></code>
* [.getProjects()](#User+getProjects) ⇒ <code>Promise.<Array.<Project>, error></code>
* [.addProject(projectname)](#User+addProject) ⇒ <code>Promise.<Project, error></code>
* [.deleteProject(projectname)](#User+deleteProject) ⇒ <code>Promise.<void, error></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.<void, error></code>
Deletes the user.
**Kind**: instance method of [<code>User</code>](#User)
<a name="User+getProjects"></a>
### user.getProjects() ⇒ <code>Promise.<Array.<Project>, error></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.<Project, error></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.<void, error></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.<void, error></code>
* [.compile()](#Project+compile) ⇒ <code>Promise.<{stdout: string, stderr: string}, error></code>
* [.getInformation()](#Project+getInformation) ⇒ <code>Promise.<ProjectInfo, error></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.<void, error></code>
Deletes the project.
**Kind**: instance method of [<code>Project</code>](#Project)
<a name="Project+compile"></a>
### project.compile() ⇒ <code>Promise.<{stdout: string, stderr: string}, error></code>
Compiles the project.
**Kind**: instance method of [<code>Project</code>](#Project)
<a name="Project+getInformation"></a>
### project.getInformation() ⇒ <code>Promise.<ProjectInfo, error></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.<File></code>](#File)
* [.source](#ProjectInfo+source) : [<code>Array.<File></code>](#File)
* [.data](#ProjectInfo+data) : [<code>Array.<File></code>](#File)
* [.addFile(dir, name)](#ProjectInfo+addFile) ⇒ <code>Promise.<File, error></code>
<a name="new_ProjectInfo_new"></a>
### new ProjectInfo(include, source, data, addFile)
Creates a ProjectInfo object.
| Param | Type | Description |
| --- | --- | --- |
| include | [<code>Array.<File></code>](#File) | array of include files |
| source | [<code>Array.<File></code>](#File) | array of source files |
| data | [<code>Array.<File></code>](#File) | array of data files |
| addFile | <code>function</code> | function to add a file |
<a name="ProjectInfo+include"></a>
### projectInfo.include : [<code>Array.<File></code>](#File)
array of include files
**Kind**: instance property of [<code>ProjectInfo</code>](#ProjectInfo)
<a name="ProjectInfo+source"></a>
### projectInfo.source : [<code>Array.<File></code>](#File)
Array of source files
**Kind**: instance property of [<code>ProjectInfo</code>](#ProjectInfo)
<a name="ProjectInfo+data"></a>
### projectInfo.data : [<code>Array.<File></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.<File, error></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.<string, error></code>
* [.delete()](#File+delete) ⇒ <code>Promise.<void, error></code>
* [.save(content)](#File+save) ⇒ <code>Promise.<void, error></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.<string, error></code>
Loads the content of the File.
**Kind**: instance method of [<code>File</code>](#File)
<a name="File+delete"></a>
### file.delete() ⇒ <code>Promise.<void, error></code>
Deletes the file.
**Kind**: instance method of [<code>File</code>](#File)
<a name="File+save"></a>
### file.save(content) ⇒ <code>Promise.<void, error></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.<Array.<User>, error></code>
* [.addUser(username)](#HarrogateClient+addUser) ⇒ <code>Promise.<User, error></code>
* [.deleteUser(username)](#HarrogateClient+deleteUser) ⇒ <code>Promise.<void, error></code>
* [.allProjects()](#HarrogateClient+allProjects) ⇒ <code>Promise.<Array.<Project>, error></code>
* [.getProjects(username)](#HarrogateClient+getProjects) ⇒ <code>Promise.<Array.<Project>, error></code>
* [.addProject(username, projectname)](#HarrogateClient+addProject) ⇒ <code>Promise.<Project, error></code>
* [.deleteProject(username, projectname)](#HarrogateClient+deleteProject) ⇒ <code>Promise.<void, error></code>
* [.compile(username, projectname)](#HarrogateClient+compile) ⇒ <code>Promise.<{stdout: string, stderr: string}, error></code>
* [.getProjectInformation(username, project)](#HarrogateClient+getProjectInformation) ⇒ <code>Promise.<ProjectInfo, error></code>
* [.loadFile(username, project, dir, name)](#HarrogateClient+loadFile) ⇒ <code>Promise.<string, error></code>
* [.loadFilePath(filepath)](#HarrogateClient+loadFilePath) ⇒ <code>Promise.<string, error></code>
* [.addFile(username, project, dir, name)](#HarrogateClient+addFile) ⇒ <code>Promise.<File, error></code>
* [.addFilePath(filepath)](#HarrogateClient+addFilePath) ⇒ <code>Promise.<File, error></code>
* [.deleteFile(username, project, dir, name)](#HarrogateClient+deleteFile) ⇒ <code>Promise.<void, error></code>
* [.deleteFilePath(filepath)](#HarrogateClient+deleteFilePath) ⇒ <code>Promise.<void, error></code>
* [.saveFile(username, project, dir, name, content)](#HarrogateClient+saveFile) ⇒ <code>Promise.<void, error></code>
* [.saveFilePath(filepath, content)](#HarrogateClient+saveFilePath) ⇒ <code>Promise.<void, error></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.<Array.<User>, error></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.<User, error></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.<void, error></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.<Array.<Project>, error></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.<Array.<Project>, error></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.<Project, error></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.<void, error></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.<{stdout: string, stderr: string}, error></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.<ProjectInfo, error></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.<string, error></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.<string, error></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.<File, error></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.<File, error></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.<void, error></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.<void, error></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.<void, error></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.<void, error></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 |