Projects
Projects ⇐ APIClient
Use Fonoster Projects, a capability of Fonoster, to create, update, get and delete Projects. Projects requires of a running Fonoster deployment.
Kind: global class
Extends: APIClient
See: module:core:APIClient
- Projects ⇐
APIClient
- new Projects(options)
- .listProjects(request) ⇒
Promise.<ListProjectsResponse>
- .createProject(request) ⇒
Promise.<CreateProjectResponse>
- .getProject(ref) ⇒
Promise.<GetProjectResponse>
- .updateProject(request) ⇒
Promise.<UpdateProjectResponse>
- .deleteProject(ref)
- .renewAccessKeySecret(request)
new Projects(options)
Constructs a new Projects object.
Param | Type | Description |
---|---|---|
options | ClientOptions | Options to indicate the objects endpoint |
Example
const Fonoster = require("@fonoster/sdk")
const Projects = new Fonoster.Projects()
const request = {
name: "project002",
allowExperiments: false
}
projects.createProject(request)
.then(result => {
console.log(result) // successful response
}).catch(e => console.error(e)) // an error occurred
projects.listProjects(request) ⇒ Promise.<ListProjectsResponse>
Returns a list of Projects
Kind: instance method of Projects
Param | Type | Description |
---|---|---|
request | ListProjectsRequest | Reserved for future filters |
Example
projects.listProjects({})
.then(result => {
console.log(result) // successful response
}).catch(e => console.error(e)) // an error occurred
projects.createProject(request) ⇒ Promise.<CreateProjectResponse>
Creates a new Project.
Kind: instance method of Projects
Param | Type | Description |
---|---|---|
request | CreateProjectRequest | Request to create a new Project |
request.name | string | Project's name |
request.allowExperiments | string | Enables experimental APIs |
Example
const request = {
name: "project001",
allowExperiments: true
}
projects.createProject(request)
.then(result => {
console.log(result) // successful response
}).catch(e => console.error(e)) // an error occurred
projects.getProject(ref) ⇒ Promise.<GetProjectResponse>
Get a Project by reference.
Kind: instance method of Projects
Returns: Promise.<GetProjectResponse>
- The Project
Throws:
- if ref is null or Project does not exist
Param | Type | Description |
---|---|---|
ref | string | Reference to Project |
Example
const ref = "507f1f77bcf86cd799439011";
projects.getProject(ref)
.then(result => {
console.log(result) // returns the Project payload
}).catch(e => console.error(e)) // an error occurred
projects.updateProject(request) ⇒ Promise.<UpdateProjectResponse>
Update a Project.
Kind: instance method of Projects
Param | Type | Description |
---|---|---|
request | UpdateProjectRequest | Request update of an Project |
request.ref | string | Required reference to the Project |
request.name | string | Value to rename the application to |
request.allowExperiments | string | Enables experimental APIs |
Example
const request = {
name: "project001",
ref: "507f1f77bcf86cd799439011"
}
projects.updateProject(request)
.then(result => {
console.log(result) // returns the UpdateProjectResponse payload
}).catch(e => console.error(e)) // an error occurred
projects.deleteProject(ref)
Delete a Project.
Kind: instance method of Projects
Param | Type | Description |
---|---|---|
ref | string | Project's reference |
Example
const ref = "507f1f77bcf86cd799439011"
projects.deleteProject(ref)
.then(() => {
console.log("done") // returns a reference of the Project
}).catch(e => console.error(e)) // an error occurred
projects.renewAccessKeySecret(request)
Generate a new accessKeySecret. Be sure to update your applications with the new value.
Kind: instance method of Projects
Param | Type | Description |
---|---|---|
request | LoginRequest | Request update of an Project |
request.ref | string | Project's reference |
Example
const request = {
ref: "507f1f77bcf86cd799439011"
}
projects.renewAccessKeySecret(request)
.then(result => {
console.log(result) // returns the new accessKeySecret
}).catch(e => console.error(e)) // an error occurred