Skip to content

Commit c55bbcc

Browse files
committed
build(api-client): generate go client
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>
1 parent 5d7ec29 commit c55bbcc

File tree

845 files changed

+166821
-16
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

845 files changed

+166821
-16
lines changed

extensions/cactus-plugin-htlc-coordinator-besu/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"codegen:openapi": "run-p generate-sdk",
4848
"generate-sdk": "run-p 'generate-sdk:*'",
4949
"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",
50+
"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",
5051
"watch": "npm-watch",
5152
"webpack": "npm-run-all webpack:dev webpack:prod",
5253
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.travis.yml
2+
README.md
3+
api/openapi.yaml
4+
api_default.go
5+
client.go
6+
configuration.go
7+
go.mod
8+
go.sum
9+
model_counterparty_htlc_request.go
10+
model_htlc_package.go
11+
model_own_htlc_request.go
12+
model_web3_signing_credential.go
13+
model_web3_signing_credential_cactus_keychain_ref.go
14+
model_web3_signing_credential_none.go
15+
model_web3_signing_credential_private_key_hex.go
16+
model_web3_signing_credential_type.go
17+
model_withdraw_counterparty_request.go
18+
response.go
19+
utils.go
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.6.0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: go
2+
3+
install:
4+
- go get -d -v .
5+
6+
script:
7+
- go build -v ./
8+
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Go API client for cactus-plugin-htlc-coordinator-besu
2+
3+
Can exchange assets between networks
4+
5+
## Overview
6+
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.
7+
8+
- API version: 2.0.0-rc.2
9+
- Package version: 1.0.0
10+
- Build package: org.openapitools.codegen.languages.GoClientCodegen
11+
12+
## Installation
13+
14+
Install the following dependencies:
15+
16+
```shell
17+
go get github.com/stretchr/testify/assert
18+
go get golang.org/x/net/context
19+
```
20+
21+
Put the package under your project folder and add the following in import:
22+
23+
```golang
24+
import cactus-plugin-htlc-coordinator-besu "github.com/hyperledger/cactus-plugin-htlc-coordinator-besu/src/main/go/generated/openapi/go-client"
25+
```
26+
27+
To use a proxy, set the environment variable `HTTP_PROXY`:
28+
29+
```golang
30+
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
31+
```
32+
33+
## Configuration of Server URL
34+
35+
Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.
36+
37+
### Select Server Configuration
38+
39+
For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.
40+
41+
```golang
42+
ctx := context.WithValue(context.Background(), cactus-plugin-htlc-coordinator-besu.ContextServerIndex, 1)
43+
```
44+
45+
### Templated Server URL
46+
47+
Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.
48+
49+
```golang
50+
ctx := context.WithValue(context.Background(), cactus-plugin-htlc-coordinator-besu.ContextServerVariables, map[string]string{
51+
"basePath": "v2",
52+
})
53+
```
54+
55+
Note, enum values are always validated and all unused variables are silently ignored.
56+
57+
### URLs Configuration per Operation
58+
59+
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
60+
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
61+
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.
62+
63+
```golang
64+
ctx := context.WithValue(context.Background(), cactus-plugin-htlc-coordinator-besu.ContextOperationServerIndices, map[string]int{
65+
"{classname}Service.{nickname}": 2,
66+
})
67+
ctx = context.WithValue(context.Background(), cactus-plugin-htlc-coordinator-besu.ContextOperationServerVariables, map[string]map[string]string{
68+
"{classname}Service.{nickname}": {
69+
"port": "8443",
70+
},
71+
})
72+
```
73+
74+
## Documentation for API Endpoints
75+
76+
All URIs are relative to *https://www.cactus.stream*
77+
78+
Class | Method | HTTP request | Description
79+
------------ | ------------- | ------------- | -------------
80+
*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
81+
*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.
82+
*DefaultApi* | [**WithdrawCounterpartyV1**](docs/DefaultApi.md#withdrawcounterpartyv1) | **Post** /api/v1/plugins/@hyperledger/cactus-plugin-htlc-coordinator-besu/withdraw-counterparty | Withdraw funds of the counterparty HTLC
83+
84+
85+
## Documentation For Models
86+
87+
- [CounterpartyHTLCRequest](docs/CounterpartyHTLCRequest.md)
88+
- [HtlcPackage](docs/HtlcPackage.md)
89+
- [OwnHTLCRequest](docs/OwnHTLCRequest.md)
90+
- [Web3SigningCredential](docs/Web3SigningCredential.md)
91+
- [Web3SigningCredentialCactusKeychainRef](docs/Web3SigningCredentialCactusKeychainRef.md)
92+
- [Web3SigningCredentialNone](docs/Web3SigningCredentialNone.md)
93+
- [Web3SigningCredentialPrivateKeyHex](docs/Web3SigningCredentialPrivateKeyHex.md)
94+
- [Web3SigningCredentialType](docs/Web3SigningCredentialType.md)
95+
- [WithdrawCounterpartyRequest](docs/WithdrawCounterpartyRequest.md)
96+
97+
98+
## Documentation For Authorization
99+
100+
Endpoints do not require authorization.
101+
102+
103+
## Documentation for Utility Methods
104+
105+
Due to the fact that model structure members are all pointers, this package contains
106+
a number of utility functions to easily obtain pointers to values of basic types.
107+
Each of these functions takes a value of the given basic type and returns a pointer to it:
108+
109+
* `PtrBool`
110+
* `PtrInt`
111+
* `PtrInt32`
112+
* `PtrInt64`
113+
* `PtrFloat`
114+
* `PtrFloat32`
115+
* `PtrFloat64`
116+
* `PtrString`
117+
* `PtrTime`
118+
119+
## Author
120+
121+
122+

0 commit comments

Comments
 (0)