Skip to content

Commit

Permalink
Merge pull request #1886 from iotaledger/fix/misc-cli
Browse files Browse the repository at this point in the history
Fix: misc cli UX
  • Loading branch information
jorgemmsilva authored Feb 13, 2023
2 parents 5c73d60 + 10f3f32 commit 9fa78bc
Show file tree
Hide file tree
Showing 27 changed files with 257 additions and 203 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ lint: lint-wasp-cli
lint-wasp-cli:
cd ./tools/wasp-cli && golangci-lint run --timeout 5m

apiclient:
clients/apiclient/generate_client.sh

gofumpt-list:
gofumpt -l ./
Expand Down
98 changes: 24 additions & 74 deletions clients/apiclient/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ paths:
summary: Get information about a specific chain
tags:
- chains
/chains/{chainID}/access-node/{publicKey}:
/chains/{chainID}/access-node/{peer}:
delete:
operationId: removeAccessNode
parameters:
Expand All @@ -117,9 +117,9 @@ paths:
schema:
format: string
type: string
- description: Nodes public key (Hex)
- description: Name of the peer to remove as access node
in: path
name: publicKey
name: peer
required: true
schema:
format: string
Expand Down Expand Up @@ -149,9 +149,9 @@ paths:
schema:
format: string
type: string
- description: Nodes public key (Hex)
- description: Name of the peer to add as access node
in: path
name: publicKey
name: peer
required: true
schema:
format: string
Expand Down Expand Up @@ -1576,7 +1576,7 @@ paths:
application/json:
schema:
additionalProperties:
example: "true"
example: info
format: string
type: string
type: object
Expand Down Expand Up @@ -1709,7 +1709,7 @@ paths:
application/json:
schema:
items:
$ref: '#/components/schemas/PeeringNodeStatusResponse__'
$ref: '#/components/schemas/PeeringNodeStatusResponse_'
type: array
description: A list of all peers
"401":
Expand Down Expand Up @@ -2992,18 +2992,18 @@ components:
committeeNodes:
- node:
isAlive: true
peeringURL: peeringURL
peeringURL: localhost:4000
name: name
publicKey: 61270151fbd8c71e43c17e0eff8c76c1ba991be28f088f72a05d790f302d67c7
numUsers: 6
publicKey: 0x0000
numUsers: 1
isTrusted: true
accessAPI: accessAPI
- node:
isAlive: true
peeringURL: peeringURL
peeringURL: localhost:4000
name: name
publicKey: 61270151fbd8c71e43c17e0eff8c76c1ba991be28f088f72a05d790f302d67c7
numUsers: 6
publicKey: 0x0000
numUsers: 1
isTrusted: true
accessAPI: accessAPI
chainId: tst1pqm5ckama06xhkl080mmvz6l3xy8c8lulrwy7mx4ll0fc69krxfgka70j0e
Expand Down Expand Up @@ -3109,10 +3109,10 @@ components:
example:
node:
isAlive: true
peeringURL: peeringURL
peeringURL: localhost:4000
name: name
publicKey: 61270151fbd8c71e43c17e0eff8c76c1ba991be28f088f72a05d790f302d67c7
numUsers: 6
publicKey: 0x0000
numUsers: 1
isTrusted: true
accessAPI: accessAPI
properties:
Expand Down Expand Up @@ -3843,7 +3843,7 @@ components:
name: InStateOutputMetricItem
InfoResponse:
example:
peeringURL: peeringURL
peeringURL: 0.0.0.0:4000
l1Params:
protocol:
rentStructure:
Expand Down Expand Up @@ -3871,6 +3871,7 @@ components:
$ref: '#/components/schemas/L1Params'
peeringURL:
description: The net id of the node
example: 0.0.0.0:4000
format: string
type: string
xml:
Expand Down Expand Up @@ -4393,7 +4394,7 @@ components:
name: OutputID
PeeringNodeIdentityResponse:
example:
peeringURL: peeringURL
peeringURL: localhost:4000
name: name
publicKey: 0x0000
isTrusted: true
Expand All @@ -4411,6 +4412,7 @@ components:
name: Name
peeringURL:
description: The peering URL of the peer
example: localhost:4000
format: string
type: string
xml:
Expand Down Expand Up @@ -4486,61 +4488,7 @@ components:
PeeringNodeStatusResponse_:
example:
isAlive: true
peeringURL: peeringURL
name: name
publicKey: 61270151fbd8c71e43c17e0eff8c76c1ba991be28f088f72a05d790f302d67c7
numUsers: 6
isTrusted: true
properties:
isAlive:
description: Whether or not the peer is activated
format: boolean
type: boolean
xml:
name: IsAlive
isTrusted:
format: boolean
type: boolean
xml:
name: IsTrusted
name:
format: string
type: string
xml:
name: Name
numUsers:
description: The amount of users attached to the peer
format: int32
type: integer
xml:
name: NumUsers
peeringURL:
description: The peering URL of the peer
format: string
type: string
xml:
name: PeeringURL
publicKey:
description: The peers public key encoded in Hex
example: 61270151fbd8c71e43c17e0eff8c76c1ba991be28f088f72a05d790f302d67c7
format: string
type: string
xml:
name: PublicKey
required:
- isAlive
- isTrusted
- name
- numUsers
- peeringURL
- publicKey
type: object
xml:
name: PeeringNodeStatusResponse
PeeringNodeStatusResponse__:
example:
isAlive: true
peeringURL: peeringURL
peeringURL: localhost:4000
name: name
publicKey: 0x0000
numUsers: 1
Expand Down Expand Up @@ -4573,6 +4521,7 @@ components:
name: NumUsers
peeringURL:
description: The peering URL of the peer
example: localhost:4000
format: string
type: string
xml:
Expand All @@ -4596,7 +4545,7 @@ components:
name: PeeringNodeStatusResponse
PeeringTrustRequest:
example:
peeringURL: peeringURL
peeringURL: localhost:4000
name: name
publicKey: 0x0000
properties:
Expand All @@ -4607,6 +4556,7 @@ components:
name: Name
peeringURL:
description: The peering URL of the peer
example: localhost:4000
format: string
type: string
xml:
Expand Down
24 changes: 12 additions & 12 deletions clients/apiclient/api_chains.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions clients/apiclient/docs/ChainsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**ActivateChain**](ChainsApi.md#ActivateChain) | **Post** /chains/{chainID}/activate | Activate a chain
[**AddAccessNode**](ChainsApi.md#AddAccessNode) | **Put** /chains/{chainID}/access-node/{publicKey} | Configure a trusted node to be an access node.
[**AddAccessNode**](ChainsApi.md#AddAccessNode) | **Put** /chains/{chainID}/access-node/{peer} | Configure a trusted node to be an access node.
[**AttachToWebsocket**](ChainsApi.md#AttachToWebsocket) | **Get** /chains/{chainID}/ws |
[**ChainsChainIDEvmGet**](ChainsApi.md#ChainsChainIDEvmGet) | **Get** /chains/{chainID}/evm |
[**DeactivateChain**](ChainsApi.md#DeactivateChain) | **Post** /chains/{chainID}/deactivate | Deactivate a chain
Expand All @@ -15,7 +15,7 @@ Method | HTTP request | Description
[**GetContracts**](ChainsApi.md#GetContracts) | **Get** /chains/{chainID}/contracts | Get all available chain contracts
[**GetRequestIDFromEVMTransactionID**](ChainsApi.md#GetRequestIDFromEVMTransactionID) | **Get** /chains/{chainID}/evm/tx/{txHash} | Get the ISC request ID for the given Ethereum transaction hash
[**GetStateValue**](ChainsApi.md#GetStateValue) | **Get** /chains/{chainID}/state/{stateKey} | Fetch the raw value associated with the given key in the chain state
[**RemoveAccessNode**](ChainsApi.md#RemoveAccessNode) | **Delete** /chains/{chainID}/access-node/{publicKey} | Remove an access node.
[**RemoveAccessNode**](ChainsApi.md#RemoveAccessNode) | **Delete** /chains/{chainID}/access-node/{peer} | Remove an access node.
[**SetChainRecord**](ChainsApi.md#SetChainRecord) | **Post** /chains/{chainID}/chainrecord | Sets the chain record.


Expand Down Expand Up @@ -88,7 +88,7 @@ Name | Type | Description | Notes

## AddAccessNode

> AddAccessNode(ctx, chainID, publicKey).Execute()
> AddAccessNode(ctx, chainID, peer).Execute()
Configure a trusted node to be an access node.

Expand All @@ -106,11 +106,11 @@ import (

func main() {
chainID := "chainID_example" // string | ChainID (Bech32)
publicKey := "publicKey_example" // string | Nodes public key (Hex)
peer := "peer_example" // string | Name of the peer to add as access node

configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.ChainsApi.AddAccessNode(context.Background(), chainID, publicKey).Execute()
resp, r, err := apiClient.ChainsApi.AddAccessNode(context.Background(), chainID, peer).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.AddAccessNode``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
Expand All @@ -125,7 +125,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**chainID** | **string** | ChainID (Bech32) |
**publicKey** | **string** | Nodes public key (Hex) |
**peer** | **string** | Name of the peer to add as access node |

### Other Parameters

Expand Down Expand Up @@ -762,7 +762,7 @@ Name | Type | Description | Notes

## RemoveAccessNode

> RemoveAccessNode(ctx, chainID, publicKey).Execute()
> RemoveAccessNode(ctx, chainID, peer).Execute()
Remove an access node.

Expand All @@ -780,11 +780,11 @@ import (

func main() {
chainID := "chainID_example" // string | ChainID (Bech32)
publicKey := "publicKey_example" // string | Nodes public key (Hex)
peer := "peer_example" // string | Name of the peer to remove as access node

configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.ChainsApi.RemoveAccessNode(context.Background(), chainID, publicKey).Execute()
resp, r, err := apiClient.ChainsApi.RemoveAccessNode(context.Background(), chainID, peer).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.RemoveAccessNode``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
Expand All @@ -799,7 +799,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**chainID** | **string** | ChainID (Bech32) |
**publicKey** | **string** | Nodes public key (Hex) |
**peer** | **string** | Name of the peer to remove as access node |

### Other Parameters

Expand Down
Loading

0 comments on commit 9fa78bc

Please sign in to comment.