From 1a990273edcc16874a4930f8f90298f4949bc8c9 Mon Sep 17 00:00:00 2001 From: "raynato.c.pedrajeta" Date: Tue, 20 Aug 2024 15:29:24 +0800 Subject: [PATCH] feat(daml): creation of connector class Primary Changes --------------- 1. Create a DAML connector class 2. Created OpenAPI endpoints of DAML 3. Created DAML web services for create, exercise and query contracts 4. Create simple IOU Transaction using DAML Fixes #3489 Signed-off-by: raynato.c.pedrajeta --- .../openapitools.json | 8 + .../package.json | 101 +++ .../go-client/.openapi-generator/FILES | 23 + .../go-client/.openapi-generator/VERSION | 1 + .../generated/openapi/go-client/.travis.yml | 8 + .../go/generated/openapi/go-client/README.md | 128 +++ .../openapi/go-client/api/openapi.yaml | 388 +++++++++ .../openapi/go-client/api_default.go | 568 +++++++++++++ .../go/generated/openapi/go-client/client.go | 656 +++++++++++++++ .../openapi/go-client/configuration.go | 215 +++++ .../go/generated/openapi/go-client/go.mod | 6 + .../go/generated/openapi/go-client/go.sum | 11 + .../model_create_iou_endpoint_request.go | 198 +++++ ...del_create_iou_endpoint_request_payload.go | 270 ++++++ .../model_create_iou_endpoint_response.go | 342 ++++++++ ...el_create_iou_endpoint_response_payload.go | 270 ++++++ .../model_exercise_iou_endpoint_request.go | 270 ++++++ ..._exercise_iou_endpoint_request_argument.go | 126 +++ .../model_exercise_iou_endpoint_response.go | 162 ++++ ...cise_iou_endpoint_response_events_inner.go | 126 +++ ...endpoint_response_events_inner_archived.go | 162 ++++ ...l_get_parties_involved_endpoint_request.go | 126 +++ .../model_get_parties_involved_response.go | 209 +++++ .../model_query_iou_endpoint_request.go | 234 ++++++ .../model_query_iou_endpoint_request_query.go | 126 +++ .../model_query_iou_endpoint_response.go | 162 ++++ ...uery_iou_endpoint_response_events_inner.go | 126 +++ ...endpoint_response_events_inner_archived.go | 162 ++++ .../model_query_raw_iou_endpoint_request.go | 126 +++ .../generated/openapi/go-client/response.go | 47 ++ .../go-client/test/api_default_test.go | 49 ++ .../go/generated/openapi/go-client/utils.go | 347 ++++++++ .../src/main/json/openapi.json | 471 +++++++++++ .../src/main/json/openapi.tpl.json | 471 +++++++++++ .../kotlin-client/.openapi-generator/FILES | 36 + .../kotlin-client/.openapi-generator/VERSION | 1 + .../generated/openapi/kotlin-client/README.md | 76 ++ .../openapi/kotlin-client/build.gradle | 38 + .../generated/openapi/kotlin-client/gradlew | 245 ++++++ .../openapi/kotlin-client/gradlew.bat | 92 +++ .../openapi/kotlin-client/settings.gradle | 2 + .../openapitools/client/apis/DefaultApi.kt | 418 ++++++++++ .../client/infrastructure/ApiAbstractions.kt | 23 + .../client/infrastructure/ApiClient.kt | 245 ++++++ .../client/infrastructure/ApiResponse.kt | 43 + .../infrastructure/BigDecimalAdapter.kt | 17 + .../infrastructure/BigIntegerAdapter.kt | 17 + .../client/infrastructure/ByteArrayAdapter.kt | 12 + .../client/infrastructure/Errors.kt | 18 + .../client/infrastructure/LocalDateAdapter.kt | 19 + .../infrastructure/LocalDateTimeAdapter.kt | 19 + .../infrastructure/OffsetDateTimeAdapter.kt | 19 + .../client/infrastructure/PartConfig.kt | 11 + .../client/infrastructure/RequestConfig.kt | 18 + .../client/infrastructure/RequestMethod.kt | 8 + .../infrastructure/ResponseExtensions.kt | 24 + .../client/infrastructure/Serializer.kt | 23 + .../client/infrastructure/URIAdapter.kt | 13 + .../client/infrastructure/UUIDAdapter.kt | 13 + .../client/models/CreateIOUEndpointRequest.kt | 44 + .../models/CreateIOUEndpointRequestPayload.kt | 51 ++ .../models/CreateIOUEndpointResponse.kt | 60 ++ .../models/ExerciseIOUEndpointRequest.kt | 52 ++ .../ExerciseIOUEndpointRequestArgument.kt | 35 + .../models/ExerciseIOUEndpointResponse.kt | 40 + .../GetPartiesInvolvedEndpointRequest.kt | 35 + .../client/models/QueryIOUEndpointRequest.kt | 48 ++ .../models/QueryIOUEndpointRequestQuery.kt | 35 + .../client/models/QueryIOUEndpointResponse.kt | 40 + .../QueryIOUEndpointResponseEventsInner.kt | 36 + ...yIOUEndpointResponseEventsInnerArchived.kt | 39 + .../models/QueryRawIOUEndpointRequest.kt | 35 + .../typescript-axios/.openapi-generator/FILES | 5 + .../.openapi-generator/VERSION | 1 + .../generated/openapi/typescript-axios/api.ts | 710 ++++++++++++++++ .../openapi/typescript-axios/base.ts | 72 ++ .../openapi/typescript-axios/common.ts | 150 ++++ .../openapi/typescript-axios/configuration.ts | 101 +++ .../openapi/typescript-axios/index.ts | 18 + .../plugin-ledger-connector-daml.ts | 318 ++++++++ .../web-services/create-iou-endpoint.ts | 123 +++ .../web-services/exercise-iou-endpoint.ts | 128 +++ .../get-parties-involved-endpoint.ts | 123 +++ .../web-services/query-iou-endpoint.ts | 123 +++ .../web-services/query-raw-iou-endpoint.ts | 123 +++ .../integration/daml-get-transaction.test.ts | 221 +++++ .../openapi/openapi-validation.test.ts | 769 ++++++++++++++++++ .../tsconfig.json | 33 + .../main/typescript/daml/daml-test-ledger.ts | 47 +- tools/docker/daml-all-in-one/supervisord.conf | 10 + yarn.lock | 49 +- 91 files changed, 11798 insertions(+), 21 deletions(-) create mode 100644 packages/cactus-plugin-ledger-connector-daml/openapitools.json create mode 100644 packages/cactus-plugin-ledger-connector-daml/package.json create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/.openapi-generator/FILES create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/.openapi-generator/VERSION create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/.travis.yml create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/README.md create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/api/openapi.yaml create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/api_default.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/client.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/configuration.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/go.mod create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/go.sum create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_request.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_request_payload.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_response.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_response_payload.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_request.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_request_argument.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_response.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_response_events_inner.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_response_events_inner_archived.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_get_parties_involved_endpoint_request.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_get_parties_involved_response.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_request.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_request_query.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_response.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_response_events_inner.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_response_events_inner_archived.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_raw_iou_endpoint_request.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/response.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/test/api_default_test.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/utils.go create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/json/openapi.json create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/json/openapi.tpl.json create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/README.md create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/build.gradle create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/gradlew create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/gradlew.bat create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/settings.gradle create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointRequest.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointRequestPayload.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointResponse.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointRequest.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointRequestArgument.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointResponse.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetPartiesInvolvedEndpointRequest.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointRequest.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointRequestQuery.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponse.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponseEventsInner.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponseEventsInnerArchived.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryRawIOUEndpointRequest.kt create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/api.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/base.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/common.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/configuration.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/index.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/plugin-ledger-connector-daml.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/create-iou-endpoint.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/exercise-iou-endpoint.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/get-parties-involved-endpoint.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/query-iou-endpoint.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/query-raw-iou-endpoint.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/test/typescript/integration/daml-get-transaction.test.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/src/test/typescript/integration/openapi/openapi-validation.test.ts create mode 100644 packages/cactus-plugin-ledger-connector-daml/tsconfig.json diff --git a/packages/cactus-plugin-ledger-connector-daml/openapitools.json b/packages/cactus-plugin-ledger-connector-daml/openapitools.json new file mode 100644 index 00000000000..58bdeee4dc9 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/openapitools.json @@ -0,0 +1,8 @@ +{ + "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "6.6.0" + } + } + \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-daml/package.json b/packages/cactus-plugin-ledger-connector-daml/package.json new file mode 100644 index 00000000000..5c2def36578 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/package.json @@ -0,0 +1,101 @@ +{ + "name": "@hyperledger/cactus-plugin-ledger-connector-daml", + "version": "2.0.0", + "description": "Allows Cactus nodes to connect to a DAML ledger.", + "keywords": [ + "Hyperledger", + "Cactus", + "Integration", + "Blockchain", + "Distributed Ledger Technology" + ], + "homepage": "https://github.com/hyperledger/cacti#readme", + "bugs": { + "url": "https://github.com/hyperledger/cacti/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/hyperledger/cacti.git" + }, + "license": "Apache-2.0", + "author": { + "name": "Hyperledger Cactus Contributors", + "email": "cactus@lists.hyperledger.org", + "url": "https://www.hyperledger.org/use/cacti" + }, + "contributors": [ + { + "name": "Please add yourself to the list of contributors", + "email": "your.name@example.com", + "url": "https://example.com" + }, + { + "name": "Peter Somogyvari", + "email": "peter.somogyvari@accenture.com", + "url": "https://accenture.com" + } + ], + "main": "dist/lib/main/typescript/index.js", + "module": "dist/lib/main/typescript/index.js", + "browser": "dist/cactus-plugin-ledger-connector-corda.web.umd.js", + "types": "dist/lib/main/typescript/index.d.ts", + "files": [ + "dist/*" + ], + "scripts": { + "codegen": "yarn run --top-level run-s 'codegen:*'", + "codegen:openapi": "npm run generate-sdk", + "generate-sdk": "run-p 'generate-sdk:*'", + "generate-sdk:go": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g go -o ./src/main/go/generated/openapi/go-client/ --git-user-id hyperledger --git-repo-id $(echo $npm_package_name | replace @hyperledger/ \"\" -z)/src/main/go/generated/openapi/go-client --package-name $(echo $npm_package_name | replace @hyperledger/ \"\" -z) --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore", + "generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore", + "generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --ignore-file-override ../../openapi-generator-ignore", + "generate-server": "yarn run --top-level openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin-spring -o ./src/main-server/kotlin/gen/kotlin-spring/ -c ./src/main-server/openapi-generator-config.yaml --ignore-file-override ../../openapi-generator-ignore", + "watch": "npm-watch", + "webpack": "npm-run-all webpack:dev", + "webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web", + "webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js", + "webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js" + }, + "dependencies": { + "@hyperledger/cactus-common": "2.0.0", + "@hyperledger/cactus-core": "2.0.0", + "@hyperledger/cactus-core-api": "2.0.0", + "axios": "1.7.7", + "express-openapi-validator": "5.2.0", + "http-errors-enhanced-cjs": "2.0.1", + "internal-ip": "6.2.0", + "joi": "17.13.3", + "node-ssh": "13.1.0", + "prom-client": "15.1.3", + "rxjs": "7.8.1", + "temp": "0.9.4", + "typescript-optional": "2.0.1" + }, + "devDependencies": { + "@hyperledger/cactus-test-tooling": "2.0.0", + "@types/body-parser": "1.19.4", + "@types/express": "5.0.0", + "@types/multer": "1.4.7", + "@types/temp": "0.9.1", + "@types/uuid": "10.0.0", + "body-parser": "1.20.2", + "express": "4.21.0", + "uuid": "10.0.0" + }, + "engines": { + "node": ">=18", + "npm": ">=8" + }, + "publishConfig": { + "access": "public" + }, + "browserMinified": "dist/cactus-plugin-ledger-connector-corda.web.umd.min.js", + "mainMinified": "dist/cactus-plugin-ledger-connector-corda.node.umd.min.js", + "watch": { + "codegen:openapi": { + "patterns": [ + "./src/main/json/openapi.json" + ] + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/.openapi-generator/FILES b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/.openapi-generator/FILES new file mode 100644 index 00000000000..9f55cc5394b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/.openapi-generator/FILES @@ -0,0 +1,23 @@ +.travis.yml +README.md +api/openapi.yaml +api_default.go +client.go +configuration.go +go.mod +go.sum +model_create_iou_endpoint_request.go +model_create_iou_endpoint_request_payload.go +model_create_iou_endpoint_response.go +model_exercise_iou_endpoint_request.go +model_exercise_iou_endpoint_request_argument.go +model_exercise_iou_endpoint_response.go +model_get_parties_involved_endpoint_request.go +model_query_iou_endpoint_request.go +model_query_iou_endpoint_request_query.go +model_query_iou_endpoint_response.go +model_query_iou_endpoint_response_events_inner.go +model_query_iou_endpoint_response_events_inner_archived.go +model_query_raw_iou_endpoint_request.go +response.go +utils.go diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/.openapi-generator/VERSION b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/.openapi-generator/VERSION new file mode 100644 index 00000000000..cd802a1ec4e --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/.travis.yml b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/.travis.yml new file mode 100644 index 00000000000..f5cb2ce9a5a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/README.md b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/README.md new file mode 100644 index 00000000000..2cd1f49498c --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/README.md @@ -0,0 +1,128 @@ +# Go API client for cactus-plugin-ledger-connector-daml + +Can perform basic tasks on a DAML ledger + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 2.0.0-rc.3 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```golang +import cactus-plugin-ledger-connector-daml "github.com/hyperledger/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```golang +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. + +```golang +ctx := context.WithValue(context.Background(), cactus-plugin-ledger-connector-daml.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. + +```golang +ctx := context.WithValue(context.Background(), cactus-plugin-ledger-connector-daml.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +### URLs Configuration per Operation + +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. + +```golang +ctx := context.WithValue(context.Background(), cactus-plugin-ledger-connector-daml.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), cactus-plugin-ledger-connector-daml.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**CreateIou**](docs/DefaultApi.md#createiou) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint | This method creates a simple iou countract +*DefaultApi* | [**ExerciseChoice**](docs/DefaultApi.md#exercisechoice) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint | This method exercise choices(DAML term for function on contracts) for iou countract +*DefaultApi* | [**GetPartiesInvolved**](docs/DefaultApi.md#getpartiesinvolved) | **Get** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint | This method queries all the parties that is included on IOU contract +*DefaultApi* | [**QueryContract**](docs/DefaultApi.md#querycontract) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint | This method queries DAML contracts +*DefaultApi* | [**QueryRawContract**](docs/DefaultApi.md#queryrawcontract) | **Get** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint | This method queries DAML contracts that does not include request body + + +## Documentation For Models + + - [CreateIOUEndpointRequest](docs/CreateIOUEndpointRequest.md) + - [CreateIOUEndpointRequestPayload](docs/CreateIOUEndpointRequestPayload.md) + - [CreateIOUEndpointResponse](docs/CreateIOUEndpointResponse.md) + - [ExerciseIOUEndpointRequest](docs/ExerciseIOUEndpointRequest.md) + - [ExerciseIOUEndpointRequestArgument](docs/ExerciseIOUEndpointRequestArgument.md) + - [ExerciseIOUEndpointResponse](docs/ExerciseIOUEndpointResponse.md) + - [GetPartiesInvolvedEndpointRequest](docs/GetPartiesInvolvedEndpointRequest.md) + - [QueryIOUEndpointRequest](docs/QueryIOUEndpointRequest.md) + - [QueryIOUEndpointRequestQuery](docs/QueryIOUEndpointRequestQuery.md) + - [QueryIOUEndpointResponse](docs/QueryIOUEndpointResponse.md) + - [QueryIOUEndpointResponseEventsInner](docs/QueryIOUEndpointResponseEventsInner.md) + - [QueryIOUEndpointResponseEventsInnerArchived](docs/QueryIOUEndpointResponseEventsInnerArchived.md) + - [QueryRawIOUEndpointRequest](docs/QueryRawIOUEndpointRequest.md) + + +## Documentation For Authorization + +Endpoints do not require authorization. + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/api/openapi.yaml b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/api/openapi.yaml new file mode 100644 index 00000000000..f3d54b74d7c --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/api/openapi.yaml @@ -0,0 +1,388 @@ +openapi: 3.0.3 +info: + description: Can perform basic tasks on a DAML ledger + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: Hyperledger Cacti Plugin - Connector DAML + version: 2.0.0-rc.3 +servers: +- url: / +paths: + /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint: + post: + operationId: createIou + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateIOUEndpointRequest' + description: Request body for creation of iou + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/CreateIOUEndpointResponse' + description: OK + summary: This method creates a simple iou countract + x-hyperledger-cactus: + http: + verbLowerCase: post + path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint + /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint: + post: + operationId: exerciseChoice + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ExerciseIOUEndpointRequest' + description: Request body for exercising choice(DAML term for function on + contracts) of iou + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ExerciseIOUEndpointResponse' + description: OK + summary: This method exercise choices(DAML term for function on contracts) for + iou countract + x-hyperledger-cactus: + http: + verbLowerCase: post + path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint + /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint: + post: + operationId: queryContract + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/QueryIOUEndpointRequest' + description: Request body for creation of iou + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/QueryIOUEndpointResponse' + description: OK + summary: This method queries DAML contracts + x-hyperledger-cactus: + http: + verbLowerCase: post + path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint + /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint: + get: + operationId: queryRawContract + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/QueryRawIOUEndpointRequest' + description: Request for querying IOU contracts + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/QueryIOUEndpointResponse' + description: OK + summary: This method queries DAML contracts that does not include request body + x-hyperledger-cactus: + http: + verbLowerCase: get + path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint + /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint: + get: + operationId: getPartiesInvolved + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GetPartiesInvolvedEndpointRequest' + description: Request body for getting the parties involved in daml instance + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/QueryIOUEndpointResponse' + description: OK + summary: This method queries all the parties that is included on IOU contract + x-hyperledger-cactus: + http: + verbLowerCase: get + path: /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint +components: + schemas: + QueryRawIOUEndpointRequest: + description: This method is the request for querying a simple IOU contract. + example: + participantToken: participantToken + properties: + participantToken: + nullable: false + type: string + type: object + GetPartiesInvolvedEndpointRequest: + description: This method is the request for getting all of the parties involved + upon starting daml. + example: + participantToken: participantToken + properties: + participantToken: + nullable: false + type: string + type: object + QueryIOUEndpointRequest: + description: This method is the request for querying a simple IOU contract. + example: + templateIds: + - templateIds + - templateIds + readers: + - readers + - readers + query: + amount: 0.8008281904610115 + participantToken: participantToken + properties: + participantToken: + nullable: false + type: string + templateIds: + items: + nullable: true + type: string + nullable: false + type: array + query: + $ref: '#/components/schemas/QueryIOUEndpointRequest_query' + readers: + items: + nullable: true + type: string + nullable: false + type: array + type: object + QueryIOUEndpointResponse: + description: This method is the response for querying a simple IOU contract. + example: + completionOffset: completionOffset + events: + - archived: + contractId: contractId + templateId: templateId + - archived: + contractId: contractId + templateId: templateId + properties: + completionOffset: + nullable: false + type: string + events: + items: + $ref: '#/components/schemas/QueryIOUEndpointResponse_events_inner' + nullable: false + type: array + type: object + CreateIOUEndpointRequest: + description: This method is the request for creating a simple IOU contract. + example: + payload: + owner: owner + amount: amount + currency: currency + issuer: issuer + observers: + - observers + - observers + templateId: templateId + participantToken: participantToken + properties: + templateId: + nullable: false + type: string + participantToken: + nullable: false + type: string + payload: + $ref: '#/components/schemas/CreateIOUEndpointRequest_payload' + type: object + CreateIOUEndpointResponse: + description: This method is the response for creating a simple IOU contract. + example: + completionOffset: completionOffset + signatories: + - signatories + - signatories + agreementText: agreementText + payload: + owner: owner + amount: amount + currency: currency + issuer: issuer + observers: + - observers + - observers + contractId: contractId + templateId: templateId + observers: + - observers + - observers + properties: + agreementText: + nullable: false + type: string + completionOffset: + nullable: false + type: string + contractId: + nullable: false + type: string + observers: + items: + nullable: true + type: string + nullable: false + type: array + templateId: + nullable: false + type: string + signatories: + items: + nullable: true + type: string + nullable: false + type: array + payload: + $ref: '#/components/schemas/CreateIOUEndpointRequest_payload' + type: object + ExerciseIOUEndpointRequest: + description: This method is the request for creating a simple IOU contract. + example: + argument: + newOwner: newOwner + contractId: contractId + templateId: templateId + choice: choice + previousParticipantToken: previousParticipantToken + properties: + previousParticipantToken: + nullable: false + type: string + templateId: + nullable: false + type: string + contractId: + nullable: false + type: string + choice: + nullable: false + type: string + argument: + $ref: '#/components/schemas/ExerciseIOUEndpointRequest_argument' + type: object + ExerciseIOUEndpointResponse: + description: This method is the request for creating a simple IOU contract. + example: + completionOffset: completionOffset + events: + - archived: + contractId: contractId + templateId: templateId + - archived: + contractId: contractId + templateId: templateId + properties: + completionOffset: + nullable: false + type: string + events: + items: + $ref: '#/components/schemas/QueryIOUEndpointResponse_events_inner' + nullable: false + type: array + type: object + QueryIOUEndpointRequest_query: + example: + amount: 0.8008281904610115 + nullable: false + properties: + amount: + nullable: false + type: number + type: object + QueryIOUEndpointResponse_events_inner_archived: + example: + contractId: contractId + templateId: templateId + nullable: false + properties: + contractId: + nullable: false + type: string + templateId: + nullable: false + type: string + type: object + QueryIOUEndpointResponse_events_inner: + example: + archived: + contractId: contractId + templateId: templateId + nullable: false + properties: + archived: + $ref: '#/components/schemas/QueryIOUEndpointResponse_events_inner_archived' + type: object + CreateIOUEndpointRequest_payload: + example: + owner: owner + amount: amount + currency: currency + issuer: issuer + observers: + - observers + - observers + properties: + issuer: + nullable: false + type: string + owner: + nullable: false + type: string + currency: + nullable: false + type: string + amount: + nullable: false + type: string + observers: + items: + nullable: true + type: string + nullable: false + type: array + type: object + ExerciseIOUEndpointRequest_argument: + example: + newOwner: newOwner + properties: + newOwner: + nullable: false + type: string + type: object diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/api_default.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/api_default.go new file mode 100644 index 00000000000..0c387e50352 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/api_default.go @@ -0,0 +1,568 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type ApiCreateIouRequest struct { + ctx context.Context + ApiService *DefaultApiService + createIOUEndpointRequest *CreateIOUEndpointRequest +} + +// Request body for creation of iou +func (r ApiCreateIouRequest) CreateIOUEndpointRequest(createIOUEndpointRequest CreateIOUEndpointRequest) ApiCreateIouRequest { + r.createIOUEndpointRequest = &createIOUEndpointRequest + return r +} + +func (r ApiCreateIouRequest) Execute() (*CreateIOUEndpointResponse, *http.Response, error) { + return r.ApiService.CreateIouExecute(r) +} + +/* +CreateIou This method creates a simple iou countract + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateIouRequest +*/ +func (a *DefaultApiService) CreateIou(ctx context.Context) ApiCreateIouRequest { + return ApiCreateIouRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return CreateIOUEndpointResponse +func (a *DefaultApiService) CreateIouExecute(r ApiCreateIouRequest) (*CreateIOUEndpointResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateIOUEndpointResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateIou") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createIOUEndpointRequest == nil { + return localVarReturnValue, nil, reportError("createIOUEndpointRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createIOUEndpointRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiExerciseChoiceRequest struct { + ctx context.Context + ApiService *DefaultApiService + exerciseIOUEndpointRequest *ExerciseIOUEndpointRequest +} + +// Request body for exercising choice(DAML term for function on contracts) of iou +func (r ApiExerciseChoiceRequest) ExerciseIOUEndpointRequest(exerciseIOUEndpointRequest ExerciseIOUEndpointRequest) ApiExerciseChoiceRequest { + r.exerciseIOUEndpointRequest = &exerciseIOUEndpointRequest + return r +} + +func (r ApiExerciseChoiceRequest) Execute() (*ExerciseIOUEndpointResponse, *http.Response, error) { + return r.ApiService.ExerciseChoiceExecute(r) +} + +/* +ExerciseChoice This method exercise choices(DAML term for function on contracts) for iou countract + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiExerciseChoiceRequest +*/ +func (a *DefaultApiService) ExerciseChoice(ctx context.Context) ApiExerciseChoiceRequest { + return ApiExerciseChoiceRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ExerciseIOUEndpointResponse +func (a *DefaultApiService) ExerciseChoiceExecute(r ApiExerciseChoiceRequest) (*ExerciseIOUEndpointResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ExerciseIOUEndpointResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ExerciseChoice") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.exerciseIOUEndpointRequest == nil { + return localVarReturnValue, nil, reportError("exerciseIOUEndpointRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.exerciseIOUEndpointRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetPartiesInvolvedRequest struct { + ctx context.Context + ApiService *DefaultApiService + getPartiesInvolvedEndpointRequest *GetPartiesInvolvedEndpointRequest +} + +// Request body for getting the parties involved in daml instance +func (r ApiGetPartiesInvolvedRequest) GetPartiesInvolvedEndpointRequest(getPartiesInvolvedEndpointRequest GetPartiesInvolvedEndpointRequest) ApiGetPartiesInvolvedRequest { + r.getPartiesInvolvedEndpointRequest = &getPartiesInvolvedEndpointRequest + return r +} + +func (r ApiGetPartiesInvolvedRequest) Execute() (*QueryIOUEndpointResponse, *http.Response, error) { + return r.ApiService.GetPartiesInvolvedExecute(r) +} + +/* +GetPartiesInvolved This method queries all the parties that is included on IOU contract + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetPartiesInvolvedRequest +*/ +func (a *DefaultApiService) GetPartiesInvolved(ctx context.Context) ApiGetPartiesInvolvedRequest { + return ApiGetPartiesInvolvedRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return QueryIOUEndpointResponse +func (a *DefaultApiService) GetPartiesInvolvedExecute(r ApiGetPartiesInvolvedRequest) (*QueryIOUEndpointResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *QueryIOUEndpointResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetPartiesInvolved") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.getPartiesInvolvedEndpointRequest == nil { + return localVarReturnValue, nil, reportError("getPartiesInvolvedEndpointRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.getPartiesInvolvedEndpointRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiQueryContractRequest struct { + ctx context.Context + ApiService *DefaultApiService + queryIOUEndpointRequest *QueryIOUEndpointRequest +} + +// Request body for creation of iou +func (r ApiQueryContractRequest) QueryIOUEndpointRequest(queryIOUEndpointRequest QueryIOUEndpointRequest) ApiQueryContractRequest { + r.queryIOUEndpointRequest = &queryIOUEndpointRequest + return r +} + +func (r ApiQueryContractRequest) Execute() (*QueryIOUEndpointResponse, *http.Response, error) { + return r.ApiService.QueryContractExecute(r) +} + +/* +QueryContract This method queries DAML contracts + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiQueryContractRequest +*/ +func (a *DefaultApiService) QueryContract(ctx context.Context) ApiQueryContractRequest { + return ApiQueryContractRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return QueryIOUEndpointResponse +func (a *DefaultApiService) QueryContractExecute(r ApiQueryContractRequest) (*QueryIOUEndpointResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *QueryIOUEndpointResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.QueryContract") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.queryIOUEndpointRequest == nil { + return localVarReturnValue, nil, reportError("queryIOUEndpointRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.queryIOUEndpointRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiQueryRawContractRequest struct { + ctx context.Context + ApiService *DefaultApiService + queryRawIOUEndpointRequest *QueryRawIOUEndpointRequest +} + +// Request for querying IOU contracts +func (r ApiQueryRawContractRequest) QueryRawIOUEndpointRequest(queryRawIOUEndpointRequest QueryRawIOUEndpointRequest) ApiQueryRawContractRequest { + r.queryRawIOUEndpointRequest = &queryRawIOUEndpointRequest + return r +} + +func (r ApiQueryRawContractRequest) Execute() (*QueryIOUEndpointResponse, *http.Response, error) { + return r.ApiService.QueryRawContractExecute(r) +} + +/* +QueryRawContract This method queries DAML contracts that does not include request body + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiQueryRawContractRequest +*/ +func (a *DefaultApiService) QueryRawContract(ctx context.Context) ApiQueryRawContractRequest { + return ApiQueryRawContractRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return QueryIOUEndpointResponse +func (a *DefaultApiService) QueryRawContractExecute(r ApiQueryRawContractRequest) (*QueryIOUEndpointResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *QueryIOUEndpointResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.QueryRawContract") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.queryRawIOUEndpointRequest == nil { + return localVarReturnValue, nil, reportError("queryRawIOUEndpointRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.queryRawIOUEndpointRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/client.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/client.go new file mode 100644 index 00000000000..0a8056e6cda --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/client.go @@ -0,0 +1,656 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) +) + +// APIClient manages communication with the Hyperledger Cacti Plugin - Connector DAML API v2.0.0-rc.3 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultApi *DefaultApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultApi = (*DefaultApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString( obj interface{}, key string ) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param,ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap,err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t,ok := obj.(MappedNullable); ok { + dataMap,err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i:=0;i 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/configuration.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/configuration.go new file mode 100644 index 00000000000..cf5d274bf01 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/configuration.go @@ -0,0 +1,215 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{ + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/go.mod b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/go.mod new file mode 100644 index 00000000000..8e6815e7aa2 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/go.mod @@ -0,0 +1,6 @@ +module github.com/hyperledger/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client + +go 1.18 + +require ( +) diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/go.sum b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/go.sum new file mode 100644 index 00000000000..c966c8ddfd0 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/go.sum @@ -0,0 +1,11 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_request.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_request.go new file mode 100644 index 00000000000..339f56d126e --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_request.go @@ -0,0 +1,198 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the CreateIOUEndpointRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateIOUEndpointRequest{} + +// CreateIOUEndpointRequest This method is the request for creating a simple IOU contract. +type CreateIOUEndpointRequest struct { + TemplateId *string `json:"templateId,omitempty"` + ParticipantToken *string `json:"participantToken,omitempty"` + Payload *CreateIOUEndpointRequestPayload `json:"payload,omitempty"` +} + +// NewCreateIOUEndpointRequest instantiates a new CreateIOUEndpointRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateIOUEndpointRequest() *CreateIOUEndpointRequest { + this := CreateIOUEndpointRequest{} + return &this +} + +// NewCreateIOUEndpointRequestWithDefaults instantiates a new CreateIOUEndpointRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateIOUEndpointRequestWithDefaults() *CreateIOUEndpointRequest { + this := CreateIOUEndpointRequest{} + return &this +} + +// GetTemplateId returns the TemplateId field value if set, zero value otherwise. +func (o *CreateIOUEndpointRequest) GetTemplateId() string { + if o == nil || IsNil(o.TemplateId) { + var ret string + return ret + } + return *o.TemplateId +} + +// GetTemplateIdOk returns a tuple with the TemplateId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointRequest) GetTemplateIdOk() (*string, bool) { + if o == nil || IsNil(o.TemplateId) { + return nil, false + } + return o.TemplateId, true +} + +// HasTemplateId returns a boolean if a field has been set. +func (o *CreateIOUEndpointRequest) HasTemplateId() bool { + if o != nil && !IsNil(o.TemplateId) { + return true + } + + return false +} + +// SetTemplateId gets a reference to the given string and assigns it to the TemplateId field. +func (o *CreateIOUEndpointRequest) SetTemplateId(v string) { + o.TemplateId = &v +} + +// GetParticipantToken returns the ParticipantToken field value if set, zero value otherwise. +func (o *CreateIOUEndpointRequest) GetParticipantToken() string { + if o == nil || IsNil(o.ParticipantToken) { + var ret string + return ret + } + return *o.ParticipantToken +} + +// GetParticipantTokenOk returns a tuple with the ParticipantToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointRequest) GetParticipantTokenOk() (*string, bool) { + if o == nil || IsNil(o.ParticipantToken) { + return nil, false + } + return o.ParticipantToken, true +} + +// HasParticipantToken returns a boolean if a field has been set. +func (o *CreateIOUEndpointRequest) HasParticipantToken() bool { + if o != nil && !IsNil(o.ParticipantToken) { + return true + } + + return false +} + +// SetParticipantToken gets a reference to the given string and assigns it to the ParticipantToken field. +func (o *CreateIOUEndpointRequest) SetParticipantToken(v string) { + o.ParticipantToken = &v +} + +// GetPayload returns the Payload field value if set, zero value otherwise. +func (o *CreateIOUEndpointRequest) GetPayload() CreateIOUEndpointRequestPayload { + if o == nil || IsNil(o.Payload) { + var ret CreateIOUEndpointRequestPayload + return ret + } + return *o.Payload +} + +// GetPayloadOk returns a tuple with the Payload field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointRequest) GetPayloadOk() (*CreateIOUEndpointRequestPayload, bool) { + if o == nil || IsNil(o.Payload) { + return nil, false + } + return o.Payload, true +} + +// HasPayload returns a boolean if a field has been set. +func (o *CreateIOUEndpointRequest) HasPayload() bool { + if o != nil && !IsNil(o.Payload) { + return true + } + + return false +} + +// SetPayload gets a reference to the given CreateIOUEndpointRequestPayload and assigns it to the Payload field. +func (o *CreateIOUEndpointRequest) SetPayload(v CreateIOUEndpointRequestPayload) { + o.Payload = &v +} + +func (o CreateIOUEndpointRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateIOUEndpointRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.TemplateId) { + toSerialize["templateId"] = o.TemplateId + } + if !IsNil(o.ParticipantToken) { + toSerialize["participantToken"] = o.ParticipantToken + } + if !IsNil(o.Payload) { + toSerialize["payload"] = o.Payload + } + return toSerialize, nil +} + +type NullableCreateIOUEndpointRequest struct { + value *CreateIOUEndpointRequest + isSet bool +} + +func (v NullableCreateIOUEndpointRequest) Get() *CreateIOUEndpointRequest { + return v.value +} + +func (v *NullableCreateIOUEndpointRequest) Set(val *CreateIOUEndpointRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateIOUEndpointRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateIOUEndpointRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateIOUEndpointRequest(val *CreateIOUEndpointRequest) *NullableCreateIOUEndpointRequest { + return &NullableCreateIOUEndpointRequest{value: val, isSet: true} +} + +func (v NullableCreateIOUEndpointRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateIOUEndpointRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_request_payload.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_request_payload.go new file mode 100644 index 00000000000..69b43b1f083 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_request_payload.go @@ -0,0 +1,270 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the CreateIOUEndpointRequestPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateIOUEndpointRequestPayload{} + +// CreateIOUEndpointRequestPayload struct for CreateIOUEndpointRequestPayload +type CreateIOUEndpointRequestPayload struct { + Issuer *string `json:"issuer,omitempty"` + Owner *string `json:"owner,omitempty"` + Currency *string `json:"currency,omitempty"` + Amount *string `json:"amount,omitempty"` + Observers []*string `json:"observers,omitempty"` +} + +// NewCreateIOUEndpointRequestPayload instantiates a new CreateIOUEndpointRequestPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateIOUEndpointRequestPayload() *CreateIOUEndpointRequestPayload { + this := CreateIOUEndpointRequestPayload{} + return &this +} + +// NewCreateIOUEndpointRequestPayloadWithDefaults instantiates a new CreateIOUEndpointRequestPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateIOUEndpointRequestPayloadWithDefaults() *CreateIOUEndpointRequestPayload { + this := CreateIOUEndpointRequestPayload{} + return &this +} + +// GetIssuer returns the Issuer field value if set, zero value otherwise. +func (o *CreateIOUEndpointRequestPayload) GetIssuer() string { + if o == nil || IsNil(o.Issuer) { + var ret string + return ret + } + return *o.Issuer +} + +// GetIssuerOk returns a tuple with the Issuer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointRequestPayload) GetIssuerOk() (*string, bool) { + if o == nil || IsNil(o.Issuer) { + return nil, false + } + return o.Issuer, true +} + +// HasIssuer returns a boolean if a field has been set. +func (o *CreateIOUEndpointRequestPayload) HasIssuer() bool { + if o != nil && !IsNil(o.Issuer) { + return true + } + + return false +} + +// SetIssuer gets a reference to the given string and assigns it to the Issuer field. +func (o *CreateIOUEndpointRequestPayload) SetIssuer(v string) { + o.Issuer = &v +} + +// GetOwner returns the Owner field value if set, zero value otherwise. +func (o *CreateIOUEndpointRequestPayload) GetOwner() string { + if o == nil || IsNil(o.Owner) { + var ret string + return ret + } + return *o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointRequestPayload) GetOwnerOk() (*string, bool) { + if o == nil || IsNil(o.Owner) { + return nil, false + } + return o.Owner, true +} + +// HasOwner returns a boolean if a field has been set. +func (o *CreateIOUEndpointRequestPayload) HasOwner() bool { + if o != nil && !IsNil(o.Owner) { + return true + } + + return false +} + +// SetOwner gets a reference to the given string and assigns it to the Owner field. +func (o *CreateIOUEndpointRequestPayload) SetOwner(v string) { + o.Owner = &v +} + +// GetCurrency returns the Currency field value if set, zero value otherwise. +func (o *CreateIOUEndpointRequestPayload) GetCurrency() string { + if o == nil || IsNil(o.Currency) { + var ret string + return ret + } + return *o.Currency +} + +// GetCurrencyOk returns a tuple with the Currency field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointRequestPayload) GetCurrencyOk() (*string, bool) { + if o == nil || IsNil(o.Currency) { + return nil, false + } + return o.Currency, true +} + +// HasCurrency returns a boolean if a field has been set. +func (o *CreateIOUEndpointRequestPayload) HasCurrency() bool { + if o != nil && !IsNil(o.Currency) { + return true + } + + return false +} + +// SetCurrency gets a reference to the given string and assigns it to the Currency field. +func (o *CreateIOUEndpointRequestPayload) SetCurrency(v string) { + o.Currency = &v +} + +// GetAmount returns the Amount field value if set, zero value otherwise. +func (o *CreateIOUEndpointRequestPayload) GetAmount() string { + if o == nil || IsNil(o.Amount) { + var ret string + return ret + } + return *o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointRequestPayload) GetAmountOk() (*string, bool) { + if o == nil || IsNil(o.Amount) { + return nil, false + } + return o.Amount, true +} + +// HasAmount returns a boolean if a field has been set. +func (o *CreateIOUEndpointRequestPayload) HasAmount() bool { + if o != nil && !IsNil(o.Amount) { + return true + } + + return false +} + +// SetAmount gets a reference to the given string and assigns it to the Amount field. +func (o *CreateIOUEndpointRequestPayload) SetAmount(v string) { + o.Amount = &v +} + +// GetObservers returns the Observers field value if set, zero value otherwise. +func (o *CreateIOUEndpointRequestPayload) GetObservers() []*string { + if o == nil || IsNil(o.Observers) { + var ret []*string + return ret + } + return o.Observers +} + +// GetObserversOk returns a tuple with the Observers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointRequestPayload) GetObserversOk() ([]*string, bool) { + if o == nil || IsNil(o.Observers) { + return nil, false + } + return o.Observers, true +} + +// HasObservers returns a boolean if a field has been set. +func (o *CreateIOUEndpointRequestPayload) HasObservers() bool { + if o != nil && !IsNil(o.Observers) { + return true + } + + return false +} + +// SetObservers gets a reference to the given []*string and assigns it to the Observers field. +func (o *CreateIOUEndpointRequestPayload) SetObservers(v []*string) { + o.Observers = v +} + +func (o CreateIOUEndpointRequestPayload) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateIOUEndpointRequestPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Issuer) { + toSerialize["issuer"] = o.Issuer + } + if !IsNil(o.Owner) { + toSerialize["owner"] = o.Owner + } + if !IsNil(o.Currency) { + toSerialize["currency"] = o.Currency + } + if !IsNil(o.Amount) { + toSerialize["amount"] = o.Amount + } + if !IsNil(o.Observers) { + toSerialize["observers"] = o.Observers + } + return toSerialize, nil +} + +type NullableCreateIOUEndpointRequestPayload struct { + value *CreateIOUEndpointRequestPayload + isSet bool +} + +func (v NullableCreateIOUEndpointRequestPayload) Get() *CreateIOUEndpointRequestPayload { + return v.value +} + +func (v *NullableCreateIOUEndpointRequestPayload) Set(val *CreateIOUEndpointRequestPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateIOUEndpointRequestPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateIOUEndpointRequestPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateIOUEndpointRequestPayload(val *CreateIOUEndpointRequestPayload) *NullableCreateIOUEndpointRequestPayload { + return &NullableCreateIOUEndpointRequestPayload{value: val, isSet: true} +} + +func (v NullableCreateIOUEndpointRequestPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateIOUEndpointRequestPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_response.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_response.go new file mode 100644 index 00000000000..9e772f24677 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_response.go @@ -0,0 +1,342 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the CreateIOUEndpointResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateIOUEndpointResponse{} + +// CreateIOUEndpointResponse This method is the response for creating a simple IOU contract. +type CreateIOUEndpointResponse struct { + AgreementText *string `json:"agreementText,omitempty"` + CompletionOffset *string `json:"completionOffset,omitempty"` + ContractId *string `json:"contractId,omitempty"` + Observers []*string `json:"observers,omitempty"` + TemplateId *string `json:"templateId,omitempty"` + Signatories []*string `json:"signatories,omitempty"` + Payload *CreateIOUEndpointRequestPayload `json:"payload,omitempty"` +} + +// NewCreateIOUEndpointResponse instantiates a new CreateIOUEndpointResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateIOUEndpointResponse() *CreateIOUEndpointResponse { + this := CreateIOUEndpointResponse{} + return &this +} + +// NewCreateIOUEndpointResponseWithDefaults instantiates a new CreateIOUEndpointResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateIOUEndpointResponseWithDefaults() *CreateIOUEndpointResponse { + this := CreateIOUEndpointResponse{} + return &this +} + +// GetAgreementText returns the AgreementText field value if set, zero value otherwise. +func (o *CreateIOUEndpointResponse) GetAgreementText() string { + if o == nil || IsNil(o.AgreementText) { + var ret string + return ret + } + return *o.AgreementText +} + +// GetAgreementTextOk returns a tuple with the AgreementText field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointResponse) GetAgreementTextOk() (*string, bool) { + if o == nil || IsNil(o.AgreementText) { + return nil, false + } + return o.AgreementText, true +} + +// HasAgreementText returns a boolean if a field has been set. +func (o *CreateIOUEndpointResponse) HasAgreementText() bool { + if o != nil && !IsNil(o.AgreementText) { + return true + } + + return false +} + +// SetAgreementText gets a reference to the given string and assigns it to the AgreementText field. +func (o *CreateIOUEndpointResponse) SetAgreementText(v string) { + o.AgreementText = &v +} + +// GetCompletionOffset returns the CompletionOffset field value if set, zero value otherwise. +func (o *CreateIOUEndpointResponse) GetCompletionOffset() string { + if o == nil || IsNil(o.CompletionOffset) { + var ret string + return ret + } + return *o.CompletionOffset +} + +// GetCompletionOffsetOk returns a tuple with the CompletionOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointResponse) GetCompletionOffsetOk() (*string, bool) { + if o == nil || IsNil(o.CompletionOffset) { + return nil, false + } + return o.CompletionOffset, true +} + +// HasCompletionOffset returns a boolean if a field has been set. +func (o *CreateIOUEndpointResponse) HasCompletionOffset() bool { + if o != nil && !IsNil(o.CompletionOffset) { + return true + } + + return false +} + +// SetCompletionOffset gets a reference to the given string and assigns it to the CompletionOffset field. +func (o *CreateIOUEndpointResponse) SetCompletionOffset(v string) { + o.CompletionOffset = &v +} + +// GetContractId returns the ContractId field value if set, zero value otherwise. +func (o *CreateIOUEndpointResponse) GetContractId() string { + if o == nil || IsNil(o.ContractId) { + var ret string + return ret + } + return *o.ContractId +} + +// GetContractIdOk returns a tuple with the ContractId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointResponse) GetContractIdOk() (*string, bool) { + if o == nil || IsNil(o.ContractId) { + return nil, false + } + return o.ContractId, true +} + +// HasContractId returns a boolean if a field has been set. +func (o *CreateIOUEndpointResponse) HasContractId() bool { + if o != nil && !IsNil(o.ContractId) { + return true + } + + return false +} + +// SetContractId gets a reference to the given string and assigns it to the ContractId field. +func (o *CreateIOUEndpointResponse) SetContractId(v string) { + o.ContractId = &v +} + +// GetObservers returns the Observers field value if set, zero value otherwise. +func (o *CreateIOUEndpointResponse) GetObservers() []*string { + if o == nil || IsNil(o.Observers) { + var ret []*string + return ret + } + return o.Observers +} + +// GetObserversOk returns a tuple with the Observers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointResponse) GetObserversOk() ([]*string, bool) { + if o == nil || IsNil(o.Observers) { + return nil, false + } + return o.Observers, true +} + +// HasObservers returns a boolean if a field has been set. +func (o *CreateIOUEndpointResponse) HasObservers() bool { + if o != nil && !IsNil(o.Observers) { + return true + } + + return false +} + +// SetObservers gets a reference to the given []*string and assigns it to the Observers field. +func (o *CreateIOUEndpointResponse) SetObservers(v []*string) { + o.Observers = v +} + +// GetTemplateId returns the TemplateId field value if set, zero value otherwise. +func (o *CreateIOUEndpointResponse) GetTemplateId() string { + if o == nil || IsNil(o.TemplateId) { + var ret string + return ret + } + return *o.TemplateId +} + +// GetTemplateIdOk returns a tuple with the TemplateId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointResponse) GetTemplateIdOk() (*string, bool) { + if o == nil || IsNil(o.TemplateId) { + return nil, false + } + return o.TemplateId, true +} + +// HasTemplateId returns a boolean if a field has been set. +func (o *CreateIOUEndpointResponse) HasTemplateId() bool { + if o != nil && !IsNil(o.TemplateId) { + return true + } + + return false +} + +// SetTemplateId gets a reference to the given string and assigns it to the TemplateId field. +func (o *CreateIOUEndpointResponse) SetTemplateId(v string) { + o.TemplateId = &v +} + +// GetSignatories returns the Signatories field value if set, zero value otherwise. +func (o *CreateIOUEndpointResponse) GetSignatories() []*string { + if o == nil || IsNil(o.Signatories) { + var ret []*string + return ret + } + return o.Signatories +} + +// GetSignatoriesOk returns a tuple with the Signatories field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointResponse) GetSignatoriesOk() ([]*string, bool) { + if o == nil || IsNil(o.Signatories) { + return nil, false + } + return o.Signatories, true +} + +// HasSignatories returns a boolean if a field has been set. +func (o *CreateIOUEndpointResponse) HasSignatories() bool { + if o != nil && !IsNil(o.Signatories) { + return true + } + + return false +} + +// SetSignatories gets a reference to the given []*string and assigns it to the Signatories field. +func (o *CreateIOUEndpointResponse) SetSignatories(v []*string) { + o.Signatories = v +} + +// GetPayload returns the Payload field value if set, zero value otherwise. +func (o *CreateIOUEndpointResponse) GetPayload() CreateIOUEndpointRequestPayload { + if o == nil || IsNil(o.Payload) { + var ret CreateIOUEndpointRequestPayload + return ret + } + return *o.Payload +} + +// GetPayloadOk returns a tuple with the Payload field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointResponse) GetPayloadOk() (*CreateIOUEndpointRequestPayload, bool) { + if o == nil || IsNil(o.Payload) { + return nil, false + } + return o.Payload, true +} + +// HasPayload returns a boolean if a field has been set. +func (o *CreateIOUEndpointResponse) HasPayload() bool { + if o != nil && !IsNil(o.Payload) { + return true + } + + return false +} + +// SetPayload gets a reference to the given CreateIOUEndpointRequestPayload and assigns it to the Payload field. +func (o *CreateIOUEndpointResponse) SetPayload(v CreateIOUEndpointRequestPayload) { + o.Payload = &v +} + +func (o CreateIOUEndpointResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateIOUEndpointResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AgreementText) { + toSerialize["agreementText"] = o.AgreementText + } + if !IsNil(o.CompletionOffset) { + toSerialize["completionOffset"] = o.CompletionOffset + } + if !IsNil(o.ContractId) { + toSerialize["contractId"] = o.ContractId + } + if !IsNil(o.Observers) { + toSerialize["observers"] = o.Observers + } + if !IsNil(o.TemplateId) { + toSerialize["templateId"] = o.TemplateId + } + if !IsNil(o.Signatories) { + toSerialize["signatories"] = o.Signatories + } + if !IsNil(o.Payload) { + toSerialize["payload"] = o.Payload + } + return toSerialize, nil +} + +type NullableCreateIOUEndpointResponse struct { + value *CreateIOUEndpointResponse + isSet bool +} + +func (v NullableCreateIOUEndpointResponse) Get() *CreateIOUEndpointResponse { + return v.value +} + +func (v *NullableCreateIOUEndpointResponse) Set(val *CreateIOUEndpointResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateIOUEndpointResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateIOUEndpointResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateIOUEndpointResponse(val *CreateIOUEndpointResponse) *NullableCreateIOUEndpointResponse { + return &NullableCreateIOUEndpointResponse{value: val, isSet: true} +} + +func (v NullableCreateIOUEndpointResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateIOUEndpointResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_response_payload.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_response_payload.go new file mode 100644 index 00000000000..659b22464b7 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_create_iou_endpoint_response_payload.go @@ -0,0 +1,270 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the CreateIOUEndpointResponsePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateIOUEndpointResponsePayload{} + +// CreateIOUEndpointResponsePayload struct for CreateIOUEndpointResponsePayload +type CreateIOUEndpointResponsePayload struct { + Issuer *string `json:"issuer,omitempty"` + Owner *string `json:"owner,omitempty"` + Currency *string `json:"currency,omitempty"` + Amount *string `json:"amount,omitempty"` + Observers []*string `json:"observers,omitempty"` +} + +// NewCreateIOUEndpointResponsePayload instantiates a new CreateIOUEndpointResponsePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateIOUEndpointResponsePayload() *CreateIOUEndpointResponsePayload { + this := CreateIOUEndpointResponsePayload{} + return &this +} + +// NewCreateIOUEndpointResponsePayloadWithDefaults instantiates a new CreateIOUEndpointResponsePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateIOUEndpointResponsePayloadWithDefaults() *CreateIOUEndpointResponsePayload { + this := CreateIOUEndpointResponsePayload{} + return &this +} + +// GetIssuer returns the Issuer field value if set, zero value otherwise. +func (o *CreateIOUEndpointResponsePayload) GetIssuer() string { + if o == nil || IsNil(o.Issuer) { + var ret string + return ret + } + return *o.Issuer +} + +// GetIssuerOk returns a tuple with the Issuer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointResponsePayload) GetIssuerOk() (*string, bool) { + if o == nil || IsNil(o.Issuer) { + return nil, false + } + return o.Issuer, true +} + +// HasIssuer returns a boolean if a field has been set. +func (o *CreateIOUEndpointResponsePayload) HasIssuer() bool { + if o != nil && !IsNil(o.Issuer) { + return true + } + + return false +} + +// SetIssuer gets a reference to the given string and assigns it to the Issuer field. +func (o *CreateIOUEndpointResponsePayload) SetIssuer(v string) { + o.Issuer = &v +} + +// GetOwner returns the Owner field value if set, zero value otherwise. +func (o *CreateIOUEndpointResponsePayload) GetOwner() string { + if o == nil || IsNil(o.Owner) { + var ret string + return ret + } + return *o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointResponsePayload) GetOwnerOk() (*string, bool) { + if o == nil || IsNil(o.Owner) { + return nil, false + } + return o.Owner, true +} + +// HasOwner returns a boolean if a field has been set. +func (o *CreateIOUEndpointResponsePayload) HasOwner() bool { + if o != nil && !IsNil(o.Owner) { + return true + } + + return false +} + +// SetOwner gets a reference to the given string and assigns it to the Owner field. +func (o *CreateIOUEndpointResponsePayload) SetOwner(v string) { + o.Owner = &v +} + +// GetCurrency returns the Currency field value if set, zero value otherwise. +func (o *CreateIOUEndpointResponsePayload) GetCurrency() string { + if o == nil || IsNil(o.Currency) { + var ret string + return ret + } + return *o.Currency +} + +// GetCurrencyOk returns a tuple with the Currency field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointResponsePayload) GetCurrencyOk() (*string, bool) { + if o == nil || IsNil(o.Currency) { + return nil, false + } + return o.Currency, true +} + +// HasCurrency returns a boolean if a field has been set. +func (o *CreateIOUEndpointResponsePayload) HasCurrency() bool { + if o != nil && !IsNil(o.Currency) { + return true + } + + return false +} + +// SetCurrency gets a reference to the given string and assigns it to the Currency field. +func (o *CreateIOUEndpointResponsePayload) SetCurrency(v string) { + o.Currency = &v +} + +// GetAmount returns the Amount field value if set, zero value otherwise. +func (o *CreateIOUEndpointResponsePayload) GetAmount() string { + if o == nil || IsNil(o.Amount) { + var ret string + return ret + } + return *o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointResponsePayload) GetAmountOk() (*string, bool) { + if o == nil || IsNil(o.Amount) { + return nil, false + } + return o.Amount, true +} + +// HasAmount returns a boolean if a field has been set. +func (o *CreateIOUEndpointResponsePayload) HasAmount() bool { + if o != nil && !IsNil(o.Amount) { + return true + } + + return false +} + +// SetAmount gets a reference to the given string and assigns it to the Amount field. +func (o *CreateIOUEndpointResponsePayload) SetAmount(v string) { + o.Amount = &v +} + +// GetObservers returns the Observers field value if set, zero value otherwise. +func (o *CreateIOUEndpointResponsePayload) GetObservers() []*string { + if o == nil || IsNil(o.Observers) { + var ret []*string + return ret + } + return o.Observers +} + +// GetObserversOk returns a tuple with the Observers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIOUEndpointResponsePayload) GetObserversOk() ([]*string, bool) { + if o == nil || IsNil(o.Observers) { + return nil, false + } + return o.Observers, true +} + +// HasObservers returns a boolean if a field has been set. +func (o *CreateIOUEndpointResponsePayload) HasObservers() bool { + if o != nil && !IsNil(o.Observers) { + return true + } + + return false +} + +// SetObservers gets a reference to the given []*string and assigns it to the Observers field. +func (o *CreateIOUEndpointResponsePayload) SetObservers(v []*string) { + o.Observers = v +} + +func (o CreateIOUEndpointResponsePayload) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateIOUEndpointResponsePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Issuer) { + toSerialize["issuer"] = o.Issuer + } + if !IsNil(o.Owner) { + toSerialize["owner"] = o.Owner + } + if !IsNil(o.Currency) { + toSerialize["currency"] = o.Currency + } + if !IsNil(o.Amount) { + toSerialize["amount"] = o.Amount + } + if !IsNil(o.Observers) { + toSerialize["observers"] = o.Observers + } + return toSerialize, nil +} + +type NullableCreateIOUEndpointResponsePayload struct { + value *CreateIOUEndpointResponsePayload + isSet bool +} + +func (v NullableCreateIOUEndpointResponsePayload) Get() *CreateIOUEndpointResponsePayload { + return v.value +} + +func (v *NullableCreateIOUEndpointResponsePayload) Set(val *CreateIOUEndpointResponsePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateIOUEndpointResponsePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateIOUEndpointResponsePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateIOUEndpointResponsePayload(val *CreateIOUEndpointResponsePayload) *NullableCreateIOUEndpointResponsePayload { + return &NullableCreateIOUEndpointResponsePayload{value: val, isSet: true} +} + +func (v NullableCreateIOUEndpointResponsePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateIOUEndpointResponsePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_request.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_request.go new file mode 100644 index 00000000000..bbbe93f85d5 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_request.go @@ -0,0 +1,270 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the ExerciseIOUEndpointRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ExerciseIOUEndpointRequest{} + +// ExerciseIOUEndpointRequest This method is the request for creating a simple IOU contract. +type ExerciseIOUEndpointRequest struct { + PreviousParticipantToken *string `json:"previousParticipantToken,omitempty"` + TemplateId *string `json:"templateId,omitempty"` + ContractId *string `json:"contractId,omitempty"` + Choice *string `json:"choice,omitempty"` + Argument *ExerciseIOUEndpointRequestArgument `json:"argument,omitempty"` +} + +// NewExerciseIOUEndpointRequest instantiates a new ExerciseIOUEndpointRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewExerciseIOUEndpointRequest() *ExerciseIOUEndpointRequest { + this := ExerciseIOUEndpointRequest{} + return &this +} + +// NewExerciseIOUEndpointRequestWithDefaults instantiates a new ExerciseIOUEndpointRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewExerciseIOUEndpointRequestWithDefaults() *ExerciseIOUEndpointRequest { + this := ExerciseIOUEndpointRequest{} + return &this +} + +// GetPreviousParticipantToken returns the PreviousParticipantToken field value if set, zero value otherwise. +func (o *ExerciseIOUEndpointRequest) GetPreviousParticipantToken() string { + if o == nil || IsNil(o.PreviousParticipantToken) { + var ret string + return ret + } + return *o.PreviousParticipantToken +} + +// GetPreviousParticipantTokenOk returns a tuple with the PreviousParticipantToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExerciseIOUEndpointRequest) GetPreviousParticipantTokenOk() (*string, bool) { + if o == nil || IsNil(o.PreviousParticipantToken) { + return nil, false + } + return o.PreviousParticipantToken, true +} + +// HasPreviousParticipantToken returns a boolean if a field has been set. +func (o *ExerciseIOUEndpointRequest) HasPreviousParticipantToken() bool { + if o != nil && !IsNil(o.PreviousParticipantToken) { + return true + } + + return false +} + +// SetPreviousParticipantToken gets a reference to the given string and assigns it to the PreviousParticipantToken field. +func (o *ExerciseIOUEndpointRequest) SetPreviousParticipantToken(v string) { + o.PreviousParticipantToken = &v +} + +// GetTemplateId returns the TemplateId field value if set, zero value otherwise. +func (o *ExerciseIOUEndpointRequest) GetTemplateId() string { + if o == nil || IsNil(o.TemplateId) { + var ret string + return ret + } + return *o.TemplateId +} + +// GetTemplateIdOk returns a tuple with the TemplateId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExerciseIOUEndpointRequest) GetTemplateIdOk() (*string, bool) { + if o == nil || IsNil(o.TemplateId) { + return nil, false + } + return o.TemplateId, true +} + +// HasTemplateId returns a boolean if a field has been set. +func (o *ExerciseIOUEndpointRequest) HasTemplateId() bool { + if o != nil && !IsNil(o.TemplateId) { + return true + } + + return false +} + +// SetTemplateId gets a reference to the given string and assigns it to the TemplateId field. +func (o *ExerciseIOUEndpointRequest) SetTemplateId(v string) { + o.TemplateId = &v +} + +// GetContractId returns the ContractId field value if set, zero value otherwise. +func (o *ExerciseIOUEndpointRequest) GetContractId() string { + if o == nil || IsNil(o.ContractId) { + var ret string + return ret + } + return *o.ContractId +} + +// GetContractIdOk returns a tuple with the ContractId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExerciseIOUEndpointRequest) GetContractIdOk() (*string, bool) { + if o == nil || IsNil(o.ContractId) { + return nil, false + } + return o.ContractId, true +} + +// HasContractId returns a boolean if a field has been set. +func (o *ExerciseIOUEndpointRequest) HasContractId() bool { + if o != nil && !IsNil(o.ContractId) { + return true + } + + return false +} + +// SetContractId gets a reference to the given string and assigns it to the ContractId field. +func (o *ExerciseIOUEndpointRequest) SetContractId(v string) { + o.ContractId = &v +} + +// GetChoice returns the Choice field value if set, zero value otherwise. +func (o *ExerciseIOUEndpointRequest) GetChoice() string { + if o == nil || IsNil(o.Choice) { + var ret string + return ret + } + return *o.Choice +} + +// GetChoiceOk returns a tuple with the Choice field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExerciseIOUEndpointRequest) GetChoiceOk() (*string, bool) { + if o == nil || IsNil(o.Choice) { + return nil, false + } + return o.Choice, true +} + +// HasChoice returns a boolean if a field has been set. +func (o *ExerciseIOUEndpointRequest) HasChoice() bool { + if o != nil && !IsNil(o.Choice) { + return true + } + + return false +} + +// SetChoice gets a reference to the given string and assigns it to the Choice field. +func (o *ExerciseIOUEndpointRequest) SetChoice(v string) { + o.Choice = &v +} + +// GetArgument returns the Argument field value if set, zero value otherwise. +func (o *ExerciseIOUEndpointRequest) GetArgument() ExerciseIOUEndpointRequestArgument { + if o == nil || IsNil(o.Argument) { + var ret ExerciseIOUEndpointRequestArgument + return ret + } + return *o.Argument +} + +// GetArgumentOk returns a tuple with the Argument field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExerciseIOUEndpointRequest) GetArgumentOk() (*ExerciseIOUEndpointRequestArgument, bool) { + if o == nil || IsNil(o.Argument) { + return nil, false + } + return o.Argument, true +} + +// HasArgument returns a boolean if a field has been set. +func (o *ExerciseIOUEndpointRequest) HasArgument() bool { + if o != nil && !IsNil(o.Argument) { + return true + } + + return false +} + +// SetArgument gets a reference to the given ExerciseIOUEndpointRequestArgument and assigns it to the Argument field. +func (o *ExerciseIOUEndpointRequest) SetArgument(v ExerciseIOUEndpointRequestArgument) { + o.Argument = &v +} + +func (o ExerciseIOUEndpointRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ExerciseIOUEndpointRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.PreviousParticipantToken) { + toSerialize["previousParticipantToken"] = o.PreviousParticipantToken + } + if !IsNil(o.TemplateId) { + toSerialize["templateId"] = o.TemplateId + } + if !IsNil(o.ContractId) { + toSerialize["contractId"] = o.ContractId + } + if !IsNil(o.Choice) { + toSerialize["choice"] = o.Choice + } + if !IsNil(o.Argument) { + toSerialize["argument"] = o.Argument + } + return toSerialize, nil +} + +type NullableExerciseIOUEndpointRequest struct { + value *ExerciseIOUEndpointRequest + isSet bool +} + +func (v NullableExerciseIOUEndpointRequest) Get() *ExerciseIOUEndpointRequest { + return v.value +} + +func (v *NullableExerciseIOUEndpointRequest) Set(val *ExerciseIOUEndpointRequest) { + v.value = val + v.isSet = true +} + +func (v NullableExerciseIOUEndpointRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableExerciseIOUEndpointRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExerciseIOUEndpointRequest(val *ExerciseIOUEndpointRequest) *NullableExerciseIOUEndpointRequest { + return &NullableExerciseIOUEndpointRequest{value: val, isSet: true} +} + +func (v NullableExerciseIOUEndpointRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExerciseIOUEndpointRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_request_argument.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_request_argument.go new file mode 100644 index 00000000000..99f04f6aef1 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_request_argument.go @@ -0,0 +1,126 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the ExerciseIOUEndpointRequestArgument type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ExerciseIOUEndpointRequestArgument{} + +// ExerciseIOUEndpointRequestArgument struct for ExerciseIOUEndpointRequestArgument +type ExerciseIOUEndpointRequestArgument struct { + NewOwner *string `json:"newOwner,omitempty"` +} + +// NewExerciseIOUEndpointRequestArgument instantiates a new ExerciseIOUEndpointRequestArgument object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewExerciseIOUEndpointRequestArgument() *ExerciseIOUEndpointRequestArgument { + this := ExerciseIOUEndpointRequestArgument{} + return &this +} + +// NewExerciseIOUEndpointRequestArgumentWithDefaults instantiates a new ExerciseIOUEndpointRequestArgument object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewExerciseIOUEndpointRequestArgumentWithDefaults() *ExerciseIOUEndpointRequestArgument { + this := ExerciseIOUEndpointRequestArgument{} + return &this +} + +// GetNewOwner returns the NewOwner field value if set, zero value otherwise. +func (o *ExerciseIOUEndpointRequestArgument) GetNewOwner() string { + if o == nil || IsNil(o.NewOwner) { + var ret string + return ret + } + return *o.NewOwner +} + +// GetNewOwnerOk returns a tuple with the NewOwner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExerciseIOUEndpointRequestArgument) GetNewOwnerOk() (*string, bool) { + if o == nil || IsNil(o.NewOwner) { + return nil, false + } + return o.NewOwner, true +} + +// HasNewOwner returns a boolean if a field has been set. +func (o *ExerciseIOUEndpointRequestArgument) HasNewOwner() bool { + if o != nil && !IsNil(o.NewOwner) { + return true + } + + return false +} + +// SetNewOwner gets a reference to the given string and assigns it to the NewOwner field. +func (o *ExerciseIOUEndpointRequestArgument) SetNewOwner(v string) { + o.NewOwner = &v +} + +func (o ExerciseIOUEndpointRequestArgument) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ExerciseIOUEndpointRequestArgument) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.NewOwner) { + toSerialize["newOwner"] = o.NewOwner + } + return toSerialize, nil +} + +type NullableExerciseIOUEndpointRequestArgument struct { + value *ExerciseIOUEndpointRequestArgument + isSet bool +} + +func (v NullableExerciseIOUEndpointRequestArgument) Get() *ExerciseIOUEndpointRequestArgument { + return v.value +} + +func (v *NullableExerciseIOUEndpointRequestArgument) Set(val *ExerciseIOUEndpointRequestArgument) { + v.value = val + v.isSet = true +} + +func (v NullableExerciseIOUEndpointRequestArgument) IsSet() bool { + return v.isSet +} + +func (v *NullableExerciseIOUEndpointRequestArgument) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExerciseIOUEndpointRequestArgument(val *ExerciseIOUEndpointRequestArgument) *NullableExerciseIOUEndpointRequestArgument { + return &NullableExerciseIOUEndpointRequestArgument{value: val, isSet: true} +} + +func (v NullableExerciseIOUEndpointRequestArgument) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExerciseIOUEndpointRequestArgument) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_response.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_response.go new file mode 100644 index 00000000000..bd4454b3d31 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_response.go @@ -0,0 +1,162 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the ExerciseIOUEndpointResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ExerciseIOUEndpointResponse{} + +// ExerciseIOUEndpointResponse This method is the request for creating a simple IOU contract. +type ExerciseIOUEndpointResponse struct { + CompletionOffset *string `json:"completionOffset,omitempty"` + Events []QueryIOUEndpointResponseEventsInner `json:"events,omitempty"` +} + +// NewExerciseIOUEndpointResponse instantiates a new ExerciseIOUEndpointResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewExerciseIOUEndpointResponse() *ExerciseIOUEndpointResponse { + this := ExerciseIOUEndpointResponse{} + return &this +} + +// NewExerciseIOUEndpointResponseWithDefaults instantiates a new ExerciseIOUEndpointResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewExerciseIOUEndpointResponseWithDefaults() *ExerciseIOUEndpointResponse { + this := ExerciseIOUEndpointResponse{} + return &this +} + +// GetCompletionOffset returns the CompletionOffset field value if set, zero value otherwise. +func (o *ExerciseIOUEndpointResponse) GetCompletionOffset() string { + if o == nil || IsNil(o.CompletionOffset) { + var ret string + return ret + } + return *o.CompletionOffset +} + +// GetCompletionOffsetOk returns a tuple with the CompletionOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExerciseIOUEndpointResponse) GetCompletionOffsetOk() (*string, bool) { + if o == nil || IsNil(o.CompletionOffset) { + return nil, false + } + return o.CompletionOffset, true +} + +// HasCompletionOffset returns a boolean if a field has been set. +func (o *ExerciseIOUEndpointResponse) HasCompletionOffset() bool { + if o != nil && !IsNil(o.CompletionOffset) { + return true + } + + return false +} + +// SetCompletionOffset gets a reference to the given string and assigns it to the CompletionOffset field. +func (o *ExerciseIOUEndpointResponse) SetCompletionOffset(v string) { + o.CompletionOffset = &v +} + +// GetEvents returns the Events field value if set, zero value otherwise. +func (o *ExerciseIOUEndpointResponse) GetEvents() []QueryIOUEndpointResponseEventsInner { + if o == nil || IsNil(o.Events) { + var ret []QueryIOUEndpointResponseEventsInner + return ret + } + return o.Events +} + +// GetEventsOk returns a tuple with the Events field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExerciseIOUEndpointResponse) GetEventsOk() ([]QueryIOUEndpointResponseEventsInner, bool) { + if o == nil || IsNil(o.Events) { + return nil, false + } + return o.Events, true +} + +// HasEvents returns a boolean if a field has been set. +func (o *ExerciseIOUEndpointResponse) HasEvents() bool { + if o != nil && !IsNil(o.Events) { + return true + } + + return false +} + +// SetEvents gets a reference to the given []QueryIOUEndpointResponseEventsInner and assigns it to the Events field. +func (o *ExerciseIOUEndpointResponse) SetEvents(v []QueryIOUEndpointResponseEventsInner) { + o.Events = v +} + +func (o ExerciseIOUEndpointResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ExerciseIOUEndpointResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CompletionOffset) { + toSerialize["completionOffset"] = o.CompletionOffset + } + if !IsNil(o.Events) { + toSerialize["events"] = o.Events + } + return toSerialize, nil +} + +type NullableExerciseIOUEndpointResponse struct { + value *ExerciseIOUEndpointResponse + isSet bool +} + +func (v NullableExerciseIOUEndpointResponse) Get() *ExerciseIOUEndpointResponse { + return v.value +} + +func (v *NullableExerciseIOUEndpointResponse) Set(val *ExerciseIOUEndpointResponse) { + v.value = val + v.isSet = true +} + +func (v NullableExerciseIOUEndpointResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableExerciseIOUEndpointResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExerciseIOUEndpointResponse(val *ExerciseIOUEndpointResponse) *NullableExerciseIOUEndpointResponse { + return &NullableExerciseIOUEndpointResponse{value: val, isSet: true} +} + +func (v NullableExerciseIOUEndpointResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExerciseIOUEndpointResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_response_events_inner.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_response_events_inner.go new file mode 100644 index 00000000000..83097f042d3 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_response_events_inner.go @@ -0,0 +1,126 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the ExerciseIOUEndpointResponseEventsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ExerciseIOUEndpointResponseEventsInner{} + +// ExerciseIOUEndpointResponseEventsInner struct for ExerciseIOUEndpointResponseEventsInner +type ExerciseIOUEndpointResponseEventsInner struct { + Archived *ExerciseIOUEndpointResponseEventsInnerArchived `json:"archived,omitempty"` +} + +// NewExerciseIOUEndpointResponseEventsInner instantiates a new ExerciseIOUEndpointResponseEventsInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewExerciseIOUEndpointResponseEventsInner() *ExerciseIOUEndpointResponseEventsInner { + this := ExerciseIOUEndpointResponseEventsInner{} + return &this +} + +// NewExerciseIOUEndpointResponseEventsInnerWithDefaults instantiates a new ExerciseIOUEndpointResponseEventsInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewExerciseIOUEndpointResponseEventsInnerWithDefaults() *ExerciseIOUEndpointResponseEventsInner { + this := ExerciseIOUEndpointResponseEventsInner{} + return &this +} + +// GetArchived returns the Archived field value if set, zero value otherwise. +func (o *ExerciseIOUEndpointResponseEventsInner) GetArchived() ExerciseIOUEndpointResponseEventsInnerArchived { + if o == nil || IsNil(o.Archived) { + var ret ExerciseIOUEndpointResponseEventsInnerArchived + return ret + } + return *o.Archived +} + +// GetArchivedOk returns a tuple with the Archived field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExerciseIOUEndpointResponseEventsInner) GetArchivedOk() (*ExerciseIOUEndpointResponseEventsInnerArchived, bool) { + if o == nil || IsNil(o.Archived) { + return nil, false + } + return o.Archived, true +} + +// HasArchived returns a boolean if a field has been set. +func (o *ExerciseIOUEndpointResponseEventsInner) HasArchived() bool { + if o != nil && !IsNil(o.Archived) { + return true + } + + return false +} + +// SetArchived gets a reference to the given ExerciseIOUEndpointResponseEventsInnerArchived and assigns it to the Archived field. +func (o *ExerciseIOUEndpointResponseEventsInner) SetArchived(v ExerciseIOUEndpointResponseEventsInnerArchived) { + o.Archived = &v +} + +func (o ExerciseIOUEndpointResponseEventsInner) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ExerciseIOUEndpointResponseEventsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Archived) { + toSerialize["archived"] = o.Archived + } + return toSerialize, nil +} + +type NullableExerciseIOUEndpointResponseEventsInner struct { + value *ExerciseIOUEndpointResponseEventsInner + isSet bool +} + +func (v NullableExerciseIOUEndpointResponseEventsInner) Get() *ExerciseIOUEndpointResponseEventsInner { + return v.value +} + +func (v *NullableExerciseIOUEndpointResponseEventsInner) Set(val *ExerciseIOUEndpointResponseEventsInner) { + v.value = val + v.isSet = true +} + +func (v NullableExerciseIOUEndpointResponseEventsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableExerciseIOUEndpointResponseEventsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExerciseIOUEndpointResponseEventsInner(val *ExerciseIOUEndpointResponseEventsInner) *NullableExerciseIOUEndpointResponseEventsInner { + return &NullableExerciseIOUEndpointResponseEventsInner{value: val, isSet: true} +} + +func (v NullableExerciseIOUEndpointResponseEventsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExerciseIOUEndpointResponseEventsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_response_events_inner_archived.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_response_events_inner_archived.go new file mode 100644 index 00000000000..7c8c7fab1fc --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_exercise_iou_endpoint_response_events_inner_archived.go @@ -0,0 +1,162 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the ExerciseIOUEndpointResponseEventsInnerArchived type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ExerciseIOUEndpointResponseEventsInnerArchived{} + +// ExerciseIOUEndpointResponseEventsInnerArchived struct for ExerciseIOUEndpointResponseEventsInnerArchived +type ExerciseIOUEndpointResponseEventsInnerArchived struct { + ContractId *string `json:"contractId,omitempty"` + TemplateId *string `json:"templateId,omitempty"` +} + +// NewExerciseIOUEndpointResponseEventsInnerArchived instantiates a new ExerciseIOUEndpointResponseEventsInnerArchived object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewExerciseIOUEndpointResponseEventsInnerArchived() *ExerciseIOUEndpointResponseEventsInnerArchived { + this := ExerciseIOUEndpointResponseEventsInnerArchived{} + return &this +} + +// NewExerciseIOUEndpointResponseEventsInnerArchivedWithDefaults instantiates a new ExerciseIOUEndpointResponseEventsInnerArchived object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewExerciseIOUEndpointResponseEventsInnerArchivedWithDefaults() *ExerciseIOUEndpointResponseEventsInnerArchived { + this := ExerciseIOUEndpointResponseEventsInnerArchived{} + return &this +} + +// GetContractId returns the ContractId field value if set, zero value otherwise. +func (o *ExerciseIOUEndpointResponseEventsInnerArchived) GetContractId() string { + if o == nil || IsNil(o.ContractId) { + var ret string + return ret + } + return *o.ContractId +} + +// GetContractIdOk returns a tuple with the ContractId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExerciseIOUEndpointResponseEventsInnerArchived) GetContractIdOk() (*string, bool) { + if o == nil || IsNil(o.ContractId) { + return nil, false + } + return o.ContractId, true +} + +// HasContractId returns a boolean if a field has been set. +func (o *ExerciseIOUEndpointResponseEventsInnerArchived) HasContractId() bool { + if o != nil && !IsNil(o.ContractId) { + return true + } + + return false +} + +// SetContractId gets a reference to the given string and assigns it to the ContractId field. +func (o *ExerciseIOUEndpointResponseEventsInnerArchived) SetContractId(v string) { + o.ContractId = &v +} + +// GetTemplateId returns the TemplateId field value if set, zero value otherwise. +func (o *ExerciseIOUEndpointResponseEventsInnerArchived) GetTemplateId() string { + if o == nil || IsNil(o.TemplateId) { + var ret string + return ret + } + return *o.TemplateId +} + +// GetTemplateIdOk returns a tuple with the TemplateId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExerciseIOUEndpointResponseEventsInnerArchived) GetTemplateIdOk() (*string, bool) { + if o == nil || IsNil(o.TemplateId) { + return nil, false + } + return o.TemplateId, true +} + +// HasTemplateId returns a boolean if a field has been set. +func (o *ExerciseIOUEndpointResponseEventsInnerArchived) HasTemplateId() bool { + if o != nil && !IsNil(o.TemplateId) { + return true + } + + return false +} + +// SetTemplateId gets a reference to the given string and assigns it to the TemplateId field. +func (o *ExerciseIOUEndpointResponseEventsInnerArchived) SetTemplateId(v string) { + o.TemplateId = &v +} + +func (o ExerciseIOUEndpointResponseEventsInnerArchived) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ExerciseIOUEndpointResponseEventsInnerArchived) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ContractId) { + toSerialize["contractId"] = o.ContractId + } + if !IsNil(o.TemplateId) { + toSerialize["templateId"] = o.TemplateId + } + return toSerialize, nil +} + +type NullableExerciseIOUEndpointResponseEventsInnerArchived struct { + value *ExerciseIOUEndpointResponseEventsInnerArchived + isSet bool +} + +func (v NullableExerciseIOUEndpointResponseEventsInnerArchived) Get() *ExerciseIOUEndpointResponseEventsInnerArchived { + return v.value +} + +func (v *NullableExerciseIOUEndpointResponseEventsInnerArchived) Set(val *ExerciseIOUEndpointResponseEventsInnerArchived) { + v.value = val + v.isSet = true +} + +func (v NullableExerciseIOUEndpointResponseEventsInnerArchived) IsSet() bool { + return v.isSet +} + +func (v *NullableExerciseIOUEndpointResponseEventsInnerArchived) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExerciseIOUEndpointResponseEventsInnerArchived(val *ExerciseIOUEndpointResponseEventsInnerArchived) *NullableExerciseIOUEndpointResponseEventsInnerArchived { + return &NullableExerciseIOUEndpointResponseEventsInnerArchived{value: val, isSet: true} +} + +func (v NullableExerciseIOUEndpointResponseEventsInnerArchived) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExerciseIOUEndpointResponseEventsInnerArchived) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_get_parties_involved_endpoint_request.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_get_parties_involved_endpoint_request.go new file mode 100644 index 00000000000..afb114e03ea --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_get_parties_involved_endpoint_request.go @@ -0,0 +1,126 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the GetPartiesInvolvedEndpointRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetPartiesInvolvedEndpointRequest{} + +// GetPartiesInvolvedEndpointRequest This method is the request for getting all of the parties involved upon starting daml. +type GetPartiesInvolvedEndpointRequest struct { + ParticipantToken *string `json:"participantToken,omitempty"` +} + +// NewGetPartiesInvolvedEndpointRequest instantiates a new GetPartiesInvolvedEndpointRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetPartiesInvolvedEndpointRequest() *GetPartiesInvolvedEndpointRequest { + this := GetPartiesInvolvedEndpointRequest{} + return &this +} + +// NewGetPartiesInvolvedEndpointRequestWithDefaults instantiates a new GetPartiesInvolvedEndpointRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetPartiesInvolvedEndpointRequestWithDefaults() *GetPartiesInvolvedEndpointRequest { + this := GetPartiesInvolvedEndpointRequest{} + return &this +} + +// GetParticipantToken returns the ParticipantToken field value if set, zero value otherwise. +func (o *GetPartiesInvolvedEndpointRequest) GetParticipantToken() string { + if o == nil || IsNil(o.ParticipantToken) { + var ret string + return ret + } + return *o.ParticipantToken +} + +// GetParticipantTokenOk returns a tuple with the ParticipantToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetPartiesInvolvedEndpointRequest) GetParticipantTokenOk() (*string, bool) { + if o == nil || IsNil(o.ParticipantToken) { + return nil, false + } + return o.ParticipantToken, true +} + +// HasParticipantToken returns a boolean if a field has been set. +func (o *GetPartiesInvolvedEndpointRequest) HasParticipantToken() bool { + if o != nil && !IsNil(o.ParticipantToken) { + return true + } + + return false +} + +// SetParticipantToken gets a reference to the given string and assigns it to the ParticipantToken field. +func (o *GetPartiesInvolvedEndpointRequest) SetParticipantToken(v string) { + o.ParticipantToken = &v +} + +func (o GetPartiesInvolvedEndpointRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetPartiesInvolvedEndpointRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ParticipantToken) { + toSerialize["participantToken"] = o.ParticipantToken + } + return toSerialize, nil +} + +type NullableGetPartiesInvolvedEndpointRequest struct { + value *GetPartiesInvolvedEndpointRequest + isSet bool +} + +func (v NullableGetPartiesInvolvedEndpointRequest) Get() *GetPartiesInvolvedEndpointRequest { + return v.value +} + +func (v *NullableGetPartiesInvolvedEndpointRequest) Set(val *GetPartiesInvolvedEndpointRequest) { + v.value = val + v.isSet = true +} + +func (v NullableGetPartiesInvolvedEndpointRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableGetPartiesInvolvedEndpointRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetPartiesInvolvedEndpointRequest(val *GetPartiesInvolvedEndpointRequest) *NullableGetPartiesInvolvedEndpointRequest { + return &NullableGetPartiesInvolvedEndpointRequest{value: val, isSet: true} +} + +func (v NullableGetPartiesInvolvedEndpointRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetPartiesInvolvedEndpointRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_get_parties_involved_response.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_get_parties_involved_response.go new file mode 100644 index 00000000000..a50c0bd1b12 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_get_parties_involved_response.go @@ -0,0 +1,209 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the GetPartiesInvolvedResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetPartiesInvolvedResponse{} + +// GetPartiesInvolvedResponse struct for GetPartiesInvolvedResponse +type GetPartiesInvolvedResponse struct { + DisplayName NullableString `json:"displayName,omitempty"` + Identifier *string `json:"identifier,omitempty"` + // + IsLocal *bool `json:"isLocal,omitempty"` +} + +// NewGetPartiesInvolvedResponse instantiates a new GetPartiesInvolvedResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetPartiesInvolvedResponse() *GetPartiesInvolvedResponse { + this := GetPartiesInvolvedResponse{} + return &this +} + +// NewGetPartiesInvolvedResponseWithDefaults instantiates a new GetPartiesInvolvedResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetPartiesInvolvedResponseWithDefaults() *GetPartiesInvolvedResponse { + this := GetPartiesInvolvedResponse{} + return &this +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *GetPartiesInvolvedResponse) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName.Get()) { + var ret string + return ret + } + return *o.DisplayName.Get() +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GetPartiesInvolvedResponse) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DisplayName.Get(), o.DisplayName.IsSet() +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *GetPartiesInvolvedResponse) HasDisplayName() bool { + if o != nil && o.DisplayName.IsSet() { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given NullableString and assigns it to the DisplayName field. +func (o *GetPartiesInvolvedResponse) SetDisplayName(v string) { + o.DisplayName.Set(&v) +} +// SetDisplayNameNil sets the value for DisplayName to be an explicit nil +func (o *GetPartiesInvolvedResponse) SetDisplayNameNil() { + o.DisplayName.Set(nil) +} + +// UnsetDisplayName ensures that no value is present for DisplayName, not even an explicit nil +func (o *GetPartiesInvolvedResponse) UnsetDisplayName() { + o.DisplayName.Unset() +} + +// GetIdentifier returns the Identifier field value if set, zero value otherwise. +func (o *GetPartiesInvolvedResponse) GetIdentifier() string { + if o == nil || IsNil(o.Identifier) { + var ret string + return ret + } + return *o.Identifier +} + +// GetIdentifierOk returns a tuple with the Identifier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetPartiesInvolvedResponse) GetIdentifierOk() (*string, bool) { + if o == nil || IsNil(o.Identifier) { + return nil, false + } + return o.Identifier, true +} + +// HasIdentifier returns a boolean if a field has been set. +func (o *GetPartiesInvolvedResponse) HasIdentifier() bool { + if o != nil && !IsNil(o.Identifier) { + return true + } + + return false +} + +// SetIdentifier gets a reference to the given string and assigns it to the Identifier field. +func (o *GetPartiesInvolvedResponse) SetIdentifier(v string) { + o.Identifier = &v +} + +// GetIsLocal returns the IsLocal field value if set, zero value otherwise. +func (o *GetPartiesInvolvedResponse) GetIsLocal() bool { + if o == nil || IsNil(o.IsLocal) { + var ret bool + return ret + } + return *o.IsLocal +} + +// GetIsLocalOk returns a tuple with the IsLocal field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetPartiesInvolvedResponse) GetIsLocalOk() (*bool, bool) { + if o == nil || IsNil(o.IsLocal) { + return nil, false + } + return o.IsLocal, true +} + +// HasIsLocal returns a boolean if a field has been set. +func (o *GetPartiesInvolvedResponse) HasIsLocal() bool { + if o != nil && !IsNil(o.IsLocal) { + return true + } + + return false +} + +// SetIsLocal gets a reference to the given bool and assigns it to the IsLocal field. +func (o *GetPartiesInvolvedResponse) SetIsLocal(v bool) { + o.IsLocal = &v +} + +func (o GetPartiesInvolvedResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetPartiesInvolvedResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.DisplayName.IsSet() { + toSerialize["displayName"] = o.DisplayName.Get() + } + if !IsNil(o.Identifier) { + toSerialize["identifier"] = o.Identifier + } + if !IsNil(o.IsLocal) { + toSerialize["isLocal"] = o.IsLocal + } + return toSerialize, nil +} + +type NullableGetPartiesInvolvedResponse struct { + value *GetPartiesInvolvedResponse + isSet bool +} + +func (v NullableGetPartiesInvolvedResponse) Get() *GetPartiesInvolvedResponse { + return v.value +} + +func (v *NullableGetPartiesInvolvedResponse) Set(val *GetPartiesInvolvedResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetPartiesInvolvedResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetPartiesInvolvedResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetPartiesInvolvedResponse(val *GetPartiesInvolvedResponse) *NullableGetPartiesInvolvedResponse { + return &NullableGetPartiesInvolvedResponse{value: val, isSet: true} +} + +func (v NullableGetPartiesInvolvedResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetPartiesInvolvedResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_request.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_request.go new file mode 100644 index 00000000000..76d75da760d --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_request.go @@ -0,0 +1,234 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the QueryIOUEndpointRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QueryIOUEndpointRequest{} + +// QueryIOUEndpointRequest This method is the request for querying a simple IOU contract. +type QueryIOUEndpointRequest struct { + ParticipantToken *string `json:"participantToken,omitempty"` + TemplateIds []*string `json:"templateIds,omitempty"` + Query *QueryIOUEndpointRequestQuery `json:"query,omitempty"` + Readers []*string `json:"readers,omitempty"` +} + +// NewQueryIOUEndpointRequest instantiates a new QueryIOUEndpointRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQueryIOUEndpointRequest() *QueryIOUEndpointRequest { + this := QueryIOUEndpointRequest{} + return &this +} + +// NewQueryIOUEndpointRequestWithDefaults instantiates a new QueryIOUEndpointRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQueryIOUEndpointRequestWithDefaults() *QueryIOUEndpointRequest { + this := QueryIOUEndpointRequest{} + return &this +} + +// GetParticipantToken returns the ParticipantToken field value if set, zero value otherwise. +func (o *QueryIOUEndpointRequest) GetParticipantToken() string { + if o == nil || IsNil(o.ParticipantToken) { + var ret string + return ret + } + return *o.ParticipantToken +} + +// GetParticipantTokenOk returns a tuple with the ParticipantToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryIOUEndpointRequest) GetParticipantTokenOk() (*string, bool) { + if o == nil || IsNil(o.ParticipantToken) { + return nil, false + } + return o.ParticipantToken, true +} + +// HasParticipantToken returns a boolean if a field has been set. +func (o *QueryIOUEndpointRequest) HasParticipantToken() bool { + if o != nil && !IsNil(o.ParticipantToken) { + return true + } + + return false +} + +// SetParticipantToken gets a reference to the given string and assigns it to the ParticipantToken field. +func (o *QueryIOUEndpointRequest) SetParticipantToken(v string) { + o.ParticipantToken = &v +} + +// GetTemplateIds returns the TemplateIds field value if set, zero value otherwise. +func (o *QueryIOUEndpointRequest) GetTemplateIds() []*string { + if o == nil || IsNil(o.TemplateIds) { + var ret []*string + return ret + } + return o.TemplateIds +} + +// GetTemplateIdsOk returns a tuple with the TemplateIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryIOUEndpointRequest) GetTemplateIdsOk() ([]*string, bool) { + if o == nil || IsNil(o.TemplateIds) { + return nil, false + } + return o.TemplateIds, true +} + +// HasTemplateIds returns a boolean if a field has been set. +func (o *QueryIOUEndpointRequest) HasTemplateIds() bool { + if o != nil && !IsNil(o.TemplateIds) { + return true + } + + return false +} + +// SetTemplateIds gets a reference to the given []*string and assigns it to the TemplateIds field. +func (o *QueryIOUEndpointRequest) SetTemplateIds(v []*string) { + o.TemplateIds = v +} + +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *QueryIOUEndpointRequest) GetQuery() QueryIOUEndpointRequestQuery { + if o == nil || IsNil(o.Query) { + var ret QueryIOUEndpointRequestQuery + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryIOUEndpointRequest) GetQueryOk() (*QueryIOUEndpointRequestQuery, bool) { + if o == nil || IsNil(o.Query) { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *QueryIOUEndpointRequest) HasQuery() bool { + if o != nil && !IsNil(o.Query) { + return true + } + + return false +} + +// SetQuery gets a reference to the given QueryIOUEndpointRequestQuery and assigns it to the Query field. +func (o *QueryIOUEndpointRequest) SetQuery(v QueryIOUEndpointRequestQuery) { + o.Query = &v +} + +// GetReaders returns the Readers field value if set, zero value otherwise. +func (o *QueryIOUEndpointRequest) GetReaders() []*string { + if o == nil || IsNil(o.Readers) { + var ret []*string + return ret + } + return o.Readers +} + +// GetReadersOk returns a tuple with the Readers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryIOUEndpointRequest) GetReadersOk() ([]*string, bool) { + if o == nil || IsNil(o.Readers) { + return nil, false + } + return o.Readers, true +} + +// HasReaders returns a boolean if a field has been set. +func (o *QueryIOUEndpointRequest) HasReaders() bool { + if o != nil && !IsNil(o.Readers) { + return true + } + + return false +} + +// SetReaders gets a reference to the given []*string and assigns it to the Readers field. +func (o *QueryIOUEndpointRequest) SetReaders(v []*string) { + o.Readers = v +} + +func (o QueryIOUEndpointRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o QueryIOUEndpointRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ParticipantToken) { + toSerialize["participantToken"] = o.ParticipantToken + } + if !IsNil(o.TemplateIds) { + toSerialize["templateIds"] = o.TemplateIds + } + if !IsNil(o.Query) { + toSerialize["query"] = o.Query + } + if !IsNil(o.Readers) { + toSerialize["readers"] = o.Readers + } + return toSerialize, nil +} + +type NullableQueryIOUEndpointRequest struct { + value *QueryIOUEndpointRequest + isSet bool +} + +func (v NullableQueryIOUEndpointRequest) Get() *QueryIOUEndpointRequest { + return v.value +} + +func (v *NullableQueryIOUEndpointRequest) Set(val *QueryIOUEndpointRequest) { + v.value = val + v.isSet = true +} + +func (v NullableQueryIOUEndpointRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableQueryIOUEndpointRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQueryIOUEndpointRequest(val *QueryIOUEndpointRequest) *NullableQueryIOUEndpointRequest { + return &NullableQueryIOUEndpointRequest{value: val, isSet: true} +} + +func (v NullableQueryIOUEndpointRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQueryIOUEndpointRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_request_query.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_request_query.go new file mode 100644 index 00000000000..bf362f7e4f8 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_request_query.go @@ -0,0 +1,126 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the QueryIOUEndpointRequestQuery type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QueryIOUEndpointRequestQuery{} + +// QueryIOUEndpointRequestQuery struct for QueryIOUEndpointRequestQuery +type QueryIOUEndpointRequestQuery struct { + Amount *float32 `json:"amount,omitempty"` +} + +// NewQueryIOUEndpointRequestQuery instantiates a new QueryIOUEndpointRequestQuery object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQueryIOUEndpointRequestQuery() *QueryIOUEndpointRequestQuery { + this := QueryIOUEndpointRequestQuery{} + return &this +} + +// NewQueryIOUEndpointRequestQueryWithDefaults instantiates a new QueryIOUEndpointRequestQuery object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQueryIOUEndpointRequestQueryWithDefaults() *QueryIOUEndpointRequestQuery { + this := QueryIOUEndpointRequestQuery{} + return &this +} + +// GetAmount returns the Amount field value if set, zero value otherwise. +func (o *QueryIOUEndpointRequestQuery) GetAmount() float32 { + if o == nil || IsNil(o.Amount) { + var ret float32 + return ret + } + return *o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryIOUEndpointRequestQuery) GetAmountOk() (*float32, bool) { + if o == nil || IsNil(o.Amount) { + return nil, false + } + return o.Amount, true +} + +// HasAmount returns a boolean if a field has been set. +func (o *QueryIOUEndpointRequestQuery) HasAmount() bool { + if o != nil && !IsNil(o.Amount) { + return true + } + + return false +} + +// SetAmount gets a reference to the given float32 and assigns it to the Amount field. +func (o *QueryIOUEndpointRequestQuery) SetAmount(v float32) { + o.Amount = &v +} + +func (o QueryIOUEndpointRequestQuery) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o QueryIOUEndpointRequestQuery) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Amount) { + toSerialize["amount"] = o.Amount + } + return toSerialize, nil +} + +type NullableQueryIOUEndpointRequestQuery struct { + value *QueryIOUEndpointRequestQuery + isSet bool +} + +func (v NullableQueryIOUEndpointRequestQuery) Get() *QueryIOUEndpointRequestQuery { + return v.value +} + +func (v *NullableQueryIOUEndpointRequestQuery) Set(val *QueryIOUEndpointRequestQuery) { + v.value = val + v.isSet = true +} + +func (v NullableQueryIOUEndpointRequestQuery) IsSet() bool { + return v.isSet +} + +func (v *NullableQueryIOUEndpointRequestQuery) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQueryIOUEndpointRequestQuery(val *QueryIOUEndpointRequestQuery) *NullableQueryIOUEndpointRequestQuery { + return &NullableQueryIOUEndpointRequestQuery{value: val, isSet: true} +} + +func (v NullableQueryIOUEndpointRequestQuery) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQueryIOUEndpointRequestQuery) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_response.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_response.go new file mode 100644 index 00000000000..626dbc65dee --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_response.go @@ -0,0 +1,162 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the QueryIOUEndpointResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QueryIOUEndpointResponse{} + +// QueryIOUEndpointResponse This method is the response for querying a simple IOU contract. +type QueryIOUEndpointResponse struct { + CompletionOffset *string `json:"completionOffset,omitempty"` + Events []QueryIOUEndpointResponseEventsInner `json:"events,omitempty"` +} + +// NewQueryIOUEndpointResponse instantiates a new QueryIOUEndpointResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQueryIOUEndpointResponse() *QueryIOUEndpointResponse { + this := QueryIOUEndpointResponse{} + return &this +} + +// NewQueryIOUEndpointResponseWithDefaults instantiates a new QueryIOUEndpointResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQueryIOUEndpointResponseWithDefaults() *QueryIOUEndpointResponse { + this := QueryIOUEndpointResponse{} + return &this +} + +// GetCompletionOffset returns the CompletionOffset field value if set, zero value otherwise. +func (o *QueryIOUEndpointResponse) GetCompletionOffset() string { + if o == nil || IsNil(o.CompletionOffset) { + var ret string + return ret + } + return *o.CompletionOffset +} + +// GetCompletionOffsetOk returns a tuple with the CompletionOffset field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryIOUEndpointResponse) GetCompletionOffsetOk() (*string, bool) { + if o == nil || IsNil(o.CompletionOffset) { + return nil, false + } + return o.CompletionOffset, true +} + +// HasCompletionOffset returns a boolean if a field has been set. +func (o *QueryIOUEndpointResponse) HasCompletionOffset() bool { + if o != nil && !IsNil(o.CompletionOffset) { + return true + } + + return false +} + +// SetCompletionOffset gets a reference to the given string and assigns it to the CompletionOffset field. +func (o *QueryIOUEndpointResponse) SetCompletionOffset(v string) { + o.CompletionOffset = &v +} + +// GetEvents returns the Events field value if set, zero value otherwise. +func (o *QueryIOUEndpointResponse) GetEvents() []QueryIOUEndpointResponseEventsInner { + if o == nil || IsNil(o.Events) { + var ret []QueryIOUEndpointResponseEventsInner + return ret + } + return o.Events +} + +// GetEventsOk returns a tuple with the Events field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryIOUEndpointResponse) GetEventsOk() ([]QueryIOUEndpointResponseEventsInner, bool) { + if o == nil || IsNil(o.Events) { + return nil, false + } + return o.Events, true +} + +// HasEvents returns a boolean if a field has been set. +func (o *QueryIOUEndpointResponse) HasEvents() bool { + if o != nil && !IsNil(o.Events) { + return true + } + + return false +} + +// SetEvents gets a reference to the given []QueryIOUEndpointResponseEventsInner and assigns it to the Events field. +func (o *QueryIOUEndpointResponse) SetEvents(v []QueryIOUEndpointResponseEventsInner) { + o.Events = v +} + +func (o QueryIOUEndpointResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o QueryIOUEndpointResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CompletionOffset) { + toSerialize["completionOffset"] = o.CompletionOffset + } + if !IsNil(o.Events) { + toSerialize["events"] = o.Events + } + return toSerialize, nil +} + +type NullableQueryIOUEndpointResponse struct { + value *QueryIOUEndpointResponse + isSet bool +} + +func (v NullableQueryIOUEndpointResponse) Get() *QueryIOUEndpointResponse { + return v.value +} + +func (v *NullableQueryIOUEndpointResponse) Set(val *QueryIOUEndpointResponse) { + v.value = val + v.isSet = true +} + +func (v NullableQueryIOUEndpointResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableQueryIOUEndpointResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQueryIOUEndpointResponse(val *QueryIOUEndpointResponse) *NullableQueryIOUEndpointResponse { + return &NullableQueryIOUEndpointResponse{value: val, isSet: true} +} + +func (v NullableQueryIOUEndpointResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQueryIOUEndpointResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_response_events_inner.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_response_events_inner.go new file mode 100644 index 00000000000..c5acf29045d --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_response_events_inner.go @@ -0,0 +1,126 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the QueryIOUEndpointResponseEventsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QueryIOUEndpointResponseEventsInner{} + +// QueryIOUEndpointResponseEventsInner struct for QueryIOUEndpointResponseEventsInner +type QueryIOUEndpointResponseEventsInner struct { + Archived *QueryIOUEndpointResponseEventsInnerArchived `json:"archived,omitempty"` +} + +// NewQueryIOUEndpointResponseEventsInner instantiates a new QueryIOUEndpointResponseEventsInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQueryIOUEndpointResponseEventsInner() *QueryIOUEndpointResponseEventsInner { + this := QueryIOUEndpointResponseEventsInner{} + return &this +} + +// NewQueryIOUEndpointResponseEventsInnerWithDefaults instantiates a new QueryIOUEndpointResponseEventsInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQueryIOUEndpointResponseEventsInnerWithDefaults() *QueryIOUEndpointResponseEventsInner { + this := QueryIOUEndpointResponseEventsInner{} + return &this +} + +// GetArchived returns the Archived field value if set, zero value otherwise. +func (o *QueryIOUEndpointResponseEventsInner) GetArchived() QueryIOUEndpointResponseEventsInnerArchived { + if o == nil || IsNil(o.Archived) { + var ret QueryIOUEndpointResponseEventsInnerArchived + return ret + } + return *o.Archived +} + +// GetArchivedOk returns a tuple with the Archived field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryIOUEndpointResponseEventsInner) GetArchivedOk() (*QueryIOUEndpointResponseEventsInnerArchived, bool) { + if o == nil || IsNil(o.Archived) { + return nil, false + } + return o.Archived, true +} + +// HasArchived returns a boolean if a field has been set. +func (o *QueryIOUEndpointResponseEventsInner) HasArchived() bool { + if o != nil && !IsNil(o.Archived) { + return true + } + + return false +} + +// SetArchived gets a reference to the given QueryIOUEndpointResponseEventsInnerArchived and assigns it to the Archived field. +func (o *QueryIOUEndpointResponseEventsInner) SetArchived(v QueryIOUEndpointResponseEventsInnerArchived) { + o.Archived = &v +} + +func (o QueryIOUEndpointResponseEventsInner) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o QueryIOUEndpointResponseEventsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Archived) { + toSerialize["archived"] = o.Archived + } + return toSerialize, nil +} + +type NullableQueryIOUEndpointResponseEventsInner struct { + value *QueryIOUEndpointResponseEventsInner + isSet bool +} + +func (v NullableQueryIOUEndpointResponseEventsInner) Get() *QueryIOUEndpointResponseEventsInner { + return v.value +} + +func (v *NullableQueryIOUEndpointResponseEventsInner) Set(val *QueryIOUEndpointResponseEventsInner) { + v.value = val + v.isSet = true +} + +func (v NullableQueryIOUEndpointResponseEventsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableQueryIOUEndpointResponseEventsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQueryIOUEndpointResponseEventsInner(val *QueryIOUEndpointResponseEventsInner) *NullableQueryIOUEndpointResponseEventsInner { + return &NullableQueryIOUEndpointResponseEventsInner{value: val, isSet: true} +} + +func (v NullableQueryIOUEndpointResponseEventsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQueryIOUEndpointResponseEventsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_response_events_inner_archived.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_response_events_inner_archived.go new file mode 100644 index 00000000000..19ee8756943 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_iou_endpoint_response_events_inner_archived.go @@ -0,0 +1,162 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the QueryIOUEndpointResponseEventsInnerArchived type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QueryIOUEndpointResponseEventsInnerArchived{} + +// QueryIOUEndpointResponseEventsInnerArchived struct for QueryIOUEndpointResponseEventsInnerArchived +type QueryIOUEndpointResponseEventsInnerArchived struct { + ContractId *string `json:"contractId,omitempty"` + TemplateId *string `json:"templateId,omitempty"` +} + +// NewQueryIOUEndpointResponseEventsInnerArchived instantiates a new QueryIOUEndpointResponseEventsInnerArchived object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQueryIOUEndpointResponseEventsInnerArchived() *QueryIOUEndpointResponseEventsInnerArchived { + this := QueryIOUEndpointResponseEventsInnerArchived{} + return &this +} + +// NewQueryIOUEndpointResponseEventsInnerArchivedWithDefaults instantiates a new QueryIOUEndpointResponseEventsInnerArchived object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQueryIOUEndpointResponseEventsInnerArchivedWithDefaults() *QueryIOUEndpointResponseEventsInnerArchived { + this := QueryIOUEndpointResponseEventsInnerArchived{} + return &this +} + +// GetContractId returns the ContractId field value if set, zero value otherwise. +func (o *QueryIOUEndpointResponseEventsInnerArchived) GetContractId() string { + if o == nil || IsNil(o.ContractId) { + var ret string + return ret + } + return *o.ContractId +} + +// GetContractIdOk returns a tuple with the ContractId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryIOUEndpointResponseEventsInnerArchived) GetContractIdOk() (*string, bool) { + if o == nil || IsNil(o.ContractId) { + return nil, false + } + return o.ContractId, true +} + +// HasContractId returns a boolean if a field has been set. +func (o *QueryIOUEndpointResponseEventsInnerArchived) HasContractId() bool { + if o != nil && !IsNil(o.ContractId) { + return true + } + + return false +} + +// SetContractId gets a reference to the given string and assigns it to the ContractId field. +func (o *QueryIOUEndpointResponseEventsInnerArchived) SetContractId(v string) { + o.ContractId = &v +} + +// GetTemplateId returns the TemplateId field value if set, zero value otherwise. +func (o *QueryIOUEndpointResponseEventsInnerArchived) GetTemplateId() string { + if o == nil || IsNil(o.TemplateId) { + var ret string + return ret + } + return *o.TemplateId +} + +// GetTemplateIdOk returns a tuple with the TemplateId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryIOUEndpointResponseEventsInnerArchived) GetTemplateIdOk() (*string, bool) { + if o == nil || IsNil(o.TemplateId) { + return nil, false + } + return o.TemplateId, true +} + +// HasTemplateId returns a boolean if a field has been set. +func (o *QueryIOUEndpointResponseEventsInnerArchived) HasTemplateId() bool { + if o != nil && !IsNil(o.TemplateId) { + return true + } + + return false +} + +// SetTemplateId gets a reference to the given string and assigns it to the TemplateId field. +func (o *QueryIOUEndpointResponseEventsInnerArchived) SetTemplateId(v string) { + o.TemplateId = &v +} + +func (o QueryIOUEndpointResponseEventsInnerArchived) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o QueryIOUEndpointResponseEventsInnerArchived) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ContractId) { + toSerialize["contractId"] = o.ContractId + } + if !IsNil(o.TemplateId) { + toSerialize["templateId"] = o.TemplateId + } + return toSerialize, nil +} + +type NullableQueryIOUEndpointResponseEventsInnerArchived struct { + value *QueryIOUEndpointResponseEventsInnerArchived + isSet bool +} + +func (v NullableQueryIOUEndpointResponseEventsInnerArchived) Get() *QueryIOUEndpointResponseEventsInnerArchived { + return v.value +} + +func (v *NullableQueryIOUEndpointResponseEventsInnerArchived) Set(val *QueryIOUEndpointResponseEventsInnerArchived) { + v.value = val + v.isSet = true +} + +func (v NullableQueryIOUEndpointResponseEventsInnerArchived) IsSet() bool { + return v.isSet +} + +func (v *NullableQueryIOUEndpointResponseEventsInnerArchived) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQueryIOUEndpointResponseEventsInnerArchived(val *QueryIOUEndpointResponseEventsInnerArchived) *NullableQueryIOUEndpointResponseEventsInnerArchived { + return &NullableQueryIOUEndpointResponseEventsInnerArchived{value: val, isSet: true} +} + +func (v NullableQueryIOUEndpointResponseEventsInnerArchived) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQueryIOUEndpointResponseEventsInnerArchived) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_raw_iou_endpoint_request.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_raw_iou_endpoint_request.go new file mode 100644 index 00000000000..72846e96c92 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/model_query_raw_iou_endpoint_request.go @@ -0,0 +1,126 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" +) + +// checks if the QueryRawIOUEndpointRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QueryRawIOUEndpointRequest{} + +// QueryRawIOUEndpointRequest This method is the request for querying a simple IOU contract. +type QueryRawIOUEndpointRequest struct { + ParticipantToken *string `json:"participantToken,omitempty"` +} + +// NewQueryRawIOUEndpointRequest instantiates a new QueryRawIOUEndpointRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQueryRawIOUEndpointRequest() *QueryRawIOUEndpointRequest { + this := QueryRawIOUEndpointRequest{} + return &this +} + +// NewQueryRawIOUEndpointRequestWithDefaults instantiates a new QueryRawIOUEndpointRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQueryRawIOUEndpointRequestWithDefaults() *QueryRawIOUEndpointRequest { + this := QueryRawIOUEndpointRequest{} + return &this +} + +// GetParticipantToken returns the ParticipantToken field value if set, zero value otherwise. +func (o *QueryRawIOUEndpointRequest) GetParticipantToken() string { + if o == nil || IsNil(o.ParticipantToken) { + var ret string + return ret + } + return *o.ParticipantToken +} + +// GetParticipantTokenOk returns a tuple with the ParticipantToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryRawIOUEndpointRequest) GetParticipantTokenOk() (*string, bool) { + if o == nil || IsNil(o.ParticipantToken) { + return nil, false + } + return o.ParticipantToken, true +} + +// HasParticipantToken returns a boolean if a field has been set. +func (o *QueryRawIOUEndpointRequest) HasParticipantToken() bool { + if o != nil && !IsNil(o.ParticipantToken) { + return true + } + + return false +} + +// SetParticipantToken gets a reference to the given string and assigns it to the ParticipantToken field. +func (o *QueryRawIOUEndpointRequest) SetParticipantToken(v string) { + o.ParticipantToken = &v +} + +func (o QueryRawIOUEndpointRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o QueryRawIOUEndpointRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ParticipantToken) { + toSerialize["participantToken"] = o.ParticipantToken + } + return toSerialize, nil +} + +type NullableQueryRawIOUEndpointRequest struct { + value *QueryRawIOUEndpointRequest + isSet bool +} + +func (v NullableQueryRawIOUEndpointRequest) Get() *QueryRawIOUEndpointRequest { + return v.value +} + +func (v *NullableQueryRawIOUEndpointRequest) Set(val *QueryRawIOUEndpointRequest) { + v.value = val + v.isSet = true +} + +func (v NullableQueryRawIOUEndpointRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableQueryRawIOUEndpointRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQueryRawIOUEndpointRequest(val *QueryRawIOUEndpointRequest) *NullableQueryRawIOUEndpointRequest { + return &NullableQueryRawIOUEndpointRequest{value: val, isSet: true} +} + +func (v NullableQueryRawIOUEndpointRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQueryRawIOUEndpointRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/response.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/response.go new file mode 100644 index 00000000000..1afb97fca4e --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/response.go @@ -0,0 +1,47 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/test/api_default_test.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/test/api_default_test.go new file mode 100644 index 00000000000..1832f87f1d6 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/test/api_default_test.go @@ -0,0 +1,49 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package cactus-plugin-ledger-connector-daml + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/hyperledger/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client" +) + +func Test_cactus-plugin-ledger-connector-daml_DefaultApiService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test DefaultApiService CreateIou", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultApi.CreateIou(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DefaultApiService GetPartiesInvolved", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultApi.GetPartiesInvolved(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/utils.go b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/utils.go new file mode 100644 index 00000000000..ca2f7d02faf --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/go/generated/openapi/go-client/utils.go @@ -0,0 +1,347 @@ +/* +Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +API version: 2.0.0-rc.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cactus-plugin-ledger-connector-daml + +import ( + "encoding/json" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/json/openapi.json b/packages/cactus-plugin-ledger-connector-daml/src/main/json/openapi.json new file mode 100644 index 00000000000..256f45b54e3 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/json/openapi.json @@ -0,0 +1,471 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cacti Plugin - Connector DAML", + "description": "Can perform basic tasks on a DAML ledger", + "version": "2.0.0-rc.3", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "QueryRawIOUEndpointRequest": { + "description": "This method is the request for querying a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "participantToken": { + "type": "string", + "nullable": false + } + } + }, + "GetPartiesInvolvedEndpointRequest": { + "description": "This method is the request for getting all of the parties involved upon starting daml.", + "type": "object", + "required": [], + "properties": { + "participantToken": { + "type": "string", + "nullable": false + } + } + }, + "QueryIOUEndpointRequest": { + "description": "This method is the request for querying a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "participantToken": { + "type": "string", + "nullable": false + }, + "templateIds": { + "type": "array", + "nullable": false, + "items": { + "type": "string", + "nullable": true + } + }, + "query": { + "type": "object", + "nullable": false, + "properties": { + "amount": { + "type": "number", + "nullable": false + } + } + }, + "readers": { + "type": "array", + "nullable": false, + "items": { + "type": "string", + "nullable": true + } + } + } + }, + "QueryIOUEndpointResponse": { + "description": "This method is the response for querying a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "completionOffset": { + "type": "string", + "nullable": false + }, + "events": { + "type": "array", + "nullable": false, + "items": { + "type": "object", + "nullable": false, + "properties": { + "archived": { + "type": "object", + "nullable": false, + "properties": { + "contractId": { + "type": "string", + "nullable": false + }, + "templateId": { + "type": "string", + "nullable": false + } + } + } + } + } + } + } + }, + "CreateIOUEndpointRequest": { + "description": "This method is the request for creating a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "templateId": { + "type": "string", + "nullable": false + }, + "participantToken": { + "type": "string", + "nullable": false + }, + "payload": { + "type": "object", + "properties": { + "issuer": { + "type": "string", + "nullable": false + }, + "owner": { + "type": "string", + "nullable": false + }, + "currency": { + "type": "string", + "nullable": false + }, + "amount": { + "type": "string", + "nullable": false + }, + "observers": { + "type": "array", + "nullable": false, + "items": { + "type": "string", + "nullable": true + } + } + } + } + } + }, + "CreateIOUEndpointResponse": { + "description": "This method is the response for creating a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "agreementText": { + "type": "string", + "nullable": false + }, + "completionOffset": { + "type": "string", + "nullable": false + }, + "contractId": { + "type": "string", + "nullable": false + }, + "observers": { + "type": "array", + "nullable": false, + "items": { + "type": "string", + "nullable": true + } + }, + "templateId": { + "type": "string", + "nullable": false + }, + "signatories": { + "type": "array", + "nullable": false, + "items": { + "type": "string", + "nullable": true + } + }, + "payload": { + "type": "object", + "properties": { + "issuer": { + "type": "string", + "nullable": false + }, + "owner": { + "type": "string", + "nullable": false + }, + "currency": { + "type": "string", + "nullable": false + }, + "amount": { + "type": "string", + "nullable": false + }, + "observers": { + "type": "array", + "nullable": false, + "items": { + "type": "string", + "nullable": true + } + } + } + } + } + }, + "ExerciseIOUEndpointRequest": { + "description": "This method is the request for creating a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "previousParticipantToken": { + "type": "string", + "nullable": false + }, + "templateId": { + "type": "string", + "nullable": false + }, + "contractId": { + "type": "string", + "nullable": false + }, + "choice": { + "type": "string", + "nullable": false + }, + "argument": { + "type": "object", + "properties": { + "newOwner": { + "type": "string", + "nullable": false + } + } + } + } + }, + "ExerciseIOUEndpointResponse": { + "description": "This method is the request for creating a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "completionOffset": { + "type": "string", + "nullable": false + }, + "events": { + "type": "array", + "nullable": false, + "items": { + "type": "object", + "nullable": false, + "properties": { + "archived": { + "type": "object", + "nullable": false, + "properties": { + "contractId": { + "type": "string", + "nullable": false + }, + "templateId": { + "type": "string", + "nullable": false + } + } + } + } + } + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint": { + "post": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint" + } + }, + "operationId": "createIou", + "summary": "This method creates a simple iou countract", + "requestBody": { + "description": "Request body for creation of iou", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateIOUEndpointRequest" + } + } + } + }, + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateIOUEndpointResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint": { + "post": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint" + } + }, + "operationId": "exerciseChoice", + "summary": "This method exercise choices(DAML term for function on contracts) for iou countract", + "requestBody": { + "description": "Request body for exercising choice(DAML term for function on contracts) of iou", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExerciseIOUEndpointRequest" + } + } + } + }, + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExerciseIOUEndpointResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint": { + "post": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint" + } + }, + "operationId": "queryContract", + "summary": "This method queries DAML contracts", + "requestBody": { + "description": "Request body for creation of iou", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryIOUEndpointRequest" + } + } + } + }, + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryIOUEndpointResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint": { + "get": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint" + } + }, + "operationId": "queryRawContract", + "summary": "This method queries DAML contracts that does not include request body", + "requestBody": { + "description": "Request for querying IOU contracts", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryRawIOUEndpointRequest" + } + } + } + }, + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryIOUEndpointResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint": { + "get": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint" + } + }, + "operationId": "getPartiesInvolved", + "summary": "This method queries all the parties that is included on IOU contract", + "requestBody": { + "description": "Request body for getting the parties involved in daml instance", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetPartiesInvolvedEndpointRequest" + } + } + } + }, + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryIOUEndpointResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/json/openapi.tpl.json b/packages/cactus-plugin-ledger-connector-daml/src/main/json/openapi.tpl.json new file mode 100644 index 00000000000..3171df1549a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/json/openapi.tpl.json @@ -0,0 +1,471 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cacti Plugin - Connector DAML", + "description": "Can perform basic tasks on a DAML ledger", + "version": "2.0.0-rc.3", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "QueryRawIOUEndpointRequest": { + "description": "This method is the request for querying a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "participantToken": { + "type": "string", + "nullable": false + } + } + }, + "GetPartiesInvolvedEndpointRequest": { + "description": "This method is the request for getting all of the parties involved upon starting daml.", + "type": "object", + "required": [], + "properties": { + "participantToken": { + "type": "string", + "nullable": false + } + } + }, + "QueryIOUEndpointRequest": { + "description": "This method is the request for querying a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "participantToken": { + "type": "string", + "nullable": false + }, + "templateIds": { + "type": "array", + "nullable": false, + "items": { + "type": "string", + "nullable": true + } + }, + "query": { + "type": "object", + "nullable": false, + "properties": { + "amount": { + "type": "number", + "nullable": false + } + } + }, + "readers": { + "type": "array", + "nullable": false, + "items": { + "type": "string", + "nullable": true + } + } + } + }, + "QueryIOUEndpointResponse": { + "description": "This method is the response for querying a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "completionOffset": { + "type": "string", + "nullable": false + }, + "events": { + "type": "array", + "nullable": false, + "items": { + "type": "object", + "nullable": false, + "properties": { + "archived": { + "type": "object", + "nullable": false, + "properties": { + "contractId": { + "type": "string", + "nullable": false + }, + "templateId": { + "type": "string", + "nullable": false + } + } + } + } + } + } + } + }, + "CreateIOUEndpointRequest": { + "description": "This method is the request for creating a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "templateId": { + "type": "string", + "nullable": false + }, + "participantToken": { + "type": "string", + "nullable": false + }, + "payload": { + "type": "object", + "properties":{ + "issuer": { + "type": "string", + "nullable": false + }, + "owner": { + "type": "string", + "nullable": false + }, + "currency": { + "type": "string", + "nullable": false + }, + "amount": { + "type": "string", + "nullable": false + }, + "observers": { + "type": "array", + "nullable": false, + "items": { + "type": "string", + "nullable": true + } + } + } + } + } + }, + "CreateIOUEndpointResponse": { + "description": "This method is the response for creating a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "agreementText": { + "type": "string", + "nullable": false + }, + "completionOffset": { + "type": "string", + "nullable": false + }, + "contractId": { + "type": "string", + "nullable": false + }, + "observers": { + "type": "array", + "nullable": false, + "items": { + "type": "string", + "nullable": true + } + }, + "templateId": { + "type": "string", + "nullable": false + }, + "signatories": { + "type": "array", + "nullable": false, + "items": { + "type": "string", + "nullable": true + } + }, + "payload": { + "type": "object", + "properties":{ + "issuer": { + "type": "string", + "nullable": false + }, + "owner": { + "type": "string", + "nullable": false + }, + "currency": { + "type": "string", + "nullable": false + }, + "amount": { + "type": "string", + "nullable": false + }, + "observers": { + "type": "array", + "nullable": false, + "items": { + "type": "string", + "nullable": true + } + } + } + } + } + }, + "ExerciseIOUEndpointRequest": { + "description": "This method is the request for creating a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "previousParticipantToken": { + "type": "string", + "nullable": false + }, + "templateId": { + "type": "string", + "nullable": false + }, + "contractId": { + "type": "string", + "nullable": false + }, + "choice": { + "type": "string", + "nullable": false + }, + "argument": { + "type": "object", + "properties":{ + "newOwner": { + "type": "string", + "nullable": false + } + } + } + } + }, + "ExerciseIOUEndpointResponse": { + "description": "This method is the request for creating a simple IOU contract.", + "type": "object", + "required": [], + "properties": { + "completionOffset": { + "type": "string", + "nullable": false + }, + "events": { + "type": "array", + "nullable": false, + "items": { + "type": "object", + "nullable": false, + "properties": { + "archived": { + "type": "object", + "nullable": false, + "properties": { + "contractId": { + "type": "string", + "nullable": false + }, + "templateId": { + "type": "string", + "nullable": false + } + } + } + } + } + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint": { + "post": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint" + } + }, + "operationId": "createIou", + "summary": "This method creates a simple iou countract", + "requestBody": { + "description": "Request body for creation of iou", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateIOUEndpointRequest" + } + } + } + }, + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateIOUEndpointResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint": { + "post": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint" + } + }, + "operationId": "exerciseChoice", + "summary": "This method exercise choices(DAML term for function on contracts) for iou countract", + "requestBody": { + "description": "Request body for exercising choice(DAML term for function on contracts) of iou", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExerciseIOUEndpointRequest" + } + } + } + }, + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExerciseIOUEndpointResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint": { + "post": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint" + } + }, + "operationId": "queryContract", + "summary": "This method queries DAML contracts", + "requestBody": { + "description": "Request body for creation of iou", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryIOUEndpointRequest" + } + } + } + }, + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryIOUEndpointResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint": { + "get": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint" + } + }, + "operationId": "queryRawContract", + "summary": "This method queries DAML contracts that does not include request body", + "requestBody": { + "description": "Request for querying IOU contracts", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryRawIOUEndpointRequest" + } + } + } + }, + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryIOUEndpointResponse" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint": { + "get": { + "x-hyperledger-cactus": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint" + } + }, + "operationId": "getPartiesInvolved", + "summary": "This method queries all the parties that is included on IOU contract", + "requestBody": { + "description": "Request body for getting the parties involved in daml instance", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetPartiesInvolvedEndpointRequest" + } + } + } + }, + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryIOUEndpointResponse" + } + } + } + } + } + } + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES new file mode 100644 index 00000000000..0a6f2104976 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/FILES @@ -0,0 +1,36 @@ +README.md +build.gradle +gradlew +gradlew.bat +settings.gradle +src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt +src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt +src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt +src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt +src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt +src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt +src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt +src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt +src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointRequest.kt +src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointRequestPayload.kt +src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointResponse.kt +src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointRequest.kt +src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointRequestArgument.kt +src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointResponse.kt +src/main/kotlin/org/openapitools/client/models/GetPartiesInvolvedEndpointRequest.kt +src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointRequest.kt +src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointRequestQuery.kt +src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponse.kt +src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponseEventsInner.kt +src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponseEventsInnerArchived.kt +src/main/kotlin/org/openapitools/client/models/QueryRawIOUEndpointRequest.kt diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION new file mode 100644 index 00000000000..cd802a1ec4e --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/README.md b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/README.md new file mode 100644 index 00000000000..11e8933d10a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/README.md @@ -0,0 +1,76 @@ +# org.openapitools.client - Kotlin client library for Hyperledger Cacti Plugin - Connector DAML + +Can perform basic tasks on a DAML ledger + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 2.0.0-rc.3 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + +## Requires + +* Kotlin 1.7.21 +* Gradle 7.5 + +## Build + +First, create the gradle wrapper script: + +``` +gradle wrapper +``` + +Then, run: + +``` +./gradlew check assemble +``` + +This runs all tests and packages the library. + +## Features/Implementation Notes + +* Supports JSON inputs/outputs, File inputs, and Form inputs. +* Supports collection formats for query parameters: csv, tsv, ssv, pipes. +* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. +* Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets. + + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**createIou**](docs/DefaultApi.md#createiou) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint | This method creates a simple iou countract +*DefaultApi* | [**exerciseChoice**](docs/DefaultApi.md#exercisechoice) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint | This method exercise choices(DAML term for function on contracts) for iou countract +*DefaultApi* | [**getPartiesInvolved**](docs/DefaultApi.md#getpartiesinvolved) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint | This method queries all the parties that is included on IOU contract +*DefaultApi* | [**queryContract**](docs/DefaultApi.md#querycontract) | **POST** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint | This method queries DAML contracts +*DefaultApi* | [**queryRawContract**](docs/DefaultApi.md#queryrawcontract) | **GET** /api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint | This method queries DAML contracts that does not include request body + + + +## Documentation for Models + + - [org.openapitools.client.models.CreateIOUEndpointRequest](docs/CreateIOUEndpointRequest.md) + - [org.openapitools.client.models.CreateIOUEndpointRequestPayload](docs/CreateIOUEndpointRequestPayload.md) + - [org.openapitools.client.models.CreateIOUEndpointResponse](docs/CreateIOUEndpointResponse.md) + - [org.openapitools.client.models.ExerciseIOUEndpointRequest](docs/ExerciseIOUEndpointRequest.md) + - [org.openapitools.client.models.ExerciseIOUEndpointRequestArgument](docs/ExerciseIOUEndpointRequestArgument.md) + - [org.openapitools.client.models.ExerciseIOUEndpointResponse](docs/ExerciseIOUEndpointResponse.md) + - [org.openapitools.client.models.GetPartiesInvolvedEndpointRequest](docs/GetPartiesInvolvedEndpointRequest.md) + - [org.openapitools.client.models.QueryIOUEndpointRequest](docs/QueryIOUEndpointRequest.md) + - [org.openapitools.client.models.QueryIOUEndpointRequestQuery](docs/QueryIOUEndpointRequestQuery.md) + - [org.openapitools.client.models.QueryIOUEndpointResponse](docs/QueryIOUEndpointResponse.md) + - [org.openapitools.client.models.QueryIOUEndpointResponseEventsInner](docs/QueryIOUEndpointResponseEventsInner.md) + - [org.openapitools.client.models.QueryIOUEndpointResponseEventsInnerArchived](docs/QueryIOUEndpointResponseEventsInnerArchived.md) + - [org.openapitools.client.models.QueryRawIOUEndpointRequest](docs/QueryRawIOUEndpointRequest.md) + + + +## Documentation for Authorization + +Endpoints do not require authorization. + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/build.gradle b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/build.gradle new file mode 100644 index 00000000000..66a3c68b890 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/build.gradle @@ -0,0 +1,38 @@ +group 'org.openapitools' +version '1.0.0' + +wrapper { + gradleVersion = '7.5' + distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" +} + +buildscript { + ext.kotlin_version = '1.7.21' + + repositories { + maven { url "https://repo1.maven.org/maven2" } + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'kotlin' +apply plugin: 'maven-publish' + +repositories { + maven { url "https://repo1.maven.org/maven2" } +} + +test { + useJUnitPlatform() +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.squareup.moshi:moshi-kotlin:1.13.0" + implementation "com.squareup.moshi:moshi-adapters:1.13.0" + implementation "com.squareup.okhttp3:okhttp:4.10.0" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/gradlew b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/gradlew new file mode 100644 index 00000000000..aeb74cbb43e --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/gradlew @@ -0,0 +1,245 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/gradlew.bat b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/gradlew.bat new file mode 100644 index 00000000000..93e3f59f135 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/settings.gradle b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/settings.gradle new file mode 100644 index 00000000000..391dcea81db --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/settings.gradle @@ -0,0 +1,2 @@ + +rootProject.name = 'kotlin-client' \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt new file mode 100644 index 00000000000..0f3836d95ac --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt @@ -0,0 +1,418 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.apis + +import java.io.IOException +import okhttp3.OkHttpClient +import okhttp3.HttpUrl + +import org.openapitools.client.models.CreateIOUEndpointRequest +import org.openapitools.client.models.CreateIOUEndpointResponse +import org.openapitools.client.models.ExerciseIOUEndpointRequest +import org.openapitools.client.models.ExerciseIOUEndpointResponse +import org.openapitools.client.models.GetPartiesInvolvedEndpointRequest +import org.openapitools.client.models.QueryIOUEndpointRequest +import org.openapitools.client.models.QueryIOUEndpointResponse +import org.openapitools.client.models.QueryRawIOUEndpointRequest + +import com.squareup.moshi.Json + +import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ApiResponse +import org.openapitools.client.infrastructure.ClientException +import org.openapitools.client.infrastructure.ClientError +import org.openapitools.client.infrastructure.ServerException +import org.openapitools.client.infrastructure.ServerError +import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.PartConfig +import org.openapitools.client.infrastructure.RequestConfig +import org.openapitools.client.infrastructure.RequestMethod +import org.openapitools.client.infrastructure.ResponseType +import org.openapitools.client.infrastructure.Success +import org.openapitools.client.infrastructure.toMultiValue + +class DefaultApi(basePath: kotlin.String = defaultBasePath, client: OkHttpClient = ApiClient.defaultClient) : ApiClient(basePath, client) { + companion object { + @JvmStatic + val defaultBasePath: String by lazy { + System.getProperties().getProperty(ApiClient.baseUrlKey, "http://localhost") + } + } + + /** + * This method creates a simple iou countract + * + * @param createIOUEndpointRequest Request body for creation of iou + * @return CreateIOUEndpointResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun createIou(createIOUEndpointRequest: CreateIOUEndpointRequest) : CreateIOUEndpointResponse { + val localVarResponse = createIouWithHttpInfo(createIOUEndpointRequest = createIOUEndpointRequest) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as CreateIOUEndpointResponse + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * This method creates a simple iou countract + * + * @param createIOUEndpointRequest Request body for creation of iou + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun createIouWithHttpInfo(createIOUEndpointRequest: CreateIOUEndpointRequest) : ApiResponse { + val localVariableConfig = createIouRequestConfig(createIOUEndpointRequest = createIOUEndpointRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation createIou + * + * @param createIOUEndpointRequest Request body for creation of iou + * @return RequestConfig + */ + fun createIouRequestConfig(createIOUEndpointRequest: CreateIOUEndpointRequest) : RequestConfig { + val localVariableBody = createIOUEndpointRequest + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * This method exercise choices(DAML term for function on contracts) for iou countract + * + * @param exerciseIOUEndpointRequest Request body for exercising choice(DAML term for function on contracts) of iou + * @return ExerciseIOUEndpointResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun exerciseChoice(exerciseIOUEndpointRequest: ExerciseIOUEndpointRequest) : ExerciseIOUEndpointResponse { + val localVarResponse = exerciseChoiceWithHttpInfo(exerciseIOUEndpointRequest = exerciseIOUEndpointRequest) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as ExerciseIOUEndpointResponse + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * This method exercise choices(DAML term for function on contracts) for iou countract + * + * @param exerciseIOUEndpointRequest Request body for exercising choice(DAML term for function on contracts) of iou + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun exerciseChoiceWithHttpInfo(exerciseIOUEndpointRequest: ExerciseIOUEndpointRequest) : ApiResponse { + val localVariableConfig = exerciseChoiceRequestConfig(exerciseIOUEndpointRequest = exerciseIOUEndpointRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation exerciseChoice + * + * @param exerciseIOUEndpointRequest Request body for exercising choice(DAML term for function on contracts) of iou + * @return RequestConfig + */ + fun exerciseChoiceRequestConfig(exerciseIOUEndpointRequest: ExerciseIOUEndpointRequest) : RequestConfig { + val localVariableBody = exerciseIOUEndpointRequest + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * This method queries all the parties that is included on IOU contract + * + * @param getPartiesInvolvedEndpointRequest Request body for getting the parties involved in daml instance + * @return QueryIOUEndpointResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getPartiesInvolved(getPartiesInvolvedEndpointRequest: GetPartiesInvolvedEndpointRequest) : QueryIOUEndpointResponse { + val localVarResponse = getPartiesInvolvedWithHttpInfo(getPartiesInvolvedEndpointRequest = getPartiesInvolvedEndpointRequest) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as QueryIOUEndpointResponse + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * This method queries all the parties that is included on IOU contract + * + * @param getPartiesInvolvedEndpointRequest Request body for getting the parties involved in daml instance + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun getPartiesInvolvedWithHttpInfo(getPartiesInvolvedEndpointRequest: GetPartiesInvolvedEndpointRequest) : ApiResponse { + val localVariableConfig = getPartiesInvolvedRequestConfig(getPartiesInvolvedEndpointRequest = getPartiesInvolvedEndpointRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation getPartiesInvolved + * + * @param getPartiesInvolvedEndpointRequest Request body for getting the parties involved in daml instance + * @return RequestConfig + */ + fun getPartiesInvolvedRequestConfig(getPartiesInvolvedEndpointRequest: GetPartiesInvolvedEndpointRequest) : RequestConfig { + val localVariableBody = getPartiesInvolvedEndpointRequest + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * This method queries DAML contracts + * + * @param queryIOUEndpointRequest Request body for creation of iou + * @return QueryIOUEndpointResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun queryContract(queryIOUEndpointRequest: QueryIOUEndpointRequest) : QueryIOUEndpointResponse { + val localVarResponse = queryContractWithHttpInfo(queryIOUEndpointRequest = queryIOUEndpointRequest) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as QueryIOUEndpointResponse + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * This method queries DAML contracts + * + * @param queryIOUEndpointRequest Request body for creation of iou + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun queryContractWithHttpInfo(queryIOUEndpointRequest: QueryIOUEndpointRequest) : ApiResponse { + val localVariableConfig = queryContractRequestConfig(queryIOUEndpointRequest = queryIOUEndpointRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation queryContract + * + * @param queryIOUEndpointRequest Request body for creation of iou + * @return RequestConfig + */ + fun queryContractRequestConfig(queryIOUEndpointRequest: QueryIOUEndpointRequest) : RequestConfig { + val localVariableBody = queryIOUEndpointRequest + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.POST, + path = "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + /** + * This method queries DAML contracts that does not include request body + * + * @param queryRawIOUEndpointRequest Request for querying IOU contracts + * @return QueryIOUEndpointResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun queryRawContract(queryRawIOUEndpointRequest: QueryRawIOUEndpointRequest) : QueryIOUEndpointResponse { + val localVarResponse = queryRawContractWithHttpInfo(queryRawIOUEndpointRequest = queryRawIOUEndpointRequest) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as QueryIOUEndpointResponse + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse) + } + } + } + + /** + * This method queries DAML contracts that does not include request body + * + * @param queryRawIOUEndpointRequest Request for querying IOU contracts + * @return ApiResponse + * @throws IllegalStateException If the request is not correctly configured + * @throws IOException Rethrows the OkHttp execute method exception + */ + @Suppress("UNCHECKED_CAST") + @Throws(IllegalStateException::class, IOException::class) + fun queryRawContractWithHttpInfo(queryRawIOUEndpointRequest: QueryRawIOUEndpointRequest) : ApiResponse { + val localVariableConfig = queryRawContractRequestConfig(queryRawIOUEndpointRequest = queryRawIOUEndpointRequest) + + return request( + localVariableConfig + ) + } + + /** + * To obtain the request config of the operation queryRawContract + * + * @param queryRawIOUEndpointRequest Request for querying IOU contracts + * @return RequestConfig + */ + fun queryRawContractRequestConfig(queryRawIOUEndpointRequest: QueryRawIOUEndpointRequest) : RequestConfig { + val localVariableBody = queryRawIOUEndpointRequest + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + return RequestConfig( + method = RequestMethod.GET, + path = "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + private fun encodeURIComponent(uriComponent: kotlin.String): kotlin.String = + HttpUrl.Builder().scheme("http").host("localhost").addPathSegment(uriComponent).build().encodedPathSegments[0] +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt new file mode 100644 index 00000000000..ef7a8f1e1a6 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -0,0 +1,23 @@ +package org.openapitools.client.infrastructure + +typealias MultiValueMap = MutableMap> + +fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { + "csv" -> "," + "tsv" -> "\t" + "pipe" -> "|" + "space" -> " " + else -> "" +} + +val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } + +fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) + = toMultiValue(items.asIterable(), collectionFormat, map) + +fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { + return when(collectionFormat) { + "multi" -> items.map(map) + else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) + } +} \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt new file mode 100644 index 00000000000..ea4b7b65935 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -0,0 +1,245 @@ +package org.openapitools.client.infrastructure + +import okhttp3.OkHttpClient +import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.asRequestBody +import okhttp3.RequestBody.Companion.toRequestBody +import okhttp3.FormBody +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull +import okhttp3.ResponseBody +import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.Request +import okhttp3.Headers +import okhttp3.Headers.Companion.toHeaders +import okhttp3.MultipartBody +import okhttp3.Call +import okhttp3.Callback +import okhttp3.Response +import okhttp3.internal.EMPTY_REQUEST +import java.io.BufferedWriter +import java.io.File +import java.io.FileWriter +import java.io.IOException +import java.net.URLConnection +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.LocalTime +import java.time.OffsetDateTime +import java.time.OffsetTime +import java.util.Locale +import com.squareup.moshi.adapter + +open class ApiClient(val baseUrl: String, val client: OkHttpClient = defaultClient) { + companion object { + protected const val ContentType = "Content-Type" + protected const val Accept = "Accept" + protected const val Authorization = "Authorization" + protected const val JsonMediaType = "application/json" + protected const val FormDataMediaType = "multipart/form-data" + protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" + protected const val XmlMediaType = "application/xml" + + val apiKey: MutableMap = mutableMapOf() + val apiKeyPrefix: MutableMap = mutableMapOf() + var username: String? = null + var password: String? = null + var accessToken: String? = null + const val baseUrlKey = "org.openapitools.client.baseUrl" + + @JvmStatic + val defaultClient: OkHttpClient by lazy { + builder.build() + } + + @JvmStatic + val builder: OkHttpClient.Builder = OkHttpClient.Builder() + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + protected fun guessContentTypeFromFile(file: File): String { + val contentType = URLConnection.guessContentTypeFromName(file.name) + return contentType ?: "application/octet-stream" + } + + protected inline fun requestBody(content: T, mediaType: String?): RequestBody = + when { + content is File -> content.asRequestBody((mediaType ?: guessContentTypeFromFile(content)).toMediaTypeOrNull()) + mediaType == FormDataMediaType -> + MultipartBody.Builder() + .setType(MultipartBody.FORM) + .apply { + // content's type *must* be Map> + @Suppress("UNCHECKED_CAST") + (content as Map>).forEach { (name, part) -> + if (part.body is File) { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"; filename=\"${part.body.name}\"") + val fileMediaType = guessContentTypeFromFile(part.body).toMediaTypeOrNull() + addPart( + partHeaders.toHeaders(), + part.body.asRequestBody(fileMediaType) + ) + } else { + val partHeaders = part.headers.toMutableMap() + + ("Content-Disposition" to "form-data; name=\"$name\"") + addPart( + partHeaders.toHeaders(), + parameterToString(part.body).toRequestBody(null) + ) + } + } + }.build() + mediaType == FormUrlEncMediaType -> { + FormBody.Builder().apply { + // content's type *must* be Map> + @Suppress("UNCHECKED_CAST") + (content as Map>).forEach { (name, part) -> + add(name, parameterToString(part.body)) + } + }.build() + } + mediaType == null || mediaType.startsWith("application/") && mediaType.endsWith("json") -> + if (content == null) { + EMPTY_REQUEST + } else { + Serializer.moshi.adapter(T::class.java).toJson(content) + .toRequestBody((mediaType ?: JsonMediaType).toMediaTypeOrNull()) + } + mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") + // TODO: this should be extended with other serializers + else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") + } + + @OptIn(ExperimentalStdlibApi::class) + protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { + if(body == null) { + return null + } + if (T::class.java == File::class.java) { + // return tempFile + // Attention: if you are developing an android app that supports API Level 25 and bellow, please check flag supportAndroidApiLevel25AndBelow in https://openapi-generator.tech/docs/generators/kotlin#config-options + val tempFile = java.nio.file.Files.createTempFile("tmp.org.openapitools.client", null).toFile() + tempFile.deleteOnExit() + body.byteStream().use { inputStream -> + tempFile.outputStream().use { tempFileOutputStream -> + inputStream.copyTo(tempFileOutputStream) + } + } + return tempFile as T + } + val bodyContent = body.string() + if (bodyContent.isEmpty()) { + return null + } + return when { + mediaType==null || (mediaType.startsWith("application/") && mediaType.endsWith("json")) -> + Serializer.moshi.adapter().fromJson(bodyContent) + else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") + } + } + + + protected inline fun request(requestConfig: RequestConfig): ApiResponse { + val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") + + val url = httpUrl.newBuilder() + .addEncodedPathSegments(requestConfig.path.trimStart('/')) + .apply { + requestConfig.query.forEach { query -> + query.value.forEach { queryValue -> + addQueryParameter(query.key, queryValue) + } + } + }.build() + + // take content-type/accept from spec or set to default (application/json) if not defined + if (requestConfig.body != null && requestConfig.headers[ContentType].isNullOrEmpty()) { + requestConfig.headers[ContentType] = JsonMediaType + } + if (requestConfig.headers[Accept].isNullOrEmpty()) { + requestConfig.headers[Accept] = JsonMediaType + } + val headers = requestConfig.headers + + if (headers[Accept].isNullOrEmpty()) { + throw kotlin.IllegalStateException("Missing Accept header. This is required.") + } + + val contentType = if (headers[ContentType] != null) { + // TODO: support multiple contentType options here. + (headers[ContentType] as String).substringBefore(";").lowercase(Locale.US) + } else { + null + } + + val request = when (requestConfig.method) { + RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType)) + RequestMethod.GET -> Request.Builder().url(url) + RequestMethod.HEAD -> Request.Builder().url(url).head() + RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType)) + RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType)) + RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType)) + RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) + }.apply { + headers.forEach { header -> addHeader(header.key, header.value) } + }.build() + + val response = client.newCall(request).execute() + + val accept = response.header(ContentType)?.substringBefore(";")?.lowercase(Locale.US) + + // TODO: handle specific mapping types. e.g. Map> + return when { + response.isRedirect -> Redirection( + response.code, + response.headers.toMultimap() + ) + response.isInformational -> Informational( + response.message, + response.code, + response.headers.toMultimap() + ) + response.isSuccessful -> Success( + responseBody(response.body, accept), + response.code, + response.headers.toMultimap() + ) + response.isClientError -> ClientError( + response.message, + response.body?.string(), + response.code, + response.headers.toMultimap() + ) + else -> ServerError( + response.message, + response.body?.string(), + response.code, + response.headers.toMultimap() + ) + } + } + + protected fun parameterToString(value: Any?): String = when (value) { + null -> "" + is Array<*> -> toMultiValue(value, "csv").toString() + is Iterable<*> -> toMultiValue(value, "csv").toString() + is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime -> + parseDateToQueryString(value) + else -> value.toString() + } + + protected inline fun parseDateToQueryString(value : T): String { + /* + .replace("\"", "") converts the json object string to an actual string for the query parameter. + The moshi or gson adapter allows a more generic solution instead of trying to use a native + formatter. It also easily allows to provide a simple way to define a custom date format pattern + inside a gson/moshi adapter. + */ + return Serializer.moshi.adapter(T::class.java).toJson(value).replace("\"", "") + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt new file mode 100644 index 00000000000..cf2cfaa95d9 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ApiResponse.kt @@ -0,0 +1,43 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +interface Response + +abstract class ApiResponse(val responseType: ResponseType): Response { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.Redirection) + +class ClientError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiResponse(ResponseType.ServerError) diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt new file mode 100644 index 00000000000..064b57fc6b8 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigDecimalAdapter.kt @@ -0,0 +1,17 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.math.BigDecimal + +class BigDecimalAdapter { + @ToJson + fun toJson(value: BigDecimal): String { + return value.toPlainString() + } + + @FromJson + fun fromJson(value: String): BigDecimal { + return BigDecimal(value) + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt new file mode 100644 index 00000000000..7df6057b450 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/BigIntegerAdapter.kt @@ -0,0 +1,17 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.math.BigInteger + +class BigIntegerAdapter { + @ToJson + fun toJson(value: BigInteger): String { + return value.toString() + } + + @FromJson + fun fromJson(value: String): BigInteger { + return BigInteger(value) + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt new file mode 100644 index 00000000000..ff5e2a81ee8 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -0,0 +1,12 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson + +class ByteArrayAdapter { + @ToJson + fun toJson(data: ByteArray): String = String(data) + + @FromJson + fun fromJson(data: String): ByteArray = data.toByteArray() +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt new file mode 100644 index 00000000000..b5310e71f13 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -0,0 +1,18 @@ +@file:Suppress("unused") +package org.openapitools.client.infrastructure + +import java.lang.RuntimeException + +open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { + + companion object { + private const val serialVersionUID: Long = 123L + } +} + +open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) { + + companion object { + private const val serialVersionUID: Long = 456L + } +} \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt new file mode 100644 index 00000000000..b2e1654479a --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.LocalDate +import java.time.format.DateTimeFormatter + +class LocalDateAdapter { + @ToJson + fun toJson(value: LocalDate): String { + return DateTimeFormatter.ISO_LOCAL_DATE.format(value) + } + + @FromJson + fun fromJson(value: String): LocalDate { + return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) + } + +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt new file mode 100644 index 00000000000..e082db94811 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter + +class LocalDateTimeAdapter { + @ToJson + fun toJson(value: LocalDateTime): String { + return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) + } + + @FromJson + fun fromJson(value: String): LocalDateTime { + return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) + } + +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt new file mode 100644 index 00000000000..87437871a31 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter + +class OffsetDateTimeAdapter { + @ToJson + fun toJson(value: OffsetDateTime): String { + return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) + } + + @FromJson + fun fromJson(value: String): OffsetDateTime { + return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) + } + +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 00000000000..be00e38fbae --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt new file mode 100644 index 00000000000..625a19002b5 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -0,0 +1,18 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given request. + * NOTE: This object doesn't include 'body' because it + * allows for caching of the constructed object + * for many request definitions. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class RequestConfig( + val method: RequestMethod, + val path: String, + val headers: MutableMap = mutableMapOf(), + val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, + val body: T? = null +) \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt new file mode 100644 index 00000000000..931b12b8bd7 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -0,0 +1,8 @@ +package org.openapitools.client.infrastructure + +/** + * Provides enumerated HTTP verbs + */ +enum class RequestMethod { + GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT +} \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt new file mode 100644 index 00000000000..9bd2790dc14 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -0,0 +1,24 @@ +package org.openapitools.client.infrastructure + +import okhttp3.Response + +/** + * Provides an extension to evaluation whether the response is a 1xx code + */ +val Response.isInformational : Boolean get() = this.code in 100..199 + +/** + * Provides an extension to evaluation whether the response is a 3xx code + */ +@Suppress("EXTENSION_SHADOWED_BY_MEMBER") +val Response.isRedirect : Boolean get() = this.code in 300..399 + +/** + * Provides an extension to evaluation whether the response is a 4xx code + */ +val Response.isClientError : Boolean get() = this.code in 400..499 + +/** + * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code + */ +val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt new file mode 100644 index 00000000000..e22592e47d7 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -0,0 +1,23 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.Moshi +import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory + +object Serializer { + @JvmStatic + val moshiBuilder: Moshi.Builder = Moshi.Builder() + .add(OffsetDateTimeAdapter()) + .add(LocalDateTimeAdapter()) + .add(LocalDateAdapter()) + .add(UUIDAdapter()) + .add(ByteArrayAdapter()) + .add(URIAdapter()) + .add(KotlinJsonAdapterFactory()) + .add(BigDecimalAdapter()) + .add(BigIntegerAdapter()) + + @JvmStatic + val moshi: Moshi by lazy { + moshiBuilder.build() + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt new file mode 100644 index 00000000000..927522757da --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/URIAdapter.kt @@ -0,0 +1,13 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.net.URI + +class URIAdapter { + @ToJson + fun toJson(uri: URI) = uri.toString() + + @FromJson + fun fromJson(s: String): URI = URI.create(s) +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt new file mode 100644 index 00000000000..7ccf7dc25d2 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -0,0 +1,13 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.util.UUID + +class UUIDAdapter { + @ToJson + fun toJson(uuid: UUID) = uuid.toString() + + @FromJson + fun fromJson(s: String): UUID = UUID.fromString(s) +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointRequest.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointRequest.kt new file mode 100644 index 00000000000..529658ddaf0 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointRequest.kt @@ -0,0 +1,44 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.CreateIOUEndpointRequestPayload + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * This method is the request for creating a simple IOU contract. + * + * @param templateId + * @param participantToken + * @param payload + */ + + +data class CreateIOUEndpointRequest ( + + @Json(name = "templateId") + val templateId: kotlin.String? = null, + + @Json(name = "participantToken") + val participantToken: kotlin.String? = null, + + @Json(name = "payload") + val payload: CreateIOUEndpointRequestPayload? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointRequestPayload.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointRequestPayload.kt new file mode 100644 index 00000000000..c1938d37049 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointRequestPayload.kt @@ -0,0 +1,51 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param issuer + * @param owner + * @param currency + * @param amount + * @param observers + */ + + +data class CreateIOUEndpointRequestPayload ( + + @Json(name = "issuer") + val issuer: kotlin.String? = null, + + @Json(name = "owner") + val owner: kotlin.String? = null, + + @Json(name = "currency") + val currency: kotlin.String? = null, + + @Json(name = "amount") + val amount: kotlin.String? = null, + + @Json(name = "observers") + val observers: kotlin.collections.List? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointResponse.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointResponse.kt new file mode 100644 index 00000000000..bb381080a9c --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/CreateIOUEndpointResponse.kt @@ -0,0 +1,60 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.CreateIOUEndpointRequestPayload + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * This method is the response for creating a simple IOU contract. + * + * @param agreementText + * @param completionOffset + * @param contractId + * @param observers + * @param templateId + * @param signatories + * @param payload + */ + + +data class CreateIOUEndpointResponse ( + + @Json(name = "agreementText") + val agreementText: kotlin.String? = null, + + @Json(name = "completionOffset") + val completionOffset: kotlin.String? = null, + + @Json(name = "contractId") + val contractId: kotlin.String? = null, + + @Json(name = "observers") + val observers: kotlin.collections.List? = null, + + @Json(name = "templateId") + val templateId: kotlin.String? = null, + + @Json(name = "signatories") + val signatories: kotlin.collections.List? = null, + + @Json(name = "payload") + val payload: CreateIOUEndpointRequestPayload? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointRequest.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointRequest.kt new file mode 100644 index 00000000000..1d7bac192df --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointRequest.kt @@ -0,0 +1,52 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.ExerciseIOUEndpointRequestArgument + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * This method is the request for creating a simple IOU contract. + * + * @param previousParticipantToken + * @param templateId + * @param contractId + * @param choice + * @param argument + */ + + +data class ExerciseIOUEndpointRequest ( + + @Json(name = "previousParticipantToken") + val previousParticipantToken: kotlin.String? = null, + + @Json(name = "templateId") + val templateId: kotlin.String? = null, + + @Json(name = "contractId") + val contractId: kotlin.String? = null, + + @Json(name = "choice") + val choice: kotlin.String? = null, + + @Json(name = "argument") + val argument: ExerciseIOUEndpointRequestArgument? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointRequestArgument.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointRequestArgument.kt new file mode 100644 index 00000000000..6517215a636 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointRequestArgument.kt @@ -0,0 +1,35 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param newOwner + */ + + +data class ExerciseIOUEndpointRequestArgument ( + + @Json(name = "newOwner") + val newOwner: kotlin.String? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointResponse.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointResponse.kt new file mode 100644 index 00000000000..5dfac873ed0 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/ExerciseIOUEndpointResponse.kt @@ -0,0 +1,40 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.QueryIOUEndpointResponseEventsInner + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * This method is the request for creating a simple IOU contract. + * + * @param completionOffset + * @param events + */ + + +data class ExerciseIOUEndpointResponse ( + + @Json(name = "completionOffset") + val completionOffset: kotlin.String? = null, + + @Json(name = "events") + val events: kotlin.collections.List? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetPartiesInvolvedEndpointRequest.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetPartiesInvolvedEndpointRequest.kt new file mode 100644 index 00000000000..f103f09d202 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/GetPartiesInvolvedEndpointRequest.kt @@ -0,0 +1,35 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * This method is the request for getting all of the parties involved upon starting daml. + * + * @param participantToken + */ + + +data class GetPartiesInvolvedEndpointRequest ( + + @Json(name = "participantToken") + val participantToken: kotlin.String? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointRequest.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointRequest.kt new file mode 100644 index 00000000000..e743c82d001 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointRequest.kt @@ -0,0 +1,48 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.QueryIOUEndpointRequestQuery + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * This method is the request for querying a simple IOU contract. + * + * @param participantToken + * @param templateIds + * @param query + * @param readers + */ + + +data class QueryIOUEndpointRequest ( + + @Json(name = "participantToken") + val participantToken: kotlin.String? = null, + + @Json(name = "templateIds") + val templateIds: kotlin.collections.List? = null, + + @Json(name = "query") + val query: QueryIOUEndpointRequestQuery? = null, + + @Json(name = "readers") + val readers: kotlin.collections.List? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointRequestQuery.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointRequestQuery.kt new file mode 100644 index 00000000000..a63b2345d7f --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointRequestQuery.kt @@ -0,0 +1,35 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param amount + */ + + +data class QueryIOUEndpointRequestQuery ( + + @Json(name = "amount") + val amount: java.math.BigDecimal? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponse.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponse.kt new file mode 100644 index 00000000000..5a2bba35041 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponse.kt @@ -0,0 +1,40 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.QueryIOUEndpointResponseEventsInner + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * This method is the response for querying a simple IOU contract. + * + * @param completionOffset + * @param events + */ + + +data class QueryIOUEndpointResponse ( + + @Json(name = "completionOffset") + val completionOffset: kotlin.String? = null, + + @Json(name = "events") + val events: kotlin.collections.List? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponseEventsInner.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponseEventsInner.kt new file mode 100644 index 00000000000..ff50c4b8882 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponseEventsInner.kt @@ -0,0 +1,36 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.QueryIOUEndpointResponseEventsInnerArchived + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param archived + */ + + +data class QueryIOUEndpointResponseEventsInner ( + + @Json(name = "archived") + val archived: QueryIOUEndpointResponseEventsInnerArchived? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponseEventsInnerArchived.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponseEventsInnerArchived.kt new file mode 100644 index 00000000000..4f2758cab83 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryIOUEndpointResponseEventsInnerArchived.kt @@ -0,0 +1,39 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * + * + * @param contractId + * @param templateId + */ + + +data class QueryIOUEndpointResponseEventsInnerArchived ( + + @Json(name = "contractId") + val contractId: kotlin.String? = null, + + @Json(name = "templateId") + val templateId: kotlin.String? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryRawIOUEndpointRequest.kt b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryRawIOUEndpointRequest.kt new file mode 100644 index 00000000000..b379069e75b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/kotlin/generated/openapi/kotlin-client/src/main/kotlin/org/openapitools/client/models/QueryRawIOUEndpointRequest.kt @@ -0,0 +1,35 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.squareup.moshi.Json +import com.squareup.moshi.JsonClass + +/** + * This method is the request for querying a simple IOU contract. + * + * @param participantToken + */ + + +data class QueryRawIOUEndpointRequest ( + + @Json(name = "participantToken") + val participantToken: kotlin.String? = null + +) + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES new file mode 100644 index 00000000000..53250c02696 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES @@ -0,0 +1,5 @@ +api.ts +base.ts +common.ts +configuration.ts +index.ts diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION new file mode 100644 index 00000000000..cd802a1ec4e --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/api.ts new file mode 100644 index 00000000000..1785c7a90a9 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -0,0 +1,710 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector DAML + * Can perform basic tasks on a DAML ledger + * + * The version of the OpenAPI document: 2.0.0-rc.3 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; + +/** + * This method is the request for creating a simple IOU contract. + * @export + * @interface CreateIOUEndpointRequest + */ +export interface CreateIOUEndpointRequest { + /** + * + * @type {string} + * @memberof CreateIOUEndpointRequest + */ + 'templateId'?: string; + /** + * + * @type {string} + * @memberof CreateIOUEndpointRequest + */ + 'participantToken'?: string; + /** + * + * @type {CreateIOUEndpointRequestPayload} + * @memberof CreateIOUEndpointRequest + */ + 'payload'?: CreateIOUEndpointRequestPayload; +} +/** + * + * @export + * @interface CreateIOUEndpointRequestPayload + */ +export interface CreateIOUEndpointRequestPayload { + /** + * + * @type {string} + * @memberof CreateIOUEndpointRequestPayload + */ + 'issuer'?: string; + /** + * + * @type {string} + * @memberof CreateIOUEndpointRequestPayload + */ + 'owner'?: string; + /** + * + * @type {string} + * @memberof CreateIOUEndpointRequestPayload + */ + 'currency'?: string; + /** + * + * @type {string} + * @memberof CreateIOUEndpointRequestPayload + */ + 'amount'?: string; + /** + * + * @type {Array} + * @memberof CreateIOUEndpointRequestPayload + */ + 'observers'?: Array; +} +/** + * This method is the response for creating a simple IOU contract. + * @export + * @interface CreateIOUEndpointResponse + */ +export interface CreateIOUEndpointResponse { + /** + * + * @type {string} + * @memberof CreateIOUEndpointResponse + */ + 'agreementText'?: string; + /** + * + * @type {string} + * @memberof CreateIOUEndpointResponse + */ + 'completionOffset'?: string; + /** + * + * @type {string} + * @memberof CreateIOUEndpointResponse + */ + 'contractId'?: string; + /** + * + * @type {Array} + * @memberof CreateIOUEndpointResponse + */ + 'observers'?: Array; + /** + * + * @type {string} + * @memberof CreateIOUEndpointResponse + */ + 'templateId'?: string; + /** + * + * @type {Array} + * @memberof CreateIOUEndpointResponse + */ + 'signatories'?: Array; + /** + * + * @type {CreateIOUEndpointRequestPayload} + * @memberof CreateIOUEndpointResponse + */ + 'payload'?: CreateIOUEndpointRequestPayload; +} +/** + * This method is the request for creating a simple IOU contract. + * @export + * @interface ExerciseIOUEndpointRequest + */ +export interface ExerciseIOUEndpointRequest { + /** + * + * @type {string} + * @memberof ExerciseIOUEndpointRequest + */ + 'previousParticipantToken'?: string; + /** + * + * @type {string} + * @memberof ExerciseIOUEndpointRequest + */ + 'templateId'?: string; + /** + * + * @type {string} + * @memberof ExerciseIOUEndpointRequest + */ + 'contractId'?: string; + /** + * + * @type {string} + * @memberof ExerciseIOUEndpointRequest + */ + 'choice'?: string; + /** + * + * @type {ExerciseIOUEndpointRequestArgument} + * @memberof ExerciseIOUEndpointRequest + */ + 'argument'?: ExerciseIOUEndpointRequestArgument; +} +/** + * + * @export + * @interface ExerciseIOUEndpointRequestArgument + */ +export interface ExerciseIOUEndpointRequestArgument { + /** + * + * @type {string} + * @memberof ExerciseIOUEndpointRequestArgument + */ + 'newOwner'?: string; +} +/** + * This method is the request for creating a simple IOU contract. + * @export + * @interface ExerciseIOUEndpointResponse + */ +export interface ExerciseIOUEndpointResponse { + /** + * + * @type {string} + * @memberof ExerciseIOUEndpointResponse + */ + 'completionOffset'?: string; + /** + * + * @type {Array} + * @memberof ExerciseIOUEndpointResponse + */ + 'events'?: Array; +} +/** + * This method is the request for getting all of the parties involved upon starting daml. + * @export + * @interface GetPartiesInvolvedEndpointRequest + */ +export interface GetPartiesInvolvedEndpointRequest { + /** + * + * @type {string} + * @memberof GetPartiesInvolvedEndpointRequest + */ + 'participantToken'?: string; +} +/** + * This method is the request for querying a simple IOU contract. + * @export + * @interface QueryIOUEndpointRequest + */ +export interface QueryIOUEndpointRequest { + /** + * + * @type {string} + * @memberof QueryIOUEndpointRequest + */ + 'participantToken'?: string; + /** + * + * @type {Array} + * @memberof QueryIOUEndpointRequest + */ + 'templateIds'?: Array; + /** + * + * @type {QueryIOUEndpointRequestQuery} + * @memberof QueryIOUEndpointRequest + */ + 'query'?: QueryIOUEndpointRequestQuery; + /** + * + * @type {Array} + * @memberof QueryIOUEndpointRequest + */ + 'readers'?: Array; +} +/** + * + * @export + * @interface QueryIOUEndpointRequestQuery + */ +export interface QueryIOUEndpointRequestQuery { + /** + * + * @type {number} + * @memberof QueryIOUEndpointRequestQuery + */ + 'amount'?: number; +} +/** + * This method is the response for querying a simple IOU contract. + * @export + * @interface QueryIOUEndpointResponse + */ +export interface QueryIOUEndpointResponse { + /** + * + * @type {string} + * @memberof QueryIOUEndpointResponse + */ + 'completionOffset'?: string; + /** + * + * @type {Array} + * @memberof QueryIOUEndpointResponse + */ + 'events'?: Array; +} +/** + * + * @export + * @interface QueryIOUEndpointResponseEventsInner + */ +export interface QueryIOUEndpointResponseEventsInner { + /** + * + * @type {QueryIOUEndpointResponseEventsInnerArchived} + * @memberof QueryIOUEndpointResponseEventsInner + */ + 'archived'?: QueryIOUEndpointResponseEventsInnerArchived; +} +/** + * + * @export + * @interface QueryIOUEndpointResponseEventsInnerArchived + */ +export interface QueryIOUEndpointResponseEventsInnerArchived { + /** + * + * @type {string} + * @memberof QueryIOUEndpointResponseEventsInnerArchived + */ + 'contractId'?: string; + /** + * + * @type {string} + * @memberof QueryIOUEndpointResponseEventsInnerArchived + */ + 'templateId'?: string; +} +/** + * This method is the request for querying a simple IOU contract. + * @export + * @interface QueryRawIOUEndpointRequest + */ +export interface QueryRawIOUEndpointRequest { + /** + * + * @type {string} + * @memberof QueryRawIOUEndpointRequest + */ + 'participantToken'?: string; +} + +/** + * DefaultApi - axios parameter creator + * @export + */ +export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary This method creates a simple iou countract + * @param {CreateIOUEndpointRequest} createIOUEndpointRequest Request body for creation of iou + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createIou: async (createIOUEndpointRequest: CreateIOUEndpointRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'createIOUEndpointRequest' is not null or undefined + assertParamExists('createIou', 'createIOUEndpointRequest', createIOUEndpointRequest) + const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(createIOUEndpointRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary This method exercise choices(DAML term for function on contracts) for iou countract + * @param {ExerciseIOUEndpointRequest} exerciseIOUEndpointRequest Request body for exercising choice(DAML term for function on contracts) of iou + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + exerciseChoice: async (exerciseIOUEndpointRequest: ExerciseIOUEndpointRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'exerciseIOUEndpointRequest' is not null or undefined + assertParamExists('exerciseChoice', 'exerciseIOUEndpointRequest', exerciseIOUEndpointRequest) + const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(exerciseIOUEndpointRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary This method queries all the parties that is included on IOU contract + * @param {GetPartiesInvolvedEndpointRequest} getPartiesInvolvedEndpointRequest Request body for getting the parties involved in daml instance + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPartiesInvolved: async (getPartiesInvolvedEndpointRequest: GetPartiesInvolvedEndpointRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'getPartiesInvolvedEndpointRequest' is not null or undefined + assertParamExists('getPartiesInvolved', 'getPartiesInvolvedEndpointRequest', getPartiesInvolvedEndpointRequest) + const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(getPartiesInvolvedEndpointRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary This method queries DAML contracts + * @param {QueryIOUEndpointRequest} queryIOUEndpointRequest Request body for creation of iou + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + queryContract: async (queryIOUEndpointRequest: QueryIOUEndpointRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'queryIOUEndpointRequest' is not null or undefined + assertParamExists('queryContract', 'queryIOUEndpointRequest', queryIOUEndpointRequest) + const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(queryIOUEndpointRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary This method queries DAML contracts that does not include request body + * @param {QueryRawIOUEndpointRequest} queryRawIOUEndpointRequest Request for querying IOU contracts + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + queryRawContract: async (queryRawIOUEndpointRequest: QueryRawIOUEndpointRequest, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'queryRawIOUEndpointRequest' is not null or undefined + assertParamExists('queryRawContract', 'queryRawIOUEndpointRequest', queryRawIOUEndpointRequest) + const localVarPath = `/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(queryRawIOUEndpointRequest, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * DefaultApi - functional programming interface + * @export + */ +export const DefaultApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration) + return { + /** + * + * @summary This method creates a simple iou countract + * @param {CreateIOUEndpointRequest} createIOUEndpointRequest Request body for creation of iou + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createIou(createIOUEndpointRequest: CreateIOUEndpointRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createIou(createIOUEndpointRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary This method exercise choices(DAML term for function on contracts) for iou countract + * @param {ExerciseIOUEndpointRequest} exerciseIOUEndpointRequest Request body for exercising choice(DAML term for function on contracts) of iou + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async exerciseChoice(exerciseIOUEndpointRequest: ExerciseIOUEndpointRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.exerciseChoice(exerciseIOUEndpointRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary This method queries all the parties that is included on IOU contract + * @param {GetPartiesInvolvedEndpointRequest} getPartiesInvolvedEndpointRequest Request body for getting the parties involved in daml instance + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getPartiesInvolved(getPartiesInvolvedEndpointRequest: GetPartiesInvolvedEndpointRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getPartiesInvolved(getPartiesInvolvedEndpointRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary This method queries DAML contracts + * @param {QueryIOUEndpointRequest} queryIOUEndpointRequest Request body for creation of iou + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async queryContract(queryIOUEndpointRequest: QueryIOUEndpointRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.queryContract(queryIOUEndpointRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary This method queries DAML contracts that does not include request body + * @param {QueryRawIOUEndpointRequest} queryRawIOUEndpointRequest Request for querying IOU contracts + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async queryRawContract(queryRawIOUEndpointRequest: QueryRawIOUEndpointRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.queryRawContract(queryRawIOUEndpointRequest, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * DefaultApi - factory interface + * @export + */ +export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = DefaultApiFp(configuration) + return { + /** + * + * @summary This method creates a simple iou countract + * @param {CreateIOUEndpointRequest} createIOUEndpointRequest Request body for creation of iou + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createIou(createIOUEndpointRequest: CreateIOUEndpointRequest, options?: any): AxiosPromise { + return localVarFp.createIou(createIOUEndpointRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary This method exercise choices(DAML term for function on contracts) for iou countract + * @param {ExerciseIOUEndpointRequest} exerciseIOUEndpointRequest Request body for exercising choice(DAML term for function on contracts) of iou + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + exerciseChoice(exerciseIOUEndpointRequest: ExerciseIOUEndpointRequest, options?: any): AxiosPromise { + return localVarFp.exerciseChoice(exerciseIOUEndpointRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary This method queries all the parties that is included on IOU contract + * @param {GetPartiesInvolvedEndpointRequest} getPartiesInvolvedEndpointRequest Request body for getting the parties involved in daml instance + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPartiesInvolved(getPartiesInvolvedEndpointRequest: GetPartiesInvolvedEndpointRequest, options?: any): AxiosPromise { + return localVarFp.getPartiesInvolved(getPartiesInvolvedEndpointRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary This method queries DAML contracts + * @param {QueryIOUEndpointRequest} queryIOUEndpointRequest Request body for creation of iou + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + queryContract(queryIOUEndpointRequest: QueryIOUEndpointRequest, options?: any): AxiosPromise { + return localVarFp.queryContract(queryIOUEndpointRequest, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary This method queries DAML contracts that does not include request body + * @param {QueryRawIOUEndpointRequest} queryRawIOUEndpointRequest Request for querying IOU contracts + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + queryRawContract(queryRawIOUEndpointRequest: QueryRawIOUEndpointRequest, options?: any): AxiosPromise { + return localVarFp.queryRawContract(queryRawIOUEndpointRequest, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * DefaultApi - object-oriented interface + * @export + * @class DefaultApi + * @extends {BaseAPI} + */ +export class DefaultApi extends BaseAPI { + /** + * + * @summary This method creates a simple iou countract + * @param {CreateIOUEndpointRequest} createIOUEndpointRequest Request body for creation of iou + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public createIou(createIOUEndpointRequest: CreateIOUEndpointRequest, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).createIou(createIOUEndpointRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary This method exercise choices(DAML term for function on contracts) for iou countract + * @param {ExerciseIOUEndpointRequest} exerciseIOUEndpointRequest Request body for exercising choice(DAML term for function on contracts) of iou + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public exerciseChoice(exerciseIOUEndpointRequest: ExerciseIOUEndpointRequest, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).exerciseChoice(exerciseIOUEndpointRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary This method queries all the parties that is included on IOU contract + * @param {GetPartiesInvolvedEndpointRequest} getPartiesInvolvedEndpointRequest Request body for getting the parties involved in daml instance + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public getPartiesInvolved(getPartiesInvolvedEndpointRequest: GetPartiesInvolvedEndpointRequest, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).getPartiesInvolved(getPartiesInvolvedEndpointRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary This method queries DAML contracts + * @param {QueryIOUEndpointRequest} queryIOUEndpointRequest Request body for creation of iou + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public queryContract(queryIOUEndpointRequest: QueryIOUEndpointRequest, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).queryContract(queryIOUEndpointRequest, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary This method queries DAML contracts that does not include request body + * @param {QueryRawIOUEndpointRequest} queryRawIOUEndpointRequest Request for querying IOU contracts + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public queryRawContract(queryRawIOUEndpointRequest: QueryRawIOUEndpointRequest, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).queryRawContract(queryRawIOUEndpointRequest, options).then((request) => request(this.axios, this.basePath)); + } +} + + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/base.ts new file mode 100644 index 00000000000..e52bee8614c --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -0,0 +1,72 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector DAML + * Can perform basic tasks on a DAML ledger + * + * The version of the OpenAPI document: 2.0.0-rc.3 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from './configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; + +export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: AxiosRequestConfig; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + constructor(public field: string, msg?: string) { + super(msg); + this.name = "RequiredError" + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/common.ts new file mode 100644 index 00000000000..682c6e20218 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -0,0 +1,150 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector DAML + * Can perform basic tasks on a DAML ledger + * + * The version of the OpenAPI document: 2.0.0-rc.3 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + setFlattenedQueryParams(searchParams, objects); + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/configuration.ts b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/configuration.ts new file mode 100644 index 00000000000..2763d520a71 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/configuration.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector DAML + * Can perform basic tasks on a DAML ledger + * + * The version of the OpenAPI document: 2.0.0-rc.3 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/index.ts b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/index.ts new file mode 100644 index 00000000000..befd7e3bc7b --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/generated/openapi/typescript-axios/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector DAML + * Can perform basic tasks on a DAML ledger + * + * The version of the OpenAPI document: 2.0.0-rc.3 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; + diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/plugin-ledger-connector-daml.ts b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/plugin-ledger-connector-daml.ts new file mode 100644 index 00000000000..018abae8912 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/plugin-ledger-connector-daml.ts @@ -0,0 +1,318 @@ +import type { Server } from "http"; +import type { Server as SecureServer } from "https"; +import type { Config as SshConfig } from "node-ssh"; +import type { Express } from "express"; +import OAS from "../json/openapi.json"; +import axios from 'axios'; + +import { + GetPartiesInvolvedEndpointRequest, + QueryIOUEndpointRequest, + QueryIOUEndpointResponse, + QueryRawIOUEndpointRequest, + CreateIOUEndpointRequest, + CreateIOUEndpointResponse, + ExerciseIOUEndpointRequest, + ExerciseIOUEndpointResponse +} from "./generated/openapi/typescript-axios"; + +import { + IPluginLedgerConnector, + IWebServiceEndpoint, + IPluginWebService, + ICactusPluginOptions, + ConsensusAlgorithmFamily, + ICactusPlugin +} from "@hyperledger/cactus-core-api"; +import { consensusHasTransactionFinality } from "@hyperledger/cactus-core"; +import { + Checks, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; + +import { + ICreateIOUEndpointOptions, + CreateIOUEndpoint +} from "./web-services/create-iou-endpoint"; + +import { + IExerciseIOUEndpointOptions, + ExerciseIOUEndpoint +} from "./web-services/exercise-iou-endpoint"; + +import { + IQueryIOUEndpointOptions, + QueryIOUEndpoint +} from "./web-services/query-iou-endpoint"; + +import { + IQueryRawIOUEndpointOptions, + QueryRawIOUEndpoint +} from "./web-services/query-raw-iou-endpoint"; + +import { + IGetPartiesInvolvedEndpointOptions, + GetPartiesInvolvedEndpoint +} from "./web-services/get-parties-involved-endpoint"; + +import fs from "fs"; +import fetch from "node-fetch"; +import https from "https"; +import * as crypto from 'crypto'; + +export interface IPluginLedgerConnectorDAMLOptions + extends ICactusPluginOptions { + logLevel?: LogLevelDesc; + apiUrl: string; + damlApiUrl?: string; +} + +export class PluginLedgerConnectorDAML + implements + IPluginLedgerConnector< + CreateIOUEndpointResponse, + CreateIOUEndpointRequest, + ExerciseIOUEndpointRequest, + ExerciseIOUEndpointResponse + >, + ICactusPlugin, + IPluginWebService +{ + + private readonly instanceId: string; + private readonly log: Logger; + private endpoints: IWebServiceEndpoint[] | undefined; + public readonly damlApiUrl: string; + + constructor(public readonly options: IPluginLedgerConnectorDAMLOptions) { + this.damlApiUrl = options.apiUrl || "https://127.0.0.1:8888"; + const level = options.logLevel || "INFO"; + const label = "plugin-ledger-connector-daml"; + this.log = LoggerProvider.getOrCreate({ level, label }); + + this.instanceId = this.options.instanceId; + } + + + public getPackageName(): string { + return "@hyperledger/cactus-plugin-ledger-connector-daml"; + } + + public async transact(): Promise { + return null as any; + } + + public async registerWebServices(app: Express): Promise { + const webServices = await this.getOrCreateWebServices(); + await Promise.all(webServices.map((ws) => ws.registerExpress(app))); + return webServices; + } + + public deployContract(): Promise { + throw new Error("Method not implemented."); + } + + public async hasTransactionFinality(): Promise { + const currentConsensusAlgorithmFamily = + await this.getConsensusAlgorithmFamily(); + + return consensusHasTransactionFinality(currentConsensusAlgorithmFamily); + } + + public async getOrCreateWebServices(): Promise { + if (Array.isArray(this.endpoints)) { + return this.endpoints; + } + const pkgName = this.getPackageName(); + this.log.info(`Instantiating web services for ${pkgName}...`); + const endpoints: IWebServiceEndpoint[] = []; + { + const opts: ICreateIOUEndpointOptions = { + apiUrl: this.options.apiUrl as string, + logLevel: this.options.logLevel, + connector: this, + }; + const endpoint = new CreateIOUEndpoint(opts); + endpoints.push(endpoint); + } + + { + const opts: IQueryIOUEndpointOptions = { + apiUrl: this.options.apiUrl as string, + logLevel: this.options.logLevel, + connector: this, + }; + const endpoint = new QueryIOUEndpoint(opts); + endpoints.push(endpoint); + } + + { + const opts: IQueryRawIOUEndpointOptions = { + apiUrl: this.options.apiUrl as string, + logLevel: this.options.logLevel, + connector: this, + }; + const endpoint = new QueryRawIOUEndpoint(opts); + endpoints.push(endpoint); + } + + { + const opts: IExerciseIOUEndpointOptions = { + apiUrl: this.options.apiUrl as string, + logLevel: this.options.logLevel, + connector: this, + }; + const endpoint = new ExerciseIOUEndpoint(opts); + endpoints.push(endpoint); + } + + { + const opts: IGetPartiesInvolvedEndpointOptions = { + apiUrl: this.options.apiUrl as string, + logLevel: this.options.logLevel, + connector: this, + }; + const endpoint = new GetPartiesInvolvedEndpoint(opts); + endpoints.push(endpoint); + } + + this.log.info(`Instantiated endpoints of ${pkgName}`); + return endpoints; + } + + public async shutdown(): Promise { + return; + } + + public getOpenApiSpec(): unknown { + return OAS; + } + + public getInstanceId(): string { + return this.instanceId; + } + + public async getConsensusAlgorithmFamily(): Promise { + return ConsensusAlgorithmFamily.Authority; + } + + public async onPluginInit(): Promise { + return; + } + + public async createContract(req: CreateIOUEndpointRequest): Promise { + const createIouUrl = `${this.damlApiUrl}/create` + let getRequestPayload = JSON.stringify(req.payload); + const parsePayload = JSON.parse(getRequestPayload) + const participantToken = req.participantToken + + const iouBody = { + templateId: req.templateId, + payload: req.payload + } + + const responseForIOU = await fetch(createIouUrl, { + method: "POST", + body: JSON.stringify(req), + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${participantToken}`, + }, + }); + const responseForIOUResult = await responseForIOU.json() + + return responseForIOUResult + } + + public async exerciseContract(req: ExerciseIOUEndpointRequest): Promise { + const exerciseIouUrl = `${this.damlApiUrl}/exercise` + let getRequestPayload = JSON.stringify(req); + const parsePayload = JSON.parse(getRequestPayload) + let participantHash = parsePayload.participantToken + const requestBody = { + templateId: parsePayload.templateId, + contractId: parsePayload.contractId, + choice: parsePayload.choice, + argument: parsePayload.argument + } + + const responseForIOU = await fetch(exerciseIouUrl, { + method: "POST", + body: JSON.stringify(requestBody), + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${participantHash}`, + }, + }); + const responseForIOUResult = await responseForIOU.json() + return responseForIOUResult + } + + public async queryContract(req: QueryIOUEndpointRequest): Promise { + const queryIOUUrl = `${this.damlApiUrl}/query` + + let getRequestPayload = JSON.stringify(req); + const parsePayload = JSON.parse(getRequestPayload) + let participantToken = parsePayload.participantToken + const requestBody = { + templateIds: parsePayload.templateIds, + query: parsePayload.query, + readers: parsePayload.readers + } + + const responseForIOU = await fetch(queryIOUUrl, { + method: "POST", + body: JSON.stringify(requestBody), + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${participantToken}`, + }, + }); + + const responseForIOUResult = await responseForIOU.json() + return responseForIOUResult + + } + + public async queryRawContract(req: QueryRawIOUEndpointRequest): Promise { + const queryIOUUrl = `${this.damlApiUrl}/query` + + let getRequestPayload = JSON.stringify(req); + const parsePayload = JSON.parse(getRequestPayload); + let participantToken = parsePayload.participantToken; + + const responseForIOU = await fetch(queryIOUUrl, { + method: "get", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${participantToken}`, + }, + }); + + const responseForIOUResult = await responseForIOU.json() + return responseForIOUResult + + } + + public async getPartiesInvolved(req: GetPartiesInvolvedEndpointRequest): Promise { + // Generate the sample token for 1 participant + let getRequestPayload = JSON.stringify(req); + const parsePayload = JSON.parse(getRequestPayload); + let participantToken = parsePayload.participantToken; + + const url = `${this.damlApiUrl}/parties` + const response = await fetch(url, { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${participantToken}`, + }, + }); + const responseBody = await response.json() + console.log(responseBody) + return JSON.stringify(responseBody.result) + } + +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/create-iou-endpoint.ts b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/create-iou-endpoint.ts new file mode 100644 index 00000000000..94027ccc930 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/create-iou-endpoint.ts @@ -0,0 +1,123 @@ +import { Express, Request, Response } from "express"; +import { + IWebServiceEndpoint, + IExpressRequestHandler, + IEndpointAuthzOptions, +} from "@hyperledger/cactus-core-api"; + +import { + registerWebServiceEndpoint, + handleRestEndpointException, +} from "@hyperledger/cactus-core"; + +import { + CreateIOUEndpointRequest, + CreateIOUEndpointResponse +} from "../generated/openapi/typescript-axios" + +import { + Checks, + IAsyncProvider, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; + +import { InternalServerError } from "http-errors-enhanced-cjs" +import OAS from "../../json/openapi.json"; +import { PluginLedgerConnectorDAML } from "../plugin-ledger-connector-daml"; +export interface ICreateIOUEndpointOptions { + logLevel?: LogLevelDesc; + apiUrl: string; + connector: PluginLedgerConnectorDAML; +} + +export class CreateIOUEndpoint implements IWebServiceEndpoint { + public static readonly CLASS_NAME = "CreateIOUEndpoint"; + + private readonly log: Logger; + private readonly apiUrl: string; + + public get className(): string { + return CreateIOUEndpoint.CLASS_NAME; + } + + constructor(public readonly options: ICreateIOUEndpointOptions) { + const fnTag = `${this.className}#constructor()`; + + Checks.truthy(options, `${fnTag} options`); + Checks.truthy(options.connector, `${fnTag} options.connector`); + Checks.nonBlankString(options.apiUrl, `${fnTag} options.apiUrl`); + + this.log = LoggerProvider.getOrCreate({ + label: "list-cpi-endpoint-v1", + level: options.logLevel || "INFO", + }); + + try { + new URL(options.apiUrl); + } catch (err) { + throw new Error(`${fnTag} Invalid URL: ${options.apiUrl}`); + } + this.apiUrl = options.apiUrl; + } + + getAuthorizationOptionsProvider(): IAsyncProvider { + return { + get: async () => ({ + isProtected: true, + requiredRoles: [], + }), + }; + } + + public get oasPath(): (typeof OAS.paths)["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint"] { + return OAS.paths[ + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/create-iou-endpoint" + ]; + } + + /** + * Returns the endpoint path to be used when installing the endpoint into the + * API server of Cactus. + */ + public getPath(): string { + return this.oasPath.post["x-hyperledger-cactus"].http.path; + } + + public getVerbLowerCase(): string { + return this.oasPath.post["x-hyperledger-cactus"].http.verbLowerCase; + } + + public getOperationId(): string { + return this.oasPath.post.operationId; + } + + public getExpressRequestHandler(): IExpressRequestHandler { + return this.handleRequest.bind(this); + } + + public async registerExpress( + expressApp: Express, + ): Promise { + await registerWebServiceEndpoint(expressApp, this); + return this; + } + + async handleRequest(req: Request, res: Response): Promise { + const fnTag = "CreateIOUEndpoint#handleRequest()"; + const verbUpper = this.getVerbLowerCase().toUpperCase(); + this.log.debug(`${verbUpper} ${this.getPath()}`); + + try { + if (this.apiUrl === undefined) + throw new InternalServerError("apiUrl option is necessary"); + const body = await this.options.connector.createContract(req.body); + res.status(200); + res.json(body); + } catch (ex) { + const errorMsg = `${fnTag} Failed to perform request:`; + handleRestEndpointException({ errorMsg, log: this.log, error: ex, res }); + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/exercise-iou-endpoint.ts b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/exercise-iou-endpoint.ts new file mode 100644 index 00000000000..fffb2a9bff5 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/exercise-iou-endpoint.ts @@ -0,0 +1,128 @@ +import { Express, Request, Response } from "express"; +import { + IWebServiceEndpoint, + IExpressRequestHandler, + IEndpointAuthzOptions, +} from "@hyperledger/cactus-core-api"; + +import { + registerWebServiceEndpoint, + handleRestEndpointException, +} from "@hyperledger/cactus-core"; + +// import { +// ExerciseIOUEndpointRequest, +// ExerciseIOUEndpointResponse +// } from "./generated/openapi/typescript-axios"; + +import { + ExerciseIOUEndpointRequest, + ExerciseIOUEndpointResponse +} from "../generated/openapi/typescript-axios" + +import { + Checks, + IAsyncProvider, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; + +import { InternalServerError } from "http-errors-enhanced-cjs" +import OAS from "../../json/openapi.json"; +import { PluginLedgerConnectorDAML } from "../plugin-ledger-connector-daml"; +export interface IExerciseIOUEndpointOptions { + logLevel?: LogLevelDesc; + apiUrl: string; + connector: PluginLedgerConnectorDAML; +} + +export class ExerciseIOUEndpoint implements IWebServiceEndpoint { + public static readonly CLASS_NAME = "ExerciseIOUEndpoint"; + + private readonly log: Logger; + private readonly apiUrl: string; + + public get className(): string { + return ExerciseIOUEndpoint.CLASS_NAME; + } + + constructor(public readonly options: IExerciseIOUEndpointOptions) { + const fnTag = `${this.className}#constructor()`; + + Checks.truthy(options, `${fnTag} options`); + Checks.truthy(options.connector, `${fnTag} options.connector`); + Checks.nonBlankString(options.apiUrl, `${fnTag} options.apiUrl`); + + this.log = LoggerProvider.getOrCreate({ + label: "list-cpi-endpoint-v1", + level: options.logLevel || "INFO", + }); + + try { + new URL(options.apiUrl); + } catch (err) { + throw new Error(`${fnTag} Invalid URL: ${options.apiUrl}`); + } + this.apiUrl = options.apiUrl; + } + + getAuthorizationOptionsProvider(): IAsyncProvider { + return { + get: async () => ({ + isProtected: true, + requiredRoles: [], + }), + }; + } + + public get oasPath(): (typeof OAS.paths)["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint"] { + return OAS.paths[ + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/exercise-iou-endpoint" + ]; + } + + /** + * Returns the endpoint path to be used when installing the endpoint into the + * API server of Cactus. + */ + public getPath(): string { + return this.oasPath.post["x-hyperledger-cactus"].http.path; + } + + public getVerbLowerCase(): string { + return this.oasPath.post["x-hyperledger-cactus"].http.verbLowerCase; + } + + public getOperationId(): string { + return this.oasPath.post.operationId; + } + + public getExpressRequestHandler(): IExpressRequestHandler { + return this.handleRequest.bind(this); + } + + public async registerExpress( + expressApp: Express, + ): Promise { + await registerWebServiceEndpoint(expressApp, this); + return this; + } + + async handleRequest(req: Request, res: Response): Promise { + const fnTag = "ExerciseIOUEndpoint#handleRequest()"; + const verbUpper = this.getVerbLowerCase().toUpperCase(); + this.log.debug(`${verbUpper} ${this.getPath()}`); + + try { + if (this.apiUrl === undefined) + throw new InternalServerError("apiUrl option is necessary"); + const body = await this.options.connector.exerciseContract(req.body); + res.status(200); + res.json(body); + } catch (ex) { + const errorMsg = `${fnTag} Failed to perform request:`; + handleRestEndpointException({ errorMsg, log: this.log, error: ex, res }); + } + } +} \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/get-parties-involved-endpoint.ts b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/get-parties-involved-endpoint.ts new file mode 100644 index 00000000000..d9f2c5146c4 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/get-parties-involved-endpoint.ts @@ -0,0 +1,123 @@ +import { Express, Request, Response } from "express"; +import { + IWebServiceEndpoint, + IExpressRequestHandler, + IEndpointAuthzOptions, +} from "@hyperledger/cactus-core-api"; + +import { + registerWebServiceEndpoint, + handleRestEndpointException, +} from "@hyperledger/cactus-core"; + +import { + GetPartiesInvolvedEndpointRequest, + QueryIOUEndpointResponse +} from "../generated/openapi/typescript-axios" + +import { + Checks, + IAsyncProvider, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; + +import { InternalServerError } from "http-errors-enhanced-cjs" +import OAS from "../../json/openapi.json"; +import { PluginLedgerConnectorDAML } from "../plugin-ledger-connector-daml"; +export interface IGetPartiesInvolvedEndpointOptions { + logLevel?: LogLevelDesc; + apiUrl: string; + connector: PluginLedgerConnectorDAML; +} + +export class GetPartiesInvolvedEndpoint implements IWebServiceEndpoint { + public static readonly CLASS_NAME = "ListCPIEndpointV1"; + + private readonly log: Logger; + private readonly apiUrl: string; + + public get className(): string { + return GetPartiesInvolvedEndpoint.CLASS_NAME; + } + + constructor(public readonly options: IGetPartiesInvolvedEndpointOptions) { + const fnTag = `${this.className}#constructor()`; + + Checks.truthy(options, `${fnTag} options`); + Checks.truthy(options.connector, `${fnTag} options.connector`); + Checks.nonBlankString(options.apiUrl, `${fnTag} options.apiUrl`); + + this.log = LoggerProvider.getOrCreate({ + label: "list-cpi-endpoint-v1", + level: options.logLevel || "INFO", + }); + + try { + new URL(options.apiUrl); + } catch (err) { + throw new Error(`${fnTag} Invalid URL: ${options.apiUrl}`); + } + this.apiUrl = options.apiUrl; + } + + getAuthorizationOptionsProvider(): IAsyncProvider { + return { + get: async () => ({ + isProtected: true, + requiredRoles: [], + }), + }; + } + + public get oasPath(): (typeof OAS.paths)["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint"] { + return OAS.paths[ + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/get-parties-involved-endpoint" + ]; + } + + /** + * Returns the endpoint path to be used when installing the endpoint into the + * API server of Cactus. + */ + public getPath(): string { + return this.oasPath.get["x-hyperledger-cactus"].http.path; + } + + public getVerbLowerCase(): string { + return this.oasPath.get["x-hyperledger-cactus"].http.verbLowerCase; + } + + public getOperationId(): string { + return this.oasPath.get.operationId; + } + + public getExpressRequestHandler(): IExpressRequestHandler { + return this.handleRequest.bind(this); + } + + public async registerExpress( + expressApp: Express, + ): Promise { + await registerWebServiceEndpoint(expressApp, this); + return this; + } + + async handleRequest(req: Request, res: Response): Promise { + const fnTag = "QueryIOURawEndpointRequest#handleRequest()"; + const verbUpper = this.getVerbLowerCase().toUpperCase(); + this.log.debug(`${verbUpper} ${this.getPath()}`); + + try { + if (this.apiUrl === undefined) + throw new InternalServerError("apiUrl option is necessary"); + const body = await this.options.connector.getPartiesInvolved(req.body); + res.status(200); + res.json(body); + } catch (ex) { + const errorMsg = `${fnTag} Failed to perform request:`; + handleRestEndpointException({ errorMsg, log: this.log, error: ex, res }); + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/query-iou-endpoint.ts b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/query-iou-endpoint.ts new file mode 100644 index 00000000000..8dde60d1e8e --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/query-iou-endpoint.ts @@ -0,0 +1,123 @@ +import { Express, Request, Response } from "express"; +import { + IWebServiceEndpoint, + IExpressRequestHandler, + IEndpointAuthzOptions, +} from "@hyperledger/cactus-core-api"; + +import { + registerWebServiceEndpoint, + handleRestEndpointException, +} from "@hyperledger/cactus-core"; + +import { + QueryIOUEndpointRequest, + QueryIOUEndpointResponse +} from "../generated/openapi/typescript-axios" + +import { + Checks, + IAsyncProvider, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; + +import { InternalServerError } from "http-errors-enhanced-cjs" +import OAS from "../../json/openapi.json"; +import { PluginLedgerConnectorDAML } from "../plugin-ledger-connector-daml"; +export interface IQueryIOUEndpointOptions { + logLevel?: LogLevelDesc; + apiUrl: string; + connector: PluginLedgerConnectorDAML; +} + +export class QueryIOUEndpoint implements IWebServiceEndpoint { + public static readonly CLASS_NAME = "QueryIOUEndpoint"; + + private readonly log: Logger; + private readonly apiUrl: string; + + public get className(): string { + return QueryIOUEndpoint.CLASS_NAME; + } + + constructor(public readonly options: IQueryIOUEndpointOptions) { + const fnTag = `${this.className}#constructor()`; + + Checks.truthy(options, `${fnTag} options`); + Checks.truthy(options.connector, `${fnTag} options.connector`); + Checks.nonBlankString(options.apiUrl, `${fnTag} options.apiUrl`); + + this.log = LoggerProvider.getOrCreate({ + label: "list-cpi-endpoint-v1", + level: options.logLevel || "INFO", + }); + + try { + new URL(options.apiUrl); + } catch (err) { + throw new Error(`${fnTag} Invalid URL: ${options.apiUrl}`); + } + this.apiUrl = options.apiUrl; + } + + getAuthorizationOptionsProvider(): IAsyncProvider { + return { + get: async () => ({ + isProtected: true, + requiredRoles: [], + }), + }; + } + + public get oasPath(): (typeof OAS.paths)["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint"] { + return OAS.paths[ + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-iou-endpoint" + ]; + } + + /** + * Returns the endpoint path to be used when installing the endpoint into the + * API server of Cactus. + */ + public getPath(): string { + return this.oasPath.post["x-hyperledger-cactus"].http.path; + } + + public getVerbLowerCase(): string { + return this.oasPath.post["x-hyperledger-cactus"].http.verbLowerCase; + } + + public getOperationId(): string { + return this.oasPath.post.operationId; + } + + public getExpressRequestHandler(): IExpressRequestHandler { + return this.handleRequest.bind(this); + } + + public async registerExpress( + expressApp: Express, + ): Promise { + await registerWebServiceEndpoint(expressApp, this); + return this; + } + + async handleRequest(req: Request, res: Response): Promise { + const fnTag = "QueryIOUEndpoint#handleRequest()"; + const verbUpper = this.getVerbLowerCase().toUpperCase(); + this.log.debug(`${verbUpper} ${this.getPath()}`); + + try { + if (this.apiUrl === undefined) + throw new InternalServerError("apiUrl option is necessary"); + const body = await this.options.connector.queryContract(req.body); + res.status(200); + res.json(body); + } catch (ex) { + const errorMsg = `${fnTag} Failed to perform request:`; + handleRestEndpointException({ errorMsg, log: this.log, error: ex, res }); + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/query-raw-iou-endpoint.ts b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/query-raw-iou-endpoint.ts new file mode 100644 index 00000000000..b89be94df64 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/main/typescript/web-services/query-raw-iou-endpoint.ts @@ -0,0 +1,123 @@ +import { Express, Request, Response } from "express"; +import { + IWebServiceEndpoint, + IExpressRequestHandler, + IEndpointAuthzOptions, +} from "@hyperledger/cactus-core-api"; + +import { + registerWebServiceEndpoint, + handleRestEndpointException, +} from "@hyperledger/cactus-core"; + +import { + QueryRawIOUEndpointRequest, + QueryIOUEndpointResponse +} from "../generated/openapi/typescript-axios" + +import { + Checks, + IAsyncProvider, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; + +import { InternalServerError } from "http-errors-enhanced-cjs" +import OAS from "../../json/openapi.json"; +import { PluginLedgerConnectorDAML } from "../plugin-ledger-connector-daml"; +export interface IQueryRawIOUEndpointOptions { + logLevel?: LogLevelDesc; + apiUrl: string; + connector: PluginLedgerConnectorDAML; +} + +export class QueryRawIOUEndpoint implements IWebServiceEndpoint { + public static readonly CLASS_NAME = "QueryRawIOUEndpoint"; + + private readonly log: Logger; + private readonly apiUrl: string; + + public get className(): string { + return QueryRawIOUEndpoint.CLASS_NAME; + } + + constructor(public readonly options: IQueryRawIOUEndpointOptions) { + const fnTag = `${this.className}#constructor()`; + + Checks.truthy(options, `${fnTag} options`); + Checks.truthy(options.connector, `${fnTag} options.connector`); + Checks.nonBlankString(options.apiUrl, `${fnTag} options.apiUrl`); + + this.log = LoggerProvider.getOrCreate({ + label: "list-cpi-endpoint-v1", + level: options.logLevel || "INFO", + }); + + try { + new URL(options.apiUrl); + } catch (err) { + throw new Error(`${fnTag} Invalid URL: ${options.apiUrl}`); + } + this.apiUrl = options.apiUrl; + } + + getAuthorizationOptionsProvider(): IAsyncProvider { + return { + get: async () => ({ + isProtected: true, + requiredRoles: [], + }), + }; + } + + public get oasPath(): (typeof OAS.paths)["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint"] { + return OAS.paths[ + "/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-daml/query-raw-iou-endpoint" + ]; + } + + /** + * Returns the endpoint path to be used when installing the endpoint into the + * API server of Cactus. + */ + public getPath(): string { + return this.oasPath.get["x-hyperledger-cactus"].http.path; + } + + public getVerbLowerCase(): string { + return this.oasPath.get["x-hyperledger-cactus"].http.verbLowerCase; + } + + public getOperationId(): string { + return this.oasPath.get.operationId; + } + + public getExpressRequestHandler(): IExpressRequestHandler { + return this.handleRequest.bind(this); + } + + public async registerExpress( + expressApp: Express, + ): Promise { + await registerWebServiceEndpoint(expressApp, this); + return this; + } + + async handleRequest(req: Request, res: Response): Promise { + const fnTag = "QueryIOURawEndpointt#handleRequest()"; + const verbUpper = this.getVerbLowerCase().toUpperCase(); + this.log.debug(`${verbUpper} ${this.getPath()}`); + + try { + if (this.apiUrl === undefined) + throw new InternalServerError("apiUrl option is necessary"); + const body = await this.options.connector.queryRawContract(req.body); + res.status(200); + res.json(body); + } catch (ex) { + const errorMsg = `${fnTag} Failed to perform request:`; + handleRestEndpointException({ errorMsg, log: this.log, error: ex, res }); + } + } +} diff --git a/packages/cactus-plugin-ledger-connector-daml/src/test/typescript/integration/daml-get-transaction.test.ts b/packages/cactus-plugin-ledger-connector-daml/src/test/typescript/integration/daml-get-transaction.test.ts new file mode 100644 index 00000000000..489d638a270 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/test/typescript/integration/daml-get-transaction.test.ts @@ -0,0 +1,221 @@ +import { v4 as uuidv4 } from "uuid"; +import "jest-extended"; + +import { DamlTestLedger } from "@hyperledger/cactus-test-tooling"; + +import { PluginLedgerConnectorDAML } from "../../../main/typescript/plugin-ledger-connector-daml"; + +import { DefaultApi } from "../../../main/typescript/generated/openapi/typescript-axios/index" + +import test, { Test } from "tape-promise/tape"; +import { + IListenOptions, + LogLevelDesc, + LoggerProvider, + Logger, + Servers, +} from "@hyperledger/cactus-common"; + +import { pruneDockerAllIfGithubAction } from "../../../../../../packages/cactus-test-tooling/src/main/typescript/github-actions/prune-docker-all-if-github-action" +import fetch from "node-fetch"; +import FormData from "form-data"; +import https from "https"; +import * as fs from 'fs'; +import { Configuration } from "@hyperledger/cactus-core-api"; +import http from "http"; +import { AddressInfo } from "net"; +import bodyParser from "body-parser"; + +import express from "express"; + +const testCase = "Instantiate plugin"; +const logLevel: LogLevelDesc = "TRACE"; +const testLogLevel: LogLevelDesc = "info"; +// Logger setup +const log: Logger = LoggerProvider.getOrCreate({ + label: "daml-get-transaction.test", + level: testLogLevel, +}); + + +describe("PluginLedgerConnectorDAML", () => { + const damlTestLedger = new DamlTestLedger({ + imageVersion: "2024-09-08T07-40-07-dev-2cc217b7a", + imageName: "ghcr.io/hyperledger/cacti-daml-all-in-one", + rpcApiHttpPort: 7575, + }); + let apiClient: DefaultApi; + const expressApp = express(); + const server = http.createServer(expressApp); + + beforeAll(async () => { + log.info("Prune Docker..."); + await pruneDockerAllIfGithubAction({ logLevel: testLogLevel }); + + await damlTestLedger.start(); + expressApp.use(bodyParser.json({ limit: "250mb" })); + + let plugin = new PluginLedgerConnectorDAML({ + instanceId: uuidv4(), + logLevel, + apiUrl: "http://localhost:7575/v1", + }); + + const listenOptions: IListenOptions = { + hostname: "127.0.0.1", + port: 0, + server, + }; + + const addressInfo = (await Servers.listen(listenOptions)) as AddressInfo; + const { address, port } = addressInfo; + const apiHost = `http://${address}:${port}`; + const config = new Configuration({ basePath: apiHost }); + + await plugin.registerWebServices(expressApp); + + apiClient = new DefaultApi(config); + + }); + + afterAll(async () => { + log.info("FINISHING THE TESTS"); + if (damlTestLedger) { + log.info("Stop the DAML ledger..."); + await damlTestLedger.stop(); + await damlTestLedger.destroy(); + } + + log.info("Prune Docker..."); + await pruneDockerAllIfGithubAction({ logLevel: testLogLevel }); + }); + + describe("DAML SIMPLE IOU TRANSACTION", () => { + it("DAML SIMPLE IOU TRANSACTION", async () => { + // /*================== + // PREREQUISITES + // ===================*/ + + // this will create the initial token generated from the daml jwt from container + const getDamlAuthorizationTokenVar = await damlTestLedger.getDamlAuthorizationToken() + const participantListBody = { + participantToken: getDamlAuthorizationTokenVar + } + const getPartiesInvolved = await apiClient.getPartiesInvolved(participantListBody) + let getPartiesInvolvedVar = JSON.stringify(getPartiesInvolved.data) + let parsePartyInvolved = JSON.parse(getPartiesInvolvedVar) + + const getTokenForAlice: string = damlTestLedger.getIdentifierByDisplayName(parsePartyInvolved, "Alice") + // create a function for jwt generator + const getAliceToken: string = damlTestLedger.generateJwtToken(getTokenForAlice); + + const rawContractIOUBody = { + participantToken: getAliceToken + } + + //get the sample IOU contract using Alice + const queryRawIou = await apiClient.queryRawContract(rawContractIOUBody) + const rawStringifyIOUPayload = JSON.stringify(queryRawIou.data) + const rawResponseForIOUResult = JSON.parse(rawStringifyIOUPayload) + + const getIouTemplate = rawResponseForIOUResult.result[0].templateId + + /*================== + STEP 1. Create IOU + ===================*/ + const iouBody = { + participantToken: getAliceToken, + templateId: `${getIouTemplate}`, + payload: { + issuer: `${getTokenForAlice}`, + owner: `${getTokenForAlice}`, + currency: "USD", + amount: "999.99", + observers: [] + } + } + const createIou = await apiClient.createIou(iouBody) + console.log("STEP 1. Create IOU as Alice result:") + console.log(createIou) + + let stringifyIOUPayload = JSON.stringify(createIou.data) + let responseForIOUResult = JSON.parse(stringifyIOUPayload) + + let ioutemplateid = responseForIOUResult.result.templateId + let ioucontractId = responseForIOUResult.result.contractId + + // /*================== + // STEP 2. Transfer IOU to BOB + // ===================*/ + + const getHashForBob: string = damlTestLedger.getIdentifierByDisplayName(parsePartyInvolved, "Bob") + const getBobToken: string = damlTestLedger.generateJwtToken(getHashForBob); + + const transferToBobBody = { + participantToken: `${getAliceToken}`, + templateId: `${ioutemplateid}`, + contractId: `${ioucontractId}`, + choice: `Iou_Transfer`, + argument: { + newOwner: `${getHashForBob}` + } + } + + let exerciseIou = await apiClient.exerciseChoice(transferToBobBody) + console.log("STEP 2. Transfer IOU to BOB result:") + console.log(exerciseIou) + + stringifyIOUPayload = JSON.stringify(exerciseIou.data) + responseForIOUResult = JSON.parse(stringifyIOUPayload) + let payloadResult = responseForIOUResult.result.events[1].created + + ioutemplateid = payloadResult.templateId + ioucontractId = payloadResult.contractId + + // /*================== + // STEP 3. Accept Transfer of IOU as BOB + // ===================*/ + + let acceptBody = { + participantToken: `${getBobToken}`, + templateId: `${ioutemplateid}`, + contractId: `${ioucontractId}`, + choice: `IouTransfer_Accept`, + argument: { + newOwner: `${getBobToken}` + } + } + exerciseIou = await apiClient.exerciseChoice(acceptBody) + + stringifyIOUPayload = JSON.stringify(exerciseIou.data) + responseForIOUResult = JSON.parse(stringifyIOUPayload) + + console.log("STEP 3. Accept Transfer of IOU as BOB result:") + console.log(responseForIOUResult) + + payloadResult = responseForIOUResult.result.events[1].created + + ioutemplateid = payloadResult.templateId + ioucontractId = payloadResult.contractId + // /*================== + // STEP 4. Check if transfer is successful by querying as BOB + // ===================*/ + + let queryIouAsBobBody = { + templateIds: [`${ioutemplateid}`], + query: {amount: 999.99}, + readers: [`${getHashForBob}`], + participantToken: getBobToken + } + + const queryIou = await apiClient.queryContract(queryIouAsBobBody) + stringifyIOUPayload = JSON.stringify(queryIou.data) + responseForIOUResult = JSON.parse(stringifyIOUPayload) + + + console.log("STEP 4. For final check, query as BOB to check if IOU has been transferred succesfully") + console.log(responseForIOUResult) + + }) + }) +}); \ No newline at end of file diff --git a/packages/cactus-plugin-ledger-connector-daml/src/test/typescript/integration/openapi/openapi-validation.test.ts b/packages/cactus-plugin-ledger-connector-daml/src/test/typescript/integration/openapi/openapi-validation.test.ts new file mode 100644 index 00000000000..e672fe640e4 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/src/test/typescript/integration/openapi/openapi-validation.test.ts @@ -0,0 +1,769 @@ +import test, { Test } from "tape-promise/tape"; +import { v4 as internalIpV4 } from "internal-ip"; + +import { + Containers, + CordaTestLedger, + pruneDockerAllIfGithubAction, +} from "@hyperledger/cactus-test-tooling"; +import { LogLevelDesc } from "@hyperledger/cactus-common"; +import { + SampleCordappEnum, + CordaConnectorContainer, +} from "@hyperledger/cactus-test-tooling"; + +import { + CordappDeploymentConfig, + DefaultApi as CordaApi, + DeployContractJarsV1Request, + DiagnoseNodeV1Request, + FlowInvocationType, + InvokeContractV1Request, + JvmTypeKind, + ListFlowsV1Request, + PublicKey, +} from "../../../../main/typescript/generated/openapi/typescript-axios/index"; +import { Configuration } from "@hyperledger/cactus-core-api"; + +const testCase = "openapi validation on corda JVM implementation"; +const logLevel: LogLevelDesc = "TRACE"; + +test.onFailure(async () => { + await Containers.logDiagnostics({ logLevel }); +}); + +test("BEFORE " + testCase, async (t: Test) => { + const pruning = pruneDockerAllIfGithubAction({ logLevel }); + await t.doesNotReject(pruning, "Pruning didn't throw OK"); + t.end(); +}); + +test(testCase, async (t: Test) => { + const ledger = new CordaTestLedger({ + imageName: "ghcr.io/hyperledger/cactus-corda-4-8-all-in-one-obligation", + imageVersion: "2021-08-31--feat-889", + logLevel, + }); + t.ok(ledger, "CordaTestLedger instantaited OK"); + + test.onFinish(async () => { + await ledger.stop(); + await ledger.destroy(); + await pruneDockerAllIfGithubAction({ logLevel }); + }); + const ledgerContainer = await ledger.start(); + t.ok(ledgerContainer, "CordaTestLedger container truthy post-start() OK"); + + await ledger.logDebugPorts(); + const partyARpcPort = await ledger.getRpcAPublicPort(); + + const cordappDeploymentConfigs: CordappDeploymentConfig[] = []; + const jarFiles = await ledger.pullCordappJars( + SampleCordappEnum.ADVANCED_OBLIGATION, + ); + t.comment(`Fetched ${jarFiles.length} cordapp jars OK`); + + const internalIpOrUndefined = await internalIpV4(); + t.ok(internalIpOrUndefined, "Determined LAN IPv4 address successfully OK"); + const internalIp = internalIpOrUndefined as string; + t.comment(`Internal IP (based on default gateway): ${internalIp}`); + + const springAppConfig = { + logging: { + level: { + root: "INFO", + "org.hyperledger.cactus": "DEBUG", + }, + }, + cactus: { + corda: { + node: { host: internalIp }, + // TODO: parse the gradle build files to extract the credentials? + rpc: { port: partyARpcPort, username: "user1", password: "password" }, + }, + }, + }; + const springApplicationJson = JSON.stringify(springAppConfig); + const envVarSpringAppJson = `SPRING_APPLICATION_JSON=${springApplicationJson}`; + t.comment(envVarSpringAppJson); + + const connector = new CordaConnectorContainer({ + logLevel, + imageName: "ghcr.io/hyperledger/cactus-connector-corda-server", + imageVersion: "2021-11-23--feat-1493", + envVars: [envVarSpringAppJson], + }); + t.ok(CordaConnectorContainer, "CordaConnectorContainer instantiated OK"); + + test.onFinish(async () => { + try { + await connector.stop(); + } finally { + await connector.destroy(); + } + }); + + const connectorContainer = await connector.start(); + t.ok(connectorContainer, "CordaConnectorContainer started OK"); + + await connector.logDebugPorts(); + const apiUrl = await connector.getApiLocalhostUrl(); + const config = new Configuration({ basePath: apiUrl }); + const apiClient = new CordaApi(config); + + const fDeploy = "deployContractJarsV1"; + const fInvoke = "invokeContractV1"; + const fDiagnose = "diagnoseNodeV1"; + const fFlows = "listFlowsV1"; + const fNetwork = "networkMapV1"; + const cOk = "without bad request error"; + const cWithoutParams = "not sending all required parameters"; + const cInvalidParams = "sending invalid parameters"; + + test(`${testCase} - ${fDeploy} - ${cOk}`, async (t2: Test) => { + const depReq: DeployContractJarsV1Request = { + jarFiles, + cordappDeploymentConfigs, + }; + const depRes = await apiClient.deployContractJarsV1(depReq); + t2.ok(depRes, "Jar deployment response truthy OK"); + t2.ok(depRes.status === 200, "Jar deployment status code === 200 OK"); + t2.ok(depRes.data, "Jar deployment response body truthy OK"); + t2.ok( + depRes.data?.deployedJarFiles, + "Jar deployment body deployedJarFiles OK", + ); + t2.equal( + depRes.data?.deployedJarFiles?.length, + jarFiles.length, + "Deployed jar file count equals count in request OK", + ); + t2.end(); + }); + + test(`${testCase} - ${fFlows} - ${cOk}`, async (t2: Test) => { + const flowsRes = await apiClient.listFlowsV1(); + t2.ok(flowsRes.status === 200, "flowsRes.status === 200 OK"); + t2.ok(flowsRes.data, "flowsRes.data truthy OK"); + t2.ok(flowsRes.data.flowNames, "flowsRes.data.flowNames truthy OK"); + t2.comment(`apiClient.listFlowsV1() => ${JSON.stringify(flowsRes.data)}`); + t2.end(); + }); + + test(`${testCase} - ${fDiagnose} - ${cOk}`, async (t2: Test) => { + const diagRes = await apiClient.diagnoseNodeV1(); + t2.ok(diagRes.status === 200, "diagRes.status === 200 OK"); + t2.ok(diagRes.data, "diagRes.data truthy OK"); + t2.ok(diagRes.data.nodeDiagnosticInfo, "nodeDiagnosticInfo truthy OK"); + t2.end(); + }); + + let partyAPublicKey: PublicKey | undefined; + let partyBPublicKey: PublicKey | undefined; + + test(`${testCase} - ${fNetwork} - ${cOk}`, async (t2: Test) => { + const networkMapRes = await apiClient.networkMapV1(); + t2.ok(networkMapRes.status === 200, "networkMapRes.status === 200 OK"); + const partyA = networkMapRes.data.find((it) => + it.legalIdentities.some( + (it2) => it2.name.organisation === "ParticipantA", + ), + ); + partyAPublicKey = partyA?.legalIdentities[0].owningKey; + + const partyB = networkMapRes.data.find((it) => + it.legalIdentities.some( + (it2) => it2.name.organisation === "ParticipantB", + ), + ); + partyBPublicKey = partyB?.legalIdentities[0].owningKey; + t2.end(); + }); + + test(`${testCase} - ${fInvoke} - ${cOk}`, async (t2: Test) => { + const req: InvokeContractV1Request = { + flowFullClassName: "net.corda.samples.obligation.flows.IOUIssueFlow", + flowInvocationType: FlowInvocationType.TrackedFlowDynamic, + params: [ + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.samples.obligation.states.IOUState", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.contracts.Amount", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "long", + }, + primitiveValue: 42, + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "java.util.Currency", + constructorName: "getInstance", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "USD", + }, + ], + }, + ], + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.identity.Party", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.identity.CordaX500Name", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "ParticipantA", + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "London", + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "GB", + }, + ], + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: + "org.hyperledger.cactus.plugin.ledger.connector.corda.server.impl.PublicKeyImpl", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: partyAPublicKey?.algorithm, + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: partyAPublicKey?.format, + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: partyAPublicKey?.encoded, + }, + ], + }, + ], + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.identity.Party", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.identity.CordaX500Name", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "ParticipantB", + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "New York", + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "US", + }, + ], + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: + "org.hyperledger.cactus.plugin.ledger.connector.corda.server.impl.PublicKeyImpl", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: partyBPublicKey?.algorithm, + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: partyBPublicKey?.format, + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: partyBPublicKey?.encoded, + }, + ], + }, + ], + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.contracts.Amount", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "long", + }, + primitiveValue: 1, + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "java.util.Currency", + constructorName: "getInstance", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "USD", + }, + ], + }, + ], + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.contracts.UniqueIdentifier", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "7fc2161e-f8d0-4c86-a596-08326bdafd56", + }, + ], + }, + ], + }, + ], + timeoutMs: 60000, + } as unknown as InvokeContractV1Request; + + const res = await apiClient.invokeContractV1(req); + t2.ok(res, "InvokeContractV1Request truthy OK"); + t2.ok(res.status === 200, "InvokeContractV1Request status code === 200 OK"); + t2.end(); + }); + + test(`${testCase} - ${fDeploy} - ${cWithoutParams}`, async (t2: Test) => { + try { + const depReq = { + jarFiles, + } as unknown as DeployContractJarsV1Request; + await apiClient.deployContractJarsV1(depReq); + t2.fail(`${fDeploy} - ${cWithoutParams}: should fail`); + } catch (e) { + t2.equal( + e.response?.data?.status, + 400, + "Deploy contract response status code === 400 OK", + ); + } + t2.end(); + }); + + test(`${testCase} - ${fInvoke} - ${cWithoutParams}`, async (t2: Test) => { + try { + const req = { + flowFullClassName: "net.corda.samples.obligation.flows.IOUIssueFlow", + flowInvocationType: FlowInvocationType.TrackedFlowDynamic, + timeoutMs: 60000, + } as unknown as InvokeContractV1Request; + await apiClient.invokeContractV1(req); + t2.fail(`${fInvoke} - ${cWithoutParams}: should fail`); + } catch (e) { + t2.equal( + e.response?.data?.status, + 400, + "Invoke contract response status code === 400 OK", + ); + } + t2.end(); + }); + + test(`${testCase} - ${fDeploy} - ${cInvalidParams}`, async (t2: Test) => { + try { + const depReq = { + jarFiles, + cordappDeploymentConfigs, + fake: 4, + }; + await apiClient.deployContractJarsV1(depReq); + t2.fail(`${fDeploy} - ${cInvalidParams}: should fail`); + } catch (e) { + t2.equal( + e.response?.data?.status, + 400, + "Deploy contract response status code === 400 OK", + ); + } + t2.end(); + }); + + test(`${testCase} - ${fFlows} - ${cInvalidParams}`, async (t2: Test) => { + try { + const req = { fake: 4 } as ListFlowsV1Request; + await apiClient.listFlowsV1(req); + t2.fail(`${fFlows} - ${cInvalidParams}: should fail`); + } catch (e) { + t2.equal( + e.response?.data?.status, + 400, + "List flows response status code === 400 OK", + ); + } + t2.end(); + }); + + test(`${testCase} - ${fDiagnose} - ${cInvalidParams}`, async (t2: Test) => { + try { + const req = { fake: 4 } as unknown as DiagnoseNodeV1Request; + await apiClient.diagnoseNodeV1(req); + t2.fail(`${fDiagnose} - ${cInvalidParams}: should fail`); + } catch (e) { + t2.equal( + e.response?.data?.status, + 400, + "Diagnose node response status code === 400 OK", + ); + } + t2.end(); + }); + + test(`${testCase} - ${fInvoke} - ${cInvalidParams}`, async (t2: Test) => { + const req: InvokeContractV1Request = { + flowFullClassName: "net.corda.samples.obligation.flows.IOUIssueFlow", + flowInvocationType: FlowInvocationType.TrackedFlowDynamic, + params: [ + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.samples.obligation.states.IOUState", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.contracts.Amount", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "long", + }, + primitiveValue: 42, + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "java.util.Currency", + constructorName: "getInstance", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "USD", + }, + ], + }, + ], + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.identity.Party", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.identity.CordaX500Name", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "ParticipantA", + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "London", + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "GB", + }, + ], + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: + "org.hyperledger.cactus.plugin.ledger.connector.corda.server.impl.PublicKeyImpl", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: partyAPublicKey?.algorithm, + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: partyAPublicKey?.format, + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: partyAPublicKey?.encoded, + }, + ], + }, + ], + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.identity.Party", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.identity.CordaX500Name", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "ParticipantB", + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "New York", + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "US", + }, + ], + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: + "org.hyperledger.cactus.plugin.ledger.connector.corda.server.impl.PublicKeyImpl", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: partyBPublicKey?.algorithm, + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: partyBPublicKey?.format, + }, + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: partyBPublicKey?.encoded, + }, + ], + }, + ], + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.contracts.Amount", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "long", + }, + primitiveValue: 1, + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "java.util.Currency", + constructorName: "getInstance", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "USD", + }, + ], + }, + ], + }, + { + jvmTypeKind: JvmTypeKind.Reference, + jvmType: { + fqClassName: "net.corda.core.contracts.UniqueIdentifier", + }, + + jvmCtorArgs: [ + { + jvmTypeKind: JvmTypeKind.Primitive, + jvmType: { + fqClassName: "java.lang.String", + }, + primitiveValue: "7fc2161e-f8d0-4c86-a596-08326bdafd56", + }, + ], + }, + ], + }, + ], + timeoutMs: 60000, + fake: 4, + } as unknown as InvokeContractV1Request; + + try { + await apiClient.invokeContractV1(req); + t2.fail(`${fInvoke} - ${cInvalidParams}: should fail`); + } catch (e) { + t2.equal( + e.response?.data?.status, + 400, + "Invoke contract response status code === 400 OK", + ); + } + t2.end(); + }); + + t.end(); +}); diff --git a/packages/cactus-plugin-ledger-connector-daml/tsconfig.json b/packages/cactus-plugin-ledger-connector-daml/tsconfig.json new file mode 100644 index 00000000000..0f99952cda3 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-daml/tsconfig.json @@ -0,0 +1,33 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist/lib", + "declarationDir": "./dist/lib", + "resolveJsonModule": true, + "rootDir": "./src", + "tsBuildInfoFile": "../../.build-cache/cactus-plugin-persistence-daml.tsbuildinfo" + }, + "include": ["./src", "./src/**/*.json", "./src/**/*.sql"], + "references": [ + { + "path": "../cactus-core/tsconfig.json" + }, + { + "path": "../cactus-common/tsconfig.json" + }, + { + "path": "../cactus-core-api/tsconfig.json" + }, + { + "path": "../cactus-test-tooling/tsconfig.json" + }, + { + "path": "../cactus-plugin-keychain-memory/tsconfig.json" + }, + { + "path": "../cactus-cmd-api-server/tsconfig.json" + } + ] + } + \ No newline at end of file diff --git a/packages/cactus-test-tooling/src/main/typescript/daml/daml-test-ledger.ts b/packages/cactus-test-tooling/src/main/typescript/daml/daml-test-ledger.ts index b42c09077e1..2743ed460f5 100644 --- a/packages/cactus-test-tooling/src/main/typescript/daml/daml-test-ledger.ts +++ b/packages/cactus-test-tooling/src/main/typescript/daml/daml-test-ledger.ts @@ -11,6 +11,7 @@ import { import { ITestLedger } from "../i-test-ledger"; import { Streams } from "../common/streams"; import { Containers } from "../common/containers"; +import * as crypto from 'crypto'; export interface IDamlTestLedgerOptions { imageVersion?: string; @@ -21,8 +22,10 @@ export interface IDamlTestLedgerOptions { } const DEFAULTS = Object.freeze({ - imageVersion: "2024-09-08T07-40-07-dev-2cc217b7a", - imageName: "ghcr.io/hyperledger/cacti-daml-all-in-one", + // imageVersion: "2024-09-08T07-40-07-dev-2cc217b7a", + // imageName: "ghcr.io/hyperledger/cacti-daml-all-in-one", + imageVersion: "latest", + imageName: "cactuts/daml-all-in-one", rpcApiHttpPort: 7575, }); @@ -50,7 +53,7 @@ export class DamlTestLedger implements ITestLedger { private container: Container | undefined; private containerId: string | undefined; - constructor(public readonly opts?: IDamlTestLedgerOptions) { + constructor(public readonly opts: IDamlTestLedgerOptions) { if (!opts) { throw new TypeError(`DAMLTestLedger#ctor options was falsy.`); } @@ -268,28 +271,50 @@ export class DamlTestLedger implements ITestLedger { public async getDamlAuthorizationToken(): Promise { const docker = new Docker(); const aContainerInfo = await this.getContainerInfo(); - const containerId = aContainerInfo.Id; + const containerId = aContainerInfo.Id const exec = await docker.getContainer(containerId).exec({ AttachStdin: false, AttachStdout: true, AttachStderr: true, - Tty: true, - Cmd: ["/bin/bash", "-c", "cat jwt"], // Command to execute + Tty: false, + Cmd: ['/bin/bash', '-c', 'cat jwt'], // Command to execute }); const stream = await exec.start({}); - return new Promise((resolve, reject) => { - let output = ""; - stream.on("data", (data: Buffer) => { + let output = ''; + stream.on('data', (data: Buffer) => { output += data.toString(); // Accumulate the output - resolve(output); + // Remove the extra characters + const removettyvalues = output.replace(/^[\u0001\u0000\u0000\u0000\u0000\u0000\u0000]*/, '').trim() + const removeunwantedcharacter = removettyvalues.replace(/�/g, ''); + resolve(removeunwantedcharacter) }); - stream.on("error", (err: Error) => { + stream.on('error', (err: Error) => { reject(err); }); }); } + public generateJwtToken(participant: string): string { + const base64UrlEncode = (input: Buffer): string => { + return input.toString('base64') + .replace(/\+/g, '-') + .replace(/\//g, '_') + .replace(/=+$/, ''); + }; + const header = base64UrlEncode(Buffer.from('{"alg":"HS256","typ":"JWT"}')); + const payload = base64UrlEncode(Buffer.from(`{"https://daml.com/ledger-api": {"ledgerId": "sandbox", "applicationId": "foobar","actAs":["${participant}"]}}`)); + const hmacSignature = base64UrlEncode(crypto.createHmac('sha256', 'secret') + .update(`${header}.${payload}`) + .digest()); + return `${header}.${payload}.${hmacSignature}` + } + public getIdentifierByDisplayName(payload: string, displayName: string): string{ + const data = JSON.parse(payload); + const item = data.find((obj: { displayName?: string; identifier: string }) => obj.displayName === displayName); + return item.identifier; + } + public async getContainerIpAddress(): Promise { const fnTag = "DAMLTestLedger#getContainerIpAddress()"; const aContainerInfo = await this.getContainerInfo(); diff --git a/tools/docker/daml-all-in-one/supervisord.conf b/tools/docker/daml-all-in-one/supervisord.conf index 288cce07598..30964116cce 100644 --- a/tools/docker/daml-all-in-one/supervisord.conf +++ b/tools/docker/daml-all-in-one/supervisord.conf @@ -10,8 +10,17 @@ autostart=true autorestart=true stderr_logfile=/var/log/daml.err.log stdout_logfile=/var/log/daml.out.log +priority=10 +[program:damlledger] +# command=daml build && && daml sandbox --wall-clock-time --dar ./.daml/dist/quickstart-0.0.1.dar && daml json-api --config json-api-app.conf +command = bash -c 'daml ledger upload-dar --host localhost --port 6865 .daml/dist/quickstart-0.0.1.dar && daml script --ledger-host localhost --ledger-port 6865 --dar .daml/dist/quickstart-0.0.1.dar --script-name Main:initialize --output-file output.json || { echo "Command failed" >&2; exit 1; }' +autostart=true +autorestart=true +stderr_logfile=/var/log/daml.err.log +stdout_logfile=/var/log/daml.out.log +priority=20 [program:jsonapi] # command=daml build && && daml sandbox --wall-clock-time --dar ./.daml/dist/quickstart-0.0.1.dar && daml json-api --config json-api-app.conf @@ -20,6 +29,7 @@ autostart=true autorestart=true stderr_logfile=/var/log/daml.err.log stdout_logfile=/var/log/daml.out.log +priority=30 [inet_http_server] port = 0.0.0.0:9001 diff --git a/yarn.lock b/yarn.lock index 93697f78b5e..f75a9ed0dd7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10400,6 +10400,35 @@ __metadata: languageName: unknown linkType: soft +"@hyperledger/cactus-plugin-ledger-connector-daml@workspace:packages/cactus-plugin-ledger-connector-daml": + version: 0.0.0-use.local + resolution: "@hyperledger/cactus-plugin-ledger-connector-daml@workspace:packages/cactus-plugin-ledger-connector-daml" + dependencies: + "@hyperledger/cactus-common": "npm:2.0.0" + "@hyperledger/cactus-core": "npm:2.0.0" + "@hyperledger/cactus-core-api": "npm:2.0.0" + "@hyperledger/cactus-test-tooling": "npm:2.0.0" + "@types/body-parser": "npm:1.19.4" + "@types/express": "npm:5.0.0" + "@types/multer": "npm:1.4.7" + "@types/temp": "npm:0.9.1" + "@types/uuid": "npm:10.0.0" + axios: "npm:1.7.7" + body-parser: "npm:1.20.2" + express: "npm:4.21.0" + express-openapi-validator: "npm:5.2.0" + http-errors-enhanced-cjs: "npm:2.0.1" + internal-ip: "npm:6.2.0" + joi: "npm:17.13.3" + node-ssh: "npm:13.1.0" + prom-client: "npm:15.1.3" + rxjs: "npm:7.8.1" + temp: "npm:0.9.4" + typescript-optional: "npm:2.0.1" + uuid: "npm:10.0.0" + languageName: unknown + linkType: soft + "@hyperledger/cactus-plugin-ledger-connector-ethereum@npm:2.0.0, @hyperledger/cactus-plugin-ledger-connector-ethereum@workspace:packages/cactus-plugin-ledger-connector-ethereum": version: 0.0.0-use.local resolution: "@hyperledger/cactus-plugin-ledger-connector-ethereum@workspace:packages/cactus-plugin-ledger-connector-ethereum" @@ -21483,9 +21512,9 @@ __metadata: languageName: node linkType: hard -"body-parser@npm:1.20.3": - version: 1.20.3 - resolution: "body-parser@npm:1.20.3" +"body-parser@npm:1.20.2, body-parser@npm:^1.10.0, body-parser@npm:^1.18.2": + version: 1.20.2 + resolution: "body-parser@npm:1.20.2" dependencies: bytes: "npm:3.1.2" content-type: "npm:~1.0.5" @@ -21495,17 +21524,17 @@ __metadata: http-errors: "npm:2.0.0" iconv-lite: "npm:0.4.24" on-finished: "npm:2.4.1" - qs: "npm:6.13.0" + qs: "npm:6.11.0" raw-body: "npm:2.5.2" type-is: "npm:~1.6.18" unpipe: "npm:1.0.0" - checksum: 10/8723e3d7a672eb50854327453bed85ac48d045f4958e81e7d470c56bf111f835b97e5b73ae9f6393d0011cc9e252771f46fd281bbabc57d33d3986edf1e6aeca + checksum: 10/3cf171b82190cf91495c262b073e425fc0d9e25cc2bf4540d43f7e7bbca27d6a9eae65ca367b6ef3993eea261159d9d2ab37ce444e8979323952e12eb3df319a languageName: node linkType: hard -"body-parser@npm:^1.10.0, body-parser@npm:^1.18.2": - version: 1.20.2 - resolution: "body-parser@npm:1.20.2" +"body-parser@npm:1.20.3": + version: 1.20.3 + resolution: "body-parser@npm:1.20.3" dependencies: bytes: "npm:3.1.2" content-type: "npm:~1.0.5" @@ -21515,11 +21544,11 @@ __metadata: http-errors: "npm:2.0.0" iconv-lite: "npm:0.4.24" on-finished: "npm:2.4.1" - qs: "npm:6.11.0" + qs: "npm:6.13.0" raw-body: "npm:2.5.2" type-is: "npm:~1.6.18" unpipe: "npm:1.0.0" - checksum: 10/3cf171b82190cf91495c262b073e425fc0d9e25cc2bf4540d43f7e7bbca27d6a9eae65ca367b6ef3993eea261159d9d2ab37ce444e8979323952e12eb3df319a + checksum: 10/8723e3d7a672eb50854327453bed85ac48d045f4958e81e7d470c56bf111f835b97e5b73ae9f6393d0011cc9e252771f46fd281bbabc57d33d3986edf1e6aeca languageName: node linkType: hard