Skip to content

Commit

Permalink
build(api-client): generate go client
Browse files Browse the repository at this point in the history
    Primary Changes
    ----------------
    1. Updated package.json file for packages to
       include the new codegen script
    2. Added a new dep, replace for string
       manupulation in package.json

Fixes #393

Signed-off-by: jagpreetsinghsasan <jagpreet.singh.sasan@accenture.com>
  • Loading branch information
jagpreetsinghsasan committed Jul 22, 2024
1 parent 603ff0e commit 68674ef
Show file tree
Hide file tree
Showing 852 changed files with 168,298 additions and 41 deletions.
3 changes: 2 additions & 1 deletion extensions/cactus-plugin-htlc-coordinator-besu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@
"dist/*"
],
"scripts": {
"codegen": "run-p 'codegen:*'",
"codegen": "yarn run --top-level run-s 'codegen:*'",
"codegen:openapi": "run-p 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) --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",
"watch": "npm-watch",
"webpack": "npm-run-all webpack:dev webpack:prod",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.travis.yml
README.md
api/openapi.yaml
api_default.go
client.go
configuration.go
go.mod
go.sum
model_counterparty_htlc_request.go
model_htlc_package.go
model_own_htlc_request.go
model_web3_signing_credential.go
model_web3_signing_credential_cactus_keychain_ref.go
model_web3_signing_credential_none.go
model_web3_signing_credential_private_key_hex.go
model_web3_signing_credential_type.go
model_withdraw_counterparty_request.go
response.go
utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.6.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: go

install:
- go get -d -v .

script:
- go build -v ./

Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Go API client for cactus-plugin-htlc-coordinator-besu

Can exchange assets between networks

## 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.2
- 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-htlc-coordinator-besu "github.com/hyperledger/cactus-plugin-htlc-coordinator-besu/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-htlc-coordinator-besu.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-htlc-coordinator-besu.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-htlc-coordinator-besu.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), cactus-plugin-htlc-coordinator-besu.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
```

## Documentation for API Endpoints

All URIs are relative to *https://www.cactus.stream*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**CounterpartyHtlcV1**](docs/DefaultApi.md#counterpartyhtlcv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/counterparty-htlc | Create an instance to interact with the counterparty HTLC
*DefaultApi* | [**OwnHtlcV1**](docs/DefaultApi.md#ownhtlcv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/own-htlc | Create an instance to interact with the own HTLC.
*DefaultApi* | [**WithdrawCounterpartyV1**](docs/DefaultApi.md#withdrawcounterpartyv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/withdraw-counterparty | Withdraw funds of the counterparty HTLC


## Documentation For Models

- [CounterpartyHTLCRequest](docs/CounterpartyHTLCRequest.md)
- [HtlcPackage](docs/HtlcPackage.md)
- [OwnHTLCRequest](docs/OwnHTLCRequest.md)
- [Web3SigningCredential](docs/Web3SigningCredential.md)
- [Web3SigningCredentialCactusKeychainRef](docs/Web3SigningCredentialCactusKeychainRef.md)
- [Web3SigningCredentialNone](docs/Web3SigningCredentialNone.md)
- [Web3SigningCredentialPrivateKeyHex](docs/Web3SigningCredentialPrivateKeyHex.md)
- [Web3SigningCredentialType](docs/Web3SigningCredentialType.md)
- [WithdrawCounterpartyRequest](docs/WithdrawCounterpartyRequest.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



Loading

0 comments on commit 68674ef

Please sign in to comment.