ynab 2.0.0-rc.1 → 2.2.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 (90) hide show
  1. package/README.md +2 -2
  2. package/dist/apis/CategoriesApi.d.ts +16 -1
  3. package/dist/apis/CategoriesApi.js +42 -0
  4. package/dist/apis/CustomTransactionsApi.d.ts +1 -1
  5. package/dist/apis/TransactionsApi.d.ts +4 -4
  6. package/dist/apis/index.d.ts +0 -1
  7. package/dist/apis/index.js +5 -2
  8. package/dist/browser/ynab.js +1 -1
  9. package/dist/esm/apis/CategoriesApi.d.ts +16 -1
  10. package/dist/esm/apis/CategoriesApi.js +65 -1
  11. package/dist/esm/apis/CustomTransactionsApi.d.ts +1 -1
  12. package/dist/esm/apis/index.d.ts +0 -1
  13. package/dist/esm/apis/index.js +0 -1
  14. package/dist/esm/models/Category.d.ts +0 -1
  15. package/dist/esm/models/Category.js +0 -1
  16. package/dist/esm/models/CategoryGoalType.d.ts +25 -0
  17. package/dist/esm/models/CategoryGoalType.js +29 -0
  18. package/dist/esm/models/HybridTransaction.d.ts +9 -30
  19. package/dist/esm/models/HybridTransaction.js +7 -26
  20. package/dist/esm/models/PatchCategoryWrapper.d.ts +32 -0
  21. package/dist/esm/models/PatchCategoryWrapper.js +44 -0
  22. package/dist/esm/models/SaveCategory.d.ts +43 -0
  23. package/dist/esm/models/SaveCategory.js +47 -0
  24. package/dist/esm/models/SaveTransaction.d.ts +8 -28
  25. package/dist/esm/models/SaveTransaction.js +6 -24
  26. package/dist/esm/models/SaveTransactionWithId.d.ts +8 -28
  27. package/dist/esm/models/SaveTransactionWithId.js +6 -24
  28. package/dist/esm/models/SaveTransactionWithOptionalFields.d.ts +8 -28
  29. package/dist/esm/models/SaveTransactionWithOptionalFields.js +6 -24
  30. package/dist/esm/models/SaveTransactionWithOptionalFieldsFlagColor.d.ts +25 -0
  31. package/dist/esm/models/SaveTransactionWithOptionalFieldsFlagColor.js +29 -0
  32. package/dist/esm/models/ScheduledTransactionDetail.d.ts +4 -16
  33. package/dist/esm/models/ScheduledTransactionDetail.js +3 -14
  34. package/dist/esm/models/ScheduledTransactionSummary.d.ts +4 -16
  35. package/dist/esm/models/ScheduledTransactionSummary.js +3 -14
  36. package/dist/esm/models/ScheduledTransactionSummaryFlagColor.d.ts +25 -0
  37. package/dist/esm/models/ScheduledTransactionSummaryFlagColor.js +29 -0
  38. package/dist/esm/models/TransactionClearedStatus.d.ts +24 -0
  39. package/dist/esm/models/TransactionClearedStatus.js +31 -0
  40. package/dist/esm/models/TransactionDetail.d.ts +9 -30
  41. package/dist/esm/models/TransactionDetail.js +7 -26
  42. package/dist/esm/models/TransactionFlagColor.d.ts +27 -0
  43. package/dist/esm/models/TransactionFlagColor.js +34 -0
  44. package/dist/esm/models/TransactionSummary.d.ts +9 -30
  45. package/dist/esm/models/TransactionSummary.js +7 -26
  46. package/dist/esm/models/TransactionSummaryDebtTransactionType.d.ts +25 -0
  47. package/dist/esm/models/TransactionSummaryDebtTransactionType.js +29 -0
  48. package/dist/esm/models/index.d.ts +4 -0
  49. package/dist/esm/models/index.js +4 -0
  50. package/dist/index.js +5 -1
  51. package/dist/models/AccountType.d.ts +1 -1
  52. package/dist/models/Category.d.ts +1 -2
  53. package/dist/models/Category.js +0 -1
  54. package/dist/models/CategoryGoalType.d.ts +25 -0
  55. package/dist/models/CategoryGoalType.js +36 -0
  56. package/dist/models/HybridTransaction.d.ts +11 -32
  57. package/dist/models/HybridTransaction.js +8 -27
  58. package/dist/models/HybridTransactionAllOf.d.ts +1 -1
  59. package/dist/models/PatchCategoryWrapper.d.ts +32 -0
  60. package/dist/models/PatchCategoryWrapper.js +51 -0
  61. package/dist/models/SaveCategory.d.ts +43 -0
  62. package/dist/models/SaveCategory.js +54 -0
  63. package/dist/models/SaveTransaction.d.ts +8 -28
  64. package/dist/models/SaveTransaction.js +7 -25
  65. package/dist/models/SaveTransactionWithId.d.ts +8 -28
  66. package/dist/models/SaveTransactionWithId.js +7 -25
  67. package/dist/models/SaveTransactionWithOptionalFields.d.ts +8 -28
  68. package/dist/models/SaveTransactionWithOptionalFields.js +7 -25
  69. package/dist/models/SaveTransactionWithOptionalFieldsFlagColor.d.ts +25 -0
  70. package/dist/models/SaveTransactionWithOptionalFieldsFlagColor.js +36 -0
  71. package/dist/models/ScheduledTransactionDetail.d.ts +5 -17
  72. package/dist/models/ScheduledTransactionDetail.js +4 -15
  73. package/dist/models/ScheduledTransactionSummary.d.ts +5 -17
  74. package/dist/models/ScheduledTransactionSummary.js +4 -15
  75. package/dist/models/ScheduledTransactionSummaryFlagColor.d.ts +25 -0
  76. package/dist/models/ScheduledTransactionSummaryFlagColor.js +36 -0
  77. package/dist/models/TransactionClearedStatus.d.ts +24 -0
  78. package/dist/models/TransactionClearedStatus.js +37 -0
  79. package/dist/models/TransactionDetail.d.ts +10 -31
  80. package/dist/models/TransactionDetail.js +8 -27
  81. package/dist/models/TransactionFlagColor.d.ts +27 -0
  82. package/dist/models/TransactionFlagColor.js +40 -0
  83. package/dist/models/TransactionSummary.d.ts +10 -31
  84. package/dist/models/TransactionSummary.js +8 -27
  85. package/dist/models/TransactionSummaryDebtTransactionType.d.ts +25 -0
  86. package/dist/models/TransactionSummaryDebtTransactionType.js +36 -0
  87. package/dist/models/index.d.ts +4 -0
  88. package/dist/models/index.js +9 -1
  89. package/dist/runtime.d.ts +9 -9
  90. package/package.json +6 -7
package/README.md CHANGED
@@ -9,7 +9,7 @@ This client is generated using the [OpenAPI Generator](https://openapi-generator
9
9
 
10
10
  ## Installation
11
11
 
12
- First, install the module with npm (or yarn):
12
+ First, install the module with npm:
13
13
 
14
14
  ```shell
15
15
  npm install ynab
@@ -118,7 +118,7 @@ folder for example usage scenarios.
118
118
 
119
119
  ## Methods
120
120
 
121
- The following methods are available in this library. For more details on parameters and usage, the [TypeScript declaration file](https://github.com/ynab/ynab-sdk-js/blob/main/dist/api.d.ts) can be referenced.
121
+ The following methods are available in this library.
122
122
 
123
123
  | | Method | Description |
124
124
  |----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { CategoriesResponse, CategoryResponse, PatchMonthCategoryWrapper, SaveCategoryResponse } from '../models/index';
13
+ import type { CategoriesResponse, CategoryResponse, PatchCategoryWrapper, PatchMonthCategoryWrapper, SaveCategoryResponse } from '../models/index';
14
14
  export interface GetCategoriesRequest {
15
15
  budgetId: string;
16
16
  lastKnowledgeOfServer?: number;
@@ -24,6 +24,11 @@ export interface GetMonthCategoryByIdRequest {
24
24
  month: string;
25
25
  categoryId: string;
26
26
  }
27
+ export interface UpdateCategoryRequest {
28
+ budgetId: string;
29
+ categoryId: string;
30
+ data: PatchCategoryWrapper;
31
+ }
27
32
  export interface UpdateMonthCategoryRequest {
28
33
  budgetId: string;
29
34
  month: string;
@@ -64,6 +69,16 @@ export declare class CategoriesApi extends runtime.BaseAPI {
64
69
  * Single category for a specific budget month
65
70
  */
66
71
  getMonthCategoryById(budgetId: string, month: string, categoryId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CategoryResponse>;
72
+ /**
73
+ * Update a category
74
+ * Update a category
75
+ */
76
+ updateCategoryRaw(requestParameters: UpdateCategoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SaveCategoryResponse>>;
77
+ /**
78
+ * Update a category
79
+ * Update a category
80
+ */
81
+ updateCategory(budgetId: string, categoryId: string, data: PatchCategoryWrapper, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SaveCategoryResponse>;
67
82
  /**
68
83
  * Update a category for a specific month. Only `budgeted` amount can be updated.
69
84
  * Update a category for a specific month
@@ -134,6 +134,48 @@ class CategoriesApi extends runtime.BaseAPI {
134
134
  const response = await this.getMonthCategoryByIdRaw({ budgetId: budgetId, month: month, categoryId: categoryId }, initOverrides);
135
135
  return await response.value();
136
136
  }
137
+ /**
138
+ * Update a category
139
+ * Update a category
140
+ */
141
+ async updateCategoryRaw(requestParameters, initOverrides) {
142
+ if (requestParameters.budgetId === null || requestParameters.budgetId === undefined) {
143
+ throw new runtime.RequiredError('budgetId', 'Required parameter requestParameters.budgetId was null or undefined when calling updateCategory.');
144
+ }
145
+ if (requestParameters.categoryId === null || requestParameters.categoryId === undefined) {
146
+ throw new runtime.RequiredError('categoryId', 'Required parameter requestParameters.categoryId was null or undefined when calling updateCategory.');
147
+ }
148
+ if (requestParameters.data === null || requestParameters.data === undefined) {
149
+ throw new runtime.RequiredError('data', 'Required parameter requestParameters.data was null or undefined when calling updateCategory.');
150
+ }
151
+ const queryParameters = {};
152
+ const headerParameters = {};
153
+ headerParameters['Accept'] = 'application/json';
154
+ headerParameters['Content-Type'] = 'application/json';
155
+ if (this.configuration && this.configuration.accessToken) {
156
+ const token = this.configuration.accessToken;
157
+ const tokenString = await token("bearer", []);
158
+ if (tokenString) {
159
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
160
+ }
161
+ }
162
+ const response = await this.request({
163
+ path: `/budgets/{budget_id}/categories/{category_id}`.replace(`{${"budget_id"}}`, encodeURIComponent(String(requestParameters.budgetId))).replace(`{${"category_id"}}`, encodeURIComponent(String(requestParameters.categoryId))),
164
+ method: 'PATCH',
165
+ headers: headerParameters,
166
+ query: queryParameters,
167
+ body: (0, index_1.PatchCategoryWrapperToJSON)(requestParameters.data),
168
+ }, initOverrides);
169
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.SaveCategoryResponseFromJSON)(jsonValue));
170
+ }
171
+ /**
172
+ * Update a category
173
+ * Update a category
174
+ */
175
+ async updateCategory(budgetId, categoryId, data, initOverrides) {
176
+ const response = await this.updateCategoryRaw({ budgetId: budgetId, categoryId: categoryId, data: data }, initOverrides);
177
+ return await response.value();
178
+ }
137
179
  /**
138
180
  * Update a category for a specific month. Only `budgeted` amount can be updated.
139
181
  * Update a category for a specific month
@@ -25,7 +25,7 @@ export declare class CustomTransactionsApi extends TransactionsApi {
25
25
  * @throws {RequiredError}
26
26
  * @memberof TransactionsApi
27
27
  */
28
- getTransactionsByType(budgetId: string, type: "uncategorized" | "unapproved", lastKnowledgeOfServer?: number, options?: any): Promise<import("..").TransactionsResponse>;
28
+ getTransactionsByType(budgetId: string, type: "uncategorized" | "unapproved" | undefined, lastKnowledgeOfServer?: number, options?: any): Promise<import("..").TransactionsResponse>;
29
29
  /**
30
30
  * Creates multiple transactions. Provide a body containing a 'transactions' array, multiple transactions will be created.
31
31
  * @summary Create a single transaction or multiple transactions
@@ -174,7 +174,7 @@ export declare const GetTransactionsTypeEnum: {
174
174
  readonly Uncategorized: "uncategorized";
175
175
  readonly Unapproved: "unapproved";
176
176
  };
177
- export declare type GetTransactionsTypeEnum = typeof GetTransactionsTypeEnum[keyof typeof GetTransactionsTypeEnum];
177
+ export type GetTransactionsTypeEnum = typeof GetTransactionsTypeEnum[keyof typeof GetTransactionsTypeEnum];
178
178
  /**
179
179
  * @export
180
180
  */
@@ -182,7 +182,7 @@ export declare const GetTransactionsByAccountTypeEnum: {
182
182
  readonly Uncategorized: "uncategorized";
183
183
  readonly Unapproved: "unapproved";
184
184
  };
185
- export declare type GetTransactionsByAccountTypeEnum = typeof GetTransactionsByAccountTypeEnum[keyof typeof GetTransactionsByAccountTypeEnum];
185
+ export type GetTransactionsByAccountTypeEnum = typeof GetTransactionsByAccountTypeEnum[keyof typeof GetTransactionsByAccountTypeEnum];
186
186
  /**
187
187
  * @export
188
188
  */
@@ -190,7 +190,7 @@ export declare const GetTransactionsByCategoryTypeEnum: {
190
190
  readonly Uncategorized: "uncategorized";
191
191
  readonly Unapproved: "unapproved";
192
192
  };
193
- export declare type GetTransactionsByCategoryTypeEnum = typeof GetTransactionsByCategoryTypeEnum[keyof typeof GetTransactionsByCategoryTypeEnum];
193
+ export type GetTransactionsByCategoryTypeEnum = typeof GetTransactionsByCategoryTypeEnum[keyof typeof GetTransactionsByCategoryTypeEnum];
194
194
  /**
195
195
  * @export
196
196
  */
@@ -198,4 +198,4 @@ export declare const GetTransactionsByPayeeTypeEnum: {
198
198
  readonly Uncategorized: "uncategorized";
199
199
  readonly Unapproved: "unapproved";
200
200
  };
201
- export declare type GetTransactionsByPayeeTypeEnum = typeof GetTransactionsByPayeeTypeEnum[keyof typeof GetTransactionsByPayeeTypeEnum];
201
+ export type GetTransactionsByPayeeTypeEnum = typeof GetTransactionsByPayeeTypeEnum[keyof typeof GetTransactionsByPayeeTypeEnum];
@@ -1,7 +1,6 @@
1
1
  export * from './AccountsApi';
2
2
  export * from './BudgetsApi';
3
3
  export * from './CategoriesApi';
4
- export * from './DeprecatedApi';
5
4
  export * from './MonthsApi';
6
5
  export * from './PayeeLocationsApi';
7
6
  export * from './PayeesApi';
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -15,7 +19,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
19
  __exportStar(require("./AccountsApi"), exports);
16
20
  __exportStar(require("./BudgetsApi"), exports);
17
21
  __exportStar(require("./CategoriesApi"), exports);
18
- __exportStar(require("./DeprecatedApi"), exports);
19
22
  __exportStar(require("./MonthsApi"), exports);
20
23
  __exportStar(require("./PayeeLocationsApi"), exports);
21
24
  __exportStar(require("./PayeesApi"), exports);