Categorygithub.com/curvegrid/multibaas-sdk-go
repositorypackage
1.0.0-beta8
Repository: https://github.com/curvegrid/multibaas-sdk-go.git
Documentation: pkg.go.dev

# README

Go API client for multibaas

MultiBaas's REST APIv0.

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: 0.0
  • Package version: 1.0.0-beta8
  • Generator version: 7.9.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

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 multibaas "github.com/curvegrid/multibaas-sdk-go"

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 multibaas.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), multibaas.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value multibaas.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), multibaas.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 multibaas.ContextOperationServerIndices and multibaas.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), multibaas.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), multibaas.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://your_deployment.multibaas.com/api/v0

ClassMethodHTTP requestDescription
AddressesAPIDeleteAddressDelete /chains/{chain}/addresses/{address-or-label}Delete address
AddressesAPIGetAddressGet /chains/{chain}/addresses/{address-or-label}Get address
AddressesAPIListAddressesGet /chains/{chain}/addressesList addresses
AddressesAPISetAddressPost /chains/{chain}/addressesCreate or update address
AdminAPIAcceptInvitePost /invites/{inviteID}Accept invite
AdminAPIAddCorsOriginPost /corsAdd CORS origin
AdminAPIAddGroupApiKeyPut /groups/{groupID}/api_keys/{apiKeyID}Add API key to group
AdminAPIAddGroupRolePut /groups/{groupID}/roles/{roleShortName}Add role to group
AdminAPIAddGroupUserPut /groups/{groupID}/users/{userID}Add user to group
AdminAPICheckInviteGet /invites/{inviteID}Check invite
AdminAPICreateApiKeyPost /api_keysCreate API key
AdminAPIDeleteApiKeyDelete /api_keys/{apiKeyID}Delete API key
AdminAPIDeleteUserDelete /users/{userID}Delete user
AdminAPIGetApiKeyGet /api_keys/{apiKeyID}Get API Key
AdminAPIInviteUserPost /invitesInvite user
AdminAPIListApiKeysGet /api_keysList API keys
AdminAPIListAuditLogsGet /systemactivitiesList audit logs
AdminAPIListCorsOriginsGet /corsList CORS origins
AdminAPIListGroupsGet /groupsList groups
AdminAPIListUserSignersGet /users/{userID}/signersList user signers
AdminAPIListUsersGet /usersList users
AdminAPIRemoveCorsOriginDelete /cors/{originID}Remove CORS Origin
AdminAPIRemoveGroupApiKeyDelete /groups/{groupID}/api_keys/{apiKeyID}Remove API key from group
AdminAPIRemoveGroupRoleDelete /groups/{groupID}/roles/{roleShortName}Remove role from group
AdminAPIRemoveGroupUserDelete /groups/{groupID}/users/{userID}Remove user from group
AdminAPIRemoveUserSignerCloudWalletDelete /users/{userID}/cloudwallets/{wallet_address}Remove user cloud wallet signer
AdminAPIRemoveUserSignerSafeAccountDelete /users/{userID}/safeaccounts/{wallet_address}Remove user safe account signer
AdminAPIRemoveUserSignerWeb3WalletDelete /users/{userID}/web3wallets/{wallet_address}Remove user web3 wallet signer
AdminAPISetUserSignerCloudWalletPut /users/{userID}/cloudwallets/{wallet_address}Add or update user cloud wallet signer
AdminAPISetUserSignerSafeAccountPut /users/{userID}/safeaccounts/{wallet_address}Add or update user safe account signer
AdminAPISetUserSignerWeb3WalletPut /users/{userID}/web3wallets/{wallet_address}Add or update user web3 wallet signer
AdminAPIUpdateApiKeyPut /api_keys/{apiKeyID}Update API key
ChainsAPIGetBlockGet /chains/{chain}/blocks/{block}Get a block
ChainsAPIGetChainStatusGet /chains/{chain}/statusGet chain status
ChainsAPIGetTransactionGet /chains/{chain}/transactions/{hash}Get transaction
ChainsAPIGetTransactionReceiptGet /chains/{chain}/transactions/receipt/{hash}Get transaction receipt
ChainsAPISubmitSignedTransactionPost /chains/{chain}/transactions/submitSubmit signed transaction
ChainsAPITransferEthPost /chains/{chain}/transfersTransfer ETH
ContractsAPICallContractFunctionPost /chains/{chain}/addresses/{address-or-label}/contracts/{contract}/methods/{method}Call a contract function
ContractsAPICreateContractPost /contracts/{contract}Create a contract
ContractsAPICreateContractsPost /contractsCreate multiple contracts
ContractsAPIDeleteContractDelete /contracts/{contract}Delete a contract
ContractsAPIDeleteContractVersionDelete /contracts/{contract}/{version}Delete a contract version
ContractsAPIDeployContractPost /contracts/{contract}/deployDeploy a contract
ContractsAPIDeployContractVersionPost /contracts/{contract}/{version}/deployDeploy a contract version
ContractsAPIGetContractGet /contracts/{contract}Get a contract
ContractsAPIGetContractVersionGet /contracts/{contract}/{version}Get a contract version
ContractsAPIGetContractVersionsGet /contracts/{contract}/allGet all contract versions
ContractsAPIGetEventMonitorStatusGet /chains/{chain}/addresses/{address-or-label}/contracts/{contract}/statusGet event monitor status
ContractsAPIGetEventTypeConversionsGet /contracts/{contract}/{version}/events/{event}Get event type conversions
ContractsAPIGetFunctionTypeConversionsGet /contracts/{contract}/{version}/methods/{method}Get function type conversions
ContractsAPILinkAddressContractPost /chains/{chain}/addresses/{address-or-label}/contractsLink address and contract
ContractsAPIListContractVersionsGet /contracts/{contract}/versionsList all contract versions
ContractsAPIListContractsGet /contractsList contracts
ContractsAPISetEventTypeConversionsPost /contracts/{contract}/{version}/events/{event}Set event type conversions
ContractsAPISetFunctionTypeConversionsPost /contracts/{contract}/{version}/methods/{method}Set function type conversions
ContractsAPIUnlinkAddressContractDelete /chains/{chain}/addresses/{address-or-label}/contracts/{contract}Unlink address and contract
EventQueriesAPICountEventQueryRecordsGet /queries/{event_query}/countCount event query records
EventQueriesAPIDeleteEventQueryDelete /queries/{event_query}Delete event query
EventQueriesAPIExecuteArbitraryEventQueryPost /queriesExecute arbitrary event query
EventQueriesAPIExecuteEventQueryGet /queries/{event_query}/resultsExecute event query
EventQueriesAPIGetEventQueryGet /queries/{event_query}Get event query
EventQueriesAPIListEventQueriesGet /queriesList event queries
EventQueriesAPISetEventQueryPut /queries/{event_query}Create or update event query
EventsAPIGetEventCountGet /events/countGet event count
EventsAPIListEventsGet /eventsList events
HsmAPIAddHsmConfigPost /hsm/configAdd HSM config
HsmAPIAddHsmKeyPost /hsm/keyAdd HSM key
HsmAPICreateHsmKeyPost /hsm/key/newCreate HSM key
HsmAPIListHsmGet /hsmList HSM configs and wallets
HsmAPIListHsmWalletsGet /hsm/walletsList HSM wallets
HsmAPIRemoveHsmConfigDelete /hsm/config/{client_id}Remove HSM config
HsmAPIRemoveHsmKeyDelete /hsm/key/{wallet_address}Remove HSM key
HsmAPISetLocalNoncePost /chains/{chain}/hsm/nonce/{wallet_address}Set local nonce
HsmAPISignAndSubmitTransactionPost /chains/{chain}/hsm/submitSign and submit transaction
HsmAPISignDataPost /chains/{chain}/hsm/signSign data
TxmAPICancelTransactionPost /chains/{chain}/txm/{wallet_address}/nonce/{nonce}/cancelCancel transaction
TxmAPICountWalletTransactionsGet /chains/{chain}/txm/{wallet_address}/countCount all transactions for a wallet
TxmAPIListWalletTransactionsGet /chains/{chain}/txm/{wallet_address}List transactions for a wallet
TxmAPISpeedUpTransactionPost /chains/{chain}/txm/{wallet_address}/nonce/{nonce}/speed_upSpeed up transaction
WebhooksAPICountWebhookEventsGet /webhooks/{webhookID}/events/countCount webhook events
WebhooksAPICountWebhooksGet /webhooks/countCount webhooks
WebhooksAPICreateWebhookPost /webhooksCreate webhook
WebhooksAPIDeleteWebhookDelete /webhooks/{webhookID}Delete webhook
WebhooksAPIGetWebhookGet /webhooks/{webhookID}Get webhook
WebhooksAPIListWebhookEventsGet /webhooks/{webhookID}/eventsList webhook events
WebhooksAPIListWebhooksGet /webhooksList webhooks
WebhooksAPIUpdateWebhookPut /webhooks/{webhookID}Update webhook

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

bearer

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), multibaas.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)

cookie

  • Type: API key
  • API key parameter name: token
  • Location:

Note, each API key must be added to a map of map[string]APIKey where the key is: cookie and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		multibaas.ContextAPIKeys,
		map[string]multibaas.APIKey{
			"cookie": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

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