diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index d3582d64..2edf025b 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,18 +1,18 @@ lockVersion: 2.0.0 id: 5bbaa3a9-baa0-471b-ba6a-13fd88e8c119 management: - docChecksum: 98a46916ed9fb36a8315c86bbba75fbd + docChecksum: 6f50b6ff9e9172aa31796a10934af7ff docVersion: 1.0.0 speakeasyVersion: 1.682.0 generationVersion: 2.791.1 - releaseVersion: 2.16.6 - configChecksum: 7239796c50483d12ab0ac0b8b3912b5f + releaseVersion: 2.16.7 + configChecksum: 6141e68f659037fbd3a7bc6dc52027a0 repoURL: https://github.com/gr4vy/gr4vy-java.git published: true persistentEdits: - generation_id: 7496d520-7bc9-4fff-82bf-9125fc778507 - pristine_commit_hash: 2f8001edc139916bb76fb2b67d807e50f601caf0 - pristine_tree_hash: 0a47f06eaac4f96e8a9643373c1cdea6db9c5a14 + generation_id: e1201411-d4bf-4b27-be64-6928dff8dc5b + pristine_commit_hash: a740271a77557d08eebe912d965c0b1c35d0d5c1 + pristine_tree_hash: 632f9a9b13148d41e6cb77b25a2fa6b894842cd7 features: java: additionalDependencies: 0.1.0 @@ -391,6 +391,14 @@ trackedFiles: id: 162e886d6d33 last_write_checksum: sha1:c0e9afd03da7f5a37d33dde09a541cb7ef3858aa pristine_git_object: e8e587d3d0b755b53020b14d3fa8a12042e8a9b9 + docs/models/components/Flow.md: + id: 77874d7a2e8f + last_write_checksum: sha1:cc34120b7685516e5e1ed02980774cab1ebd2e41 + pristine_git_object: 5f95cf8888d4eb1e32b3f0adb4f6796d6238c23a + docs/models/components/FlowAction.md: + id: 26ac1049757b + last_write_checksum: sha1:38036eeef28d2325c8c4b242bdfb72ed4abad248 + pristine_git_object: 8bf3943c1cb92cb7e71978967c88ecf8d695cb89 docs/models/components/ForterAntiFraudOptions.md: id: f1d6879beedc last_write_checksum: sha1:c92bf010c8c77356644bb323918580a3cc8b2a45 @@ -1051,6 +1059,14 @@ trackedFiles: id: 860f2214deb0 last_write_checksum: sha1:26049ea7dc3b4939ef40a92b40f5340cd2bf8a42 pristine_git_object: 66d262afba4818ca4bcb15358caea08e1c595668 + docs/models/components/TransactionAction.md: + id: 7cf2857d2f07 + last_write_checksum: sha1:e9d0306a43f9865d511a66ee72ac9dc57fe1b79e + pristine_git_object: eda9cb61593aea5f98f469d00d79d85c43945bac + docs/models/components/TransactionActions.md: + id: 40a8e069c73a + last_write_checksum: sha1:88bb082afe8dd221f3c6e69e57fe9bef6ab58ead + pristine_git_object: b57f6dff53780c04e40354cbf0ff2c9b0f4d00c4 docs/models/components/TransactionBuyer.md: id: 31b4c412193a last_write_checksum: sha1:65d59a8e48a7c154609da24b7300f2b37c1a7a9c @@ -1847,6 +1863,14 @@ trackedFiles: id: 5a96a588a01d last_write_checksum: sha1:a820a9985e8bc8784387ec33a8eb0317e885f002 pristine_git_object: 192a3b88d50e0e622849209d0499dc6c0dd25862 + docs/models/operations/ListTransactionActionsRequest.md: + id: d243da14c657 + last_write_checksum: sha1:855f68945e8509a3de59d730d71201ab5b5a3a4e + pristine_git_object: 64b887849dd2c77ef5a33ce5152b60e39c72b053 + docs/models/operations/ListTransactionActionsResponse.md: + id: 25ea63143f2b + last_write_checksum: sha1:5a3b997758868c4fb80de5281864a157b2f71f8f + pristine_git_object: 8f8d0c2c6077a8b433a02b9c3a69c3f092c1b081 docs/models/operations/ListTransactionEventsRequest.md: id: cc9c93d01a99 last_write_checksum: sha1:05211be13fb2ade81de41b41e85cb8f709e2ae62 @@ -2011,6 +2035,10 @@ trackedFiles: id: d9257bed4aeb last_write_checksum: sha1:8ecea7787ab7a819637013853b269d5bb5e371db pristine_git_object: 83fe0d57b20cfb96692c64518a1d649355ec7a07 + docs/sdks/actions/README.md: + id: e229cf99e666 + last_write_checksum: sha1:6f9aba742b30e5c3137b411063deb64964328d19 + pristine_git_object: acabfcfe9a9794983b00dbd3446142987eeb668d docs/sdks/all/README.md: id: 936653be5c4b last_write_checksum: sha1:65e40bebdbeea2b16557bdffbee9051f8de6f09f @@ -2145,8 +2173,8 @@ trackedFiles: pristine_git_object: 15c4e4642f204ccb312d8814155b69e153b4e19b gradle.properties: id: 2afbb999f001 - last_write_checksum: sha1:7e1f08c08d03464d694655c12ff61b8ccd2bb79e - pristine_git_object: 9e174a7733ae3b217cf1d5e7e9f0b16e3281d26c + last_write_checksum: sha1:6edeab871e3dcc2e21e79da5d6fd26802fc9b7aa + pristine_git_object: e021cdca9f51faceee32e06feb25efa1091f1c01 gradle/wrapper/gradle-wrapper.jar: id: ec27dae6e852 last_write_checksum: sha1:f725fb1467084142d74fd7cd8eab691ab3442611 @@ -2203,6 +2231,10 @@ trackedFiles: id: 71aaa90e0827 last_write_checksum: sha1:7daa26ea3b48220f84c6d77ebf0d4df86750ff5d pristine_git_object: 30132948a1d2797294f9ccee3b2e5edb763113d6 + src/main/java/com/gr4vy/sdk/Actions.java: + id: 7c86edba82fe + last_write_checksum: sha1:06941122d01bc0d55acec9e541f880b66cd7f75e + pristine_git_object: 2fcf52268f2a72d27abaf140bbb428db4a696b48 src/main/java/com/gr4vy/sdk/All.java: id: 234c521b6941 last_write_checksum: sha1:c192ddbfd8ac3760b9c812ad3ed31841212b7abf @@ -2211,6 +2243,10 @@ trackedFiles: id: 34079b56a4a6 last_write_checksum: sha1:04f37daea3a2ce9298b776199abf54faa1ee1094 pristine_git_object: 44d25af25b5889a53dccba8fec59d873d4353bf0 + src/main/java/com/gr4vy/sdk/AsyncActions.java: + id: 6e9840fe25fe + last_write_checksum: sha1:41fdcdaa325ed3a1e8e5cf8ac80ea4860598347d + pristine_git_object: fbb34e6af45c541910cdc621b57918e218b34bfd src/main/java/com/gr4vy/sdk/AsyncAll.java: id: 42ccc0a41ddf last_write_checksum: sha1:8e72fc268baf2be20bbaab2498be58828098acf9 @@ -2337,8 +2373,8 @@ trackedFiles: pristine_git_object: 1c2a4e96c35adbaa3ed6a13733f6a903df243fa1 src/main/java/com/gr4vy/sdk/AsyncTransactions.java: id: bf9640b12cf9 - last_write_checksum: sha1:8a2153a7a4980d787d2e8c11e07fa27899129f06 - pristine_git_object: 459c9a7735b613a398629fef4f4d2ce0d39f420a + last_write_checksum: sha1:1775dfdd49bc91a78920fad2390489e8ff2d50ef + pristine_git_object: 358bbf8b3dc0a4a4e2d52a22a86fc46ea63afc9b src/main/java/com/gr4vy/sdk/AsyncTransactionsRefunds.java: id: 25e32812684e last_write_checksum: sha1:bf160a106f5b900e7821cb2dbf1768e3622eac23 @@ -2453,8 +2489,8 @@ trackedFiles: pristine_git_object: 502a7312d3dc82c102dbaf7ed5e952d0c793e26f src/main/java/com/gr4vy/sdk/SDKConfiguration.java: id: 73a7edeaca45 - last_write_checksum: sha1:071035068aff6e2b92fef4b192e3a7d3b3e8dfa3 - pristine_git_object: 6f2454dbd18c6a67bccb5ffae287c5f4276b91b3 + last_write_checksum: sha1:7bcbe3aff7772595eab18a682b9412a19965df48 + pristine_git_object: cf77c2956f8421915f105dbad12d0203a80909ec src/main/java/com/gr4vy/sdk/SecuritySource.java: id: 1b6add6b9b50 last_write_checksum: sha1:2f365cc823c6243188e83f4df618c9737fcee8bd @@ -2473,8 +2509,8 @@ trackedFiles: pristine_git_object: fc50cc835b8470e7dbb58c900cd8253f0102162f src/main/java/com/gr4vy/sdk/Transactions.java: id: 3cf11cff6a7f - last_write_checksum: sha1:d9f7ff18fb72c43fc1a7ad7c44c39861a0f0bf02 - pristine_git_object: a7c2a3418bcf60a7ff1c790b53ad0bb9e67491f3 + last_write_checksum: sha1:976a76050968bab7073b26021808f29598a7bbf8 + pristine_git_object: a7117f3ce4432d9a59b8aabedd6e687c151030ad src/main/java/com/gr4vy/sdk/TransactionsRefunds.java: id: cf62b811d59f last_write_checksum: sha1:8f75137e3958a96a43c2c6d5da3a7e1d9cfc6ba7 @@ -2823,6 +2859,14 @@ trackedFiles: id: 7d00f2b8a827 last_write_checksum: sha1:d4e5031a4e97c87b6800d0ae3d307d3b039f28cf pristine_git_object: be352eb8d514038fd7a2100ee20ad31b0741a5b5 + src/main/java/com/gr4vy/sdk/models/components/Flow.java: + id: 3349fe260a47 + last_write_checksum: sha1:7e8e18c485456fc572defee0aed2d4f16b104ab2 + pristine_git_object: 685c5d868c3957b2a47ae4e82071e566bc214c9e + src/main/java/com/gr4vy/sdk/models/components/FlowAction.java: + id: 4e074d1e3902 + last_write_checksum: sha1:ac748987bb5d385e32d5311d27eabaa5b85cae6e + pristine_git_object: abf8340b4869b86574b9772f49736d3da31535ad src/main/java/com/gr4vy/sdk/models/components/ForterAntiFraudOptions.java: id: db91800557ce last_write_checksum: sha1:7c162c7206410a54842f49c277c2324bf861442b @@ -3487,6 +3531,14 @@ trackedFiles: id: 3a6b6cb3c604 last_write_checksum: sha1:a3458f1ccd5743cf61f5a43042135ddf38aa40fb pristine_git_object: c49dc4d32634602c72b4c7a493cd4af4cc485dba + src/main/java/com/gr4vy/sdk/models/components/TransactionAction.java: + id: 562a10c022e6 + last_write_checksum: sha1:bcfb0848257538b71da9082394bad798d626c99d + pristine_git_object: ef47fcd9818fd56dfdaf946e0c2b8d8412de662f + src/main/java/com/gr4vy/sdk/models/components/TransactionActions.java: + id: 6046e429eb14 + last_write_checksum: sha1:ed325ea0de8479a18191964326342440080d3d40 + pristine_git_object: 8e5f4ed945fcb918649ebad09496b8834b963076 src/main/java/com/gr4vy/sdk/models/components/TransactionBuyer.java: id: 6a241140748c last_write_checksum: sha1:8f10538238d7894b987b7f92b59c2b71d6424ada @@ -4011,6 +4063,10 @@ trackedFiles: id: c2f6ba6be3a2 last_write_checksum: sha1:a40ca4a6b2e30f816f0f6dfe2dae5f5113910d00 pristine_git_object: 8d6f5ea60b5259609ee0287b351d81f68bb12c7e + src/main/java/com/gr4vy/sdk/models/operations//async/ListTransactionActionsRequestBuilder.java: + id: 95644f7a09eb + last_write_checksum: sha1:b1391b16c3b554b8523d13ca318cc306b62e66dc + pristine_git_object: 773e7537998cf0afb0385f15409114ed36fa0b7d src/main/java/com/gr4vy/sdk/models/operations//async/ListTransactionEventsRequestBuilder.java: id: 5da67dc24205 last_write_checksum: sha1:f281c7abe91a4fabbfa799a3ba3e256ed062300d @@ -4971,6 +5027,18 @@ trackedFiles: id: 0be548d1550d last_write_checksum: sha1:b9869a84bea111dfa944341d2f9206a2ad702dec pristine_git_object: 627aa2722f4e09d6a16b2f15e3e61f614edcb026 + src/main/java/com/gr4vy/sdk/models/operations/ListTransactionActionsRequest.java: + id: a6f190df250a + last_write_checksum: sha1:3fd60a50faa93d5468c7b73874a357761163ef10 + pristine_git_object: 0e421f36e3ab6ecbd2c043e3979e9a1da372b53d + src/main/java/com/gr4vy/sdk/models/operations/ListTransactionActionsRequestBuilder.java: + id: f8f10eba4ece + last_write_checksum: sha1:298216cce47092f58e5817fb38ab62dd5db4590b + pristine_git_object: 19240efbdf68f81d3194c6b150a0e455189ab4dd + src/main/java/com/gr4vy/sdk/models/operations/ListTransactionActionsResponse.java: + id: 139deac43727 + last_write_checksum: sha1:22538ab97ad0109bfa11d884f5cdda273dc0c9ec + pristine_git_object: 161432ff0fd7e4ddb1f765b4b5bf8dd5a47c4706 src/main/java/com/gr4vy/sdk/models/operations/ListTransactionEventsRequest.java: id: f826a99ee50b last_write_checksum: sha1:ac43bd5829f81b0ca130292bd2bd36d532a0bc20 @@ -5507,6 +5575,10 @@ trackedFiles: id: 54d96bb1c1db last_write_checksum: sha1:8611fc86928a0cda5fd7b54a00454bcaad5c339c pristine_git_object: 46b2a8edacb91e21e9b23d44b5106eacab246301 + src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionActionsResponse.java: + id: a39e09266a62 + last_write_checksum: sha1:7185a24dff2180f65d32b6c0e26b56377bc543bc + pristine_git_object: 9fe912e3e71766c60aae09ff4f5085dc496481c7 src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionEventsResponse.java: id: bed5acb1dfe5 last_write_checksum: sha1:78c781665644caa81837ddcffba4e50cfb538ce4 @@ -5879,6 +5951,10 @@ trackedFiles: id: 20f116bc6064 last_write_checksum: sha1:83c634f4b32e59f7f75699ff629ff40fc4dc5046 pristine_git_object: 3acfb2d3ed618b7157934df0788271f77b0d5463 + src/main/java/com/gr4vy/sdk/operations/ListTransactionActions.java: + id: 1790260027b3 + last_write_checksum: sha1:0b7cb6ac147f69310be09001a36f932dd84f36f9 + pristine_git_object: c22c0f3a224415f684340744dc55bdd6ebb36470 src/main/java/com/gr4vy/sdk/operations/ListTransactionEvents.java: id: 2c060ebeaaec last_write_checksum: sha1:afeca4c4e3419ad2ba8a7453d5dc2b51a19eaeaf @@ -9685,8 +9761,43 @@ examples: application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} "504": application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + list_transaction_actions: + speakeasy-default-list-transaction-actions: + parameters: + path: + transaction_id: "7099948d-7286-47e4-aad8-b68f7eb44591" + responses: + "200": + application/json: {"items": [{"type": "action", "id": "route-transaction", "flow": "redirect-transaction", "rule_id": "f133a3b7-e67e-4d83-bcd3-3e438fedf348", "created_at": "2013-07-16T19:23:00.000+00:00", "outcome": {"result": [{"instrument": "pan", "payment_service_id": "ce26a7d7-fec0-4d47-8efa-044a32b09bc6", "transformations": []}], "type": "card-routing", "version": 2}}]} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} examplesVersion: 1.0.2 generatedTests: {} +releaseNotes: | + ## Java SDK Changes: + * `gr4vy.transactions.actions.list()`: **Added** generatedFiles: - .gitattributes - USAGE.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 31363821..5a59d3c6 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -27,7 +27,7 @@ generation: generateNewTests: false skipResponseBodyAssertions: false java: - version: 2.16.6 + version: 2.16.7 additionalDependencies: - testImplementation:org.junit.jupiter:junit-jupiter:5.10.0 - implementation:com.auth0:java-jwt:4.5.0 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 65463f2f..2a7437a2 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -9,11 +9,11 @@ sources: - 1.0.0 openapi: sourceNamespace: openapi - sourceRevisionDigest: sha256:4e49e586135b35361223e928ed987513ce0d52f4a5b22e1fe291404294b3fb06 - sourceBlobDigest: sha256:5febf2b280dc84a21c4c35dbfb108af81a7d5feeea27f2dd84d52f33f0cd6d3f + sourceRevisionDigest: sha256:5ca34661da18eb56c168e4695778de0c7b1c841d110f532d0031642ccad8c62f + sourceBlobDigest: sha256:42ef6274294e01b2db87805670b01c1e6efc9c55b3a43b21bf02d4266366d815 tags: - latest - - speakeasy-sdk-regen-1767785715 + - speakeasy-sdk-regen-1767805100 - 1.0.0 targets: gr-4-vy: @@ -26,10 +26,10 @@ targets: java: source: openapi sourceNamespace: openapi - sourceRevisionDigest: sha256:4e49e586135b35361223e928ed987513ce0d52f4a5b22e1fe291404294b3fb06 - sourceBlobDigest: sha256:5febf2b280dc84a21c4c35dbfb108af81a7d5feeea27f2dd84d52f33f0cd6d3f + sourceRevisionDigest: sha256:5ca34661da18eb56c168e4695778de0c7b1c841d110f532d0031642ccad8c62f + sourceBlobDigest: sha256:42ef6274294e01b2db87805670b01c1e6efc9c55b3a43b21bf02d4266366d815 codeSamplesNamespace: openapi-java-code-samples - codeSamplesRevisionDigest: sha256:21e40d9f8080295eb12a6bf12fc21372385f4ddce16bf3a965d20efc703e786a + codeSamplesRevisionDigest: sha256:bf9c50699afc88941b3146419f345dfeb93c6f7a01717498717ed8b085a6f791 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 04c4f06d..0f9cbae6 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'com.gr4vy:sdk:2.16.6' +implementation 'com.gr4vy:sdk:2.16.7' ``` Maven: @@ -66,7 +66,7 @@ Maven: com.gr4vy sdk - 2.16.6 + 2.16.7 ``` @@ -463,6 +463,10 @@ Async support is available for: * [cancel](docs/sdks/transactions/README.md#cancel) - Cancel transaction * [sync](docs/sdks/transactions/README.md#sync) - Sync transaction +#### [Transactions.Actions](docs/sdks/actions/README.md) + +* [list](docs/sdks/actions/README.md#list) - Get Flow actions for transaction + #### [Transactions.Events](docs/sdks/events/README.md) * [list](docs/sdks/events/README.md#list) - List transaction events diff --git a/RELEASES.md b/RELEASES.md index 8d63dbc0..732a955d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -898,4 +898,14 @@ Based on: ### Generated - [java v2.16.6] . ### Releases -- [Maven Central v2.16.6] https://central.sonatype.com/artifact/com.gr4vy/sdk/2.16.6 - . \ No newline at end of file +- [Maven Central v2.16.6] https://central.sonatype.com/artifact/com.gr4vy/sdk/2.16.6 - . + +## 2026-01-07 16:58:00 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.682.0 (2.791.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v2.16.7] . +### Releases +- [Maven Central v2.16.7] https://central.sonatype.com/artifact/com.gr4vy/sdk/2.16.7 - . \ No newline at end of file diff --git a/docs/models/components/Flow.md b/docs/models/components/Flow.md new file mode 100644 index 00000000..5f95cf88 --- /dev/null +++ b/docs/models/components/Flow.md @@ -0,0 +1,11 @@ +# Flow + + +## Values + +| Name | Value | +| ---------------------- | ---------------------- | +| `CHECKOUT` | checkout | +| `CARD_TRANSACTION` | card-transaction | +| `NON_CARD_TRANSACTION` | non-card-transaction | +| `REDIRECT_TRANSACTION` | redirect-transaction | \ No newline at end of file diff --git a/docs/models/components/FlowAction.md b/docs/models/components/FlowAction.md new file mode 100644 index 00000000..8bf3943c --- /dev/null +++ b/docs/models/components/FlowAction.md @@ -0,0 +1,11 @@ +# FlowAction + + +## Values + +| Name | Value | +| ------------------------ | ------------------------ | +| `SELECT_PAYMENT_OPTIONS` | select-payment-options | +| `ROUTE_TRANSACTION` | route-transaction | +| `DECLINE_EARLY` | decline-early | +| `SKIP3DS` | skip-3ds | \ No newline at end of file diff --git a/docs/models/components/TransactionAction.md b/docs/models/components/TransactionAction.md new file mode 100644 index 00000000..eda9cb61 --- /dev/null +++ b/docs/models/components/TransactionAction.md @@ -0,0 +1,13 @@ +# TransactionAction + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `type` | *Optional\* | :heavy_minus_sign: | Always `action`. | action | +| `id` | [FlowAction](../../models/components/FlowAction.md) | :heavy_check_mark: | N/A | | +| `flow` | [Flow](../../models/components/Flow.md) | :heavy_check_mark: | N/A | | +| `ruleId` | *String* | :heavy_check_mark: | The ID of the rule that triggered this action. | f133a3b7-e67e-4d83-bcd3-3e438fedf348 | +| `createdAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date this action was created at. | 2013-07-16T19:23:00.000+00:00 | +| `outcome` | Map\ | :heavy_check_mark: | The outcome of the action. | {
"result": [
{
"instrument": "pan",
"payment_service_id": "ce26a7d7-fec0-4d47-8efa-044a32b09bc6",
"transformations": []
}
],
"type": "card-routing",
"version": 2
} | \ No newline at end of file diff --git a/docs/models/components/TransactionActions.md b/docs/models/components/TransactionActions.md new file mode 100644 index 00000000..b57f6dff --- /dev/null +++ b/docs/models/components/TransactionActions.md @@ -0,0 +1,8 @@ +# TransactionActions + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `items` | List\<[TransactionAction](../../models/components/TransactionAction.md)> | :heavy_check_mark: | The list of actions triggered for a transaction. | \ No newline at end of file diff --git a/docs/models/operations/ListTransactionActionsRequest.md b/docs/models/operations/ListTransactionActionsRequest.md new file mode 100644 index 00000000..64b88784 --- /dev/null +++ b/docs/models/operations/ListTransactionActionsRequest.md @@ -0,0 +1,9 @@ +# ListTransactionActionsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `transactionId` | *String* | :heavy_check_mark: | The ID of the transaction | 7099948d-7286-47e4-aad8-b68f7eb44591 | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | \ No newline at end of file diff --git a/docs/models/operations/ListTransactionActionsResponse.md b/docs/models/operations/ListTransactionActionsResponse.md new file mode 100644 index 00000000..8f8d0c2c --- /dev/null +++ b/docs/models/operations/ListTransactionActionsResponse.md @@ -0,0 +1,11 @@ +# ListTransactionActionsResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `transactionActions` | [Optional\](../../models/components/TransactionActions.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/sdks/actions/README.md b/docs/sdks/actions/README.md new file mode 100644 index 00000000..acabfcfe --- /dev/null +++ b/docs/sdks/actions/README.md @@ -0,0 +1,71 @@ +# Transactions.Actions + +## Overview + +### Available Operations + +* [list](#list) - Get Flow actions for transaction + +## list + +Retrieve the list of Flow actions that have been triggered for a transaction. + +### Example Usage + + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.ListTransactionActionsResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .merchantAccountId("") + .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", "")) + .build(); + + ListTransactionActionsResponse res = sdk.transactions().actions().list() + .transactionId("7099948d-7286-47e4-aad8-b68f7eb44591") + .call(); + + if (res.transactionActions().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `transactionId` | *String* | :heavy_check_mark: | The ID of the transaction | 7099948d-7286-47e4-aad8-b68f7eb44591 | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | + +### Response + +**[ListTransactionActionsResponse](../../models/operations/ListTransactionActionsResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 9e174a77..e021cdca 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ groupId=com.gr4vy artifactId=sdk -version=2.16.6 +version=2.16.7 org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g diff --git a/src/main/java/com/gr4vy/sdk/Actions.java b/src/main/java/com/gr4vy/sdk/Actions.java new file mode 100644 index 00000000..2fcf5226 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/Actions.java @@ -0,0 +1,87 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk; + +import static com.gr4vy.sdk.operations.Operations.RequestOperation; + +import com.gr4vy.sdk.models.operations.ListTransactionActionsRequest; +import com.gr4vy.sdk.models.operations.ListTransactionActionsRequestBuilder; +import com.gr4vy.sdk.models.operations.ListTransactionActionsResponse; +import com.gr4vy.sdk.operations.ListTransactionActions; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Options; +import java.lang.String; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class Actions { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final AsyncActions asyncSDK; + + Actions(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncActions(this, sdkConfiguration); + } + + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncActions async() { + return asyncSDK; + } + + /** + * Get Flow actions for transaction + * + *

Retrieve the list of Flow actions that have been triggered for a transaction. + * + * @return The call builder + */ + public ListTransactionActionsRequestBuilder list() { + return new ListTransactionActionsRequestBuilder(sdkConfiguration); + } + + /** + * Get Flow actions for transaction + * + *

Retrieve the list of Flow actions that have been triggered for a transaction. + * + * @param transactionId The ID of the transaction + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public ListTransactionActionsResponse list(String transactionId) { + return list(transactionId, JsonNullable.undefined(), Optional.empty()); + } + + /** + * Get Flow actions for transaction + * + *

Retrieve the list of Flow actions that have been triggered for a transaction. + * + * @param transactionId The ID of the transaction + * @param merchantAccountId + * @param options additional options + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public ListTransactionActionsResponse list( + String transactionId, JsonNullable merchantAccountId, + Optional options) { + ListTransactionActionsRequest request = + ListTransactionActionsRequest + .builder() + .transactionId(transactionId) + .merchantAccountId(merchantAccountId) + .build(); + RequestOperation operation + = new ListTransactionActions.Sync(sdkConfiguration, options, _headers); + return operation.handleResponse(operation.doRequest(request)); + } + +} diff --git a/src/main/java/com/gr4vy/sdk/AsyncActions.java b/src/main/java/com/gr4vy/sdk/AsyncActions.java new file mode 100644 index 00000000..fbb34e6a --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/AsyncActions.java @@ -0,0 +1,90 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk; + +import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation; + +import com.gr4vy.sdk.models.operations.ListTransactionActionsRequest; +import com.gr4vy.sdk.models.operations.async.ListTransactionActionsRequestBuilder; +import com.gr4vy.sdk.models.operations.async.ListTransactionActionsResponse; +import com.gr4vy.sdk.operations.ListTransactionActions; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Options; +import java.lang.String; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class AsyncActions { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final Actions syncSDK; + + AsyncActions(Actions syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public Actions sync() { + return syncSDK; + } + + + /** + * Get Flow actions for transaction + * + *

Retrieve the list of Flow actions that have been triggered for a transaction. + * + * @return The async call builder + */ + public ListTransactionActionsRequestBuilder list() { + return new ListTransactionActionsRequestBuilder(sdkConfiguration); + } + + /** + * Get Flow actions for transaction + * + *

Retrieve the list of Flow actions that have been triggered for a transaction. + * + * @param transactionId The ID of the transaction + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture list(String transactionId) { + return list(transactionId, JsonNullable.undefined(), Optional.empty()); + } + + /** + * Get Flow actions for transaction + * + *

Retrieve the list of Flow actions that have been triggered for a transaction. + * + * @param transactionId The ID of the transaction + * @param merchantAccountId + * @param options additional options + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture list( + String transactionId, JsonNullable merchantAccountId, + Optional options) { + ListTransactionActionsRequest request = + ListTransactionActionsRequest + .builder() + .transactionId(transactionId) + .merchantAccountId(merchantAccountId) + .build(); + AsyncRequestOperation operation + = new ListTransactionActions.Async( + sdkConfiguration, options, sdkConfiguration.retryScheduler(), + _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/com/gr4vy/sdk/AsyncTransactions.java b/src/main/java/com/gr4vy/sdk/AsyncTransactions.java index 459c9a77..358bbf8b 100644 --- a/src/main/java/com/gr4vy/sdk/AsyncTransactions.java +++ b/src/main/java/com/gr4vy/sdk/AsyncTransactions.java @@ -53,6 +53,7 @@ public class AsyncTransactions { private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; private final AsyncTransactionsRefunds refunds; + private final AsyncActions actions; private final AsyncEvents events; private final AsyncSettlements settlements; private final Transactions syncSDK; @@ -60,6 +61,7 @@ public class AsyncTransactions { AsyncTransactions(Transactions syncSDK, SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; this.refunds = new AsyncTransactionsRefunds(syncSDK.refunds(), this.sdkConfiguration); + this.actions = new AsyncActions(syncSDK.actions(), this.sdkConfiguration); this.events = new AsyncEvents(syncSDK.events(), this.sdkConfiguration); this.settlements = new AsyncSettlements(syncSDK.settlements(), this.sdkConfiguration); this.syncSDK = syncSDK; @@ -69,6 +71,10 @@ public final AsyncTransactionsRefunds refunds() { return refunds; } + public final AsyncActions actions() { + return actions; + } + public final AsyncEvents events() { return events; } diff --git a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java index 6f2454db..cf77c295 100644 --- a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java +++ b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java @@ -22,7 +22,7 @@ public class SDKConfiguration { private static final String LANGUAGE = "java"; public static final String OPENAPI_DOC_VERSION = "1.0.0"; - public static final String SDK_VERSION = "2.16.6"; + public static final String SDK_VERSION = "2.16.7"; public static final String GEN_VERSION = "2.791.1"; private static final String BASE_PACKAGE = "com.gr4vy.sdk"; public static final String USER_AGENT = diff --git a/src/main/java/com/gr4vy/sdk/Transactions.java b/src/main/java/com/gr4vy/sdk/Transactions.java index a7c2a341..a7117f3c 100644 --- a/src/main/java/com/gr4vy/sdk/Transactions.java +++ b/src/main/java/com/gr4vy/sdk/Transactions.java @@ -53,12 +53,14 @@ public class Transactions { private final SDKConfiguration sdkConfiguration; private final AsyncTransactions asyncSDK; private final TransactionsRefunds refunds; + private final Actions actions; private final Events events; private final Settlements settlements; Transactions(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; this.refunds = new TransactionsRefunds(this.sdkConfiguration); + this.actions = new Actions(this.sdkConfiguration); this.events = new Events(this.sdkConfiguration); this.settlements = new Settlements(this.sdkConfiguration); this.asyncSDK = new AsyncTransactions(this, sdkConfiguration); @@ -68,6 +70,10 @@ public final TransactionsRefunds refunds() { return refunds; } + public final Actions actions() { + return actions; + } + public final Events events() { return events; } diff --git a/src/main/java/com/gr4vy/sdk/models/components/Flow.java b/src/main/java/com/gr4vy/sdk/models/components/Flow.java new file mode 100644 index 00000000..685c5d86 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/Flow.java @@ -0,0 +1,135 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.lang.Override; +import java.lang.String; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + * Wrapper for an "open" enum that can handle unknown values from API responses + * without runtime errors. Instances are immutable singletons with reference equality. + * Use {@code asEnum()} for switch expressions. + */ +public class Flow { + + public static final Flow CHECKOUT = new Flow("checkout"); + public static final Flow CARD_TRANSACTION = new Flow("card-transaction"); + public static final Flow NON_CARD_TRANSACTION = new Flow("non-card-transaction"); + public static final Flow REDIRECT_TRANSACTION = new Flow("redirect-transaction"); + + // This map will grow whenever a Color gets created with a new + // unrecognized value (a potential memory leak if the user is not + // careful). Keep this field lower case to avoid clashing with + // generated member names which will always be upper cased (Java + // convention) + private static final Map values = createValuesMap(); + private static final Map enums = createEnumsMap(); + + private final String value; + + private Flow(String value) { + this.value = value; + } + + /** + * Returns a Flow with the given value. For a specific value the + * returned object will always be a singleton so reference equality + * is satisfied when the values are the same. + * + * @param value value to be wrapped as Flow + */ + @JsonCreator + public static Flow of(String value) { + synchronized (Flow.class) { + return values.computeIfAbsent(value, v -> new Flow(v)); + } + } + + @JsonValue + public String value() { + return value; + } + + public Optional asEnum() { + return Optional.ofNullable(enums.getOrDefault(value, null)); + } + + public boolean isKnown() { + return asEnum().isPresent(); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Flow other = (Flow) obj; + return Objects.equals(value, other.value); + } + + @Override + public String toString() { + return "Flow [value=" + value + "]"; + } + + // return an array just like an enum + public static Flow[] values() { + synchronized (Flow.class) { + return values.values().toArray(new Flow[] {}); + } + } + + private static final Map createValuesMap() { + Map map = new LinkedHashMap<>(); + map.put("checkout", CHECKOUT); + map.put("card-transaction", CARD_TRANSACTION); + map.put("non-card-transaction", NON_CARD_TRANSACTION); + map.put("redirect-transaction", REDIRECT_TRANSACTION); + return map; + } + + private static final Map createEnumsMap() { + Map map = new HashMap<>(); + map.put("checkout", FlowEnum.CHECKOUT); + map.put("card-transaction", FlowEnum.CARD_TRANSACTION); + map.put("non-card-transaction", FlowEnum.NON_CARD_TRANSACTION); + map.put("redirect-transaction", FlowEnum.REDIRECT_TRANSACTION); + return map; + } + + + public enum FlowEnum { + + CHECKOUT("checkout"), + CARD_TRANSACTION("card-transaction"), + NON_CARD_TRANSACTION("non-card-transaction"), + REDIRECT_TRANSACTION("redirect-transaction"),; + + private final String value; + + private FlowEnum(String value) { + this.value = value; + } + + public String value() { + return value; + } + } +} + diff --git a/src/main/java/com/gr4vy/sdk/models/components/FlowAction.java b/src/main/java/com/gr4vy/sdk/models/components/FlowAction.java new file mode 100644 index 00000000..abf8340b --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/FlowAction.java @@ -0,0 +1,135 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import java.lang.Override; +import java.lang.String; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + * Wrapper for an "open" enum that can handle unknown values from API responses + * without runtime errors. Instances are immutable singletons with reference equality. + * Use {@code asEnum()} for switch expressions. + */ +public class FlowAction { + + public static final FlowAction SELECT_PAYMENT_OPTIONS = new FlowAction("select-payment-options"); + public static final FlowAction ROUTE_TRANSACTION = new FlowAction("route-transaction"); + public static final FlowAction DECLINE_EARLY = new FlowAction("decline-early"); + public static final FlowAction SKIP3DS = new FlowAction("skip-3ds"); + + // This map will grow whenever a Color gets created with a new + // unrecognized value (a potential memory leak if the user is not + // careful). Keep this field lower case to avoid clashing with + // generated member names which will always be upper cased (Java + // convention) + private static final Map values = createValuesMap(); + private static final Map enums = createEnumsMap(); + + private final String value; + + private FlowAction(String value) { + this.value = value; + } + + /** + * Returns a FlowAction with the given value. For a specific value the + * returned object will always be a singleton so reference equality + * is satisfied when the values are the same. + * + * @param value value to be wrapped as FlowAction + */ + @JsonCreator + public static FlowAction of(String value) { + synchronized (FlowAction.class) { + return values.computeIfAbsent(value, v -> new FlowAction(v)); + } + } + + @JsonValue + public String value() { + return value; + } + + public Optional asEnum() { + return Optional.ofNullable(enums.getOrDefault(value, null)); + } + + public boolean isKnown() { + return asEnum().isPresent(); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + FlowAction other = (FlowAction) obj; + return Objects.equals(value, other.value); + } + + @Override + public String toString() { + return "FlowAction [value=" + value + "]"; + } + + // return an array just like an enum + public static FlowAction[] values() { + synchronized (FlowAction.class) { + return values.values().toArray(new FlowAction[] {}); + } + } + + private static final Map createValuesMap() { + Map map = new LinkedHashMap<>(); + map.put("select-payment-options", SELECT_PAYMENT_OPTIONS); + map.put("route-transaction", ROUTE_TRANSACTION); + map.put("decline-early", DECLINE_EARLY); + map.put("skip-3ds", SKIP3DS); + return map; + } + + private static final Map createEnumsMap() { + Map map = new HashMap<>(); + map.put("select-payment-options", FlowActionEnum.SELECT_PAYMENT_OPTIONS); + map.put("route-transaction", FlowActionEnum.ROUTE_TRANSACTION); + map.put("decline-early", FlowActionEnum.DECLINE_EARLY); + map.put("skip-3ds", FlowActionEnum.SKIP3DS); + return map; + } + + + public enum FlowActionEnum { + + SELECT_PAYMENT_OPTIONS("select-payment-options"), + ROUTE_TRANSACTION("route-transaction"), + DECLINE_EARLY("decline-early"), + SKIP3DS("skip-3ds"),; + + private final String value; + + private FlowActionEnum(String value) { + this.value = value; + } + + public String value() { + return value; + } + } +} + diff --git a/src/main/java/com/gr4vy/sdk/models/components/TransactionAction.java b/src/main/java/com/gr4vy/sdk/models/components/TransactionAction.java new file mode 100644 index 00000000..ef47fcd9 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/TransactionAction.java @@ -0,0 +1,274 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.Optional; + + +public class TransactionAction { + /** + * Always `action`. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("type") + private Optional type; + + + @JsonProperty("id") + private FlowAction id; + + + @JsonProperty("flow") + private Flow flow; + + /** + * The ID of the rule that triggered this action. + */ + @JsonProperty("rule_id") + private String ruleId; + + /** + * The date this action was created at. + */ + @JsonProperty("created_at") + private OffsetDateTime createdAt; + + /** + * The outcome of the action. + */ + @JsonProperty("outcome") + private Map outcome; + + @JsonCreator + public TransactionAction( + @JsonProperty("id") FlowAction id, + @JsonProperty("flow") Flow flow, + @JsonProperty("rule_id") String ruleId, + @JsonProperty("created_at") OffsetDateTime createdAt, + @JsonProperty("outcome") Map outcome) { + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(flow, "flow"); + Utils.checkNotNull(ruleId, "ruleId"); + Utils.checkNotNull(createdAt, "createdAt"); + outcome = Utils.emptyMapIfNull(outcome); + Utils.checkNotNull(outcome, "outcome"); + this.type = Builder._SINGLETON_VALUE_Type.value(); + this.id = id; + this.flow = flow; + this.ruleId = ruleId; + this.createdAt = createdAt; + this.outcome = outcome; + } + + /** + * Always `action`. + */ + @JsonIgnore + public Optional type() { + return type; + } + + @JsonIgnore + public FlowAction id() { + return id; + } + + @JsonIgnore + public Flow flow() { + return flow; + } + + /** + * The ID of the rule that triggered this action. + */ + @JsonIgnore + public String ruleId() { + return ruleId; + } + + /** + * The date this action was created at. + */ + @JsonIgnore + public OffsetDateTime createdAt() { + return createdAt; + } + + /** + * The outcome of the action. + */ + @JsonIgnore + public Map outcome() { + return outcome; + } + + public static Builder builder() { + return new Builder(); + } + + + public TransactionAction withId(FlowAction id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public TransactionAction withFlow(Flow flow) { + Utils.checkNotNull(flow, "flow"); + this.flow = flow; + return this; + } + + /** + * The ID of the rule that triggered this action. + */ + public TransactionAction withRuleId(String ruleId) { + Utils.checkNotNull(ruleId, "ruleId"); + this.ruleId = ruleId; + return this; + } + + /** + * The date this action was created at. + */ + public TransactionAction withCreatedAt(OffsetDateTime createdAt) { + Utils.checkNotNull(createdAt, "createdAt"); + this.createdAt = createdAt; + return this; + } + + /** + * The outcome of the action. + */ + public TransactionAction withOutcome(Map outcome) { + Utils.checkNotNull(outcome, "outcome"); + this.outcome = outcome; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransactionAction other = (TransactionAction) o; + return + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.flow, other.flow) && + Utils.enhancedDeepEquals(this.ruleId, other.ruleId) && + Utils.enhancedDeepEquals(this.createdAt, other.createdAt) && + Utils.enhancedDeepEquals(this.outcome, other.outcome); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + type, id, flow, + ruleId, createdAt, outcome); + } + + @Override + public String toString() { + return Utils.toString(TransactionAction.class, + "type", type, + "id", id, + "flow", flow, + "ruleId", ruleId, + "createdAt", createdAt, + "outcome", outcome); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private FlowAction id; + + private Flow flow; + + private String ruleId; + + private OffsetDateTime createdAt; + + private Map outcome; + + private Builder() { + // force use of static builder() method + } + + + public Builder id(FlowAction id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + public Builder flow(Flow flow) { + Utils.checkNotNull(flow, "flow"); + this.flow = flow; + return this; + } + + + /** + * The ID of the rule that triggered this action. + */ + public Builder ruleId(String ruleId) { + Utils.checkNotNull(ruleId, "ruleId"); + this.ruleId = ruleId; + return this; + } + + + /** + * The date this action was created at. + */ + public Builder createdAt(OffsetDateTime createdAt) { + Utils.checkNotNull(createdAt, "createdAt"); + this.createdAt = createdAt; + return this; + } + + + /** + * The outcome of the action. + */ + public Builder outcome(Map outcome) { + Utils.checkNotNull(outcome, "outcome"); + this.outcome = outcome; + return this; + } + + public TransactionAction build() { + + return new TransactionAction( + id, flow, ruleId, + createdAt, outcome); + } + + + private static final LazySingletonValue> _SINGLETON_VALUE_Type = + new LazySingletonValue<>( + "type", + "\"action\"", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/TransactionActions.java b/src/main/java/com/gr4vy/sdk/models/components/TransactionActions.java new file mode 100644 index 00000000..8e5f4ed9 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/TransactionActions.java @@ -0,0 +1,102 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.util.List; + + +public class TransactionActions { + /** + * The list of actions triggered for a transaction. + */ + @JsonProperty("items") + private List items; + + @JsonCreator + public TransactionActions( + @JsonProperty("items") List items) { + Utils.checkNotNull(items, "items"); + this.items = items; + } + + /** + * The list of actions triggered for a transaction. + */ + @JsonIgnore + public List items() { + return items; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The list of actions triggered for a transaction. + */ + public TransactionActions withItems(List items) { + Utils.checkNotNull(items, "items"); + this.items = items; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransactionActions other = (TransactionActions) o; + return + Utils.enhancedDeepEquals(this.items, other.items); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + items); + } + + @Override + public String toString() { + return Utils.toString(TransactionActions.class, + "items", items); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private List items; + + private Builder() { + // force use of static builder() method + } + + + /** + * The list of actions triggered for a transaction. + */ + public Builder items(List items) { + Utils.checkNotNull(items, "items"); + this.items = items; + return this; + } + + public TransactionActions build() { + + return new TransactionActions( + items); + } + + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionActionsRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionActionsRequest.java new file mode 100644 index 00000000..0e421f36 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionActionsRequest.java @@ -0,0 +1,165 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import org.openapitools.jackson.nullable.JsonNullable; + + +public class ListTransactionActionsRequest { + /** + * The ID of the transaction + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=transaction_id") + private String transactionId; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @JsonCreator + public ListTransactionActionsRequest( + String transactionId, + JsonNullable merchantAccountId) { + Utils.checkNotNull(transactionId, "transactionId"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.transactionId = transactionId; + this.merchantAccountId = merchantAccountId; + } + + public ListTransactionActionsRequest( + String transactionId) { + this(transactionId, JsonNullable.undefined()); + } + + /** + * The ID of the transaction + */ + @JsonIgnore + public String transactionId() { + return transactionId; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * The ID of the transaction + */ + public ListTransactionActionsRequest withTransactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ListTransactionActionsRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ListTransactionActionsRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListTransactionActionsRequest other = (ListTransactionActionsRequest) o; + return + Utils.enhancedDeepEquals(this.transactionId, other.transactionId) && + Utils.enhancedDeepEquals(this.merchantAccountId, other.merchantAccountId); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + transactionId, merchantAccountId); + } + + @Override + public String toString() { + return Utils.toString(ListTransactionActionsRequest.class, + "transactionId", transactionId, + "merchantAccountId", merchantAccountId); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String transactionId; + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + + /** + * The ID of the transaction + */ + public Builder transactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ListTransactionActionsRequest build() { + + return new ListTransactionActionsRequest( + transactionId, merchantAccountId); + } + + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionActionsRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionActionsRequestBuilder.java new file mode 100644 index 00000000..19240efb --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionActionsRequestBuilder.java @@ -0,0 +1,80 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import static com.gr4vy.sdk.operations.Operations.RequestOperation; + +import com.gr4vy.sdk.SDKConfiguration; +import com.gr4vy.sdk.operations.ListTransactionActions; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.String; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ListTransactionActionsRequestBuilder { + + private String transactionId; + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private Optional retryConfig = Optional.empty(); + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public ListTransactionActionsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public ListTransactionActionsRequestBuilder transactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + public ListTransactionActionsRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public ListTransactionActionsRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ListTransactionActionsRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public ListTransactionActionsRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + + private ListTransactionActionsRequest buildRequest() { + + ListTransactionActionsRequest request = new ListTransactionActionsRequest(transactionId, + merchantAccountId); + + return request; + } + + public ListTransactionActionsResponse call() { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + + RequestOperation operation + = new ListTransactionActions.Sync(sdkConfiguration, options, _headers); + ListTransactionActionsRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionActionsResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionActionsResponse.java new file mode 100644 index 00000000..161432ff --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListTransactionActionsResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.TransactionActions; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; + + +public class ListTransactionActionsResponse implements Response { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional transactionActions; + + @JsonCreator + public ListTransactionActionsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional transactionActions) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(transactionActions, "transactionActions"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.transactionActions = transactionActions; + } + + public ListTransactionActionsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional transactionActions() { + return (Optional) transactionActions; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public ListTransactionActionsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public ListTransactionActionsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public ListTransactionActionsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public ListTransactionActionsResponse withTransactionActions(TransactionActions transactionActions) { + Utils.checkNotNull(transactionActions, "transactionActions"); + this.transactionActions = Optional.ofNullable(transactionActions); + return this; + } + + + /** + * Successful Response + */ + public ListTransactionActionsResponse withTransactionActions(Optional transactionActions) { + Utils.checkNotNull(transactionActions, "transactionActions"); + this.transactionActions = transactionActions; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListTransactionActionsResponse other = (ListTransactionActionsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.transactionActions, other.transactionActions); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + transactionActions); + } + + @Override + public String toString() { + return Utils.toString(ListTransactionActionsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "transactionActions", transactionActions); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional transactionActions = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Successful Response + */ + public Builder transactionActions(TransactionActions transactionActions) { + Utils.checkNotNull(transactionActions, "transactionActions"); + this.transactionActions = Optional.ofNullable(transactionActions); + return this; + } + + /** + * Successful Response + */ + public Builder transactionActions(Optional transactionActions) { + Utils.checkNotNull(transactionActions, "transactionActions"); + this.transactionActions = transactionActions; + return this; + } + + public ListTransactionActionsResponse build() { + + return new ListTransactionActionsResponse( + contentType, statusCode, rawResponse, + transactionActions); + } + + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionActionsRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionActionsRequestBuilder.java new file mode 100644 index 00000000..773e7537 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionActionsRequestBuilder.java @@ -0,0 +1,85 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations.async; + +import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation; + +import com.gr4vy.sdk.SDKConfiguration; +import com.gr4vy.sdk.models.operations.ListTransactionActionsRequest; +import com.gr4vy.sdk.operations.ListTransactionActions; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.String; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ListTransactionActionsRequestBuilder { + + private String transactionId; + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private Optional retryConfig = Optional.empty(); + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public ListTransactionActionsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public ListTransactionActionsRequestBuilder transactionId(String transactionId) { + Utils.checkNotNull(transactionId, "transactionId"); + this.transactionId = transactionId; + return this; + } + + public ListTransactionActionsRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public ListTransactionActionsRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ListTransactionActionsRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public ListTransactionActionsRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + + private ListTransactionActionsRequest buildRequest() { + + ListTransactionActionsRequest request = new ListTransactionActionsRequest(transactionId, + merchantAccountId); + + return request; + } + + public CompletableFuture call() { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + + AsyncRequestOperation operation + = new ListTransactionActions.Async( + sdkConfiguration, options, sdkConfiguration.retryScheduler(), + _headers); + ListTransactionActionsRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionActionsResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionActionsResponse.java new file mode 100644 index 00000000..9fe912e3 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/async/ListTransactionActionsResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.TransactionActions; +import com.gr4vy.sdk.utils.AsyncResponse; +import com.gr4vy.sdk.utils.Blob; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; + + +public class ListTransactionActionsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional transactionActions; + + @JsonCreator + public ListTransactionActionsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional transactionActions) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(transactionActions, "transactionActions"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.transactionActions = transactionActions; + } + + public ListTransactionActionsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional transactionActions() { + return (Optional) transactionActions; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public ListTransactionActionsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public ListTransactionActionsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public ListTransactionActionsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public ListTransactionActionsResponse withTransactionActions(TransactionActions transactionActions) { + Utils.checkNotNull(transactionActions, "transactionActions"); + this.transactionActions = Optional.ofNullable(transactionActions); + return this; + } + + + /** + * Successful Response + */ + public ListTransactionActionsResponse withTransactionActions(Optional transactionActions) { + Utils.checkNotNull(transactionActions, "transactionActions"); + this.transactionActions = transactionActions; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListTransactionActionsResponse other = (ListTransactionActionsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.transactionActions, other.transactionActions); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + transactionActions); + } + + @Override + public String toString() { + return Utils.toString(ListTransactionActionsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "transactionActions", transactionActions); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional transactionActions = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Successful Response + */ + public Builder transactionActions(TransactionActions transactionActions) { + Utils.checkNotNull(transactionActions, "transactionActions"); + this.transactionActions = Optional.ofNullable(transactionActions); + return this; + } + + /** + * Successful Response + */ + public Builder transactionActions(Optional transactionActions) { + Utils.checkNotNull(transactionActions, "transactionActions"); + this.transactionActions = transactionActions; + return this; + } + + public ListTransactionActionsResponse build() { + + return new ListTransactionActionsResponse( + contentType, statusCode, rawResponse, + transactionActions); + } + + } +} diff --git a/src/main/java/com/gr4vy/sdk/operations/ListTransactionActions.java b/src/main/java/com/gr4vy/sdk/operations/ListTransactionActions.java new file mode 100644 index 00000000..c22c0f3a --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/operations/ListTransactionActions.java @@ -0,0 +1,493 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.operations; + +import static com.gr4vy.sdk.operations.Operations.RequestOperation; +import static com.gr4vy.sdk.utils.Exceptions.unchecked; +import static com.gr4vy.sdk.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.SDKConfiguration; +import com.gr4vy.sdk.SecuritySource; +import com.gr4vy.sdk.models.components.TransactionActions; +import com.gr4vy.sdk.models.errors.APIException; +import com.gr4vy.sdk.models.errors.Error400; +import com.gr4vy.sdk.models.errors.Error401; +import com.gr4vy.sdk.models.errors.Error403; +import com.gr4vy.sdk.models.errors.Error404; +import com.gr4vy.sdk.models.errors.Error405; +import com.gr4vy.sdk.models.errors.Error409; +import com.gr4vy.sdk.models.errors.Error425; +import com.gr4vy.sdk.models.errors.Error429; +import com.gr4vy.sdk.models.errors.Error500; +import com.gr4vy.sdk.models.errors.Error502; +import com.gr4vy.sdk.models.errors.Error504; +import com.gr4vy.sdk.models.errors.HTTPValidationError; +import com.gr4vy.sdk.models.operations.ListTransactionActionsRequest; +import com.gr4vy.sdk.models.operations.ListTransactionActionsResponse; +import com.gr4vy.sdk.utils.AsyncRetries; +import com.gr4vy.sdk.utils.BackoffStrategy; +import com.gr4vy.sdk.utils.Blob; +import com.gr4vy.sdk.utils.Globals; +import com.gr4vy.sdk.utils.HTTPClient; +import com.gr4vy.sdk.utils.HTTPRequest; +import com.gr4vy.sdk.utils.Headers; +import com.gr4vy.sdk.utils.Hook.AfterErrorContextImpl; +import com.gr4vy.sdk.utils.Hook.AfterSuccessContextImpl; +import com.gr4vy.sdk.utils.Hook.BeforeRequestContextImpl; +import com.gr4vy.sdk.utils.NonRetryableException; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.Retries; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; + + +public class ListTransactionActions { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final List retryStatusCodes; + final RetryConfig retryConfig; + final HTTPClient client; + final Headers _headers; + final Globals operationGlobals; + + public Base( + SDKConfiguration sdkConfiguration, Optional options, + Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + this.securitySource = this.sdkConfiguration.securitySource(); + options + .ifPresent(o -> o.validate(List.of(Options.Option.RETRY_CONFIG))); + this.retryStatusCodes = List.of("5XX"); + this.retryConfig = options + .flatMap(Options::retryConfig) + .or(sdkConfiguration::retryConfig) + .orElse(RetryConfig.builder().backoff(BackoffStrategy.builder() + .initialInterval(200, TimeUnit.MILLISECONDS) + .maxInterval(200, TimeUnit.MILLISECONDS) + .baseFactor((double) (1)) + .maxElapsedTime(1000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build()); + this.client = this.sdkConfiguration.client(); + this.operationGlobals = new Globals(); + this.sdkConfiguration.globals.getParam("header", "x-gr4vy-merchant-account-id") + .ifPresent(param -> operationGlobals.putParam("header", "x-gr4vy-merchant-account-id", param)); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "list_transaction_actions", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "list_transaction_actions", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "list_transaction_actions", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/transactions/{transaction_id}/actions", + request, this.operationGlobals); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + req.addHeaders(Utils.getHeadersFromMetadata(request, this.operationGlobals)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync( + SDKConfiguration sdkConfiguration, Optional options, + Headers _headers) { + super( + sdkConfiguration, options, + _headers); + } + + private HttpRequest onBuildRequest(ListTransactionActionsRequest request) throws Exception { + HttpRequest req = buildRequest(request, ListTransactionActionsRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(ListTransactionActionsRequest request) { + Retries retries = Retries.builder() + .action(() -> { + HttpRequest r; + try { + r = onBuildRequest(request); + } catch (Exception e) { + throw new NonRetryableException(e); + } + try { + HttpResponse httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "400", "401", "403", "404", "405", "409", "422", "425", "429", "4XX", "500", "502", "504", "5XX")) { + return onError(httpRes, null); + } + return httpRes; + } catch (Exception e) { + return onError(null, e); + } + }) + .retryConfig(retryConfig) + .statusCodes(retryStatusCodes) + .build(); + return unchecked(() -> onSuccess(retries.run())).get(); + } + + + @Override + public ListTransactionActionsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ListTransactionActionsResponse.Builder resBuilder = + ListTransactionActionsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ListTransactionActionsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withTransactionActions(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "400")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error400.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "401")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error401.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "403")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error403.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "404")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error404.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "405")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error405.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "409")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error409.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "422")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw HTTPValidationError.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "425")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error425.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "429")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error429.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "500")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error500.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "502")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error502.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "504")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error504.from(response); + } else { + throw APIException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw APIException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw APIException.from("API error occurred", response); + } + throw APIException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + private final ScheduledExecutorService retryScheduler; + + public Async( + SDKConfiguration sdkConfiguration, Optional options, + ScheduledExecutorService retryScheduler, Headers _headers) { + super( + sdkConfiguration, options, + _headers); + this.retryScheduler = retryScheduler; + } + + private CompletableFuture onBuildRequest(ListTransactionActionsRequest request) throws Exception { + HttpRequest req = buildRequest(request, ListTransactionActionsRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(ListTransactionActionsRequest request) { + AsyncRetries retries = AsyncRetries.builder() + .retryConfig(retryConfig) + .statusCodes(retryStatusCodes) + .scheduler(retryScheduler) + .build(); + return retries.retry(() -> unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "400", "401", "403", "404", "405", "409", "422", "425", "429", "4XX", "500", "502", "504", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity())) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + com.gr4vy.sdk.models.operations.async.ListTransactionActionsResponse.Builder resBuilder = + com.gr4vy.sdk.models.operations.async.ListTransactionActionsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + com.gr4vy.sdk.models.operations.async.ListTransactionActionsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withTransactionActions); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "400")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error400.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "401")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error401.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "403")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error403.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "404")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error404.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "405")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error405.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "409")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error409.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "422")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return HTTPValidationError.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "425")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error425.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "429")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error429.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "500")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error500.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "502")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error502.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "504")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error504.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +}