Skip to content

Commit

Permalink
Generate from spec version 1.72.0 - get txns by month
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymholt committed Jul 11, 2024
1 parent aff9cb0 commit 9f9ad81
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 1 deletion.
72 changes: 71 additions & 1 deletion 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.71.0
version: 1.72.0
servers:
- url: https://api.ynab.com/v1
security:
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
73 changes: 73 additions & 0 deletions src/apis/TransactionsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ export interface GetTransactionsByCategoryRequest {
lastKnowledgeOfServer?: number;
}

export interface GetTransactionsByMonthRequest {
budgetId: string;
month: string;
sinceDate?: string;
type?: GetTransactionsByMonthTypeEnum;
lastKnowledgeOfServer?: number;
}

export interface GetTransactionsByPayeeRequest {
budgetId: string;
payeeId: string;
Expand Down Expand Up @@ -412,6 +420,63 @@ export class TransactionsApi extends runtime.BaseAPI {
return await response.value();
}

/**
* Returns all transactions for a specified month
* List transactions in month, excluding any pending transactions
*/
async getTransactionsByMonthRaw(requestParameters: GetTransactionsByMonthRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HybridTransactionsResponse>> {
if (requestParameters.budgetId === null || requestParameters.budgetId === undefined) {
throw new runtime.RequiredError('budgetId','Required parameter requestParameters.budgetId was null or undefined when calling getTransactionsByMonth.');
}

if (requestParameters.month === null || requestParameters.month === undefined) {
throw new runtime.RequiredError('month','Required parameter requestParameters.month was null or undefined when calling getTransactionsByMonth.');
}

const queryParameters: any = {};

if (requestParameters.sinceDate !== undefined) {
queryParameters['since_date'] = requestParameters.sinceDate;
}

if (requestParameters.type !== undefined) {
queryParameters['type'] = requestParameters.type;
}

if (requestParameters.lastKnowledgeOfServer !== undefined) {
queryParameters['last_knowledge_of_server'] = requestParameters.lastKnowledgeOfServer;
}

const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Accept'] = '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}/months/{month}/transactions`.replace(`{${"budget_id"}}`, encodeURIComponent(String(requestParameters.budgetId))).replace(`{${"month"}}`, encodeURIComponent(String(requestParameters.month))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => HybridTransactionsResponseFromJSON(jsonValue));
}

/**
* Returns all transactions for a specified month
* List transactions in month, excluding any pending transactions
*/
async getTransactionsByMonth(budgetId: string, month: string, sinceDate?: string, type?: GetTransactionsByMonthTypeEnum, lastKnowledgeOfServer?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HybridTransactionsResponse> {
const response = await this.getTransactionsByMonthRaw({ budgetId: budgetId, month: month, sinceDate: sinceDate, type: type, lastKnowledgeOfServer: lastKnowledgeOfServer }, initOverrides);
return await response.value();
}

/**
* Returns all transactions for a specified payee
* List payee transactions, excluding any pending transactions
Expand Down Expand Up @@ -636,6 +701,14 @@ export const GetTransactionsByCategoryTypeEnum = {
Unapproved: 'unapproved'
} as const;
export type GetTransactionsByCategoryTypeEnum = typeof GetTransactionsByCategoryTypeEnum[keyof typeof GetTransactionsByCategoryTypeEnum];
/**
* @export
*/
export const GetTransactionsByMonthTypeEnum = {
Uncategorized: 'uncategorized',
Unapproved: 'unapproved'
} as const;
export type GetTransactionsByMonthTypeEnum = typeof GetTransactionsByMonthTypeEnum[keyof typeof GetTransactionsByMonthTypeEnum];
/**
* @export
*/
Expand Down

0 comments on commit 9f9ad81

Please sign in to comment.