Skip to content

Latest commit

 

History

History
371 lines (323 loc) · 22.8 KB

README.md

File metadata and controls

371 lines (323 loc) · 22.8 KB

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-beta9
  • 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

Class Method HTTP request Description
AddressesAPI DeleteAddress Delete /chains/{chain}/addresses/{address-or-label} Delete address
AddressesAPI GetAddress Get /chains/{chain}/addresses/{address-or-label} Get address
AddressesAPI ListAddresses Get /chains/{chain}/addresses List addresses
AddressesAPI SetAddress Post /chains/{chain}/addresses Create or update address
AdminAPI AcceptInvite Post /invites/{inviteID} Accept invite
AdminAPI AddCorsOrigin Post /cors Add CORS origin
AdminAPI AddGroupApiKey Put /groups/{groupID}/api_keys/{apiKeyID} Add API key to group
AdminAPI AddGroupRole Put /groups/{groupID}/roles/{roleShortName} Add role to group
AdminAPI AddGroupUser Put /groups/{groupID}/users/{userID} Add user to group
AdminAPI CheckInvite Get /invites/{inviteID} Check invite
AdminAPI CreateApiKey Post /api_keys Create API key
AdminAPI DeleteApiKey Delete /api_keys/{apiKeyID} Delete API key
AdminAPI DeleteUser Delete /users/{userID} Delete user
AdminAPI GetApiKey Get /api_keys/{apiKeyID} Get API Key
AdminAPI InviteUser Post /invites Invite user
AdminAPI ListApiKeys Get /api_keys List API keys
AdminAPI ListAuditLogs Get /systemactivities List audit logs
AdminAPI ListCorsOrigins Get /cors List CORS origins
AdminAPI ListGroups Get /groups List groups
AdminAPI ListUserSigners Get /users/{userID}/signers List user signers
AdminAPI ListUsers Get /users List users
AdminAPI RemoveCorsOrigin Delete /cors/{originID} Remove CORS Origin
AdminAPI RemoveGroupApiKey Delete /groups/{groupID}/api_keys/{apiKeyID} Remove API key from group
AdminAPI RemoveGroupRole Delete /groups/{groupID}/roles/{roleShortName} Remove role from group
AdminAPI RemoveGroupUser Delete /groups/{groupID}/users/{userID} Remove user from group
AdminAPI RemoveUserSignerCloudWallet Delete /users/{userID}/cloudwallets/{wallet_address} Remove user cloud wallet signer
AdminAPI RemoveUserSignerSafeAccount Delete /users/{userID}/safeaccounts/{wallet_address} Remove user safe account signer
AdminAPI RemoveUserSignerWeb3Wallet Delete /users/{userID}/web3wallets/{wallet_address} Remove user web3 wallet signer
AdminAPI SetUserSignerCloudWallet Put /users/{userID}/cloudwallets/{wallet_address} Add or update user cloud wallet signer
AdminAPI SetUserSignerSafeAccount Put /users/{userID}/safeaccounts/{wallet_address} Add or update user safe account signer
AdminAPI SetUserSignerWeb3Wallet Put /users/{userID}/web3wallets/{wallet_address} Add or update user web3 wallet signer
AdminAPI UpdateApiKey Put /api_keys/{apiKeyID} Update API key
ChainsAPI GetBlock Get /chains/{chain}/blocks/{block} Get a block
ChainsAPI GetChainStatus Get /chains/{chain}/status Get chain status
ChainsAPI GetTransaction Get /chains/{chain}/transactions/{hash} Get transaction
ChainsAPI GetTransactionReceipt Get /chains/{chain}/transactions/receipt/{hash} Get transaction receipt
ChainsAPI SubmitSignedTransaction Post /chains/{chain}/transactions/submit Submit signed transaction
ChainsAPI TransferEth Post /chains/{chain}/transfers Transfer ETH
ContractsAPI CallContractFunction Post /chains/{chain}/addresses/{address-or-label}/contracts/{contract}/methods/{method} Call a contract function
ContractsAPI CreateContract Post /contracts/{contract} Create a contract
ContractsAPI CreateContracts Post /contracts Create multiple contracts
ContractsAPI DeleteContract Delete /contracts/{contract} Delete a contract
ContractsAPI DeleteContractVersion Delete /contracts/{contract}/{version} Delete a contract version
ContractsAPI DeployContract Post /contracts/{contract}/deploy Deploy a contract
ContractsAPI DeployContractVersion Post /contracts/{contract}/{version}/deploy Deploy a contract version
ContractsAPI GetContract Get /contracts/{contract} Get a contract
ContractsAPI GetContractVersion Get /contracts/{contract}/{version} Get a contract version
ContractsAPI GetContractVersions Get /contracts/{contract}/all Get all contract versions
ContractsAPI GetEventMonitorStatus Get /chains/{chain}/addresses/{address-or-label}/contracts/{contract}/status Get event monitor status
ContractsAPI GetEventTypeConversions Get /contracts/{contract}/{version}/events/{event} Get event type conversions
ContractsAPI GetFunctionTypeConversions Get /contracts/{contract}/{version}/methods/{method} Get function type conversions
ContractsAPI LinkAddressContract Post /chains/{chain}/addresses/{address-or-label}/contracts Link address and contract
ContractsAPI ListContractVersions Get /contracts/{contract}/versions List all contract versions
ContractsAPI ListContracts Get /contracts List contracts
ContractsAPI SetEventTypeConversions Post /contracts/{contract}/{version}/events/{event} Set event type conversions
ContractsAPI SetFunctionTypeConversions Post /contracts/{contract}/{version}/methods/{method} Set function type conversions
ContractsAPI UnlinkAddressContract Delete /chains/{chain}/addresses/{address-or-label}/contracts/{contract} Unlink address and contract
EventQueriesAPI CountEventQueryRecords Get /queries/{event_query}/count Count event query records
EventQueriesAPI DeleteEventQuery Delete /queries/{event_query} Delete event query
EventQueriesAPI ExecuteArbitraryEventQuery Post /queries Execute arbitrary event query
EventQueriesAPI ExecuteEventQuery Get /queries/{event_query}/results Execute event query
EventQueriesAPI GetEventQuery Get /queries/{event_query} Get event query
EventQueriesAPI ListEventQueries Get /queries List event queries
EventQueriesAPI SetEventQuery Put /queries/{event_query} Create or update event query
EventsAPI GetEventCount Get /events/count Get event count
EventsAPI ListEvents Get /events List events
HsmAPI AddHsmConfig Post /hsm/config Add HSM config
HsmAPI AddHsmKey Post /hsm/key Add HSM key
HsmAPI CreateHsmKey Post /hsm/key/new Create HSM key
HsmAPI ListHsm Get /hsm List HSM configs and wallets
HsmAPI ListHsmWallets Get /hsm/wallets List HSM wallets
HsmAPI RemoveHsmConfig Delete /hsm/config/{client_id} Remove HSM config
HsmAPI RemoveHsmKey Delete /hsm/key/{wallet_address} Remove HSM key
HsmAPI SetLocalNonce Post /chains/{chain}/hsm/nonce/{wallet_address} Set local nonce
HsmAPI SignAndSubmitTransaction Post /chains/{chain}/hsm/submit Sign and submit transaction
HsmAPI SignData Post /chains/{chain}/hsm/sign Sign data
TxmAPI CancelTransaction Post /chains/{chain}/txm/{wallet_address}/nonce/{nonce}/cancel Cancel transaction
TxmAPI CountWalletTransactions Get /chains/{chain}/txm/{wallet_address}/count Count all transactions for a wallet
TxmAPI ListWalletTransactions Get /chains/{chain}/txm/{wallet_address} List transactions for a wallet
TxmAPI SpeedUpTransaction Post /chains/{chain}/txm/{wallet_address}/nonce/{nonce}/speed_up Speed up transaction
WebhooksAPI CountWebhookEvents Get /webhooks/{webhookID}/events/count Count webhook events
WebhooksAPI CountWebhooks Get /webhooks/count Count webhooks
WebhooksAPI CreateWebhook Post /webhooks Create webhook
WebhooksAPI DeleteWebhook Delete /webhooks/{webhookID} Delete webhook
WebhooksAPI GetWebhook Get /webhooks/{webhookID} Get webhook
WebhooksAPI ListWebhookEvents Get /webhooks/{webhookID}/events List webhook events
WebhooksAPI ListWebhooks Get /webhooks List webhooks
WebhooksAPI UpdateWebhook Put /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