ynab 2.4.0 → 2.6.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.
Files changed (230) hide show
  1. package/README.md +1 -1
  2. package/dist/apis/AccountsApi.js +24 -1
  3. package/dist/apis/BudgetsApi.js +24 -1
  4. package/dist/apis/CategoriesApi.js +24 -1
  5. package/dist/apis/DeprecatedApi.js +24 -1
  6. package/dist/apis/MonthsApi.js +24 -1
  7. package/dist/apis/PayeeLocationsApi.js +24 -1
  8. package/dist/apis/PayeesApi.js +24 -1
  9. package/dist/apis/ScheduledTransactionsApi.js +24 -1
  10. package/dist/apis/TransactionsApi.js +24 -1
  11. package/dist/apis/UserApi.js +24 -1
  12. package/dist/browser/ynab.js +1 -1
  13. package/dist/esm/apis/AccountsApi.d.ts +1 -6
  14. package/dist/esm/apis/AccountsApi.js +2 -7
  15. package/dist/esm/apis/BudgetsApi.d.ts +1 -6
  16. package/dist/esm/apis/BudgetsApi.js +2 -7
  17. package/dist/esm/apis/CategoriesApi.d.ts +1 -6
  18. package/dist/esm/apis/CategoriesApi.js +2 -7
  19. package/dist/esm/apis/DeprecatedApi.js +1 -1
  20. package/dist/esm/apis/MonthsApi.d.ts +1 -6
  21. package/dist/esm/apis/MonthsApi.js +2 -7
  22. package/dist/esm/apis/PayeeLocationsApi.d.ts +1 -6
  23. package/dist/esm/apis/PayeeLocationsApi.js +2 -7
  24. package/dist/esm/apis/PayeesApi.d.ts +17 -7
  25. package/dist/esm/apis/PayeesApi.js +67 -8
  26. package/dist/esm/apis/ScheduledTransactionsApi.d.ts +16 -7
  27. package/dist/esm/apis/ScheduledTransactionsApi.js +64 -8
  28. package/dist/esm/apis/TransactionsApi.d.ts +40 -20
  29. package/dist/esm/apis/TransactionsApi.js +87 -17
  30. package/dist/esm/apis/UserApi.d.ts +1 -6
  31. package/dist/esm/apis/UserApi.js +2 -7
  32. package/dist/esm/models/Account.d.ts +2 -7
  33. package/dist/esm/models/Account.js +51 -51
  34. package/dist/esm/models/AccountResponse.d.ts +2 -7
  35. package/dist/esm/models/AccountResponse.js +8 -16
  36. package/dist/esm/models/AccountResponseData.d.ts +2 -7
  37. package/dist/esm/models/AccountResponseData.js +8 -16
  38. package/dist/esm/models/AccountType.d.ts +3 -7
  39. package/dist/esm/models/AccountType.js +11 -6
  40. package/dist/esm/models/AccountsResponse.d.ts +2 -7
  41. package/dist/esm/models/AccountsResponse.js +8 -16
  42. package/dist/esm/models/AccountsResponseData.d.ts +2 -7
  43. package/dist/esm/models/AccountsResponseData.js +11 -18
  44. package/dist/esm/models/BudgetDetail.d.ts +6 -11
  45. package/dist/esm/models/BudgetDetail.js +45 -53
  46. package/dist/esm/models/BudgetDetailResponse.d.ts +2 -7
  47. package/dist/esm/models/BudgetDetailResponse.js +8 -16
  48. package/dist/esm/models/BudgetDetailResponseData.d.ts +2 -7
  49. package/dist/esm/models/BudgetDetailResponseData.js +11 -18
  50. package/dist/esm/models/BudgetSettings.d.ts +2 -7
  51. package/dist/esm/models/BudgetSettings.js +11 -18
  52. package/dist/esm/models/BudgetSettingsResponse.d.ts +2 -7
  53. package/dist/esm/models/BudgetSettingsResponse.js +8 -16
  54. package/dist/esm/models/BudgetSettingsResponseData.d.ts +2 -7
  55. package/dist/esm/models/BudgetSettingsResponseData.js +8 -16
  56. package/dist/esm/models/BudgetSummary.d.ts +2 -7
  57. package/dist/esm/models/BudgetSummary.js +23 -31
  58. package/dist/esm/models/BudgetSummaryResponse.d.ts +2 -7
  59. package/dist/esm/models/BudgetSummaryResponse.js +8 -16
  60. package/dist/esm/models/BudgetSummaryResponseData.d.ts +2 -7
  61. package/dist/esm/models/BudgetSummaryResponseData.js +10 -19
  62. package/dist/esm/models/BulkResponse.d.ts +2 -7
  63. package/dist/esm/models/BulkResponse.js +8 -16
  64. package/dist/esm/models/BulkResponseData.d.ts +2 -7
  65. package/dist/esm/models/BulkResponseData.js +8 -16
  66. package/dist/esm/models/BulkResponseDataBulk.d.ts +2 -7
  67. package/dist/esm/models/BulkResponseDataBulk.js +11 -18
  68. package/dist/esm/models/BulkTransactions.d.ts +5 -10
  69. package/dist/esm/models/BulkTransactions.js +10 -18
  70. package/dist/esm/models/CategoriesResponse.d.ts +2 -7
  71. package/dist/esm/models/CategoriesResponse.js +8 -16
  72. package/dist/esm/models/CategoriesResponseData.d.ts +2 -7
  73. package/dist/esm/models/CategoriesResponseData.js +11 -18
  74. package/dist/esm/models/Category.d.ts +10 -9
  75. package/dist/esm/models/Category.js +61 -61
  76. package/dist/esm/models/CategoryGroup.d.ts +2 -7
  77. package/dist/esm/models/CategoryGroup.js +17 -22
  78. package/dist/esm/models/CategoryGroupWithCategories.d.ts +2 -7
  79. package/dist/esm/models/CategoryGroupWithCategories.js +20 -24
  80. package/dist/esm/models/CategoryResponse.d.ts +2 -7
  81. package/dist/esm/models/CategoryResponse.js +8 -16
  82. package/dist/esm/models/CategoryResponseData.d.ts +2 -7
  83. package/dist/esm/models/CategoryResponseData.js +8 -16
  84. package/dist/esm/models/CurrencyFormat.d.ts +2 -7
  85. package/dist/esm/models/CurrencyFormat.js +29 -30
  86. package/dist/esm/models/DateFormat.d.ts +2 -7
  87. package/dist/esm/models/DateFormat.js +8 -16
  88. package/dist/esm/models/ErrorDetail.d.ts +2 -7
  89. package/dist/esm/models/ErrorDetail.js +14 -20
  90. package/dist/esm/models/ErrorResponse.d.ts +2 -7
  91. package/dist/esm/models/ErrorResponse.js +8 -16
  92. package/dist/esm/models/ExistingTransaction.d.ts +89 -0
  93. package/dist/esm/models/ExistingTransaction.js +56 -0
  94. package/dist/esm/models/HybridTransaction.d.ts +12 -11
  95. package/dist/esm/models/HybridTransaction.js +63 -62
  96. package/dist/esm/models/HybridTransactionAllOf.d.ts +1 -1
  97. package/dist/esm/models/HybridTransactionsResponse.d.ts +2 -7
  98. package/dist/esm/models/HybridTransactionsResponse.js +8 -16
  99. package/dist/esm/models/HybridTransactionsResponseData.d.ts +2 -7
  100. package/dist/esm/models/HybridTransactionsResponseData.js +10 -19
  101. package/dist/esm/models/MonthDetail.d.ts +2 -7
  102. package/dist/esm/models/MonthDetail.js +30 -33
  103. package/dist/esm/models/MonthDetailResponse.d.ts +2 -7
  104. package/dist/esm/models/MonthDetailResponse.js +8 -16
  105. package/dist/esm/models/MonthDetailResponseData.d.ts +2 -7
  106. package/dist/esm/models/MonthDetailResponseData.js +8 -16
  107. package/dist/esm/models/MonthSummariesResponse.d.ts +2 -7
  108. package/dist/esm/models/MonthSummariesResponse.js +8 -16
  109. package/dist/esm/models/MonthSummariesResponseData.d.ts +2 -7
  110. package/dist/esm/models/MonthSummariesResponseData.js +11 -18
  111. package/dist/esm/models/MonthSummary.d.ts +2 -7
  112. package/dist/esm/models/MonthSummary.js +27 -31
  113. package/dist/esm/models/NewTransaction.d.ts +95 -0
  114. package/dist/esm/models/NewTransaction.js +58 -0
  115. package/dist/esm/models/PatchCategoryWrapper.d.ts +2 -7
  116. package/dist/esm/models/PatchCategoryWrapper.js +8 -16
  117. package/dist/esm/models/PatchMonthCategoryWrapper.d.ts +2 -7
  118. package/dist/esm/models/PatchMonthCategoryWrapper.js +8 -16
  119. package/dist/esm/models/PatchPayeeWrapper.d.ts +27 -0
  120. package/dist/esm/models/PatchPayeeWrapper.js +36 -0
  121. package/dist/esm/models/PatchTransactionsWrapper.d.ts +5 -10
  122. package/dist/esm/models/PatchTransactionsWrapper.js +10 -18
  123. package/dist/esm/models/Payee.d.ts +2 -7
  124. package/dist/esm/models/Payee.js +16 -23
  125. package/dist/esm/models/PayeeLocation.d.ts +2 -7
  126. package/dist/esm/models/PayeeLocation.js +20 -24
  127. package/dist/esm/models/PayeeLocationResponse.d.ts +2 -7
  128. package/dist/esm/models/PayeeLocationResponse.js +8 -16
  129. package/dist/esm/models/PayeeLocationResponseData.d.ts +2 -7
  130. package/dist/esm/models/PayeeLocationResponseData.js +8 -16
  131. package/dist/esm/models/PayeeLocationsResponse.d.ts +2 -7
  132. package/dist/esm/models/PayeeLocationsResponse.js +8 -16
  133. package/dist/esm/models/PayeeLocationsResponseData.d.ts +2 -7
  134. package/dist/esm/models/PayeeLocationsResponseData.js +8 -16
  135. package/dist/esm/models/PayeeResponse.d.ts +2 -7
  136. package/dist/esm/models/PayeeResponse.js +8 -16
  137. package/dist/esm/models/PayeeResponseData.d.ts +2 -7
  138. package/dist/esm/models/PayeeResponseData.js +8 -16
  139. package/dist/esm/models/PayeesResponse.d.ts +2 -7
  140. package/dist/esm/models/PayeesResponse.js +8 -16
  141. package/dist/esm/models/PayeesResponseData.d.ts +2 -7
  142. package/dist/esm/models/PayeesResponseData.js +11 -18
  143. package/dist/esm/models/PostAccountWrapper.d.ts +2 -7
  144. package/dist/esm/models/PostAccountWrapper.js +8 -16
  145. package/dist/esm/models/PostScheduledTransactionWrapper.d.ts +27 -0
  146. package/dist/esm/models/PostScheduledTransactionWrapper.js +36 -0
  147. package/dist/esm/models/PostTransactionsWrapper.d.ts +7 -12
  148. package/dist/esm/models/PostTransactionsWrapper.js +10 -20
  149. package/dist/esm/models/PutTransactionWrapper.d.ts +5 -10
  150. package/dist/esm/models/PutTransactionWrapper.js +10 -18
  151. package/dist/esm/models/SaveAccount.d.ts +2 -7
  152. package/dist/esm/models/SaveAccount.js +14 -20
  153. package/dist/esm/models/SaveCategory.d.ts +2 -7
  154. package/dist/esm/models/SaveCategory.js +11 -21
  155. package/dist/esm/models/SaveCategoryResponse.d.ts +2 -7
  156. package/dist/esm/models/SaveCategoryResponse.js +8 -16
  157. package/dist/esm/models/SaveCategoryResponseData.d.ts +2 -7
  158. package/dist/esm/models/SaveCategoryResponseData.js +11 -18
  159. package/dist/esm/models/SaveMonthCategory.d.ts +2 -7
  160. package/dist/esm/models/SaveMonthCategory.js +8 -16
  161. package/dist/esm/models/SavePayee.d.ts +26 -0
  162. package/dist/esm/models/SavePayee.js +33 -0
  163. package/dist/esm/models/SavePayeeResponse.d.ts +27 -0
  164. package/dist/esm/models/SavePayeeResponse.js +36 -0
  165. package/dist/esm/models/SavePayeeResponseData.d.ts +33 -0
  166. package/dist/esm/models/SavePayeeResponseData.js +40 -0
  167. package/dist/esm/models/SaveScheduledTransaction.d.ts +76 -0
  168. package/dist/esm/models/SaveScheduledTransaction.js +55 -0
  169. package/dist/esm/models/SaveSubTransaction.d.ts +2 -7
  170. package/dist/esm/models/SaveSubTransaction.js +16 -25
  171. package/dist/esm/models/SaveTransactionWithIdOrImportId.d.ts +101 -0
  172. package/dist/esm/models/SaveTransactionWithIdOrImportId.js +60 -0
  173. package/dist/esm/models/SaveTransactionWithOptionalFields.d.ts +5 -16
  174. package/dist/esm/models/SaveTransactionWithOptionalFields.js +29 -41
  175. package/dist/esm/models/SaveTransactionsResponse.d.ts +2 -7
  176. package/dist/esm/models/SaveTransactionsResponse.js +8 -16
  177. package/dist/esm/models/SaveTransactionsResponseData.d.ts +2 -7
  178. package/dist/esm/models/SaveTransactionsResponseData.js +17 -25
  179. package/dist/esm/models/ScheduledSubTransaction.d.ts +2 -7
  180. package/dist/esm/models/ScheduledSubTransaction.js +25 -31
  181. package/dist/esm/models/ScheduledTransactionDetail.d.ts +10 -9
  182. package/dist/esm/models/ScheduledTransactionDetail.js +49 -48
  183. package/dist/esm/models/ScheduledTransactionFrequency.d.ts +30 -0
  184. package/dist/esm/models/ScheduledTransactionFrequency.js +46 -0
  185. package/dist/esm/models/ScheduledTransactionResponse.d.ts +2 -7
  186. package/dist/esm/models/ScheduledTransactionResponse.js +8 -16
  187. package/dist/esm/models/ScheduledTransactionResponseData.d.ts +2 -7
  188. package/dist/esm/models/ScheduledTransactionResponseData.js +8 -16
  189. package/dist/esm/models/ScheduledTransactionSummary.d.ts +9 -8
  190. package/dist/esm/models/ScheduledTransactionSummary.js +38 -39
  191. package/dist/esm/models/ScheduledTransactionsResponse.d.ts +2 -7
  192. package/dist/esm/models/ScheduledTransactionsResponse.js +8 -16
  193. package/dist/esm/models/ScheduledTransactionsResponseData.d.ts +2 -7
  194. package/dist/esm/models/ScheduledTransactionsResponseData.js +11 -18
  195. package/dist/esm/models/SubTransaction.d.ts +2 -7
  196. package/dist/esm/models/SubTransaction.js +31 -37
  197. package/dist/esm/models/TransactionClearedStatus.d.ts +3 -7
  198. package/dist/esm/models/TransactionClearedStatus.js +11 -6
  199. package/dist/esm/models/TransactionDetail.d.ts +12 -11
  200. package/dist/esm/models/TransactionDetail.js +62 -61
  201. package/dist/esm/models/TransactionFlagColor.d.ts +3 -7
  202. package/dist/esm/models/TransactionFlagColor.js +11 -6
  203. package/dist/esm/models/TransactionResponse.d.ts +2 -7
  204. package/dist/esm/models/TransactionResponse.js +8 -16
  205. package/dist/esm/models/TransactionResponseData.d.ts +2 -7
  206. package/dist/esm/models/TransactionResponseData.js +8 -16
  207. package/dist/esm/models/TransactionSummary.d.ts +11 -10
  208. package/dist/esm/models/TransactionSummary.js +51 -52
  209. package/dist/esm/models/TransactionsImportResponse.d.ts +2 -7
  210. package/dist/esm/models/TransactionsImportResponse.js +8 -16
  211. package/dist/esm/models/TransactionsImportResponseData.d.ts +2 -7
  212. package/dist/esm/models/TransactionsImportResponseData.js +8 -16
  213. package/dist/esm/models/TransactionsResponse.d.ts +2 -7
  214. package/dist/esm/models/TransactionsResponse.js +8 -16
  215. package/dist/esm/models/TransactionsResponseData.d.ts +2 -7
  216. package/dist/esm/models/TransactionsResponseData.js +11 -18
  217. package/dist/esm/models/User.d.ts +2 -7
  218. package/dist/esm/models/User.js +8 -16
  219. package/dist/esm/models/UserResponse.d.ts +2 -7
  220. package/dist/esm/models/UserResponse.js +8 -16
  221. package/dist/esm/models/UserResponseData.d.ts +2 -7
  222. package/dist/esm/models/UserResponseData.js +8 -16
  223. package/dist/esm/models/index.d.ts +10 -9
  224. package/dist/esm/models/index.js +10 -9
  225. package/dist/esm/runtime.d.ts +12 -17
  226. package/dist/esm/runtime.js +43 -39
  227. package/dist/index.js +17 -2
  228. package/dist/runtime.d.ts +5 -5
  229. package/dist/runtime.js +58 -48
  230. package/package.json +1 -1
@@ -2,12 +2,7 @@
2
2
  * YNAB API Endpoints
3
3
  * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
4
4
  *
5
- * The version of the OpenAPI document: 1.0.0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
5
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
11
6
  */
12
7
  export declare const BASE_PATH: string;
13
8
  export interface ConfigurationParameters {
@@ -47,8 +42,8 @@ export declare class BaseAPI {
47
42
  private middleware;
48
43
  constructor(configuration?: Configuration);
49
44
  withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
50
- withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
51
- withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
45
+ withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware["pre"]>): T;
46
+ withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware["post"]>): T;
52
47
  /**
53
48
  * Check if the given MIME is a JSON MIME.
54
49
  * JSON MIME examples:
@@ -90,24 +85,24 @@ export declare const COLLECTION_FORMATS: {
90
85
  tsv: string;
91
86
  pipes: string;
92
87
  };
93
- export declare type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
94
- export declare type Json = any;
95
- export declare type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
96
- export declare type HTTPHeaders = {
88
+ export type FetchAPI = WindowOrWorkerGlobalScope["fetch"];
89
+ export type Json = any;
90
+ export type HTTPMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
91
+ export type HTTPHeaders = {
97
92
  [key: string]: string;
98
93
  };
99
- export declare type HTTPQuery = {
94
+ export type HTTPQuery = {
100
95
  [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery;
101
96
  };
102
- export declare type HTTPBody = Json | FormData | URLSearchParams;
103
- export declare type HTTPRequestInit = {
97
+ export type HTTPBody = Json | FormData | URLSearchParams;
98
+ export type HTTPRequestInit = {
104
99
  headers?: HTTPHeaders;
105
100
  method: HTTPMethod;
106
101
  credentials?: RequestCredentials;
107
102
  body?: HTTPBody;
108
103
  };
109
- export declare type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
110
- export declare type InitOverrideFunction = (requestContext: {
104
+ export type ModelPropertyNaming = "camelCase" | "snake_case" | "PascalCase" | "original";
105
+ export type InitOverrideFunction = (requestContext: {
111
106
  init: HTTPRequestInit;
112
107
  context: RequestOpts;
113
108
  }) => Promise<RequestInit>;
@@ -4,12 +4,7 @@
4
4
  * YNAB API Endpoints
5
5
  * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
6
6
  *
7
- * The version of the OpenAPI document: 1.0.0
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
7
+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)
13
8
  */
14
9
  var __extends = (this && this.__extends) || (function () {
15
10
  var extendStatics = function (d, b) {
@@ -52,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
52
47
  function verb(n) { return function (v) { return step([n, v]); }; }
53
48
  function step(op) {
54
49
  if (f) throw new TypeError("Generator is already executing.");
55
- while (_) try {
50
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
56
51
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
57
52
  if (y = 0, t) op = [op[0] & 2, t.value];
58
53
  switch (op[0]) {
@@ -73,13 +68,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
73
68
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
74
69
  }
75
70
  };
71
+ import fetchPonyfill from "fetch-ponyfill";
76
72
  // Polyfill fetch globally - this makes it easier to override with modules like fetch-mock.
77
- var fetchPonyfill = require("fetch-ponyfill")();
73
+ var fetchPonyfillInstance = fetchPonyfill();
78
74
  if (!globalThis.fetch) {
79
- globalThis.fetch = fetchPonyfill.fetch;
80
- globalThis.Response = fetchPonyfill.Response;
81
- globalThis.Headers = fetchPonyfill.Headers;
82
- globalThis.Request = fetchPonyfill.Request;
75
+ globalThis.fetch = fetchPonyfillInstance.fetch;
76
+ globalThis.Response = fetchPonyfillInstance.Response;
77
+ globalThis.Headers = fetchPonyfillInstance.Headers;
78
+ globalThis.Request = fetchPonyfillInstance.Request;
83
79
  }
84
80
  export var BASE_PATH = "https://api.ynab.com/v1".replace(/\/+$/, "");
85
81
  var Configuration = /** @class */ (function () {
@@ -96,7 +92,9 @@ var Configuration = /** @class */ (function () {
96
92
  });
97
93
  Object.defineProperty(Configuration.prototype, "basePath", {
98
94
  get: function () {
99
- return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
95
+ return this.configuration.basePath != null
96
+ ? this.configuration.basePath
97
+ : BASE_PATH;
100
98
  },
101
99
  enumerable: false,
102
100
  configurable: true
@@ -140,7 +138,7 @@ var Configuration = /** @class */ (function () {
140
138
  get: function () {
141
139
  var apiKey = this.configuration.apiKey;
142
140
  if (apiKey) {
143
- return typeof apiKey === 'function' ? apiKey : function () { return apiKey; };
141
+ return typeof apiKey === "function" ? apiKey : function () { return apiKey; };
144
142
  }
145
143
  return undefined;
146
144
  },
@@ -152,9 +150,11 @@ var Configuration = /** @class */ (function () {
152
150
  var _this = this;
153
151
  var accessToken = this.configuration.accessToken;
154
152
  if (accessToken) {
155
- return typeof accessToken === 'function' ? accessToken : function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
156
- return [2 /*return*/, accessToken];
157
- }); }); };
153
+ return typeof accessToken === "function"
154
+ ? accessToken
155
+ : function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
156
+ return [2 /*return*/, accessToken];
157
+ }); }); };
158
158
  }
159
159
  return undefined;
160
160
  },
@@ -201,7 +201,8 @@ var BaseAPI = /** @class */ (function () {
201
201
  if (!middleware.pre) return [3 /*break*/, 3];
202
202
  return [4 /*yield*/, middleware.pre(__assign({ fetch: this.fetchApi }, fetchParams))];
203
203
  case 2:
204
- fetchParams = (_f.sent()) || fetchParams;
204
+ fetchParams =
205
+ (_f.sent()) || fetchParams;
205
206
  _f.label = 3;
206
207
  case 3:
207
208
  _i++;
@@ -231,7 +232,8 @@ var BaseAPI = /** @class */ (function () {
231
232
  response: response ? response.clone() : undefined,
232
233
  })];
233
234
  case 9:
234
- response = (_f.sent()) || response;
235
+ response =
236
+ (_f.sent()) || response;
235
237
  _f.label = 10;
236
238
  case 10:
237
239
  _b++;
@@ -239,7 +241,7 @@ var BaseAPI = /** @class */ (function () {
239
241
  case 11:
240
242
  if (response === undefined) {
241
243
  if (e_1 instanceof Error) {
242
- throw new FetchError(e_1, 'The request failed and the interceptors did not return an alternative response');
244
+ throw new FetchError(e_1, "The request failed and the interceptors did not return an alternative response");
243
245
  }
244
246
  else {
245
247
  throw e_1;
@@ -260,7 +262,8 @@ var BaseAPI = /** @class */ (function () {
260
262
  response: response.clone(),
261
263
  })];
262
264
  case 14:
263
- response = (_f.sent()) || response;
265
+ response =
266
+ (_f.sent()) || response;
264
267
  _f.label = 15;
265
268
  case 15:
266
269
  _d++;
@@ -324,7 +327,7 @@ var BaseAPI = /** @class */ (function () {
324
327
  return [4 /*yield*/, this.fetchApi(url, init)];
325
328
  case 2:
326
329
  response = _b.sent();
327
- if (!(response && (response.status >= 200 && response.status < 300))) return [3 /*break*/, 3];
330
+ if (!(response && response.status >= 200 && response.status < 300)) return [3 /*break*/, 3];
328
331
  return [2 /*return*/, response];
329
332
  case 3: return [4 /*yield*/, response.json()];
330
333
  case 4: throw _b.sent();
@@ -340,14 +343,17 @@ var BaseAPI = /** @class */ (function () {
340
343
  switch (_b.label) {
341
344
  case 0:
342
345
  url = this.configuration.basePath + context.path;
343
- if (context.query !== undefined && Object.keys(context.query).length !== 0) {
346
+ if (context.query !== undefined &&
347
+ Object.keys(context.query).length !== 0) {
344
348
  // only add the querystring to the URL if there are query parameters.
345
349
  // this is done to avoid urls ending with a "?" character which buggy webservers
346
350
  // do not handle correctly sometimes.
347
- url += '?' + this.configuration.queryParamsStringify(context.query);
351
+ url += "?" + this.configuration.queryParamsStringify(context.query);
348
352
  }
349
353
  headers = Object.assign({}, this.configuration.headers, context.headers);
350
- Object.keys(headers).forEach(function (key) { return headers[key] === undefined ? delete headers[key] : {}; });
354
+ Object.keys(headers).forEach(function (key) {
355
+ return headers[key] === undefined ? delete headers[key] : {};
356
+ });
351
357
  initOverrideFn = typeof initOverrides === "function"
352
358
  ? initOverrides
353
359
  : function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
@@ -366,12 +372,12 @@ var BaseAPI = /** @class */ (function () {
366
372
  })];
367
373
  case 1:
368
374
  overriddenInit = __assign.apply(void 0, _a.concat([(_b.sent())]));
369
- if (isFormData(overriddenInit.body)
370
- || (overriddenInit.body instanceof URLSearchParams)
371
- || isBlob(overriddenInit.body)) {
375
+ if (isFormData(overriddenInit.body) ||
376
+ overriddenInit.body instanceof URLSearchParams ||
377
+ isBlob(overriddenInit.body)) {
372
378
  body = overriddenInit.body;
373
379
  }
374
- else if (this.isJsonMime(headers['Content-Type'])) {
380
+ else if (this.isJsonMime(headers["Content-Type"])) {
375
381
  body = JSON.stringify(overriddenInit.body);
376
382
  }
377
383
  else {
@@ -393,13 +399,12 @@ var BaseAPI = /** @class */ (function () {
393
399
  next.middleware = this.middleware.slice();
394
400
  return next;
395
401
  };
396
- BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
402
+ BaseAPI.jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
397
403
  return BaseAPI;
398
404
  }());
399
405
  export { BaseAPI };
400
- ;
401
406
  function isBlob(value) {
402
- return typeof Blob !== 'undefined' && value instanceof Blob;
407
+ return typeof Blob !== "undefined" && value instanceof Blob;
403
408
  }
404
409
  function isFormData(value) {
405
410
  return typeof FormData !== "undefined" && value instanceof FormData;
@@ -448,17 +453,18 @@ export function exists(json, key) {
448
453
  return value !== null && value !== undefined;
449
454
  }
450
455
  export function querystring(params, prefix) {
451
- if (prefix === void 0) { prefix = ''; }
456
+ if (prefix === void 0) { prefix = ""; }
452
457
  return Object.keys(params)
453
458
  .map(function (key) { return querystringSingleKey(key, params[key], prefix); })
454
459
  .filter(function (part) { return part.length > 0; })
455
- .join('&');
460
+ .join("&");
456
461
  }
457
462
  function querystringSingleKey(key, value, keyPrefix) {
458
- if (keyPrefix === void 0) { keyPrefix = ''; }
463
+ if (keyPrefix === void 0) { keyPrefix = ""; }
459
464
  var fullKey = keyPrefix + (keyPrefix.length ? "[".concat(key, "]") : key);
460
465
  if (value instanceof Array) {
461
- var multiValue = value.map(function (singleValue) { return encodeURIComponent(String(singleValue)); })
466
+ var multiValue = value
467
+ .map(function (singleValue) { return encodeURIComponent(String(singleValue)); })
462
468
  .join("&".concat(encodeURIComponent(fullKey), "="));
463
469
  return "".concat(encodeURIComponent(fullKey), "=").concat(multiValue);
464
470
  }
@@ -483,7 +489,7 @@ export function mapValues(data, fn) {
483
489
  export function canConsumeForm(consumes) {
484
490
  for (var _i = 0, consumes_1 = consumes; _i < consumes_1.length; _i++) {
485
491
  var consume = consumes_1[_i];
486
- if ('multipart/form-data' === consume.contentType) {
492
+ if ("multipart/form-data" === consume.contentType) {
487
493
  return true;
488
494
  }
489
495
  }
@@ -539,7 +545,6 @@ var BlobApiResponse = /** @class */ (function () {
539
545
  });
540
546
  });
541
547
  };
542
- ;
543
548
  return BlobApiResponse;
544
549
  }());
545
550
  export { BlobApiResponse };
@@ -557,7 +562,6 @@ var TextApiResponse = /** @class */ (function () {
557
562
  });
558
563
  });
559
564
  };
560
- ;
561
565
  return TextApiResponse;
562
566
  }());
563
567
  export { TextApiResponse };
package/dist/index.js CHANGED
@@ -11,14 +11,29 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
11
11
  if (k2 === undefined) k2 = k;
12
12
  o[k2] = m[k];
13
13
  }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
14
26
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
27
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
28
  };
29
+ var __importDefault = (this && this.__importDefault) || function (mod) {
30
+ return (mod && mod.__esModule) ? mod : { "default": mod };
31
+ };
17
32
  Object.defineProperty(exports, "__esModule", { value: true });
18
33
  exports.api = exports.utils = exports.API = void 0;
19
- const apis = require("./apis");
34
+ const apis = __importStar(require("./apis"));
20
35
  const CustomTransactionsApi_1 = require("./apis/CustomTransactionsApi");
21
- const utils_1 = require("./utils");
36
+ const utils_1 = __importDefault(require("./utils"));
22
37
  exports.utils = utils_1.default;
23
38
  const runtime_1 = require("./runtime");
24
39
  /* eslint-disable */
package/dist/runtime.d.ts CHANGED
@@ -42,8 +42,8 @@ export declare class BaseAPI {
42
42
  private middleware;
43
43
  constructor(configuration?: Configuration);
44
44
  withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
45
- withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
46
- withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
45
+ withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware["pre"]>): T;
46
+ withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware["post"]>): T;
47
47
  /**
48
48
  * Check if the given MIME is a JSON MIME.
49
49
  * JSON MIME examples:
@@ -85,9 +85,9 @@ export declare const COLLECTION_FORMATS: {
85
85
  tsv: string;
86
86
  pipes: string;
87
87
  };
88
- export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
88
+ export type FetchAPI = WindowOrWorkerGlobalScope["fetch"];
89
89
  export type Json = any;
90
- export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
90
+ export type HTTPMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
91
91
  export type HTTPHeaders = {
92
92
  [key: string]: string;
93
93
  };
@@ -101,7 +101,7 @@ export type HTTPRequestInit = {
101
101
  credentials?: RequestCredentials;
102
102
  body?: HTTPBody;
103
103
  };
104
- export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
104
+ export type ModelPropertyNaming = "camelCase" | "snake_case" | "PascalCase" | "original";
105
105
  export type InitOverrideFunction = (requestContext: {
106
106
  init: HTTPRequestInit;
107
107
  context: RequestOpts;
package/dist/runtime.js CHANGED
@@ -7,15 +7,19 @@
7
7
  *
8
8
  * Generated by: OpenAPI Generator (https://openapi-generator.tech)
9
9
  */
10
+ var __importDefault = (this && this.__importDefault) || function (mod) {
11
+ return (mod && mod.__esModule) ? mod : { "default": mod };
12
+ };
10
13
  Object.defineProperty(exports, "__esModule", { value: true });
11
14
  exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.canConsumeForm = exports.mapValues = exports.querystring = exports.exists = exports.COLLECTION_FORMATS = exports.RequiredError = exports.FetchError = exports.ResponseError = exports.BaseAPI = exports.DefaultConfig = exports.Configuration = exports.BASE_PATH = void 0;
15
+ const fetch_ponyfill_1 = __importDefault(require("fetch-ponyfill"));
12
16
  // Polyfill fetch globally - this makes it easier to override with modules like fetch-mock.
13
- const fetchPonyfill = require("fetch-ponyfill")();
17
+ const fetchPonyfillInstance = (0, fetch_ponyfill_1.default)();
14
18
  if (!globalThis.fetch) {
15
- globalThis.fetch = fetchPonyfill.fetch;
16
- globalThis.Response = fetchPonyfill.Response;
17
- globalThis.Headers = fetchPonyfill.Headers;
18
- globalThis.Request = fetchPonyfill.Request;
19
+ globalThis.fetch = fetchPonyfillInstance.fetch;
20
+ globalThis.Response = fetchPonyfillInstance.Response;
21
+ globalThis.Headers = fetchPonyfillInstance.Headers;
22
+ globalThis.Request = fetchPonyfillInstance.Request;
19
23
  }
20
24
  exports.BASE_PATH = "https://api.ynab.com/v1".replace(/\/+$/, "");
21
25
  class Configuration {
@@ -26,7 +30,9 @@ class Configuration {
26
30
  this.configuration = configuration;
27
31
  }
28
32
  get basePath() {
29
- return this.configuration.basePath != null ? this.configuration.basePath : exports.BASE_PATH;
33
+ return this.configuration.basePath != null
34
+ ? this.configuration.basePath
35
+ : exports.BASE_PATH;
30
36
  }
31
37
  get fetchApi() {
32
38
  return this.configuration.fetchApi;
@@ -46,14 +52,16 @@ class Configuration {
46
52
  get apiKey() {
47
53
  const apiKey = this.configuration.apiKey;
48
54
  if (apiKey) {
49
- return typeof apiKey === 'function' ? apiKey : () => apiKey;
55
+ return typeof apiKey === "function" ? apiKey : () => apiKey;
50
56
  }
51
57
  return undefined;
52
58
  }
53
59
  get accessToken() {
54
60
  const accessToken = this.configuration.accessToken;
55
61
  if (accessToken) {
56
- return typeof accessToken === 'function' ? accessToken : async () => accessToken;
62
+ return typeof accessToken === "function"
63
+ ? accessToken
64
+ : async () => accessToken;
57
65
  }
58
66
  return undefined;
59
67
  }
@@ -76,10 +84,11 @@ class BaseAPI {
76
84
  let fetchParams = { url, init };
77
85
  for (const middleware of this.middleware) {
78
86
  if (middleware.pre) {
79
- fetchParams = await middleware.pre({
80
- fetch: this.fetchApi,
81
- ...fetchParams,
82
- }) || fetchParams;
87
+ fetchParams =
88
+ (await middleware.pre({
89
+ fetch: this.fetchApi,
90
+ ...fetchParams,
91
+ })) || fetchParams;
83
92
  }
84
93
  }
85
94
  let response = undefined;
@@ -89,18 +98,19 @@ class BaseAPI {
89
98
  catch (e) {
90
99
  for (const middleware of this.middleware) {
91
100
  if (middleware.onError) {
92
- response = await middleware.onError({
93
- fetch: this.fetchApi,
94
- url: fetchParams.url,
95
- init: fetchParams.init,
96
- error: e,
97
- response: response ? response.clone() : undefined,
98
- }) || response;
101
+ response =
102
+ (await middleware.onError({
103
+ fetch: this.fetchApi,
104
+ url: fetchParams.url,
105
+ init: fetchParams.init,
106
+ error: e,
107
+ response: response ? response.clone() : undefined,
108
+ })) || response;
99
109
  }
100
110
  }
101
111
  if (response === undefined) {
102
112
  if (e instanceof Error) {
103
- throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
113
+ throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
104
114
  }
105
115
  else {
106
116
  throw e;
@@ -109,12 +119,13 @@ class BaseAPI {
109
119
  }
110
120
  for (const middleware of this.middleware) {
111
121
  if (middleware.post) {
112
- response = await middleware.post({
113
- fetch: this.fetchApi,
114
- url: fetchParams.url,
115
- init: fetchParams.init,
116
- response: response.clone(),
117
- }) || response;
122
+ response =
123
+ (await middleware.post({
124
+ fetch: this.fetchApi,
125
+ url: fetchParams.url,
126
+ init: fetchParams.init,
127
+ response: response.clone(),
128
+ })) || response;
118
129
  }
119
130
  }
120
131
  return response;
@@ -153,7 +164,7 @@ class BaseAPI {
153
164
  async request(context, initOverrides) {
154
165
  const { url, init } = await this.createFetchParams(context, initOverrides);
155
166
  const response = await this.fetchApi(url, init);
156
- if (response && (response.status >= 200 && response.status < 300)) {
167
+ if (response && response.status >= 200 && response.status < 300) {
157
168
  return response;
158
169
  }
159
170
  else {
@@ -162,14 +173,15 @@ class BaseAPI {
162
173
  }
163
174
  async createFetchParams(context, initOverrides) {
164
175
  let url = this.configuration.basePath + context.path;
165
- if (context.query !== undefined && Object.keys(context.query).length !== 0) {
176
+ if (context.query !== undefined &&
177
+ Object.keys(context.query).length !== 0) {
166
178
  // only add the querystring to the URL if there are query parameters.
167
179
  // this is done to avoid urls ending with a "?" character which buggy webservers
168
180
  // do not handle correctly sometimes.
169
- url += '?' + this.configuration.queryParamsStringify(context.query);
181
+ url += "?" + this.configuration.queryParamsStringify(context.query);
170
182
  }
171
183
  const headers = Object.assign({}, this.configuration.headers, context.headers);
172
- Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
184
+ Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
173
185
  const initOverrideFn = typeof initOverrides === "function"
174
186
  ? initOverrides
175
187
  : async () => initOverrides;
@@ -184,15 +196,15 @@ class BaseAPI {
184
196
  ...(await initOverrideFn({
185
197
  init: initParams,
186
198
  context,
187
- }))
199
+ })),
188
200
  };
189
201
  let body;
190
- if (isFormData(overriddenInit.body)
191
- || (overriddenInit.body instanceof URLSearchParams)
192
- || isBlob(overriddenInit.body)) {
202
+ if (isFormData(overriddenInit.body) ||
203
+ overriddenInit.body instanceof URLSearchParams ||
204
+ isBlob(overriddenInit.body)) {
193
205
  body = overriddenInit.body;
194
206
  }
195
- else if (this.isJsonMime(headers['Content-Type'])) {
207
+ else if (this.isJsonMime(headers["Content-Type"])) {
196
208
  body = JSON.stringify(overriddenInit.body);
197
209
  }
198
210
  else {
@@ -200,7 +212,7 @@ class BaseAPI {
200
212
  }
201
213
  const init = {
202
214
  ...overriddenInit,
203
- body
215
+ body,
204
216
  };
205
217
  return { url, init };
206
218
  }
@@ -216,10 +228,9 @@ class BaseAPI {
216
228
  }
217
229
  }
218
230
  exports.BaseAPI = BaseAPI;
219
- BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
220
- ;
231
+ BaseAPI.jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
221
232
  function isBlob(value) {
222
- return typeof Blob !== 'undefined' && value instanceof Blob;
233
+ return typeof Blob !== "undefined" && value instanceof Blob;
223
234
  }
224
235
  function isFormData(value) {
225
236
  return typeof FormData !== "undefined" && value instanceof FormData;
@@ -259,17 +270,18 @@ function exists(json, key) {
259
270
  return value !== null && value !== undefined;
260
271
  }
261
272
  exports.exists = exists;
262
- function querystring(params, prefix = '') {
273
+ function querystring(params, prefix = "") {
263
274
  return Object.keys(params)
264
- .map(key => querystringSingleKey(key, params[key], prefix))
265
- .filter(part => part.length > 0)
266
- .join('&');
275
+ .map((key) => querystringSingleKey(key, params[key], prefix))
276
+ .filter((part) => part.length > 0)
277
+ .join("&");
267
278
  }
268
279
  exports.querystring = querystring;
269
- function querystringSingleKey(key, value, keyPrefix = '') {
280
+ function querystringSingleKey(key, value, keyPrefix = "") {
270
281
  const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
271
282
  if (value instanceof Array) {
272
- const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
283
+ const multiValue = value
284
+ .map((singleValue) => encodeURIComponent(String(singleValue)))
273
285
  .join(`&${encodeURIComponent(fullKey)}=`);
274
286
  return `${encodeURIComponent(fullKey)}=${multiValue}`;
275
287
  }
@@ -291,7 +303,7 @@ function mapValues(data, fn) {
291
303
  exports.mapValues = mapValues;
292
304
  function canConsumeForm(consumes) {
293
305
  for (const consume of consumes) {
294
- if ('multipart/form-data' === consume.contentType) {
306
+ if ("multipart/form-data" === consume.contentType) {
295
307
  return true;
296
308
  }
297
309
  }
@@ -324,7 +336,6 @@ class BlobApiResponse {
324
336
  async value() {
325
337
  return await this.raw.blob();
326
338
  }
327
- ;
328
339
  }
329
340
  exports.BlobApiResponse = BlobApiResponse;
330
341
  class TextApiResponse {
@@ -334,6 +345,5 @@ class TextApiResponse {
334
345
  async value() {
335
346
  return await this.raw.text();
336
347
  }
337
- ;
338
348
  }
339
349
  exports.TextApiResponse = TextApiResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ynab",
3
- "version": "2.4.0",
3
+ "version": "2.6.0",
4
4
  "description": "YNAB API Javascript (Node) Library",
5
5
  "author": "YNAB",
6
6
  "email": "api@ynab.com",