From a00dd9cf4f2502e138b0c22ff68d8f6061988529 Mon Sep 17 00:00:00 2001 From: Github Actions Bot Date: Fri, 26 Apr 2024 19:42:37 +0000 Subject: [PATCH] feat: sync SDK to OpenAPI doc v2.10.0 --- OPENAPI_VERSION | 2 +- sdk.json | 206 +++++++++++++++++- src/generated/.openapi-generator/FILES | 7 + src/generated/apis/payments-api.ts | 115 ++++++++++ .../models/exchange-rate-request-from.ts | 21 ++ .../models/exchange-rate-request-to.ts | 21 ++ src/generated/models/exchange-rate-request.ts | 34 +++ .../models/exchange-rate-response.ts | 49 +++++ .../models/fetch-exchange-rate-response.ts | 25 +++ src/generated/models/fiat-currency.ts | 22 ++ .../models/fiat-optional-amount-money.ts | 31 +++ src/generated/models/index.ts | 7 + 12 files changed, 538 insertions(+), 2 deletions(-) create mode 100644 src/generated/models/exchange-rate-request-from.ts create mode 100644 src/generated/models/exchange-rate-request-to.ts create mode 100644 src/generated/models/exchange-rate-request.ts create mode 100644 src/generated/models/exchange-rate-response.ts create mode 100644 src/generated/models/fetch-exchange-rate-response.ts create mode 100644 src/generated/models/fiat-currency.ts create mode 100644 src/generated/models/fiat-optional-amount-money.ts diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index c8e38b6..10c2c0c 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -2.9.0 +2.10.0 diff --git a/sdk.json b/sdk.json index a673ca1..fdedb9f 100644 --- a/sdk.json +++ b/sdk.json @@ -6,7 +6,7 @@ } ], "info": { - "version": "2.9.0", + "version": "2.10.0", "title": "All Circle APIs", "description": "Circle's General, Core Functionality, Payments, Payouts, Accounts, and Crypto Payments APIs bundled into one OpenAPI Specification." }, @@ -5439,6 +5439,144 @@ } } }, + "/v1/exchange/quotes": { + "post": { + "security": [ + { + "bearerAuth": [] + } + ], + "summary": "Fetch exchange rate", + "operationId": "exchangeRate", + "description": "Fetches an indicative exchange rate between two currencies. Either the from currency or to currency must be USD.\n\nNote: The current market exchange rate will be applied when Circle receives the deposit.\n", + "tags": ["Payments"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExchangeRateRequest" + }, + "examples": { + "Null amounts": { + "value": { + "from": { + "currency": "MXN" + }, + "to": { + "currency": "USD" + } + } + }, + "Non-null from amount": { + "value": { + "from": { + "amount": 5.05, + "currency": "MXN" + }, + "to": { + "currency": "USD" + } + } + }, + "Non-null to amount": { + "value": { + "from": { + "currency": "MXN" + }, + "to": { + "amount": 5.05, + "currency": "USD" + } + } + } + } + } + } + }, + "responses": { + "201": { + "description": "Successfully fetched exchange rate.", + "headers": { + "X-Request-Id": { + "$ref": "#/components/headers/XRequestId" + } + }, + "content": { + "application/json": { + "schema": { + "title": "FetchExchangeRateResponse", + "properties": { + "data": { + "$ref": "#/components/schemas/ExchangeRateResponse" + } + } + }, + "examples": { + "Null amounts": { + "value": { + "data": { + "id": "8755d0ea-14f9-4259-b092-de23c14b6568", + "rate": 17.0531, + "from": { + "currency": "MXN" + }, + "to": { + "currency": "USD" + }, + "timestamp": "2022-07-21T20:13:35.578678Z" + } + } + }, + "Non-null from amount": { + "value": { + "data": { + "id": "8755d0ea-14f9-4259-b092-de23c14b6568", + "rate": 17.0531, + "from": { + "amount": 5.05, + "currency": "MXN" + }, + "to": { + "amount": 0.29, + "currency": "USD" + }, + "timestamp": "2022-07-21T20:13:35.578678Z" + } + } + }, + "Non-null to amount": { + "value": { + "data": { + "id": "8755d0ea-14f9-4259-b092-de23c14b6568", + "rate": 17.0531, + "from": { + "amount": 96.12, + "currency": "MXN" + }, + "to": { + "amount": 5.05, + "currency": "USD" + }, + "timestamp": "2022-07-21T20:13:35.578678Z" + } + } + } + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/NotAuthorized" + }, + "404": { + "$ref": "#/components/responses/NotFound" + } + } + } + }, "/v1/wallets": { "post": { "security": [ @@ -10754,6 +10892,72 @@ } } }, + "FiatCurrency": { + "type": "string", + "description": "Currency code.", + "title": "Currency", + "enum": ["USD", "EUR", "MXN", "SGD"] + }, + "FiatOptionalAmountMoney": { + "type": "object", + "title": "OptionalAmountMoney", + "required": ["currency"], + "properties": { + "amount": { + "description": "Magnitude of the amount, in units of the currency, with a `.`.", + "type": "string", + "example": "3.14" + }, + "currency": { + "$ref": "#/components/schemas/FiatCurrency" + } + } + }, + "ExchangeRateRequest": { + "type": "object", + "required": ["from", "to"], + "properties": { + "from": { + "allOf": [ + { + "$ref": "#/components/schemas/FiatOptionalAmountMoney" + } + ], + "description": "Amount (Optional) and currency to convert from. If an amount is provided here, then the amount in the \"to\" field must be null." + }, + "to": { + "allOf": [ + { + "$ref": "#/components/schemas/FiatOptionalAmountMoney" + } + ], + "description": "Amount (Optional) and currency to convert to. If an amount is provided here, then the amount in the \"from\" field must be null." + } + } + }, + "ExchangeRateResponse": { + "type": "object", + "required": ["id", "rate", "from", "to", "timestamp"], + "properties": { + "id": { + "$ref": "#/components/schemas/Id" + }, + "rate": { + "description": "Exchange rate", + "type": "number", + "format": "float" + }, + "from": { + "$ref": "#/components/schemas/FiatOptionalAmountMoney" + }, + "to": { + "$ref": "#/components/schemas/FiatOptionalAmountMoney" + }, + "timestamp": { + "$ref": "#/components/schemas/UtcTimestamp" + } + } + }, "Wallet": { "type": "object", "properties": { diff --git a/src/generated/.openapi-generator/FILES b/src/generated/.openapi-generator/FILES index c9854cb..2e4b726 100644 --- a/src/generated/.openapi-generator/FILES +++ b/src/generated/.openapi-generator/FILES @@ -124,14 +124,21 @@ models/detailed-cancel.ts models/detailed-payment.ts models/detailed-refund.ts models/eci.ts +models/exchange-rate-request-from.ts +models/exchange-rate-request-to.ts +models/exchange-rate-request.ts +models/exchange-rate-response.ts models/expire-payment-intent-response.ts models/extend-checkout-session-request.ts models/extend-checkout-session-response.ts models/external-fiat-account-status.ts models/fee.ts +models/fetch-exchange-rate-response.ts models/fiat-cancel.ts +models/fiat-currency.ts models/fiat-money-usd.ts models/fiat-money.ts +models/fiat-optional-amount-money.ts models/fiat-payment-polymorphic.ts models/fiat-payment.ts models/fiat-refund.ts diff --git a/src/generated/apis/payments-api.ts b/src/generated/apis/payments-api.ts index d0c4c17..1449a6a 100644 --- a/src/generated/apis/payments-api.ts +++ b/src/generated/apis/payments-api.ts @@ -44,6 +44,10 @@ import { CreatePaymentResponse } from "../models"; // @ts-ignore import { CreateWirePaymentResponse } from "../models"; // @ts-ignore +import { ExchangeRateRequest } from "../models"; +// @ts-ignore +import { FetchExchangeRateResponse } from "../models"; +// @ts-ignore import { GetPaymentResponse } from "../models"; // @ts-ignore import { ListPaymentsResponse } from "../models"; @@ -289,6 +293,58 @@ export const PaymentsApiAxiosParamCreator = function ( options: localVarRequestOptions }; }, + /** + * Fetches an indicative exchange rate between two currencies. Either the from currency or to currency must be USD. Note: The current market exchange rate will be applied when Circle receives the deposit. + * @summary Fetch exchange rate + * @param {ExchangeRateRequest} [exchangeRateRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + exchangeRate: async ( + exchangeRateRequest?: ExchangeRateRequest, + options: AxiosRequestConfig = {} + ): Promise => { + const localVarPath = `/v1/exchange/quotes`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { + method: "POST", + ...baseOptions, + ...options + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration); + + localVarHeaderParameter["Content-Type"] = "application/json"; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers + }; + localVarRequestOptions.data = serializeDataIfNeeded( + exchangeRateRequest, + localVarRequestOptions, + configuration + ); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions + }; + }, /** * * @summary Get a payment @@ -625,6 +681,33 @@ export const PaymentsApiFp = function (configuration?: Configuration) { configuration ); }, + /** + * Fetches an indicative exchange rate between two currencies. Either the from currency or to currency must be USD. Note: The current market exchange rate will be applied when Circle receives the deposit. + * @summary Fetch exchange rate + * @param {ExchangeRateRequest} [exchangeRateRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async exchangeRate( + exchangeRateRequest?: ExchangeRateRequest, + options?: AxiosRequestConfig + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string + ) => AxiosPromise + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.exchangeRate( + exchangeRateRequest, + options + ); + return createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + ); + }, /** * * @summary Get a payment @@ -814,6 +897,21 @@ export const PaymentsApiFactory = function ( .createPayment(paymentCreationRequest, options) .then((request) => request(axios, basePath)); }, + /** + * Fetches an indicative exchange rate between two currencies. Either the from currency or to currency must be USD. Note: The current market exchange rate will be applied when Circle receives the deposit. + * @summary Fetch exchange rate + * @param {ExchangeRateRequest} [exchangeRateRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + exchangeRate( + exchangeRateRequest?: ExchangeRateRequest, + options?: any + ): AxiosPromise { + return localVarFp + .exchangeRate(exchangeRateRequest, options) + .then((request) => request(axios, basePath)); + }, /** * * @summary Get a payment @@ -970,6 +1068,23 @@ export class PaymentsApi extends BaseAPI { .then((request) => request(this.axios, this.basePath)); } + /** + * Fetches an indicative exchange rate between two currencies. Either the from currency or to currency must be USD. Note: The current market exchange rate will be applied when Circle receives the deposit. + * @summary Fetch exchange rate + * @param {ExchangeRateRequest} [exchangeRateRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PaymentsApi + */ + public exchangeRate( + exchangeRateRequest?: ExchangeRateRequest, + options?: AxiosRequestConfig + ) { + return PaymentsApiFp(this.configuration) + .exchangeRate(exchangeRateRequest, options) + .then((request) => request(this.axios, this.basePath)); + } + /** * * @summary Get a payment diff --git a/src/generated/models/exchange-rate-request-from.ts b/src/generated/models/exchange-rate-request-from.ts new file mode 100644 index 0000000..b1febb2 --- /dev/null +++ b/src/generated/models/exchange-rate-request-from.ts @@ -0,0 +1,21 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { FiatCurrency } from "./fiat-currency"; +// May contain unused imports in some cases +// @ts-ignore +import { FiatOptionalAmountMoney } from "./fiat-optional-amount-money"; + +/** + * @type ExchangeRateRequestFrom + * Amount (Optional) and currency to convert from. If an amount is provided here, then the amount in the \"to\" field must be null. + * @export + */ +export type ExchangeRateRequestFrom = FiatOptionalAmountMoney; diff --git a/src/generated/models/exchange-rate-request-to.ts b/src/generated/models/exchange-rate-request-to.ts new file mode 100644 index 0000000..ed02a6f --- /dev/null +++ b/src/generated/models/exchange-rate-request-to.ts @@ -0,0 +1,21 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { FiatCurrency } from "./fiat-currency"; +// May contain unused imports in some cases +// @ts-ignore +import { FiatOptionalAmountMoney } from "./fiat-optional-amount-money"; + +/** + * @type ExchangeRateRequestTo + * Amount (Optional) and currency to convert to. If an amount is provided here, then the amount in the \"from\" field must be null. + * @export + */ +export type ExchangeRateRequestTo = FiatOptionalAmountMoney; diff --git a/src/generated/models/exchange-rate-request.ts b/src/generated/models/exchange-rate-request.ts new file mode 100644 index 0000000..6729914 --- /dev/null +++ b/src/generated/models/exchange-rate-request.ts @@ -0,0 +1,34 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { ExchangeRateRequestFrom } from "./exchange-rate-request-from"; +// May contain unused imports in some cases +// @ts-ignore +import { ExchangeRateRequestTo } from "./exchange-rate-request-to"; + +/** + * + * @export + * @interface ExchangeRateRequest + */ +export interface ExchangeRateRequest { + /** + * + * @type {ExchangeRateRequestFrom} + * @memberof ExchangeRateRequest + */ + from: ExchangeRateRequestFrom; + /** + * + * @type {ExchangeRateRequestTo} + * @memberof ExchangeRateRequest + */ + to: ExchangeRateRequestTo; +} diff --git a/src/generated/models/exchange-rate-response.ts b/src/generated/models/exchange-rate-response.ts new file mode 100644 index 0000000..cf7b836 --- /dev/null +++ b/src/generated/models/exchange-rate-response.ts @@ -0,0 +1,49 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { FiatOptionalAmountMoney } from "./fiat-optional-amount-money"; + +/** + * + * @export + * @interface ExchangeRateResponse + */ +export interface ExchangeRateResponse { + /** + * Unique system generated identifier for the entity. + * @type {string} + * @memberof ExchangeRateResponse + */ + id: string; + /** + * Exchange rate + * @type {number} + * @memberof ExchangeRateResponse + */ + rate: number; + /** + * + * @type {FiatOptionalAmountMoney} + * @memberof ExchangeRateResponse + */ + from: FiatOptionalAmountMoney; + /** + * + * @type {FiatOptionalAmountMoney} + * @memberof ExchangeRateResponse + */ + to: FiatOptionalAmountMoney; + /** + * ISO-8601 UTC date/time format. + * @type {string} + * @memberof ExchangeRateResponse + */ + timestamp: string; +} diff --git a/src/generated/models/fetch-exchange-rate-response.ts b/src/generated/models/fetch-exchange-rate-response.ts new file mode 100644 index 0000000..0f13208 --- /dev/null +++ b/src/generated/models/fetch-exchange-rate-response.ts @@ -0,0 +1,25 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { ExchangeRateResponse } from "./exchange-rate-response"; + +/** + * + * @export + * @interface FetchExchangeRateResponse + */ +export interface FetchExchangeRateResponse { + /** + * + * @type {ExchangeRateResponse} + * @memberof FetchExchangeRateResponse + */ + data?: ExchangeRateResponse; +} diff --git a/src/generated/models/fiat-currency.ts b/src/generated/models/fiat-currency.ts new file mode 100644 index 0000000..d370533 --- /dev/null +++ b/src/generated/models/fiat-currency.ts @@ -0,0 +1,22 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * Currency code. + * @export + * @enum {string} + */ + +export const FiatCurrency = { + Usd: "USD", + Eur: "EUR", + Mxn: "MXN", + Sgd: "SGD" +} as const; + +export type FiatCurrency = typeof FiatCurrency[keyof typeof FiatCurrency]; diff --git a/src/generated/models/fiat-optional-amount-money.ts b/src/generated/models/fiat-optional-amount-money.ts new file mode 100644 index 0000000..62000d6 --- /dev/null +++ b/src/generated/models/fiat-optional-amount-money.ts @@ -0,0 +1,31 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { FiatCurrency } from "./fiat-currency"; + +/** + * + * @export + * @interface FiatOptionalAmountMoney + */ +export interface FiatOptionalAmountMoney { + /** + * Magnitude of the amount, in units of the currency, with a `.`. + * @type {string} + * @memberof FiatOptionalAmountMoney + */ + amount?: string; + /** + * + * @type {FiatCurrency} + * @memberof FiatOptionalAmountMoney + */ + currency: FiatCurrency; +} diff --git a/src/generated/models/index.ts b/src/generated/models/index.ts index 2fd8571..7ba3bf1 100644 --- a/src/generated/models/index.ts +++ b/src/generated/models/index.ts @@ -95,14 +95,21 @@ export * from "./detailed-cancel"; export * from "./detailed-payment"; export * from "./detailed-refund"; export * from "./eci"; +export * from "./exchange-rate-request"; +export * from "./exchange-rate-request-from"; +export * from "./exchange-rate-request-to"; +export * from "./exchange-rate-response"; export * from "./expire-payment-intent-response"; export * from "./extend-checkout-session-request"; export * from "./extend-checkout-session-response"; export * from "./external-fiat-account-status"; export * from "./fee"; +export * from "./fetch-exchange-rate-response"; export * from "./fiat-cancel"; +export * from "./fiat-currency"; export * from "./fiat-money"; export * from "./fiat-money-usd"; +export * from "./fiat-optional-amount-money"; export * from "./fiat-payment"; export * from "./fiat-payment-polymorphic"; export * from "./fiat-refund";