README
Verys Scout SDK
Browser and node module for making API requests against Verys Scout SDK.
Please note: This module uses Popsicle to make API requests. Promises must be supported or polyfilled on all target environments.
Installation
npm install verys-scout-sdk --save
bower install verys-scout-sdk --save
Usage
Node
var VerysScoutSdk = require('verys-scout-sdk');
var client = new VerysScoutSdk();
Browsers
<script src="verys-scout-sdk/index.js"></script>
<script>
var client = new VerysScoutSdk();
</script>
Options
You can set options when you initialize a client or at any time with the options
property. You may also override options for a single request by passing an object as the second argument of any request method. For example:
var client = new VerysScoutSdk({ ... });
client.options = { ... };
client.resource('/').get(null, {
baseUri: 'http://example.com',
headers: {
'Content-Type': 'application/json'
}
});
Base URI
You can override the base URI by setting the baseUri
property, or initializing a client with a base URI. For example:
new VerysScoutSdk({
baseUri: 'https://example.com'
});
Base URI Parameters
If the base URI has parameters inline, you can set them by updating the baseUriParameters
property. For example:
client.options.baseUriParameters.version = 'v1';
Resources
All methods return a HTTP request instance of Popsicle, which allows the use of promises (and streaming in node).
resources.clients
var resource = client.resources.clients;
GET
Fetch all clients
resource.get().then(function (res) { ... });
POST
Create a new client
resource.post().then(function (res) { ... });
resources.clients.id(Client ID)
- Client ID integer
var resource = client.resources.clients.id(Client ID);
GET
Fetch a specific client
resource.get().then(function (res) { ... });
PUT
Update a specific client
resource.put().then(function (res) { ... });
DELETE
Delete a specific client
resource.delete().then(function (res) { ... });
resources.clients.id(Client ID).projects
var resource = client.resources.clients.id(Client ID).projects;
GET
Fetch all projects for a specific client
resource.get().then(function (res) { ... });
resources.projects
var resource = client.resources.projects;
GET
Fetch all projects
resource.get().then(function (res) { ... });
POST
Create a new project
resource.post().then(function (res) { ... });
resources.projects.id(Project ID)
- Project ID integer
var resource = client.resources.projects.id(Project ID);
GET
Fetch a specific project
resource.get().then(function (res) { ... });
PUT
Update a specific project
resource.put().then(function (res) { ... });
DELETE
Delete a specific project
resource.delete().then(function (res) { ... });
resources.projects.id(Project ID).versions
var resource = client.resources.projects.id(Project ID).versions;
GET
Fetch all versions for a specific project
resource.get().then(function (res) { ... });
resources.versions
var resource = client.resources.versions;
GET
Fetch all versions
resource.get().then(function (res) { ... });
POST
Create a new version
resource.post().then(function (res) { ... });
resources.versions.id(Version ID)
- Version ID integer
var resource = client.resources.versions.id(Version ID);
GET
Fetch a specific version
resource.get().then(function (res) { ... });
PUT
Update a specific version
resource.put().then(function (res) { ... });
DELETE
Delete a specific version
resource.delete().then(function (res) { ... });
resources.versions.id(Version ID).phases
var resource = client.resources.versions.id(Version ID).phases;
GET
Fetch all phases for a specific version
resource.get().then(function (res) { ... });
resources.phases
var resource = client.resources.phases;
GET
Fetch all phases
resource.get().then(function (res) { ... });
POST
Create a new phase
resource.post().then(function (res) { ... });
resources.phases.id(Phase ID)
- Phase ID integer
var resource = client.resources.phases.id(Phase ID);
GET
Fetch a specific phase
resource.get().then(function (res) { ... });
PUT
Update a specific phase
resource.put().then(function (res) { ... });
DELETE
Delete a specific phase
resource.delete().then(function (res) { ... });
resources.phases.id(Phase ID).tasks
var resource = client.resources.phases.id(Phase ID).tasks;
GET
Fetch all tasks for a specific phase
resource.get().then(function (res) { ... });
resources.tasks
var resource = client.resources.tasks;
GET
Fetch all tasks
resource.get().then(function (res) { ... });
POST
Create a new task
resource.post().then(function (res) { ... });
resources.tasks.id(Task ID)
- Task ID integer
var resource = client.resources.tasks.id(Task ID);
GET
Fetch a specific task
resource.get().then(function (res) { ... });
PUT
Update a specific task
resource.put().then(function (res) { ... });
DELETE
Delete a specific task
resource.delete().then(function (res) { ... });
resources.sizes
var resource = client.resources.sizes;
GET
Fetch all sizes
resource.get().then(function (res) { ... });
POST
Create a new size
resource.post().then(function (res) { ... });
resources.sizes.id(Size ID)
- Size ID integer
var resource = client.resources.sizes.id(Size ID);
GET
Fetch a specific size
resource.get().then(function (res) { ... });
PUT
Update a specific size
resource.put().then(function (res) { ... });
DELETE
Delete a specific size
resource.delete().then(function (res) { ... });
resources.estimates
var resource = client.resources.estimates;
GET
Fetch all estimates
resource.get().then(function (res) { ... });
POST
Create a new estimate
resource.post().then(function (res) { ... });
resources.estimates.id(Estimate ID)
- Estimate ID integer
var resource = client.resources.estimates.id(Estimate ID);
GET
Fetch a specific estimate
resource.get().then(function (res) { ... });
PUT
Update a specific estimate
resource.put().then(function (res) { ... });
DELETE
Delete a specific estimate
resource.delete().then(function (res) { ... });
Custom Resources
You can make requests to a custom path in the API using the #resource(path)
method.
client.resource('/example/path').get();
License
Apache 2.0