Skip to content

Commit

Permalink
fix: reuse model in pagination items type (#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Jan 21, 2025
1 parent 12512e5 commit 63d4498
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 143 deletions.
3 changes: 1 addition & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,10 @@ Methods:
Types:

- <code><a href="./src/resources/financial-accounts/statements/line-items.ts">StatementLineItems</a></code>
- <code><a href="./src/resources/financial-accounts/statements/line-items.ts">LineItemListResponse</a></code>

Methods:

- <code title="get /v1/financial_accounts/{financial_account_token}/statements/{statement_token}/line_items">client.financialAccounts.statements.lineItems.<a href="./src/resources/financial-accounts/statements/line-items.ts">list</a>(financialAccountToken, statementToken, { ...params }) -> LineItemListResponsesCursorPage</code>
- <code title="get /v1/financial_accounts/{financial_account_token}/statements/{statement_token}/line_items">client.financialAccounts.statements.lineItems.<a href="./src/resources/financial-accounts/statements/line-items.ts">list</a>(financialAccountToken, statementToken, { ...params }) -> StatementLineItemsDataCursorPage</code>

## LoanTapes

Expand Down
3 changes: 1 addition & 2 deletions src/resources/financial-accounts/statements/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export {
LineItemListResponsesCursorPage,
StatementLineItemsDataCursorPage,
LineItems,
type StatementLineItems,
type LineItemListResponse,
type LineItemListParams,
} from './line-items';
export { StatementsCursorPage, Statements, type Statement, type StatementListParams } from './statements';
141 changes: 7 additions & 134 deletions src/resources/financial-accounts/statements/line-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ export class LineItems extends APIResource {
statementToken: string,
query?: LineItemListParams,
options?: Core.RequestOptions,
): Core.PagePromise<LineItemListResponsesCursorPage, LineItemListResponse>;
): Core.PagePromise<StatementLineItemsDataCursorPage, StatementLineItems.Data>;
list(
financialAccountToken: string,
statementToken: string,
options?: Core.RequestOptions,
): Core.PagePromise<LineItemListResponsesCursorPage, LineItemListResponse>;
): Core.PagePromise<StatementLineItemsDataCursorPage, StatementLineItems.Data>;
list(
financialAccountToken: string,
statementToken: string,
query: LineItemListParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.PagePromise<LineItemListResponsesCursorPage, LineItemListResponse> {
): Core.PagePromise<StatementLineItemsDataCursorPage, StatementLineItems.Data> {
if (isRequestOptions(query)) {
return this.list(financialAccountToken, statementToken, {}, query);
}
return this._client.getAPIList(
`/v1/financial_accounts/${financialAccountToken}/statements/${statementToken}/line_items`,
LineItemListResponsesCursorPage,
StatementLineItemsDataCursorPage,
{ query, ...options },
);
}
}

export class LineItemListResponsesCursorPage extends CursorPage<LineItemListResponse> {}
export class StatementLineItemsDataCursorPage extends CursorPage<StatementLineItems.Data> {}

export interface StatementLineItems {
data: Array<StatementLineItems.Data>;
Expand Down Expand Up @@ -173,141 +173,14 @@ export namespace StatementLineItems {
}
}

export interface LineItemListResponse {
/**
* Globally unique identifier for a Statement Line Item
*/
token: string;

/**
* Transaction amount in cents
*/
amount: number;

category:
| 'ACH'
| 'BALANCE_OR_FUNDING'
| 'CARD'
| 'EXTERNAL_ACH'
| 'EXTERNAL_CHECK'
| 'EXTERNAL_TRANSFER'
| 'EXTERNAL_WIRE'
| 'MANAGEMENT_ADJUSTMENT'
| 'MANAGEMENT_DISPUTE'
| 'MANAGEMENT_FEE'
| 'MANAGEMENT_REWARD';

/**
* Timestamp of when the line item was generated
*/
created: string;

/**
* 3-digit alphabetic ISO 4217 code for the settling currency of the transaction
*/
currency: string;

/**
* Date that the transaction effected the account balance
*/
effective_date: string;

event_type:
| 'ACH_ORIGINATION_CANCELLED'
| 'ACH_ORIGINATION_INITIATED'
| 'ACH_ORIGINATION_PROCESSED'
| 'ACH_ORIGINATION_RELEASED'
| 'ACH_ORIGINATION_REVIEWED'
| 'ACH_ORIGINATION_SETTLED'
| 'ACH_RECEIPT_PROCESSED'
| 'ACH_RECEIPT_SETTLED'
| 'ACH_RETURN_INITIATED'
| 'ACH_RETURN_PROCESSED'
| 'AUTHORIZATION'
| 'AUTHORIZATION_ADVICE'
| 'AUTHORIZATION_EXPIRY'
| 'AUTHORIZATION_REVERSAL'
| 'BALANCE_INQUIRY'
| 'BILLING_ERROR'
| 'BILLING_ERROR_REVERSAL'
| 'CARD_TO_CARD'
| 'CASH_BACK'
| 'CASH_BACK_REVERSAL'
| 'CLEARING'
| 'CORRECTION_CREDIT'
| 'CORRECTION_DEBIT'
| 'CREDIT_AUTHORIZATION'
| 'CREDIT_AUTHORIZATION_ADVICE'
| 'CURRENCY_CONVERSION'
| 'CURRENCY_CONVERSION_REVERSAL'
| 'DISPUTE_WON'
| 'EXTERNAL_ACH_CANCELED'
| 'EXTERNAL_ACH_INITIATED'
| 'EXTERNAL_ACH_RELEASED'
| 'EXTERNAL_ACH_REVERSED'
| 'EXTERNAL_ACH_SETTLED'
| 'EXTERNAL_CHECK_CANCELED'
| 'EXTERNAL_CHECK_INITIATED'
| 'EXTERNAL_CHECK_RELEASED'
| 'EXTERNAL_CHECK_REVERSED'
| 'EXTERNAL_CHECK_SETTLED'
| 'EXTERNAL_TRANSFER_CANCELED'
| 'EXTERNAL_TRANSFER_INITIATED'
| 'EXTERNAL_TRANSFER_RELEASED'
| 'EXTERNAL_TRANSFER_REVERSED'
| 'EXTERNAL_TRANSFER_SETTLED'
| 'EXTERNAL_WIRE_CANCELED'
| 'EXTERNAL_WIRE_INITIATED'
| 'EXTERNAL_WIRE_RELEASED'
| 'EXTERNAL_WIRE_REVERSED'
| 'EXTERNAL_WIRE_SETTLED'
| 'FINANCIAL_AUTHORIZATION'
| 'FINANCIAL_CREDIT_AUTHORIZATION'
| 'INTEREST'
| 'INTEREST_REVERSAL'
| 'LATE_PAYMENT'
| 'LATE_PAYMENT_REVERSAL'
| 'PROVISIONAL_CREDIT'
| 'PROVISIONAL_CREDIT_REVERSAL'
| 'RETURN'
| 'RETURN_REVERSAL'
| 'TRANSFER'
| 'TRANSFER_INSUFFICIENT_FUNDS'
| 'RETURNED_PAYMENT'
| 'RETURNED_PAYMENT_REVERSAL';

/**
* Globally unique identifier for a financial account
*/
financial_account_token: string;

/**
* Globally unique identifier for a financial transaction event
*/
financial_transaction_event_token: string;

/**
* Globally unique identifier for a financial transaction
*/
financial_transaction_token: string;

/**
* Globally unique identifier for a card
*/
card_token?: string;

descriptor?: string;
}

export interface LineItemListParams extends CursorPageParams {}

LineItems.LineItemListResponsesCursorPage = LineItemListResponsesCursorPage;
LineItems.StatementLineItemsDataCursorPage = StatementLineItemsDataCursorPage;

export declare namespace LineItems {
export {
type StatementLineItems as StatementLineItems,
type LineItemListResponse as LineItemListResponse,
LineItemListResponsesCursorPage as LineItemListResponsesCursorPage,
StatementLineItemsDataCursorPage as StatementLineItemsDataCursorPage,
type LineItemListParams as LineItemListParams,
};
}
8 changes: 3 additions & 5 deletions src/resources/financial-accounts/statements/statements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import * as Core from '../../../core';
import * as LineItemsAPI from './line-items';
import {
LineItemListParams,
LineItemListResponse,
LineItemListResponsesCursorPage,
LineItems,
StatementLineItems,
StatementLineItemsDataCursorPage,
} from './line-items';
import { CursorPage, type CursorPageParams } from '../../../pagination';

Expand Down Expand Up @@ -351,7 +350,7 @@ export interface StatementListParams extends CursorPageParams {

Statements.StatementsCursorPage = StatementsCursorPage;
Statements.LineItems = LineItems;
Statements.LineItemListResponsesCursorPage = LineItemListResponsesCursorPage;
Statements.StatementLineItemsDataCursorPage = StatementLineItemsDataCursorPage;

export declare namespace Statements {
export {
Expand All @@ -364,8 +363,7 @@ export declare namespace Statements {
export {
LineItems as LineItems,
type StatementLineItems as StatementLineItems,
type LineItemListResponse as LineItemListResponse,
LineItemListResponsesCursorPage as LineItemListResponsesCursorPage,
StatementLineItemsDataCursorPage as StatementLineItemsDataCursorPage,
type LineItemListParams as LineItemListParams,
};
}

0 comments on commit 63d4498

Please sign in to comment.