From 69425845ce73555fe38f743ee4346f200f573bae Mon Sep 17 00:00:00 2001 From: Brady Holt Date: Tue, 9 Jul 2024 17:13:51 -0500 Subject: [PATCH] Generate from spec version 1.71.0 - POST scheduled txns --- README.md | 1 + open_api_spec.yaml | 124 +++++++++++++++- src/.openapi-generator/FILES | 3 + src/.openapi-generator/VERSION | 2 +- src/apis/ScheduledTransactionsApi.ts | 56 ++++++++ src/apis/TransactionsApi.ts | 4 +- src/models/Account.ts | 12 +- src/models/AccountType.ts | 2 +- src/models/BudgetDetail.ts | 4 +- src/models/BudgetSummary.ts | 4 +- src/models/Category.ts | 30 ++-- src/models/ExistingTransaction.ts | 12 +- src/models/HybridTransaction.ts | 28 ++-- src/models/MonthDetail.ts | 4 +- src/models/MonthSummary.ts | 4 +- src/models/NewTransaction.ts | 14 +- src/models/Payee.ts | 2 +- src/models/PostScheduledTransactionWrapper.ts | 63 ++++++++ src/models/SaveCategory.ts | 4 +- src/models/SaveScheduledTransaction.ts | 134 ++++++++++++++++++ src/models/SaveSubTransaction.ts | 8 +- src/models/SaveTransactionWithIdOrImportId.ts | 16 +-- .../SaveTransactionWithOptionalFields.ts | 12 +- src/models/ScheduledSubTransaction.ts | 8 +- src/models/ScheduledTransactionDetail.ts | 16 +-- src/models/ScheduledTransactionFrequency.ts | 55 +++++++ src/models/ScheduledTransactionSummary.ts | 12 +- src/models/SubTransaction.ts | 14 +- src/models/TransactionClearedStatus.ts | 2 +- src/models/TransactionDetail.ts | 28 ++-- src/models/TransactionFlagColor.ts | 4 +- src/models/TransactionSummary.ts | 24 ++-- src/models/index.ts | 3 + 33 files changed, 570 insertions(+), 139 deletions(-) create mode 100644 src/models/PostScheduledTransactionWrapper.ts create mode 100644 src/models/SaveScheduledTransaction.ts create mode 100644 src/models/ScheduledTransactionFrequency.ts diff --git a/README.md b/README.md index effd718..602640b 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,7 @@ The following methods are available in this library. | | [transactions.importTransactions(budget_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Imports transactions | | **Scheduled Transactions** | [scheduled_transactions.getScheduledTransactions(budget_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/ScheduledTransactionsApi.d.ts) | Returns all scheduled transactions | | | [scheduled_transactions.getScheduledTransactionById(budget_id, scheduled_transaction_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/ScheduledTransactionsApi.d.ts) | Returns a single scheduled transaction | +| | [scheduled_transactions.createScheduledTransaction(budget_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/ScheduledTransactionsApi.d.ts) | Creates a single scheduled transaction | ### Utilities diff --git a/open_api_spec.yaml b/open_api_spec.yaml index 0b0a6a8..5f9c44b 100644 --- a/open_api_spec.yaml +++ b/open_api_spec.yaml @@ -6,7 +6,7 @@ info: 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 - version: 1.70.0 + version: 1.71.0 servers: - url: https://api.ynab.com/v1 security: @@ -959,8 +959,8 @@ paths: Creates a single transaction or multiple transactions. If you provide a body containing a `transaction` object, a single transaction will be created and if you provide a body containing a `transactions` array, - multiple transactions will be created. Scheduled transactions cannot be - created on this endpoint. + multiple transactions will be created. Scheduled transactions (transactions with a future date) + cannot be created on this endpoint. operationId: createTransaction parameters: - name: budget_id @@ -1469,6 +1469,47 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" + post: + tags: + - Scheduled Transactions + summary: Create a single scheduled transaction + description: >- + Creates a single scheduled transaction. + operationId: createScheduledTransaction + parameters: + - name: budget_id + in: path + description: >- + The id of the budget. "last-used" can be used to specify the last + used budget and "default" can be used if default budget selection is + enabled (see: https://api.ynab.com/#oauth-default-budget). + required: true + schema: + type: string + requestBody: + description: >- + The scheduled transaction to create + content: + "application/json": + schema: + $ref: "#/components/schemas/PostScheduledTransactionWrapper" + required: true + responses: + "201": + description: The scheduled transaction was successfully created + content: + application/json: + schema: + $ref: "#/components/schemas/ScheduledTransactionResponse" + "400": + description: >- + The request could not be understood due to malformed syntax or + validation error(s). + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + x-codegen-request-body-name: data /budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id}: get: tags: @@ -2401,7 +2442,7 @@ components: The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as - `tranfer_payee_id` on the account resource. + `transfer_payee_id` on the account resource. format: uuid payee_name: maxLength: 50 @@ -2875,6 +2916,64 @@ components: properties: scheduled_transaction: $ref: "#/components/schemas/ScheduledTransactionDetail" + PostScheduledTransactionWrapper: + required: + - scheduled_transaction + type: object + properties: + scheduled_transaction: + $ref: "#/components/schemas/SaveScheduledTransaction" + SaveScheduledTransaction: + required: + - account_id + - date + type: object + properties: + account_id: + type: string + format: uuid + date: + type: string + description: >- + The scheduled transaction date in ISO format (e.g. 2016-12-01). + format: date + amount: + type: integer + description: >- + The scheduled transaction amount in milliunits format. + format: int64 + payee_id: + type: string + nullable: true + description: >- + The payee for the scheduled transaction. To create a transfer between two + accounts, use the account transfer payee pointing to the target + account. Account transfer payees are specified as + `transfer_payee_id` on the account resource. + format: uuid + payee_name: + maxLength: 50 + type: string + nullable: true + description: >- + The payee name for the the scheduled transaction. If a `payee_name` value is provided and `payee_id` + has a null value, the `payee_name` value will be used to resolve the + payee by either (1) a payee with the same name or (2) creation of a new payee. + category_id: + type: string + nullable: true + description: >- + The category for the scheduled transaction. Credit Card Payment categories are not permitted. + Creating a split scheduled transaction is not currently supported. + format: uuid + memo: + maxLength: 200 + type: string + nullable: true + flag_color: + $ref: "#/components/schemas/TransactionFlagColor" + frequency: + $ref: "#/components/schemas/ScheduledTransactionFrequency" ScheduledTransactionSummary: required: - account_id @@ -3127,6 +3226,23 @@ components: - cleared - uncleared - reconciled + ScheduledTransactionFrequency: + type: string + description: The scheduled transaction frequency + enum: + - never + - daily + - weekly + - everyOtherWeek + - twiceAMonth + - every4Weeks + - monthly + - everyOtherMonth + - every3Months + - every4Months + - twiceAYear + - yearly + - everyOtherYear securitySchemes: bearer: type: http diff --git a/src/.openapi-generator/FILES b/src/.openapi-generator/FILES index 589ba0f..59ec02f 100644 --- a/src/.openapi-generator/FILES +++ b/src/.openapi-generator/FILES @@ -65,6 +65,7 @@ models/PayeeResponseData.ts models/PayeesResponse.ts models/PayeesResponseData.ts models/PostAccountWrapper.ts +models/PostScheduledTransactionWrapper.ts models/PostTransactionsWrapper.ts models/PutTransactionWrapper.ts models/SaveAccount.ts @@ -75,6 +76,7 @@ models/SaveMonthCategory.ts models/SavePayee.ts models/SavePayeeResponse.ts models/SavePayeeResponseData.ts +models/SaveScheduledTransaction.ts models/SaveSubTransaction.ts models/SaveTransactionWithIdOrImportId.ts models/SaveTransactionWithOptionalFields.ts @@ -82,6 +84,7 @@ models/SaveTransactionsResponse.ts models/SaveTransactionsResponseData.ts models/ScheduledSubTransaction.ts models/ScheduledTransactionDetail.ts +models/ScheduledTransactionFrequency.ts models/ScheduledTransactionResponse.ts models/ScheduledTransactionResponseData.ts models/ScheduledTransactionSummary.ts diff --git a/src/.openapi-generator/VERSION b/src/.openapi-generator/VERSION index 93c8dda..1985849 100644 --- a/src/.openapi-generator/VERSION +++ b/src/.openapi-generator/VERSION @@ -1 +1 @@ -7.6.0 +7.7.0 diff --git a/src/apis/ScheduledTransactionsApi.ts b/src/apis/ScheduledTransactionsApi.ts index 3e52ada..f192f39 100644 --- a/src/apis/ScheduledTransactionsApi.ts +++ b/src/apis/ScheduledTransactionsApi.ts @@ -11,18 +11,26 @@ import * as runtime from '../runtime'; import type { ErrorResponse, + PostScheduledTransactionWrapper, ScheduledTransactionResponse, ScheduledTransactionsResponse, } from '../models/index'; import { ErrorResponseFromJSON, ErrorResponseToJSON, + PostScheduledTransactionWrapperFromJSON, + PostScheduledTransactionWrapperToJSON, ScheduledTransactionResponseFromJSON, ScheduledTransactionResponseToJSON, ScheduledTransactionsResponseFromJSON, ScheduledTransactionsResponseToJSON, } from '../models/index'; +export interface CreateScheduledTransactionRequest { + budgetId: string; + data: PostScheduledTransactionWrapper; +} + export interface GetScheduledTransactionByIdRequest { budgetId: string; scheduledTransactionId: string; @@ -38,6 +46,54 @@ export interface GetScheduledTransactionsRequest { */ export class ScheduledTransactionsApi extends runtime.BaseAPI { + /** + * Creates a single scheduled transaction. + * Create a single scheduled transaction + */ + async createScheduledTransactionRaw(requestParameters: CreateScheduledTransactionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.budgetId === null || requestParameters.budgetId === undefined) { + throw new runtime.RequiredError('budgetId','Required parameter requestParameters.budgetId was null or undefined when calling createScheduledTransaction.'); + } + + if (requestParameters.data === null || requestParameters.data === undefined) { + throw new runtime.RequiredError('data','Required parameter requestParameters.data was null or undefined when calling createScheduledTransaction.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + headerParameters['Accept'] = 'application/json'; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/budgets/{budget_id}/scheduled_transactions`.replace(`{${"budget_id"}}`, encodeURIComponent(String(requestParameters.budgetId))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: PostScheduledTransactionWrapperToJSON(requestParameters.data), + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => ScheduledTransactionResponseFromJSON(jsonValue)); + } + + /** + * Creates a single scheduled transaction. + * Create a single scheduled transaction + */ + async createScheduledTransaction(budgetId: string, data: PostScheduledTransactionWrapper, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.createScheduledTransactionRaw({ budgetId: budgetId, data: data }, initOverrides); + return await response.value(); + } + /** * Returns a single scheduled transaction * Single scheduled transaction diff --git a/src/apis/TransactionsApi.ts b/src/apis/TransactionsApi.ts index 2a28f1e..4f68af8 100644 --- a/src/apis/TransactionsApi.ts +++ b/src/apis/TransactionsApi.ts @@ -108,7 +108,7 @@ export interface UpdateTransactionsRequest { export class TransactionsApi extends runtime.BaseAPI { /** - * Creates a single transaction or multiple transactions. If you provide a body containing a `transaction` object, a single transaction will be created and if you provide a body containing a `transactions` array, multiple transactions will be created. Scheduled transactions cannot be created on this endpoint. + * Creates a single transaction or multiple transactions. If you provide a body containing a `transaction` object, a single transaction will be created and if you provide a body containing a `transactions` array, multiple transactions will be created. Scheduled transactions (transactions with a future date) cannot be created on this endpoint. * Create a single transaction or multiple transactions */ async createTransactionRaw(requestParameters: CreateTransactionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { @@ -147,7 +147,7 @@ export class TransactionsApi extends runtime.BaseAPI { } /** - * Creates a single transaction or multiple transactions. If you provide a body containing a `transaction` object, a single transaction will be created and if you provide a body containing a `transactions` array, multiple transactions will be created. Scheduled transactions cannot be created on this endpoint. + * Creates a single transaction or multiple transactions. If you provide a body containing a `transaction` object, a single transaction will be created and if you provide a body containing a `transactions` array, multiple transactions will be created. Scheduled transactions (transactions with a future date) cannot be created on this endpoint. * Create a single transaction or multiple transactions */ async createTransaction(budgetId: string, data: PostTransactionsWrapper, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { diff --git a/src/models/Account.ts b/src/models/Account.ts index b112625..11c9685 100644 --- a/src/models/Account.ts +++ b/src/models/Account.ts @@ -56,7 +56,7 @@ export interface Account { * @type {string} * @memberof Account */ - note?: string; + note?: string | null; /** * The current balance of the account in milliunits format * @type {number} @@ -98,31 +98,31 @@ export interface Account { * @type {string} * @memberof Account */ - last_reconciled_at?: string; + last_reconciled_at?: string | null; /** * The original debt/loan account balance, specified in milliunits format. * @type {number} * @memberof Account */ - debt_original_balance?: number; + debt_original_balance?: number | null; /** * * @type {{ [key: string]: number; }} * @memberof Account */ - debt_interest_rates?: { [key: string]: number; }; + debt_interest_rates?: { [key: string]: number; } | null; /** * * @type {{ [key: string]: number; }} * @memberof Account */ - debt_minimum_payments?: { [key: string]: number; }; + debt_minimum_payments?: { [key: string]: number; } | null; /** * * @type {{ [key: string]: number; }} * @memberof Account */ - debt_escrow_amounts?: { [key: string]: number; }; + debt_escrow_amounts?: { [key: string]: number; } | null; /** * Whether or not the account has been deleted. Deleted accounts will only be included in delta requests. * @type {boolean} diff --git a/src/models/AccountType.ts b/src/models/AccountType.ts index ecd818e..dad1914 100644 --- a/src/models/AccountType.ts +++ b/src/models/AccountType.ts @@ -33,7 +33,7 @@ export type AccountType = typeof AccountType[keyof typeof AccountType]; export function instanceOfAccountType(value: any): boolean { for (const key in AccountType) { if (Object.prototype.hasOwnProperty.call(AccountType, key)) { - if (AccountType[key as keyof typeof AccountType] === value) { + if ((AccountType as Record)[key] === value) { return true; } } diff --git a/src/models/BudgetDetail.ts b/src/models/BudgetDetail.ts index c4d0fbd..1dbfb09 100644 --- a/src/models/BudgetDetail.ts +++ b/src/models/BudgetDetail.ts @@ -122,13 +122,13 @@ export interface BudgetDetail { * @type {DateFormat} * @memberof BudgetDetail */ - date_format?: DateFormat; + date_format?: DateFormat | null; /** * * @type {CurrencyFormat} * @memberof BudgetDetail */ - currency_format?: CurrencyFormat; + currency_format?: CurrencyFormat | null; /** * * @type {Array} diff --git a/src/models/BudgetSummary.ts b/src/models/BudgetSummary.ts index f85026a..49a1590 100644 --- a/src/models/BudgetSummary.ts +++ b/src/models/BudgetSummary.ts @@ -68,13 +68,13 @@ export interface BudgetSummary { * @type {DateFormat} * @memberof BudgetSummary */ - date_format?: DateFormat; + date_format?: DateFormat | null; /** * * @type {CurrencyFormat} * @memberof BudgetSummary */ - currency_format?: CurrencyFormat; + currency_format?: CurrencyFormat | null; /** * The budget accounts (only included if `include_accounts=true` specified as query parameter) * @type {Array} diff --git a/src/models/Category.ts b/src/models/Category.ts index ed2ff44..d9fbe50 100644 --- a/src/models/Category.ts +++ b/src/models/Category.ts @@ -49,13 +49,13 @@ export interface Category { * @type {string} * @memberof Category */ - original_category_group_id?: string; + original_category_group_id?: string | null; /** * * @type {string} * @memberof Category */ - note?: string; + note?: string | null; /** * Budgeted amount in milliunits format * @type {number} @@ -79,79 +79,79 @@ export interface Category { * @type {string} * @memberof Category */ - goal_type?: CategoryGoalTypeEnum; + goal_type?: CategoryGoalTypeEnum | null; /** * Indicates the monthly rollover behavior for "NEED"-type goals. When "true", the goal will always ask for the target amount in the new month ("Set Aside"). When "false", previous month category funding is used ("Refill"). For other goal types, this field will be null. * @type {boolean} * @memberof Category */ - goal_needs_whole_amount?: boolean; + goal_needs_whole_amount?: boolean | null; /** * A day offset modifier for the goal's due date. When goal_cadence is 2 (Weekly), this value specifies which day of the week the goal is due (0 = Sunday, 6 = Saturday). Otherwise, this value specifies which day of the month the goal is due (1 = 1st, 31 = 31st, null = Last day of Month). * @type {number} * @memberof Category */ - goal_day?: number; + goal_day?: number | null; /** * The goal cadence. Value in range 0-14. There are two subsets of these values which behave differently. For values 0, 1, 2, and 13, the goal's due date repeats every goal_cadence * goal_cadence_frequency, where 0 = None, 1 = Monthly, 2 = Weekly, and 13 = Yearly. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. For values 3-12 and 14, goal_cadence_frequency is ignored and the goal's due date repeats every goal_cadence, where 3 = Every 2 Months, 4 = Every 3 Months, ..., 12 = Every 11 Months, and 14 = Every 2 Years. * @type {number} * @memberof Category */ - goal_cadence?: number; + goal_cadence?: number | null; /** * The goal cadence frequency. When goal_cadence is 0, 1, 2, or 13, a goal's due date repeats every goal_cadence * goal_cadence_frequency. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. When goal_cadence is 3-12 or 14, goal_cadence_frequency is ignored. * @type {number} * @memberof Category */ - goal_cadence_frequency?: number; + goal_cadence_frequency?: number | null; /** * The month a goal was created * @type {string} * @memberof Category */ - goal_creation_month?: string; + goal_creation_month?: string | null; /** * The goal target amount in milliunits * @type {number} * @memberof Category */ - goal_target?: number; + goal_target?: number | null; /** * The original target month for the goal to be completed. Only some goal types specify this date. * @type {string} * @memberof Category */ - goal_target_month?: string; + goal_target_month?: string | null; /** * The percentage completion of the goal * @type {number} * @memberof Category */ - goal_percentage_complete?: number; + goal_percentage_complete?: number | null; /** * The number of months, including the current month, left in the current goal period. * @type {number} * @memberof Category */ - goal_months_to_budget?: number; + goal_months_to_budget?: number | null; /** * The amount of funding still needed in the current month to stay on track towards completing the goal within the current goal period. This amount will generally correspond to the 'Underfunded' amount in the web and mobile clients except when viewing a category with a Needed for Spending Goal in a future month. The web and mobile clients will ignore any funding from a prior goal period when viewing category with a Needed for Spending Goal in a future month. * @type {number} * @memberof Category */ - goal_under_funded?: number; + goal_under_funded?: number | null; /** * The total amount funded towards the goal within the current goal period. * @type {number} * @memberof Category */ - goal_overall_funded?: number; + goal_overall_funded?: number | null; /** * The amount of funding still needed to complete the goal within the current goal period. * @type {number} * @memberof Category */ - goal_overall_left?: number; + goal_overall_left?: number | null; /** * Whether or not the category has been deleted. Deleted categories will only be included in delta requests. * @type {boolean} diff --git a/src/models/ExistingTransaction.ts b/src/models/ExistingTransaction.ts index f8c9ba9..f137efe 100644 --- a/src/models/ExistingTransaction.ts +++ b/src/models/ExistingTransaction.ts @@ -52,29 +52,29 @@ export interface ExistingTransaction { */ amount?: number; /** - * The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `tranfer_payee_id` on the account resource. + * The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `transfer_payee_id` on the account resource. * @type {string} * @memberof ExistingTransaction */ - payee_id?: string; + payee_id?: string | null; /** * The payee name. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a matching payee rename rule (only if `import_id` is also specified) or (2) a payee with the same name or (3) creation of a new payee. * @type {string} * @memberof ExistingTransaction */ - payee_name?: string; + payee_name?: string | null; /** * The category for the transaction. To configure a split transaction, you can specify null for `category_id` and provide a `subtransactions` array as part of the transaction object. If an existing transaction is a split, the `category_id` cannot be changed. Credit Card Payment categories are not permitted and will be ignored if supplied. * @type {string} * @memberof ExistingTransaction */ - category_id?: string; + category_id?: string | null; /** * * @type {string} * @memberof ExistingTransaction */ - memo?: string; + memo?: string | null; /** * * @type {TransactionClearedStatus} @@ -92,7 +92,7 @@ export interface ExistingTransaction { * @type {TransactionFlagColor} * @memberof ExistingTransaction */ - flag_color?: TransactionFlagColor; + flag_color?: TransactionFlagColor | null; /** * An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported. * @type {Array} diff --git a/src/models/HybridTransaction.ts b/src/models/HybridTransaction.ts index 6429b45..5498cde 100644 --- a/src/models/HybridTransaction.ts +++ b/src/models/HybridTransaction.ts @@ -50,7 +50,7 @@ export interface HybridTransaction { * @type {string} * @memberof HybridTransaction */ - memo?: string; + memo?: string | null; /** * * @type {TransactionClearedStatus} @@ -68,13 +68,13 @@ export interface HybridTransaction { * @type {TransactionFlagColor} * @memberof HybridTransaction */ - flag_color?: TransactionFlagColor; + flag_color?: TransactionFlagColor | null; /** * The customized name of a transaction flag * @type {string} * @memberof HybridTransaction */ - flag_name?: string; + flag_name?: string | null; /** * * @type {string} @@ -86,55 +86,55 @@ export interface HybridTransaction { * @type {string} * @memberof HybridTransaction */ - payee_id?: string; + payee_id?: string | null; /** * * @type {string} * @memberof HybridTransaction */ - category_id?: string; + category_id?: string | null; /** * If a transfer transaction, the account to which it transfers * @type {string} * @memberof HybridTransaction */ - transfer_account_id?: string; + transfer_account_id?: string | null; /** * If a transfer transaction, the id of transaction on the other side of the transfer * @type {string} * @memberof HybridTransaction */ - transfer_transaction_id?: string; + transfer_transaction_id?: string | null; /** * If transaction is matched, the id of the matched transaction * @type {string} * @memberof HybridTransaction */ - matched_transaction_id?: string; + matched_transaction_id?: string | null; /** * If the transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. * @type {string} * @memberof HybridTransaction */ - import_id?: string; + import_id?: string | null; /** * If the transaction was imported, the payee name that was used when importing and before applying any payee rename rules * @type {string} * @memberof HybridTransaction */ - import_payee_name?: string; + import_payee_name?: string | null; /** * If the transaction was imported, the original payee name as it appeared on the statement * @type {string} * @memberof HybridTransaction */ - import_payee_name_original?: string; + import_payee_name_original?: string | null; /** * If the transaction is a debt/loan account transaction, the type of transaction * @type {string} * @memberof HybridTransaction */ - debt_transaction_type?: HybridTransactionDebtTransactionTypeEnum; + debt_transaction_type?: HybridTransactionDebtTransactionTypeEnum | null; /** * Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. * @type {boolean} @@ -152,7 +152,7 @@ export interface HybridTransaction { * @type {string} * @memberof HybridTransaction */ - parent_transaction_id?: string; + parent_transaction_id?: string | null; /** * * @type {string} @@ -164,7 +164,7 @@ export interface HybridTransaction { * @type {string} * @memberof HybridTransaction */ - payee_name?: string; + payee_name?: string | null; /** * The name of the category. If a split transaction, this will be 'Split'. * @type {string} diff --git a/src/models/MonthDetail.ts b/src/models/MonthDetail.ts index 57bbd86..5ab75ec 100644 --- a/src/models/MonthDetail.ts +++ b/src/models/MonthDetail.ts @@ -32,7 +32,7 @@ export interface MonthDetail { * @type {string} * @memberof MonthDetail */ - note?: string; + note?: string | null; /** * The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month * @type {number} @@ -62,7 +62,7 @@ export interface MonthDetail { * @type {number} * @memberof MonthDetail */ - age_of_money?: number; + age_of_money?: number | null; /** * Whether or not the month has been deleted. Deleted months will only be included in delta requests. * @type {boolean} diff --git a/src/models/MonthSummary.ts b/src/models/MonthSummary.ts index c3e2097..b9ad343 100644 --- a/src/models/MonthSummary.ts +++ b/src/models/MonthSummary.ts @@ -25,7 +25,7 @@ export interface MonthSummary { * @type {string} * @memberof MonthSummary */ - note?: string; + note?: string | null; /** * The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month * @type {number} @@ -55,7 +55,7 @@ export interface MonthSummary { * @type {number} * @memberof MonthSummary */ - age_of_money?: number; + age_of_money?: number | null; /** * Whether or not the month has been deleted. Deleted months will only be included in delta requests. * @type {boolean} diff --git a/src/models/NewTransaction.ts b/src/models/NewTransaction.ts index 1366388..0a4b8c7 100644 --- a/src/models/NewTransaction.ts +++ b/src/models/NewTransaction.ts @@ -52,29 +52,29 @@ export interface NewTransaction { */ amount?: number; /** - * The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `tranfer_payee_id` on the account resource. + * The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `transfer_payee_id` on the account resource. * @type {string} * @memberof NewTransaction */ - payee_id?: string; + payee_id?: string | null; /** * The payee name. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a matching payee rename rule (only if `import_id` is also specified) or (2) a payee with the same name or (3) creation of a new payee. * @type {string} * @memberof NewTransaction */ - payee_name?: string; + payee_name?: string | null; /** * The category for the transaction. To configure a split transaction, you can specify null for `category_id` and provide a `subtransactions` array as part of the transaction object. If an existing transaction is a split, the `category_id` cannot be changed. Credit Card Payment categories are not permitted and will be ignored if supplied. * @type {string} * @memberof NewTransaction */ - category_id?: string; + category_id?: string | null; /** * * @type {string} * @memberof NewTransaction */ - memo?: string; + memo?: string | null; /** * * @type {TransactionClearedStatus} @@ -92,7 +92,7 @@ export interface NewTransaction { * @type {TransactionFlagColor} * @memberof NewTransaction */ - flag_color?: TransactionFlagColor; + flag_color?: TransactionFlagColor | null; /** * An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported. * @type {Array} @@ -104,7 +104,7 @@ export interface NewTransaction { * @type {string} * @memberof NewTransaction */ - import_id?: string; + import_id?: string | null; } /** diff --git a/src/models/Payee.ts b/src/models/Payee.ts index db43601..0932fb4 100644 --- a/src/models/Payee.ts +++ b/src/models/Payee.ts @@ -31,7 +31,7 @@ export interface Payee { * @type {string} * @memberof Payee */ - transfer_account_id?: string; + transfer_account_id?: string | null; /** * Whether or not the payee has been deleted. Deleted payees will only be included in delta requests. * @type {boolean} diff --git a/src/models/PostScheduledTransactionWrapper.ts b/src/models/PostScheduledTransactionWrapper.ts new file mode 100644 index 0000000..16f5cb5 --- /dev/null +++ b/src/models/PostScheduledTransactionWrapper.ts @@ -0,0 +1,63 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * YNAB API Endpoints + * 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 + * + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +import { mapValues } from '../runtime'; +import type { SaveScheduledTransaction } from './SaveScheduledTransaction'; +import { + SaveScheduledTransactionFromJSON, + SaveScheduledTransactionFromJSONTyped, + SaveScheduledTransactionToJSON, +} from './SaveScheduledTransaction'; + +/** + * + * @export + * @interface PostScheduledTransactionWrapper + */ +export interface PostScheduledTransactionWrapper { + /** + * + * @type {SaveScheduledTransaction} + * @memberof PostScheduledTransactionWrapper + */ + scheduled_transaction: SaveScheduledTransaction; +} + +/** + * Check if a given object implements the PostScheduledTransactionWrapper interface. + */ +export function instanceOfPostScheduledTransactionWrapper(value: object): value is PostScheduledTransactionWrapper { + if (!('scheduled_transaction' in value) || value['scheduled_transaction'] === undefined) return false; + return true; +} + +export function PostScheduledTransactionWrapperFromJSON(json: any): PostScheduledTransactionWrapper { + return PostScheduledTransactionWrapperFromJSONTyped(json, false); +} + +export function PostScheduledTransactionWrapperFromJSONTyped(json: any, ignoreDiscriminator: boolean): PostScheduledTransactionWrapper { + if (json == null) { + return json; + } + return { + + 'scheduled_transaction': SaveScheduledTransactionFromJSON(json['scheduled_transaction']), + }; +} + +export function PostScheduledTransactionWrapperToJSON(value?: PostScheduledTransactionWrapper | null): any { + if (value == null) { + return value; + } + return { + + 'scheduled_transaction': SaveScheduledTransactionToJSON(value['scheduled_transaction']), + }; +} + diff --git a/src/models/SaveCategory.ts b/src/models/SaveCategory.ts index f09e0d3..e2a0b50 100644 --- a/src/models/SaveCategory.ts +++ b/src/models/SaveCategory.ts @@ -19,13 +19,13 @@ export interface SaveCategory { * @type {string} * @memberof SaveCategory */ - name?: string; + name?: string | null; /** * * @type {string} * @memberof SaveCategory */ - note?: string; + note?: string | null; /** * * @type {string} diff --git a/src/models/SaveScheduledTransaction.ts b/src/models/SaveScheduledTransaction.ts new file mode 100644 index 0000000..fa23fc2 --- /dev/null +++ b/src/models/SaveScheduledTransaction.ts @@ -0,0 +1,134 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * YNAB API Endpoints + * 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 + * + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +import { mapValues } from '../runtime'; +import type { TransactionFlagColor } from './TransactionFlagColor'; +import { + TransactionFlagColorFromJSON, + TransactionFlagColorFromJSONTyped, + TransactionFlagColorToJSON, +} from './TransactionFlagColor'; +import type { ScheduledTransactionFrequency } from './ScheduledTransactionFrequency'; +import { + ScheduledTransactionFrequencyFromJSON, + ScheduledTransactionFrequencyFromJSONTyped, + ScheduledTransactionFrequencyToJSON, +} from './ScheduledTransactionFrequency'; + +/** + * + * @export + * @interface SaveScheduledTransaction + */ +export interface SaveScheduledTransaction { + /** + * + * @type {string} + * @memberof SaveScheduledTransaction + */ + account_id: string; + /** + * The scheduled transaction date in ISO format (e.g. 2016-12-01). + * @type {string} + * @memberof SaveScheduledTransaction + */ + date: string; + /** + * The scheduled transaction amount in milliunits format. + * @type {number} + * @memberof SaveScheduledTransaction + */ + amount?: number; + /** + * The payee for the scheduled transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `transfer_payee_id` on the account resource. + * @type {string} + * @memberof SaveScheduledTransaction + */ + payee_id?: string | null; + /** + * The payee name for the the scheduled transaction. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a payee with the same name or (2) creation of a new payee. + * @type {string} + * @memberof SaveScheduledTransaction + */ + payee_name?: string | null; + /** + * The category for the scheduled transaction. Credit Card Payment categories are not permitted. Creating a split scheduled transaction is not currently supported. + * @type {string} + * @memberof SaveScheduledTransaction + */ + category_id?: string | null; + /** + * + * @type {string} + * @memberof SaveScheduledTransaction + */ + memo?: string | null; + /** + * + * @type {TransactionFlagColor} + * @memberof SaveScheduledTransaction + */ + flag_color?: TransactionFlagColor | null; + /** + * + * @type {ScheduledTransactionFrequency} + * @memberof SaveScheduledTransaction + */ + frequency?: ScheduledTransactionFrequency; +} + +/** + * Check if a given object implements the SaveScheduledTransaction interface. + */ +export function instanceOfSaveScheduledTransaction(value: object): value is SaveScheduledTransaction { + if (!('account_id' in value) || value['account_id'] === undefined) return false; + if (!('date' in value) || value['date'] === undefined) return false; + return true; +} + +export function SaveScheduledTransactionFromJSON(json: any): SaveScheduledTransaction { + return SaveScheduledTransactionFromJSONTyped(json, false); +} + +export function SaveScheduledTransactionFromJSONTyped(json: any, ignoreDiscriminator: boolean): SaveScheduledTransaction { + if (json == null) { + return json; + } + return { + + 'account_id': json['account_id'], + 'date': json['date'], + 'amount': json['amount'] == null ? undefined : json['amount'], + 'payee_id': json['payee_id'] == null ? undefined : json['payee_id'], + 'payee_name': json['payee_name'] == null ? undefined : json['payee_name'], + 'category_id': json['category_id'] == null ? undefined : json['category_id'], + 'memo': json['memo'] == null ? undefined : json['memo'], + 'flag_color': json['flag_color'] == null ? undefined : TransactionFlagColorFromJSON(json['flag_color']), + 'frequency': json['frequency'] == null ? undefined : ScheduledTransactionFrequencyFromJSON(json['frequency']), + }; +} + +export function SaveScheduledTransactionToJSON(value?: SaveScheduledTransaction | null): any { + if (value == null) { + return value; + } + return { + + 'account_id': value['account_id'], + 'date': value['date'], + 'amount': value['amount'], + 'payee_id': value['payee_id'], + 'payee_name': value['payee_name'], + 'category_id': value['category_id'], + 'memo': value['memo'], + 'flag_color': TransactionFlagColorToJSON(value['flag_color']), + 'frequency': ScheduledTransactionFrequencyToJSON(value['frequency']), + }; +} + diff --git a/src/models/SaveSubTransaction.ts b/src/models/SaveSubTransaction.ts index 05c9c8e..69622c5 100644 --- a/src/models/SaveSubTransaction.ts +++ b/src/models/SaveSubTransaction.ts @@ -25,25 +25,25 @@ export interface SaveSubTransaction { * @type {string} * @memberof SaveSubTransaction */ - payee_id?: string; + payee_id?: string | null; /** * The payee name. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a matching payee rename rule (only if import_id is also specified on parent transaction) or (2) a payee with the same name or (3) creation of a new payee. * @type {string} * @memberof SaveSubTransaction */ - payee_name?: string; + payee_name?: string | null; /** * The category for the subtransaction. Credit Card Payment categories are not permitted and will be ignored if supplied. * @type {string} * @memberof SaveSubTransaction */ - category_id?: string; + category_id?: string | null; /** * * @type {string} * @memberof SaveSubTransaction */ - memo?: string; + memo?: string | null; } /** diff --git a/src/models/SaveTransactionWithIdOrImportId.ts b/src/models/SaveTransactionWithIdOrImportId.ts index f2207de..4899281 100644 --- a/src/models/SaveTransactionWithIdOrImportId.ts +++ b/src/models/SaveTransactionWithIdOrImportId.ts @@ -52,29 +52,29 @@ export interface SaveTransactionWithIdOrImportId { */ amount?: number; /** - * The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `tranfer_payee_id` on the account resource. + * The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `transfer_payee_id` on the account resource. * @type {string} * @memberof SaveTransactionWithIdOrImportId */ - payee_id?: string; + payee_id?: string | null; /** * The payee name. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a matching payee rename rule (only if `import_id` is also specified) or (2) a payee with the same name or (3) creation of a new payee. * @type {string} * @memberof SaveTransactionWithIdOrImportId */ - payee_name?: string; + payee_name?: string | null; /** * The category for the transaction. To configure a split transaction, you can specify null for `category_id` and provide a `subtransactions` array as part of the transaction object. If an existing transaction is a split, the `category_id` cannot be changed. Credit Card Payment categories are not permitted and will be ignored if supplied. * @type {string} * @memberof SaveTransactionWithIdOrImportId */ - category_id?: string; + category_id?: string | null; /** * * @type {string} * @memberof SaveTransactionWithIdOrImportId */ - memo?: string; + memo?: string | null; /** * * @type {TransactionClearedStatus} @@ -92,7 +92,7 @@ export interface SaveTransactionWithIdOrImportId { * @type {TransactionFlagColor} * @memberof SaveTransactionWithIdOrImportId */ - flag_color?: TransactionFlagColor; + flag_color?: TransactionFlagColor | null; /** * An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported. * @type {Array} @@ -104,13 +104,13 @@ export interface SaveTransactionWithIdOrImportId { * @type {string} * @memberof SaveTransactionWithIdOrImportId */ - id?: string; + id?: string | null; /** * If specified, this id will be used to lookup a transaction by its `import_id` for the purpose of updating the transaction itself. If not specified, an `id` should be supplied. You may not provide both an `id` and an `import_id` and updating an `import_id` on an existing transaction is not allowed. * @type {string} * @memberof SaveTransactionWithIdOrImportId */ - import_id?: string; + import_id?: string | null; } /** diff --git a/src/models/SaveTransactionWithOptionalFields.ts b/src/models/SaveTransactionWithOptionalFields.ts index 20c02b3..0ad3384 100644 --- a/src/models/SaveTransactionWithOptionalFields.ts +++ b/src/models/SaveTransactionWithOptionalFields.ts @@ -52,29 +52,29 @@ export interface SaveTransactionWithOptionalFields { */ amount?: number; /** - * The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `tranfer_payee_id` on the account resource. + * The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `transfer_payee_id` on the account resource. * @type {string} * @memberof SaveTransactionWithOptionalFields */ - payee_id?: string; + payee_id?: string | null; /** * The payee name. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a matching payee rename rule (only if `import_id` is also specified) or (2) a payee with the same name or (3) creation of a new payee. * @type {string} * @memberof SaveTransactionWithOptionalFields */ - payee_name?: string; + payee_name?: string | null; /** * The category for the transaction. To configure a split transaction, you can specify null for `category_id` and provide a `subtransactions` array as part of the transaction object. If an existing transaction is a split, the `category_id` cannot be changed. Credit Card Payment categories are not permitted and will be ignored if supplied. * @type {string} * @memberof SaveTransactionWithOptionalFields */ - category_id?: string; + category_id?: string | null; /** * * @type {string} * @memberof SaveTransactionWithOptionalFields */ - memo?: string; + memo?: string | null; /** * * @type {TransactionClearedStatus} @@ -92,7 +92,7 @@ export interface SaveTransactionWithOptionalFields { * @type {TransactionFlagColor} * @memberof SaveTransactionWithOptionalFields */ - flag_color?: TransactionFlagColor; + flag_color?: TransactionFlagColor | null; /** * An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported. * @type {Array} diff --git a/src/models/ScheduledSubTransaction.ts b/src/models/ScheduledSubTransaction.ts index 1668132..b552064 100644 --- a/src/models/ScheduledSubTransaction.ts +++ b/src/models/ScheduledSubTransaction.ts @@ -37,25 +37,25 @@ export interface ScheduledSubTransaction { * @type {string} * @memberof ScheduledSubTransaction */ - memo?: string; + memo?: string | null; /** * * @type {string} * @memberof ScheduledSubTransaction */ - payee_id?: string; + payee_id?: string | null; /** * * @type {string} * @memberof ScheduledSubTransaction */ - category_id?: string; + category_id?: string | null; /** * If a transfer, the account_id which the scheduled subtransaction transfers to * @type {string} * @memberof ScheduledSubTransaction */ - transfer_account_id?: string; + transfer_account_id?: string | null; /** * Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests. * @type {boolean} diff --git a/src/models/ScheduledTransactionDetail.ts b/src/models/ScheduledTransactionDetail.ts index d6d8fa1..c775fba 100644 --- a/src/models/ScheduledTransactionDetail.ts +++ b/src/models/ScheduledTransactionDetail.ts @@ -62,19 +62,19 @@ export interface ScheduledTransactionDetail { * @type {string} * @memberof ScheduledTransactionDetail */ - memo?: string; + memo?: string | null; /** * * @type {TransactionFlagColor} * @memberof ScheduledTransactionDetail */ - flag_color?: TransactionFlagColor; + flag_color?: TransactionFlagColor | null; /** * The customized name of a transaction flag * @type {string} * @memberof ScheduledTransactionDetail */ - flag_name?: string; + flag_name?: string | null; /** * * @type {string} @@ -86,19 +86,19 @@ export interface ScheduledTransactionDetail { * @type {string} * @memberof ScheduledTransactionDetail */ - payee_id?: string; + payee_id?: string | null; /** * * @type {string} * @memberof ScheduledTransactionDetail */ - category_id?: string; + category_id?: string | null; /** * If a transfer, the account_id which the scheduled transaction transfers to * @type {string} * @memberof ScheduledTransactionDetail */ - transfer_account_id?: string; + transfer_account_id?: string | null; /** * Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. * @type {boolean} @@ -116,13 +116,13 @@ export interface ScheduledTransactionDetail { * @type {string} * @memberof ScheduledTransactionDetail */ - payee_name?: string; + payee_name?: string | null; /** * The name of the category. If a split scheduled transaction, this will be 'Split'. * @type {string} * @memberof ScheduledTransactionDetail */ - category_name?: string; + category_name?: string | null; /** * If a split scheduled transaction, the subtransactions. * @type {Array} diff --git a/src/models/ScheduledTransactionFrequency.ts b/src/models/ScheduledTransactionFrequency.ts new file mode 100644 index 0000000..44a0831 --- /dev/null +++ b/src/models/ScheduledTransactionFrequency.ts @@ -0,0 +1,55 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * YNAB API Endpoints + * 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 + * + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + + +/** + * The scheduled transaction frequency + * @export + */ +export const ScheduledTransactionFrequency = { + Never: 'never', + Daily: 'daily', + Weekly: 'weekly', + EveryOtherWeek: 'everyOtherWeek', + TwiceAMonth: 'twiceAMonth', + Every4Weeks: 'every4Weeks', + Monthly: 'monthly', + EveryOtherMonth: 'everyOtherMonth', + Every3Months: 'every3Months', + Every4Months: 'every4Months', + TwiceAYear: 'twiceAYear', + Yearly: 'yearly', + EveryOtherYear: 'everyOtherYear' +} as const; +export type ScheduledTransactionFrequency = typeof ScheduledTransactionFrequency[keyof typeof ScheduledTransactionFrequency]; + + +export function instanceOfScheduledTransactionFrequency(value: any): boolean { + for (const key in ScheduledTransactionFrequency) { + if (Object.prototype.hasOwnProperty.call(ScheduledTransactionFrequency, key)) { + if ((ScheduledTransactionFrequency as Record)[key] === value) { + return true; + } + } + } + return false; +} + +export function ScheduledTransactionFrequencyFromJSON(json: any): ScheduledTransactionFrequency { + return ScheduledTransactionFrequencyFromJSONTyped(json, false); +} + +export function ScheduledTransactionFrequencyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ScheduledTransactionFrequency { + return json as ScheduledTransactionFrequency; +} + +export function ScheduledTransactionFrequencyToJSON(value?: ScheduledTransactionFrequency | null): any { + return value as any; +} + diff --git a/src/models/ScheduledTransactionSummary.ts b/src/models/ScheduledTransactionSummary.ts index c63df6c..efbf969 100644 --- a/src/models/ScheduledTransactionSummary.ts +++ b/src/models/ScheduledTransactionSummary.ts @@ -56,19 +56,19 @@ export interface ScheduledTransactionSummary { * @type {string} * @memberof ScheduledTransactionSummary */ - memo?: string; + memo?: string | null; /** * * @type {TransactionFlagColor} * @memberof ScheduledTransactionSummary */ - flag_color?: TransactionFlagColor; + flag_color?: TransactionFlagColor | null; /** * The customized name of a transaction flag * @type {string} * @memberof ScheduledTransactionSummary */ - flag_name?: string; + flag_name?: string | null; /** * * @type {string} @@ -80,19 +80,19 @@ export interface ScheduledTransactionSummary { * @type {string} * @memberof ScheduledTransactionSummary */ - payee_id?: string; + payee_id?: string | null; /** * * @type {string} * @memberof ScheduledTransactionSummary */ - category_id?: string; + category_id?: string | null; /** * If a transfer, the account_id which the scheduled transaction transfers to * @type {string} * @memberof ScheduledTransactionSummary */ - transfer_account_id?: string; + transfer_account_id?: string | null; /** * Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. * @type {boolean} diff --git a/src/models/SubTransaction.ts b/src/models/SubTransaction.ts index 19f7fdb..da75202 100644 --- a/src/models/SubTransaction.ts +++ b/src/models/SubTransaction.ts @@ -37,43 +37,43 @@ export interface SubTransaction { * @type {string} * @memberof SubTransaction */ - memo?: string; + memo?: string | null; /** * * @type {string} * @memberof SubTransaction */ - payee_id?: string; + payee_id?: string | null; /** * * @type {string} * @memberof SubTransaction */ - payee_name?: string; + payee_name?: string | null; /** * * @type {string} * @memberof SubTransaction */ - category_id?: string; + category_id?: string | null; /** * * @type {string} * @memberof SubTransaction */ - category_name?: string; + category_name?: string | null; /** * If a transfer, the account_id which the subtransaction transfers to * @type {string} * @memberof SubTransaction */ - transfer_account_id?: string; + transfer_account_id?: string | null; /** * If a transfer, the id of transaction on the other side of the transfer * @type {string} * @memberof SubTransaction */ - transfer_transaction_id?: string; + transfer_transaction_id?: string | null; /** * Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests. * @type {boolean} diff --git a/src/models/TransactionClearedStatus.ts b/src/models/TransactionClearedStatus.ts index 05c61b2..78ce50b 100644 --- a/src/models/TransactionClearedStatus.ts +++ b/src/models/TransactionClearedStatus.ts @@ -23,7 +23,7 @@ export type TransactionClearedStatus = typeof TransactionClearedStatus[keyof typ export function instanceOfTransactionClearedStatus(value: any): boolean { for (const key in TransactionClearedStatus) { if (Object.prototype.hasOwnProperty.call(TransactionClearedStatus, key)) { - if (TransactionClearedStatus[key as keyof typeof TransactionClearedStatus ] === value) { + if ((TransactionClearedStatus as Record)[key] === value) { return true; } } diff --git a/src/models/TransactionDetail.ts b/src/models/TransactionDetail.ts index 0509348..1c30af8 100644 --- a/src/models/TransactionDetail.ts +++ b/src/models/TransactionDetail.ts @@ -56,7 +56,7 @@ export interface TransactionDetail { * @type {string} * @memberof TransactionDetail */ - memo?: string; + memo?: string | null; /** * * @type {TransactionClearedStatus} @@ -74,13 +74,13 @@ export interface TransactionDetail { * @type {TransactionFlagColor} * @memberof TransactionDetail */ - flag_color?: TransactionFlagColor; + flag_color?: TransactionFlagColor | null; /** * The customized name of a transaction flag * @type {string} * @memberof TransactionDetail */ - flag_name?: string; + flag_name?: string | null; /** * * @type {string} @@ -92,55 +92,55 @@ export interface TransactionDetail { * @type {string} * @memberof TransactionDetail */ - payee_id?: string; + payee_id?: string | null; /** * * @type {string} * @memberof TransactionDetail */ - category_id?: string; + category_id?: string | null; /** * If a transfer transaction, the account to which it transfers * @type {string} * @memberof TransactionDetail */ - transfer_account_id?: string; + transfer_account_id?: string | null; /** * If a transfer transaction, the id of transaction on the other side of the transfer * @type {string} * @memberof TransactionDetail */ - transfer_transaction_id?: string; + transfer_transaction_id?: string | null; /** * If transaction is matched, the id of the matched transaction * @type {string} * @memberof TransactionDetail */ - matched_transaction_id?: string; + matched_transaction_id?: string | null; /** * If the transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. * @type {string} * @memberof TransactionDetail */ - import_id?: string; + import_id?: string | null; /** * If the transaction was imported, the payee name that was used when importing and before applying any payee rename rules * @type {string} * @memberof TransactionDetail */ - import_payee_name?: string; + import_payee_name?: string | null; /** * If the transaction was imported, the original payee name as it appeared on the statement * @type {string} * @memberof TransactionDetail */ - import_payee_name_original?: string; + import_payee_name_original?: string | null; /** * If the transaction is a debt/loan account transaction, the type of transaction * @type {string} * @memberof TransactionDetail */ - debt_transaction_type?: TransactionDetailDebtTransactionTypeEnum; + debt_transaction_type?: TransactionDetailDebtTransactionTypeEnum | null; /** * Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. * @type {boolean} @@ -158,13 +158,13 @@ export interface TransactionDetail { * @type {string} * @memberof TransactionDetail */ - payee_name?: string; + payee_name?: string | null; /** * The name of the category. If a split transaction, this will be 'Split'. * @type {string} * @memberof TransactionDetail */ - category_name?: string; + category_name?: string | null; /** * If a split transaction, the subtransactions. * @type {Array} diff --git a/src/models/TransactionFlagColor.ts b/src/models/TransactionFlagColor.ts index 9640472..caeebf3 100644 --- a/src/models/TransactionFlagColor.ts +++ b/src/models/TransactionFlagColor.ts @@ -19,7 +19,7 @@ export const TransactionFlagColor = { Green: 'green', Blue: 'blue', Purple: 'purple', - + } as const; export type TransactionFlagColor = typeof TransactionFlagColor[keyof typeof TransactionFlagColor]; @@ -27,7 +27,7 @@ export type TransactionFlagColor = typeof TransactionFlagColor[keyof typeof Tran export function instanceOfTransactionFlagColor(value: any): boolean { for (const key in TransactionFlagColor) { if (Object.prototype.hasOwnProperty.call(TransactionFlagColor, key)) { - if (TransactionFlagColor[key as keyof typeof TransactionFlagColor] === value) { + if ((TransactionFlagColor as Record)[key] === value) { return true; } } diff --git a/src/models/TransactionSummary.ts b/src/models/TransactionSummary.ts index 1556c43..2c85941 100644 --- a/src/models/TransactionSummary.ts +++ b/src/models/TransactionSummary.ts @@ -50,7 +50,7 @@ export interface TransactionSummary { * @type {string} * @memberof TransactionSummary */ - memo?: string; + memo?: string | null; /** * * @type {TransactionClearedStatus} @@ -68,13 +68,13 @@ export interface TransactionSummary { * @type {TransactionFlagColor} * @memberof TransactionSummary */ - flag_color?: TransactionFlagColor; + flag_color?: TransactionFlagColor | null; /** * The customized name of a transaction flag * @type {string} * @memberof TransactionSummary */ - flag_name?: string; + flag_name?: string | null; /** * * @type {string} @@ -86,55 +86,55 @@ export interface TransactionSummary { * @type {string} * @memberof TransactionSummary */ - payee_id?: string; + payee_id?: string | null; /** * * @type {string} * @memberof TransactionSummary */ - category_id?: string; + category_id?: string | null; /** * If a transfer transaction, the account to which it transfers * @type {string} * @memberof TransactionSummary */ - transfer_account_id?: string; + transfer_account_id?: string | null; /** * If a transfer transaction, the id of transaction on the other side of the transfer * @type {string} * @memberof TransactionSummary */ - transfer_transaction_id?: string; + transfer_transaction_id?: string | null; /** * If transaction is matched, the id of the matched transaction * @type {string} * @memberof TransactionSummary */ - matched_transaction_id?: string; + matched_transaction_id?: string | null; /** * If the transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. * @type {string} * @memberof TransactionSummary */ - import_id?: string; + import_id?: string | null; /** * If the transaction was imported, the payee name that was used when importing and before applying any payee rename rules * @type {string} * @memberof TransactionSummary */ - import_payee_name?: string; + import_payee_name?: string | null; /** * If the transaction was imported, the original payee name as it appeared on the statement * @type {string} * @memberof TransactionSummary */ - import_payee_name_original?: string; + import_payee_name_original?: string | null; /** * If the transaction is a debt/loan account transaction, the type of transaction * @type {string} * @memberof TransactionSummary */ - debt_transaction_type?: TransactionSummaryDebtTransactionTypeEnum; + debt_transaction_type?: TransactionSummaryDebtTransactionTypeEnum | null; /** * Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. * @type {boolean} diff --git a/src/models/index.ts b/src/models/index.ts index bd6f3fa..b379cd5 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -56,6 +56,7 @@ export * from './PayeeResponseData'; export * from './PayeesResponse'; export * from './PayeesResponseData'; export * from './PostAccountWrapper'; +export * from './PostScheduledTransactionWrapper'; export * from './PostTransactionsWrapper'; export * from './PutTransactionWrapper'; export * from './SaveAccount'; @@ -66,6 +67,7 @@ export * from './SaveMonthCategory'; export * from './SavePayee'; export * from './SavePayeeResponse'; export * from './SavePayeeResponseData'; +export * from './SaveScheduledTransaction'; export * from './SaveSubTransaction'; export * from './SaveTransactionWithIdOrImportId'; export * from './SaveTransactionWithOptionalFields'; @@ -73,6 +75,7 @@ export * from './SaveTransactionsResponse'; export * from './SaveTransactionsResponseData'; export * from './ScheduledSubTransaction'; export * from './ScheduledTransactionDetail'; +export * from './ScheduledTransactionFrequency'; export * from './ScheduledTransactionResponse'; export * from './ScheduledTransactionResponseData'; export * from './ScheduledTransactionSummary';