# README
Go API client for client
REST API for the Wasp node
Overview
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 1
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Generation
- Install newest OpenAPI Generator binary
- Run an up to date Wasp node
- Execute
openapi-generator-cli generate -i http://localhost:9090/doc/swagger.json -g go --package-name=client
Installation
Install the following dependencies:
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:
import "github.com/iotaledger/wasp/clients/apiclient"
To use a proxy, set the environment variable HTTP_PROXY
:
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
.
ctx := context.WithValue(context.Background(), apiclient.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
.
ctx := context.WithValue(context.Background(), apiclient.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.
ctx := context.WithValue(context.Background(), apiclient.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), apiclient.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
Documentation for API Endpoints
All URIs are relative to http://localhost:9090
Class | Method | HTTP request | Description |
---|---|---|---|
AuthApi | AuthInfo | Get /auth/info | Get information about the current authentication mode |
AuthApi | Authenticate | Post /auth | Authenticate towards the node |
ChainsApi | ActivateChain | Post /v1/chains/{chainID}/activate | Activate a chain |
ChainsApi | AddAccessNode | Put /v1/chains/{chainID}/access-node/{peer} | Configure a trusted node to be an access node. |
ChainsApi | DeactivateChain | Post /v1/chains/{chainID}/deactivate | Deactivate a chain |
ChainsApi | GetChainInfo | Get /v1/chains/{chainID} | Get information about a specific chain |
ChainsApi | GetChains | Get /v1/chains | Get a list of all chains |
ChainsApi | GetCommitteeInfo | Get /v1/chains/{chainID}/committee | Get information about the deployed committee |
ChainsApi | GetContracts | Get /v1/chains/{chainID}/contracts | Get all available chain contracts |
ChainsApi | GetRequestIDFromEVMTransactionID | Get /v1/chains/{chainID}/evm/tx/{txHash} | Get the ISC request ID for the given Ethereum transaction hash |
ChainsApi | GetStateValue | Get /v1/chains/{chainID}/state/{stateKey} | Fetch the raw value associated with the given key in the chain state |
ChainsApi | RemoveAccessNode | Delete /v1/chains/{chainID}/access-node/{peer} | Remove an access node. |
ChainsApi | SetChainRecord | Post /v1/chains/{chainID}/chainrecord | Sets the chain record. |
ChainsApi | V1ChainsChainIDEvmGet | Get /v1/chains/{chainID}/evm | Ethereum JSON-RPC |
ChainsApi | V1ChainsChainIDEvmWsGet | Get /v1/chains/{chainID}/evm/ws | Ethereum JSON-RPC (Websocket transport) |
CorecontractsApi | AccountsGetAccountBalance | Get /v1/chains/{chainID}/core/accounts/account/{agentID}/balance | Get all assets belonging to an account |
CorecontractsApi | AccountsGetAccountFoundries | Get /v1/chains/{chainID}/core/accounts/account/{agentID}/foundries | Get all foundries owned by an account |
CorecontractsApi | AccountsGetAccountNFTIDs | Get /v1/chains/{chainID}/core/accounts/account/{agentID}/nfts | Get all NFT ids belonging to an account |
CorecontractsApi | AccountsGetAccountNonce | Get /v1/chains/{chainID}/core/accounts/account/{agentID}/nonce | Get the current nonce of an account |
CorecontractsApi | AccountsGetAccounts | Get /v1/chains/{chainID}/core/accounts | Get a list of all accounts |
CorecontractsApi | AccountsGetFoundryOutput | Get /v1/chains/{chainID}/core/accounts/foundry_output/{serialNumber} | Get the foundry output |
CorecontractsApi | AccountsGetNFTData | Get /v1/chains/{chainID}/core/accounts/nftdata/{nftID} | Get the NFT data by an ID |
CorecontractsApi | AccountsGetNativeTokenIDRegistry | Get /v1/chains/{chainID}/core/accounts/token_registry | Get a list of all registries |
CorecontractsApi | AccountsGetTotalAssets | Get /v1/chains/{chainID}/core/accounts/total_assets | Get all stored assets |
CorecontractsApi | BlobsGetAllBlobs | Get /v1/chains/{chainID}/core/blobs | Get all stored blobs |
CorecontractsApi | BlobsGetBlobInfo | Get /v1/chains/{chainID}/core/blobs/{blobHash} | Get all fields of a blob |
CorecontractsApi | BlobsGetBlobValue | Get /v1/chains/{chainID}/core/blobs/{blobHash}/data/{fieldKey} | Get the value of the supplied field (key) |
CorecontractsApi | BlocklogGetBlockInfo | Get /v1/chains/{chainID}/core/blocklog/blocks/{blockIndex} | Get the block info of a certain block index |
CorecontractsApi | BlocklogGetControlAddresses | Get /v1/chains/{chainID}/core/blocklog/controladdresses | Get the control addresses |
CorecontractsApi | BlocklogGetEventsOfBlock | Get /v1/chains/{chainID}/core/blocklog/events/block/{blockIndex} | Get events of a block |
CorecontractsApi | BlocklogGetEventsOfContract | Get /v1/chains/{chainID}/core/blocklog/events/contract/{contractHname} | Get events of a contract |
CorecontractsApi | BlocklogGetEventsOfLatestBlock | Get /v1/chains/{chainID}/core/blocklog/events/block/latest | Get events of the latest block |
CorecontractsApi | BlocklogGetEventsOfRequest | Get /v1/chains/{chainID}/core/blocklog/events/request/{requestID} | Get events of a request |
CorecontractsApi | BlocklogGetLatestBlockInfo | Get /v1/chains/{chainID}/core/blocklog/blocks/latest | Get the block info of the latest block |
CorecontractsApi | BlocklogGetRequestIDsForBlock | Get /v1/chains/{chainID}/core/blocklog/blocks/{blockIndex}/requestids | Get the request ids for a certain block index |
CorecontractsApi | BlocklogGetRequestIDsForLatestBlock | Get /v1/chains/{chainID}/core/blocklog/blocks/latest/requestids | Get the request ids for the latest block |
CorecontractsApi | BlocklogGetRequestIsProcessed | Get /v1/chains/{chainID}/core/blocklog/requests/{requestID}/is_processed | Get the request processing status |
CorecontractsApi | BlocklogGetRequestReceipt | Get /v1/chains/{chainID}/core/blocklog/requests/{requestID} | Get the receipt of a certain request id |
CorecontractsApi | BlocklogGetRequestReceiptsOfBlock | Get /v1/chains/{chainID}/core/blocklog/blocks/{blockIndex}/receipts | Get all receipts of a certain block |
CorecontractsApi | BlocklogGetRequestReceiptsOfLatestBlock | Get /v1/chains/{chainID}/core/blocklog/blocks/latest/receipts | Get all receipts of the latest block |
CorecontractsApi | ErrorsGetErrorMessageFormat | Get /v1/chains/{chainID}/core/errors/{contractHname}/message/{errorID} | Get the error message format of a specific error id |
CorecontractsApi | GovernanceGetAllowedStateControllerAddresses | Get /v1/chains/{chainID}/core/governance/allowedstatecontrollers | Get the allowed state controller addresses |
CorecontractsApi | GovernanceGetChainInfo | Get /v1/chains/{chainID}/core/governance/chaininfo | Get the chain info |
CorecontractsApi | GovernanceGetChainOwner | Get /v1/chains/{chainID}/core/governance/chainowner | Get the chain owner |
DefaultApi | GetHealth | Get /health | Returns 200 if the node is healthy. |
DefaultApi | V1WsGet | Get /v1/ws | The websocket connection service |
MetricsApi | GetChainMessageMetrics | Get /v1/metrics/chain/{chainID}/messages | Get chain specific message metrics. |
MetricsApi | GetChainPipeMetrics | Get /v1/metrics/chain/{chainID}/pipe | Get chain pipe event metrics. |
MetricsApi | GetChainWorkflowMetrics | Get /v1/metrics/chain/{chainID}/workflow | Get chain workflow metrics. |
MetricsApi | GetNodeMessageMetrics | Get /v1/metrics/node/messages | Get accumulated message metrics. |
NodeApi | DistrustPeer | Delete /v1/node/peers/trusted/{peer} | Distrust a peering node |
NodeApi | GenerateDKS | Post /v1/node/dks | Generate a new distributed key |
NodeApi | GetAllPeers | Get /v1/node/peers | Get basic information about all configured peers |
NodeApi | GetConfiguration | Get /v1/node/config | Return the Wasp configuration |
NodeApi | GetDKSInfo | Get /v1/node/dks/{sharedAddress} | Get information about the shared address DKS configuration |
NodeApi | GetInfo | Get /v1/node/info | Returns private information about this node. |
NodeApi | GetPeeringIdentity | Get /v1/node/peers/identity | Get basic peer info of the current node |
NodeApi | GetTrustedPeers | Get /v1/node/peers/trusted | Get trusted peers |
NodeApi | GetVersion | Get /v1/node/version | Returns the node version. |
NodeApi | SetNodeOwner | Post /v1/node/owner/certificate | Sets the node owner |
NodeApi | ShutdownNode | Post /v1/node/shutdown | Shut down the node |
NodeApi | TrustPeer | Post /v1/node/peers/trusted | Trust a peering node |
RequestsApi | CallView | Post /v1/requests/callview | Call a view function on a contract by Hname |
RequestsApi | GetReceipt | Get /v1/chains/{chainID}/receipts/{requestID} | Get a receipt from a request ID |
RequestsApi | OffLedger | Post /v1/requests/offledger | Post an off-ledger request |
RequestsApi | WaitForRequest | Get /v1/chains/{chainID}/requests/{requestID}/wait | Wait until the given request has been processed by the node |
UsersApi | AddUser | Post /v1/users | Add a user |
UsersApi | ChangeUserPassword | Put /v1/users/{username}/password | Change user password |
UsersApi | ChangeUserPermissions | Put /v1/users/{username}/permissions | Change user permissions |
UsersApi | DeleteUser | Delete /v1/users/{username} | Deletes a user |
UsersApi | GetUser | Get /v1/users/{username} | Get a user |
UsersApi | GetUsers | Get /v1/users | Get a list of all users |
Documentation For Models
- AccountFoundriesResponse
- AccountListResponse
- AccountNFTsResponse
- AccountNonceResponse
- AddUserRequest
- AliasOutputMetricItem
- Assets
- AssetsResponse
- AuthInfoModel
- BaseToken
- Blob
- BlobInfoResponse
- BlobListResponse
- BlobValueResponse
- BlockInfoResponse
- BlockReceiptError
- BlockReceiptsResponse
- BurnLog
- BurnRecord
- CallTarget
- ChainInfoResponse
- ChainMessageMetrics
- ChainRecord
- CommitteeInfoResponse
- CommitteeNode
- ConsensusPipeMetrics
- ConsensusWorkflowMetrics
- ContractCallViewRequest
- ContractInfoResponse
- ControlAddressesResponse
- DKSharesInfo
- DKSharesPostRequest
- ErrorMessageFormatResponse
- ErrorParameter
- EventsResponse
- FeePolicy
- FoundryOutputResponse
- GovAllowedStateControllerAddressesResponse
- GovChainInfoResponse
- GovChainOwnerResponse
- InOutput
- InOutputMetricItem
- InStateOutput
- InStateOutputMetricItem
- InfoResponse
- InterfaceMetricItem
- Item
- JSONDict
- L1Params
- Limits
- LoginRequest
- LoginResponse
- MilestoneInfo
- MilestoneMetricItem
- NFTDataResponse
- NativeToken
- NativeTokenIDRegistryResponse
- NodeMessageMetrics
- NodeOwnerCertificateRequest
- NodeOwnerCertificateResponse
- OffLedgerRequest
- OnLedgerRequest
- OnLedgerRequestMetricItem
- Output
- OutputID
- PeeringNodeIdentityResponse
- PeeringNodeStatusResponse
- PeeringTrustRequest
- ProtocolParameters
- PublisherStateTransactionItem
- Ratio32
- ReceiptError
- ReceiptResponse
- RentStructure
- RequestDetail
- RequestIDResponse
- RequestIDsResponse
- RequestProcessedResponse
- RequestReceiptResponse
- StateResponse
- StateTransaction
- Transaction
- TransactionIDMetricItem
- TransactionMetricItem
- TxInclusionStateMsg
- TxInclusionStateMsgMetricItem
- UTXOInputMetricItem
- UpdateUserPasswordRequest
- UpdateUserPermissionsRequest
- User
- ValidationError
- VersionResponse
Documentation For Authorization
Authorization
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: Authorization and passed in as the auth context for each request.
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