Comparing version 0.0.1 to 0.1.0
{ | ||
"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" | ||
} | ||
} |
112
README.md
@@ -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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
219850
15
4196
117
1
19
1
21
+ Addedportable-fetch@^3.0.0
+ Addedencoding@0.1.13(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedportable-fetch@3.0.0(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)