diff --git a/Earthfile b/Earthfile index f883f478fa..113a711019 100644 --- a/Earthfile +++ b/Earthfile @@ -52,16 +52,9 @@ build-final-spec: SAVE ARTIFACT build/latest.json openapi: - FROM core+base-image - COPY . /src - WORKDIR /src - FOR component IN $(cd ./components && ls -d */) - COPY (./components/$component+openapi/src/components/$component) /src/components/$component - END - FOR component IN $(cd ./ee && ls -d */) - COPY (./ee/$component+openapi/src/ee/$component) /src/ee/$component - END - SAVE ARTIFACT /src + LOCALLY + BUILD ./components+run --TARGET=openapi + BUILD ./ee+run --TARGET=openapi goreleaser: FROM core+builder-image @@ -101,12 +94,8 @@ all-ci-goreleaser: build-all: LOCALLY - FOR component IN $(cd ./components && ls -d */) - BUILD --pass-args ./components/${component}+build-image - END - FOR component IN $(cd ./ee && ls -d */) - BUILD --pass-args ./ee/${component}+build-image - END + BUILD ./components+run --TARGET=build-image + BUILD ./ee+run --TARGET=build-image deploy-all: LOCALLY @@ -118,9 +107,7 @@ deploy-all: BUILD --pass-args ./components/+deploy --components=$component END END - FOR component IN $(cd ./ee && ls -d */) - BUILD --pass-args ./ee/+deploy --components=$component - END + BUILD ./ee+run --TARGET=build-image deployer-module: FROM --pass-args core+base-image diff --git a/components/ledger/openapi.yaml b/components/ledger/openapi.yaml index 3d5f5855bc..cc58c90725 100644 --- a/components/ledger/openapi.yaml +++ b/components/ledger/openapi.yaml @@ -25,6 +25,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read /{ledger}/_info: get: summary: Get information about a ledger @@ -52,6 +55,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read /{ledger}/accounts: head: summary: Count the accounts from a ledger @@ -96,6 +102,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read get: summary: List accounts from a ledger description: List accounts from a ledger, sorted by address in descending order. @@ -236,6 +245,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read /{ledger}/accounts/{address}: get: summary: Get account by its address @@ -274,6 +286,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read /{ledger}/accounts/{address}/metadata: post: summary: Add metadata to an account @@ -316,6 +331,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:write /{ledger}/mapping: get: tags: @@ -343,6 +361,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read put: tags: - ledger.v1 @@ -375,6 +396,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:write /{ledger}/script: post: deprecated: true @@ -417,6 +441,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ScriptResponse' + security: + - Authorization: + - ledger:write /{ledger}/stats: get: tags: @@ -446,6 +473,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read /{ledger}/transactions: head: tags: @@ -546,6 +576,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read get: tags: - ledger.v1 @@ -697,6 +730,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read post: tags: - ledger.v1 @@ -739,6 +775,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:write /{ledger}/transactions/{txid}: get: tags: @@ -775,6 +814,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read /{ledger}/transactions/{txid}/metadata: post: tags: @@ -814,6 +856,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:write /{ledger}/transactions/{txid}/revert: post: tags: @@ -856,6 +901,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:write /{ledger}/transactions/batch: post: tags: @@ -889,6 +937,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:write /{ledger}/balances: get: tags: @@ -960,6 +1011,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read /{ledger}/aggregate/balances: get: tags: @@ -999,6 +1053,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read /{ledger}/logs: get: tags: @@ -1119,6 +1176,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - ledger:read /v2/_info: get: tags: @@ -1145,6 +1205,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read /v2: get: summary: List ledgers @@ -1186,6 +1249,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read /v2/{ledger}: parameters: - name: ledger @@ -1214,6 +1280,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read post: summary: Create a ledger operationId: v2CreateLedger @@ -1234,6 +1303,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:write /v2/{ledger}/metadata: parameters: - name: ledger @@ -1269,6 +1341,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:write /v2/{ledger}/metadata/{key}: parameters: - name: ledger @@ -1300,6 +1375,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:write /v2/{ledger}/_info: get: summary: Get information about a ledger @@ -1328,6 +1406,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read /v2/{ledger}/_bulk: post: summary: Bulk request @@ -1367,6 +1448,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:write /v2/{ledger}/accounts: head: summary: Count the accounts from a ledger @@ -1409,6 +1493,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read get: summary: List accounts from a ledger description: List accounts from a ledger, sorted by address in descending order. @@ -1475,6 +1562,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read /v2/{ledger}/accounts/{address}: get: summary: Get account by its address @@ -1526,6 +1616,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read /v2/{ledger}/accounts/{address}/metadata: post: summary: Add metadata to an account @@ -1580,6 +1673,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:write /v2/{ledger}/accounts/{address}/metadata/{key}: delete: description: Delete metadata by key @@ -1619,6 +1715,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:write /v2/{ledger}/stats: get: tags: @@ -1649,6 +1748,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read /v2/{ledger}/transactions: head: tags: @@ -1691,6 +1793,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read get: tags: - ledger.v2 @@ -1769,6 +1874,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read post: tags: - ledger.v2 @@ -1817,6 +1925,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:write /v2/{ledger}/transactions/{id}: get: tags: @@ -1866,6 +1977,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read /v2/{ledger}/transactions/{id}/metadata: post: tags: @@ -1917,6 +2031,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:write /v2/{ledger}/transactions/{id}/metadata/{key}: delete: description: Delete metadata by key @@ -1959,6 +2076,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:write /v2/{ledger}/transactions/{id}/revert: post: tags: @@ -2008,6 +2128,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:write /v2/{ledger}/aggregate/balances: get: tags: @@ -2054,6 +2177,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read /v2/{ledger}/volumes: get: tags: @@ -2135,6 +2261,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read /v2/{ledger}/logs: get: tags: @@ -2196,6 +2325,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read /v2/{ledger}/logs/import: post: tags: @@ -2224,6 +2356,9 @@ paths: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:write /v2/{ledger}/logs/export: post: summary: Export logs @@ -2250,6 +2385,9 @@ paths: title: bytes type: string format: binary + security: + - Authorization: + - ledger:write components: schemas: AccountsCursorResponse: @@ -2879,37 +3017,6 @@ components: type: array items: $ref: '#/components/schemas/V2Account' - V2BalancesCursorResponse: - type: object - required: - - cursor - properties: - cursor: - type: object - required: - - pageSize - - hasMore - - data - properties: - pageSize: - type: integer - format: int64 - minimum: 1 - maximum: 1000 - example: 15 - hasMore: - type: boolean - example: false - previous: - type: string - example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= - next: - type: string - example: "" - data: - type: array - items: - $ref: '#/components/schemas/V2AccountsBalances' V2TransactionsCursorResponse: type: object required: @@ -3076,17 +3183,6 @@ components: $ref: '#/components/schemas/V2Volumes' effectiveVolumes: $ref: '#/components/schemas/V2Volumes' - V2AccountsBalances: - type: object - additionalProperties: - $ref: '#/components/schemas/V2AssetsBalances' - example: - account1: - USD: 100 - EUR: 23 - account2: - CAD: 20 - JPY: 21 V2AssetsBalances: type: object additionalProperties: @@ -3117,33 +3213,6 @@ components: - asset - destination - source - V2Script: - type: object - properties: - plain: - type: string - example: | - vars { - account $user - } - send [COIN 10] ( - source = @world - destination = $user - ) - vars: - type: object - properties: {} - additionalProperties: true - example: - user: users:042 - reference: - type: string - example: order_1234 - description: Reference to attach to the generated transaction - metadata: - $ref: '#/components/schemas/V2Metadata' - required: - - plain V2Transaction: type: object properties: diff --git a/components/ledger/openapi/v1.yaml b/components/ledger/openapi/v1.yaml index 02d5da083c..319d35c2eb 100644 --- a/components/ledger/openapi/v1.yaml +++ b/components/ledger/openapi/v1.yaml @@ -2,8 +2,7 @@ openapi: 3.0.3 info: title: Ledger API contact: {} - version: "LEDGER_VERSION" - + version: LEDGER_VERSION paths: /_info: get: @@ -12,7 +11,7 @@ paths: summary: Show server information operationId: getInfo responses: - "200": + '200': description: OK content: application/json: @@ -24,7 +23,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read /{ledger}/_info: get: summary: Get information about a ledger @@ -40,7 +41,7 @@ paths: type: string example: ledger001 responses: - "200": + '200': description: OK content: application/json: @@ -52,7 +53,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read /{ledger}/accounts: head: summary: Count the accounts from a ledger @@ -69,13 +72,17 @@ paths: example: ledger001 - name: address in: query - description: Filter accounts by address pattern (regular expression placed between ^ and $). + description: >- + Filter accounts by address pattern (regular expression placed + between ^ and $). schema: type: string example: users:.+ - name: metadata in: query - description: Filter accounts by metadata key value pairs. The filter can be used like this metadata[key]=value1&metadata[a.nested.key]=value2 + description: >- + Filter accounts by metadata key value pairs. The filter can be used + like this metadata[key]=value1&metadata[a.nested.key]=value2 style: deepObject explode: true schema: @@ -83,7 +90,7 @@ paths: additionalProperties: true example: metadata[key]=value1&metadata[a.nested.key]=value2 responses: - "200": + '200': description: OK headers: Count: @@ -97,7 +104,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read get: summary: List accounts from a ledger description: List accounts from a ledger, sorted by address in descending order. @@ -139,19 +148,25 @@ paths: deprecated: true - name: after in: query - description: Pagination cursor, will return accounts after given address, in descending order. + description: >- + Pagination cursor, will return accounts after given address, in + descending order. schema: type: string example: users:003 - name: address in: query - description: Filter accounts by address pattern (regular expression placed between ^ and $). + description: >- + Filter accounts by address pattern (regular expression placed + between ^ and $). schema: type: string example: users:.+ - name: metadata in: query - description: Filter accounts by metadata key value pairs. Nested objects can be used as seen in the example below. + description: >- + Filter accounts by metadata key value pairs. Nested objects can be + used as seen in the example below. style: deepObject explode: true schema: @@ -168,53 +183,77 @@ paths: - name: balanceOperator x-speakeasy-ignore: true in: query - description: | - Operator used for the filtering of balances can be greater than/equal, less than/equal, greater than, less than, equal or not. + description: > + Operator used for the filtering of balances can be greater + than/equal, less than/equal, greater than, less than, equal or not. schema: type: string - enum: [gte, lte, gt, lt, e, ne] + enum: + - gte + - lte + - gt + - lt + - e + - ne example: gte - name: balance_operator x-speakeasy-ignore: true in: query - description: | - Operator used for the filtering of balances can be greater than/equal, less than/equal, greater than, less than, equal or not. + description: > + Operator used for the filtering of balances can be greater + than/equal, less than/equal, greater than, less than, equal or not. + Deprecated, please use `balanceOperator` instead. schema: type: string - enum: [gte, lte, gt, lt, e, ne] + enum: + - gte + - lte + - gt + - lt + - e + - ne example: gte deprecated: true - name: cursor in: query - description: | - Parameter used in pagination requests. Maximum page size is set to 1000. + description: > + Parameter used in pagination requests. Maximum page size is set to + 1000. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when this parameter is set. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== - name: pagination_token in: query - description: | - Parameter used in pagination requests. Maximum page size is set to 1000. + description: > + Parameter used in pagination requests. Maximum page size is set to + 1000. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when this parameter is set. + Deprecated, please use `cursor` instead. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== deprecated: true responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AccountsCursorResponse' - "404": + '404': description: Not found content: application/json: @@ -226,7 +265,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read /{ledger}/accounts/{address}: get: summary: Get account by its address @@ -243,17 +284,21 @@ paths: example: ledger001 - name: address in: path - description: | - Exact address of the account. It must match the following regular expressions pattern: + description: > + Exact address of the account. It must match the following regular + expressions pattern: + ``` + ^\w+(:\w+)*$ + ``` required: true schema: type: string example: users:001 responses: - "200": + '200': description: OK content: application/json: @@ -265,7 +310,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read /{ledger}/accounts/{address}/metadata: post: summary: Add metadata to an account @@ -282,10 +329,14 @@ paths: example: ledger001 - name: address in: path - description: | - Exact address of the account. It must match the following regular expressions pattern: + description: > + Exact address of the account. It must match the following regular + expressions pattern: + ``` + ^\w+(:\w+)*$ + ``` required: true schema: @@ -299,17 +350,18 @@ paths: $ref: '#/components/schemas/Metadata' required: true responses: - "204": + '204': description: No Content content: {} - default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:write /{ledger}/mapping: get: tags: @@ -325,7 +377,7 @@ paths: type: string example: ledger001 responses: - "200": + '200': description: OK content: application/json: @@ -337,7 +389,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read put: tags: - ledger.v1 @@ -358,7 +412,7 @@ paths: $ref: '#/components/schemas/Mapping' required: true responses: - "200": + '200': description: OK content: application/json: @@ -370,7 +424,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:write /{ledger}/script: post: deprecated: true @@ -379,7 +435,8 @@ paths: operationId: runScript summary: Execute a Numscript description: > - This route is deprecated, and has been merged into `POST /{ledger}/transactions`. + This route is deprecated, and has been merged into `POST + /{ledger}/transactions`. parameters: - name: ledger in: path @@ -390,7 +447,9 @@ paths: example: ledger001 - name: preview in: query - description: Set the preview mode. Preview mode doesn't add the logs to the database or publish a message to the message broker. + description: >- + Set the preview mode. Preview mode doesn't add the logs to the + database or publish a message to the message broker. schema: type: boolean example: true @@ -401,12 +460,14 @@ paths: schema: $ref: '#/components/schemas/Script' responses: - "200": + '200': description: > - On success, it will return a 200 status code, and the resulting transaction under the `transaction` field. + On success, it will return a 200 status code, and the resulting + transaction under the `transaction` field. - On failure, it will also return a 200 status code, and the following fields: + On failure, it will also return a 200 status code, and the following + fields: - `details`: contains a URL. When there is an error parsing Numscript, the result can be difficult to read—the provided URL will render the error in an easy-to-read format. - `errorCode` and `error_code` (deprecated): contains the string code of the error - `errorMessage` and `error_message` (deprecated): contains a human-readable indication of what went wrong, for example that an account had insufficient funds, or that there was an error in the provided Numscript. @@ -414,15 +475,18 @@ paths: application/json: schema: $ref: '#/components/schemas/ScriptResponse' - + security: + - Authorization: + - ledger:write /{ledger}/stats: get: tags: - ledger.v1 operationId: readStats summary: Get statistics from a ledger - description: | - Get statistics from a ledger. (aggregate metrics on accounts and transactions) + description: > + Get statistics from a ledger. (aggregate metrics on accounts and + transactions) parameters: - name: ledger in: path @@ -432,7 +496,7 @@ paths: type: string example: ledger001 responses: - "200": + '200': description: OK content: application/json: @@ -444,7 +508,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read /{ledger}/transactions: head: tags: @@ -467,37 +533,47 @@ paths: example: ref:001 - name: account in: query - description: Filter transactions with postings involving given account, either - as source or destination (regular expression placed between ^ and $). + description: >- + Filter transactions with postings involving given account, either as + source or destination (regular expression placed between ^ and $). schema: type: string example: users:001 - name: source in: query - description: Filter transactions with postings involving given account at source (regular expression placed between ^ and $). + description: >- + Filter transactions with postings involving given account at source + (regular expression placed between ^ and $). schema: type: string example: users:001 - name: destination in: query - description: Filter transactions with postings involving given account at destination (regular expression placed between ^ and $). + description: >- + Filter transactions with postings involving given account at + destination (regular expression placed between ^ and $). schema: type: string example: users:001 - name: startTime in: query - description: | + description: > Filter transactions that occurred after this timestamp. - The format is RFC3339 and is inclusive (for example, "2023-01-02T15:04:01Z" includes the first second of 4th minute). + + The format is RFC3339 and is inclusive (for example, + "2023-01-02T15:04:01Z" includes the first second of 4th minute). schema: type: string format: date-time - name: start_time x-speakeasy-ignore: true in: query - description: | + description: > Filter transactions that occurred after this timestamp. - The format is RFC3339 and is inclusive (for example, "2023-01-02T15:04:01Z" includes the first second of 4th minute). + + The format is RFC3339 and is inclusive (for example, + "2023-01-02T15:04:01Z" includes the first second of 4th minute). + Deprecated, please use `startTime` instead. schema: type: string @@ -505,18 +581,23 @@ paths: deprecated: true - name: endTime in: query - description: | + description: > Filter transactions that occurred before this timestamp. - The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute). + + The format is RFC3339 and is exclusive (for example, + "2023-01-02T15:04:01Z" excludes the first second of 4th minute). schema: type: string format: date-time - name: end_time x-speakeasy-ignore: true in: query - description: | + description: > Filter transactions that occurred before this timestamp. - The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute). + + The format is RFC3339 and is exclusive (for example, + "2023-01-02T15:04:01Z" excludes the first second of 4th minute). + Deprecated, please use `endTime` instead. schema: type: string @@ -524,15 +605,17 @@ paths: deprecated: true - name: metadata in: query - description: Filter transactions by metadata key value pairs. Nested objects can be used as seen in the example below. + description: >- + Filter transactions by metadata key value pairs. Nested objects can + be used as seen in the example below. style: deepObject explode: true schema: type: object - properties: { } + properties: {} example: metadata[key]=value1&metadata[a.nested.key]=value2 responses: - "200": + '200': description: OK headers: Count: @@ -546,7 +629,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read get: tags: - ledger.v1 @@ -588,8 +673,9 @@ paths: deprecated: true - name: after in: query - description: Pagination cursor, will return transactions after given txid - (in descending order). + description: >- + Pagination cursor, will return transactions after given txid (in + descending order). schema: type: string example: 1234 @@ -601,37 +687,47 @@ paths: example: ref:001 - name: account in: query - description: Filter transactions with postings involving given account, either - as source or destination (regular expression placed between ^ and $). + description: >- + Filter transactions with postings involving given account, either as + source or destination (regular expression placed between ^ and $). schema: type: string example: users:001 - name: source in: query - description: Filter transactions with postings involving given account at source (regular expression placed between ^ and $). + description: >- + Filter transactions with postings involving given account at source + (regular expression placed between ^ and $). schema: type: string example: users:001 - name: destination in: query - description: Filter transactions with postings involving given account at destination (regular expression placed between ^ and $). + description: >- + Filter transactions with postings involving given account at + destination (regular expression placed between ^ and $). schema: type: string example: users:001 - name: startTime in: query - description: | + description: > Filter transactions that occurred after this timestamp. - The format is RFC3339 and is inclusive (for example, "2023-01-02T15:04:01Z" includes the first second of 4th minute). + + The format is RFC3339 and is inclusive (for example, + "2023-01-02T15:04:01Z" includes the first second of 4th minute). schema: type: string format: date-time - name: start_time x-speakeasy-ignore: true in: query - description: | + description: > Filter transactions that occurred after this timestamp. - The format is RFC3339 and is inclusive (for example, "2023-01-02T15:04:01Z" includes the first second of 4th minute). + + The format is RFC3339 and is inclusive (for example, + "2023-01-02T15:04:01Z" includes the first second of 4th minute). + Deprecated, please use `startTime` instead. schema: type: string @@ -639,18 +735,23 @@ paths: deprecated: true - name: endTime in: query - description: | + description: > Filter transactions that occurred before this timestamp. - The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute). + + The format is RFC3339 and is exclusive (for example, + "2023-01-02T15:04:01Z" excludes the first second of 4th minute). schema: type: string format: date-time - name: end_time x-speakeasy-ignore: true in: query - description: | + description: > Filter transactions that occurred before this timestamp. - The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute). + + The format is RFC3339 and is exclusive (for example, + "2023-01-02T15:04:01Z" excludes the first second of 4th minute). + Deprecated, please use `endTime` instead. schema: type: string @@ -658,10 +759,14 @@ paths: deprecated: true - name: cursor in: query - description: | - Parameter used in pagination requests. Maximum page size is set to 1000. + description: > + Parameter used in pagination requests. Maximum page size is set to + 1000. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when this parameter is set. schema: type: string @@ -669,11 +774,16 @@ paths: - name: pagination_token x-speakeasy-ignore: true in: query - description: | - Parameter used in pagination requests. Maximum page size is set to 1000. + description: > + Parameter used in pagination requests. Maximum page size is set to + 1000. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when this parameter is set. + Deprecated, please use `cursor` instead. schema: type: string @@ -681,14 +791,16 @@ paths: deprecated: true - name: metadata in: query - description: Filter transactions by metadata key value pairs. Nested objects can be used as seen in the example below. + description: >- + Filter transactions by metadata key value pairs. Nested objects can + be used as seen in the example below. style: deepObject explode: true schema: type: object additionalProperties: true responses: - "200": + '200': description: OK content: application/json: @@ -700,7 +812,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read post: tags: - ledger.v1 @@ -716,13 +830,15 @@ paths: example: ledger001 - name: preview in: query - description: Set the preview mode. Preview mode doesn't add the logs to the database or publish a message to the message broker. + description: >- + Set the preview mode. Preview mode doesn't add the logs to the + database or publish a message to the message broker. schema: type: boolean example: true requestBody: required: true - description: > + description: | The request body must contain at least one of the following objects: - `postings`: suitable for simple transactions - `script`: enabling more complex transactions with Numscript @@ -731,20 +847,21 @@ paths: schema: $ref: '#/components/schemas/PostTransaction' responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/TransactionsResponse' - default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:write /{ledger}/transactions/{txid}: get: tags: @@ -769,7 +886,7 @@ paths: minimum: 0 example: 1234 responses: - "200": + '200': description: OK content: application/json: @@ -781,7 +898,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read /{ledger}/transactions/{txid}/metadata: post: tags: @@ -812,7 +931,7 @@ paths: schema: $ref: '#/components/schemas/Metadata' responses: - "204": + '204': description: No Content content: {} default: @@ -821,7 +940,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:write /{ledger}/transactions/{txid}/revert: post: tags: @@ -852,7 +973,7 @@ paths: schema: type: boolean responses: - "201": + '201': description: OK content: application/json: @@ -864,7 +985,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:write /{ledger}/transactions/batch: post: tags: @@ -886,7 +1009,7 @@ paths: $ref: '#/components/schemas/Transactions' required: true responses: - "200": + '200': description: OK content: application/json: @@ -898,7 +1021,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:write /{ledger}/balances: get: tags: @@ -915,8 +1040,9 @@ paths: example: ledger001 - name: address in: query - description: Filter balances involving given account, either - as source or destination. + description: >- + Filter balances involving given account, either as source or + destination. schema: type: string example: users:001 @@ -932,16 +1058,22 @@ paths: default: 15 - name: after in: query - description: Pagination cursor, will return accounts after given address, in descending order. + description: >- + Pagination cursor, will return accounts after given address, in + descending order. schema: type: string example: users:003 - name: cursor in: query - description: | - Parameter used in pagination requests. Maximum page size is set to 1000. + description: > + Parameter used in pagination requests. Maximum page size is set to + 1000. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when this parameter is set. schema: type: string @@ -959,7 +1091,7 @@ paths: example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== deprecated: true responses: - "200": + '200': description: OK content: application/json: @@ -971,7 +1103,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read /{ledger}/aggregate/balances: get: tags: @@ -988,8 +1122,9 @@ paths: example: ledger001 - name: address in: query - description: Filter balances involving given account, either - as source or destination. + description: >- + Filter balances involving given account, either as source or + destination. schema: type: string example: users:001 @@ -1000,7 +1135,7 @@ paths: schema: type: boolean responses: - "200": + '200': description: OK content: application/json: @@ -1012,7 +1147,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read /{ledger}/logs: get: tags: @@ -1055,25 +1192,31 @@ paths: deprecated: true - name: after in: query - description: Pagination cursor, will return the logs after a given ID. - (in descending order). + description: >- + Pagination cursor, will return the logs after a given ID. (in + descending order). schema: type: string example: 1234 - name: startTime in: query - description: | + description: > Filter transactions that occurred after this timestamp. - The format is RFC3339 and is inclusive (for example, "2023-01-02T15:04:01Z" includes the first second of 4th minute). + + The format is RFC3339 and is inclusive (for example, + "2023-01-02T15:04:01Z" includes the first second of 4th minute). schema: type: string format: date-time - name: start_time x-speakeasy-ignore: true in: query - description: | + description: > Filter transactions that occurred after this timestamp. - The format is RFC3339 and is inclusive (for example, "2023-01-02T15:04:01Z" includes the first second of 4th minute). + + The format is RFC3339 and is inclusive (for example, + "2023-01-02T15:04:01Z" includes the first second of 4th minute). + Deprecated, please use `startTime` instead. schema: type: string @@ -1081,18 +1224,23 @@ paths: deprecated: true - name: endTime in: query - description: | + description: > Filter transactions that occurred before this timestamp. - The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute). + + The format is RFC3339 and is exclusive (for example, + "2023-01-02T15:04:01Z" excludes the first second of 4th minute). schema: type: string format: date-time - name: end_time x-speakeasy-ignore: true in: query - description: | + description: > Filter transactions that occurred before this timestamp. - The format is RFC3339 and is exclusive (for example, "2023-01-02T15:04:01Z" excludes the first second of 4th minute). + + The format is RFC3339 and is exclusive (for example, + "2023-01-02T15:04:01Z" excludes the first second of 4th minute). + Deprecated, please use `endTime` instead. schema: type: string @@ -1100,10 +1248,14 @@ paths: deprecated: true - name: cursor in: query - description: | - Parameter used in pagination requests. Maximum page size is set to 1000. + description: > + Parameter used in pagination requests. Maximum page size is set to + 1000. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when this parameter is set. schema: type: string @@ -1111,18 +1263,23 @@ paths: - name: pagination_token x-speakeasy-ignore: true in: query - description: | - Parameter used in pagination requests. Maximum page size is set to 1000. + description: > + Parameter used in pagination requests. Maximum page size is set to + 1000. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when this parameter is set. + Deprecated, please use `cursor` instead. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== deprecated: true responses: - "200": + '200': description: OK content: application/json: @@ -1134,7 +1291,9 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - ledger:read components: schemas: AccountsCursorResponse: @@ -1160,15 +1319,14 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: $ref: '#/components/schemas/Account' - BalancesCursorResponse: type: object required: @@ -1192,15 +1350,14 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: $ref: '#/components/schemas/AccountsBalances' - TransactionsCursorResponse: type: object required: @@ -1224,15 +1381,14 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: $ref: '#/components/schemas/Transaction' - LogsCursorResponse: type: object required: @@ -1256,15 +1412,14 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: $ref: '#/components/schemas/Log' - AccountResponse: type: object required: @@ -1272,7 +1427,6 @@ components: properties: data: $ref: '#/components/schemas/AccountWithVolumesAndBalances' - AggregateBalancesResponse: type: object required: @@ -1280,7 +1434,6 @@ components: properties: data: $ref: '#/components/schemas/AssetsBalances' - Config: type: object properties: @@ -1288,7 +1441,6 @@ components: $ref: '#/components/schemas/LedgerStorage' required: - storage - LedgerStorage: type: object properties: @@ -1301,12 +1453,10 @@ components: required: - driver - ledgers - Metadata: type: object nullable: true additionalProperties: {} - ConfigInfo: type: object properties: @@ -1320,7 +1470,6 @@ components: - config - server - version - ScriptResponse: type: object properties: @@ -1328,13 +1477,13 @@ components: $ref: '#/components/schemas/ErrorsEnum' errorMessage: type: string - example: "account had insufficient funds" + example: account had insufficient funds details: type: string - example: "https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9" + example: >- + https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9 transaction: $ref: '#/components/schemas/Transaction' - Account: type: object required: @@ -1349,8 +1498,11 @@ components: metadata: type: object additionalProperties: true - example: { admin: true, a: { nested: { key: value}} } - + example: + admin: true + a: + nested: + key: value AccountWithVolumesAndBalances: type: object required: @@ -1365,7 +1517,11 @@ components: metadata: type: object additionalProperties: true - example: { admin: true, a: { nested: { key: value}} } + example: + admin: true + a: + nested: + key: value volumes: $ref: '#/components/schemas/Volumes' balances: @@ -1375,7 +1531,6 @@ components: format: bigint example: COIN: 100 - AccountsBalances: type: object additionalProperties: @@ -1387,7 +1542,6 @@ components: account2: CAD: 20 JPY: 21 - AssetsBalances: type: object additionalProperties: @@ -1396,7 +1550,6 @@ components: example: USD: 100 EUR: 12 - Contract: type: object properties: @@ -1408,7 +1561,6 @@ components: required: - accounts - expr - Mapping: type: object nullable: true @@ -1419,7 +1571,6 @@ components: type: array items: $ref: '#/components/schemas/Contract' - Posting: type: object properties: @@ -1442,7 +1593,6 @@ components: - asset - destination - source - Script: type: object properties: @@ -1452,9 +1602,8 @@ components: vars: type: object additionalProperties: true - example: { - "user": "users:042" - } + example: + user: users:042 reference: type: string example: order_1234 @@ -1463,7 +1612,6 @@ components: $ref: '#/components/schemas/Metadata' required: - plain - Transaction: type: object properties: @@ -1491,7 +1639,6 @@ components: - postings - timestamp - txid - TransactionData: type: object required: @@ -1509,7 +1656,6 @@ components: timestamp: type: string format: date-time - Transactions: required: - transactions @@ -1519,7 +1665,6 @@ components: type: array items: $ref: '#/components/schemas/TransactionData' - PostTransaction: type: object properties: @@ -1539,9 +1684,8 @@ components: vars: type: object additionalProperties: true - example: { - "user": "users:042" - } + example: + user: users:042 required: - plain reference: @@ -1549,7 +1693,6 @@ components: example: ref:001 metadata: $ref: '#/components/schemas/Metadata' - Stats: type: object properties: @@ -1564,7 +1707,6 @@ components: required: - accounts - transactions - Log: type: object properties: @@ -1583,7 +1725,7 @@ components: additionalProperties: true hash: type: string - example: "9ee060170400f556b7e1575cb13f9db004f150a08355c7431c62bc639166431e" + example: 9ee060170400f556b7e1575cb13f9db004f150a08355c7431c62bc639166431e date: type: string format: date-time @@ -1593,7 +1735,6 @@ components: - data - hash - date - TransactionsResponse: type: object properties: @@ -1603,7 +1744,6 @@ components: type: array required: - data - TransactionResponse: properties: data: @@ -1611,7 +1751,6 @@ components: type: object required: - data - StatsResponse: properties: data: @@ -1619,13 +1758,11 @@ components: type: object required: - data - MappingResponse: properties: data: $ref: '#/components/schemas/Mapping' type: object - ConfigInfoResponse: properties: data: @@ -1633,7 +1770,6 @@ components: type: object required: - data - Volume: type: object properties: @@ -1653,7 +1789,6 @@ components: input: 100 output: 20 balance: 80 - Volumes: type: object additionalProperties: @@ -1667,23 +1802,21 @@ components: input: 100 output: 10 balance: 90 - AggregatedVolumes: type: object additionalProperties: $ref: '#/components/schemas/Volumes' example: - "orders:1": - "USD": + orders:1: + USD: input: 100 output: 10 balance: 90 - "orders:2": - "USD": + orders:2: + USD: input: 100 output: 10 balance: 90 - ErrorResponse: type: object required: @@ -1694,11 +1827,11 @@ components: $ref: '#/components/schemas/ErrorsEnum' errorMessage: type: string - example: "[INSUFFICIENT_FUND] account had insufficient funds" + example: '[INSUFFICIENT_FUND] account had insufficient funds' details: type: string - example: "https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9" - + example: >- + https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9 ErrorsEnum: type: string enum: @@ -1711,12 +1844,10 @@ components: - METADATA_OVERRIDE - NOT_FOUND example: INSUFFICIENT_FUND - LedgerInfoResponse: properties: data: $ref: '#/components/schemas/LedgerInfo' - LedgerInfo: type: object properties: @@ -1730,7 +1861,6 @@ components: type: array items: $ref: '#/components/schemas/MigrationInfo' - MigrationInfo: type: object properties: @@ -1748,5 +1878,5 @@ components: state: type: string enum: - - "TO DO" - - "DONE" + - TO DO + - DONE diff --git a/components/ledger/openapi/v2.yaml b/components/ledger/openapi/v2.yaml index 9e2c22f107..1ecc4a9afd 100644 --- a/components/ledger/openapi/v2.yaml +++ b/components/ledger/openapi/v2.yaml @@ -2,15 +2,13 @@ openapi: 3.0.3 info: title: Ledger API contact: {} - version: "LEDGER_VERSION" - + version: LEDGER_VERSION servers: - url: http://localhost:8080/ - paths: x-speakeasy-errors: statusCodes: - - "default" + - default /v2/_info: get: tags: @@ -19,24 +17,27 @@ paths: operationId: v2GetInfo x-speakeasy-name-override: GetInfo responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2ConfigInfoResponse' - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - "5XX": + 5XX: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' + security: + - Authorization: + - ledger:read /v2: get: summary: List ledgers @@ -57,28 +58,34 @@ paths: maximum: 1000 - name: cursor in: query - description: | - Parameter used in pagination requests. Maximum page size is set to 15. + description: > + Parameter used in pagination requests. Maximum page size is set to + 15. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when this parameter is set. schema: type: string example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2LedgerListResponse' - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read /v2/{ledger}: parameters: - name: ledger @@ -88,7 +95,6 @@ paths: schema: type: string example: ledger001 - get: summary: Get a ledger operationId: v2GetLedger @@ -96,19 +102,21 @@ paths: tags: - ledger.v2 responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2GetLedgerResponse' - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read post: summary: Create a ledger operationId: v2CreateLedger @@ -121,16 +129,17 @@ paths: schema: $ref: '#/components/schemas/V2CreateLedgerRequest' responses: - "204": + '204': description: OK - - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:write /v2/{ledger}/metadata: parameters: - name: ledger @@ -140,7 +149,6 @@ paths: schema: type: string example: ledger001 - put: summary: Update ledger metadata operationId: v2UpdateLedgerMetadata @@ -153,22 +161,23 @@ paths: schema: $ref: '#/components/schemas/V2UpdateLedgerMetadataRequest' responses: - "204": + '204': description: OK - - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - "5XX": + 5XX: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:write /v2/{ledger}/metadata/{key}: parameters: - name: ledger @@ -185,7 +194,6 @@ paths: schema: type: string example: foo - delete: summary: Delete ledger metadata by key operationId: v2DeleteLedgerMetadata @@ -193,16 +201,17 @@ paths: tags: - ledger.v2 responses: - "204": + '204': description: OK - - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:write /v2/{ledger}/_info: get: summary: Get information about a ledger @@ -219,19 +228,21 @@ paths: type: string example: ledger001 responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2LedgerInfoResponse' - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read /v2/{ledger}/_bulk: post: summary: Bulk request @@ -240,40 +251,40 @@ paths: tags: - ledger.v2 parameters: - - name: ledger - in: path - description: Name of the ledger. - required: true - schema: - type: string - example: ledger001 + - name: ledger + in: path + description: Name of the ledger. + required: true + schema: + type: string + example: ledger001 requestBody: content: application/json: schema: $ref: '#/components/schemas/V2Bulk' responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2BulkResponse' - - "400": + '400': description: OK content: application/json: schema: $ref: '#/components/schemas/V2BulkResponse' - - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:write /v2/{ledger}/accounts: head: summary: Count the accounts from a ledger @@ -302,7 +313,7 @@ paths: type: object additionalProperties: true responses: - "204": + '204': description: OK headers: Count: @@ -310,13 +321,15 @@ paths: type: integer format: bigint minimum: 0 - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read get: summary: List accounts from a ledger description: List accounts from a ledger, sorted by address in descending order. @@ -344,10 +357,14 @@ paths: maximum: 1000 - name: cursor in: query - description: | - Parameter used in pagination requests. Maximum page size is set to 15. + description: > + Parameter used in pagination requests. Maximum page size is set to + 15. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when this parameter is set. schema: type: string @@ -371,20 +388,21 @@ paths: type: object additionalProperties: true responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2AccountsCursorResponse' - - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read /v2/{ledger}/accounts/{address}: get: summary: Get account by its address @@ -402,10 +420,14 @@ paths: example: ledger001 - name: address in: path - description: | - Exact address of the account. It must match the following regular expressions pattern: + description: > + Exact address of the account. It must match the following regular + expressions pattern: + ``` + ^\w+(:\w+)*$ + ``` required: true schema: @@ -424,19 +446,21 @@ paths: type: string format: date-time responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2AccountResponse' - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read /v2/{ledger}/accounts/{address}/metadata: post: summary: Add metadata to an account @@ -454,10 +478,14 @@ paths: example: ledger001 - name: address in: path - description: | - Exact address of the account. It must match the following regular expressions pattern: + description: > + Exact address of the account. It must match the following regular + expressions pattern: + ``` + ^\w+(:\w+)*$ + ``` required: true schema: @@ -465,7 +493,9 @@ paths: example: users:001 - name: dryRun in: query - description: Set the dry run mode. Dry run mode doesn't add the logs to the database or publish a message to the message broker. + description: >- + Set the dry run mode. Dry run mode doesn't add the logs to the + database or publish a message to the message broker. schema: type: boolean example: true @@ -482,17 +512,18 @@ paths: $ref: '#/components/schemas/V2Metadata' required: true responses: - "204": + '204': description: No Content content: {} - - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:write /v2/{ledger}/accounts/{address}/metadata/{key}: delete: description: Delete metadata by key @@ -526,13 +557,15 @@ paths: 2XX: description: Key deleted content: {} - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:write /v2/{ledger}/stats: get: tags: @@ -540,8 +573,9 @@ paths: operationId: v2ReadStats x-speakeasy-name-override: ReadStats summary: Get statistics from a ledger - description: | - Get statistics from a ledger. (aggregate metrics on accounts and transactions) + description: > + Get statistics from a ledger. (aggregate metrics on accounts and + transactions) parameters: - name: ledger in: path @@ -551,19 +585,21 @@ paths: type: string example: ledger001 responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2StatsResponse' - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read /v2/{ledger}/transactions: head: tags: @@ -592,7 +628,7 @@ paths: type: object additionalProperties: true responses: - "204": + '204': description: OK headers: Count: @@ -600,13 +636,15 @@ paths: type: integer format: int64 minimum: 0 - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read get: tags: - ledger.v2 @@ -634,10 +672,14 @@ paths: maximum: 1000 - name: cursor in: query - description: | - Parameter used in pagination requests. Maximum page size is set to 15. + description: > + Parameter used in pagination requests. Maximum page size is set to + 15. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when this parameter is set. schema: type: string @@ -673,20 +715,21 @@ paths: type: object additionalProperties: true responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2TransactionsCursorResponse' - - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read post: tags: - ledger.v2 @@ -703,7 +746,9 @@ paths: example: ledger001 - name: dryRun in: query - description: Set the dryRun mode. dry run mode doesn't add the logs to the database or publish a message to the message broker. + description: >- + Set the dryRun mode. dry run mode doesn't add the logs to the + database or publish a message to the message broker. schema: type: boolean example: true @@ -714,7 +759,7 @@ paths: type: string requestBody: required: true - description: > + description: | The request body must contain at least one of the following objects: - `postings`: suitable for simple transactions - `script`: enabling more complex transactions with Numscript @@ -723,20 +768,21 @@ paths: schema: $ref: '#/components/schemas/V2PostTransaction' responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2CreateTransactionResponse' - - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:write /v2/{ledger}/transactions/{id}: get: tags: @@ -774,20 +820,21 @@ paths: type: string format: date-time responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2GetTransactionResponse' - - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read /v2/{ledger}/transactions/{id}/metadata: post: tags: @@ -814,7 +861,9 @@ paths: example: 1234 - name: dryRun in: query - description: Set the dryRun mode. Dry run mode doesn't add the logs to the database or publish a message to the message broker. + description: >- + Set the dryRun mode. Dry run mode doesn't add the logs to the + database or publish a message to the message broker. schema: type: boolean example: true @@ -830,17 +879,18 @@ paths: schema: $ref: '#/components/schemas/V2Metadata' responses: - "204": + '204': description: No Content content: {} - - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:write /v2/{ledger}/transactions/{id}/metadata/{key}: delete: description: Delete metadata by key @@ -876,15 +926,16 @@ paths: responses: 2XX: description: Key deleted - content: { } - - "default": + content: {} + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:write /v2/{ledger}/transactions/{id}/revert: post: tags: @@ -922,20 +973,21 @@ paths: schema: type: boolean responses: - "201": + '201': description: OK content: application/json: schema: $ref: '#/components/schemas/V2RevertTransactionResponse' - - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:write /v2/{ledger}/aggregate/balances: get: tags: @@ -970,19 +1022,21 @@ paths: type: object additionalProperties: true responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2AggregateBalancesResponse' - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read /v2/{ledger}/volumes: get: tags: @@ -1003,10 +1057,14 @@ paths: maximum: 1000 - name: cursor in: query - description: | - Parameter used in pagination requests. Maximum page size is set to 15. + description: > + Parameter used in pagination requests. Maximum page size is set to + 15. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when this parameter is set. schema: type: string @@ -1052,19 +1110,21 @@ paths: type: object additionalProperties: true responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2VolumesWithBalanceCursorResponse' - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read /v2/{ledger}/logs: get: tags: @@ -1093,10 +1153,14 @@ paths: maximum: 1000 - name: cursor in: query - description: | - Parameter used in pagination requests. Maximum page size is set to 15. + description: > + Parameter used in pagination requests. Maximum page size is set to + 15. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when this parameter is set. schema: type: string @@ -1114,19 +1178,21 @@ paths: type: object additionalProperties: true responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/V2LogsCursorResponse' - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:read /v2/{ledger}/logs/import: post: tags: @@ -1147,15 +1213,17 @@ paths: schema: type: string responses: - 204: + '204': description: Import OK - "default": + default: description: Error content: application/json: schema: $ref: '#/components/schemas/V2ErrorResponse' - + security: + - Authorization: + - ledger:write /v2/{ledger}/logs/export: post: summary: Export logs @@ -1172,9 +1240,9 @@ paths: type: string example: ledger001 responses: - 200: + '200': description: Import OK - "default": + default: description: Error content: application/octet-stream: @@ -1182,7 +1250,9 @@ paths: title: bytes type: string format: binary - + security: + - Authorization: + - ledger:write components: schemas: V2AccountsCursorResponse: @@ -1208,47 +1278,14 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: $ref: '#/components/schemas/V2Account' - - V2BalancesCursorResponse: - type: object - required: - - cursor - properties: - cursor: - type: object - required: - - pageSize - - hasMore - - data - properties: - pageSize: - type: integer - format: int64 - minimum: 1 - maximum: 1000 - example: 15 - hasMore: - type: boolean - example: false - previous: - type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" - next: - type: string - example: "" - data: - type: array - items: - $ref: '#/components/schemas/V2AccountsBalances' - V2TransactionsCursorResponse: type: object required: @@ -1272,15 +1309,14 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: $ref: '#/components/schemas/V2ExpandedTransaction' - V2LogsCursorResponse: type: object required: @@ -1304,15 +1340,14 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: $ref: '#/components/schemas/V2Log' - V2AccountResponse: type: object required: @@ -1320,7 +1355,6 @@ components: properties: data: $ref: '#/components/schemas/V2Account' - V2AggregateBalancesResponse: type: object required: @@ -1328,7 +1362,6 @@ components: properties: data: $ref: '#/components/schemas/V2AssetsBalances' - V2VolumesWithBalanceCursorResponse: type: object required: @@ -1352,15 +1385,14 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: $ref: '#/components/schemas/V2VolumesWithBalance' - V2VolumesWithBalance: type: object properties: @@ -1383,13 +1415,12 @@ components: - input - output - balance - V2Metadata: type: object additionalProperties: type: string - example: { admin: "true" } - + example: + admin: 'true' V2ConfigInfo: type: object properties: @@ -1401,7 +1432,6 @@ components: - config - server - version - V2Account: type: object required: @@ -1416,24 +1446,12 @@ components: properties: {} additionalProperties: type: string - example: { admin: "true" } + example: + admin: 'true' volumes: $ref: '#/components/schemas/V2Volumes' effectiveVolumes: $ref: '#/components/schemas/V2Volumes' - - V2AccountsBalances: - type: object - additionalProperties: - $ref: '#/components/schemas/V2AssetsBalances' - example: - account1: - USD: 100 - EUR: 23 - account2: - CAD: 20 - JPY: 21 - V2AssetsBalances: type: object additionalProperties: @@ -1442,9 +1460,6 @@ components: example: USD: 100 EUR: 12 - - - V2Posting: type: object properties: @@ -1467,29 +1482,6 @@ components: - asset - destination - source - - V2Script: - type: object - properties: - plain: - type: string - example: "vars {\naccount $user\n}\nsend [COIN 10] (\n\tsource = @world\n\tdestination = $user\n)\n" - vars: - type: object - properties: {} - additionalProperties: true - example: { - "user": "users:042" - } - reference: - type: string - example: order_1234 - description: Reference to attach to the generated transaction - metadata: - $ref: '#/components/schemas/V2Metadata' - required: - - plain - V2Transaction: type: object properties: @@ -1512,26 +1504,24 @@ components: reverted: type: boolean required: - - postings - - timestamp - - id - - metadata - - reverted - + - postings + - timestamp + - id + - metadata + - reverted V2ExpandedTransaction: allOf: - - $ref: '#/components/schemas/V2Transaction' - - type: object - properties: - preCommitVolumes: - $ref: '#/components/schemas/V2AggregatedVolumes' - postCommitVolumes: - $ref: '#/components/schemas/V2AggregatedVolumes' - + - $ref: '#/components/schemas/V2Transaction' + - type: object + properties: + preCommitVolumes: + $ref: '#/components/schemas/V2AggregatedVolumes' + postCommitVolumes: + $ref: '#/components/schemas/V2AggregatedVolumes' V2PostTransaction: type: object required: - - metadata + - metadata properties: timestamp: type: string @@ -1550,9 +1540,8 @@ components: type: object properties: {} additionalProperties: true - example: { - "user": "users:042" - } + example: + user: users:042 required: - plain reference: @@ -1560,7 +1549,6 @@ components: example: ref:001 metadata: $ref: '#/components/schemas/V2Metadata' - V2Stats: type: object properties: @@ -1575,7 +1563,6 @@ components: required: - accounts - transactions - V2Log: type: object properties: @@ -1596,7 +1583,7 @@ components: additionalProperties: true hash: type: string - example: "9ee060170400f556b7e1575cb13f9db004f150a08355c7431c62bc639166431e" + example: 9ee060170400f556b7e1575cb13f9db004f150a08355c7431c62bc639166431e date: type: string format: date-time @@ -1606,7 +1593,6 @@ components: - data - hash - date - V2CreateTransactionResponse: properties: data: @@ -1614,18 +1600,15 @@ components: type: object required: - data - V2RevertTransactionResponse: $ref: '#/components/schemas/V2CreateTransactionResponse' - V2GetTransactionResponse: properties: data: $ref: '#/components/schemas/V2ExpandedTransaction' type: object required: - - data - + - data V2StatsResponse: properties: data: @@ -1633,10 +1616,8 @@ components: type: object required: - data - V2ConfigInfoResponse: $ref: '#/components/schemas/V2ConfigInfo' - V2Volume: type: object properties: @@ -1656,7 +1637,6 @@ components: input: 100 output: 20 balance: 80 - V2Volumes: type: object additionalProperties: @@ -1670,23 +1650,21 @@ components: input: 100 output: 10 balance: 90 - V2AggregatedVolumes: type: object additionalProperties: $ref: '#/components/schemas/V2Volumes' example: - "orders:1": - "USD": + orders:1: + USD: input: 100 output: 10 balance: 90 - "orders:2": - "USD": + orders:2: + USD: input: 100 output: 10 balance: 90 - V2ErrorResponse: type: object required: @@ -1697,11 +1675,11 @@ components: $ref: '#/components/schemas/V2ErrorsEnum' errorMessage: type: string - example: "[VALIDATION] invalid 'cursor' query param" + example: '[VALIDATION] invalid ''cursor'' query param' details: type: string - example: "https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9" - + example: >- + https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9 V2ErrorsEnum: type: string enum: @@ -1718,13 +1696,11 @@ components: - LEDGER_NOT_FOUND - IMPORT example: VALIDATION - V2LedgerInfoResponse: type: object properties: data: $ref: '#/components/schemas/V2LedgerInfo' - V2LedgerInfo: type: object properties: @@ -1738,7 +1714,6 @@ components: type: array items: $ref: '#/components/schemas/V2MigrationInfo' - V2MigrationInfo: type: object properties: @@ -1756,14 +1731,12 @@ components: state: type: string enum: - - "TO DO" - - "DONE" - + - TO DO + - DONE V2Bulk: type: array items: $ref: '#/components/schemas/V2BulkElement' - V2BaseBulkElement: type: object required: @@ -1773,7 +1746,6 @@ components: type: string ik: type: string - V2BulkElement: type: object oneOf: @@ -1788,69 +1760,63 @@ components: ADD_METADATA: '#/components/schemas/V2BulkElementAddMetadata' REVERT_TRANSACTION: '#/components/schemas/V2BulkElementRevertTransaction' DELETE_METADATA: '#/components/schemas/V2BulkElementDeleteMetadata' - V2BulkElementCreateTransaction: type: object allOf: - - $ref: '#/components/schemas/V2BaseBulkElement' - - type: object - properties: - data: - $ref: '#/components/schemas/V2PostTransaction' - + - $ref: '#/components/schemas/V2BaseBulkElement' + - type: object + properties: + data: + $ref: '#/components/schemas/V2PostTransaction' V2TargetId: oneOf: - type: string - type: integer format: bigint - V2TargetType: type: string enum: - TRANSACTION - ACCOUNT - V2BulkElementAddMetadata: type: object allOf: - - $ref: '#/components/schemas/V2BaseBulkElement' - - type: object - properties: - data: - type: object - properties: - targetId: - $ref: '#/components/schemas/V2TargetId' - targetType: - $ref: '#/components/schemas/V2TargetType' - metadata: - type: object - additionalProperties: - type: string - required: - - targetId - - targetType - - metadata - + - $ref: '#/components/schemas/V2BaseBulkElement' + - type: object + properties: + data: + type: object + properties: + targetId: + $ref: '#/components/schemas/V2TargetId' + targetType: + $ref: '#/components/schemas/V2TargetType' + metadata: + type: object + additionalProperties: + type: string + required: + - targetId + - targetType + - metadata V2BulkElementRevertTransaction: type: object allOf: - - $ref: '#/components/schemas/V2BaseBulkElement' - - type: object - properties: - data: - type: object - properties: - id: - type: integer - format: bigint - force: - type: boolean - atEffectiveDate: - type: boolean - required: - - id - + - $ref: '#/components/schemas/V2BaseBulkElement' + - type: object + properties: + data: + type: object + properties: + id: + type: integer + format: bigint + force: + type: boolean + atEffectiveDate: + type: boolean + required: + - id V2BulkElementDeleteMetadata: type: object allOf: @@ -1870,7 +1836,6 @@ components: - targetId - targetType - key - V2BulkResponse: properties: data: @@ -1880,7 +1845,6 @@ components: type: object required: - data - V2BulkElementResult: type: object oneOf: @@ -1897,7 +1861,6 @@ components: REVERT_TRANSACTION: '#/components/schemas/V2BulkElementResultRevertTransaction' DELETE_METADATA: '#/components/schemas/V2BulkElementResultDeleteMetadata' ERROR: '#/components/schemas/V2BulkElementResultError' - V2BaseBulkElementResult: type: object properties: @@ -1905,7 +1868,6 @@ components: type: string required: - responseType - V2BulkElementResultCreateTransaction: allOf: - $ref: '#/components/schemas/V2BaseBulkElementResult' @@ -1915,11 +1877,9 @@ components: $ref: '#/components/schemas/V2Transaction' required: - data - V2BulkElementResultAddMetadata: allOf: - $ref: '#/components/schemas/V2BaseBulkElementResult' - V2BulkElementResultRevertTransaction: allOf: - $ref: '#/components/schemas/V2BaseBulkElementResult' @@ -1929,11 +1889,9 @@ components: $ref: '#/components/schemas/V2Transaction' required: - data - V2BulkElementResultDeleteMetadata: allOf: - $ref: '#/components/schemas/V2BaseBulkElementResult' - V2BulkElementResultError: allOf: - $ref: '#/components/schemas/V2BaseBulkElementResult' @@ -1948,7 +1906,6 @@ components: required: - errorCode - errorDescription - V2CreateLedgerRequest: type: object properties: @@ -1956,7 +1913,6 @@ components: type: string metadata: $ref: '#/components/schemas/V2Metadata' - V2Ledger: type: object properties: @@ -1973,7 +1929,6 @@ components: - name - addedAt - bucket - V2LedgerListResponse: type: object required: @@ -1997,22 +1952,20 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: $ref: '#/components/schemas/V2Ledger' - V2UpdateLedgerMetadataRequest: $ref: '#/components/schemas/V2Metadata' - V2GetLedgerResponse: type: object required: - data properties: data: - $ref: '#/components/schemas/V2Ledger' \ No newline at end of file + $ref: '#/components/schemas/V2Ledger' diff --git a/components/payments/openapi.yaml b/components/payments/openapi.yaml index 003df4bd95..7788a4579b 100644 --- a/components/payments/openapi.yaml +++ b/components/payments/openapi.yaml @@ -1,9 +1,7 @@ openapi: 3.0.3 info: title: Payments API - version: "PAYMENTS_VERSION" - -# ---------------------- PATHS ---------------------- + version: PAYMENTS_VERSION paths: /_info: get: @@ -11,32 +9,34 @@ paths: operationId: getServerInfo tags: - payments.v1 - responses: - "200": + '200': $ref: '#/components/responses/ServerInfo' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /payments: post: summary: Create a payment tags: - payments.v1 - operationId: createPayment description: Create a payment requestBody: $ref: '#/components/requestBodies/Payment' responses: - "200": + '200': $ref: '#/components/responses/Payment' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:write get: summary: List payments operationId: listPayments - tags: - payments.v1 parameters: @@ -45,48 +45,51 @@ paths: - $ref: '#/components/parameters/Sort' - $ref: '#/components/parameters/Query' responses: - "200": + '200': $ref: '#/components/responses/Payments' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /payments/{paymentId}: get: summary: Get a payment tags: - payments.v1 operationId: getPayment - parameters: - $ref: '#/components/parameters/PaymentId' responses: - "200": + '200': $ref: '#/components/responses/Payment' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /payments/{paymentId}/metadata: patch: summary: Update metadata tags: - payments.v1 operationId: updateMetadata - parameters: - $ref: '#/components/parameters/PaymentId' requestBody: $ref: '#/components/requestBodies/UpdateMetadata' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:write /transfer-initiations: get: summary: List Transfer Initiations operationId: listTransferInitiations - tags: - payments.v1 parameters: @@ -95,111 +98,120 @@ paths: - $ref: '#/components/parameters/Sort' - $ref: '#/components/parameters/Query' responses: - "200": + '200': $ref: '#/components/responses/TransferInitiations' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:read post: summary: Create a TransferInitiation tags: - payments.v1 operationId: createTransferInitiation - description: Create a transfer initiation requestBody: $ref: '#/components/requestBodies/TransferInitiation' responses: - "200": + '200': $ref: '#/components/responses/TransferInitiation' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:write /transfer-initiations/{transferId}: get: summary: Get a transfer initiation tags: - payments.v1 operationId: getTransferInitiation - parameters: - $ref: '#/components/parameters/TransferId' responses: - "200": + '200': $ref: '#/components/responses/TransferInitiation' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:read delete: summary: Delete a transfer initiation operationId: deleteTransferInitiation - tags: - payments.v1 description: Delete a transfer initiation by its id. parameters: - $ref: '#/components/parameters/TransferId' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:write /transfer-initiations/{transferId}/status: post: summary: Update the status of a transfer initiation tags: - payments.v1 operationId: udpateTransferInitiationStatus - description: Update a transfer initiation status parameters: - $ref: '#/components/parameters/TransferId' requestBody: $ref: '#/components/requestBodies/UpdateTransferInitiationStatus' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:write /transfer-initiations/{transferId}/reverse: post: summary: Reverse a transfer initiation tags: - payments.v1 operationId: reverseTransferInitiation - description: Reverse transfer initiation parameters: - $ref: '#/components/parameters/TransferId' requestBody: $ref: '#/components/requestBodies/ReverseTransferInitiation' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:write /transfer-initiations/{transferId}/retry: post: summary: Retry a failed transfer initiation tags: - payments.v1 operationId: retryTransferInitiation - description: Retry a failed transfer initiation parameters: - $ref: '#/components/parameters/TransferId' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:write /pools: get: summary: List Pools operationId: listPools - tags: - payments.v1 parameters: @@ -208,74 +220,84 @@ paths: - $ref: '#/components/parameters/Sort' - $ref: '#/components/parameters/Query' responses: - "200": + '200': $ref: '#/components/responses/Pools' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:read post: summary: Create a Pool tags: - payments.v1 operationId: createPool - description: Create a Pool requestBody: $ref: '#/components/requestBodies/Pool' responses: - "200": + '200': $ref: '#/components/responses/Pool' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:write /pools/{poolId}: get: summary: Get a Pool tags: - payments.v1 operationId: getPool - parameters: - $ref: '#/components/parameters/PoolId' responses: - "200": + '200': $ref: '#/components/responses/Pool' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:read delete: summary: Delete a Pool operationId: deletePool - tags: - payments.v1 description: Delete a pool by its id. parameters: - $ref: '#/components/parameters/PoolId' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:write /pools/{poolId}/accounts: post: summary: Add an account to a pool tags: - payments.v1 operationId: addAccountToPool - description: Add an account to a pool parameters: - $ref: '#/components/parameters/PoolId' requestBody: $ref: '#/components/requestBodies/AddAccountToPool' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:write /pools/{poolId}/accounts/{accountId}: delete: summary: Remove an account from a pool operationId: removeAccountFromPool - tags: - payments.v1 description: Remove an account from a pool by its id. @@ -283,15 +305,17 @@ paths: - $ref: '#/components/parameters/PoolId' - $ref: '#/components/parameters/AccountId' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:write /pools/{poolId}/balances: get: summary: Get pool balances operationId: getPoolBalances - tags: - payments.v1 parameters: @@ -305,30 +329,33 @@ paths: type: string format: date-time responses: - "200": + '200': $ref: '#/components/responses/PoolBalances' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /accounts: post: summary: Create an account tags: - payments.v1 operationId: createAccount - description: Create an account requestBody: $ref: '#/components/requestBodies/Account' responses: - "200": + '200': $ref: '#/components/responses/Account' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:write get: summary: List accounts operationId: listAccounts - tags: - payments.v1 parameters: @@ -343,31 +370,33 @@ paths: type: object additionalProperties: true responses: - "200": + '200': $ref: '#/components/responses/Accounts' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /accounts/{accountId}: get: summary: Get an account tags: - payments.v1 operationId: getAccount - parameters: - $ref: '#/components/parameters/AccountId' responses: - "200": + '200': $ref: '#/components/responses/Account' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /accounts/{accountId}/balances: get: summary: Get account balances operationId: getAccountBalances - tags: - payments.v1 parameters: @@ -409,30 +438,33 @@ paths: - $ref: '#/components/parameters/Cursor' - $ref: '#/components/parameters/Sort' responses: - "200": + '200': $ref: '#/components/responses/AccountBalances' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /bank-accounts: post: summary: Create a BankAccount in Payments and on the PSP tags: - payments.v1 operationId: createBankAccount - description: Create a bank account in Payments and on the PSP. requestBody: $ref: '#/components/requestBodies/BankAccount' responses: - "200": + '200': $ref: '#/components/responses/BankAccount' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:write get: summary: List bank accounts created by user on Formance operationId: listBankAccounts - tags: - payments.v1 parameters: @@ -441,125 +473,135 @@ paths: - $ref: '#/components/parameters/Sort' description: List all bank accounts created by user on Formance. responses: - "200": + '200': $ref: '#/components/responses/BankAccounts' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /bank-accounts/{bankAccountId}: get: summary: Get a bank account created by user on Formance tags: - payments.v1 operationId: getBankAccount - parameters: - $ref: '#/components/parameters/BankAccountId' responses: - "200": + '200': $ref: '#/components/responses/BankAccount' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /bank-accounts/{bankAccountId}/forward: post: summary: Forward a bank account to a connector tags: - payments.v1 operationId: forwardBankAccount - parameters: - $ref: '#/components/parameters/BankAccountId' requestBody: $ref: '#/components/requestBodies/ForwardBankAccount' responses: - "200": + '200': $ref: '#/components/responses/BankAccount' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:write /bank-accounts/{bankAccountId}/metadata: patch: summary: Update metadata of a bank account tags: - payments.v1 operationId: updateBankAccountMetadata - parameters: - $ref: '#/components/parameters/BankAccountId' requestBody: $ref: '#/components/requestBodies/UpdateBankAccountMetadata' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:write /connectors: get: summary: List all installed connectors operationId: listAllConnectors - tags: - payments.v1 description: List all installed connectors. responses: - "200": + '200': $ref: '#/components/responses/Connectors' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /connectors/configs: get: summary: List the configs of each available connector operationId: listConfigsAvailableConnectors - tags: - payments.v1 description: List the configs of each available connector. responses: - "200": + '200': $ref: '#/components/responses/ConnectorsConfigs' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /connectors/{connector}: post: summary: Install a connector tags: - payments.v1 operationId: installConnector - description: Install a connector by its name and config. parameters: - $ref: '#/components/parameters/Connector' requestBody: $ref: '#/components/requestBodies/ConnectorConfig' responses: - "201": + '201': $ref: '#/components/responses/ConnectorInstalled' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:write delete: summary: Uninstall a connector deprecated: true operationId: uninstallConnector - tags: - payments.v1 description: Uninstall a connector by its name. parameters: - $ref: '#/components/parameters/Connector' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:write /connectors/{connector}/{connectorId}: delete: summary: Uninstall a connector operationId: uninstallConnectorV1 - tags: - payments.v1 description: Uninstall a connector by its name. @@ -567,33 +609,35 @@ paths: - $ref: '#/components/parameters/Connector' - $ref: '#/components/parameters/ConnectorID' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:write /connectors/{connector}/config: get: summary: Read the config of a connector deprecated: true operationId: readConnectorConfig - tags: - payments.v1 description: Read connector config parameters: - $ref: '#/components/parameters/Connector' responses: - "200": + '200': $ref: '#/components/responses/ConnectorConfig' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /connectors/{connector}/{connectorId}/config: post: summary: Update the config of a connector operationId: updateConnectorConfigV1 - tags: - payments.v1 description: Update connector config @@ -603,14 +647,16 @@ paths: requestBody: $ref: '#/components/requestBodies/ConnectorConfig' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:write get: summary: Read the config of a connector operationId: readConnectorConfigV1 - tags: - payments.v1 description: Read connector config @@ -618,17 +664,18 @@ paths: - $ref: '#/components/parameters/Connector' - $ref: '#/components/parameters/ConnectorID' responses: - "200": + '200': $ref: '#/components/responses/ConnectorConfig' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /connectors/{connector}/reset: post: summary: Reset a connector deprecated: true operationId: resetConnector - tags: - payments.v1 description: | @@ -637,15 +684,17 @@ paths: parameters: - $ref: '#/components/parameters/Connector' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' + security: + - Authorization: + - payments:write /connectors/{connector}/{connectorId}/reset: post: summary: Reset a connector operationId: resetConnectorV1 - tags: - payments.v1 description: | @@ -655,11 +704,13 @@ paths: - $ref: '#/components/parameters/Connector' - $ref: '#/components/parameters/ConnectorID' responses: - "204": + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:write /connectors/{connector}/tasks: get: summary: List tasks from a connector @@ -667,25 +718,25 @@ paths: tags: - payments.v1 operationId: listConnectorTasks - description: List all tasks associated with this connector. parameters: - $ref: '#/components/parameters/Connector' - $ref: '#/components/parameters/PageSize' - $ref: '#/components/parameters/Cursor' responses: - "200": + '200': $ref: '#/components/responses/Tasks' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /connectors/{connector}/{connectorId}/tasks: get: summary: List tasks from a connector tags: - payments.v1 operationId: listConnectorTasksV1 - description: List all tasks associated with this connector. parameters: - $ref: '#/components/parameters/Connector' @@ -693,11 +744,13 @@ paths: - $ref: '#/components/parameters/PageSize' - $ref: '#/components/parameters/Cursor' responses: - "200": + '200': $ref: '#/components/responses/Tasks' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /connectors/{connector}/tasks/{taskId}: get: summary: Read a specific task of the connector @@ -705,56 +758,57 @@ paths: tags: - payments.v1 operationId: getConnectorTask - description: Get a specific task associated to the connector. parameters: - $ref: '#/components/parameters/Connector' - $ref: '#/components/parameters/TaskId' responses: - "200": + '200': $ref: '#/components/responses/Task' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /connectors/{connector}/{connectorId}/tasks/{taskId}: get: summary: Read a specific task of the connector tags: - payments.v1 operationId: getConnectorTaskV1 - description: Get a specific task associated to the connector. parameters: - $ref: '#/components/parameters/Connector' - $ref: '#/components/parameters/ConnectorID' - $ref: '#/components/parameters/TaskId' responses: - "200": + '200': $ref: '#/components/responses/Task' default: $ref: '#/components/responses/PaymentsErrorResponse' - + security: + - Authorization: + - payments:read /connectors/{connector}/transfers: post: summary: Transfer funds between Connector accounts tags: - payments.v1 operationId: connectorsTransfer - description: Execute a transfer between two accounts. parameters: - $ref: '#/components/parameters/Connector' requestBody: $ref: '#/components/requestBodies/Transfer' responses: - "200": + '200': $ref: '#/components/responses/Transfer' default: $ref: '#/components/responses/PaymentsErrorResponse' - -# ---------------------- COMPONENTS ---------------------- + security: + - Authorization: + - payments:write components: - # ---------------------- PARAMETERS ---------------------- parameters: Query: name: query @@ -796,8 +850,8 @@ components: type: string description: Fields used to sort payments (default is date:desc). example: - - date:asc - - status:desc + - date:asc + - status:desc PaymentId: name: paymentId in: path @@ -861,8 +915,6 @@ components: schema: type: string required: true - - # ---------------------- RESPONSES ---------------------- responses: NoContent: description: No content @@ -992,13 +1044,6 @@ components: application/json: schema: $ref: '#/components/schemas/TransferResponse' - Transfers: - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/TransfersResponse' - # ---------------------- REQUESTS ---------------------- requestBodies: ConnectorConfig: required: true @@ -1077,11 +1122,8 @@ components: content: application/json: schema: - $ref: '#/components/schemas/TransferRequest' - - # ---------------------- SCHEMAS ---------------------- + $ref: '#/components/schemas/TransferRequest' schemas: - # ---------------------- CURSORS ---------------------- CursorBase: type: object required: @@ -1100,10 +1142,10 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' PaymentsCursor: type: object required: @@ -1224,8 +1266,6 @@ components: - $ref: '#/components/schemas/TaskBankingCircle' - $ref: '#/components/schemas/TaskMangoPay' - $ref: '#/components/schemas/TaskMoneycorp' - - # ---------------------- RESPONSES ---------------------- ConnectorConfigResponse: type: object required: @@ -1337,7 +1377,7 @@ components: TaskResponse: type: object required: - - data + - data properties: data: oneOf: @@ -1354,33 +1394,6 @@ components: properties: id: type: string - TransfersResponse: - type: object - properties: - data: - type: array - items: - type: object - properties: - id: - type: string - amount: - type: integer - format: bigint - minimum: 0 - asset: - type: string - destination: - type: string - source: - type: string - currency: - type: string - status: - type: string - error: - type: string - # ---------------------- DATA MODELS ---------------------- Connector: type: string enum: @@ -1431,13 +1444,14 @@ components: properties: name: type: string - example: 'My Stripe Account' + example: My Stripe Account pollingPeriod: type: string - example: '60s' - description: | - The frequency at which the connector will try to fetch new BalanceTransaction objects from Stripe API. - default: '120s' + example: 60s + description: > + The frequency at which the connector will try to fetch new + BalanceTransaction objects from Stripe API. + default: 120s apiKey: type: string example: XXX @@ -1457,15 +1471,17 @@ components: properties: name: type: string - example: 'My DummyPay Account' + example: My DummyPay Account filePollingPeriod: type: string - example: '60s' - description: The frequency at which the connector will try to fetch new payment objects from the directory - default: '10s' + example: 60s + description: >- + The frequency at which the connector will try to fetch new payment + objects from the directory + default: 10s directory: type: string - example: '/tmp/dummypay' + example: /tmp/dummypay prefixFileToIngest: type: string numberOfAccountsPreGenerated: @@ -1482,41 +1498,43 @@ components: properties: name: type: string - example: 'My Wise Account' + example: My Wise Account apiKey: type: string - example: 'XXX' + example: XXX pollingPeriod: type: string - example: '60s' - description: | - The frequency at which the connector will try to fetch new BalanceTransaction objects from Wise API. - default: '120s' + example: 60s + description: > + The frequency at which the connector will try to fetch new + BalanceTransaction objects from Wise API. + default: 120s ModulrConfig: type: object required: - - name - - apiKey - - apiSecret + - name + - apiKey + - apiSecret properties: name: type: string - example: 'My Modulr Account' + example: My Modulr Account apiKey: type: string - example: 'XXX' + example: XXX apiSecret: type: string - example: 'XXX' + example: XXX endpoint: type: string - example: 'XXX' + example: XXX pollingPeriod: type: string - example: '60s' - description: | - The frequency at which the connector will try to fetch new BalanceTransaction objects from Modulr API. - default: '120s' + example: 60s + description: > + The frequency at which the connector will try to fetch new + BalanceTransaction objects from Modulr API. + default: 120s BankingCircleConfig: type: object required: @@ -1530,31 +1548,32 @@ components: properties: name: type: string - example: 'My Banking Circle Account' + example: My Banking Circle Account username: type: string - example: 'XXX' + example: XXX password: type: string - example: 'XXX' + example: XXX endpoint: type: string - example: 'XXX' + example: XXX authorizationEndpoint: type: string - example: 'XXX' + example: XXX userCertificate: type: string - example: 'XXX' + example: XXX userCertificateKey: type: string - example: 'XXX' + example: XXX pollingPeriod: type: string - example: '60s' - description: | - The frequency at which the connector will try to fetch new BalanceTransaction objects from Banking Circle API. - default: '120s' + example: 60s + description: > + The frequency at which the connector will try to fetch new + BalanceTransaction objects from Banking Circle API. + default: 120s GenericConfig: type: object required: @@ -1564,19 +1583,20 @@ components: properties: name: type: string - example: 'My Generic Account' + example: My Generic Account apiKey: type: string - example: 'XXX' + example: XXX endpoint: type: string - example: 'XXX' + example: XXX pollingPeriod: type: string - example: '60s' - description: | - The frequency at which the connector will try to fetch new BalanceTransaction objects from the API. - default: '120s' + example: 60s + description: > + The frequency at which the connector will try to fetch new + BalanceTransaction objects from the API. + default: 120s MangoPayConfig: type: object required: @@ -1587,22 +1607,23 @@ components: properties: name: type: string - example: 'My MangoPay Account' + example: My MangoPay Account pollingPeriod: type: string - example: '60s' - description: | - The frequency at which the connector will try to fetch new BalanceTransaction objects from MangoPay API. - default: '120s' + example: 60s + description: > + The frequency at which the connector will try to fetch new + BalanceTransaction objects from MangoPay API. + default: 120s clientID: type: string - example: 'XXX' + example: XXX apiKey: type: string - example: 'XXX' + example: XXX endpoint: type: string - example: 'XXX' + example: XXX MoneycorpConfig: type: object required: @@ -1613,22 +1634,23 @@ components: properties: name: type: string - example: 'My Moneycorp Account' + example: My Moneycorp Account clientID: type: string - example: 'XXX' + example: XXX apiKey: type: string - example: 'XXX' + example: XXX endpoint: type: string - example: 'XXX' + example: XXX pollingPeriod: type: string - example: '60s' - description: | - The frequency at which the connector will try to fetch new BalanceTransaction objects from MoneyCorp API. - default: '120s' + example: 60s + description: > + The frequency at which the connector will try to fetch new + BalanceTransaction objects from MoneyCorp API. + default: 120s CurrencyCloudConfig: type: object required: @@ -1638,23 +1660,25 @@ components: properties: name: type: string - example: 'My CurrencyCloud Account' + example: My CurrencyCloud Account apiKey: type: string - example: 'XXX' + example: XXX loginID: type: string - example: 'XXX' - description: 'Username of the API Key holder' + example: XXX + description: Username of the API Key holder pollingPeriod: type: string - example: '60s' + example: 60s description: The frequency at which the connector will fetch transactions - default: '120s' + default: 120s endpoint: type: string - example: 'XXX' - description: 'The endpoint to use for the API. Defaults to https://devapi.currencycloud.com' + example: XXX + description: >- + The endpoint to use for the API. Defaults to + https://devapi.currencycloud.com AdyenConfig: type: object required: @@ -1664,22 +1688,23 @@ components: properties: name: type: string - example: 'My Adyen Account' + example: My Adyen Account apiKey: type: string - example: 'XXX' + example: XXX hmacKey: type: string - example: 'XXX' + example: XXX liveEndpointPrefix: type: string - example: 'XXX' + example: XXX pollingPeriod: type: string - example: '60s' - description: | - The frequency at which the connector will try to fetch new BalanceTransaction objects from Adyen API. - default: '120s' + example: 60s + description: > + The frequency at which the connector will try to fetch new + BalanceTransaction objects from Adyen API. + default: 120s AtlarConfig: type: object required: @@ -1689,37 +1714,46 @@ components: properties: name: type: string - example: 'My Atlar Account' + example: My Atlar Account baseUrl: type: string example: https://api.example.com default: https://api.atlar.com - description: | - The base URL the client uses for making requests towards the Atlar API. + description: > + The base URL the client uses for making requests towards the Atlar + API. pollingPeriod: type: string - example: '60s' - description: | - The frequency at which the connector tries to fetch new Transaction objects from the Atlar API. - default: '120s' + example: 60s + description: > + The frequency at which the connector tries to fetch new Transaction + objects from the Atlar API. + default: 120s transferInitiationStatusPollingPeriod: type: string - example: '60s' - description: | - The frequency at which the connector tries to fetch the status of payment initiations from the Atlar API. - default: '120s' + example: 60s + description: > + The frequency at which the connector tries to fetch the status of + payment initiations from the Atlar API. + default: 120s accessKey: type: string example: XXX - description: | - The access key used by the connector for authorizing requests to the Atlar API. - You can obtain it along with the associated secret from the Atlar dashboard. + description: > + The access key used by the connector for authorizing requests to the + Atlar API. + + You can obtain it along with the associated secret from the Atlar + dashboard. secret: type: string example: XXX - description: | - The secret used by the connector for authorizing requests to the Atlar API. - You can obtain it along with the associated access key from the Atlar dashboard. + description: > + The secret used by the connector for authorizing requests to the + Atlar API. + + You can obtain it along with the associated access key from the + Atlar dashboard. pageSize: type: integer format: int64 @@ -1960,28 +1994,28 @@ components: metadata: $ref: '#/components/schemas/PaymentMetadata' PaymentAdjustment: - type: object - required: - - reference - - createdAt - - amount - - status - - raw - properties: - reference: - type: string - createdAt: - type: string - format: date-time - status: - $ref: '#/components/schemas/PaymentStatus' - amount: - type: integer - format: bigint - minimum: 0 - example: 100 - raw: - type: object + type: object + required: + - reference + - createdAt + - amount + - status + - raw + properties: + reference: + type: string + createdAt: + type: string + format: date-time + status: + $ref: '#/components/schemas/PaymentStatus' + amount: + type: integer + format: bigint + minimum: 0 + example: 100 + raw: + type: object PaymentMetadata: type: object additionalProperties: @@ -2303,7 +2337,7 @@ components: type: string name: type: string - example: 'My account' + example: My account accountNumber: type: string iban: @@ -2534,7 +2568,7 @@ components: ServerInfo: type: object required: - - version + - version properties: version: type: string @@ -2548,7 +2582,7 @@ components: $ref: '#/components/schemas/PaymentsErrorsEnum' errorMessage: type: string - example: "[VALIDATION] missing reference" + example: '[VALIDATION] missing reference' PaymentsErrorsEnum: type: string enum: diff --git a/ee/auth/openapi.yaml b/ee/auth/openapi.yaml index 09685ade16..9d6090af13 100644 --- a/ee/auth/openapi.yaml +++ b/ee/auth/openapi.yaml @@ -2,8 +2,7 @@ openapi: 3.0.3 info: title: Auth API contact: {} - version: "AUTH_VERSION" - + version: AUTH_VERSION paths: /.well-known/openid-configuration: get: @@ -12,11 +11,16 @@ paths: tags: - auth.v1 responses: - 200: - description: | + '200': + description: > OpenID provider configuration. - See https://swagger.io/docs/specification/authentication/openid-connect-discovery/ for details + See + https://swagger.io/docs/specification/authentication/openid-connect-discovery/ + for details + security: + - Authorization: + - auth:read /_info: get: summary: Get server info @@ -24,12 +28,15 @@ paths: tags: - auth.v1 responses: - 200: + '200': description: Server information content: application/json: schema: $ref: '#/components/schemas/ServerInfo' + security: + - Authorization: + - auth:read /clients: get: summary: List clients @@ -37,12 +44,15 @@ paths: - auth.v1 operationId: listClients responses: - "200": + '200': description: List of clients content: application/json: schema: $ref: '#/components/schemas/ListClientsResponse' + security: + - Authorization: + - auth:read post: summary: Create client tags: @@ -54,12 +64,15 @@ paths: schema: $ref: '#/components/schemas/CreateClientRequest' responses: - "201": + '201': description: Client created content: application/json: schema: $ref: '#/components/schemas/CreateClientResponse' + security: + - Authorization: + - auth:write /clients/{clientId}: get: summary: Read client @@ -74,12 +87,15 @@ paths: schema: type: string responses: - "200": + '200': description: Retrieved client content: application/json: schema: $ref: '#/components/schemas/ReadClientResponse' + security: + - Authorization: + - auth:read put: summary: Update client tags: @@ -98,12 +114,15 @@ paths: schema: type: string responses: - "200": + '200': description: Updated client content: application/json: schema: $ref: '#/components/schemas/UpdateClientResponse' + security: + - Authorization: + - auth:write delete: summary: Delete client tags: @@ -117,8 +136,11 @@ paths: schema: type: string responses: - "204": + '204': description: Client deleted + security: + - Authorization: + - auth:write /clients/{clientId}/secrets: post: summary: Add a secret to a client @@ -138,12 +160,15 @@ paths: schema: $ref: '#/components/schemas/CreateSecretRequest' responses: - 200: + '200': description: Created secret content: application/json: schema: $ref: '#/components/schemas/CreateSecretResponse' + security: + - Authorization: + - auth:write /clients/{clientId}/secrets/{secretId}: delete: summary: Delete a secret from a client @@ -164,8 +189,11 @@ paths: schema: type: string responses: - 204: + '204': description: Secret deleted + security: + - Authorization: + - auth:write /users: get: summary: List users @@ -174,12 +202,15 @@ paths: description: List users operationId: listUsers responses: - 200: + '200': description: List of users content: application/json: schema: $ref: '#/components/schemas/ListUsersResponse' + security: + - Authorization: + - auth:read /users/{userId}: get: summary: Read user @@ -195,12 +226,15 @@ paths: schema: type: string responses: - 200: + '200': description: Retrieved user content: application/json: schema: $ref: '#/components/schemas/ReadUserResponse' + security: + - Authorization: + - auth:read components: schemas: Metadata: @@ -342,26 +376,6 @@ components: properties: data: $ref: '#/components/schemas/Client' - ListScopesResponse: - type: object - properties: - data: - type: array - items: - $ref: '#/components/schemas/Scope' - CreateScopeRequest: - $ref: '#/components/schemas/ScopeOptions' - CreateScopeResponse: - type: object - properties: - data: - $ref: '#/components/schemas/Scope' - ReadScopeResponse: - $ref: '#/components/schemas/CreateScopeResponse' - UpdateScopeRequest: - $ref: '#/components/schemas/ScopeOptions' - UpdateScopeResponse: - $ref: '#/components/schemas/CreateScopeResponse' CreateSecretRequest: $ref: '#/components/schemas/SecretOptions' CreateSecretResponse: @@ -384,7 +398,7 @@ components: ServerInfo: type: object required: - - version + - version properties: version: type: string diff --git a/ee/orchestration/openapi.yaml b/ee/orchestration/openapi.yaml index 6585e8e17e..0431574f4e 100644 --- a/ee/orchestration/openapi.yaml +++ b/ee/orchestration/openapi.yaml @@ -18,6 +18,9 @@ paths: $ref: '#/components/schemas/ServerInfo' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read /triggers: get: summary: List triggers @@ -41,6 +44,9 @@ paths: $ref: '#/components/schemas/ListTriggersResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read post: summary: Create trigger operationId: createTrigger @@ -61,6 +67,9 @@ paths: $ref: '#/components/schemas/CreateTriggerResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:write /triggers/{triggerID}: parameters: - name: triggerID @@ -84,6 +93,9 @@ paths: $ref: '#/components/schemas/ReadTriggerResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read delete: summary: Delete trigger operationId: deleteTrigger @@ -95,6 +107,9 @@ paths: description: Trigger deleted default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:write /triggers/{triggerID}/occurrences: parameters: - name: triggerID @@ -118,6 +133,9 @@ paths: $ref: '#/components/schemas/ListTriggersOccurrencesResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read /workflows: get: summary: List registered workflows @@ -134,6 +152,9 @@ paths: $ref: '#/components/schemas/ListWorkflowsResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read post: summary: Create workflow operationId: createWorkflow @@ -154,6 +175,9 @@ paths: $ref: '#/components/schemas/CreateWorkflowResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:write /workflows/{flowId}: parameters: - in: path @@ -178,6 +202,9 @@ paths: $ref: '#/components/schemas/GetWorkflowResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read delete: summary: Delete a flow by id tags: @@ -189,6 +216,9 @@ paths: description: No content default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:write /workflows/{workflowID}/instances: parameters: - in: path @@ -225,6 +255,9 @@ paths: $ref: '#/components/schemas/RunWorkflowResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:write /instances: get: description: List instances of a workflow @@ -256,6 +289,9 @@ paths: $ref: '#/components/schemas/ListRunsResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read /instances/{instanceID}: parameters: - in: path @@ -280,6 +316,9 @@ paths: $ref: '#/components/schemas/GetWorkflowInstanceResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read /instances/{instanceID}/events: parameters: - in: path @@ -310,6 +349,9 @@ paths: description: No content default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:write /instances/{instanceID}/abort: parameters: - in: path @@ -330,6 +372,9 @@ paths: description: No content default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:write /instances/{instanceID}/history: parameters: - in: path @@ -354,6 +399,9 @@ paths: $ref: '#/components/schemas/GetWorkflowInstanceHistoryResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read /instances/{instanceID}/stages/{number}/history: parameters: - in: path @@ -385,6 +433,9 @@ paths: $ref: '#/components/schemas/GetWorkflowInstanceHistoryStageResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read /v2/_info: get: summary: Get server info @@ -401,6 +452,9 @@ paths: $ref: '#/components/schemas/V2ServerInfo' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read /v2/triggers: get: summary: List triggers @@ -427,6 +481,9 @@ paths: $ref: '#/components/schemas/V2ListTriggersResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read post: summary: Create trigger operationId: v2CreateTrigger @@ -448,6 +505,9 @@ paths: $ref: '#/components/schemas/V2CreateTriggerResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:write /v2/triggers/{triggerID}: parameters: - name: triggerID @@ -472,6 +532,9 @@ paths: $ref: '#/components/schemas/V2ReadTriggerResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read delete: summary: Delete trigger operationId: v2DeleteTrigger @@ -484,6 +547,9 @@ paths: description: Trigger deleted default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:write /v2/triggers/{triggerID}/test: parameters: - name: triggerID @@ -514,6 +580,9 @@ paths: $ref: '#/components/schemas/V2TestTriggerResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:write /v2/triggers/{triggerID}/occurrences: parameters: - name: triggerID @@ -541,6 +610,9 @@ paths: $ref: '#/components/schemas/V2ListTriggersOccurrencesResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read /v2/workflows: get: summary: List registered workflows @@ -561,6 +633,9 @@ paths: $ref: '#/components/schemas/V2ListWorkflowsResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read post: summary: Create workflow operationId: v2CreateWorkflow @@ -582,6 +657,9 @@ paths: $ref: '#/components/schemas/V2CreateWorkflowResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:write /v2/workflows/{flowId}: parameters: - in: path @@ -607,6 +685,9 @@ paths: $ref: '#/components/schemas/V2GetWorkflowResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read delete: summary: Delete a flow by id tags: @@ -619,6 +700,9 @@ paths: description: No content default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:write /v2/workflows/{workflowID}/instances: parameters: - in: path @@ -656,6 +740,9 @@ paths: $ref: '#/components/schemas/V2RunWorkflowResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:write /v2/instances: get: description: List instances of a workflow @@ -690,6 +777,9 @@ paths: $ref: '#/components/schemas/V2ListRunsResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read /v2/instances/{instanceID}: parameters: - in: path @@ -715,6 +805,9 @@ paths: $ref: '#/components/schemas/V2GetWorkflowInstanceResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read /v2/instances/{instanceID}/events: parameters: - in: path @@ -746,6 +839,9 @@ paths: description: No content default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:write /v2/instances/{instanceID}/abort: parameters: - in: path @@ -767,6 +863,9 @@ paths: description: No content default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:write /v2/instances/{instanceID}/history: parameters: - in: path @@ -792,6 +891,9 @@ paths: $ref: '#/components/schemas/V2GetWorkflowInstanceHistoryResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read /v2/instances/{instanceID}/stages/{number}/history: parameters: - in: path @@ -824,6 +926,9 @@ paths: $ref: '#/components/schemas/V2GetWorkflowInstanceHistoryStageResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read components: schemas: ServerInfo: @@ -1066,13 +1171,6 @@ components: type: array required: - data - ReadWorkflowResponse: - type: object - required: - - data - properties: - data: - $ref: '#/components/schemas/Workflow' CreateWorkflowRequest: $ref: '#/components/schemas/WorkflowConfig' CreateWorkflowResponse: @@ -1281,8 +1379,6 @@ components: properties: name: type: string - ActivityListWalletsOutput: - $ref: '#/components/schemas/ListWalletsResponse' ListWalletsResponse: type: object required: @@ -2289,13 +2385,6 @@ components: $ref: '#/components/schemas/V2Trigger' required: - cursor - V2ReadWorkflowResponse: - type: object - required: - - data - properties: - data: - $ref: '#/components/schemas/V2Workflow' V2CreateWorkflowRequest: $ref: '#/components/schemas/V2WorkflowConfig' V2CreateWorkflowResponse: @@ -2527,8 +2616,6 @@ components: properties: name: type: string - V2ActivityListWalletsOutput: - $ref: '#/components/schemas/V2ListWalletsResponse' V2ListWalletsResponse: type: object required: diff --git a/ee/orchestration/openapi/v1.yaml b/ee/orchestration/openapi/v1.yaml index c0c20424ef..9f1aa06e76 100644 --- a/ee/orchestration/openapi/v1.yaml +++ b/ee/orchestration/openapi/v1.yaml @@ -1,18 +1,16 @@ openapi: 3.0.3 - info: title: Formance Simple orchestration Service API version: 0.1.0 - paths: /_info: get: summary: Get server info operationId: getServerInfo tags: - - orchestration.v1 + - orchestration.v1 responses: - 200: + '200': description: Server information content: application/json: @@ -20,13 +18,16 @@ paths: $ref: '#/components/schemas/ServerInfo' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read /triggers: get: summary: List triggers operationId: listTriggers description: List triggers tags: - - orchestration.v1 + - orchestration.v1 parameters: - name: name in: query @@ -35,7 +36,7 @@ paths: schema: type: string responses: - 200: + '200': description: List of triggers content: application/json: @@ -43,19 +44,22 @@ paths: $ref: '#/components/schemas/ListTriggersResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read post: summary: Create trigger operationId: createTrigger description: Create trigger tags: - - orchestration.v1 + - orchestration.v1 requestBody: content: application/json: schema: $ref: '#/components/schemas/TriggerData' responses: - 201: + '201': description: Created trigger content: application/json: @@ -63,6 +67,9 @@ paths: $ref: '#/components/schemas/CreateTriggerResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:write /triggers/{triggerID}: parameters: - name: triggerID @@ -78,7 +85,7 @@ paths: tags: - orchestration.v1 responses: - 200: + '200': description: A specific trigger content: application/json: @@ -86,17 +93,23 @@ paths: $ref: '#/components/schemas/ReadTriggerResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read delete: summary: Delete trigger operationId: deleteTrigger description: Read trigger tags: - - orchestration.v1 + - orchestration.v1 responses: - 204: + '204': description: Trigger deleted default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:write /triggers/{triggerID}/occurrences: parameters: - name: triggerID @@ -112,7 +125,7 @@ paths: tags: - orchestration.v1 responses: - 200: + '200': description: List of triggers occurrences content: application/json: @@ -120,15 +133,18 @@ paths: $ref: '#/components/schemas/ListTriggersOccurrencesResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read /workflows: get: summary: List registered workflows operationId: listWorkflows description: List registered workflows tags: - - orchestration.v1 + - orchestration.v1 responses: - 200: + '200': description: List of workflows content: application/json: @@ -136,19 +152,22 @@ paths: $ref: '#/components/schemas/ListWorkflowsResponse' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read post: summary: Create workflow operationId: createWorkflow description: Create a workflow tags: - - orchestration.v1 + - orchestration.v1 requestBody: content: application/json: schema: $ref: '#/components/schemas/CreateWorkflowRequest' responses: - 201: + '201': description: Created workflow content: application/json: @@ -156,104 +175,113 @@ paths: $ref: '#/components/schemas/CreateWorkflowResponse' default: $ref: '#/components/responses/ErrorResponse' - + security: + - Authorization: + - orchestration:write /workflows/{flowId}: parameters: - - in: path - description: The flow id - name: flowId - schema: - type: string - example: xxx - required: true + - in: path + description: The flow id + name: flowId + schema: + type: string + example: xxx + required: true get: summary: Get a flow by id tags: - - orchestration.v1 + - orchestration.v1 description: Get a flow by id operationId: getWorkflow responses: - default: - $ref: '#/components/responses/ErrorResponse' - 200: + '200': description: The workflow content: application/json: schema: $ref: '#/components/schemas/GetWorkflowResponse' + default: + $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read delete: summary: Delete a flow by id tags: - - orchestration.v1 + - orchestration.v1 description: Delete a flow by id operationId: deleteWorkflow responses: + '204': + description: No content default: $ref: '#/components/responses/ErrorResponse' - 204: - description: No content - + security: + - Authorization: + - orchestration:write /workflows/{workflowID}/instances: parameters: - - in: path - description: The flow id - name: workflowID - schema: - type: string - example: xxx - required: true + - in: path + description: The flow id + name: workflowID + schema: + type: string + example: xxx + required: true post: description: Run workflow summary: Run workflow operationId: runWorkflow parameters: - - in: query - name: wait - required: false - description: Wait end of the workflow before return - schema: - type: boolean + - in: query + name: wait + required: false + description: Wait end of the workflow before return + schema: + type: boolean tags: - - orchestration.v1 + - orchestration.v1 requestBody: content: application/json: schema: $ref: '#/components/schemas/RunWorkflowRequest' responses: - default: - $ref: '#/components/responses/ErrorResponse' - 201: + '201': description: The workflow instance content: application/json: schema: $ref: '#/components/schemas/RunWorkflowResponse' - + default: + $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:write /instances: get: description: List instances of a workflow summary: List instances of a workflow operationId: listInstances parameters: - - in: query - description: A workflow id - name: workflowID - schema: - type: string - example: xxx - required: false - - in: query - description: Filter running instances - name: running - schema: - type: boolean - example: true - required: false + - in: query + description: A workflow id + name: workflowID + schema: + type: string + example: xxx + required: false + - in: query + description: Filter running instances + name: running + schema: + type: boolean + example: true + required: false tags: - - orchestration.v1 + - orchestration.v1 responses: - 200: + '200': description: List of workflow instances content: application/json: @@ -261,168 +289,180 @@ paths: $ref: '#/components/schemas/ListRunsResponse' default: $ref: '#/components/responses/ErrorResponse' - + security: + - Authorization: + - orchestration:read /instances/{instanceID}: parameters: - - in: path - description: The instance id - name: instanceID - schema: - type: string - example: xxx - required: true + - in: path + description: The instance id + name: instanceID + schema: + type: string + example: xxx + required: true get: summary: Get a workflow instance by id description: Get a workflow instance by id operationId: getInstance tags: - - orchestration.v1 + - orchestration.v1 responses: - default: - $ref: '#/components/responses/ErrorResponse' - 200: + '200': description: The workflow instance content: application/json: schema: $ref: '#/components/schemas/GetWorkflowInstanceResponse' - + default: + $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read /instances/{instanceID}/events: parameters: - - in: path - description: The instance id - name: instanceID - schema: - type: string - example: xxx - required: true + - in: path + description: The instance id + name: instanceID + schema: + type: string + example: xxx + required: true post: summary: Send an event to a running workflow description: Send an event to a running workflow operationId: sendEvent tags: - - orchestration.v1 + - orchestration.v1 requestBody: content: application/json: schema: type: object required: - - name + - name properties: name: type: string responses: + '204': + description: No content default: $ref: '#/components/responses/ErrorResponse' - 204: - description: No content - + security: + - Authorization: + - orchestration:write /instances/{instanceID}/abort: parameters: - - in: path - description: The instance id - name: instanceID - schema: - type: string - example: xxx - required: true + - in: path + description: The instance id + name: instanceID + schema: + type: string + example: xxx + required: true put: summary: Cancel a running workflow description: Cancel a running workflow operationId: cancelEvent tags: - - orchestration.v1 + - orchestration.v1 responses: + '204': + description: No content default: $ref: '#/components/responses/ErrorResponse' - 204: - description: No content - + security: + - Authorization: + - orchestration:write /instances/{instanceID}/history: parameters: - - in: path - description: The instance id - name: instanceID - schema: - type: string - example: xxx - required: true + - in: path + description: The instance id + name: instanceID + schema: + type: string + example: xxx + required: true get: summary: Get a workflow instance history by id description: Get a workflow instance history by id operationId: getInstanceHistory tags: - - orchestration.v1 + - orchestration.v1 responses: - default: - $ref: '#/components/responses/ErrorResponse' - 200: + '200': description: The workflow instance history content: application/json: schema: $ref: '#/components/schemas/GetWorkflowInstanceHistoryResponse' - + default: + $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read /instances/{instanceID}/stages/{number}/history: parameters: - - in: path - description: The instance id - name: instanceID - schema: - type: string - example: xxx - required: true - - in: path - description: The stage number - name: number - schema: - type: integer - example: 0 - required: true + - in: path + description: The instance id + name: instanceID + schema: + type: string + example: xxx + required: true + - in: path + description: The stage number + name: number + schema: + type: integer + example: 0 + required: true get: summary: Get a workflow instance stage history description: Get a workflow instance stage history operationId: getInstanceStageHistory tags: - - orchestration.v1 + - orchestration.v1 responses: - default: - $ref: '#/components/responses/ErrorResponse' - 200: + '200': description: The workflow instance stage history content: application/json: schema: $ref: '#/components/schemas/GetWorkflowInstanceHistoryStageResponse' - + default: + $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - orchestration:read components: schemas: ServerInfo: type: object required: - - version + - version properties: version: type: string Error: type: object required: - - errorCode - - errorMessage + - errorCode + - errorMessage properties: errorCode: type: string enum: - - VALIDATION - - NOT_FOUND - - INTERNAL + - VALIDATION + - NOT_FOUND + - INTERNAL errorMessage: type: string WorkflowConfig: type: object required: - - stages + - stages properties: name: type: string @@ -430,14 +470,14 @@ components: type: array items: type: object - additionalProperties: { } + additionalProperties: {} Workflow: type: object required: - - config - - createdAt - - updatedAt - - id + - config + - createdAt + - updatedAt + - id properties: config: $ref: '#/components/schemas/WorkflowConfig' @@ -452,9 +492,9 @@ components: StageStatus: type: object required: - - stage - - instanceID - - startedAt + - stage + - instanceID + - startedAt properties: stage: type: number @@ -471,11 +511,11 @@ components: WorkflowInstance: type: object required: - - workflowID - - id - - createdAt - - updatedAt - - terminated + - workflowID + - id + - createdAt + - updatedAt + - terminated properties: workflowID: type: string @@ -501,11 +541,11 @@ components: WorkflowInstanceHistoryStage: type: object required: - - name - - input - - startedAt - - terminated - - attempt + - name + - input + - startedAt + - terminated + - attempt properties: name: type: string @@ -533,10 +573,10 @@ components: WorkflowInstanceHistory: type: object required: - - name - - input - - terminated - - startedAt + - name + - input + - terminated + - startedAt properties: name: type: string @@ -568,7 +608,7 @@ components: $ref: '#/components/schemas/Workflow' type: array required: - - data + - data TriggerData: type: object required: @@ -588,17 +628,17 @@ components: type: string Trigger: allOf: - - $ref: '#/components/schemas/TriggerData' - - type: object - required: - - id - - createdAt - properties: - id: - type: string - createdAt: - type: string - format: date-time + - $ref: '#/components/schemas/TriggerData' + - type: object + required: + - id + - createdAt + properties: + id: + type: string + createdAt: + type: string + format: date-time TriggerOccurrence: type: object required: @@ -638,19 +678,12 @@ components: type: array required: - data - ReadWorkflowResponse: - type: object - required: - - data - properties: - data: - $ref: '#/components/schemas/Workflow' CreateWorkflowRequest: $ref: '#/components/schemas/WorkflowConfig' CreateWorkflowResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/Workflow' @@ -668,13 +701,13 @@ components: RunWorkflowResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/WorkflowInstance' ListRunsResponse: required: - - data + - data properties: data: items: @@ -683,35 +716,35 @@ components: GetWorkflowResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/Workflow' GetWorkflowInstanceResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/WorkflowInstance' GetWorkflowInstanceHistoryResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/WorkflowInstanceHistoryList' GetWorkflowInstanceHistoryStageResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/WorkflowInstanceHistoryStageList' StageSendSourceWallet: type: object required: - - id + - id properties: id: type: string @@ -722,7 +755,7 @@ components: StageSendSourceAccount: type: object required: - - id + - id properties: id: type: string @@ -733,14 +766,14 @@ components: StageSendSourcePayment: type: object required: - - id + - id properties: id: type: string StageSendDestinationPayment: type: object required: - - psp + - psp properties: psp: type: string @@ -789,7 +822,7 @@ components: StageWaitEvent: type: object required: - - event + - event properties: event: type: string @@ -815,10 +848,10 @@ components: $ref: '#/components/schemas/UpdateAccount' Stage: anyOf: - - $ref: '#/components/schemas/StageSend' - - $ref: '#/components/schemas/StageDelay' - - $ref: '#/components/schemas/StageWaitEvent' - - $ref: '#/components/schemas/Update' + - $ref: '#/components/schemas/StageSend' + - $ref: '#/components/schemas/StageDelay' + - $ref: '#/components/schemas/StageWaitEvent' + - $ref: '#/components/schemas/Update' StripeTransferRequest: type: object properties: @@ -841,9 +874,11 @@ components: default: false metadata: type: object - description: | + description: > A set of key/value pairs that you can attach to a transfer object. - It can be useful for storing additional information about the transfer in a structured format. + + It can be useful for storing additional information about the + transfer in a structured format. example: order_id: '6735' ActivityStripeTransfer: @@ -853,8 +888,6 @@ components: properties: name: type: string - ActivityListWalletsOutput: - $ref: '#/components/schemas/ListWalletsResponse' ListWalletsResponse: type: object required: @@ -912,15 +945,15 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' ActivityGetAccount: type: object required: - - id - - ledger + - id + - ledger properties: id: type: string @@ -951,8 +984,8 @@ components: ActivityRevertTransaction: type: object required: - - id - - ledger + - id + - ledger properties: ledger: type: string @@ -961,14 +994,14 @@ components: ActivityGetPayment: type: object required: - - id + - id properties: id: type: string ActivityConfirmHold: type: object required: - - id + - id properties: id: type: string @@ -979,7 +1012,6 @@ components: type: string data: $ref: '#/components/schemas/CreditWalletRequest' - CreditWalletRequest: type: object required: @@ -1011,8 +1043,8 @@ components: asset: USD/2 amount: 100 metadata: - key: "" - sources: [ ] + key: '' + sources: [] LedgerAccountSubject: type: object required: @@ -1044,7 +1076,6 @@ components: oneOf: - $ref: '#/components/schemas/LedgerAccountSubject' - $ref: '#/components/schemas/WalletSubject' - ActivityDebitWallet: type: object properties: @@ -1052,7 +1083,6 @@ components: type: string data: $ref: '#/components/schemas/DebitWalletRequest' - DebitWalletRequest: type: object required: @@ -1063,7 +1093,9 @@ components: $ref: '#/components/schemas/Monetary' pending: type: boolean - description: Set to true to create a pending hold. If false, the wallet will be debited immediately. + description: >- + Set to true to create a pending hold. If false, the wallet will be + debited immediately. metadata: type: object additionalProperties: @@ -1087,20 +1119,19 @@ components: asset: USD/2 amount: 100 metadata: - key: "" + key: '' pending: true - ActivityGetWallet: type: object required: - - id + - id properties: id: type: string ActivityVoidHold: type: object required: - - id + - id properties: id: type: string @@ -1108,7 +1139,6 @@ components: $ref: '#/components/schemas/AccountResponse' ActivityCreateTransactionOutput: $ref: '#/components/schemas/CreateTransactionResponse' - CreateTransactionResponse: properties: data: @@ -1116,7 +1146,6 @@ components: type: object required: - data - Transaction: type: object properties: @@ -1144,16 +1173,12 @@ components: - id - metadata - reverted - ActivityRevertTransactionOutput: $ref: '#/components/schemas/RevertTransactionResponse' - RevertTransactionResponse: $ref: '#/components/schemas/CreateTransactionResponse' - ActivityGetPaymentOutput: $ref: '#/components/schemas/PaymentResponse' - PaymentResponse: type: object required: @@ -1242,7 +1267,6 @@ components: $ref: '#/components/schemas/PaymentAdjustment' metadata: $ref: '#/components/schemas/PaymentMetadata' - Connector: type: string enum: @@ -1254,7 +1278,6 @@ components: - BANKING-CIRCLE - MANGOPAY - MONEYCORP - PaymentAdjustment: type: object required: @@ -1278,7 +1301,6 @@ components: type: object absolute: type: boolean - PaymentStatus: type: string enum: @@ -1288,17 +1310,14 @@ components: - FAILED - SUCCEEDED - CANCELLED - PaymentMetadata: type: object properties: key: type: string nullable: true - ActivityDebitWalletOutput: $ref: '#/components/schemas/DebitWalletResponse' - DebitWalletResponse: type: object required: @@ -1306,7 +1325,6 @@ components: properties: data: $ref: '#/components/schemas/Hold' - Hold: type: object required: @@ -1331,10 +1349,8 @@ components: type: string destination: $ref: '#/components/schemas/Subject' - ActivityGetWalletOutput: $ref: '#/components/schemas/GetWalletResponse' - GetWalletResponse: type: object required: @@ -1342,7 +1358,6 @@ components: properties: data: $ref: '#/components/schemas/WalletWithBalances' - WalletWithBalances: type: object required: @@ -1376,7 +1391,6 @@ components: $ref: '#/components/schemas/AssetHolder' ledger: type: string - AssetHolder: type: object required: @@ -1387,7 +1401,6 @@ components: additionalProperties: type: integer format: bigint - WorkflowInstanceHistoryStageInput: type: object properties: @@ -1432,7 +1445,6 @@ components: $ref: '#/components/schemas/ActivityGetWalletOutput' ListWallets: $ref: '#/components/schemas/ListWalletsResponse' - Monetary: type: object required: @@ -1446,7 +1458,6 @@ components: type: integer format: bigint description: The amount of the monetary value. - PostTransaction: type: object required: @@ -1467,11 +1478,10 @@ components: example: "vars {\naccount $user\n}\nsend [COIN 10] (\n\tsource = @world\n\tdestination = $user\n)\n" vars: type: object - properties: { } + properties: {} additionalProperties: true - example: { - "user": "users:042" - } + example: + user: users:042 required: - plain reference: @@ -1479,13 +1489,12 @@ components: example: ref:001 metadata: $ref: '#/components/schemas/Metadata' - Metadata: type: object additionalProperties: type: string - example: { admin: "true" } - + example: + admin: 'true' Posting: type: object properties: @@ -1508,7 +1517,6 @@ components: - asset - destination - source - AccountResponse: type: object required: @@ -1516,7 +1524,6 @@ components: properties: data: $ref: '#/components/schemas/Account' - ReadTriggerResponse: type: object required: @@ -1524,7 +1531,6 @@ components: properties: data: $ref: '#/components/schemas/Trigger' - Account: type: object required: @@ -1536,15 +1542,15 @@ components: example: users:001 metadata: type: object - properties: { } + properties: {} additionalProperties: type: string - example: { admin: "true" } + example: + admin: 'true' volumes: $ref: '#/components/schemas/Volumes' effectiveVolumes: $ref: '#/components/schemas/Volumes' - Volume: type: object properties: @@ -1564,7 +1570,6 @@ components: input: 100 output: 20 balance: 80 - Volumes: type: object additionalProperties: @@ -1578,7 +1583,6 @@ components: input: 100 output: 10 balance: 90 - responses: ErrorResponse: description: General error diff --git a/ee/orchestration/openapi/v2.yaml b/ee/orchestration/openapi/v2.yaml index 014cf41578..f5949fbb51 100644 --- a/ee/orchestration/openapi/v2.yaml +++ b/ee/orchestration/openapi/v2.yaml @@ -1,9 +1,7 @@ openapi: 3.0.3 - info: title: Formance Simple orchestration Service API version: 0.1.0 - paths: /v2/_info: get: @@ -11,9 +9,9 @@ paths: operationId: v2GetServerInfo x-speakeasy-name-override: GetServerInfo tags: - - orchestration.v2 + - orchestration.v2 responses: - 200: + '200': description: Server information content: application/json: @@ -21,6 +19,9 @@ paths: $ref: '#/components/schemas/V2ServerInfo' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read /v2/triggers: get: summary: List triggers @@ -28,7 +29,7 @@ paths: description: List triggers x-speakeasy-name-override: ListTriggers tags: - - orchestration.v2 + - orchestration.v2 parameters: - $ref: '#/components/parameters/Cursor' - $ref: '#/components/parameters/PageSize' @@ -39,7 +40,7 @@ paths: schema: type: string responses: - 200: + '200': description: List of triggers content: application/json: @@ -47,20 +48,23 @@ paths: $ref: '#/components/schemas/V2ListTriggersResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read post: summary: Create trigger operationId: v2CreateTrigger description: Create trigger x-speakeasy-name-override: CreateTrigger tags: - - orchestration.v2 + - orchestration.v2 requestBody: content: application/json: schema: $ref: '#/components/schemas/V2TriggerData' responses: - 201: + '201': description: Created trigger content: application/json: @@ -68,7 +72,9 @@ paths: $ref: '#/components/schemas/V2CreateTriggerResponse' default: $ref: '#/components/responses/V2ErrorResponse' - + security: + - Authorization: + - orchestration:write /v2/triggers/{triggerID}: parameters: - name: triggerID @@ -85,7 +91,7 @@ paths: tags: - orchestration.v2 responses: - 200: + '200': description: A specific trigger content: application/json: @@ -93,20 +99,24 @@ paths: $ref: '#/components/schemas/V2ReadTriggerResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read delete: summary: Delete trigger operationId: v2DeleteTrigger description: Read trigger x-speakeasy-name-override: DeleteTrigger tags: - - orchestration.v2 + - orchestration.v2 responses: - 204: + '204': description: Trigger deleted - default: $ref: '#/components/responses/V2ErrorResponse' - + security: + - Authorization: + - orchestration:write /v2/triggers/{triggerID}/test: parameters: - name: triggerID @@ -129,7 +139,7 @@ paths: type: object additionalProperties: true responses: - "200": + '200': description: Test a trigger content: application/json: @@ -137,7 +147,9 @@ paths: $ref: '#/components/schemas/V2TestTriggerResponse' default: $ref: '#/components/responses/V2ErrorResponse' - + security: + - Authorization: + - orchestration:write /v2/triggers/{triggerID}/occurrences: parameters: - name: triggerID @@ -157,7 +169,7 @@ paths: - $ref: '#/components/parameters/Cursor' - $ref: '#/components/parameters/PageSize' responses: - 200: + '200': description: List of triggers occurrences content: application/json: @@ -165,6 +177,9 @@ paths: $ref: '#/components/schemas/V2ListTriggersOccurrencesResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read /v2/workflows: get: summary: List registered workflows @@ -172,12 +187,12 @@ paths: description: List registered workflows x-speakeasy-name-override: ListWorkflows tags: - - orchestration.v2 + - orchestration.v2 parameters: - $ref: '#/components/parameters/Cursor' - $ref: '#/components/parameters/PageSize' responses: - 200: + '200': description: List of workflows content: application/json: @@ -185,20 +200,23 @@ paths: $ref: '#/components/schemas/V2ListWorkflowsResponse' default: $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read post: summary: Create workflow operationId: v2CreateWorkflow description: Create a workflow x-speakeasy-name-override: CreateWorkflow tags: - - orchestration.v2 + - orchestration.v2 requestBody: content: application/json: schema: $ref: '#/components/schemas/V2CreateWorkflowRequest' responses: - 201: + '201': description: Created workflow content: application/json: @@ -206,84 +224,92 @@ paths: $ref: '#/components/schemas/V2CreateWorkflowResponse' default: $ref: '#/components/responses/V2ErrorResponse' - + security: + - Authorization: + - orchestration:write /v2/workflows/{flowId}: parameters: - - in: path - description: The flow id - name: flowId - schema: - type: string - example: xxx - required: true + - in: path + description: The flow id + name: flowId + schema: + type: string + example: xxx + required: true get: summary: Get a flow by id tags: - - orchestration.v2 + - orchestration.v2 description: Get a flow by id operationId: v2GetWorkflow x-speakeasy-name-override: GetWorkflow responses: - default: - $ref: '#/components/responses/V2ErrorResponse' - 200: + '200': description: The workflow content: application/json: schema: $ref: '#/components/schemas/V2GetWorkflowResponse' + default: + $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read delete: summary: Delete a flow by id tags: - - orchestration.v2 + - orchestration.v2 description: Delete a flow by id operationId: v2DeleteWorkflow x-speakeasy-name-override: DeleteWorkflow responses: + '204': + description: No content default: $ref: '#/components/responses/V2ErrorResponse' - - 204: - description: No content - + security: + - Authorization: + - orchestration:write /v2/workflows/{workflowID}/instances: parameters: - - in: path - description: The flow id - name: workflowID - schema: - type: string - example: xxx - required: true + - in: path + description: The flow id + name: workflowID + schema: + type: string + example: xxx + required: true post: description: Run workflow summary: Run workflow operationId: v2RunWorkflow x-speakeasy-name-override: RunWorkflow parameters: - - in: query - name: wait - required: false - description: Wait end of the workflow before return - schema: - type: boolean + - in: query + name: wait + required: false + description: Wait end of the workflow before return + schema: + type: boolean tags: - - orchestration.v2 + - orchestration.v2 requestBody: content: application/json: schema: $ref: '#/components/schemas/V2RunWorkflowRequest' responses: - default: - $ref: '#/components/responses/V2ErrorResponse' - 201: + '201': description: The workflow instance content: application/json: schema: $ref: '#/components/schemas/V2RunWorkflowResponse' - + default: + $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:write /v2/instances: get: description: List instances of a workflow @@ -291,26 +317,26 @@ paths: operationId: v2ListInstances x-speakeasy-name-override: ListInstances parameters: - - $ref: '#/components/parameters/Cursor' - - $ref: '#/components/parameters/PageSize' - - in: query - description: A workflow id - name: workflowID - schema: - type: string - example: xxx - required: false - - in: query - description: Filter running instances - name: running - schema: - type: boolean - example: true - required: false + - $ref: '#/components/parameters/Cursor' + - $ref: '#/components/parameters/PageSize' + - in: query + description: A workflow id + name: workflowID + schema: + type: string + example: xxx + required: false + - in: query + description: Filter running instances + name: running + schema: + type: boolean + example: true + required: false tags: - - orchestration.v2 + - orchestration.v2 responses: - 200: + '200': description: List of workflow instances content: application/json: @@ -318,146 +344,158 @@ paths: $ref: '#/components/schemas/V2ListRunsResponse' default: $ref: '#/components/responses/V2ErrorResponse' - + security: + - Authorization: + - orchestration:read /v2/instances/{instanceID}: parameters: - - in: path - description: The instance id - name: instanceID - schema: - type: string - example: xxx - required: true + - in: path + description: The instance id + name: instanceID + schema: + type: string + example: xxx + required: true get: summary: Get a workflow instance by id description: Get a workflow instance by id operationId: v2GetInstance x-speakeasy-name-override: GetInstance tags: - - orchestration.v2 + - orchestration.v2 responses: - default: - $ref: '#/components/responses/V2ErrorResponse' - 200: + '200': description: The workflow instance content: application/json: schema: $ref: '#/components/schemas/V2GetWorkflowInstanceResponse' - + default: + $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read /v2/instances/{instanceID}/events: parameters: - - in: path - description: The instance id - name: instanceID - schema: - type: string - example: xxx - required: true + - in: path + description: The instance id + name: instanceID + schema: + type: string + example: xxx + required: true post: summary: Send an event to a running workflow description: Send an event to a running workflow operationId: v2SendEvent x-speakeasy-name-override: SendEvent tags: - - orchestration.v2 + - orchestration.v2 requestBody: content: application/json: schema: type: object required: - - name + - name properties: name: type: string responses: + '204': + description: No content default: $ref: '#/components/responses/V2ErrorResponse' - 204: - description: No content - + security: + - Authorization: + - orchestration:write /v2/instances/{instanceID}/abort: parameters: - - in: path - description: The instance id - name: instanceID - schema: - type: string - example: xxx - required: true + - in: path + description: The instance id + name: instanceID + schema: + type: string + example: xxx + required: true put: summary: Cancel a running workflow description: Cancel a running workflow operationId: v2CancelEvent x-speakeasy-name-override: CancelEvent tags: - - orchestration.v2 + - orchestration.v2 responses: + '204': + description: No content default: $ref: '#/components/responses/V2ErrorResponse' - 204: - description: No content - + security: + - Authorization: + - orchestration:write /v2/instances/{instanceID}/history: parameters: - - in: path - description: The instance id - name: instanceID - schema: - type: string - example: xxx - required: true + - in: path + description: The instance id + name: instanceID + schema: + type: string + example: xxx + required: true get: summary: Get a workflow instance history by id description: Get a workflow instance history by id operationId: v2GetInstanceHistory x-speakeasy-name-override: GetInstanceHistory tags: - - orchestration.v2 + - orchestration.v2 responses: - default: - $ref: '#/components/responses/V2ErrorResponse' - 200: + '200': description: The workflow instance history content: application/json: schema: $ref: '#/components/schemas/V2GetWorkflowInstanceHistoryResponse' - + default: + $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read /v2/instances/{instanceID}/stages/{number}/history: parameters: - - in: path - description: The instance id - name: instanceID - schema: - type: string - example: xxx - required: true - - in: path - description: The stage number - name: number - schema: - type: integer - example: 0 - required: true + - in: path + description: The instance id + name: instanceID + schema: + type: string + example: xxx + required: true + - in: path + description: The stage number + name: number + schema: + type: integer + example: 0 + required: true get: summary: Get a workflow instance stage history description: Get a workflow instance stage history operationId: v2GetInstanceStageHistory x-speakeasy-name-override: GetInstanceStageHistory tags: - - orchestration.v2 + - orchestration.v2 responses: - default: - $ref: '#/components/responses/V2ErrorResponse' - 200: + '200': description: The workflow instance stage history content: application/json: schema: $ref: '#/components/schemas/V2GetWorkflowInstanceHistoryStageResponse' - + default: + $ref: '#/components/responses/V2ErrorResponse' + security: + - Authorization: + - orchestration:read components: parameters: Cursor: @@ -486,28 +524,28 @@ components: V2ServerInfo: type: object required: - - version + - version properties: version: type: string V2Error: type: object required: - - errorCode - - errorMessage + - errorCode + - errorMessage properties: errorCode: type: string enum: - - VALIDATION - - NOT_FOUND - - INTERNAL + - VALIDATION + - NOT_FOUND + - INTERNAL errorMessage: type: string V2WorkflowConfig: type: object required: - - stages + - stages properties: name: type: string @@ -515,14 +553,14 @@ components: type: array items: type: object - additionalProperties: { } + additionalProperties: {} V2Workflow: type: object required: - - config - - createdAt - - updatedAt - - id + - config + - createdAt + - updatedAt + - id properties: config: $ref: '#/components/schemas/V2WorkflowConfig' @@ -537,9 +575,9 @@ components: V2StageStatus: type: object required: - - stage - - instanceID - - startedAt + - stage + - instanceID + - startedAt properties: stage: type: number @@ -556,11 +594,11 @@ components: V2WorkflowInstance: type: object required: - - workflowID - - id - - createdAt - - updatedAt - - terminated + - workflowID + - id + - createdAt + - updatedAt + - terminated properties: workflowID: type: string @@ -586,11 +624,11 @@ components: V2WorkflowInstanceHistoryStage: type: object required: - - name - - input - - startedAt - - terminated - - attempt + - name + - input + - startedAt + - terminated + - attempt properties: name: type: string @@ -618,10 +656,10 @@ components: V2WorkflowInstanceHistory: type: object required: - - name - - input - - terminated - - startedAt + - name + - input + - terminated + - startedAt properties: name: type: string @@ -666,10 +704,10 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: @@ -695,17 +733,17 @@ components: type: string V2Trigger: allOf: - - $ref: '#/components/schemas/V2TriggerData' - - type: object - required: - - id - - createdAt - properties: - id: - type: string - createdAt: - type: string - format: date-time + - $ref: '#/components/schemas/V2TriggerData' + - type: object + required: + - id + - createdAt + properties: + id: + type: string + createdAt: + type: string + format: date-time V2TriggerOccurrence: type: object required: @@ -748,10 +786,10 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: @@ -779,29 +817,22 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: $ref: '#/components/schemas/V2Trigger' required: - cursor - V2ReadWorkflowResponse: - type: object - required: - - data - properties: - data: - $ref: '#/components/schemas/V2Workflow' V2CreateWorkflowRequest: $ref: '#/components/schemas/V2WorkflowConfig' V2CreateWorkflowResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/V2Workflow' @@ -819,7 +850,7 @@ components: V2RunWorkflowResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/V2WorkflowInstance' @@ -844,10 +875,10 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: @@ -857,35 +888,35 @@ components: V2GetWorkflowResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/V2Workflow' V2GetWorkflowInstanceResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/V2WorkflowInstance' V2GetWorkflowInstanceHistoryResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/V2WorkflowInstanceHistoryList' V2GetWorkflowInstanceHistoryStageResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/V2WorkflowInstanceHistoryStageList' V2StageSendSourceWallet: type: object required: - - id + - id properties: id: type: string @@ -896,7 +927,7 @@ components: V2StageSendSourceAccount: type: object required: - - id + - id properties: id: type: string @@ -907,14 +938,14 @@ components: V2StageSendSourcePayment: type: object required: - - id + - id properties: id: type: string V2StageSendDestinationPayment: type: object required: - - psp + - psp properties: psp: type: string @@ -963,7 +994,7 @@ components: V2StageWaitEvent: type: object required: - - event + - event properties: event: type: string @@ -989,10 +1020,10 @@ components: $ref: '#/components/schemas/V2UpdateAccount' V2Stage: anyOf: - - $ref: '#/components/schemas/V2StageSend' - - $ref: '#/components/schemas/V2StageDelay' - - $ref: '#/components/schemas/V2StageWaitEvent' - - $ref: '#/components/schemas/V2Update' + - $ref: '#/components/schemas/V2StageSend' + - $ref: '#/components/schemas/V2StageDelay' + - $ref: '#/components/schemas/V2StageWaitEvent' + - $ref: '#/components/schemas/V2Update' V2StripeTransferRequest: type: object properties: @@ -1015,9 +1046,11 @@ components: default: false metadata: type: object - description: | + description: > A set of key/value pairs that you can attach to a transfer object. - It can be useful for storing additional information about the transfer in a structured format. + + It can be useful for storing additional information about the + transfer in a structured format. example: order_id: '6735' V2ActivityStripeTransfer: @@ -1027,8 +1060,6 @@ components: properties: name: type: string - V2ActivityListWalletsOutput: - $ref: '#/components/schemas/V2ListWalletsResponse' V2ListWalletsResponse: type: object required: @@ -1086,15 +1117,15 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' V2ActivityGetAccount: type: object required: - - id - - ledger + - id + - ledger properties: id: type: string @@ -1125,14 +1156,14 @@ components: V2ActivityGetPayment: type: object required: - - id + - id properties: id: type: string V2ActivityConfirmHold: type: object required: - - id + - id properties: id: type: string @@ -1143,7 +1174,6 @@ components: type: string data: $ref: '#/components/schemas/V2CreditWalletRequest' - V2CreditWalletRequest: type: object required: @@ -1175,8 +1205,8 @@ components: asset: USD/2 amount: 100 metadata: - key: "" - sources: [ ] + key: '' + sources: [] V2LedgerAccountSubject: type: object required: @@ -1208,7 +1238,6 @@ components: oneOf: - $ref: '#/components/schemas/V2LedgerAccountSubject' - $ref: '#/components/schemas/V2WalletSubject' - V2ActivityDebitWallet: type: object properties: @@ -1216,7 +1245,6 @@ components: type: string data: $ref: '#/components/schemas/V2DebitWalletRequest' - V2DebitWalletRequest: type: object required: @@ -1227,7 +1255,9 @@ components: $ref: '#/components/schemas/V2Monetary' pending: type: boolean - description: Set to true to create a pending hold. If false, the wallet will be debited immediately. + description: >- + Set to true to create a pending hold. If false, the wallet will be + debited immediately. metadata: type: object additionalProperties: @@ -1251,20 +1281,19 @@ components: asset: USD/2 amount: 100 metadata: - key: "" + key: '' pending: true - V2ActivityGetWallet: type: object required: - - id + - id properties: id: type: string V2ActivityVoidHold: type: object required: - - id + - id properties: id: type: string @@ -1272,7 +1301,6 @@ components: $ref: '#/components/schemas/V2AccountResponse' V2ActivityCreateTransactionOutput: $ref: '#/components/schemas/V2CreateTransactionResponse' - V2CreateTransactionResponse: properties: data: @@ -1282,7 +1310,6 @@ components: type: object required: - data - V2Transaction: type: object properties: @@ -1307,10 +1334,8 @@ components: - timestamp - txid - metadata - V2ActivityGetPaymentOutput: $ref: '#/components/schemas/V2PaymentResponse' - V2PaymentResponse: type: object required: @@ -1399,7 +1424,6 @@ components: $ref: '#/components/schemas/V2PaymentAdjustment' metadata: $ref: '#/components/schemas/V2PaymentMetadata' - V2Connector: type: string enum: @@ -1411,7 +1435,6 @@ components: - BANKING-CIRCLE - MANGOPAY - MONEYCORP - V2PaymentAdjustment: type: object required: @@ -1435,7 +1458,6 @@ components: type: object absolute: type: boolean - V2PaymentStatus: type: string enum: @@ -1445,17 +1467,14 @@ components: - FAILED - SUCCEEDED - CANCELLED - V2PaymentMetadata: type: object properties: key: type: string nullable: true - V2ActivityDebitWalletOutput: $ref: '#/components/schemas/V2DebitWalletResponse' - V2DebitWalletResponse: type: object required: @@ -1463,7 +1482,6 @@ components: properties: data: $ref: '#/components/schemas/V2Hold' - V2Hold: type: object required: @@ -1488,10 +1506,8 @@ components: type: string destination: $ref: '#/components/schemas/V2Subject' - V2ActivityGetWalletOutput: $ref: '#/components/schemas/V2GetWalletResponse' - V2GetWalletResponse: type: object required: @@ -1499,7 +1515,6 @@ components: properties: data: $ref: '#/components/schemas/V2WalletWithBalances' - V2WalletWithBalances: type: object required: @@ -1533,7 +1548,6 @@ components: $ref: '#/components/schemas/V2AssetHolder' ledger: type: string - V2AssetHolder: type: object required: @@ -1544,7 +1558,6 @@ components: additionalProperties: type: integer format: bigint - V2WorkflowInstanceHistoryStageInput: type: object properties: @@ -1585,7 +1598,6 @@ components: $ref: '#/components/schemas/V2ActivityGetWalletOutput' ListWallets: $ref: '#/components/schemas/V2ListWalletsResponse' - V2Monetary: type: object required: @@ -1599,7 +1611,6 @@ components: type: integer format: bigint description: The amount of the monetary value. - V2PostTransaction: type: object required: @@ -1620,11 +1631,10 @@ components: example: "vars {\naccount $user\n}\nsend [COIN 10] (\n\tsource = @world\n\tdestination = $user\n)\n" vars: type: object - properties: { } + properties: {} additionalProperties: true - example: { - "user": "users:042" - } + example: + user: users:042 required: - plain reference: @@ -1632,13 +1642,12 @@ components: example: ref:001 metadata: $ref: '#/components/schemas/V2Metadata' - V2Metadata: type: object additionalProperties: type: string - example: { admin: "true" } - + example: + admin: 'true' V2Posting: type: object properties: @@ -1661,7 +1670,6 @@ components: - asset - destination - source - V2AccountResponse: type: object required: @@ -1669,7 +1677,6 @@ components: properties: data: $ref: '#/components/schemas/V2Account' - V2ReadTriggerResponse: type: object required: @@ -1677,7 +1684,6 @@ components: properties: data: $ref: '#/components/schemas/V2Trigger' - V2Account: type: object required: @@ -1689,15 +1695,15 @@ components: example: users:001 metadata: type: object - properties: { } + properties: {} additionalProperties: type: string - example: { admin: "true" } + example: + admin: 'true' volumes: $ref: '#/components/schemas/V2Volumes' effectiveVolumes: $ref: '#/components/schemas/V2Volumes' - V2Volume: type: object properties: @@ -1717,7 +1723,6 @@ components: input: 100 output: 20 balance: 80 - V2Volumes: type: object additionalProperties: @@ -1731,7 +1736,6 @@ components: input: 100 output: 10 balance: 90 - V2TestTriggerResponse: type: object required: @@ -1739,7 +1743,6 @@ components: properties: data: $ref: '#/components/schemas/V2TriggerTest' - V2TriggerTest: type: object properties: @@ -1759,7 +1762,6 @@ components: type: string error: type: string - responses: V2ErrorResponse: description: General error diff --git a/ee/reconciliation/openapi.yaml b/ee/reconciliation/openapi.yaml index 8c757e2236..498fc6d4df 100644 --- a/ee/reconciliation/openapi.yaml +++ b/ee/reconciliation/openapi.yaml @@ -1,9 +1,7 @@ openapi: 3.0.3 info: title: Reconciliation API - version: "RECONCILIATION_VERSION" - -# ---------------------- PATHS ---------------------- + version: RECONCILIATION_VERSION paths: /_info: get: @@ -12,11 +10,13 @@ paths: tags: - reconciliation.v1 responses: - 200: + '200': $ref: '#/components/responses/ServerInfo' default: $ref: '#/components/responses/ErrorResponse' - + security: + - Authorization: + - reconciliation:read /policies: post: summary: Create a policy @@ -27,10 +27,13 @@ paths: requestBody: $ref: '#/components/requestBodies/Policy' responses: - 201: + '201': $ref: '#/components/responses/Policy' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - reconciliation:write get: summary: List policies operationId: listPolicies @@ -40,11 +43,13 @@ paths: - $ref: '#/components/parameters/PageSize' - $ref: '#/components/parameters/Cursor' responses: - 200: + '200': $ref: '#/components/responses/Policies' default: $ref: '#/components/responses/ErrorResponse' - + security: + - Authorization: + - reconciliation:read /policies/{policyID}: delete: summary: Delete a policy @@ -55,10 +60,13 @@ paths: parameters: - $ref: '#/components/parameters/PolicyID' responses: - 204: + '204': $ref: '#/components/responses/NoContent' default: $ref: '#/components/responses/ErrorResponse' + security: + - Authorization: + - reconciliation:write get: summary: Get a policy tags: @@ -67,11 +75,13 @@ paths: parameters: - $ref: '#/components/parameters/PolicyID' responses: - 200: + '200': $ref: '#/components/responses/Policy' default: $ref: '#/components/responses/ErrorResponse' - + security: + - Authorization: + - reconciliation:read /policies/{policyID}/reconciliation: post: summary: Reconcile using a policy @@ -84,11 +94,13 @@ paths: requestBody: $ref: '#/components/requestBodies/Reconciliation' responses: - 200: + '200': $ref: '#/components/responses/Reconciliation' default: $ref: '#/components/responses/ErrorResponse' - + security: + - Authorization: + - reconciliation:write /reconciliations: get: summary: List reconciliations @@ -99,11 +111,13 @@ paths: - $ref: '#/components/parameters/PageSize' - $ref: '#/components/parameters/Cursor' responses: - 200: + '200': $ref: '#/components/responses/Reconciliations' default: $ref: '#/components/responses/ErrorResponse' - + security: + - Authorization: + - reconciliation:read /reconciliations/{reconciliationID}: get: summary: Get a reconciliation @@ -113,20 +127,20 @@ paths: parameters: - $ref: '#/components/parameters/ReconciliationID' responses: - 200: + '200': $ref: '#/components/responses/Reconciliation' default: $ref: '#/components/responses/ErrorResponse' - -# ---------------------- COMPONENTS ---------------------- + security: + - Authorization: + - reconciliation:read components: - # ---------------------- PARAMETERS ---------------------- parameters: PageSize: name: pageSize in: query description: | - The maximum number of results to return per page. + The maximum number of results to return per page. example: 100 schema: type: integer @@ -160,8 +174,6 @@ components: description: The reconciliation ID. example: XXX required: true - - # ---------------------- RESPONSES ---------------------- responses: NoContent: description: No content @@ -201,7 +213,6 @@ components: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - # ---------------------- REQUESTS ---------------------- requestBodies: Policy: required: true @@ -215,10 +226,7 @@ components: application/json: schema: $ref: '#/components/schemas/ReconciliationRequest' - - # ---------------------- SCHEMAS ---------------------- schemas: - # ---------------------- CURSORS ---------------------- PoliciesCursorResponse: type: object required: @@ -242,10 +250,10 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: @@ -273,19 +281,18 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' data: type: array items: $ref: '#/components/schemas/Reconciliation' - # ---------------------- RESPONSES ---------------------- ServerInfo: type: object required: - - version + - version properties: version: type: string @@ -299,16 +306,16 @@ components: properties: name: type: string - example: "XXX" + example: XXX ledgerName: type: string - example: "default" + example: default ledgerQuery: type: object additionalProperties: true paymentsPoolID: type: string - example: "XXX" + example: XXX PolicyResponse: type: object required: @@ -325,11 +332,11 @@ components: reconciledAtLedger: type: string format: date-time - example: "2021-01-01T00:00:00.000Z" + example: '2021-01-01T00:00:00.000Z' reconciledAtPayments: type: string format: date-time - example: "2021-01-01T00:00:00.000Z" + example: '2021-01-01T00:00:00.000Z' ReconciliationResponse: type: object required: @@ -349,23 +356,23 @@ components: properties: id: type: string - example: "XXX" + example: XXX name: type: string - example: "XXX" + example: XXX createdAt: type: string format: date-time - example: "2021-01-01T00:00:00.000Z" + example: '2021-01-01T00:00:00.000Z' ledgerName: type: string - example: "default" + example: default ledgerQuery: type: object additionalProperties: true paymentsPoolID: type: string - example: "XXX" + example: XXX Reconciliation: type: object required: @@ -381,25 +388,25 @@ components: properties: id: type: string - example: "XXX" + example: XXX policyID: type: string - example: "XXX" + example: XXX createdAt: type: string format: date-time - example: "2021-01-01T00:00:00.000Z" + example: '2021-01-01T00:00:00.000Z' reconciledAtLedger: type: string format: date-time - example: "2021-01-01T00:00:00.000Z" + example: '2021-01-01T00:00:00.000Z' reconciledAtPayments: type: string format: date-time - example: "2021-01-01T00:00:00.000Z" + example: '2021-01-01T00:00:00.000Z' status: type: string - example: "COMPLETED" + example: COMPLETED paymentsBalances: type: object additionalProperties: @@ -425,8 +432,8 @@ components: properties: errorCode: type: string - example: "VALIDATION" + example: VALIDATION errorMessage: type: string details: - type: string \ No newline at end of file + type: string diff --git a/ee/search/openapi.yaml b/ee/search/openapi.yaml index ca7badae0f..89b5bdb816 100644 --- a/ee/search/openapi.yaml +++ b/ee/search/openapi.yaml @@ -2,7 +2,6 @@ openapi: 3.0.3 info: title: Search API version: latest - paths: /_info: get: @@ -11,12 +10,15 @@ paths: tags: - search.v1 responses: - "200": + '200': description: Server information content: application/json: schema: $ref: '#/components/schemas/ServerInfo' + security: + - Authorization: + - search:read /: post: summary: search.v1 @@ -31,7 +33,7 @@ paths: schema: $ref: '#/components/schemas/Query' responses: - "200": + '200': description: Success content: application/json: @@ -40,7 +42,9 @@ paths: default: description: Error content: {} - + security: + - Authorization: + - search:write components: schemas: ServerInfo: @@ -50,7 +54,6 @@ components: properties: version: type: string - Query: type: object properties: @@ -58,12 +61,12 @@ components: type: array items: type: string - example: "quickstart" + example: quickstart after: type: array items: type: string - example: "users:002" + example: users:002 pageSize: type: integer format: int64 @@ -72,22 +75,23 @@ components: type: array items: type: string - example: "destination=central_bank1" + example: destination=central_bank1 sort: type: string - example: "id:asc" + example: id:asc policy: type: string - example: "OR" + example: OR target: type: string cursor: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= raw: type: object - example: {"query": {"match_all": {}}} - + example: + query: + match_all: {} Response: type: object properties: @@ -116,16 +120,16 @@ components: example: 1 relation: type: string - example: "eq" + example: eq next: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= data: type: array items: allOf: - - type: object - additionalProperties: true + - type: object + additionalProperties: true diff --git a/ee/wallets/openapi.yaml b/ee/wallets/openapi.yaml index 25f52b6baf..c5169bd5b1 100644 --- a/ee/wallets/openapi.yaml +++ b/ee/wallets/openapi.yaml @@ -1,18 +1,16 @@ openapi: 3.0.3 - info: title: Formance Simple Wallets Service API version: 0.1.0 - paths: /_info: get: summary: Get server info operationId: getServerInfo tags: - - wallets.v1 + - wallets.v1 responses: - 200: + '200': description: Server information content: application/json: @@ -24,38 +22,40 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:read /transactions: get: operationId: getTransactions parameters: - - name: pageSize - in: query - description: 'The maximum number of results to return per page' - example: 100 - schema: - type: integer - maximum: 1000 - minimum: 1 - default: 15 - - name: walletID - in: query - description: "A wallet ID to filter on" - example: "wallet1" - schema: - type: string - - name: cursor - in: query - description: | - Parameter used in pagination requests. - Set to the value of next for the next page of results. - Set to the value of previous for the previous page of results. - No other parameters can be set when the cursor is set. - schema: - type: string - example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== + - name: pageSize + in: query + description: The maximum number of results to return per page + example: 100 + schema: + type: integer + maximum: 1000 + minimum: 1 + default: 15 + - name: walletID + in: query + description: A wallet ID to filter on + example: wallet1 + schema: + type: string + - name: cursor + in: query + description: | + Parameter used in pagination requests. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when the cursor is set. + schema: + type: string + example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== tags: - - wallets.v1 + - wallets.v1 responses: '200': description: OK @@ -69,57 +69,62 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:read /wallets: get: summary: List all wallets operationId: listWallets parameters: - - name: name - in: query - description: 'Filter on wallet name' - example: wallet1 - schema: - type: string - - name: metadata - in: query - description: Filter wallets by metadata key value pairs. Nested objects can be used as seen in the example below. - style: deepObject - explode: true - schema: - type: object - properties: { } - additionalProperties: + - name: name + in: query + description: Filter on wallet name + example: wallet1 + schema: type: string - example: { admin: "true" } - - name: pageSize - in: query - description: 'The maximum number of results to return per page' - example: 100 - schema: - type: integer - maximum: 1000 - minimum: 1 - default: 15 - - name: cursor - in: query - description: | - Parameter used in pagination requests. - Set to the value of next for the next page of results. - Set to the value of previous for the previous page of results. - No other parameters can be set when the pagination token is set. - schema: - type: string - example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== - - name: expand - in: query - example: "balances" - schema: - type: string - items: + - name: metadata + in: query + description: >- + Filter wallets by metadata key value pairs. Nested objects can be + used as seen in the example below. + style: deepObject + explode: true + schema: + type: object + properties: {} + additionalProperties: + type: string + example: + admin: 'true' + - name: pageSize + in: query + description: The maximum number of results to return per page + example: 100 + schema: + type: integer + maximum: 1000 + minimum: 1 + default: 15 + - name: cursor + in: query + description: | + Parameter used in pagination requests. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when the pagination token is set. + schema: type: string + example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== + - name: expand + in: query + example: balances + schema: + type: string + items: + type: string tags: - - wallets.v1 + - wallets.v1 responses: '200': description: OK @@ -127,18 +132,20 @@ paths: application/json: schema: $ref: '#/components/schemas/ListWalletsResponse' - default: description: OK content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + security: + - Authorization: + - wallets:read post: summary: Create a new wallet operationId: createWallet tags: - - wallets.v1 + - wallets.v1 parameters: - name: Idempotency-Key in: header @@ -151,7 +158,7 @@ paths: schema: $ref: '#/components/schemas/CreateWalletRequest' responses: - 201: + '201': description: Wallet created content: application/json: @@ -163,27 +170,29 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:write /wallets/{id}: parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string get: summary: Get a wallet operationId: getWallet tags: - - wallets.v1 + - wallets.v1 responses: - 200: + '200': description: Wallet content: application/json: schema: $ref: '#/components/schemas/GetWalletResponse' - 404: + '404': description: Wallet not found default: description: Error @@ -191,12 +200,14 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:read patch: summary: Update a wallet operationId: updateWallet tags: - - wallets.v1 + - wallets.v1 parameters: - name: Idempotency-Key in: header @@ -209,7 +220,7 @@ paths: schema: type: object required: - - metadata + - metadata properties: metadata: type: object @@ -217,7 +228,7 @@ paths: additionalProperties: type: string responses: - 204: + '204': description: Wallet successfully updated default: description: Error @@ -225,27 +236,29 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:write /wallets/{id}/summary: parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string get: summary: Get wallet summary operationId: getWalletSummary tags: - - wallets.v1 + - wallets.v1 responses: - 200: + '200': description: Wallet summary content: application/json: schema: $ref: '#/components/schemas/GetWalletSummaryResponse' - 404: + '404': description: Wallet not found default: description: Error @@ -253,26 +266,31 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:read /wallets/{id}/balances: parameters: - - name: id - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string get: summary: List balances of a wallet operationId: listBalances tags: - - wallets.v1 + - wallets.v1 responses: - 200: + '200': description: Balances list content: application/json: schema: $ref: '#/components/schemas/ListBalancesResponse' + security: + - Authorization: + - wallets:read post: summary: Create a balance operationId: createBalance @@ -290,7 +308,7 @@ paths: schema: $ref: '#/components/schemas/CreateBalanceRequest' responses: - 201: + '201': description: Created balance content: application/json: @@ -302,26 +320,28 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:write /wallets/{id}/balances/{balanceName}: get: parameters: - - name: id - in: path - required: true - schema: - type: string - - name: balanceName - in: path - required: true - schema: - type: string + - name: id + in: path + required: true + schema: + type: string + - name: balanceName + in: path + required: true + schema: + type: string summary: Get detailed balance operationId: getBalance tags: - - wallets.v1 + - wallets.v1 responses: - 200: + '200': description: Balance summary content: application/json: @@ -333,19 +353,21 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:read /wallets/{id}/debit: parameters: - - name: id - in: path - required: true - schema: - type: string - - name: Idempotency-Key - in: header - description: Use an idempotency key - schema: - type: string + - name: id + in: path + required: true + schema: + type: string + - name: Idempotency-Key + in: header + description: Use an idempotency key + schema: + type: string post: summary: Debit a wallet operationId: debitWallet @@ -356,20 +378,20 @@ paths: schema: type: string tags: - - wallets.v1 + - wallets.v1 requestBody: content: application/json: schema: $ref: '#/components/schemas/DebitWalletRequest' responses: - 201: + '201': description: Wallet successfully debited as a pending hold content: application/json: schema: $ref: '#/components/schemas/DebitWalletResponse' - 204: + '204': description: Wallet successfully debited default: description: Error @@ -377,19 +399,21 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:write /wallets/{id}/credit: parameters: - - name: id - in: path - required: true - schema: - type: string - - name: Idempotency-Key - in: header - description: Use an idempotency key - schema: - type: string + - name: id + in: path + required: true + schema: + type: string + - name: Idempotency-Key + in: header + description: Use an idempotency key + schema: + type: string post: summary: Credit a wallet operationId: creditWallet @@ -400,14 +424,14 @@ paths: schema: type: string tags: - - wallets.v1 + - wallets.v1 requestBody: content: application/json: schema: $ref: '#/components/schemas/CreditWalletRequest' responses: - 204: + '204': description: Wallet successfully credited default: description: Error @@ -415,51 +439,56 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:write /holds: get: summary: Get all holds for a wallet tags: - - wallets.v1 + - wallets.v1 operationId: getHolds parameters: - - name: pageSize - in: query - description: 'The maximum number of results to return per page' - example: 100 - schema: - type: integer - maximum: 1000 - minimum: 1 - default: 15 - - name: walletID - in: query - description: 'The wallet to filter on' - example: wallet1 - schema: - type: string - - name: metadata - in: query - description: Filter holds by metadata key value pairs. Nested objects can be used as seen in the example below. - style: deepObject - schema: - type: object - properties: { } - additionalProperties: + - name: pageSize + in: query + description: The maximum number of results to return per page + example: 100 + schema: + type: integer + maximum: 1000 + minimum: 1 + default: 15 + - name: walletID + in: query + description: The wallet to filter on + example: wallet1 + schema: type: string - example: { admin: "true" } - - name: cursor - in: query - description: | - Parameter used in pagination requests. - Set to the value of next for the next page of results. - Set to the value of previous for the previous page of results. - No other parameters can be set when the pagination token is set. - schema: - type: string - example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== + - name: metadata + in: query + description: >- + Filter holds by metadata key value pairs. Nested objects can be used + as seen in the example below. + style: deepObject + schema: + type: object + properties: {} + additionalProperties: + type: string + example: + admin: 'true' + - name: cursor + in: query + description: | + Parameter used in pagination requests. + Set to the value of next for the next page of results. + Set to the value of previous for the previous page of results. + No other parameters can be set when the pagination token is set. + schema: + type: string + example: aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== responses: - 200: + '200': description: Holds content: application/json: @@ -471,22 +500,24 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:read /holds/{holdID}: get: summary: Get a hold tags: - - wallets.v1 + - wallets.v1 operationId: getHold parameters: - - name: holdID - in: path - schema: - type: string - required: true - description: The hold ID + - name: holdID + in: path + schema: + type: string + required: true + description: The hold ID responses: - 200: + '200': description: Holds content: application/json: @@ -498,20 +529,22 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:read /holds/{hold_id}/confirm: post: parameters: - - name: hold_id - in: path - required: true - schema: - type: string - - name: Idempotency-Key - in: header - description: Use an idempotency key - schema: - type: string + - name: hold_id + in: path + required: true + schema: + type: string + - name: Idempotency-Key + in: header + description: Use an idempotency key + schema: + type: string requestBody: content: application/json: @@ -519,10 +552,10 @@ paths: $ref: '#/components/schemas/ConfirmHoldRequest' summary: Confirm a hold tags: - - wallets.v1 + - wallets.v1 operationId: confirmHold responses: - 204: + '204': description: Hold successfully confirmed, funds moved back to initial destination default: description: Error @@ -530,24 +563,26 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:write /holds/{hold_id}/void: parameters: - - name: hold_id - in: path - required: true - schema: - type: string - - name: Idempotency-Key - in: header - description: Use an idempotency key - schema: - type: string + - name: hold_id + in: path + required: true + schema: + type: string + - name: Idempotency-Key + in: header + description: Use an idempotency key + schema: + type: string post: summary: Cancel a hold operationId: voidHold tags: - - wallets.v1 + - wallets.v1 parameters: - name: Idempotency-Key in: header @@ -555,7 +590,7 @@ paths: schema: type: string responses: - 204: + '204': description: Hold successfully cancelled, funds returned to wallet default: description: Error @@ -563,14 +598,16 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - wallets:write components: schemas: Monetary: type: object required: - - asset - - amount + - asset + - amount properties: asset: type: string @@ -582,11 +619,11 @@ components: Wallet: type: object required: - - name - - id - - metadata - - createdAt - - ledger + - name + - id + - metadata + - createdAt + - ledger properties: id: type: string @@ -614,12 +651,12 @@ components: WalletWithBalances: type: object required: - - name - - id - - metadata - - createdAt - - balances - - ledger + - name + - id + - metadata + - createdAt + - balances + - ledger properties: id: type: string @@ -638,7 +675,7 @@ components: balances: type: object required: - - main + - main properties: main: $ref: '#/components/schemas/AssetHolder' @@ -647,10 +684,10 @@ components: Hold: type: object required: - - id - - walletID - - metadata - - description + - id + - walletID + - metadata + - description properties: id: type: string @@ -670,56 +707,56 @@ components: $ref: '#/components/schemas/Subject' ExpandedDebitHold: allOf: - - $ref: '#/components/schemas/Hold' - - type: object - required: - - remaining - - originalAmount - properties: - remaining: - type: integer - description: Remaining amount on hold - example: 10 - format: bigint - originalAmount: - type: integer - description: Original amount on hold - example: 100 - format: bigint + - $ref: '#/components/schemas/Hold' + - type: object + required: + - remaining + - originalAmount + properties: + remaining: + type: integer + description: Remaining amount on hold + example: 10 + format: bigint + originalAmount: + type: integer + description: Original amount on hold + example: 100 + format: bigint ListWalletsResponse: type: object required: - - cursor + - cursor properties: cursor: allOf: - - $ref: '#/components/schemas/Cursor' - - properties: - data: - items: - $ref: '#/components/schemas/Wallet' - type: array - type: object - required: - - data + - $ref: '#/components/schemas/Cursor' + - properties: + data: + items: + $ref: '#/components/schemas/Wallet' + type: array + type: object + required: + - data CreateWalletResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/Wallet' GetWalletResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/WalletWithBalances' DebitWalletResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/Hold' @@ -747,10 +784,10 @@ components: type: string example: users:001 required: - - amount - - asset - - destination - - source + - amount + - asset + - destination + - source Transaction: type: object properties: @@ -780,14 +817,14 @@ components: postCommitVolumes: $ref: '#/components/schemas/AggregatedVolumes' required: - - postings - - timestamp - - id - - metadata + - postings + - timestamp + - id + - metadata Cursor: type: object required: - - pageSize + - pageSize properties: pageSize: type: integer @@ -800,54 +837,54 @@ components: example: false previous: type: string - example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= next: type: string - example: "" + example: '' GetTransactionsResponse: type: object required: - - cursor + - cursor properties: cursor: allOf: - - $ref: '#/components/schemas/Cursor' - - properties: - data: - items: - $ref: '#/components/schemas/Transaction' - type: array - type: object - required: - - data + - $ref: '#/components/schemas/Cursor' + - properties: + data: + items: + $ref: '#/components/schemas/Transaction' + type: array + type: object + required: + - data GetHoldsResponse: type: object required: - - cursor + - cursor properties: cursor: allOf: - - $ref: '#/components/schemas/Cursor' - - properties: - data: - items: - $ref: '#/components/schemas/Hold' - type: array - type: object - required: - - data + - $ref: '#/components/schemas/Cursor' + - properties: + data: + items: + $ref: '#/components/schemas/Hold' + type: array + type: object + required: + - data GetHoldResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/ExpandedDebitHold' CreateWalletRequest: type: object required: - - name - - metadata + - name + - metadata properties: metadata: type: object @@ -869,9 +906,9 @@ components: type: integer format: bigint required: - - input - - output - - balance + - input + - output + - balance example: input: 100 output: 20 @@ -900,12 +937,14 @@ components: final: type: boolean example: true - description: Define a final confirmation. Remaining funds will be returned to the wallet. + description: >- + Define a final confirmation. Remaining funds will be returned to the + wallet. LedgerAccountSubject: type: object required: - - type - - identifier + - type + - identifier properties: type: type: string @@ -914,8 +953,8 @@ components: WalletSubject: type: object required: - - type - - identifier + - type + - identifier properties: type: type: string @@ -930,12 +969,12 @@ components: ACCOUNT: '#/components/schemas/LedgerAccountSubject' WALLET: '#/components/schemas/WalletSubject' oneOf: - - $ref: '#/components/schemas/LedgerAccountSubject' - - $ref: '#/components/schemas/WalletSubject' + - $ref: '#/components/schemas/LedgerAccountSubject' + - $ref: '#/components/schemas/WalletSubject' CreditWalletRequest: type: object required: - - amount + - amount properties: amount: $ref: '#/components/schemas/Monetary' @@ -963,20 +1002,21 @@ components: asset: USD/2 amount: 100 metadata: - key: "" + key: '' sources: [] - DebitWalletRequest: type: object required: - - amount - - metadata + - amount + - metadata properties: amount: $ref: '#/components/schemas/Monetary' pending: type: boolean - description: Set to true to create a pending hold. If false, the wallet will be debited immediately. + description: >- + Set to true to create a pending hold. If false, the wallet will be + debited immediately. metadata: type: object additionalProperties: @@ -1000,20 +1040,19 @@ components: asset: USD/2 amount: 100 metadata: - key: "" + key: '' pending: true - ServerInfo: type: object required: - - version + - version properties: version: type: string AssetHolder: type: object required: - - assets + - assets properties: assets: type: object @@ -1023,7 +1062,7 @@ components: Balance: type: object required: - - name + - name properties: name: type: string @@ -1036,16 +1075,16 @@ components: format: bigint BalanceWithAssets: allOf: - - $ref: '#/components/schemas/Balance' - - $ref: '#/components/schemas/AssetHolder' + - $ref: '#/components/schemas/Balance' + - $ref: '#/components/schemas/AssetHolder' GetWalletSummaryResponse: type: object required: - - balances - - availableFunds - - expiredFunds - - expirableFunds - - holdFunds + - balances + - availableFunds + - expiredFunds + - expirableFunds + - holdFunds properties: balances: type: array @@ -1074,48 +1113,47 @@ components: ListBalancesResponse: type: object required: - - cursor + - cursor properties: cursor: allOf: - - $ref: '#/components/schemas/Cursor' - - properties: - data: - items: - $ref: '#/components/schemas/Balance' - type: array - type: object - required: - - data + - $ref: '#/components/schemas/Cursor' + - properties: + data: + items: + $ref: '#/components/schemas/Balance' + type: array + type: object + required: + - data GetBalanceResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/BalanceWithAssets' CreateBalanceRequest: $ref: '#/components/schemas/Balance' - CreateBalanceResponse: type: object required: - - data + - data properties: data: $ref: '#/components/schemas/Balance' ErrorResponse: type: object required: - - errorCode - - errorMessage + - errorCode + - errorMessage properties: errorCode: type: string enum: - - VALIDATION - - INTERNAL_ERROR - - INSUFFICIENT_FUND - - HOLD_CLOSED + - VALIDATION + - INTERNAL_ERROR + - INSUFFICIENT_FUND + - HOLD_CLOSED errorMessage: type: string diff --git a/ee/webhooks/openapi.yaml b/ee/webhooks/openapi.yaml index 0d8f79175f..ea4b40ba6f 100644 --- a/ee/webhooks/openapi.yaml +++ b/ee/webhooks/openapi.yaml @@ -1,8 +1,7 @@ openapi: 3.0.3 info: title: Webhooks - version: "WEBHOOKS_VERSION" - + version: WEBHOOKS_VERSION paths: /configs: get: @@ -27,30 +26,37 @@ paths: type: string example: https://example.com responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ConfigsResponse' - default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - webhooks:read post: summary: Insert a new config - description: | + description: > Insert a new webhooks config. + The endpoint should be a valid https URL and be unique. + The secret is the endpoint's verification secret. + If not passed or empty, a secret is automatically generated. - The format is a random string of bytes of size 24, base64 encoded. (larger size after encoding) + + The format is a random string of bytes of size 24, base64 encoded. + (larger size after encoding) + All eventTypes are converted to lower-case when inserted. operationId: insertConfig @@ -63,20 +69,21 @@ paths: $ref: '#/components/schemas/ConfigUser' required: true responses: - "200": + '200': description: Config created successfully. content: application/json: schema: $ref: '#/components/schemas/ConfigResponse' - default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - webhooks:write /configs/{id}: delete: summary: Delete one config @@ -93,16 +100,17 @@ paths: type: string example: 4997257d-dfb6-445b-929c-cbe2ab182818 responses: - "200": + '200': description: Config successfully deleted. - default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - webhooks:write /configs/{id}/test: get: summary: Test one config @@ -119,24 +127,27 @@ paths: type: string example: 4997257d-dfb6-445b-929c-cbe2ab182818 responses: - "200": + '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AttemptResponse' - default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - webhooks:read /configs/{id}/activate: put: summary: Activate one config - description: Activate a webhooks config by ID, to start receiving webhooks to its endpoint. + description: >- + Activate a webhooks config by ID, to start receiving webhooks to its + endpoint. operationId: activateConfig tags: - webhooks.v1 @@ -149,24 +160,27 @@ paths: type: string example: 4997257d-dfb6-445b-929c-cbe2ab182818 responses: - "200": + '200': description: Config successfully activated. content: application/json: schema: $ref: '#/components/schemas/ConfigResponse' - default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - webhooks:write /configs/{id}/deactivate: put: summary: Deactivate one config - description: Deactivate a webhooks config by ID, to stop receiving webhooks to its endpoint. + description: >- + Deactivate a webhooks config by ID, to stop receiving webhooks to its + endpoint. operationId: deactivateConfig tags: - webhooks.v1 @@ -179,28 +193,32 @@ paths: type: string example: 4997257d-dfb6-445b-929c-cbe2ab182818 responses: - "200": + '200': description: Config successfully deactivated. content: application/json: schema: $ref: '#/components/schemas/ConfigResponse' - default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - webhooks:write /configs/{id}/secret/change: put: summary: Change the signing secret of a config - description: | + description: > Change the signing secret of the endpoint of a webhooks config. + If not passed or empty, a secret is automatically generated. - The format is a random string of bytes of size 24, base64 encoded. (larger size after encoding) + + The format is a random string of bytes of size 24, base64 encoded. + (larger size after encoding) operationId: changeConfigSecret tags: - webhooks.v1 @@ -218,20 +236,21 @@ paths: type: string example: 4997257d-dfb6-445b-929c-cbe2ab182818 responses: - "200": + '200': description: Secret successfully changed. content: application/json: schema: $ref: '#/components/schemas/ConfigResponse' - default: description: Error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - + security: + - Authorization: + - webhooks:write components: schemas: ConfigUser: @@ -242,20 +261,21 @@ components: properties: name: type: string - example: "customer_payment" + example: customer_payment endpoint: type: string - example: "https://example.com" + example: https://example.com secret: type: string - example: "V0bivxRWveaoz08afqjU6Ko/jwO0Cb+3" + example: V0bivxRWveaoz08afqjU6Ko/jwO0Cb+3 eventTypes: type: array items: type: string - example: "TYPE1" - example: ["TYPE1", "TYPE2"] - + example: TYPE1 + example: + - TYPE1 + - TYPE2 ConfigsResponse: type: object required: @@ -272,7 +292,6 @@ components: type: object required: - data - Cursor: type: object required: @@ -286,7 +305,6 @@ components: type: array items: $ref: '#/components/schemas/WebhooksConfig' - ConfigResponse: type: object required: @@ -294,7 +312,6 @@ components: properties: data: $ref: '#/components/schemas/WebhooksConfig' - WebhooksConfig: properties: id: @@ -302,16 +319,18 @@ components: format: uuid endpoint: type: string - example: "https://example.com" + example: https://example.com secret: type: string - example: "V0bivxRWveaoz08afqjU6Ko/jwO0Cb+3" + example: V0bivxRWveaoz08afqjU6Ko/jwO0Cb+3 eventTypes: type: array items: type: string - example: "TYPE1" - example: ["TYPE1", "TYPE2"] + example: TYPE1 + example: + - TYPE1 + - TYPE2 active: type: boolean example: true @@ -329,16 +348,14 @@ components: - active - createdAt - updatedAt - ConfigChangeSecret: type: object properties: secret: type: string - example: "V0bivxRWveaoz08afqjU6Ko/jwO0Cb+3" + example: V0bivxRWveaoz08afqjU6Ko/jwO0Cb+3 required: - secret - AttemptResponse: type: object required: @@ -346,7 +363,6 @@ components: properties: data: $ref: '#/components/schemas/Attempt' - Attempt: properties: id: @@ -388,7 +404,6 @@ components: - statusCode - retryAttempt - status - ErrorResponse: type: object required: @@ -399,11 +414,11 @@ components: $ref: '#/components/schemas/ErrorsEnum' errorMessage: type: string - example: "[VALIDATION] invalid 'cursor' query param" + example: '[VALIDATION] invalid ''cursor'' query param' details: type: string - example: "https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9" - + example: >- + https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9 ErrorsEnum: type: string enum: diff --git a/releases/base.yaml b/releases/base.yaml index f45e617a6b..10932d2e2b 100644 --- a/releases/base.yaml +++ b/releases/base.yaml @@ -25,9 +25,23 @@ info: servers: - url: http://localhost description: local server +- url: https://{stack}.sandbox.formance.cloud + description: sandbox server -security: - - Authorization: [] +#security: {} +# - Authorization: [] + +tags: + - name: ledger.v1 + - name: ledger.v2 + - name: payments.v1 + - name: auth.v1 + - name: orchestration.v1 + - name: orchestration.v2 + - name: reconciliation.v1 + - name: search.v1 + - name: webhooks.v1 + - name: wallets.v1 components: securitySchemes: diff --git a/releases/sdks/go/.speakeasy/gen.lock b/releases/sdks/go/.speakeasy/gen.lock old mode 100755 new mode 100644 index 197a44e524..a1e51e3d17 --- a/releases/sdks/go/.speakeasy/gen.lock +++ b/releases/sdks/go/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 -id: 7eac0a45-60a2-40bb-9e85-26bd77ec2a6d +id: 8cc5b996-ee96-49ac-9b4e-0cc5e3bfbe2f management: - docChecksum: 0565b0e11806fc861715659cc13d103e + docChecksum: e92196089dd1f79fdb19e88fc5e39117 docVersion: v0.0.0 speakeasyVersion: 1.346.0 generationVersion: 2.379.3 releaseVersion: v0.0.0 - configChecksum: 86fb0b4c762641bbbe6b4f59e9dd3989 + configChecksum: f2202d55313914a857427cd0c614fbb1 features: go: additionalDependencies: 0.1.0 @@ -25,6 +25,7 @@ features: intellisenseMarkdownSupport: 0.1.0 nameOverrides: 2.81.2 nullables: 0.1.0 + oauth2ClientCredentials: 0.1.1 responseFormat: 0.1.2 retries: 2.83.0 sdkHooks: 0.1.0 @@ -1375,4 +1376,5 @@ generatedFiles: - pkg/models/operations/options.go - .gitattributes - internal/hooks/hooks.go + - internal/hooks/clientcredentials.go - CONTRIBUTING.md diff --git a/releases/sdks/go/README.md b/releases/sdks/go/README.md index bdd7006bf6..8c82504225 100644 --- a/releases/sdks/go/README.md +++ b/releases/sdks/go/README.md @@ -1,7 +1,7 @@ # github.com/formancehq/formance-sdk-go/v2
- + @@ -11,9 +11,9 @@ ## 🏗 **Welcome to your new SDK!** 🏗 It has been generated successfully based on your OpenAPI spec. However, it is not yet ready for production use. Here are some next steps: -- [ ] 🛠 Make your SDK feel handcrafted by [customizing it](https://www.speakeasyapi.dev/docs/customize-sdks) +- [ ] 🛠 Make your SDK feel handcrafted by [customizing it](https://www.speakeasy.com/docs/customize-sdks) - [ ] ♻️ Refine your SDK quickly by iterating locally with the [Speakeasy CLI](https://github.com/speakeasy-api/speakeasy) -- [ ] 🎁 Publish your SDK to package managers by [configuring automatic publishing](https://www.speakeasyapi.dev/docs/productionize-sdks/publish-sdks) +- [ ] 🎁 Publish your SDK to package managers by [configuring automatic publishing](https://www.speakeasy.com/docs/advanced-setup/publish-sdks) - [ ] ✨ When ready to productionize, delete this section from the README @@ -43,7 +43,7 @@ import ( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -274,6 +274,98 @@ func main() { * [TestConfig](docs/sdks/formancewebhooksv1/README.md#testconfig) - Test one config + +## Retries + +Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK. + +To change the default retry strategy for a single API call, simply provide a `retry.Config` object to the call by using the `WithRetries` option: +```go +package main + +import ( + "context" + "github.com/formancehq/formance-sdk-go/v2" + "github.com/formancehq/formance-sdk-go/v2/pkg/models/shared" + "github.com/formancehq/formance-sdk-go/v2/pkg/retry" + "log" + "os" + "pkg/models/operations" +) + +func main() { + s := v2.New( + v2.WithSecurity(shared.Security{ + ClientID: v2.String(os.Getenv("CLIENT_ID")), + }), + ) + + ctx := context.Background() + res, err := s.GetVersions(ctx, operations.WithRetries( + retry.Config{ + Strategy: "backoff", + Backoff: &retry.BackoffStrategy{ + InitialInterval: 1, + MaxInterval: 50, + Exponent: 1.1, + MaxElapsedTime: 100, + }, + RetryConnectionErrors: false, + })) + if err != nil { + log.Fatal(err) + } + if res.GetVersionsResponse != nil { + // handle response + } +} + +``` + +If you'd like to override the default retry strategy for all operations that support retries, you can use the `WithRetryConfig` option at SDK initialization: +```go +package main + +import ( + "context" + "github.com/formancehq/formance-sdk-go/v2" + "github.com/formancehq/formance-sdk-go/v2/pkg/models/shared" + "github.com/formancehq/formance-sdk-go/v2/pkg/retry" + "log" + "os" +) + +func main() { + s := v2.New( + v2.WithRetryConfig( + retry.Config{ + Strategy: "backoff", + Backoff: &retry.BackoffStrategy{ + InitialInterval: 1, + MaxInterval: 50, + Exponent: 1.1, + MaxElapsedTime: 100, + }, + RetryConnectionErrors: false, + }), + v2.WithSecurity(shared.Security{ + ClientID: v2.String(os.Getenv("CLIENT_ID")), + }), + ) + + ctx := context.Background() + res, err := s.GetVersions(ctx) + if err != nil { + log.Fatal(err) + } + if res.GetVersionsResponse != nil { + // handle response + } +} + +``` + + ## Error Handling @@ -304,7 +396,7 @@ import ( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.CreateTransactionsRequest{ @@ -356,6 +448,7 @@ You can override the default server globally using the `WithServerIndex` option | # | Server | Variables | | - | ------ | --------- | | 0 | `http://localhost` | None | +| 1 | `https://{stack}.sandbox.formance.cloud` | None | #### Example @@ -372,9 +465,9 @@ import ( func main() { s := v2.New( - v2.WithServerIndex(0), + v2.WithServerIndex(1), v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -409,7 +502,7 @@ func main() { s := v2.New( v2.WithServerURL("http://localhost"), v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -460,13 +553,14 @@ This can be a convenient way to configure timeouts, cookies, proxies, custom hea ### Per-Client Security Schemes -This SDK supports the following security scheme globally: +This SDK supports the following security schemes globally: -| Name | Type | Scheme | -| --------------- | --------------- | --------------- | -| `Authorization` | oauth2 | OAuth2 token | +| Name | Type | Scheme | +| -------------- | -------------- | -------------- | +| `ClientID` | oauth2 | OAuth2 token | +| `ClientSecret` | oauth2 | OAuth2 token | -You can configure it using the `WithSecurity` option when initializing the SDK client instance. For example: +You can set the security parameters through the `WithSecurity` option when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example: ```go package main @@ -481,7 +575,7 @@ import ( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -504,98 +598,6 @@ func main() { - -## Retries - -Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK. - -To change the default retry strategy for a single API call, simply provide a `retry.Config` object to the call by using the `WithRetries` option: -```go -package main - -import ( - "context" - "github.com/formancehq/formance-sdk-go/v2" - "github.com/formancehq/formance-sdk-go/v2/pkg/models/shared" - "github.com/formancehq/formance-sdk-go/v2/pkg/retry" - "log" - "os" - "pkg/models/operations" -) - -func main() { - s := v2.New( - v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), - }), - ) - - ctx := context.Background() - res, err := s.GetVersions(ctx, operations.WithRetries( - retry.Config{ - Strategy: "backoff", - Backoff: &retry.BackoffStrategy{ - InitialInterval: 1, - MaxInterval: 50, - Exponent: 1.1, - MaxElapsedTime: 100, - }, - RetryConnectionErrors: false, - })) - if err != nil { - log.Fatal(err) - } - if res.GetVersionsResponse != nil { - // handle response - } -} - -``` - -If you'd like to override the default retry strategy for all operations that support retries, you can use the `WithRetryConfig` option at SDK initialization: -```go -package main - -import ( - "context" - "github.com/formancehq/formance-sdk-go/v2" - "github.com/formancehq/formance-sdk-go/v2/pkg/models/shared" - "github.com/formancehq/formance-sdk-go/v2/pkg/retry" - "log" - "os" -) - -func main() { - s := v2.New( - v2.WithRetryConfig( - retry.Config{ - Strategy: "backoff", - Backoff: &retry.BackoffStrategy{ - InitialInterval: 1, - MaxInterval: 50, - Exponent: 1.1, - MaxElapsedTime: 100, - }, - RetryConnectionErrors: false, - }), - v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), - }), - ) - - ctx := context.Background() - res, err := s.GetVersions(ctx) - if err != nil { - log.Fatal(err) - } - if res.GetVersionsResponse != nil { - // handle response - } -} - -``` - - # Development @@ -608,7 +610,7 @@ looking for the latest version. ## Contributions -While we value open-source contributions to this SDK, this library is generated programmatically. -Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release! +While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. +We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release. -### SDK Created by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks) +### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=&utm_campaign=go) diff --git a/releases/sdks/go/USAGE.md b/releases/sdks/go/USAGE.md index 6bfbc0a67e..c671ac9d49 100644 --- a/releases/sdks/go/USAGE.md +++ b/releases/sdks/go/USAGE.md @@ -13,7 +13,7 @@ import ( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) diff --git a/releases/sdks/go/docs/pkg/models/shared/security.md b/releases/sdks/go/docs/pkg/models/shared/security.md index 1fe487ab4e..56fbad446b 100644 --- a/releases/sdks/go/docs/pkg/models/shared/security.md +++ b/releases/sdks/go/docs/pkg/models/shared/security.md @@ -3,6 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `Authorization` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `ClientID` | **string* | :heavy_minus_sign: | N/A | | +| `ClientSecret` | **string* | :heavy_minus_sign: | N/A | | +| `TokenURL` | **string* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/releases/sdks/go/docs/sdks/formance/README.md b/releases/sdks/go/docs/sdks/formance/README.md index b3e0e3907d..f3d24d40ae 100644 --- a/releases/sdks/go/docs/sdks/formance/README.md +++ b/releases/sdks/go/docs/sdks/formance/README.md @@ -40,7 +40,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) diff --git a/releases/sdks/go/docs/sdks/formanceorchestrationv1/README.md b/releases/sdks/go/docs/sdks/formanceorchestrationv1/README.md index 053e8cce3d..c4b0218940 100644 --- a/releases/sdks/go/docs/sdks/formanceorchestrationv1/README.md +++ b/releases/sdks/go/docs/sdks/formanceorchestrationv1/README.md @@ -42,7 +42,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.CancelEventRequest{ @@ -96,7 +96,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) var request *shared.TriggerData = &shared.TriggerData{ @@ -151,7 +151,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) var request *shared.CreateWorkflowRequest = &shared.CreateWorkflowRequest{ @@ -210,7 +210,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.DeleteTriggerRequest{ @@ -265,7 +265,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.DeleteWorkflowRequest{ @@ -320,7 +320,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetInstanceRequest{ @@ -375,7 +375,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetInstanceHistoryRequest{ @@ -430,7 +430,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetInstanceStageHistoryRequest{ @@ -486,7 +486,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetWorkflowRequest{ @@ -541,7 +541,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListInstancesRequest{ @@ -597,7 +597,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListTriggersRequest{} @@ -650,7 +650,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListTriggersOccurrencesRequest{ @@ -704,7 +704,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -755,7 +755,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -807,7 +807,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ReadTriggerRequest{ @@ -862,7 +862,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.RunWorkflowRequest{ @@ -917,7 +917,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.SendEventRequest{ diff --git a/releases/sdks/go/docs/sdks/formancepaymentsv1/README.md b/releases/sdks/go/docs/sdks/formancepaymentsv1/README.md index e9ccd8b702..a3b363cd4e 100644 --- a/releases/sdks/go/docs/sdks/formancepaymentsv1/README.md +++ b/releases/sdks/go/docs/sdks/formancepaymentsv1/README.md @@ -68,7 +68,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.AddAccountToPoolRequest{ @@ -127,7 +127,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ConnectorsTransferRequest{ @@ -188,7 +188,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := shared.AccountRequest{ @@ -245,7 +245,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := shared.BankAccountRequest{ @@ -303,7 +303,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := shared.PaymentRequest{ @@ -364,7 +364,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := shared.PoolRequest{ @@ -423,7 +423,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := shared.TransferInitiationRequest{ @@ -486,7 +486,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.DeletePoolRequest{ @@ -541,7 +541,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.DeleteTransferInitiationRequest{ @@ -596,7 +596,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ForwardBankAccountRequest{ @@ -654,7 +654,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetAccountBalancesRequest{ @@ -715,7 +715,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetBankAccountRequest{ @@ -772,7 +772,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetConnectorTaskRequest{ @@ -828,7 +828,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetConnectorTaskV1Request{ @@ -885,7 +885,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetPaymentRequest{ @@ -940,7 +940,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetPoolRequest{ @@ -996,7 +996,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetPoolBalancesRequest{ @@ -1052,7 +1052,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetTransferInitiationRequest{ @@ -1107,7 +1107,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.InstallConnectorRequest{ @@ -1168,7 +1168,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -1220,7 +1220,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListBankAccountsRequest{ @@ -1279,7 +1279,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -1333,7 +1333,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListConnectorTasksRequest{ @@ -1390,7 +1390,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListConnectorTasksV1Request{ @@ -1448,7 +1448,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListPaymentsRequest{ @@ -1508,7 +1508,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListPoolsRequest{ @@ -1568,7 +1568,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListTransferInitiationsRequest{ @@ -1628,7 +1628,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.PaymentsgetAccountRequest{ @@ -1682,7 +1682,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -1734,7 +1734,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.PaymentslistAccountsRequest{ @@ -1796,7 +1796,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ReadConnectorConfigRequest{ @@ -1851,7 +1851,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ReadConnectorConfigV1Request{ @@ -1907,7 +1907,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.RemoveAccountFromPoolRequest{ @@ -1967,7 +1967,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ResetConnectorRequest{ @@ -2024,7 +2024,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ResetConnectorV1Request{ @@ -2080,7 +2080,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.RetryTransferInitiationRequest{ @@ -2136,7 +2136,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ReverseTransferInitiationRequest{ @@ -2200,7 +2200,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.UdpateTransferInitiationStatusRequest{ @@ -2260,7 +2260,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.UninstallConnectorRequest{ @@ -2315,7 +2315,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.UninstallConnectorV1Request{ @@ -2371,7 +2371,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.UpdateBankAccountMetadataRequest{ @@ -2431,7 +2431,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.UpdateConnectorConfigV1Request{ @@ -2495,7 +2495,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.UpdateMetadataRequest{ diff --git a/releases/sdks/go/docs/sdks/formancereconciliationv1/README.md b/releases/sdks/go/docs/sdks/formancereconciliationv1/README.md index 7bcdd7dbff..5ea5b6e04f 100644 --- a/releases/sdks/go/docs/sdks/formancereconciliationv1/README.md +++ b/releases/sdks/go/docs/sdks/formancereconciliationv1/README.md @@ -32,7 +32,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := shared.PolicyRequest{ @@ -92,7 +92,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.DeletePolicyRequest{ @@ -147,7 +147,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetPolicyRequest{ @@ -202,7 +202,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetReconciliationRequest{ @@ -257,7 +257,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListPoliciesRequest{ @@ -313,7 +313,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListReconciliationsRequest{ @@ -370,7 +370,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ReconcileRequest{ @@ -428,7 +428,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) diff --git a/releases/sdks/go/docs/sdks/formancesearchv1/README.md b/releases/sdks/go/docs/sdks/formancesearchv1/README.md index 8955cfad14..82fb87e909 100644 --- a/releases/sdks/go/docs/sdks/formancesearchv1/README.md +++ b/releases/sdks/go/docs/sdks/formancesearchv1/README.md @@ -26,7 +26,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := shared.Query{ @@ -91,7 +91,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) diff --git a/releases/sdks/go/docs/sdks/formancev1/README.md b/releases/sdks/go/docs/sdks/formancev1/README.md index 4baf4fd166..56d5f90ac1 100644 --- a/releases/sdks/go/docs/sdks/formancev1/README.md +++ b/releases/sdks/go/docs/sdks/formancev1/README.md @@ -46,7 +46,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.CreateTransactionsRequest{ @@ -117,7 +117,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.AddMetadataOnTransactionRequest{ @@ -173,7 +173,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.AddMetadataToAccountRequest{ @@ -232,7 +232,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.CountAccountsRequest{ @@ -340,7 +340,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.CountTransactionsRequest{ @@ -401,7 +401,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.CreateTransactionRequest{ @@ -481,7 +481,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetAccountRequest{ @@ -537,7 +537,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetBalancesRequest{ @@ -595,7 +595,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetBalancesAggregatedRequest{ @@ -650,7 +650,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -702,7 +702,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetLedgerInfoRequest{ @@ -757,7 +757,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetMappingRequest{ @@ -813,7 +813,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetTransactionRequest{ @@ -869,7 +869,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListAccountsRequest{ @@ -981,7 +981,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListLogsRequest{ @@ -1039,7 +1039,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListTransactionsRequest{ @@ -1102,7 +1102,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ReadStatsRequest{ @@ -1158,7 +1158,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.RevertTransactionRequest{ @@ -1217,7 +1217,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.RunScriptRequest{ @@ -1286,7 +1286,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.UpdateMappingRequest{ diff --git a/releases/sdks/go/docs/sdks/formancev2/README.md b/releases/sdks/go/docs/sdks/formancev2/README.md index d2c204f63a..7a94cbf172 100644 --- a/releases/sdks/go/docs/sdks/formancev2/README.md +++ b/releases/sdks/go/docs/sdks/formancev2/README.md @@ -43,7 +43,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2CancelEventRequest{ @@ -97,7 +97,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) var request *shared.V2TriggerData = &shared.V2TriggerData{ @@ -152,7 +152,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) var request *shared.V2CreateWorkflowRequest = &shared.V2CreateWorkflowRequest{ @@ -211,7 +211,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2DeleteTriggerRequest{ @@ -266,7 +266,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2DeleteWorkflowRequest{ @@ -321,7 +321,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2GetInstanceRequest{ @@ -376,7 +376,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2GetInstanceHistoryRequest{ @@ -431,7 +431,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2GetInstanceStageHistoryRequest{ @@ -486,7 +486,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -538,7 +538,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2GetWorkflowRequest{ @@ -593,7 +593,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2ListInstancesRequest{ @@ -651,7 +651,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2ListTriggersRequest{ @@ -707,7 +707,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2ListTriggersOccurrencesRequest{ @@ -764,7 +764,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2ListWorkflowsRequest{ @@ -820,7 +820,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2ReadTriggerRequest{ @@ -875,7 +875,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2RunWorkflowRequest{ @@ -930,7 +930,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2SendEventRequest{ @@ -985,7 +985,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.TestTriggerRequest{ diff --git a/releases/sdks/go/docs/sdks/formancewalletsv1/README.md b/releases/sdks/go/docs/sdks/formancewalletsv1/README.md index 258a8933bf..7a60235033 100644 --- a/releases/sdks/go/docs/sdks/formancewalletsv1/README.md +++ b/releases/sdks/go/docs/sdks/formancewalletsv1/README.md @@ -42,7 +42,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ConfirmHoldRequest{ @@ -101,7 +101,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.CreateBalanceRequest{ @@ -156,7 +156,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.CreateWalletRequest{} @@ -210,7 +210,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.CreditWalletRequest{ @@ -283,7 +283,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.DebitWalletRequest{ @@ -348,7 +348,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetBalanceRequest{ @@ -404,7 +404,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetHoldRequest{ @@ -459,7 +459,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetHoldsRequest{ @@ -517,7 +517,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetTransactionsRequest{ @@ -574,7 +574,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetWalletRequest{ @@ -629,7 +629,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetWalletSummaryRequest{ @@ -684,7 +684,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListBalancesRequest{ @@ -738,7 +738,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ListWalletsRequest{ @@ -799,7 +799,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.UpdateWalletRequest{ @@ -854,7 +854,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.VoidHoldRequest{ @@ -908,7 +908,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) diff --git a/releases/sdks/go/docs/sdks/formancewebhooksv1/README.md b/releases/sdks/go/docs/sdks/formancewebhooksv1/README.md index 87e0847a69..a28b9e0935 100644 --- a/releases/sdks/go/docs/sdks/formancewebhooksv1/README.md +++ b/releases/sdks/go/docs/sdks/formancewebhooksv1/README.md @@ -32,7 +32,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ActivateConfigRequest{ @@ -91,7 +91,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ChangeConfigSecretRequest{ @@ -149,7 +149,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.DeactivateConfigRequest{ @@ -204,7 +204,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.DeleteConfigRequest{ @@ -259,7 +259,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.GetManyConfigsRequest{ @@ -323,7 +323,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := shared.ConfigUser{ @@ -384,7 +384,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.TestConfigRequest{ diff --git a/releases/sdks/go/docs/sdks/v1/README.md b/releases/sdks/go/docs/sdks/v1/README.md index fc4c8fed7f..f4a1fa359b 100644 --- a/releases/sdks/go/docs/sdks/v1/README.md +++ b/releases/sdks/go/docs/sdks/v1/README.md @@ -35,7 +35,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) var request *shared.CreateClientRequest = &shared.CreateClientRequest{ @@ -89,7 +89,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.CreateSecretRequest{ @@ -143,7 +143,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.DeleteClientRequest{ @@ -197,7 +197,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.DeleteSecretRequest{ @@ -251,7 +251,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -301,7 +301,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -351,7 +351,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -401,7 +401,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -452,7 +452,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ReadClientRequest{ @@ -506,7 +506,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.ReadUserRequest{ @@ -560,7 +560,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.UpdateClientRequest{ diff --git a/releases/sdks/go/docs/sdks/v2/README.md b/releases/sdks/go/docs/sdks/v2/README.md index 78cc371a13..08b4cb88c5 100644 --- a/releases/sdks/go/docs/sdks/v2/README.md +++ b/releases/sdks/go/docs/sdks/v2/README.md @@ -52,7 +52,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2AddMetadataOnTransactionRequest{ @@ -112,7 +112,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2AddMetadataToAccountRequest{ @@ -172,7 +172,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2CountAccountsRequest{ @@ -227,7 +227,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2CountTransactionsRequest{ @@ -282,7 +282,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2CreateBulkRequest{ @@ -344,7 +344,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2CreateLedgerRequest{ @@ -405,7 +405,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2CreateTransactionRequest{ @@ -488,7 +488,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2DeleteAccountMetadataRequest{ @@ -545,7 +545,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2DeleteLedgerMetadataRequest{ @@ -602,7 +602,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2DeleteTransactionMetadataRequest{ @@ -659,7 +659,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2ExportLogsRequest{ @@ -713,7 +713,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2GetAccountRequest{ @@ -769,7 +769,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2GetBalancesAggregatedRequest{ @@ -823,7 +823,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) @@ -875,7 +875,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2GetLedgerRequest{ @@ -930,7 +930,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2GetLedgerInfoRequest{ @@ -986,7 +986,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2GetTransactionRequest{ @@ -1042,7 +1042,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2GetVolumesWithBalancesRequest{ @@ -1098,7 +1098,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2ImportLogsRequest{ @@ -1153,7 +1153,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2ListAccountsRequest{ @@ -1210,7 +1210,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2ListLedgersRequest{ @@ -1266,7 +1266,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2ListLogsRequest{ @@ -1323,7 +1323,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2ListTransactionsRequest{ @@ -1381,7 +1381,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2ReadStatsRequest{ @@ -1437,7 +1437,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2RevertTransactionRequest{ @@ -1493,7 +1493,7 @@ import( func main() { s := v2.New( v2.WithSecurity(shared.Security{ - Authorization: os.Getenv("AUTHORIZATION"), + ClientID: v2.String(os.Getenv("CLIENT_ID")), }), ) request := operations.V2UpdateLedgerMetadataRequest{ diff --git a/releases/sdks/go/formance.go b/releases/sdks/go/formance.go index 760682d517..fba30ca448 100644 --- a/releases/sdks/go/formance.go +++ b/releases/sdks/go/formance.go @@ -23,6 +23,8 @@ import ( var ServerList = []string{ // local server "http://localhost", + // sandbox server + "https://{stack}.sandbox.formance.cloud", } // HTTPClient provides an interface for suplying the SDK with a custom HTTP client @@ -215,7 +217,7 @@ func (s *Formance) GetVersions(ctx context.Context, opts ...operations.Option) ( hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getVersions", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read"}, SecuritySource: s.sdkConfiguration.Security, } diff --git a/releases/sdks/go/formanceorchestrationv1.go b/releases/sdks/go/formanceorchestrationv1.go index 5a5da27209..5818700242 100644 --- a/releases/sdks/go/formanceorchestrationv1.go +++ b/releases/sdks/go/formanceorchestrationv1.go @@ -33,7 +33,7 @@ func (s *FormanceOrchestrationV1) CancelEvent(ctx context.Context, request opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "cancelEvent", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -201,7 +201,7 @@ func (s *FormanceOrchestrationV1) CreateTrigger(ctx context.Context, request *sh hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createTrigger", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -386,7 +386,7 @@ func (s *FormanceOrchestrationV1) CreateWorkflow(ctx context.Context, request *s hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createWorkflow", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -571,7 +571,7 @@ func (s *FormanceOrchestrationV1) DeleteTrigger(ctx context.Context, request ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "deleteTrigger", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -739,7 +739,7 @@ func (s *FormanceOrchestrationV1) DeleteWorkflow(ctx context.Context, request op hookCtx := hooks.HookContext{ Context: ctx, OperationID: "deleteWorkflow", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -907,7 +907,7 @@ func (s *FormanceOrchestrationV1) GetInstance(ctx context.Context, request opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getInstance", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1086,7 +1086,7 @@ func (s *FormanceOrchestrationV1) GetInstanceHistory(ctx context.Context, reques hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getInstanceHistory", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1265,7 +1265,7 @@ func (s *FormanceOrchestrationV1) GetInstanceStageHistory(ctx context.Context, r hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getInstanceStageHistory", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1444,7 +1444,7 @@ func (s *FormanceOrchestrationV1) GetWorkflow(ctx context.Context, request opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getWorkflow", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1623,7 +1623,7 @@ func (s *FormanceOrchestrationV1) ListInstances(ctx context.Context, request ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listInstances", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1806,7 +1806,7 @@ func (s *FormanceOrchestrationV1) ListTriggers(ctx context.Context, request oper hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listTriggers", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1989,7 +1989,7 @@ func (s *FormanceOrchestrationV1) ListTriggersOccurrences(ctx context.Context, r hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listTriggersOccurrences", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2168,7 +2168,7 @@ func (s *FormanceOrchestrationV1) ListWorkflows(ctx context.Context, opts ...ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listWorkflows", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2346,7 +2346,7 @@ func (s *FormanceOrchestrationV1) OrchestrationgetServerInfo(ctx context.Context hookCtx := hooks.HookContext{ Context: ctx, OperationID: "orchestrationgetServerInfo", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2525,7 +2525,7 @@ func (s *FormanceOrchestrationV1) ReadTrigger(ctx context.Context, request opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "readTrigger", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2704,7 +2704,7 @@ func (s *FormanceOrchestrationV1) RunWorkflow(ctx context.Context, request opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "runWorkflow", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2893,7 +2893,7 @@ func (s *FormanceOrchestrationV1) SendEvent(ctx context.Context, request operati hookCtx := hooks.HookContext{ Context: ctx, OperationID: "sendEvent", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } diff --git a/releases/sdks/go/formancepaymentsv1.go b/releases/sdks/go/formancepaymentsv1.go index 325b943a76..85a3d08423 100644 --- a/releases/sdks/go/formancepaymentsv1.go +++ b/releases/sdks/go/formancepaymentsv1.go @@ -33,7 +33,7 @@ func (s *FormancePaymentsV1) AddAccountToPool(ctx context.Context, request opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "addAccountToPool", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -207,7 +207,7 @@ func (s *FormancePaymentsV1) ConnectorsTransfer(ctx context.Context, request ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "connectorsTransfer", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -392,7 +392,7 @@ func (s *FormancePaymentsV1) CreateAccount(ctx context.Context, request shared.A hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createAccount", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -577,7 +577,7 @@ func (s *FormancePaymentsV1) CreateBankAccount(ctx context.Context, request shar hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createBankAccount", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -762,7 +762,7 @@ func (s *FormancePaymentsV1) CreatePayment(ctx context.Context, request shared.P hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createPayment", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -947,7 +947,7 @@ func (s *FormancePaymentsV1) CreatePool(ctx context.Context, request shared.Pool hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createPool", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1132,7 +1132,7 @@ func (s *FormancePaymentsV1) CreateTransferInitiation(ctx context.Context, reque hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createTransferInitiation", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1317,7 +1317,7 @@ func (s *FormancePaymentsV1) DeletePool(ctx context.Context, request operations. hookCtx := hooks.HookContext{ Context: ctx, OperationID: "deletePool", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1485,7 +1485,7 @@ func (s *FormancePaymentsV1) DeleteTransferInitiation(ctx context.Context, reque hookCtx := hooks.HookContext{ Context: ctx, OperationID: "deleteTransferInitiation", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1652,7 +1652,7 @@ func (s *FormancePaymentsV1) ForwardBankAccount(ctx context.Context, request ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "forwardBankAccount", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1836,7 +1836,7 @@ func (s *FormancePaymentsV1) GetAccountBalances(ctx context.Context, request ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getAccountBalances", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2018,7 +2018,7 @@ func (s *FormancePaymentsV1) GetBankAccount(ctx context.Context, request operati hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getBankAccount", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2199,7 +2199,7 @@ func (s *FormancePaymentsV1) GetConnectorTask(ctx context.Context, request opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getConnectorTask", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2378,7 +2378,7 @@ func (s *FormancePaymentsV1) GetConnectorTaskV1(ctx context.Context, request ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getConnectorTaskV1", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2556,7 +2556,7 @@ func (s *FormancePaymentsV1) GetPayment(ctx context.Context, request operations. hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getPayment", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2734,7 +2734,7 @@ func (s *FormancePaymentsV1) GetPool(ctx context.Context, request operations.Get hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getPool", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2912,7 +2912,7 @@ func (s *FormancePaymentsV1) GetPoolBalances(ctx context.Context, request operat hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getPoolBalances", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3094,7 +3094,7 @@ func (s *FormancePaymentsV1) GetTransferInitiation(ctx context.Context, request hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getTransferInitiation", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3273,7 +3273,7 @@ func (s *FormancePaymentsV1) InstallConnector(ctx context.Context, request opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "installConnector", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3458,7 +3458,7 @@ func (s *FormancePaymentsV1) ListAllConnectors(ctx context.Context, opts ...oper hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listAllConnectors", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3637,7 +3637,7 @@ func (s *FormancePaymentsV1) ListBankAccounts(ctx context.Context, request opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listBankAccounts", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3820,7 +3820,7 @@ func (s *FormancePaymentsV1) ListConfigsAvailableConnectors(ctx context.Context, hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listConfigsAvailableConnectors", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -4001,7 +4001,7 @@ func (s *FormancePaymentsV1) ListConnectorTasks(ctx context.Context, request ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listConnectorTasks", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -4184,7 +4184,7 @@ func (s *FormancePaymentsV1) ListConnectorTasksV1(ctx context.Context, request o hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listConnectorTasksV1", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -4366,7 +4366,7 @@ func (s *FormancePaymentsV1) ListPayments(ctx context.Context, request operation hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listPayments", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -4548,7 +4548,7 @@ func (s *FormancePaymentsV1) ListPools(ctx context.Context, request operations.L hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listPools", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -4730,7 +4730,7 @@ func (s *FormancePaymentsV1) ListTransferInitiations(ctx context.Context, reques hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listTransferInitiations", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -4912,7 +4912,7 @@ func (s *FormancePaymentsV1) PaymentsgetAccount(ctx context.Context, request ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "paymentsgetAccount", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -5090,7 +5090,7 @@ func (s *FormancePaymentsV1) PaymentsgetServerInfo(ctx context.Context, opts ... hookCtx := hooks.HookContext{ Context: ctx, OperationID: "paymentsgetServerInfo", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -5268,7 +5268,7 @@ func (s *FormancePaymentsV1) PaymentslistAccounts(ctx context.Context, request o hookCtx := hooks.HookContext{ Context: ctx, OperationID: "paymentslistAccounts", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -5459,7 +5459,7 @@ func (s *FormancePaymentsV1) ReadConnectorConfig(ctx context.Context, request op hookCtx := hooks.HookContext{ Context: ctx, OperationID: "readConnectorConfig", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -5638,7 +5638,7 @@ func (s *FormancePaymentsV1) ReadConnectorConfigV1(ctx context.Context, request hookCtx := hooks.HookContext{ Context: ctx, OperationID: "readConnectorConfigV1", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -5817,7 +5817,7 @@ func (s *FormancePaymentsV1) RemoveAccountFromPool(ctx context.Context, request hookCtx := hooks.HookContext{ Context: ctx, OperationID: "removeAccountFromPool", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -5988,7 +5988,7 @@ func (s *FormancePaymentsV1) ResetConnector(ctx context.Context, request operati hookCtx := hooks.HookContext{ Context: ctx, OperationID: "resetConnector", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -6157,7 +6157,7 @@ func (s *FormancePaymentsV1) ResetConnectorV1(ctx context.Context, request opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "resetConnectorV1", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -6325,7 +6325,7 @@ func (s *FormancePaymentsV1) RetryTransferInitiation(ctx context.Context, reques hookCtx := hooks.HookContext{ Context: ctx, OperationID: "retryTransferInitiation", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -6493,7 +6493,7 @@ func (s *FormancePaymentsV1) ReverseTransferInitiation(ctx context.Context, requ hookCtx := hooks.HookContext{ Context: ctx, OperationID: "reverseTransferInitiation", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -6667,7 +6667,7 @@ func (s *FormancePaymentsV1) UdpateTransferInitiationStatus(ctx context.Context, hookCtx := hooks.HookContext{ Context: ctx, OperationID: "udpateTransferInitiationStatus", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -6843,7 +6843,7 @@ func (s *FormancePaymentsV1) UninstallConnector(ctx context.Context, request ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "uninstallConnector", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -7011,7 +7011,7 @@ func (s *FormancePaymentsV1) UninstallConnectorV1(ctx context.Context, request o hookCtx := hooks.HookContext{ Context: ctx, OperationID: "uninstallConnectorV1", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -7178,7 +7178,7 @@ func (s *FormancePaymentsV1) UpdateBankAccountMetadata(ctx context.Context, requ hookCtx := hooks.HookContext{ Context: ctx, OperationID: "updateBankAccountMetadata", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -7352,7 +7352,7 @@ func (s *FormancePaymentsV1) UpdateConnectorConfigV1(ctx context.Context, reques hookCtx := hooks.HookContext{ Context: ctx, OperationID: "updateConnectorConfigV1", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -7525,7 +7525,7 @@ func (s *FormancePaymentsV1) UpdateMetadata(ctx context.Context, request operati hookCtx := hooks.HookContext{ Context: ctx, OperationID: "updateMetadata", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "payments:write"}, SecuritySource: s.sdkConfiguration.Security, } diff --git a/releases/sdks/go/formancereconciliationv1.go b/releases/sdks/go/formancereconciliationv1.go index c5b069ccbd..189fdb9cf4 100644 --- a/releases/sdks/go/formancereconciliationv1.go +++ b/releases/sdks/go/formancereconciliationv1.go @@ -33,7 +33,7 @@ func (s *FormanceReconciliationV1) CreatePolicy(ctx context.Context, request sha hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createPolicy", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "reconciliation:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -218,7 +218,7 @@ func (s *FormanceReconciliationV1) DeletePolicy(ctx context.Context, request ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "deletePolicy", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "reconciliation:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -385,7 +385,7 @@ func (s *FormanceReconciliationV1) GetPolicy(ctx context.Context, request operat hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getPolicy", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "reconciliation:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -563,7 +563,7 @@ func (s *FormanceReconciliationV1) GetReconciliation(ctx context.Context, reques hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getReconciliation", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "reconciliation:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -741,7 +741,7 @@ func (s *FormanceReconciliationV1) ListPolicies(ctx context.Context, request ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listPolicies", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "reconciliation:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -923,7 +923,7 @@ func (s *FormanceReconciliationV1) ListReconciliations(ctx context.Context, requ hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listReconciliations", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "reconciliation:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1106,7 +1106,7 @@ func (s *FormanceReconciliationV1) Reconcile(ctx context.Context, request operat hookCtx := hooks.HookContext{ Context: ctx, OperationID: "reconcile", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "reconciliation:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1290,7 +1290,7 @@ func (s *FormanceReconciliationV1) ReconciliationgetServerInfo(ctx context.Conte hookCtx := hooks.HookContext{ Context: ctx, OperationID: "reconciliationgetServerInfo", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "reconciliation:read"}, SecuritySource: s.sdkConfiguration.Security, } diff --git a/releases/sdks/go/formancesearchv1.go b/releases/sdks/go/formancesearchv1.go index cd9d18bfa5..d46b1528c1 100644 --- a/releases/sdks/go/formancesearchv1.go +++ b/releases/sdks/go/formancesearchv1.go @@ -33,7 +33,7 @@ func (s *FormanceSearchV1) Search(ctx context.Context, request shared.Query, opt hookCtx := hooks.HookContext{ Context: ctx, OperationID: "search", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "search:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -207,7 +207,7 @@ func (s *FormanceSearchV1) SearchgetServerInfo(ctx context.Context, opts ...oper hookCtx := hooks.HookContext{ Context: ctx, OperationID: "searchgetServerInfo", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "search:read"}, SecuritySource: s.sdkConfiguration.Security, } diff --git a/releases/sdks/go/formancev1.go b/releases/sdks/go/formancev1.go index 7e9a98077a..d39ff7e0dd 100644 --- a/releases/sdks/go/formancev1.go +++ b/releases/sdks/go/formancev1.go @@ -32,7 +32,7 @@ func (s *FormanceV1) CreateTransactions(ctx context.Context, request operations. hookCtx := hooks.HookContext{ Context: ctx, OperationID: "CreateTransactions", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -216,7 +216,7 @@ func (s *FormanceV1) AddMetadataOnTransaction(ctx context.Context, request opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "addMetadataOnTransaction", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -389,7 +389,7 @@ func (s *FormanceV1) AddMetadataToAccount(ctx context.Context, request operation hookCtx := hooks.HookContext{ Context: ctx, OperationID: "addMetadataToAccount", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -562,7 +562,7 @@ func (s *FormanceV1) CountAccounts(ctx context.Context, request operations.Count hookCtx := hooks.HookContext{ Context: ctx, OperationID: "countAccounts", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -735,7 +735,7 @@ func (s *FormanceV1) CountTransactions(ctx context.Context, request operations.C hookCtx := hooks.HookContext{ Context: ctx, OperationID: "countTransactions", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -908,7 +908,7 @@ func (s *FormanceV1) CreateTransaction(ctx context.Context, request operations.C hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createTransaction", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1096,7 +1096,7 @@ func (s *FormanceV1) GetAccount(ctx context.Context, request operations.GetAccou hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getAccount", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1274,7 +1274,7 @@ func (s *FormanceV1) GetBalances(ctx context.Context, request operations.GetBala hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getBalances", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1456,7 +1456,7 @@ func (s *FormanceV1) GetBalancesAggregated(ctx context.Context, request operatio hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getBalancesAggregated", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1638,7 +1638,7 @@ func (s *FormanceV1) GetInfo(ctx context.Context, opts ...operations.Option) (*o hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getInfo", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1816,7 +1816,7 @@ func (s *FormanceV1) GetLedgerInfo(ctx context.Context, request operations.GetLe hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getLedgerInfo", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1994,7 +1994,7 @@ func (s *FormanceV1) GetMapping(ctx context.Context, request operations.GetMappi hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getMapping", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2172,7 +2172,7 @@ func (s *FormanceV1) GetTransaction(ctx context.Context, request operations.GetT hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getTransaction", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2351,7 +2351,7 @@ func (s *FormanceV1) ListAccounts(ctx context.Context, request operations.ListAc hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listAccounts", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2546,7 +2546,7 @@ func (s *FormanceV1) ListLogs(ctx context.Context, request operations.ListLogsRe hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listLogs", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2729,7 +2729,7 @@ func (s *FormanceV1) ListTransactions(ctx context.Context, request operations.Li hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listTransactions", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2912,7 +2912,7 @@ func (s *FormanceV1) ReadStats(ctx context.Context, request operations.ReadStats hookCtx := hooks.HookContext{ Context: ctx, OperationID: "readStats", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3090,7 +3090,7 @@ func (s *FormanceV1) RevertTransaction(ctx context.Context, request operations.R hookCtx := hooks.HookContext{ Context: ctx, OperationID: "revertTransaction", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3275,7 +3275,7 @@ func (s *FormanceV1) RunScript(ctx context.Context, request operations.RunScript hookCtx := hooks.HookContext{ Context: ctx, OperationID: "runScript", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3453,7 +3453,7 @@ func (s *FormanceV1) UpdateMapping(ctx context.Context, request operations.Updat hookCtx := hooks.HookContext{ Context: ctx, OperationID: "updateMapping", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } diff --git a/releases/sdks/go/formancev2.go b/releases/sdks/go/formancev2.go index 580af355b0..2ac4ecd8b9 100644 --- a/releases/sdks/go/formancev2.go +++ b/releases/sdks/go/formancev2.go @@ -33,7 +33,7 @@ func (s *FormanceV2) CancelEvent(ctx context.Context, request operations.V2Cance hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2CancelEvent", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -201,7 +201,7 @@ func (s *FormanceV2) CreateTrigger(ctx context.Context, request *shared.V2Trigge hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2CreateTrigger", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -386,7 +386,7 @@ func (s *FormanceV2) CreateWorkflow(ctx context.Context, request *shared.V2Creat hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2CreateWorkflow", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -571,7 +571,7 @@ func (s *FormanceV2) DeleteTrigger(ctx context.Context, request operations.V2Del hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2DeleteTrigger", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -739,7 +739,7 @@ func (s *FormanceV2) DeleteWorkflow(ctx context.Context, request operations.V2De hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2DeleteWorkflow", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -907,7 +907,7 @@ func (s *FormanceV2) GetInstance(ctx context.Context, request operations.V2GetIn hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2GetInstance", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1086,7 +1086,7 @@ func (s *FormanceV2) GetInstanceHistory(ctx context.Context, request operations. hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2GetInstanceHistory", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1265,7 +1265,7 @@ func (s *FormanceV2) GetInstanceStageHistory(ctx context.Context, request operat hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2GetInstanceStageHistory", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1443,7 +1443,7 @@ func (s *FormanceV2) GetServerInfo(ctx context.Context, opts ...operations.Optio hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2GetServerInfo", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1622,7 +1622,7 @@ func (s *FormanceV2) GetWorkflow(ctx context.Context, request operations.V2GetWo hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2GetWorkflow", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1801,7 +1801,7 @@ func (s *FormanceV2) ListInstances(ctx context.Context, request operations.V2Lis hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2ListInstances", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1984,7 +1984,7 @@ func (s *FormanceV2) ListTriggers(ctx context.Context, request operations.V2List hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2ListTriggers", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2167,7 +2167,7 @@ func (s *FormanceV2) ListTriggersOccurrences(ctx context.Context, request operat hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2ListTriggersOccurrences", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2350,7 +2350,7 @@ func (s *FormanceV2) ListWorkflows(ctx context.Context, request operations.V2Lis hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2ListWorkflows", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2533,7 +2533,7 @@ func (s *FormanceV2) ReadTrigger(ctx context.Context, request operations.V2ReadT hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2ReadTrigger", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2712,7 +2712,7 @@ func (s *FormanceV2) RunWorkflow(ctx context.Context, request operations.V2RunWo hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2RunWorkflow", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2901,7 +2901,7 @@ func (s *FormanceV2) SendEvent(ctx context.Context, request operations.V2SendEve hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2SendEvent", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3075,7 +3075,7 @@ func (s *FormanceV2) TestTrigger(ctx context.Context, request operations.TestTri hookCtx := hooks.HookContext{ Context: ctx, OperationID: "testTrigger", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "orchestration:write"}, SecuritySource: s.sdkConfiguration.Security, } diff --git a/releases/sdks/go/formancewalletsv1.go b/releases/sdks/go/formancewalletsv1.go index 19c15e8a71..021d7b03eb 100644 --- a/releases/sdks/go/formancewalletsv1.go +++ b/releases/sdks/go/formancewalletsv1.go @@ -32,7 +32,7 @@ func (s *FormanceWalletsV1) ConfirmHold(ctx context.Context, request operations. hookCtx := hooks.HookContext{ Context: ctx, OperationID: "confirmHold", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -207,7 +207,7 @@ func (s *FormanceWalletsV1) CreateBalance(ctx context.Context, request operation hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createBalance", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -393,7 +393,7 @@ func (s *FormanceWalletsV1) CreateWallet(ctx context.Context, request operations hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createWallet", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -579,7 +579,7 @@ func (s *FormanceWalletsV1) CreditWallet(ctx context.Context, request operations hookCtx := hooks.HookContext{ Context: ctx, OperationID: "creditWallet", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -754,7 +754,7 @@ func (s *FormanceWalletsV1) DebitWallet(ctx context.Context, request operations. hookCtx := hooks.HookContext{ Context: ctx, OperationID: "debitWallet", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -941,7 +941,7 @@ func (s *FormanceWalletsV1) GetBalance(ctx context.Context, request operations.G hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getBalance", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1119,7 +1119,7 @@ func (s *FormanceWalletsV1) GetHold(ctx context.Context, request operations.GetH hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getHold", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1297,7 +1297,7 @@ func (s *FormanceWalletsV1) GetHolds(ctx context.Context, request operations.Get hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getHolds", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1478,7 +1478,7 @@ func (s *FormanceWalletsV1) GetTransactions(ctx context.Context, request operati hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getTransactions", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1660,7 +1660,7 @@ func (s *FormanceWalletsV1) GetWallet(ctx context.Context, request operations.Ge hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getWallet", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1839,7 +1839,7 @@ func (s *FormanceWalletsV1) GetWalletSummary(ctx context.Context, request operat hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getWalletSummary", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2018,7 +2018,7 @@ func (s *FormanceWalletsV1) ListBalances(ctx context.Context, request operations hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listBalances", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2186,7 +2186,7 @@ func (s *FormanceWalletsV1) ListWallets(ctx context.Context, request operations. hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listWallets", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2368,7 +2368,7 @@ func (s *FormanceWalletsV1) UpdateWallet(ctx context.Context, request operations hookCtx := hooks.HookContext{ Context: ctx, OperationID: "updateWallet", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2543,7 +2543,7 @@ func (s *FormanceWalletsV1) VoidHold(ctx context.Context, request operations.Voi hookCtx := hooks.HookContext{ Context: ctx, OperationID: "voidHold", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2712,7 +2712,7 @@ func (s *FormanceWalletsV1) WalletsgetServerInfo(ctx context.Context, opts ...op hookCtx := hooks.HookContext{ Context: ctx, OperationID: "walletsgetServerInfo", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "wallets:read"}, SecuritySource: s.sdkConfiguration.Security, } diff --git a/releases/sdks/go/formancewebhooksv1.go b/releases/sdks/go/formancewebhooksv1.go index 8c4ea296b1..737c611581 100644 --- a/releases/sdks/go/formancewebhooksv1.go +++ b/releases/sdks/go/formancewebhooksv1.go @@ -33,7 +33,7 @@ func (s *FormanceWebhooksV1) ActivateConfig(ctx context.Context, request operati hookCtx := hooks.HookContext{ Context: ctx, OperationID: "activateConfig", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "webhooks:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -215,7 +215,7 @@ func (s *FormanceWebhooksV1) ChangeConfigSecret(ctx context.Context, request ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "changeConfigSecret", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "webhooks:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -400,7 +400,7 @@ func (s *FormanceWebhooksV1) DeactivateConfig(ctx context.Context, request opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "deactivateConfig", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "webhooks:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -579,7 +579,7 @@ func (s *FormanceWebhooksV1) DeleteConfig(ctx context.Context, request operation hookCtx := hooks.HookContext{ Context: ctx, OperationID: "deleteConfig", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "webhooks:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -747,7 +747,7 @@ func (s *FormanceWebhooksV1) GetManyConfigs(ctx context.Context, request operati hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getManyConfigs", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "webhooks:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -938,7 +938,7 @@ func (s *FormanceWebhooksV1) InsertConfig(ctx context.Context, request shared.Co hookCtx := hooks.HookContext{ Context: ctx, OperationID: "insertConfig", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "webhooks:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1123,7 +1123,7 @@ func (s *FormanceWebhooksV1) TestConfig(ctx context.Context, request operations. hookCtx := hooks.HookContext{ Context: ctx, OperationID: "testConfig", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "webhooks:read"}, SecuritySource: s.sdkConfiguration.Security, } diff --git a/releases/sdks/go/gen.yaml b/releases/sdks/go/gen.yaml index 0040626fac..6de870e8c0 100755 --- a/releases/sdks/go/gen.yaml +++ b/releases/sdks/go/gen.yaml @@ -8,7 +8,7 @@ generation: parameterOrderingFeb2024: false requestResponseComponentNamesFeb2024: false auth: - oAuth2ClientCredentialsEnabled: false + oAuth2ClientCredentialsEnabled: true telemetryEnabled: false go: version: v0.0.0 diff --git a/releases/sdks/go/internal/hooks/clientcredentials.go b/releases/sdks/go/internal/hooks/clientcredentials.go new file mode 100644 index 0000000000..62907f0936 --- /dev/null +++ b/releases/sdks/go/internal/hooks/clientcredentials.go @@ -0,0 +1,255 @@ +// Code generated by Speakeasy (https://speakeasyapi.com). DO NOT EDIT. + +package hooks + +import ( + "bytes" + "context" + "crypto/md5" + "encoding/hex" + "encoding/json" + "fmt" + "github.com/formancehq/formance-sdk-go/v2/pkg/models/shared" + "io" + "net/http" + "net/url" + "strings" + "time" +) + +type session struct { + Credentials *credentials + Token string + ExpiresAt *int64 + Scopes []string +} + +type tokenResponse struct { + AccessToken string `json:"access_token"` + TokenType string `json:"token_type"` + ExpiresIn *int64 `json:"expires_in"` +} + +type credentials struct { + ClientID string + ClientSecret string + TokenURL string +} + +type clientCredentialsHook struct { + baseURL string + client HTTPClient + sessions map[string]*session +} + +var ( + _ sdkInitHook = (*clientCredentialsHook)(nil) + _ beforeRequestHook = (*clientCredentialsHook)(nil) + _ afterErrorHook = (*clientCredentialsHook)(nil) +) + +func NewClientCredentialsHook() *clientCredentialsHook { + return &clientCredentialsHook{ + sessions: make(map[string]*session), + } +} + +func (c *clientCredentialsHook) SDKInit(baseURL string, client HTTPClient) (string, HTTPClient) { + c.baseURL = baseURL + c.client = client + return baseURL, client +} + +func (c *clientCredentialsHook) BeforeRequest(ctx BeforeRequestContext, req *http.Request) (*http.Request, error) { + if ctx.OAuth2Scopes == nil { + // OAuth2 not in use + return req, nil + } + + credentials, err := c.getCredentials(ctx.Context, ctx.SecuritySource) + if err != nil { + return nil, &FailEarly{Cause: err} + } + if credentials == nil { + return req, err + } + + sessionKey := getSessionKey(credentials.ClientID, credentials.ClientSecret) + sess, ok := c.sessions[sessionKey] + if !ok || !hasRequiredScopes(sess.Scopes, ctx.OAuth2Scopes) || hasTokenExpired(sess.ExpiresAt) { + s, err := c.doTokenRequest(ctx.Context, credentials, getScopes(ctx.OAuth2Scopes, sess)) + if err != nil { + return nil, fmt.Errorf("failed to get token: %w", err) + } + + c.sessions[sessionKey] = s + sess = s + } + + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", sess.Token)) + + return req, nil +} + +func (c *clientCredentialsHook) AfterError(ctx AfterErrorContext, res *http.Response, err error) (*http.Response, error) { + if ctx.OAuth2Scopes == nil { + // OAuth2 not in use + return res, err + } + + // We don't want to refresh the token if the error is not related to the token + if err != nil { + return res, err + } + + credentials, err := c.getCredentials(ctx.Context, ctx.SecuritySource) + if err != nil { + return nil, &FailEarly{Cause: err} + } + if credentials == nil { + return res, err + } + + if res != nil && res.StatusCode == http.StatusUnauthorized { + sessionKey := getSessionKey(credentials.ClientID, credentials.ClientSecret) + delete(c.sessions, sessionKey) + } + + return res, err +} + +func (c *clientCredentialsHook) doTokenRequest(ctx context.Context, credentials *credentials, scopes []string) (*session, error) { + values := url.Values{} + values.Set("grant_type", "client_credentials") + values.Set("client_id", credentials.ClientID) + values.Set("client_secret", credentials.ClientSecret) + + if len(scopes) > 0 { + values.Set("scope", strings.Join(scopes, " ")) + } + + tokenURL := credentials.TokenURL + u, err := url.Parse(tokenURL) + if err != nil { + return nil, fmt.Errorf("failed to parse token URL: %w", err) + } + if !u.IsAbs() { + tokenURL, err = url.JoinPath(c.baseURL, tokenURL) + if err != nil { + return nil, fmt.Errorf("failed to parse token URL: %w", err) + } + } + + req, err := http.NewRequestWithContext(ctx, http.MethodPost, tokenURL, bytes.NewBufferString(values.Encode())) + if err != nil { + return nil, fmt.Errorf("failed to create token request: %w", err) + } + + req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + + res, err := c.client.Do(req) + if err != nil { + return nil, fmt.Errorf("failed to send token request: %w", err) + } + defer res.Body.Close() + + if res.StatusCode < 200 || res.StatusCode >= 300 { + body, _ := io.ReadAll(res.Body) + return nil, fmt.Errorf("unexpected status code: %d: %s", res.StatusCode, body) + } + + var tokenRes tokenResponse + if err := json.NewDecoder(res.Body).Decode(&tokenRes); err != nil { + return nil, fmt.Errorf("failed to decode token response: %w", err) + } + + if tokenRes.TokenType != "Bearer" { + return nil, fmt.Errorf("unexpected token type: %s", tokenRes.TokenType) + } + + var expiresAt *int64 + if tokenRes.ExpiresIn != nil { + expiresAt = new(int64) + *expiresAt = time.Now().Unix() + *tokenRes.ExpiresIn + } + + return &session{ + Credentials: credentials, + Token: tokenRes.AccessToken, + ExpiresAt: expiresAt, + Scopes: scopes, + }, nil +} + +func (c *clientCredentialsHook) getCredentials(ctx context.Context, source func(ctx context.Context) (interface{}, error)) (*credentials, error) { + if source == nil { + return nil, nil + } + + sec, err := source(ctx) + if err != nil { + return nil, err + } + + security, ok := sec.(shared.Security) + + if !ok { + return nil, fmt.Errorf("unexpected security type: %T", sec) + } + + if security.ClientID == nil || security.ClientSecret == nil { + return nil, nil + } + + return &credentials{ + ClientID: *security.ClientID, + ClientSecret: *security.ClientSecret, + TokenURL: *security.GetTokenURL(), + }, nil +} + +func getSessionKey(clientID, clientSecret string) string { + key := fmt.Sprintf("%s:%s", clientID, clientSecret) + hash := md5.Sum([]byte(key)) + return hex.EncodeToString(hash[:]) +} + +func hasRequiredScopes(scopes []string, requiredScopes []string) bool { + for _, requiredScope := range requiredScopes { + found := false + for _, scope := range scopes { + if scope == requiredScope { + found = true + break + } + } + if !found { + return false + } + } + return true +} + +func getScopes(requiredScopes []string, sess *session) []string { + scopes := requiredScopes + if sess != nil { + for _, scope := range sess.Scopes { + found := false + for _, requiredScope := range requiredScopes { + if scope == requiredScope { + found = true + break + } + } + if !found { + scopes = append(scopes, scope) + } + } + } + + return scopes +} + +func hasTokenExpired(expiresAt *int64) bool { + return expiresAt == nil || time.Now().Unix()+60 >= *expiresAt +} diff --git a/releases/sdks/go/internal/hooks/hooks.go b/releases/sdks/go/internal/hooks/hooks.go index b978f6beff..5155b621bf 100644 --- a/releases/sdks/go/internal/hooks/hooks.go +++ b/releases/sdks/go/internal/hooks/hooks.go @@ -71,11 +71,19 @@ type Hooks struct { } func New() *Hooks { + cc := NewClientCredentialsHook() + h := &Hooks{ - sdkInitHooks: []sdkInitHook{}, - beforeRequestHook: []beforeRequestHook{}, - afterSuccessHook: []afterSuccessHook{}, - afterErrorHook: []afterErrorHook{}, + sdkInitHooks: []sdkInitHook{ + cc, + }, + beforeRequestHook: []beforeRequestHook{ + cc, + }, + afterSuccessHook: []afterSuccessHook{}, + afterErrorHook: []afterErrorHook{ + cc, + }, } initHooks(h) diff --git a/releases/sdks/go/internal/hooks/ledger.go b/releases/sdks/go/internal/hooks/ledger.go deleted file mode 100644 index bbe675395b..0000000000 --- a/releases/sdks/go/internal/hooks/ledger.go +++ /dev/null @@ -1,78 +0,0 @@ -package hooks - -import ( - "bytes" - "io" - "net/http" - "os" -) - -type ledgerHook struct {} - -func (l ledgerHook) AfterSuccess(hookCtx AfterSuccessContext, res *http.Response) (*http.Response, error) { - switch hookCtx.HookContext.OperationID { - case "v2ExportLogs": - return l.handleV2ExportLogs(hookCtx, res) - default: - return res, nil - } -} - -func (l ledgerHook) handleV2ExportLogs(ctx AfterSuccessContext, res *http.Response) (*http.Response, error) { - if path := ctx.Context.Value("path"); path != nil { - f, err := os.Create(path.(string)) - if err != nil { - return nil, err - } - _, err = io.Copy(f, res.Body) - if err != nil { - return nil, err - } - } - - return res, nil -} - -func (l ledgerHook) handleV2ImportLogs(req *http.Request) (*http.Request, error) { - header := make([]byte, 5) - _, err := req.Body.Read(header) - if err == nil && string(header) == "file:" { - filePath, err := io.ReadAll(req.Body) - if err != nil { - return nil, err - } - - f, err := os.OpenFile(string(filePath), os.O_RDONLY, 0666) - if err != nil { - return nil, err - } - stat, err := f.Stat() - if err != nil { - return nil, err - } - - req.ContentLength = stat.Size() - req.Body = f - - return req, nil - } - - data, err := io.ReadAll(req.Body) - if err != nil { - return nil, err - } - - req.Body = io.NopCloser(bytes.NewReader(append(header, data...))) - - return req, nil -} - -func (l ledgerHook) BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error) { - switch hookCtx.HookContext.OperationID { - case "v2ImportLogs": - return l.handleV2ImportLogs(req) - default: - return req, nil - } -} - diff --git a/releases/sdks/go/internal/hooks/registration.go b/releases/sdks/go/internal/hooks/registration.go index dacf8f50a0..690cca9e71 100644 --- a/releases/sdks/go/internal/hooks/registration.go +++ b/releases/sdks/go/internal/hooks/registration.go @@ -10,8 +10,4 @@ func initHooks(h *Hooks) { // Add hooks by calling h.register{SDKInit/BeforeRequest/AfterSuccess/AfterError}Hook // with an instance of a hook that implements that specific Hook interface // Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance - - hook := ledgerHook{} - h.registerBeforeRequestHook(hook) - h.registerAfterSuccessHook(hook) } diff --git a/releases/sdks/go/pkg/models/shared/security.go b/releases/sdks/go/pkg/models/shared/security.go index 508f6190c0..33aae347cd 100644 --- a/releases/sdks/go/pkg/models/shared/security.go +++ b/releases/sdks/go/pkg/models/shared/security.go @@ -2,13 +2,42 @@ package shared +import ( + "github.com/formancehq/formance-sdk-go/v2/pkg/types" + "github.com/formancehq/formance-sdk-go/v2/pkg/utils" +) + type Security struct { - Authorization string `security:"scheme,type=oauth2,name=Authorization"` + ClientID *string `security:"scheme,type=oauth2,subtype=client_credentials,name=clientID"` + ClientSecret *string `security:"scheme,type=oauth2,subtype=client_credentials,name=clientSecret"` + tokenURL *string `const:"/api/auth/oauth/token"` +} + +func (s Security) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(s, "", false) +} + +func (s *Security) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { + return err + } + return nil } -func (o *Security) GetAuthorization() string { +func (o *Security) GetClientID() *string { if o == nil { - return "" + return nil } - return o.Authorization + return o.ClientID +} + +func (o *Security) GetClientSecret() *string { + if o == nil { + return nil + } + return o.ClientSecret +} + +func (o *Security) GetTokenURL() *string { + return types.String("/api/auth/oauth/token") } diff --git a/releases/sdks/go/v1.go b/releases/sdks/go/v1.go index 1f877ebfdd..0d4b50eedc 100644 --- a/releases/sdks/go/v1.go +++ b/releases/sdks/go/v1.go @@ -32,7 +32,7 @@ func (s *V1) CreateClient(ctx context.Context, request *shared.CreateClientReque hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createClient", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "auth:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -206,7 +206,7 @@ func (s *V1) CreateSecret(ctx context.Context, request operations.CreateSecretRe hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createSecret", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "auth:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -380,7 +380,7 @@ func (s *V1) DeleteClient(ctx context.Context, request operations.DeleteClientRe hookCtx := hooks.HookContext{ Context: ctx, OperationID: "deleteClient", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "auth:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -537,7 +537,7 @@ func (s *V1) DeleteSecret(ctx context.Context, request operations.DeleteSecretRe hookCtx := hooks.HookContext{ Context: ctx, OperationID: "deleteSecret", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "auth:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -694,7 +694,7 @@ func (s *V1) GetOIDCWellKnowns(ctx context.Context, opts ...operations.Option) ( hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getOIDCWellKnowns", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "auth:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -851,7 +851,7 @@ func (s *V1) GetServerInfo(ctx context.Context, opts ...operations.Option) (*ope hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getServerInfo", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "auth:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1019,7 +1019,7 @@ func (s *V1) ListClients(ctx context.Context, opts ...operations.Option) (*opera hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listClients", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "auth:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1188,7 +1188,7 @@ func (s *V1) ListUsers(ctx context.Context, opts ...operations.Option) (*operati hookCtx := hooks.HookContext{ Context: ctx, OperationID: "listUsers", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "auth:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1356,7 +1356,7 @@ func (s *V1) ReadClient(ctx context.Context, request operations.ReadClientReques hookCtx := hooks.HookContext{ Context: ctx, OperationID: "readClient", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "auth:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1525,7 +1525,7 @@ func (s *V1) ReadUser(ctx context.Context, request operations.ReadUserRequest, o hookCtx := hooks.HookContext{ Context: ctx, OperationID: "readUser", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "auth:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1693,7 +1693,7 @@ func (s *V1) UpdateClient(ctx context.Context, request operations.UpdateClientRe hookCtx := hooks.HookContext{ Context: ctx, OperationID: "updateClient", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "auth:write"}, SecuritySource: s.sdkConfiguration.Security, } diff --git a/releases/sdks/go/v2.go b/releases/sdks/go/v2.go index 24839bd818..ddbea486db 100644 --- a/releases/sdks/go/v2.go +++ b/releases/sdks/go/v2.go @@ -32,7 +32,7 @@ func (s *V2) AddMetadataOnTransaction(ctx context.Context, request operations.V2 hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2AddMetadataOnTransaction", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -211,7 +211,7 @@ func (s *V2) AddMetadataToAccount(ctx context.Context, request operations.V2AddM hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2AddMetadataToAccount", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -390,7 +390,7 @@ func (s *V2) CountAccounts(ctx context.Context, request operations.V2CountAccoun hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2CountAccounts", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -569,7 +569,7 @@ func (s *V2) CountTransactions(ctx context.Context, request operations.V2CountTr hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2CountTransactions", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -748,7 +748,7 @@ func (s *V2) CreateBulk(ctx context.Context, request operations.V2CreateBulkRequ hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2CreateBulk", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -934,7 +934,7 @@ func (s *V2) CreateLedger(ctx context.Context, request operations.V2CreateLedger hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2CreateLedger", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1107,7 +1107,7 @@ func (s *V2) CreateTransaction(ctx context.Context, request operations.V2CreateT hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2CreateTransaction", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1298,7 +1298,7 @@ func (s *V2) DeleteAccountMetadata(ctx context.Context, request operations.V2Del hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2DeleteAccountMetadata", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1465,7 +1465,7 @@ func (s *V2) DeleteLedgerMetadata(ctx context.Context, request operations.V2Dele hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2DeleteLedgerMetadata", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1633,7 +1633,7 @@ func (s *V2) DeleteTransactionMetadata(ctx context.Context, request operations.V hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2DeleteTransactionMetadata", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1800,7 +1800,7 @@ func (s *V2) ExportLogs(ctx context.Context, request operations.V2ExportLogsRequ hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2ExportLogs", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -1957,7 +1957,7 @@ func (s *V2) GetAccount(ctx context.Context, request operations.V2GetAccountRequ hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2GetAccount", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2139,7 +2139,7 @@ func (s *V2) GetBalancesAggregated(ctx context.Context, request operations.V2Get hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2GetBalancesAggregated", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2327,7 +2327,7 @@ func (s *V2) GetInfo(ctx context.Context, opts ...operations.Option) (*operation hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2GetInfo", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2517,7 +2517,7 @@ func (s *V2) GetLedger(ctx context.Context, request operations.V2GetLedgerReques hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2GetLedger", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2695,7 +2695,7 @@ func (s *V2) GetLedgerInfo(ctx context.Context, request operations.V2GetLedgerIn hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2GetLedgerInfo", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -2873,7 +2873,7 @@ func (s *V2) GetTransaction(ctx context.Context, request operations.V2GetTransac hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2GetTransaction", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3055,7 +3055,7 @@ func (s *V2) GetVolumesWithBalances(ctx context.Context, request operations.V2Ge hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2GetVolumesWithBalances", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3242,7 +3242,7 @@ func (s *V2) ImportLogs(ctx context.Context, request operations.V2ImportLogsRequ hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2ImportLogs", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3416,7 +3416,7 @@ func (s *V2) ListAccounts(ctx context.Context, request operations.V2ListAccounts hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2ListAccounts", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3604,7 +3604,7 @@ func (s *V2) ListLedgers(ctx context.Context, request operations.V2ListLedgersRe hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2ListLedgers", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3787,7 +3787,7 @@ func (s *V2) ListLogs(ctx context.Context, request operations.V2ListLogsRequest, hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2ListLogs", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -3976,7 +3976,7 @@ func (s *V2) ListTransactions(ctx context.Context, request operations.V2ListTran hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2ListTransactions", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -4165,7 +4165,7 @@ func (s *V2) ReadStats(ctx context.Context, request operations.V2ReadStatsReques hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2ReadStats", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -4343,7 +4343,7 @@ func (s *V2) RevertTransaction(ctx context.Context, request operations.V2RevertT hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2RevertTransaction", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } @@ -4525,7 +4525,7 @@ func (s *V2) UpdateLedgerMetadata(ctx context.Context, request operations.V2Upda hookCtx := hooks.HookContext{ Context: ctx, OperationID: "v2UpdateLedgerMetadata", - OAuth2Scopes: []string{}, + OAuth2Scopes: []string{"auth:read", "ledger:write"}, SecuritySource: s.sdkConfiguration.Security, } diff --git a/releases/templates/sdk/go/gen.yaml b/releases/templates/sdk/go/gen.yaml index d6ff615c7b..6de870e8c0 100755 --- a/releases/templates/sdk/go/gen.yaml +++ b/releases/templates/sdk/go/gen.yaml @@ -5,9 +5,15 @@ generation: optionalPropertyRendering: withExample fixes: nameResolutionDec2023: false + parameterOrderingFeb2024: false + requestResponseComponentNamesFeb2024: false + auth: + oAuth2ClientCredentialsEnabled: true telemetryEnabled: false go: - version: "" + version: v0.0.0 + additionalDependencies: {} + allowUnknownFieldsInWeakUnions: false author: Formance clientServerStatusCodesAsErrors: true flattenGlobalSecurity: false @@ -21,5 +27,7 @@ go: webhooks: pkg/models/webhooks inputModelSuffix: input maxMethodParams: 0 + methodArguments: require-security-and-request outputModelSuffix: output packageName: github.com/formancehq/formance-sdk-go/v2 + responseFormat: envelope diff --git a/releases/templates/sdk/java/.github/workflows/speakeasy_sdk_publish.yml b/releases/templates/sdk/java/.github/workflows/speakeasy_sdk_publish.yml deleted file mode 100644 index 262be38e2c..0000000000 --- a/releases/templates/sdk/java/.github/workflows/speakeasy_sdk_publish.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Publish -"on": - push: - branches: - - release/v*.*.* - - release/v*.*.*-alpha.* - - release/v*.*.*-beta.* - - release/v*.*.*-rc.*version -jobs: - Release: - name: 'Release' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Extract branch name - shell: bash - run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/release/}}" >> $GITHUB_OUTPUT - id: extract_branch - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ steps.extract_branch.outputs.branch }} - release_name: ${{ steps.extract_branch.outputs.branch }} - draft: false - prerelease: false - - run: gh repo edit --default-branch=release/${{ steps.extract_branch.outputs.branch }} - env: - GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} - - Publish: - name: Publish - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - needs: - - Release - steps: - - uses: actions/checkout@v3 - - name: Set up Java - uses: actions/setup-java@v3 - with: - java-version: "11" - distribution: "corretto" - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b - - name: Publish package - uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 - with: - arguments: -Pskip.signing=true publish - env: - MAVEN_USERNAME: "flemzord" - MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/releases/templates/sdk/java/LICENSE b/releases/templates/sdk/java/LICENSE deleted file mode 100644 index 442dbb7b3a..0000000000 --- a/releases/templates/sdk/java/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Formance, Inc - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/releases/templates/sdk/java/gen.yaml b/releases/templates/sdk/java/gen.yaml deleted file mode 100755 index 4b89ecdaeb..0000000000 --- a/releases/templates/sdk/java/gen.yaml +++ /dev/null @@ -1,30 +0,0 @@ -configVersion: 2.0.0 -generation: - comments: {} - sdkClassName: SDK - usageSnippets: - optionalPropertyRendering: withExample - fixes: - nameResolutionDec2023: false - telemetryEnabled: false -java: - version: "" - artifactID: formance-sdk - companyEmail: support@formance.com - companyName: Formance - companyURL: www.formance.com - githubURL: github.com/formancehq/formance-sdk-java - groupID: com.formance - imports: - option: openapi - paths: - callbacks: models/callbacks - errors: models/errors - operations: models/operations - shared: models/shared - webhooks: models/webhooks - inputModelSuffix: input - maxMethodParams: 0 - ossrhURL: https://maven.pkg.github.com/formancehq/formance-sdk-java - outputModelSuffix: output - projectName: formance-sdk-java diff --git a/releases/templates/sdk/php/.github/workflows/speakeasy_sdk_publish.yml b/releases/templates/sdk/php/.github/workflows/speakeasy_sdk_publish.yml deleted file mode 100644 index 5f8a1a7ac6..0000000000 --- a/releases/templates/sdk/php/.github/workflows/speakeasy_sdk_publish.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Publish -"on": - push: - branches: - - release/v*.*.* - - release/v*.*.*-alpha.* - - release/v*.*.*-beta.* - - release/v*.*.*-rc.*version -jobs: - Release: - name: 'Release' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Extract branch name - shell: bash - run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/release/}}" >> $GITHUB_OUTPUT - id: extract_branch - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ steps.extract_branch.outputs.branch }} - release_name: ${{ steps.extract_branch.outputs.branch }} - draft: false - prerelease: false - - run: gh repo edit --default-branch=release/${{ steps.extract_branch.outputs.branch }} - env: - GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} \ No newline at end of file diff --git a/releases/templates/sdk/php/LICENSE b/releases/templates/sdk/php/LICENSE deleted file mode 100644 index 442dbb7b3a..0000000000 --- a/releases/templates/sdk/php/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Formance, Inc - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/releases/templates/sdk/php/gen.yaml b/releases/templates/sdk/php/gen.yaml deleted file mode 100755 index 4ae511ca5a..0000000000 --- a/releases/templates/sdk/php/gen.yaml +++ /dev/null @@ -1,24 +0,0 @@ -configVersion: 2.0.0 -generation: - comments: {} - sdkClassName: SDK - usageSnippets: - optionalPropertyRendering: withExample - fixes: - nameResolutionDec2023: false - telemetryEnabled: false -php: - version: "" - imports: - option: openapi - paths: - callbacks: Models/Callbacks - errors: Models/Errors - operations: Models/Operations - shared: Models/Shared - webhooks: Models/Webhooks - inputModelSuffix: input - maxMethodParams: 0 - namespace: formance\stack - outputModelSuffix: output - packageName: formance-sdk-php diff --git a/releases/templates/sdk/python/.github/workflows/speakeasy_sdk_publish.yml b/releases/templates/sdk/python/.github/workflows/speakeasy_sdk_publish.yml deleted file mode 100644 index 527364a812..0000000000 --- a/releases/templates/sdk/python/.github/workflows/speakeasy_sdk_publish.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Publish -"on": - push: - branches: - - release/v*.*.* - - release/v*.*.*-alpha.* - - release/v*.*.*-beta.* - - release/v*.*.*-rc.*version -jobs: - Release: - name: 'Release' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Extract branch name - shell: bash - run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/release/}}" >> $GITHUB_OUTPUT - id: extract_branch - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ steps.extract_branch.outputs.branch }} - release_name: ${{ steps.extract_branch.outputs.branch }} - draft: false - prerelease: false - - run: gh repo edit --default-branch=release/${{ steps.extract_branch.outputs.branch }} - env: - GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} - - Publish: - name: 'Publish' - needs: - - Release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.9" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_SECRET }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* \ No newline at end of file diff --git a/releases/templates/sdk/python/LICENSE b/releases/templates/sdk/python/LICENSE deleted file mode 100644 index 442dbb7b3a..0000000000 --- a/releases/templates/sdk/python/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Formance, Inc - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/releases/templates/sdk/python/gen.yaml b/releases/templates/sdk/python/gen.yaml deleted file mode 100755 index 6593d958c5..0000000000 --- a/releases/templates/sdk/python/gen.yaml +++ /dev/null @@ -1,27 +0,0 @@ -configVersion: 2.0.0 -generation: - comments: {} - sdkClassName: SDK - usageSnippets: - optionalPropertyRendering: withExample - fixes: - nameResolutionDec2023: false - telemetryEnabled: false -python: - version: "" - author: Formance - clientServerStatusCodesAsErrors: true - description: Python Client SDK Generated by Speakeasy - flattenGlobalSecurity: true - imports: - option: openapi - paths: - callbacks: models/callbacks - errors: models/errors - operations: models/operations - shared: models/shared - webhooks: models/webhooks - inputModelSuffix: input - maxMethodParams: 0 - outputModelSuffix: output - packageName: formance-sdk-python diff --git a/releases/templates/sdk/typescript/.github/workflows/speakeasy_sdk_publish.yml b/releases/templates/sdk/typescript/.github/workflows/speakeasy_sdk_publish.yml deleted file mode 100644 index 74cf1e63a1..0000000000 --- a/releases/templates/sdk/typescript/.github/workflows/speakeasy_sdk_publish.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Publish -"on": - push: - branches: - - release/v*.*.* - - release/v*.*.*-alpha.* - - release/v*.*.*-beta.* - - release/v*.*.*-rc.*version -jobs: - Release: - name: 'Release' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Extract branch name - shell: bash - run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/release/}}" >> $GITHUB_OUTPUT - id: extract_branch - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ steps.extract_branch.outputs.branch }} - release_name: ${{ steps.extract_branch.outputs.branch }} - draft: false - prerelease: false - - run: gh repo edit --default-branch=release/${{ steps.extract_branch.outputs.branch }} - env: - GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }} - - Publish: - name: 'Publish' - needs: - - Release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '18.x' - registry-url: 'https://registry.npmjs.org' - - run: npm ci - - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/releases/templates/sdk/typescript/LICENSE b/releases/templates/sdk/typescript/LICENSE deleted file mode 100644 index 442dbb7b3a..0000000000 --- a/releases/templates/sdk/typescript/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Formance, Inc - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/releases/templates/sdk/typescript/gen.yaml b/releases/templates/sdk/typescript/gen.yaml deleted file mode 100755 index 18d48da39f..0000000000 --- a/releases/templates/sdk/typescript/gen.yaml +++ /dev/null @@ -1,27 +0,0 @@ -configVersion: 2.0.0 -generation: - comments: {} - sdkClassName: SDK - usageSnippets: - optionalPropertyRendering: withExample - fixes: - nameResolutionDec2023: false - telemetryEnabled: false -typescript: - version: "" - author: Formance - clientServerStatusCodesAsErrors: false - flattenGlobalSecurity: true - imports: - option: openapi - paths: - callbacks: sdk/models/callbacks - errors: sdk/models/errors - operations: sdk/models/operations - shared: sdk/models/shared - webhooks: sdk/models/webhooks - inputModelSuffix: input - maxMethodParams: 0 - outputModelSuffix: output - packageName: '@formance/formance-sdk' - templateVersion: v2 diff --git a/tests/integration/go.mod b/tests/integration/go.mod index 5a489ea77d..711a5271dd 100644 --- a/tests/integration/go.mod +++ b/tests/integration/go.mod @@ -18,7 +18,6 @@ require ( github.com/formancehq/stack/libs/events v0.0.0-00010101000000-000000000000 github.com/formancehq/wallets v0.0.0-00010101000000-000000000000 github.com/formancehq/webhooks v0.0.0-00010101000000-000000000000 - github.com/getkin/kin-openapi v0.114.0 github.com/golang-jwt/jwt v3.2.2+incompatible github.com/google/uuid v1.6.0 github.com/jackc/pgx/v5 v5.6.0 @@ -146,7 +145,6 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.4 // indirect github.com/iancoleman/strcase v0.2.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/invopop/yaml v0.1.0 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.14.3 // indirect github.com/jackc/pgio v1.0.0 // indirect @@ -179,7 +177,6 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/moby/term v0.5.0 // indirect - github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/morikuni/aec v1.0.0 // indirect github.com/muhlemmer/gu v0.3.1 // indirect github.com/muhlemmer/httpforwarded v0.1.0 // indirect @@ -192,7 +189,6 @@ require ( github.com/opensearch-project/opensearch-go v1.1.0 // indirect github.com/opensearch-project/opensearch-go/v2 v2.3.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect - github.com/perimeterx/marshmallow v1.1.4 // indirect github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect @@ -214,7 +210,6 @@ require ( github.com/tklauser/go-sysconf v0.3.14 // indirect github.com/tklauser/numcpus v0.8.0 // indirect github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect - github.com/ugorji/go/codec v1.2.11 // indirect github.com/uptrace/bun/extra/bundebug v1.2.1 // indirect github.com/uptrace/bun/extra/bunotel v1.2.1 // indirect github.com/uptrace/opentelemetry-go-extra/otellogrus v0.3.1 // indirect diff --git a/tests/integration/go.sum b/tests/integration/go.sum index c84c1ff153..72e26361ea 100644 --- a/tests/integration/go.sum +++ b/tests/integration/go.sum @@ -795,8 +795,6 @@ github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/get-momo/atlar-v1-go-client v1.2.1 h1:sKWd0maMshxBErGXsYVGhGIB+zFxynrWLNHnegB4lXs= github.com/get-momo/atlar-v1-go-client v1.2.1/go.mod h1:qcLoXEhjTCOeBqAzG2tucpvxGJS2LYNwaU7WnJYnO64= -github.com/getkin/kin-openapi v0.114.0 h1:ar7QiJpDdlR+zSyPjrLf8mNnpoFP/lI90XcywMCFNe8= -github.com/getkin/kin-openapi v0.114.0/go.mod h1:l5e9PaFUo9fyLJCPGQeXI2ML8c3P8BHOEV2VaAVf/pc= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gibson042/canonicaljson-go v1.0.3 h1:EAyF8L74AWabkyUmrvEFHEt/AGFQeD6RfwbAuf0j1bI= github.com/gibson042/canonicaljson-go v1.0.3/go.mod h1:DsLpJTThXyGNO+KZlI85C1/KDcImpP67k/RKVjcaEqo= @@ -874,8 +872,6 @@ github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqw github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= -github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= -github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= @@ -1051,8 +1047,6 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/invopop/yaml v0.1.0 h1:YW3WGUoJEXYfzWBjn00zIlrw7brGVD0fUKRYDPAPhrc= -github.com/invopop/yaml v0.1.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= @@ -1173,8 +1167,6 @@ github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3N github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= @@ -1218,8 +1210,6 @@ github.com/ory/dockertest/v3 v3.11.0 h1:OiHcxKAvSDUwsEVh2BjxQQc/5EHz9n0va9awCtNG github.com/ory/dockertest/v3 v3.11.0/go.mod h1:VIPxS1gwT9NpPOrfD3rACs8Y9Z7yhzO4SB194iUDnUI= github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw= github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/perimeterx/marshmallow v1.1.4 h1:pZLDH9RjlLGGorbXhcaQLhfuV0pFMNfPO55FuFkxqLw= -github.com/perimeterx/marshmallow v1.1.4/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= @@ -1315,10 +1305,6 @@ github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYg github.com/tklauser/numcpus v0.8.0/go.mod h1:ZJZlAY+dmR4eut8epnzf0u/VwodKmryxR8txiloSqBE= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= -github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= -github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= -github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= -github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/uptrace/bun v1.2.3 h1:6KDc6YiNlXde38j9ATKufb8o7MS8zllhAOeIyELKrk0= github.com/uptrace/bun v1.2.3/go.mod h1:8frYFHrO/Zol3I4FEjoXam0HoNk+t5k7aJRl3FXp0mk= github.com/uptrace/bun/dialect/pgdialect v1.2.3 h1:YyCxxqeL0lgFWRZzKCOt6mnxUsjqITcxSo0mLqgwMUA= @@ -2159,7 +2145,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= diff --git a/tests/integration/internal/init.go b/tests/integration/internal/init.go index 5eca41a3ef..0a39d63f52 100644 --- a/tests/integration/internal/init.go +++ b/tests/integration/internal/init.go @@ -38,14 +38,13 @@ func Client(options ...formance.SDKOption) *formance.Formance { panic(err) } - httpTransport, err := newOpenapiCheckerTransport(ctx, currentTest.httpTransport) Expect(err).To(BeNil()) options = append([]formance.SDKOption{ formance.WithServerURL(gatewayUrl.String()), formance.WithClient( &http.Client{ - Transport: httpTransport, + Transport: currentTest.httpTransport, }, ), }, options...) diff --git a/tests/integration/internal/openapi.go b/tests/integration/internal/openapi.go deleted file mode 100644 index ebd5ddf705..0000000000 --- a/tests/integration/internal/openapi.go +++ /dev/null @@ -1,115 +0,0 @@ -package internal - -import ( - "bytes" - "context" - "io" - "net/http" - "net/http/httputil" - "os" - "path/filepath" - - formance "github.com/formancehq/formance-sdk-go/v2" - "github.com/getkin/kin-openapi/openapi3" - "github.com/getkin/kin-openapi/openapi3filter" - "github.com/getkin/kin-openapi/routers" - "github.com/getkin/kin-openapi/routers/gorillamux" - . "github.com/onsi/gomega" - "github.com/pkg/errors" -) - -var sdkClient *formance.Formance - -type openapiCheckerRoundTripper struct { - router routers.Router - underlying http.RoundTripper -} - -func (c *openapiCheckerRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - route, pathParams, err := c.router.FindRoute(req) - Expect(errors.Wrapf(err, "retrieving operation for route %s %s", req.Method, req.URL.String())). - WithOffset(6).To(Succeed()) - - options := &openapi3filter.Options{ - IncludeResponseStatus: true, - MultiError: true, - AuthenticationFunc: openapi3filter.NoopAuthenticationFunc, - } - input := &openapi3filter.RequestValidationInput{ - Request: req, - PathParams: pathParams, - QueryParams: req.URL.Query(), - Route: route, - Options: options, - } - - Expect(errors.Wrap(openapi3filter.ValidateRequest(req.Context(), input), "validating request")). - WithOffset(6).To(Succeed()) - - _, err = httputil.DumpRequest(req, true) - Expect(err).ToNot(HaveOccurred()) - - rsp, err := c.underlying.RoundTrip(req) - Expect(err).WithOffset(6).To(Succeed()) - - data, err := io.ReadAll(rsp.Body) - Expect(err).WithOffset(6).To(Succeed()) - - rsp.Body = io.NopCloser(bytes.NewBuffer(data)) - - err = openapi3filter.ValidateResponse(req.Context(), &openapi3filter.ResponseValidationInput{ - RequestValidationInput: input, - Status: rsp.StatusCode, - Header: rsp.Header, - Body: io.NopCloser(bytes.NewBuffer(data)), - Options: options, - }) - Expect(err).WithOffset(6).To(Succeed()) - - return rsp, nil -} - -var _ http.RoundTripper = &openapiCheckerRoundTripper{} - -func newOpenapiCheckerTransport(ctx context.Context, rt http.RoundTripper) (*openapiCheckerRoundTripper, error) { - openapiRawSpec, err := os.ReadFile(filepath.Join("..", "..", "..", "releases", "build", "latest.json")) - if err != nil { - return nil, errors.Wrap(err, "loading spec file") - } - - loader := &openapi3.Loader{ - Context: ctx, - IsExternalRefsAllowed: true, - } - doc, err := loader.LoadFromData(openapiRawSpec) - if err != nil { - return nil, errors.Wrap(err, "parsing spec") - } - - // Override default servers - doc.Servers = []*openapi3.Server{{ - URL: "http://127.0.0.1", - }} - doc.Security = openapi3.SecurityRequirements{} - doc.Components.SecuritySchemes = openapi3.SecuritySchemes{} - for path := range doc.Paths { - if path == "x-speakeasy-errors" { - delete(doc.Paths, path) - } - } - - err = doc.Validate(ctx, openapi3.DisableExamplesValidation()) - if err != nil { - return nil, errors.Wrap(err, "validating spec") - } - - router, err := gorillamux.NewRouter(doc) - if err != nil { - return nil, errors.Wrap(err, "building router") - } - - return &openapiCheckerRoundTripper{ - router: router, - underlying: rt, - }, nil -} diff --git a/tests/integration/temporalite.Dockerfile b/tests/integration/temporalite.Dockerfile index 3973469dc1..2ab6a03261 100644 --- a/tests/integration/temporalite.Dockerfile +++ b/tests/integration/temporalite.Dockerfile @@ -1,4 +1,4 @@ -FROM public.ecr.aws/docker/library/golang:1.19 AS builder +FROM golang:1.19 AS builder RUN mkdir -p ${GOPATH:-/go}/src/temporalite && \ git clone https://github.com/temporalio/temporalite.git ${GOPATH:-/go}/src/temporalite && \ @@ -8,7 +8,7 @@ RUN mkdir -p ${GOPATH:-/go}/src/temporalite && \ go get -d -v ./... && \ go build -o ${GOPATH:-/go}/bin/ ${GOPATH:-/go}/src/temporalite/cmd/temporalite -FROM public.ecr.aws/debian/debian:stable-slim +FROM debian:stable-slim COPY --from=builder ${GOPATH:-/go}/bin/temporalite /bin EXPOSE 7233 8233