dailys-js v0.2.12
Dailys JS
The official javascript library for dailys application.
Installation
Use either NPM or Yarn to install this library.
NPM
npm install -s dailys-jsYarn
yarn add dailys-jsUsage
To get started with the library, you will need to import and instantiate dailys-js.
// Import the library.
import Dailys from 'dailys-js';
// Define the baseURI and the authorisation token.
let baseURI = 'https://dailys.nz/api/v1';
let authorizationToken = '...';
// Create the new instance.
let dailys = new Dailys(baseURI, authorizationToken);
// Make api calls.Reference
Below is a reference of all of the methods within the library.
Restful Resources
These resources have common REST methods:
get([params])- index the resource.params (optional)- an object of key-value query params.
fetch(index, [params])- get the resource with the specified index.index- the index of the resource (i.e., its ID).params (optional)- an object of key-value query params.
store(data, [params])- store a resource with the given data.data- an object representing the resource.params (optional)- an object of key-value query params.
update(index, data, [params])- store a resource with the given data.index- the index of the resource (i.e., its ID).data- an object representing the resource.params (optional)- an object of key-value query params.
destroy(index, [params])- destroy the resource with the specified index.index- the index of the resource (i.e., its ID).params (optional)- an object of key-value query params.
These can be accessed using Dailys.resource.get, for example.
Some of these resources also have convenience methods to get related resources,
for example Dailys.categories.charges(11) will get all of the charges for category 11.
The resources with these methods are:
expensescategories, related:charges,taskscharges, related:categoriesclients, related:invoices,projectsinvites, related:resend(this simply hits the resend route of the invite)tasks, related:categoriesroles
Single Resources
Single Resources are a special type, as there is only ever one of them for the currently authenticated user.
These are the user and organisation route.
These resources only have the fetch and update methods as above.
Special Resources
There are a few resources in Dailys that aren't strictly Restful, and as such there are extra routes for them.
Projects
Projects has the standard Restful resources plus the following:
project.categories(index, [params])- get the categories for the projectproject.charges(index, [params])- get the charges for the projectproject.invoices(index, [params])- get the invoices for the projectproject.tasks(index, [params])- get the tasks for the projectproject.total(index, [params])- get the total cost for the projectproject.status(index, data, [params])- update the status for the projectdata.status: the status for the project -complete,incomplete, orinvoiced
project.times.get(index, [params])- get all the times for a projectproject.times.summary(index, [params])- get a summary of the project's timesproject.users.get(index, [params])- get the users for a projectproject.users.expenses(index, user, [params])- get the expenses for the specified user for the specified projectproject.users.times(index, user, [params])- get the times for the specified user for the specified projectproject.users.tasks.times(index, user, task, [params])- get the times for the specified user for the specified project for the specified task
Users
Users has the standard Restful resources plus the following:
users.times.get(index, [params])- get the times for the specified userusers.times.overview(index, [params])- get the times overview for the specified userusers.times.fetch(index, time, [params])- get the specified time for the specified userusers.expenses(index, [params])- get the expenses for the specified userusers.projects(index, [params])- get the projects for the specified user
Invoices
Projects has the standard Restful resources plus the following:
invoices.status(index, status, [params])- update the status for the invoicestatus: the status for the project -finalordraft
Times
Times has the standard Restful resources plus the following:
times.overview([params])- get the times overview for the current user
Permissions
Permissions only has the following:
permissions.get([params])- get the permissionspermissions.fetch(index, [params])- fetch the specified permission
Building
yarn installornpm installnpm run build
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago