|
| 1 | +# Go API client for rpc_client |
| 2 | + |
| 3 | +This is the documentation for the `stacks-node` RPC interface. |
| 4 | + |
| 5 | + |
| 6 | +## Overview |
| 7 | +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. |
| 8 | + |
| 9 | +- API version: 1.0.0 |
| 10 | +- Package version: 1.0.0 |
| 11 | +- Generator version: 7.8.0 |
| 12 | +- Build package: org.openapitools.codegen.languages.GoClientCodegen |
| 13 | + |
| 14 | +## Installation |
| 15 | + |
| 16 | +Install the following dependencies: |
| 17 | + |
| 18 | +```sh |
| 19 | +go get github.com/stretchr/testify/assert |
| 20 | +go get golang.org/x/net/context |
| 21 | +``` |
| 22 | + |
| 23 | +Put the package under your project folder and add the following in import: |
| 24 | + |
| 25 | +```go |
| 26 | +import rpc_client "github.com/GIT_USER_ID/GIT_REPO_ID" |
| 27 | +``` |
| 28 | + |
| 29 | +To use a proxy, set the environment variable `HTTP_PROXY`: |
| 30 | + |
| 31 | +```go |
| 32 | +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") |
| 33 | +``` |
| 34 | + |
| 35 | +## Configuration of Server URL |
| 36 | + |
| 37 | +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. |
| 38 | + |
| 39 | +### Select Server Configuration |
| 40 | + |
| 41 | +For using other server than the one defined on index 0 set context value `rpc_client.ContextServerIndex` of type `int`. |
| 42 | + |
| 43 | +```go |
| 44 | +ctx := context.WithValue(context.Background(), rpc_client.ContextServerIndex, 1) |
| 45 | +``` |
| 46 | + |
| 47 | +### Templated Server URL |
| 48 | + |
| 49 | +Templated server URL is formatted using default variables from configuration or from context value `rpc_client.ContextServerVariables` of type `map[string]string`. |
| 50 | + |
| 51 | +```go |
| 52 | +ctx := context.WithValue(context.Background(), rpc_client.ContextServerVariables, map[string]string{ |
| 53 | + "basePath": "v2", |
| 54 | +}) |
| 55 | +``` |
| 56 | + |
| 57 | +Note, enum values are always validated and all unused variables are silently ignored. |
| 58 | + |
| 59 | +### URLs Configuration per Operation |
| 60 | + |
| 61 | +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. |
| 62 | +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. |
| 63 | +Similar rules for overriding default operation server index and variables applies by using `rpc_client.ContextOperationServerIndices` and `rpc_client.ContextOperationServerVariables` context maps. |
| 64 | + |
| 65 | +```go |
| 66 | +ctx := context.WithValue(context.Background(), rpc_client.ContextOperationServerIndices, map[string]int{ |
| 67 | + "{classname}Service.{nickname}": 2, |
| 68 | +}) |
| 69 | +ctx = context.WithValue(context.Background(), rpc_client.ContextOperationServerVariables, map[string]map[string]string{ |
| 70 | + "{classname}Service.{nickname}": { |
| 71 | + "port": "8443", |
| 72 | + }, |
| 73 | +}) |
| 74 | +``` |
| 75 | + |
| 76 | +## Documentation for API Endpoints |
| 77 | + |
| 78 | +All URIs are relative to *http://localhost:20443* |
| 79 | + |
| 80 | +Class | Method | HTTP request | Description |
| 81 | +------------ | ------------- | ------------- | ------------- |
| 82 | +*AccountsAPI* | [**GetAccountInfo**](docs/AccountsAPI.md#getaccountinfo) | **Get** /v2/accounts/{principal} | Get account info |
| 83 | +*BlocksAPI* | [**GetBlockV3**](docs/BlocksAPI.md#getblockv3) | **Get** /v3/blocks/{block_id} | Fetch a Nakamoto block |
| 84 | +*BlocksAPI* | [**GetTenureInfo**](docs/BlocksAPI.md#gettenureinfo) | **Get** /v3/tenures/info | Fetch metadata about the ongoing Nakamoto tenure |
| 85 | +*BlocksAPI* | [**GetTenures**](docs/BlocksAPI.md#gettenures) | **Get** /v3/tenures/{block_id} | Fetch a sequence of Nakamoto blocks in a tenure |
| 86 | +*FeesAPI* | [**GetFeeTransfer**](docs/FeesAPI.md#getfeetransfer) | **Get** /v2/fees/transfer | Get estimated fee |
| 87 | +*FeesAPI* | [**PostFeeTransaction**](docs/FeesAPI.md#postfeetransaction) | **Post** /v2/fees/transaction | Get approximate fees for the given transaction |
| 88 | +*InfoAPI* | [**GetBurnOps**](docs/InfoAPI.md#getburnops) | **Get** /v2/burn_ops/{burn_height}/{op_type} | Get burn operations |
| 89 | +*InfoAPI* | [**GetCoreApiInfo**](docs/InfoAPI.md#getcoreapiinfo) | **Get** /v2/info | Get Core API info |
| 90 | +*InfoAPI* | [**GetPoxInfo**](docs/InfoAPI.md#getpoxinfo) | **Get** /v2/pox | Get PoX details |
| 91 | +*MiningAPI* | [**GetStackerSet**](docs/MiningAPI.md#getstackerset) | **Get** /v2/stacker_set/{cycle_number} | Fetch the stacker and signer set information for a given cycle. |
| 92 | +*MiningAPI* | [**PostBlockProposal**](docs/MiningAPI.md#postblockproposal) | **Post** /v2/block_proposal | Validate a proposed Stacks block |
| 93 | +*SmartContractsAPI* | [**CallReadOnlyFunction**](docs/SmartContractsAPI.md#callreadonlyfunction) | **Post** /v2/contracts/call-read/{contract_address}/{contract_name}/{function_name} | Call read-only function |
| 94 | +*SmartContractsAPI* | [**GetConstantVal**](docs/SmartContractsAPI.md#getconstantval) | **Post** /v2/constant_val/{contract_address}/{contract_name}/{constant_name} | Get the value of a constant inside a contract |
| 95 | +*SmartContractsAPI* | [**GetContractDataMapEntry**](docs/SmartContractsAPI.md#getcontractdatamapentry) | **Post** /v2/map_entry/{contract_address}/{contract_name}/{map_name} | Get specific data-map inside a contract |
| 96 | +*SmartContractsAPI* | [**GetContractInterface**](docs/SmartContractsAPI.md#getcontractinterface) | **Get** /v2/contracts/interface/{contract_address}/{contract_name} | Get contract interface |
| 97 | +*SmartContractsAPI* | [**GetContractSource**](docs/SmartContractsAPI.md#getcontractsource) | **Get** /v2/contracts/source/{contract_address}/{contract_name} | Get contract source |
| 98 | +*SmartContractsAPI* | [**GetIsTraitImplemented**](docs/SmartContractsAPI.md#getistraitimplemented) | **Get** /v2/traits/{contract_address}/{contract_name}/{trait_contract_address}/{trait_contract_name}/{trait_name} | Get trait implementation details |
| 99 | +*TransactionsAPI* | [**PostCoreNodeTransactions**](docs/TransactionsAPI.md#postcorenodetransactions) | **Post** /v2/transactions | Broadcast raw transaction |
| 100 | + |
| 101 | + |
| 102 | +## Documentation For Models |
| 103 | + |
| 104 | + - [GetAccountDataschema](docs/GetAccountDataschema.md) |
| 105 | + - [GetContractDataMapEntryschema](docs/GetContractDataMapEntryschema.md) |
| 106 | + - [GetContractInterfaceschema](docs/GetContractInterfaceschema.md) |
| 107 | + - [GetContractSourceschema](docs/GetContractSourceschema.md) |
| 108 | + - [GetInfoschema](docs/GetInfoschema.md) |
| 109 | + - [GetPoxschema](docs/GetPoxschema.md) |
| 110 | + - [GetPoxschemaContractVersionsInner](docs/GetPoxschemaContractVersionsInner.md) |
| 111 | + - [GetPoxschemaCurrentCycle](docs/GetPoxschemaCurrentCycle.md) |
| 112 | + - [GetPoxschemaNextCycle](docs/GetPoxschemaNextCycle.md) |
| 113 | + - [PostCallReadOnlyFnschema](docs/PostCallReadOnlyFnschema.md) |
| 114 | + - [PostCoreNodeTransactionsErrorschema](docs/PostCoreNodeTransactionsErrorschema.md) |
| 115 | + - [PostFeeTransactionResponseschema](docs/PostFeeTransactionResponseschema.md) |
| 116 | + - [PostFeeTransactionResponseschemaEstimatedCost](docs/PostFeeTransactionResponseschemaEstimatedCost.md) |
| 117 | + - [PostFeeTransactionResponseschemaEstimationsInner](docs/PostFeeTransactionResponseschemaEstimationsInner.md) |
| 118 | + - [PostFeeTransactionschema](docs/PostFeeTransactionschema.md) |
| 119 | + - [ReadOnlyFunctionArgsschema](docs/ReadOnlyFunctionArgsschema.md) |
| 120 | + |
| 121 | + |
| 122 | +## Documentation For Authorization |
| 123 | + |
| 124 | +Endpoints do not require authorization. |
| 125 | + |
| 126 | + |
| 127 | +## Documentation for Utility Methods |
| 128 | + |
| 129 | +Due to the fact that model structure members are all pointers, this package contains |
| 130 | +a number of utility functions to easily obtain pointers to values of basic types. |
| 131 | +Each of these functions takes a value of the given basic type and returns a pointer to it: |
| 132 | + |
| 133 | +* `PtrBool` |
| 134 | +* `PtrInt` |
| 135 | +* `PtrInt32` |
| 136 | +* `PtrInt64` |
| 137 | +* `PtrFloat` |
| 138 | +* `PtrFloat32` |
| 139 | +* `PtrFloat64` |
| 140 | +* `PtrString` |
| 141 | +* `PtrTime` |
| 142 | + |
| 143 | +## Author |
| 144 | + |
| 145 | + |
| 146 | + |
0 commit comments