
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@app-masters/hubstaff-node-client
Advanced tools
Simple library to access hubstaff API V2, developed by App Masters.
References: Hubstaff developer portal
yarn add @app-masters/hubstaff-node-client
or
npm i @app-masters/hubstaff-node-client
Before starting to use the methods, we need to send some parameters to the Hubstaff instance.
The first parameter is an object containing the accessToken
and the refreshToken
. (Click here to see how to get them).
The second is a callback function that will be called every time the access token is refreshed.
Tip: this function receives two parameters, accessToken
and the refreshToken
, you may consider saving these tokens into some database.
import Hubstaff from '@app-masters/hubstaff-node-client';
const refreshTokenCallback = (accessToken, refreshToken) => {
console.log("A new token has received");
console.log("access token", accessToken);
console.log("refresh token", refreshToken);
};
const hubstaff = new Hubstaff({ accessToken: "your-access-token", refreshToken: "your-refresh-token" }, refreshTokenCallback);
//...
Simple exemple:
//...
// Get organizations
const orgs = hubstaff.getOrganizations();
console.log(orgs);
/* Output:
[
{
id: 55426,
name: 'App Masters',
status: 'active',
created_at: '2017-06-05T12:21:08.432670Z',
updated_at: '2020-12-07T17:00:04.712558Z',
metadata: {},
invite_url: 'https://app.hubstaff.com/organizations/invite/exfImdk6Skl213g'
}
]
*/
// Get projects
const projects = hubstaff.getProjects(orgs[0].id);
console.log(projects); // Output: Project[]
// Get tasks
const tasks = hubstaff.getTasks(orgs[0].id);
console.log(tasks); // Output: Task[]
// Get activities
const activities = hubstaff.getActivities(orgs[0].id);
console.log(activities); // Output: Activity[]
refresh_token
that will be generated.import Hubstaff from '@app-masters/hubstaff-node-client';
const tokenObj = Hubstaff.getAccessToken('your-refresh-token');
console.log(tokenObj.accessToken); // Output: 'your-access-token'
console.log(tokenObj.refreshToken); // Output: 'your-refresh-token'
variables.examples.ts
file and create a new file variables.ts
inside folder __tests__
.accessToken
variable that is already declared.accessToken: 'your-access-token',
refreshToken: '', // you can leave it blank (only for test)
yarn run test
# or
npm run test
We focused just on some endpoints we need to use, but is really simple to add any other.
Feel free to contribute, start by opening a issue please.
FAQs
Simple library to access hubstaff API.
The npm package @app-masters/hubstaff-node-client receives a total of 0 weekly downloads. As such, @app-masters/hubstaff-node-client popularity was classified as not popular.
We found that @app-masters/hubstaff-node-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.