Skip to content

Commit

Permalink
feat(types): remove incorrectly included Idempotency-Key param (#218)
Browse files Browse the repository at this point in the history
This still works at runtime but it has been removed from type signaures and
the runtime support will be removed shortly.
  • Loading branch information
stainless-bot committed Sep 1, 2023
1 parent 15df031 commit 905b43e
Show file tree
Hide file tree
Showing 51 changed files with 610 additions and 786 deletions.
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Types:
Methods:

- <code title="post /api/account_collection_flows">client.accountCollectionFlows.<a href="./src/resources/account-collection-flows.ts">create</a>({ ...params }) -> AccountCollectionFlow</code>
- <code title="get /api/account_collection_flows/{id}">client.accountCollectionFlows.<a href="./src/resources/account-collection-flows.ts">retrieve</a>(id, { ...params }) -> AccountCollectionFlow</code>
- <code title="get /api/account_collection_flows/{id}">client.accountCollectionFlows.<a href="./src/resources/account-collection-flows.ts">retrieve</a>(id) -> AccountCollectionFlow</code>
- <code title="patch /api/account_collection_flows/{id}">client.accountCollectionFlows.<a href="./src/resources/account-collection-flows.ts">update</a>(id, { ...params }) -> AccountCollectionFlow</code>
- <code title="get /api/account_collection_flows">client.accountCollectionFlows.<a href="./src/resources/account-collection-flows.ts">list</a>({ ...params }) -> AccountCollectionFlowsPage</code>

Expand Down Expand Up @@ -346,7 +346,7 @@ Types:
Methods:

- <code title="post /api/payment_flows">client.paymentFlows.<a href="./src/resources/payment-flows.ts">create</a>({ ...params }) -> PaymentFlow</code>
- <code title="get /api/payment_flows/{id}">client.paymentFlows.<a href="./src/resources/payment-flows.ts">retrieve</a>(id, { ...params }) -> PaymentFlow</code>
- <code title="get /api/payment_flows/{id}">client.paymentFlows.<a href="./src/resources/payment-flows.ts">retrieve</a>(id) -> PaymentFlow</code>
- <code title="patch /api/payment_flows/{id}">client.paymentFlows.<a href="./src/resources/payment-flows.ts">update</a>(id, { ...params }) -> PaymentFlow</code>
- <code title="get /api/payment_flows">client.paymentFlows.<a href="./src/resources/payment-flows.ts">list</a>({ ...params }) -> PaymentFlowsPage</code>

Expand Down
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ export namespace ModernTreasury {
export import AccountCollectionFlow = API.AccountCollectionFlow;
export import AccountCollectionFlowsPage = API.AccountCollectionFlowsPage;
export import AccountCollectionFlowCreateParams = API.AccountCollectionFlowCreateParams;
export import AccountCollectionFlowRetrieveParams = API.AccountCollectionFlowRetrieveParams;
export import AccountCollectionFlowUpdateParams = API.AccountCollectionFlowUpdateParams;
export import AccountCollectionFlowListParams = API.AccountCollectionFlowListParams;

Expand Down Expand Up @@ -399,7 +398,6 @@ export namespace ModernTreasury {
export import PaymentFlow = API.PaymentFlow;
export import PaymentFlowsPage = API.PaymentFlowsPage;
export import PaymentFlowCreateParams = API.PaymentFlowCreateParams;
export import PaymentFlowRetrieveParams = API.PaymentFlowRetrieveParams;
export import PaymentFlowUpdateParams = API.PaymentFlowUpdateParams;
export import PaymentFlowListParams = API.PaymentFlowListParams;

Expand Down
66 changes: 19 additions & 47 deletions src/resources/account-collection-flows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,25 @@ export class AccountCollectionFlows extends APIResource {
params: AccountCollectionFlowCreateParams,
options?: Core.RequestOptions,
): Core.APIPromise<AccountCollectionFlow> {
// @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
if (idempotencyKey) {
console.warn(
"The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
);
}
return this.post('/api/account_collection_flows', {
body,
...options,
headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
});
}

/**
* get account_collection_flow
*/
retrieve(
id: string,
query?: AccountCollectionFlowRetrieveParams,
options?: Core.RequestOptions,
): Core.APIPromise<AccountCollectionFlow>;
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<AccountCollectionFlow>;
retrieve(
id: string,
query: AccountCollectionFlowRetrieveParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<AccountCollectionFlow> {
if (isRequestOptions(query)) {
return this.retrieve(id, {}, query);
}
const { 'Idempotency-Key': idempotencyKey } = query;
return this.get(`/api/account_collection_flows/${id}`, {
...options,
headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
});
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<AccountCollectionFlow> {
return this.get(`/api/account_collection_flows/${id}`, options);
}

/**
Expand All @@ -54,11 +43,17 @@ export class AccountCollectionFlows extends APIResource {
params: AccountCollectionFlowUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise<AccountCollectionFlow> {
// @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
if (idempotencyKey) {
console.warn(
"The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
);
}
return this.patch(`/api/account_collection_flows/${id}`, {
body,
...options,
headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
});
}

Expand Down Expand Up @@ -131,41 +126,19 @@ export interface AccountCollectionFlow {

export interface AccountCollectionFlowCreateParams {
/**
* Body param: Required.
* Required.
*/
counterparty_id: string;

/**
* Body param:
*/
payment_types: Array<string>;

/**
* Header param: This key should be something unique, preferably something like an
* UUID.
*/
'Idempotency-Key'?: string;
}

export interface AccountCollectionFlowRetrieveParams {
/**
* This key should be something unique, preferably something like an UUID.
*/
'Idempotency-Key'?: string;
}

export interface AccountCollectionFlowUpdateParams {
/**
* Body param: Required. The updated status of the account collection flow. Can
* only be used to mark a flow as `cancelled`.
* Required. The updated status of the account collection flow. Can only be used to
* mark a flow as `cancelled`.
*/
status: 'cancelled';

/**
* Header param: This key should be something unique, preferably something like an
* UUID.
*/
'Idempotency-Key'?: string;
}

export interface AccountCollectionFlowListParams extends PageParams {
Expand All @@ -182,7 +155,6 @@ export namespace AccountCollectionFlows {
export import AccountCollectionFlow = API.AccountCollectionFlow;
export type AccountCollectionFlowsPage = _AccountCollectionFlowsPage;
export import AccountCollectionFlowCreateParams = API.AccountCollectionFlowCreateParams;
export import AccountCollectionFlowRetrieveParams = API.AccountCollectionFlowRetrieveParams;
export import AccountCollectionFlowUpdateParams = API.AccountCollectionFlowUpdateParams;
export import AccountCollectionFlowListParams = API.AccountCollectionFlowListParams;
}
20 changes: 10 additions & 10 deletions src/resources/account-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ export class AccountDetails extends APIResource {
params: AccountDetailCreateParams,
options?: Core.RequestOptions,
): Core.APIPromise<AccountDetail> {
// @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
if (idempotencyKey) {
console.warn(
"The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
);
}
return this.post(`/api/${accountsType}/${accountId}/account_details`, {
body,
...options,
headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
});
}

Expand Down Expand Up @@ -122,21 +128,15 @@ export interface AccountDetail {

export interface AccountDetailCreateParams {
/**
* Body param: The account number for the bank account.
* The account number for the bank account.
*/
account_number: string;

/**
* Body param: One of `iban`, `clabe`, `wallet_address`, or `other`. Use `other` if
* the bank account number is in a generic format.
* One of `iban`, `clabe`, `wallet_address`, or `other`. Use `other` if the bank
* account number is in a generic format.
*/
account_number_type?: 'clabe' | 'iban' | 'other' | 'pan' | 'wallet_address';

/**
* Header param: This key should be something unique, preferably something like an
* UUID.
*/
'Idempotency-Key'?: string;
}

export interface AccountDetailListParams extends PageParams {}
Expand Down
84 changes: 40 additions & 44 deletions src/resources/counterparties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ export class Counterparties extends APIResource {
* Create a new counterparty.
*/
create(params: CounterpartyCreateParams, options?: Core.RequestOptions): Core.APIPromise<Counterparty> {
// @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
if (idempotencyKey) {
console.warn(
"The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
);
}
return this.post('/api/counterparties', {
body,
...options,
headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
});
}

Expand Down Expand Up @@ -85,11 +91,17 @@ export class Counterparties extends APIResource {
params: CounterpartyCollectAccountParams,
options?: Core.RequestOptions,
): Core.APIPromise<CounterpartyCollectAccountResponse> {
// @ts-expect-error idempotency key header isn't defined anymore but is included here for back-compat
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
if (idempotencyKey) {
console.warn(
"The Idempotency-Key request param is deprecated, the 'idempotencyToken' option should be set instead",
);
}
return this.post(`/api/counterparties/${id}/collect_account`, {
body,
...options,
headers: { 'Idempotency-Key': idempotencyKey || '', ...options?.headers },
headers: { 'Idempotency-Key': idempotencyKey, ...options?.headers },
});
}
}
Expand Down Expand Up @@ -304,58 +316,49 @@ export interface CounterpartyCollectAccountResponse {

export interface CounterpartyCreateParams {
/**
* Body param: A human friendly name for this counterparty.
* A human friendly name for this counterparty.
*/
name: string | null;

/**
* Body param:
*/
accounting?: CounterpartyCreateParams.Accounting;

/**
* Body param: The accounts for this counterparty.
* The accounts for this counterparty.
*/
accounts?: Array<CounterpartyCreateParams.Account>;

/**
* Body param: The counterparty's email.
* The counterparty's email.
*/
email?: string | null;

/**
* Body param: An optional type to auto-sync the counterparty to your ledger.
* Either `customer` or `vendor`.
* An optional type to auto-sync the counterparty to your ledger. Either `customer`
* or `vendor`.
*/
ledger_type?: 'customer' | 'vendor';

/**
* Body param: Additional data represented as key-value pairs. Both the key and
* value must be strings.
* Additional data represented as key-value pairs. Both the key and value must be
* strings.
*/
metadata?: Record<string, string>;

/**
* Body param: Send an email to the counterparty whenever an associated payment
* order is sent to the bank.
* Send an email to the counterparty whenever an associated payment order is sent
* to the bank.
*/
send_remittance_advice?: boolean;

/**
* Body param: Either a valid SSN or EIN.
* Either a valid SSN or EIN.
*/
taxpayer_identifier?: string;

/**
* Body param: The verification status of the counterparty.
* The verification status of the counterparty.
*/
verification_status?: 'denied' | 'needs_approval' | 'unverified' | 'verified';

/**
* Header param: This key should be something unique, preferably something like an
* UUID.
*/
'Idempotency-Key'?: string;
}

export namespace CounterpartyCreateParams {
Expand Down Expand Up @@ -623,26 +626,25 @@ export interface CounterpartyListParams extends PageParams {

export interface CounterpartyCollectAccountParams {
/**
* Body param: One of `credit` or `debit`. Use `credit` when you want to pay a
* counterparty. Use `debit` when you need to charge a counterparty. This field
* helps us send a more tailored email to your counterparties."
* One of `credit` or `debit`. Use `credit` when you want to pay a counterparty.
* Use `debit` when you need to charge a counterparty. This field helps us send a
* more tailored email to your counterparties."
*/
direction: 'credit' | 'debit';

/**
* Body param: The URL you want your customer to visit upon filling out the form.
* By default, they will be sent to a Modern Treasury landing page. This must be a
* valid HTTPS URL if set.
* The URL you want your customer to visit upon filling out the form. By default,
* they will be sent to a Modern Treasury landing page. This must be a valid HTTPS
* URL if set.
*/
custom_redirect?: string;

/**
* Body param: The list of fields you want on the form. This field is optional and
* if it is not set, will default to [\"nameOnAccount\", \"accountType\",
* \"accountNumber\", \"routingNumber\", \"address\"]. The full list of options is
* [\"name\", \"nameOnAccount\", \"taxpayerIdentifier\", \"accountType\",
* \"accountNumber\", \"routingNumber\", \"address\", \"ibanNumber\",
* \"swiftCode\"].
* The list of fields you want on the form. This field is optional and if it is not
* set, will default to [\"nameOnAccount\", \"accountType\", \"accountNumber\",
* \"routingNumber\", \"address\"]. The full list of options is [\"name\",
* \"nameOnAccount\", \"taxpayerIdentifier\", \"accountType\", \"accountNumber\",
* \"routingNumber\", \"address\", \"ibanNumber\", \"swiftCode\"].
*/
fields?: Array<
| 'name'
Expand All @@ -669,18 +671,12 @@ export interface CounterpartyCollectAccountParams {
>;

/**
* Body param: By default, Modern Treasury will send an email to your counterparty
* that includes a link to the form they must fill out. However, if you would like
* to send the counterparty the link, you can set this parameter to `false`. The
* JSON body will include the link to the secure Modern Treasury form.
* By default, Modern Treasury will send an email to your counterparty that
* includes a link to the form they must fill out. However, if you would like to
* send the counterparty the link, you can set this parameter to `false`. The JSON
* body will include the link to the secure Modern Treasury form.
*/
send_email?: boolean;

/**
* Header param: This key should be something unique, preferably something like an
* UUID.
*/
'Idempotency-Key'?: string;
}

export namespace Counterparties {
Expand Down
Loading

0 comments on commit 905b43e

Please sign in to comment.