Socket
Socket
Sign inDemoInstall

ynab

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ynab - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

dist/api.d.ts

66

package.json
{
"name": "ynab",
"version": "0.0.1",
"description": "A Node.js library that provides native access to YNAB data",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/israelroldan/ynab.git"
},
"version": "0.1.0",
"description": "YNAB API Javascript (Node) Library",
"author": "You Need a Budget, LLC",
"keywords": [
"typescript",
"swagger-client",
"ynab",
"budget",
"finance",
"home",
"administration"
"api"
],
"author": "Israel Roldan (npm@israelroldan.com)",
"license": "ISC",
"bugs": {
"url": "https://github.com/israelroldan/ynab/issues"
"files": [
"dist/"
],
"license": "Apache-2.0",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/ynab/ynab-sdk-js.git"
},
"homepage": "https://github.com/israelroldan/ynab#readme"
"scripts": {
"generate": "cd build && ./generate_sdk_typescript.js",
"build": "npx tsc && npx tsc -p examples/",
"test": "npx mocha --reporter spec --require ts-node/register 'test/**/*.ts'"
},
"dependencies": {
"portable-fetch": "^3.0.0"
},
"devDependencies": {
"@types/chai": "^4.0.5",
"@types/fetch-mock": "^5.12.2",
"@types/isomorphic-fetch": "0.0.34",
"@types/lodash": "^4.14.86",
"@types/mocha": "^2.2.44",
"@types/node": "^8.0.9",
"@types/yargs": "^8.0.2",
"chai": "^4.1.2",
"fetch-mock": "^5.13.1",
"jbash": "^1.35.0",
"lodash": "^4.17.4",
"mocha": "^4.0.1",
"moment": "^2.19.2",
"prettier": "1.8.2",
"swagger-model-validator": "^2.2.1",
"ts-node": "^3.3.0",
"typescript": "^2.6",
"yamljs": "^0.3.0",
"yargs": "^10.0.3"
},
"engines": {
"npm": "^5.2.0"
}
}

@@ -1,30 +0,116 @@

# ynab
# YNAB API Javascript (Node) Library
A Node.js library that provides native access to YNAB data
[![NPM Package](https://img.shields.io/npm/v/ynab-sdk-js.svg)](https://www.npmjs.com/package/ynab-sdk-js) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
The YNAB API JavaScript library provides access to the YNAB API from
applications written in Node.js / JavaScript.
Please read the [YNAB API documentation](https://api.youneedabudget.com) for an
overview of using the API and a complete list of the available resources.
## Installation
```sh
npm install ynab --save
```shell
npm install ynab
```
## Usage
## Tests
To use this client, you must
[obtain an access token](https://api.youneedabudget.com/#authentication) from
the [My Account](https://app.youneedabudget.com/settings) area of the YNAB web
application.
```sh
npm install
npm test
```typescript
const ynabApi = require("ynab");
const accessToken = "bf0cbb14b4330e9d5f4312a646eb0115b80a169ad1425d3de12e66a389eaafe2";
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();
```
## Dependencies
### Error Handling
None
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.
## Dev Dependencies
```typescript
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"
// }
// }
});
```
None
### Utilities
There are several utilities available on the `ynab.utils` object to make working
with [ISO dates and milliunits](https://api.youneedabudget.com/#formats) a bit
easier.
```typescript
/**
* Returns the current month (system timezone) in ISO 8601 format (i.e. '2015-12-01')
*/
getCurrentMonthInISOFormat(): string;
/**
* Converts an ISO 8601 formatted string to a JS date object
* @param {string} isoDate - An ISO 8601 formatted date (i.e. '2015-12-30'). This date is assumed to be in UTC timezone
*/
convertFromISODateString(isoDateString: string): Date;
/**
* Converts a milliunits amount to a currency amount
* @param milliunits - The milliunits amount (i.e. 293294)
* @param currencyDecimalDigits - The number of decimals in the currency (i.e. 2 for USD)
*/
convertMilliUnitsToCurrencyAmount(milliunits: number, currencyDecimalDigits: number): number;
```
## Examples
See the [examples](https://github.com/ynab/ynab-sdk-js/tree/master/examples)
folder for example usage scenarios.
## Development
To build and compile:
```shell
npm install
npm run build
```
To run tests:
```shell
npm test
```
## License
ISC
Copyright (c) 2018 You Need A Budget, LLC
Licensed under the Apache-2.0 license
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc