Skip to content

Commit

Permalink
Merge pull request #170 from ynab/gen-1.71.0
Browse files Browse the repository at this point in the history
Generate latest from spec version 1.72.0
  • Loading branch information
bradymholt authored Jul 11, 2024
2 parents 33ae786 + b0dac2c commit b898050
Show file tree
Hide file tree
Showing 35 changed files with 896 additions and 286 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ The following methods are available in this library.
| **Transactions** | [transactions.getTransactions(budget_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns budget transactions |
| | [transactions.getTransactionsByAccount(budget_id, account_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns all transactions for a specified account |
| | [transactions.getTransactionsByCategory(budget_id, category_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns all transactions for a specified category |
| | [transactions.getTransactionsByMonth(budget_id, month)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns all transactions for a specified month |
| | [transactions.getTransactionsByType(budget_id, type)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns all transactions of a specified type ("unapproved" or "uncategorized") |
| | [transactions.getTransactionById(budget_id, transaction_id)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Returns a single transaction |
| | [transactions.createTransaction(budget_id, data)](https://github.com/ynab/ynab-sdk-js/blob/main/dist/apis/TransactionsApi.d.ts) | Creates a single transaction |
Expand All @@ -152,6 +153,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

Expand Down
194 changes: 190 additions & 4 deletions open_api_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.72.0
servers:
- url: https://api.ynab.com/v1
security:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1425,6 +1425,76 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/budgets/{budget_id}/months/{month}/transactions:
get:
tags:
- Transactions
summary: List transactions in month, excluding any pending transactions
description: Returns all transactions for a specified month
operationId: getTransactionsByMonth
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
- name: month
in: path
description: >-
The budget month in ISO format (e.g. 2016-12-01) ("current" can also
be used to specify the current calendar month (UTC))
required: true
schema:
type: string
- name: since_date
in: query
description: >-
If specified, only transactions on or after this date will be
included. The date should be ISO formatted (e.g. 2016-12-30).
schema:
type: string
format: date
- name: type
in: query
description: >-
If specified, only transactions of the specified type will be
included. "uncategorized" and "unapproved" are currently supported.
schema:
type: string
enum:
- uncategorized
- unapproved
- name: last_knowledge_of_server
in: query
description: >-
The starting server knowledge. If provided, only entities that have
changed since `last_knowledge_of_server` will be included.
schema:
type: integer
format: int64
responses:
"200":
description: The list of requested transactions
content:
application/json:
schema:
$ref: "#/components/schemas/HybridTransactionsResponse"
"404":
description: No transactions were found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
default:
description: An error occurred
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/budgets/{budget_id}/scheduled_transactions:
get:
tags:
Expand Down Expand Up @@ -1469,6 +1539,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:
Expand Down Expand Up @@ -2401,7 +2512,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
Expand Down Expand Up @@ -2875,6 +2986,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
Expand Down Expand Up @@ -3127,6 +3296,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
Expand Down
3 changes: 3 additions & 0 deletions src/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -75,13 +76,15 @@ models/SaveMonthCategory.ts
models/SavePayee.ts
models/SavePayeeResponse.ts
models/SavePayeeResponseData.ts
models/SaveScheduledTransaction.ts
models/SaveSubTransaction.ts
models/SaveTransactionWithIdOrImportId.ts
models/SaveTransactionWithOptionalFields.ts
models/SaveTransactionsResponse.ts
models/SaveTransactionsResponseData.ts
models/ScheduledSubTransaction.ts
models/ScheduledTransactionDetail.ts
models/ScheduledTransactionFrequency.ts
models/ScheduledTransactionResponse.ts
models/ScheduledTransactionResponseData.ts
models/ScheduledTransactionSummary.ts
Expand Down
2 changes: 1 addition & 1 deletion src/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6.0
7.7.0
56 changes: 56 additions & 0 deletions src/apis/ScheduledTransactionsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<runtime.ApiResponse<ScheduledTransactionResponse>> {
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<ScheduledTransactionResponse> {
const response = await this.createScheduledTransactionRaw({ budgetId: budgetId, data: data }, initOverrides);
return await response.value();
}

/**
* Returns a single scheduled transaction
* Single scheduled transaction
Expand Down
Loading

0 comments on commit b898050

Please sign in to comment.