Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
ynab
Advanced tools
Readme
NOTE: The YNAB API is currently only available to Early Access users. If you are interested in requesting access before the API is generally available, please fill out this form.
The YNAB API JavaScript library provides access to the YNAB API from applications written in Node.js / JavaScript.
Please read the YNAB API documentation for an overview of using the API and a complete list of the available resources.
npm install ynab
To use this client, you must obtain an access token from the My Account area of the YNAB web application.
const ynabApi = require("ynab");
const accessToken = "b43439eaafe2_this_is_fake_b43439eaafe2";
const ynab = new ynabApi(accessToken);
async function listBudgets(){
const budgetsResponse = await ynab.budgets.getBudgets();
const budgets = budgetsResponse.data.budgets;
for(let budget of budgets) {
console.log(`Budget Name: ${budget.name}`);
}
}
listBudgets();
If a response is returned with a code >= 300, instead of returning the response, the response will be "thrown" as an error to be caught.
const ynabApi = require("ynab-sdk-js");
const accessToken = "invalid_token";
const ynab = new ynabApi(accessToken);
const budgetsResponse = ynab.budgets.getBudgets()
.then(budgetsResponse => {
// Won't get here because an error will be thrown
})
.catch(e => {
console.log(e);
// {
// error: {
// id: "401",
// name: "unauthorized",
// detail: "Unauthorized"
// }
// }
});
There are several utilities available on the ynab.utils
object to make working
with ISO dates and milliunits a bit
easier.
// Returns the current month (system timezone) in ISO 8601 format (i.e. '2015-12-01')
getCurrentMonthInISOFormat(): string;
// Returns the current date (system timezone) in ISO 8601 format (i.e. '2015-12-15')
getCurrentDateInISOFormat(): string;
// Converts an ISO 8601 formatted string to a JS date object
convertFromISODateString(isoDateString: string): Date;
// Converts a milliunits amount to a currency amount
convertMilliUnitsToCurrencyAmount(milliunits: number, currencyDecimalDigits: number): number;
See the examples folder for example usage scenarios.
To build and compile:
npm install
npm run build
To run tests:
npm test
Copyright (c) 2018 You Need A Budget, LLC
Licensed under the Apache-2.0 license
FAQs
YNAB API Javascript (Node) Library
The npm package ynab receives a total of 574 weekly downloads. As such, ynab popularity was classified as not popular.
We found that ynab demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.