ynab 1.21.0 → 1.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -64,6 +64,7 @@ the [Account Settings](https://app.youneedabudget.com/settings) area of the YNAB
64
64
  application.
65
65
 
66
66
  ```typescript
67
+ const ynab = require("ynab");
67
68
  const accessToken = "b43439eaafe2_this_is_fake_b43439eaafe2";
68
69
  const ynabAPI = new ynab.API(accessToken);
69
70
 
@@ -103,6 +104,20 @@ const budgetsResponse = ynabAPI.budgets
103
104
  });
104
105
  ```
105
106
 
107
+ ### Rate Limiting
108
+
109
+ The API enforces [Rate Limiting](https://api.youneedabudget.com/#rate-limiting).
110
+
111
+ If the rate limit is exceeded, a `429` [Error Response](https://api.youneedabudget.com/#errors) will be returned from the API which will result in an [error being thrown](https://github.com/ynab/ynab-sdk-js#error-handling) in this library.
112
+
113
+ You can access the rate limiting info through the `rateLimit` property on a response object. It will contain the value from the `X-Rate-Limit` response header.
114
+
115
+ ```typescript
116
+ const ynabAPI = new ynab.API(accessToken);
117
+ const budgetsResponse = await ynabAPI.budgets.getBudgets();
118
+ console.log(budgetsResponse.rateLimit); // ex: "36/200"
119
+ ```
120
+
106
121
  ## Examples
107
122
 
108
123
  See the [examples](https://github.com/ynab/ynab-sdk-js/tree/master/examples)
@@ -134,9 +149,10 @@ The following methods are available in this library. For more details on paramet
134
149
  | **Transactions** | [transactions.getTransactions(budget_id)](https://github.com/ynab/ynab-sdk-js/blob/master/dist/api.d.ts) | Returns budget transactions |
135
150
  | | [transactions.getTransactionsByAccount(budget_id, account_id)](https://github.com/ynab/ynab-sdk-js/blob/master/dist/api.d.ts) | Returns all transactions for a specified account |
136
151
  | | [transactions.getTransactionsByCategory(budget_id, category_id)](https://github.com/ynab/ynab-sdk-js/blob/master/dist/api.d.ts) | Returns all transactions for a specified category |
152
+ | | [transactions.getTransactionsByType(budget_id, type)](https://github.com/ynab/ynab-sdk-js/blob/master/dist/transactionsApi.d.ts) | Returns all transactions of a specified type ("unapproved" or "uncategorized") |
137
153
  | | [transactions.getTransactionById(budget_id, transaction_id)](https://github.com/ynab/ynab-sdk-js/blob/master/dist/api.d.ts) | Returns a single transaction |
138
154
  | | [transactions.createTransaction(budget_id, data)](https://github.com/ynab/ynab-sdk-js/blob/master/dist/api.d.ts) | Creates a single transaction |
139
- | | [transactions.createTransactions(budget_id, data)](https://github.com/ynab/ynab-sdk-js/blob/master/dist/api.d.ts) | Creates multiple transactions |
155
+ | | [transactions.createTransactions(budget_id, data)](https://github.com/ynab/ynab-sdk-js/blob/master/dist/transactionsApi.d.ts) | Creates multiple transactions |
140
156
  | | [transactions.updateTransaction(budget_id, transaction_id, data)](https://github.com/ynab/ynab-sdk-js/blob/master/dist/api.d.ts) | Updates a single transaction |
141
157
  | | [transactions.updateTransactions(budget_id, data)](https://github.com/ynab/ynab-sdk-js/blob/master/dist/api.d.ts) | Updates multiple transactions |
142
158
  | | [transactions.importTransactions(budget_id)](https://github.com/ynab/ynab-sdk-js/blob/master/dist/api.d.ts) | Imports transactions |