From 97768923a9a99ffea49050d263d06a98a42c72e5 Mon Sep 17 00:00:00 2001 From: Chris Gianelloni Date: Wed, 3 Jul 2024 15:03:43 -0400 Subject: [PATCH] feat: openapi client Signed-off-by: Chris Gianelloni --- openapi/.gitignore | 24 + openapi/.openapi-generator-ignore | 23 + openapi/.openapi-generator/FILES | 33 + openapi/.openapi-generator/VERSION | 1 + openapi/.openapi-generator/go-config.yml | 3 + openapi/.travis.yml | 8 + openapi/README.md | 130 +++ openapi/api/openapi.yaml | 354 +++++++++ openapi/api_chainsync.go | 175 +++++ openapi/api_default.go | 183 +++++ openapi/api_localstatequery.go | 741 ++++++++++++++++++ openapi/api_localtxmonitor.go | 390 +++++++++ openapi/client.go | 658 ++++++++++++++++ openapi/configuration.go | 216 +++++ openapi/docs/ApiResponseApiError.md | 56 ++ .../ApiResponseLocalStateQueryCurrentEra.md | 82 ++ .../ApiResponseLocalStateQuerySystemStart.md | 108 +++ openapi/docs/ApiResponseLocalStateQueryTip.md | 160 ++++ .../docs/ApiResponseLocalTxMonitorHasTx.md | 56 ++ .../docs/ApiResponseLocalTxMonitorSizes.md | 108 +++ openapi/docs/ApiResponseLocalTxMonitorTxs.md | 82 ++ openapi/docs/ChainsyncAPI.md | 75 ++ openapi/docs/DefaultAPI.md | 75 ++ openapi/docs/LocalstatequeryAPI.md | 368 +++++++++ openapi/docs/LocaltxmonitorAPI.md | 197 +++++ openapi/go.mod | 11 + openapi/go.sum | 10 + openapi/model_api_response_api_error.go | 127 +++ ..._response_local_state_query_current_era.go | 163 ++++ ...response_local_state_query_system_start.go | 199 +++++ ...odel_api_response_local_state_query_tip.go | 271 +++++++ ...el_api_response_local_tx_monitor_has_tx.go | 127 +++ ...del_api_response_local_tx_monitor_sizes.go | 199 +++++ ...model_api_response_local_tx_monitor_txs.go | 163 ++++ openapi/response.go | 48 ++ openapi/test/api_chainsync_test.go | 36 + openapi/test/api_default_test.go | 37 + openapi/test/api_localstatequery_test.go | 97 +++ openapi/test/api_localtxmonitor_test.go | 63 ++ openapi/utils.go | 362 +++++++++ 40 files changed, 6219 insertions(+) create mode 100644 openapi/.gitignore create mode 100644 openapi/.openapi-generator-ignore create mode 100644 openapi/.openapi-generator/FILES create mode 100644 openapi/.openapi-generator/VERSION create mode 100644 openapi/.openapi-generator/go-config.yml create mode 100644 openapi/.travis.yml create mode 100644 openapi/README.md create mode 100644 openapi/api/openapi.yaml create mode 100644 openapi/api_chainsync.go create mode 100644 openapi/api_default.go create mode 100644 openapi/api_localstatequery.go create mode 100644 openapi/api_localtxmonitor.go create mode 100644 openapi/client.go create mode 100644 openapi/configuration.go create mode 100644 openapi/docs/ApiResponseApiError.md create mode 100644 openapi/docs/ApiResponseLocalStateQueryCurrentEra.md create mode 100644 openapi/docs/ApiResponseLocalStateQuerySystemStart.md create mode 100644 openapi/docs/ApiResponseLocalStateQueryTip.md create mode 100644 openapi/docs/ApiResponseLocalTxMonitorHasTx.md create mode 100644 openapi/docs/ApiResponseLocalTxMonitorSizes.md create mode 100644 openapi/docs/ApiResponseLocalTxMonitorTxs.md create mode 100644 openapi/docs/ChainsyncAPI.md create mode 100644 openapi/docs/DefaultAPI.md create mode 100644 openapi/docs/LocalstatequeryAPI.md create mode 100644 openapi/docs/LocaltxmonitorAPI.md create mode 100644 openapi/go.mod create mode 100644 openapi/go.sum create mode 100644 openapi/model_api_response_api_error.go create mode 100644 openapi/model_api_response_local_state_query_current_era.go create mode 100644 openapi/model_api_response_local_state_query_system_start.go create mode 100644 openapi/model_api_response_local_state_query_tip.go create mode 100644 openapi/model_api_response_local_tx_monitor_has_tx.go create mode 100644 openapi/model_api_response_local_tx_monitor_sizes.go create mode 100644 openapi/model_api_response_local_tx_monitor_txs.go create mode 100644 openapi/response.go create mode 100644 openapi/test/api_chainsync_test.go create mode 100644 openapi/test/api_default_test.go create mode 100644 openapi/test/api_localstatequery_test.go create mode 100644 openapi/test/api_localtxmonitor_test.go create mode 100644 openapi/utils.go diff --git a/openapi/.gitignore b/openapi/.gitignore new file mode 100644 index 0000000..daf913b --- /dev/null +++ b/openapi/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/openapi/.openapi-generator-ignore b/openapi/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/openapi/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/openapi/.openapi-generator/FILES b/openapi/.openapi-generator/FILES new file mode 100644 index 0000000..eae1a39 --- /dev/null +++ b/openapi/.openapi-generator/FILES @@ -0,0 +1,33 @@ +.gitignore +.travis.yml +README.md +api/openapi.yaml +api_chainsync.go +api_default.go +api_localstatequery.go +api_localtxmonitor.go +client.go +configuration.go +docs/ApiResponseApiError.md +docs/ApiResponseLocalStateQueryCurrentEra.md +docs/ApiResponseLocalStateQuerySystemStart.md +docs/ApiResponseLocalStateQueryTip.md +docs/ApiResponseLocalTxMonitorHasTx.md +docs/ApiResponseLocalTxMonitorSizes.md +docs/ApiResponseLocalTxMonitorTxs.md +docs/ChainsyncAPI.md +docs/DefaultAPI.md +docs/LocalstatequeryAPI.md +docs/LocaltxmonitorAPI.md +git_push.sh +go.mod +go.sum +model_api_response_api_error.go +model_api_response_local_state_query_current_era.go +model_api_response_local_state_query_system_start.go +model_api_response_local_state_query_tip.go +model_api_response_local_tx_monitor_has_tx.go +model_api_response_local_tx_monitor_sizes.go +model_api_response_local_tx_monitor_txs.go +response.go +utils.go diff --git a/openapi/.openapi-generator/VERSION b/openapi/.openapi-generator/VERSION new file mode 100644 index 0000000..6116b14 --- /dev/null +++ b/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.8.0-SNAPSHOT diff --git a/openapi/.openapi-generator/go-config.yml b/openapi/.openapi-generator/go-config.yml new file mode 100644 index 0000000..a9000cb --- /dev/null +++ b/openapi/.openapi-generator/go-config.yml @@ -0,0 +1,3 @@ +enumClassPrefix: true +generateInterfaces: true +structPrefix: true diff --git a/openapi/.travis.yml b/openapi/.travis.yml new file mode 100644 index 0000000..f5cb2ce --- /dev/null +++ b/openapi/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/openapi/README.md b/openapi/README.md new file mode 100644 index 0000000..4f77811 --- /dev/null +++ b/openapi/README.md @@ -0,0 +1,130 @@ +# Go API client for openapi + +Cardano Node API + +## Overview +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. + +- API version: 1.0 +- Package version: 1.0.0 +- Generator version: 7.8.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.GoClientCodegen +For more information, please visit [https://blinklabs.io](https://blinklabs.io) + +## Installation + +Install the following dependencies: + +```sh +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: + +```go +import openapi "github.com/blinklabs-io/cardano-node-api/openapi" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```go +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 `openapi.ContextServerIndex` of type `int`. + +```go +ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `openapi.ContextServerVariables` of type `map[string]string`. + +```go +ctx := context.WithValue(context.Background(), openapi.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 `openapi.ContextOperationServerIndices` and `openapi.ContextOperationServerVariables` context maps. + +```go +ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost/api* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*ChainsyncAPI* | [**ChainsyncSyncGet**](docs/ChainsyncAPI.md#chainsyncsyncget) | **Get** /chainsync/sync | Start a chain-sync using a websocket for events +*DefaultAPI* | [**LocaltxsubmissionTxPost**](docs/DefaultAPI.md#localtxsubmissiontxpost) | **Post** /localtxsubmission/tx | Submit Tx +*LocalstatequeryAPI* | [**LocalstatequeryCurrentEraGet**](docs/LocalstatequeryAPI.md#localstatequerycurrenteraget) | **Get** /localstatequery/current-era | Query Current Era +*LocalstatequeryAPI* | [**LocalstatequeryEraHistoryGet**](docs/LocalstatequeryAPI.md#localstatequeryerahistoryget) | **Get** /localstatequery/era-history | Query Era History +*LocalstatequeryAPI* | [**LocalstatequeryGenesisConfigGet**](docs/LocalstatequeryAPI.md#localstatequerygenesisconfigget) | **Get** /localstatequery/genesis-config | Query Genesis Config +*LocalstatequeryAPI* | [**LocalstatequeryProtocolParamsGet**](docs/LocalstatequeryAPI.md#localstatequeryprotocolparamsget) | **Get** /localstatequery/protocol-params | Query Current Protocol Parameters +*LocalstatequeryAPI* | [**LocalstatequerySystemStartGet**](docs/LocalstatequeryAPI.md#localstatequerysystemstartget) | **Get** /localstatequery/system-start | Query System Start +*LocalstatequeryAPI* | [**LocalstatequeryTipGet**](docs/LocalstatequeryAPI.md#localstatequerytipget) | **Get** /localstatequery/tip | Query Chain Tip +*LocaltxmonitorAPI* | [**LocaltxmonitorHasTxTxHashGet**](docs/LocaltxmonitorAPI.md#localtxmonitorhastxtxhashget) | **Get** /localtxmonitor/has_tx/{tx_hash} | Check if a particular TX exists in the mempool +*LocaltxmonitorAPI* | [**LocaltxmonitorSizesGet**](docs/LocaltxmonitorAPI.md#localtxmonitorsizesget) | **Get** /localtxmonitor/sizes | Get mempool capacity, size, and TX count +*LocaltxmonitorAPI* | [**LocaltxmonitorTxsGet**](docs/LocaltxmonitorAPI.md#localtxmonitortxsget) | **Get** /localtxmonitor/txs | List all transactions in the mempool + + +## Documentation For Models + + - [ApiResponseApiError](docs/ApiResponseApiError.md) + - [ApiResponseLocalStateQueryCurrentEra](docs/ApiResponseLocalStateQueryCurrentEra.md) + - [ApiResponseLocalStateQuerySystemStart](docs/ApiResponseLocalStateQuerySystemStart.md) + - [ApiResponseLocalStateQueryTip](docs/ApiResponseLocalStateQueryTip.md) + - [ApiResponseLocalTxMonitorHasTx](docs/ApiResponseLocalTxMonitorHasTx.md) + - [ApiResponseLocalTxMonitorSizes](docs/ApiResponseLocalTxMonitorSizes.md) + - [ApiResponseLocalTxMonitorTxs](docs/ApiResponseLocalTxMonitorTxs.md) + + +## Documentation For Authorization + +Endpoints do not require authorization. + + +## 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 + +support@blinklabs.io + diff --git a/openapi/api/openapi.yaml b/openapi/api/openapi.yaml new file mode 100644 index 0000000..b87ded9 --- /dev/null +++ b/openapi/api/openapi.yaml @@ -0,0 +1,354 @@ +openapi: 3.0.1 +info: + contact: + email: support@blinklabs.io + name: Blink Labs + url: https://blinklabs.io + description: Cardano Node API + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: cardano-node-api + version: "1.0" +servers: +- url: http://localhost/api +paths: + /chainsync/sync: + get: + parameters: + - description: whether to start from the current tip + in: query + name: tip + schema: + type: boolean + - description: "slot to start sync at, should match hash" + in: query + name: slot + schema: + type: integer + - description: "block hash to start sync at, should match slot" + in: query + name: hash + schema: + type: string + responses: + "101": + content: {} + description: Switching Protocols + "400": + content: + '*/*': + schema: + $ref: '#/components/schemas/api.responseApiError' + description: Bad Request + "500": + content: + '*/*': + schema: + $ref: '#/components/schemas/api.responseApiError' + description: Internal Server Error + summary: Start a chain-sync using a websocket for events + tags: + - chainsync + /localstatequery/current-era: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseLocalStateQueryCurrentEra' + description: OK + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseApiError' + description: Internal Server Error + summary: Query Current Era + tags: + - localstatequery + /localstatequery/era-history: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseLocalStateQueryEraHistory' + description: OK + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseApiError' + description: Internal Server Error + summary: Query Era History + tags: + - localstatequery + /localstatequery/genesis-config: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseLocalStateQueryGenesisConfig' + description: OK + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseApiError' + description: Internal Server Error + summary: Query Genesis Config + tags: + - localstatequery + /localstatequery/protocol-params: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseLocalStateQueryProtocolParams' + description: OK + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseApiError' + description: Internal Server Error + summary: Query Current Protocol Parameters + tags: + - localstatequery + /localstatequery/system-start: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseLocalStateQuerySystemStart' + description: OK + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseApiError' + description: Internal Server Error + summary: Query System Start + tags: + - localstatequery + /localstatequery/tip: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseLocalStateQueryTip' + description: OK + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseApiError' + description: Internal Server Error + summary: Query Chain Tip + tags: + - localstatequery + /localtxmonitor/has_tx/{tx_hash}: + get: + parameters: + - description: Transaction hash (hex string) + in: path + name: tx_hash + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseLocalTxMonitorHasTx' + description: OK + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseApiError' + description: Internal Server Error + summary: Check if a particular TX exists in the mempool + tags: + - localtxmonitor + /localtxmonitor/sizes: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseLocalTxMonitorSizes' + description: OK + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseApiError' + description: Internal Server Error + summary: "Get mempool capacity, size, and TX count" + tags: + - localtxmonitor + /localtxmonitor/txs: + get: + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/api.responseLocalTxMonitorTxs' + type: array + description: OK + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/api.responseApiError' + description: Internal Server Error + summary: List all transactions in the mempool + tags: + - localtxmonitor + /localtxsubmission/tx: + post: + description: Submit an already serialized transaction to the network. + parameters: + - description: Content type + in: header + name: Content-Type + required: true + schema: + enum: + - application/cbor + type: string + responses: + "202": + content: + application/json: + schema: + type: string + description: Ok + "400": + content: + application/json: + schema: + type: string + description: Bad Request + "415": + content: + application/json: + schema: + type: string + description: Unsupported Media Type + "500": + content: + application/json: + schema: + type: string + description: Server Error + summary: Submit Tx +components: + schemas: + api.responseApiError: + example: + msg: error message + properties: + msg: + example: error message + type: string + type: object + api.responseLocalStateQueryCurrentEra: + example: + name: name + id: 0 + properties: + id: + type: integer + name: + type: string + type: object + api.responseLocalStateQueryEraHistory: + type: object + api.responseLocalStateQueryGenesisConfig: + type: object + api.responseLocalStateQueryProtocolParams: + type: object + api.responseLocalStateQuerySystemStart: + example: + year: 1 + day: 0 + picoseconds: 6 + properties: + day: + type: integer + picoseconds: + type: integer + year: + type: integer + type: object + api.responseLocalStateQueryTip: + example: + block_no: 0 + era: era + slot_no: 1 + epoch_no: 6 + hash: hash + properties: + block_no: + type: integer + epoch_no: + type: integer + era: + type: string + hash: + type: string + slot_no: + type: integer + type: object + api.responseLocalTxMonitorHasTx: + example: + has_tx: true + properties: + has_tx: + type: boolean + type: object + api.responseLocalTxMonitorSizes: + example: + tx_count: 1 + size: 6 + capacity: 0 + properties: + capacity: + type: integer + size: + type: integer + tx_count: + type: integer + type: object + api.responseLocalTxMonitorTxs: + example: + tx_hash: 96649a8b827a5a4d508cd4e98cd88832482f7b884d507a49466d1fb8c4b14978 + tx_bytes: + properties: + tx_bytes: + example: + format: base64 + type: string + tx_hash: + example: 96649a8b827a5a4d508cd4e98cd88832482f7b884d507a49466d1fb8c4b14978 + format: base16 + type: string + type: object +x-original-swagger-version: "2.0" diff --git a/openapi/api_chainsync.go b/openapi/api_chainsync.go new file mode 100644 index 0000000..de97c97 --- /dev/null +++ b/openapi/api_chainsync.go @@ -0,0 +1,175 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + + +type ChainsyncAPI interface { + + /* + ChainsyncSyncGet Start a chain-sync using a websocket for events + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ChainsyncAPIChainsyncSyncGetRequest + */ + ChainsyncSyncGet(ctx context.Context) ChainsyncAPIChainsyncSyncGetRequest + + // ChainsyncSyncGetExecute executes the request + ChainsyncSyncGetExecute(r ChainsyncAPIChainsyncSyncGetRequest) (*http.Response, error) +} + +// ChainsyncAPIService ChainsyncAPI service +type ChainsyncAPIService service + +type ChainsyncAPIChainsyncSyncGetRequest struct { + ctx context.Context + ApiService ChainsyncAPI + tip *bool + slot *int32 + hash *string +} + +// whether to start from the current tip +func (r ChainsyncAPIChainsyncSyncGetRequest) Tip(tip bool) ChainsyncAPIChainsyncSyncGetRequest { + r.tip = &tip + return r +} + +// slot to start sync at, should match hash +func (r ChainsyncAPIChainsyncSyncGetRequest) Slot(slot int32) ChainsyncAPIChainsyncSyncGetRequest { + r.slot = &slot + return r +} + +// block hash to start sync at, should match slot +func (r ChainsyncAPIChainsyncSyncGetRequest) Hash(hash string) ChainsyncAPIChainsyncSyncGetRequest { + r.hash = &hash + return r +} + +func (r ChainsyncAPIChainsyncSyncGetRequest) Execute() (*http.Response, error) { + return r.ApiService.ChainsyncSyncGetExecute(r) +} + +/* +ChainsyncSyncGet Start a chain-sync using a websocket for events + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ChainsyncAPIChainsyncSyncGetRequest +*/ +func (a *ChainsyncAPIService) ChainsyncSyncGet(ctx context.Context) ChainsyncAPIChainsyncSyncGetRequest { + return ChainsyncAPIChainsyncSyncGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *ChainsyncAPIService) ChainsyncSyncGetExecute(r ChainsyncAPIChainsyncSyncGetRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsyncAPIService.ChainsyncSyncGet") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chainsync/sync" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.tip != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "tip", r.tip, "") + } + if r.slot != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "slot", r.slot, "") + } + if r.hash != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "hash", r.hash, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ApiResponseApiError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponseApiError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/openapi/api_default.go b/openapi/api_default.go new file mode 100644 index 0000000..6d293d5 --- /dev/null +++ b/openapi/api_default.go @@ -0,0 +1,183 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + + +type DefaultAPI interface { + + /* + LocaltxsubmissionTxPost Submit Tx + + Submit an already serialized transaction to the network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return DefaultAPILocaltxsubmissionTxPostRequest + */ + LocaltxsubmissionTxPost(ctx context.Context) DefaultAPILocaltxsubmissionTxPostRequest + + // LocaltxsubmissionTxPostExecute executes the request + // @return string + LocaltxsubmissionTxPostExecute(r DefaultAPILocaltxsubmissionTxPostRequest) (string, *http.Response, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type DefaultAPILocaltxsubmissionTxPostRequest struct { + ctx context.Context + ApiService DefaultAPI + contentType *string +} + +// Content type +func (r DefaultAPILocaltxsubmissionTxPostRequest) ContentType(contentType string) DefaultAPILocaltxsubmissionTxPostRequest { + r.contentType = &contentType + return r +} + +func (r DefaultAPILocaltxsubmissionTxPostRequest) Execute() (string, *http.Response, error) { + return r.ApiService.LocaltxsubmissionTxPostExecute(r) +} + +/* +LocaltxsubmissionTxPost Submit Tx + +Submit an already serialized transaction to the network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return DefaultAPILocaltxsubmissionTxPostRequest +*/ +func (a *DefaultAPIService) LocaltxsubmissionTxPost(ctx context.Context) DefaultAPILocaltxsubmissionTxPostRequest { + return DefaultAPILocaltxsubmissionTxPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *DefaultAPIService) LocaltxsubmissionTxPostExecute(r DefaultAPILocaltxsubmissionTxPostRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.LocaltxsubmissionTxPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/localtxsubmission/tx" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.contentType == nil { + return localVarReturnValue, nil, reportError("contentType is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + parameterAddToHeaderOrQuery(localVarHeaderParams, "Content-Type", r.contentType, "") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 415 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/openapi/api_localstatequery.go b/openapi/api_localstatequery.go new file mode 100644 index 0000000..d101e4c --- /dev/null +++ b/openapi/api_localstatequery.go @@ -0,0 +1,741 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + + +type LocalstatequeryAPI interface { + + /* + LocalstatequeryCurrentEraGet Query Current Era + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocalstatequeryAPILocalstatequeryCurrentEraGetRequest + */ + LocalstatequeryCurrentEraGet(ctx context.Context) LocalstatequeryAPILocalstatequeryCurrentEraGetRequest + + // LocalstatequeryCurrentEraGetExecute executes the request + // @return ApiResponseLocalStateQueryCurrentEra + LocalstatequeryCurrentEraGetExecute(r LocalstatequeryAPILocalstatequeryCurrentEraGetRequest) (*ApiResponseLocalStateQueryCurrentEra, *http.Response, error) + + /* + LocalstatequeryEraHistoryGet Query Era History + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocalstatequeryAPILocalstatequeryEraHistoryGetRequest + */ + LocalstatequeryEraHistoryGet(ctx context.Context) LocalstatequeryAPILocalstatequeryEraHistoryGetRequest + + // LocalstatequeryEraHistoryGetExecute executes the request + // @return map[string]interface{} + LocalstatequeryEraHistoryGetExecute(r LocalstatequeryAPILocalstatequeryEraHistoryGetRequest) (map[string]interface{}, *http.Response, error) + + /* + LocalstatequeryGenesisConfigGet Query Genesis Config + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocalstatequeryAPILocalstatequeryGenesisConfigGetRequest + */ + LocalstatequeryGenesisConfigGet(ctx context.Context) LocalstatequeryAPILocalstatequeryGenesisConfigGetRequest + + // LocalstatequeryGenesisConfigGetExecute executes the request + // @return map[string]interface{} + LocalstatequeryGenesisConfigGetExecute(r LocalstatequeryAPILocalstatequeryGenesisConfigGetRequest) (map[string]interface{}, *http.Response, error) + + /* + LocalstatequeryProtocolParamsGet Query Current Protocol Parameters + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocalstatequeryAPILocalstatequeryProtocolParamsGetRequest + */ + LocalstatequeryProtocolParamsGet(ctx context.Context) LocalstatequeryAPILocalstatequeryProtocolParamsGetRequest + + // LocalstatequeryProtocolParamsGetExecute executes the request + // @return map[string]interface{} + LocalstatequeryProtocolParamsGetExecute(r LocalstatequeryAPILocalstatequeryProtocolParamsGetRequest) (map[string]interface{}, *http.Response, error) + + /* + LocalstatequerySystemStartGet Query System Start + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocalstatequeryAPILocalstatequerySystemStartGetRequest + */ + LocalstatequerySystemStartGet(ctx context.Context) LocalstatequeryAPILocalstatequerySystemStartGetRequest + + // LocalstatequerySystemStartGetExecute executes the request + // @return ApiResponseLocalStateQuerySystemStart + LocalstatequerySystemStartGetExecute(r LocalstatequeryAPILocalstatequerySystemStartGetRequest) (*ApiResponseLocalStateQuerySystemStart, *http.Response, error) + + /* + LocalstatequeryTipGet Query Chain Tip + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocalstatequeryAPILocalstatequeryTipGetRequest + */ + LocalstatequeryTipGet(ctx context.Context) LocalstatequeryAPILocalstatequeryTipGetRequest + + // LocalstatequeryTipGetExecute executes the request + // @return ApiResponseLocalStateQueryTip + LocalstatequeryTipGetExecute(r LocalstatequeryAPILocalstatequeryTipGetRequest) (*ApiResponseLocalStateQueryTip, *http.Response, error) +} + +// LocalstatequeryAPIService LocalstatequeryAPI service +type LocalstatequeryAPIService service + +type LocalstatequeryAPILocalstatequeryCurrentEraGetRequest struct { + ctx context.Context + ApiService LocalstatequeryAPI +} + +func (r LocalstatequeryAPILocalstatequeryCurrentEraGetRequest) Execute() (*ApiResponseLocalStateQueryCurrentEra, *http.Response, error) { + return r.ApiService.LocalstatequeryCurrentEraGetExecute(r) +} + +/* +LocalstatequeryCurrentEraGet Query Current Era + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocalstatequeryAPILocalstatequeryCurrentEraGetRequest +*/ +func (a *LocalstatequeryAPIService) LocalstatequeryCurrentEraGet(ctx context.Context) LocalstatequeryAPILocalstatequeryCurrentEraGetRequest { + return LocalstatequeryAPILocalstatequeryCurrentEraGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponseLocalStateQueryCurrentEra +func (a *LocalstatequeryAPIService) LocalstatequeryCurrentEraGetExecute(r LocalstatequeryAPILocalstatequeryCurrentEraGetRequest) (*ApiResponseLocalStateQueryCurrentEra, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponseLocalStateQueryCurrentEra + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocalstatequeryAPIService.LocalstatequeryCurrentEraGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/localstatequery/current-era" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponseApiError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type LocalstatequeryAPILocalstatequeryEraHistoryGetRequest struct { + ctx context.Context + ApiService LocalstatequeryAPI +} + +func (r LocalstatequeryAPILocalstatequeryEraHistoryGetRequest) Execute() (map[string]interface{}, *http.Response, error) { + return r.ApiService.LocalstatequeryEraHistoryGetExecute(r) +} + +/* +LocalstatequeryEraHistoryGet Query Era History + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocalstatequeryAPILocalstatequeryEraHistoryGetRequest +*/ +func (a *LocalstatequeryAPIService) LocalstatequeryEraHistoryGet(ctx context.Context) LocalstatequeryAPILocalstatequeryEraHistoryGetRequest { + return LocalstatequeryAPILocalstatequeryEraHistoryGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return map[string]interface{} +func (a *LocalstatequeryAPIService) LocalstatequeryEraHistoryGetExecute(r LocalstatequeryAPILocalstatequeryEraHistoryGetRequest) (map[string]interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocalstatequeryAPIService.LocalstatequeryEraHistoryGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/localstatequery/era-history" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponseApiError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type LocalstatequeryAPILocalstatequeryGenesisConfigGetRequest struct { + ctx context.Context + ApiService LocalstatequeryAPI +} + +func (r LocalstatequeryAPILocalstatequeryGenesisConfigGetRequest) Execute() (map[string]interface{}, *http.Response, error) { + return r.ApiService.LocalstatequeryGenesisConfigGetExecute(r) +} + +/* +LocalstatequeryGenesisConfigGet Query Genesis Config + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocalstatequeryAPILocalstatequeryGenesisConfigGetRequest +*/ +func (a *LocalstatequeryAPIService) LocalstatequeryGenesisConfigGet(ctx context.Context) LocalstatequeryAPILocalstatequeryGenesisConfigGetRequest { + return LocalstatequeryAPILocalstatequeryGenesisConfigGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return map[string]interface{} +func (a *LocalstatequeryAPIService) LocalstatequeryGenesisConfigGetExecute(r LocalstatequeryAPILocalstatequeryGenesisConfigGetRequest) (map[string]interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocalstatequeryAPIService.LocalstatequeryGenesisConfigGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/localstatequery/genesis-config" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponseApiError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type LocalstatequeryAPILocalstatequeryProtocolParamsGetRequest struct { + ctx context.Context + ApiService LocalstatequeryAPI +} + +func (r LocalstatequeryAPILocalstatequeryProtocolParamsGetRequest) Execute() (map[string]interface{}, *http.Response, error) { + return r.ApiService.LocalstatequeryProtocolParamsGetExecute(r) +} + +/* +LocalstatequeryProtocolParamsGet Query Current Protocol Parameters + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocalstatequeryAPILocalstatequeryProtocolParamsGetRequest +*/ +func (a *LocalstatequeryAPIService) LocalstatequeryProtocolParamsGet(ctx context.Context) LocalstatequeryAPILocalstatequeryProtocolParamsGetRequest { + return LocalstatequeryAPILocalstatequeryProtocolParamsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return map[string]interface{} +func (a *LocalstatequeryAPIService) LocalstatequeryProtocolParamsGetExecute(r LocalstatequeryAPILocalstatequeryProtocolParamsGetRequest) (map[string]interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocalstatequeryAPIService.LocalstatequeryProtocolParamsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/localstatequery/protocol-params" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponseApiError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type LocalstatequeryAPILocalstatequerySystemStartGetRequest struct { + ctx context.Context + ApiService LocalstatequeryAPI +} + +func (r LocalstatequeryAPILocalstatequerySystemStartGetRequest) Execute() (*ApiResponseLocalStateQuerySystemStart, *http.Response, error) { + return r.ApiService.LocalstatequerySystemStartGetExecute(r) +} + +/* +LocalstatequerySystemStartGet Query System Start + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocalstatequeryAPILocalstatequerySystemStartGetRequest +*/ +func (a *LocalstatequeryAPIService) LocalstatequerySystemStartGet(ctx context.Context) LocalstatequeryAPILocalstatequerySystemStartGetRequest { + return LocalstatequeryAPILocalstatequerySystemStartGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponseLocalStateQuerySystemStart +func (a *LocalstatequeryAPIService) LocalstatequerySystemStartGetExecute(r LocalstatequeryAPILocalstatequerySystemStartGetRequest) (*ApiResponseLocalStateQuerySystemStart, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponseLocalStateQuerySystemStart + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocalstatequeryAPIService.LocalstatequerySystemStartGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/localstatequery/system-start" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponseApiError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type LocalstatequeryAPILocalstatequeryTipGetRequest struct { + ctx context.Context + ApiService LocalstatequeryAPI +} + +func (r LocalstatequeryAPILocalstatequeryTipGetRequest) Execute() (*ApiResponseLocalStateQueryTip, *http.Response, error) { + return r.ApiService.LocalstatequeryTipGetExecute(r) +} + +/* +LocalstatequeryTipGet Query Chain Tip + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocalstatequeryAPILocalstatequeryTipGetRequest +*/ +func (a *LocalstatequeryAPIService) LocalstatequeryTipGet(ctx context.Context) LocalstatequeryAPILocalstatequeryTipGetRequest { + return LocalstatequeryAPILocalstatequeryTipGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponseLocalStateQueryTip +func (a *LocalstatequeryAPIService) LocalstatequeryTipGetExecute(r LocalstatequeryAPILocalstatequeryTipGetRequest) (*ApiResponseLocalStateQueryTip, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponseLocalStateQueryTip + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocalstatequeryAPIService.LocalstatequeryTipGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/localstatequery/tip" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponseApiError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/openapi/api_localtxmonitor.go b/openapi/api_localtxmonitor.go new file mode 100644 index 0000000..5095e29 --- /dev/null +++ b/openapi/api_localtxmonitor.go @@ -0,0 +1,390 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +type LocaltxmonitorAPI interface { + + /* + LocaltxmonitorHasTxTxHashGet Check if a particular TX exists in the mempool + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param txHash Transaction hash (hex string) + @return LocaltxmonitorAPILocaltxmonitorHasTxTxHashGetRequest + */ + LocaltxmonitorHasTxTxHashGet(ctx context.Context, txHash string) LocaltxmonitorAPILocaltxmonitorHasTxTxHashGetRequest + + // LocaltxmonitorHasTxTxHashGetExecute executes the request + // @return ApiResponseLocalTxMonitorHasTx + LocaltxmonitorHasTxTxHashGetExecute(r LocaltxmonitorAPILocaltxmonitorHasTxTxHashGetRequest) (*ApiResponseLocalTxMonitorHasTx, *http.Response, error) + + /* + LocaltxmonitorSizesGet Get mempool capacity, size, and TX count + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocaltxmonitorAPILocaltxmonitorSizesGetRequest + */ + LocaltxmonitorSizesGet(ctx context.Context) LocaltxmonitorAPILocaltxmonitorSizesGetRequest + + // LocaltxmonitorSizesGetExecute executes the request + // @return ApiResponseLocalTxMonitorSizes + LocaltxmonitorSizesGetExecute(r LocaltxmonitorAPILocaltxmonitorSizesGetRequest) (*ApiResponseLocalTxMonitorSizes, *http.Response, error) + + /* + LocaltxmonitorTxsGet List all transactions in the mempool + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocaltxmonitorAPILocaltxmonitorTxsGetRequest + */ + LocaltxmonitorTxsGet(ctx context.Context) LocaltxmonitorAPILocaltxmonitorTxsGetRequest + + // LocaltxmonitorTxsGetExecute executes the request + // @return []ApiResponseLocalTxMonitorTxs + LocaltxmonitorTxsGetExecute(r LocaltxmonitorAPILocaltxmonitorTxsGetRequest) ([]ApiResponseLocalTxMonitorTxs, *http.Response, error) +} + +// LocaltxmonitorAPIService LocaltxmonitorAPI service +type LocaltxmonitorAPIService service + +type LocaltxmonitorAPILocaltxmonitorHasTxTxHashGetRequest struct { + ctx context.Context + ApiService LocaltxmonitorAPI + txHash string +} + +func (r LocaltxmonitorAPILocaltxmonitorHasTxTxHashGetRequest) Execute() (*ApiResponseLocalTxMonitorHasTx, *http.Response, error) { + return r.ApiService.LocaltxmonitorHasTxTxHashGetExecute(r) +} + +/* +LocaltxmonitorHasTxTxHashGet Check if a particular TX exists in the mempool + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param txHash Transaction hash (hex string) + @return LocaltxmonitorAPILocaltxmonitorHasTxTxHashGetRequest +*/ +func (a *LocaltxmonitorAPIService) LocaltxmonitorHasTxTxHashGet(ctx context.Context, txHash string) LocaltxmonitorAPILocaltxmonitorHasTxTxHashGetRequest { + return LocaltxmonitorAPILocaltxmonitorHasTxTxHashGetRequest{ + ApiService: a, + ctx: ctx, + txHash: txHash, + } +} + +// Execute executes the request +// @return ApiResponseLocalTxMonitorHasTx +func (a *LocaltxmonitorAPIService) LocaltxmonitorHasTxTxHashGetExecute(r LocaltxmonitorAPILocaltxmonitorHasTxTxHashGetRequest) (*ApiResponseLocalTxMonitorHasTx, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponseLocalTxMonitorHasTx + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocaltxmonitorAPIService.LocaltxmonitorHasTxTxHashGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/localtxmonitor/has_tx/{tx_hash}" + localVarPath = strings.Replace(localVarPath, "{"+"tx_hash"+"}", url.PathEscape(parameterValueToString(r.txHash, "txHash")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponseApiError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type LocaltxmonitorAPILocaltxmonitorSizesGetRequest struct { + ctx context.Context + ApiService LocaltxmonitorAPI +} + +func (r LocaltxmonitorAPILocaltxmonitorSizesGetRequest) Execute() (*ApiResponseLocalTxMonitorSizes, *http.Response, error) { + return r.ApiService.LocaltxmonitorSizesGetExecute(r) +} + +/* +LocaltxmonitorSizesGet Get mempool capacity, size, and TX count + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocaltxmonitorAPILocaltxmonitorSizesGetRequest +*/ +func (a *LocaltxmonitorAPIService) LocaltxmonitorSizesGet(ctx context.Context) LocaltxmonitorAPILocaltxmonitorSizesGetRequest { + return LocaltxmonitorAPILocaltxmonitorSizesGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ApiResponseLocalTxMonitorSizes +func (a *LocaltxmonitorAPIService) LocaltxmonitorSizesGetExecute(r LocaltxmonitorAPILocaltxmonitorSizesGetRequest) (*ApiResponseLocalTxMonitorSizes, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ApiResponseLocalTxMonitorSizes + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocaltxmonitorAPIService.LocaltxmonitorSizesGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/localtxmonitor/sizes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponseApiError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type LocaltxmonitorAPILocaltxmonitorTxsGetRequest struct { + ctx context.Context + ApiService LocaltxmonitorAPI +} + +func (r LocaltxmonitorAPILocaltxmonitorTxsGetRequest) Execute() ([]ApiResponseLocalTxMonitorTxs, *http.Response, error) { + return r.ApiService.LocaltxmonitorTxsGetExecute(r) +} + +/* +LocaltxmonitorTxsGet List all transactions in the mempool + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return LocaltxmonitorAPILocaltxmonitorTxsGetRequest +*/ +func (a *LocaltxmonitorAPIService) LocaltxmonitorTxsGet(ctx context.Context) LocaltxmonitorAPILocaltxmonitorTxsGetRequest { + return LocaltxmonitorAPILocaltxmonitorTxsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []ApiResponseLocalTxMonitorTxs +func (a *LocaltxmonitorAPIService) LocaltxmonitorTxsGetExecute(r LocaltxmonitorAPILocaltxmonitorTxsGetRequest) ([]ApiResponseLocalTxMonitorTxs, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ApiResponseLocalTxMonitorTxs + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocaltxmonitorAPIService.LocaltxmonitorTxsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/localtxmonitor/txs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 500 { + var v ApiResponseApiError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/openapi/client.go b/openapi/client.go new file mode 100644 index 0000000..30f1218 --- /dev/null +++ b/openapi/client.go @@ -0,0 +1,658 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) +) + +// APIClient manages communication with the cardano-node-api API v1.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + ChainsyncAPI ChainsyncAPI + + DefaultAPI DefaultAPI + + LocalstatequeryAPI LocalstatequeryAPI + + LocaltxmonitorAPI LocaltxmonitorAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.ChainsyncAPI = (*ChainsyncAPIService)(&c.common) + c.DefaultAPI = (*DefaultAPIService)(&c.common) + c.LocalstatequeryAPI = (*LocalstatequeryAPIService)(&c.common) + c.LocaltxmonitorAPI = (*LocaltxmonitorAPIService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString( obj interface{}, key string ) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param,ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap,err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t,ok := obj.(MappedNullable); ok { + dataMap,err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i:=0;i 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/openapi/configuration.go b/openapi/configuration.go new file mode 100644 index 0000000..56d44e9 --- /dev/null +++ b/openapi/configuration.go @@ -0,0 +1,216 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "http://localhost/api", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{ + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/openapi/docs/ApiResponseApiError.md b/openapi/docs/ApiResponseApiError.md new file mode 100644 index 0000000..8eb2512 --- /dev/null +++ b/openapi/docs/ApiResponseApiError.md @@ -0,0 +1,56 @@ +# ApiResponseApiError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Msg** | Pointer to **string** | | [optional] + +## Methods + +### NewApiResponseApiError + +`func NewApiResponseApiError() *ApiResponseApiError` + +NewApiResponseApiError instantiates a new ApiResponseApiError object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewApiResponseApiErrorWithDefaults + +`func NewApiResponseApiErrorWithDefaults() *ApiResponseApiError` + +NewApiResponseApiErrorWithDefaults instantiates a new ApiResponseApiError object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetMsg + +`func (o *ApiResponseApiError) GetMsg() string` + +GetMsg returns the Msg field if non-nil, zero value otherwise. + +### GetMsgOk + +`func (o *ApiResponseApiError) GetMsgOk() (*string, bool)` + +GetMsgOk returns a tuple with the Msg field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMsg + +`func (o *ApiResponseApiError) SetMsg(v string)` + +SetMsg sets Msg field to given value. + +### HasMsg + +`func (o *ApiResponseApiError) HasMsg() bool` + +HasMsg returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/openapi/docs/ApiResponseLocalStateQueryCurrentEra.md b/openapi/docs/ApiResponseLocalStateQueryCurrentEra.md new file mode 100644 index 0000000..e36f203 --- /dev/null +++ b/openapi/docs/ApiResponseLocalStateQueryCurrentEra.md @@ -0,0 +1,82 @@ +# ApiResponseLocalStateQueryCurrentEra + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | Pointer to **int32** | | [optional] +**Name** | Pointer to **string** | | [optional] + +## Methods + +### NewApiResponseLocalStateQueryCurrentEra + +`func NewApiResponseLocalStateQueryCurrentEra() *ApiResponseLocalStateQueryCurrentEra` + +NewApiResponseLocalStateQueryCurrentEra instantiates a new ApiResponseLocalStateQueryCurrentEra object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewApiResponseLocalStateQueryCurrentEraWithDefaults + +`func NewApiResponseLocalStateQueryCurrentEraWithDefaults() *ApiResponseLocalStateQueryCurrentEra` + +NewApiResponseLocalStateQueryCurrentEraWithDefaults instantiates a new ApiResponseLocalStateQueryCurrentEra object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *ApiResponseLocalStateQueryCurrentEra) GetId() int32` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *ApiResponseLocalStateQueryCurrentEra) GetIdOk() (*int32, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *ApiResponseLocalStateQueryCurrentEra) SetId(v int32)` + +SetId sets Id field to given value. + +### HasId + +`func (o *ApiResponseLocalStateQueryCurrentEra) HasId() bool` + +HasId returns a boolean if a field has been set. + +### GetName + +`func (o *ApiResponseLocalStateQueryCurrentEra) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *ApiResponseLocalStateQueryCurrentEra) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *ApiResponseLocalStateQueryCurrentEra) SetName(v string)` + +SetName sets Name field to given value. + +### HasName + +`func (o *ApiResponseLocalStateQueryCurrentEra) HasName() bool` + +HasName returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/openapi/docs/ApiResponseLocalStateQuerySystemStart.md b/openapi/docs/ApiResponseLocalStateQuerySystemStart.md new file mode 100644 index 0000000..6eeef6e --- /dev/null +++ b/openapi/docs/ApiResponseLocalStateQuerySystemStart.md @@ -0,0 +1,108 @@ +# ApiResponseLocalStateQuerySystemStart + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Day** | Pointer to **int32** | | [optional] +**Picoseconds** | Pointer to **int32** | | [optional] +**Year** | Pointer to **int32** | | [optional] + +## Methods + +### NewApiResponseLocalStateQuerySystemStart + +`func NewApiResponseLocalStateQuerySystemStart() *ApiResponseLocalStateQuerySystemStart` + +NewApiResponseLocalStateQuerySystemStart instantiates a new ApiResponseLocalStateQuerySystemStart object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewApiResponseLocalStateQuerySystemStartWithDefaults + +`func NewApiResponseLocalStateQuerySystemStartWithDefaults() *ApiResponseLocalStateQuerySystemStart` + +NewApiResponseLocalStateQuerySystemStartWithDefaults instantiates a new ApiResponseLocalStateQuerySystemStart object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetDay + +`func (o *ApiResponseLocalStateQuerySystemStart) GetDay() int32` + +GetDay returns the Day field if non-nil, zero value otherwise. + +### GetDayOk + +`func (o *ApiResponseLocalStateQuerySystemStart) GetDayOk() (*int32, bool)` + +GetDayOk returns a tuple with the Day field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDay + +`func (o *ApiResponseLocalStateQuerySystemStart) SetDay(v int32)` + +SetDay sets Day field to given value. + +### HasDay + +`func (o *ApiResponseLocalStateQuerySystemStart) HasDay() bool` + +HasDay returns a boolean if a field has been set. + +### GetPicoseconds + +`func (o *ApiResponseLocalStateQuerySystemStart) GetPicoseconds() int32` + +GetPicoseconds returns the Picoseconds field if non-nil, zero value otherwise. + +### GetPicosecondsOk + +`func (o *ApiResponseLocalStateQuerySystemStart) GetPicosecondsOk() (*int32, bool)` + +GetPicosecondsOk returns a tuple with the Picoseconds field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPicoseconds + +`func (o *ApiResponseLocalStateQuerySystemStart) SetPicoseconds(v int32)` + +SetPicoseconds sets Picoseconds field to given value. + +### HasPicoseconds + +`func (o *ApiResponseLocalStateQuerySystemStart) HasPicoseconds() bool` + +HasPicoseconds returns a boolean if a field has been set. + +### GetYear + +`func (o *ApiResponseLocalStateQuerySystemStart) GetYear() int32` + +GetYear returns the Year field if non-nil, zero value otherwise. + +### GetYearOk + +`func (o *ApiResponseLocalStateQuerySystemStart) GetYearOk() (*int32, bool)` + +GetYearOk returns a tuple with the Year field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetYear + +`func (o *ApiResponseLocalStateQuerySystemStart) SetYear(v int32)` + +SetYear sets Year field to given value. + +### HasYear + +`func (o *ApiResponseLocalStateQuerySystemStart) HasYear() bool` + +HasYear returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/openapi/docs/ApiResponseLocalStateQueryTip.md b/openapi/docs/ApiResponseLocalStateQueryTip.md new file mode 100644 index 0000000..ffefe2a --- /dev/null +++ b/openapi/docs/ApiResponseLocalStateQueryTip.md @@ -0,0 +1,160 @@ +# ApiResponseLocalStateQueryTip + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**BlockNo** | Pointer to **int32** | | [optional] +**EpochNo** | Pointer to **int32** | | [optional] +**Era** | Pointer to **string** | | [optional] +**Hash** | Pointer to **string** | | [optional] +**SlotNo** | Pointer to **int32** | | [optional] + +## Methods + +### NewApiResponseLocalStateQueryTip + +`func NewApiResponseLocalStateQueryTip() *ApiResponseLocalStateQueryTip` + +NewApiResponseLocalStateQueryTip instantiates a new ApiResponseLocalStateQueryTip object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewApiResponseLocalStateQueryTipWithDefaults + +`func NewApiResponseLocalStateQueryTipWithDefaults() *ApiResponseLocalStateQueryTip` + +NewApiResponseLocalStateQueryTipWithDefaults instantiates a new ApiResponseLocalStateQueryTip object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetBlockNo + +`func (o *ApiResponseLocalStateQueryTip) GetBlockNo() int32` + +GetBlockNo returns the BlockNo field if non-nil, zero value otherwise. + +### GetBlockNoOk + +`func (o *ApiResponseLocalStateQueryTip) GetBlockNoOk() (*int32, bool)` + +GetBlockNoOk returns a tuple with the BlockNo field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBlockNo + +`func (o *ApiResponseLocalStateQueryTip) SetBlockNo(v int32)` + +SetBlockNo sets BlockNo field to given value. + +### HasBlockNo + +`func (o *ApiResponseLocalStateQueryTip) HasBlockNo() bool` + +HasBlockNo returns a boolean if a field has been set. + +### GetEpochNo + +`func (o *ApiResponseLocalStateQueryTip) GetEpochNo() int32` + +GetEpochNo returns the EpochNo field if non-nil, zero value otherwise. + +### GetEpochNoOk + +`func (o *ApiResponseLocalStateQueryTip) GetEpochNoOk() (*int32, bool)` + +GetEpochNoOk returns a tuple with the EpochNo field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEpochNo + +`func (o *ApiResponseLocalStateQueryTip) SetEpochNo(v int32)` + +SetEpochNo sets EpochNo field to given value. + +### HasEpochNo + +`func (o *ApiResponseLocalStateQueryTip) HasEpochNo() bool` + +HasEpochNo returns a boolean if a field has been set. + +### GetEra + +`func (o *ApiResponseLocalStateQueryTip) GetEra() string` + +GetEra returns the Era field if non-nil, zero value otherwise. + +### GetEraOk + +`func (o *ApiResponseLocalStateQueryTip) GetEraOk() (*string, bool)` + +GetEraOk returns a tuple with the Era field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEra + +`func (o *ApiResponseLocalStateQueryTip) SetEra(v string)` + +SetEra sets Era field to given value. + +### HasEra + +`func (o *ApiResponseLocalStateQueryTip) HasEra() bool` + +HasEra returns a boolean if a field has been set. + +### GetHash + +`func (o *ApiResponseLocalStateQueryTip) GetHash() string` + +GetHash returns the Hash field if non-nil, zero value otherwise. + +### GetHashOk + +`func (o *ApiResponseLocalStateQueryTip) GetHashOk() (*string, bool)` + +GetHashOk returns a tuple with the Hash field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHash + +`func (o *ApiResponseLocalStateQueryTip) SetHash(v string)` + +SetHash sets Hash field to given value. + +### HasHash + +`func (o *ApiResponseLocalStateQueryTip) HasHash() bool` + +HasHash returns a boolean if a field has been set. + +### GetSlotNo + +`func (o *ApiResponseLocalStateQueryTip) GetSlotNo() int32` + +GetSlotNo returns the SlotNo field if non-nil, zero value otherwise. + +### GetSlotNoOk + +`func (o *ApiResponseLocalStateQueryTip) GetSlotNoOk() (*int32, bool)` + +GetSlotNoOk returns a tuple with the SlotNo field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSlotNo + +`func (o *ApiResponseLocalStateQueryTip) SetSlotNo(v int32)` + +SetSlotNo sets SlotNo field to given value. + +### HasSlotNo + +`func (o *ApiResponseLocalStateQueryTip) HasSlotNo() bool` + +HasSlotNo returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/openapi/docs/ApiResponseLocalTxMonitorHasTx.md b/openapi/docs/ApiResponseLocalTxMonitorHasTx.md new file mode 100644 index 0000000..3697dcd --- /dev/null +++ b/openapi/docs/ApiResponseLocalTxMonitorHasTx.md @@ -0,0 +1,56 @@ +# ApiResponseLocalTxMonitorHasTx + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**HasTx** | Pointer to **bool** | | [optional] + +## Methods + +### NewApiResponseLocalTxMonitorHasTx + +`func NewApiResponseLocalTxMonitorHasTx() *ApiResponseLocalTxMonitorHasTx` + +NewApiResponseLocalTxMonitorHasTx instantiates a new ApiResponseLocalTxMonitorHasTx object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewApiResponseLocalTxMonitorHasTxWithDefaults + +`func NewApiResponseLocalTxMonitorHasTxWithDefaults() *ApiResponseLocalTxMonitorHasTx` + +NewApiResponseLocalTxMonitorHasTxWithDefaults instantiates a new ApiResponseLocalTxMonitorHasTx object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetHasTx + +`func (o *ApiResponseLocalTxMonitorHasTx) GetHasTx() bool` + +GetHasTx returns the HasTx field if non-nil, zero value otherwise. + +### GetHasTxOk + +`func (o *ApiResponseLocalTxMonitorHasTx) GetHasTxOk() (*bool, bool)` + +GetHasTxOk returns a tuple with the HasTx field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHasTx + +`func (o *ApiResponseLocalTxMonitorHasTx) SetHasTx(v bool)` + +SetHasTx sets HasTx field to given value. + +### HasHasTx + +`func (o *ApiResponseLocalTxMonitorHasTx) HasHasTx() bool` + +HasHasTx returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/openapi/docs/ApiResponseLocalTxMonitorSizes.md b/openapi/docs/ApiResponseLocalTxMonitorSizes.md new file mode 100644 index 0000000..ae68034 --- /dev/null +++ b/openapi/docs/ApiResponseLocalTxMonitorSizes.md @@ -0,0 +1,108 @@ +# ApiResponseLocalTxMonitorSizes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Capacity** | Pointer to **int32** | | [optional] +**Size** | Pointer to **int32** | | [optional] +**TxCount** | Pointer to **int32** | | [optional] + +## Methods + +### NewApiResponseLocalTxMonitorSizes + +`func NewApiResponseLocalTxMonitorSizes() *ApiResponseLocalTxMonitorSizes` + +NewApiResponseLocalTxMonitorSizes instantiates a new ApiResponseLocalTxMonitorSizes object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewApiResponseLocalTxMonitorSizesWithDefaults + +`func NewApiResponseLocalTxMonitorSizesWithDefaults() *ApiResponseLocalTxMonitorSizes` + +NewApiResponseLocalTxMonitorSizesWithDefaults instantiates a new ApiResponseLocalTxMonitorSizes object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetCapacity + +`func (o *ApiResponseLocalTxMonitorSizes) GetCapacity() int32` + +GetCapacity returns the Capacity field if non-nil, zero value otherwise. + +### GetCapacityOk + +`func (o *ApiResponseLocalTxMonitorSizes) GetCapacityOk() (*int32, bool)` + +GetCapacityOk returns a tuple with the Capacity field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCapacity + +`func (o *ApiResponseLocalTxMonitorSizes) SetCapacity(v int32)` + +SetCapacity sets Capacity field to given value. + +### HasCapacity + +`func (o *ApiResponseLocalTxMonitorSizes) HasCapacity() bool` + +HasCapacity returns a boolean if a field has been set. + +### GetSize + +`func (o *ApiResponseLocalTxMonitorSizes) GetSize() int32` + +GetSize returns the Size field if non-nil, zero value otherwise. + +### GetSizeOk + +`func (o *ApiResponseLocalTxMonitorSizes) GetSizeOk() (*int32, bool)` + +GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSize + +`func (o *ApiResponseLocalTxMonitorSizes) SetSize(v int32)` + +SetSize sets Size field to given value. + +### HasSize + +`func (o *ApiResponseLocalTxMonitorSizes) HasSize() bool` + +HasSize returns a boolean if a field has been set. + +### GetTxCount + +`func (o *ApiResponseLocalTxMonitorSizes) GetTxCount() int32` + +GetTxCount returns the TxCount field if non-nil, zero value otherwise. + +### GetTxCountOk + +`func (o *ApiResponseLocalTxMonitorSizes) GetTxCountOk() (*int32, bool)` + +GetTxCountOk returns a tuple with the TxCount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTxCount + +`func (o *ApiResponseLocalTxMonitorSizes) SetTxCount(v int32)` + +SetTxCount sets TxCount field to given value. + +### HasTxCount + +`func (o *ApiResponseLocalTxMonitorSizes) HasTxCount() bool` + +HasTxCount returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/openapi/docs/ApiResponseLocalTxMonitorTxs.md b/openapi/docs/ApiResponseLocalTxMonitorTxs.md new file mode 100644 index 0000000..aa99da5 --- /dev/null +++ b/openapi/docs/ApiResponseLocalTxMonitorTxs.md @@ -0,0 +1,82 @@ +# ApiResponseLocalTxMonitorTxs + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TxBytes** | Pointer to **string** | | [optional] +**TxHash** | Pointer to **string** | | [optional] + +## Methods + +### NewApiResponseLocalTxMonitorTxs + +`func NewApiResponseLocalTxMonitorTxs() *ApiResponseLocalTxMonitorTxs` + +NewApiResponseLocalTxMonitorTxs instantiates a new ApiResponseLocalTxMonitorTxs object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewApiResponseLocalTxMonitorTxsWithDefaults + +`func NewApiResponseLocalTxMonitorTxsWithDefaults() *ApiResponseLocalTxMonitorTxs` + +NewApiResponseLocalTxMonitorTxsWithDefaults instantiates a new ApiResponseLocalTxMonitorTxs object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetTxBytes + +`func (o *ApiResponseLocalTxMonitorTxs) GetTxBytes() string` + +GetTxBytes returns the TxBytes field if non-nil, zero value otherwise. + +### GetTxBytesOk + +`func (o *ApiResponseLocalTxMonitorTxs) GetTxBytesOk() (*string, bool)` + +GetTxBytesOk returns a tuple with the TxBytes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTxBytes + +`func (o *ApiResponseLocalTxMonitorTxs) SetTxBytes(v string)` + +SetTxBytes sets TxBytes field to given value. + +### HasTxBytes + +`func (o *ApiResponseLocalTxMonitorTxs) HasTxBytes() bool` + +HasTxBytes returns a boolean if a field has been set. + +### GetTxHash + +`func (o *ApiResponseLocalTxMonitorTxs) GetTxHash() string` + +GetTxHash returns the TxHash field if non-nil, zero value otherwise. + +### GetTxHashOk + +`func (o *ApiResponseLocalTxMonitorTxs) GetTxHashOk() (*string, bool)` + +GetTxHashOk returns a tuple with the TxHash field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTxHash + +`func (o *ApiResponseLocalTxMonitorTxs) SetTxHash(v string)` + +SetTxHash sets TxHash field to given value. + +### HasTxHash + +`func (o *ApiResponseLocalTxMonitorTxs) HasTxHash() bool` + +HasTxHash returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/openapi/docs/ChainsyncAPI.md b/openapi/docs/ChainsyncAPI.md new file mode 100644 index 0000000..ce7d9db --- /dev/null +++ b/openapi/docs/ChainsyncAPI.md @@ -0,0 +1,75 @@ +# \ChainsyncAPI + +All URIs are relative to *http://localhost/api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**ChainsyncSyncGet**](ChainsyncAPI.md#ChainsyncSyncGet) | **Get** /chainsync/sync | Start a chain-sync using a websocket for events + + + +## ChainsyncSyncGet + +> ChainsyncSyncGet(ctx).Tip(tip).Slot(slot).Hash(hash).Execute() + +Start a chain-sync using a websocket for events + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func main() { + tip := true // bool | whether to start from the current tip (optional) + slot := int32(56) // int32 | slot to start sync at, should match hash (optional) + hash := "hash_example" // string | block hash to start sync at, should match slot (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + r, err := apiClient.ChainsyncAPI.ChainsyncSyncGet(context.Background()).Tip(tip).Slot(slot).Hash(hash).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsyncAPI.ChainsyncSyncGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiChainsyncSyncGetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tip** | **bool** | whether to start from the current tip | + **slot** | **int32** | slot to start sync at, should match hash | + **hash** | **string** | block hash to start sync at, should match slot | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/openapi/docs/DefaultAPI.md b/openapi/docs/DefaultAPI.md new file mode 100644 index 0000000..3ecf57b --- /dev/null +++ b/openapi/docs/DefaultAPI.md @@ -0,0 +1,75 @@ +# \DefaultAPI + +All URIs are relative to *http://localhost/api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**LocaltxsubmissionTxPost**](DefaultAPI.md#LocaltxsubmissionTxPost) | **Post** /localtxsubmission/tx | Submit Tx + + + +## LocaltxsubmissionTxPost + +> string LocaltxsubmissionTxPost(ctx).ContentType(contentType).Execute() + +Submit Tx + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func main() { + contentType := "contentType_example" // string | Content type + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.DefaultAPI.LocaltxsubmissionTxPost(context.Background()).ContentType(contentType).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DefaultAPI.LocaltxsubmissionTxPost``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LocaltxsubmissionTxPost`: string + fmt.Fprintf(os.Stdout, "Response from `DefaultAPI.LocaltxsubmissionTxPost`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiLocaltxsubmissionTxPostRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **contentType** | **string** | Content type | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/openapi/docs/LocalstatequeryAPI.md b/openapi/docs/LocalstatequeryAPI.md new file mode 100644 index 0000000..1750e29 --- /dev/null +++ b/openapi/docs/LocalstatequeryAPI.md @@ -0,0 +1,368 @@ +# \LocalstatequeryAPI + +All URIs are relative to *http://localhost/api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**LocalstatequeryCurrentEraGet**](LocalstatequeryAPI.md#LocalstatequeryCurrentEraGet) | **Get** /localstatequery/current-era | Query Current Era +[**LocalstatequeryEraHistoryGet**](LocalstatequeryAPI.md#LocalstatequeryEraHistoryGet) | **Get** /localstatequery/era-history | Query Era History +[**LocalstatequeryGenesisConfigGet**](LocalstatequeryAPI.md#LocalstatequeryGenesisConfigGet) | **Get** /localstatequery/genesis-config | Query Genesis Config +[**LocalstatequeryProtocolParamsGet**](LocalstatequeryAPI.md#LocalstatequeryProtocolParamsGet) | **Get** /localstatequery/protocol-params | Query Current Protocol Parameters +[**LocalstatequerySystemStartGet**](LocalstatequeryAPI.md#LocalstatequerySystemStartGet) | **Get** /localstatequery/system-start | Query System Start +[**LocalstatequeryTipGet**](LocalstatequeryAPI.md#LocalstatequeryTipGet) | **Get** /localstatequery/tip | Query Chain Tip + + + +## LocalstatequeryCurrentEraGet + +> ApiResponseLocalStateQueryCurrentEra LocalstatequeryCurrentEraGet(ctx).Execute() + +Query Current Era + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LocalstatequeryAPI.LocalstatequeryCurrentEraGet(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LocalstatequeryAPI.LocalstatequeryCurrentEraGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LocalstatequeryCurrentEraGet`: ApiResponseLocalStateQueryCurrentEra + fmt.Fprintf(os.Stdout, "Response from `LocalstatequeryAPI.LocalstatequeryCurrentEraGet`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiLocalstatequeryCurrentEraGetRequest struct via the builder pattern + + +### Return type + +[**ApiResponseLocalStateQueryCurrentEra**](ApiResponseLocalStateQueryCurrentEra.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LocalstatequeryEraHistoryGet + +> map[string]interface{} LocalstatequeryEraHistoryGet(ctx).Execute() + +Query Era History + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LocalstatequeryAPI.LocalstatequeryEraHistoryGet(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LocalstatequeryAPI.LocalstatequeryEraHistoryGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LocalstatequeryEraHistoryGet`: map[string]interface{} + fmt.Fprintf(os.Stdout, "Response from `LocalstatequeryAPI.LocalstatequeryEraHistoryGet`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiLocalstatequeryEraHistoryGetRequest struct via the builder pattern + + +### Return type + +**map[string]interface{}** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LocalstatequeryGenesisConfigGet + +> map[string]interface{} LocalstatequeryGenesisConfigGet(ctx).Execute() + +Query Genesis Config + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LocalstatequeryAPI.LocalstatequeryGenesisConfigGet(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LocalstatequeryAPI.LocalstatequeryGenesisConfigGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LocalstatequeryGenesisConfigGet`: map[string]interface{} + fmt.Fprintf(os.Stdout, "Response from `LocalstatequeryAPI.LocalstatequeryGenesisConfigGet`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiLocalstatequeryGenesisConfigGetRequest struct via the builder pattern + + +### Return type + +**map[string]interface{}** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LocalstatequeryProtocolParamsGet + +> map[string]interface{} LocalstatequeryProtocolParamsGet(ctx).Execute() + +Query Current Protocol Parameters + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LocalstatequeryAPI.LocalstatequeryProtocolParamsGet(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LocalstatequeryAPI.LocalstatequeryProtocolParamsGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LocalstatequeryProtocolParamsGet`: map[string]interface{} + fmt.Fprintf(os.Stdout, "Response from `LocalstatequeryAPI.LocalstatequeryProtocolParamsGet`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiLocalstatequeryProtocolParamsGetRequest struct via the builder pattern + + +### Return type + +**map[string]interface{}** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LocalstatequerySystemStartGet + +> ApiResponseLocalStateQuerySystemStart LocalstatequerySystemStartGet(ctx).Execute() + +Query System Start + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LocalstatequeryAPI.LocalstatequerySystemStartGet(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LocalstatequeryAPI.LocalstatequerySystemStartGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LocalstatequerySystemStartGet`: ApiResponseLocalStateQuerySystemStart + fmt.Fprintf(os.Stdout, "Response from `LocalstatequeryAPI.LocalstatequerySystemStartGet`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiLocalstatequerySystemStartGetRequest struct via the builder pattern + + +### Return type + +[**ApiResponseLocalStateQuerySystemStart**](ApiResponseLocalStateQuerySystemStart.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LocalstatequeryTipGet + +> ApiResponseLocalStateQueryTip LocalstatequeryTipGet(ctx).Execute() + +Query Chain Tip + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LocalstatequeryAPI.LocalstatequeryTipGet(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LocalstatequeryAPI.LocalstatequeryTipGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LocalstatequeryTipGet`: ApiResponseLocalStateQueryTip + fmt.Fprintf(os.Stdout, "Response from `LocalstatequeryAPI.LocalstatequeryTipGet`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiLocalstatequeryTipGetRequest struct via the builder pattern + + +### Return type + +[**ApiResponseLocalStateQueryTip**](ApiResponseLocalStateQueryTip.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/openapi/docs/LocaltxmonitorAPI.md b/openapi/docs/LocaltxmonitorAPI.md new file mode 100644 index 0000000..2199c22 --- /dev/null +++ b/openapi/docs/LocaltxmonitorAPI.md @@ -0,0 +1,197 @@ +# \LocaltxmonitorAPI + +All URIs are relative to *http://localhost/api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**LocaltxmonitorHasTxTxHashGet**](LocaltxmonitorAPI.md#LocaltxmonitorHasTxTxHashGet) | **Get** /localtxmonitor/has_tx/{tx_hash} | Check if a particular TX exists in the mempool +[**LocaltxmonitorSizesGet**](LocaltxmonitorAPI.md#LocaltxmonitorSizesGet) | **Get** /localtxmonitor/sizes | Get mempool capacity, size, and TX count +[**LocaltxmonitorTxsGet**](LocaltxmonitorAPI.md#LocaltxmonitorTxsGet) | **Get** /localtxmonitor/txs | List all transactions in the mempool + + + +## LocaltxmonitorHasTxTxHashGet + +> ApiResponseLocalTxMonitorHasTx LocaltxmonitorHasTxTxHashGet(ctx, txHash).Execute() + +Check if a particular TX exists in the mempool + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func main() { + txHash := "txHash_example" // string | Transaction hash (hex string) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LocaltxmonitorAPI.LocaltxmonitorHasTxTxHashGet(context.Background(), txHash).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LocaltxmonitorAPI.LocaltxmonitorHasTxTxHashGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LocaltxmonitorHasTxTxHashGet`: ApiResponseLocalTxMonitorHasTx + fmt.Fprintf(os.Stdout, "Response from `LocaltxmonitorAPI.LocaltxmonitorHasTxTxHashGet`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**txHash** | **string** | Transaction hash (hex string) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiLocaltxmonitorHasTxTxHashGetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ApiResponseLocalTxMonitorHasTx**](ApiResponseLocalTxMonitorHasTx.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LocaltxmonitorSizesGet + +> ApiResponseLocalTxMonitorSizes LocaltxmonitorSizesGet(ctx).Execute() + +Get mempool capacity, size, and TX count + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LocaltxmonitorAPI.LocaltxmonitorSizesGet(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LocaltxmonitorAPI.LocaltxmonitorSizesGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LocaltxmonitorSizesGet`: ApiResponseLocalTxMonitorSizes + fmt.Fprintf(os.Stdout, "Response from `LocaltxmonitorAPI.LocaltxmonitorSizesGet`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiLocaltxmonitorSizesGetRequest struct via the builder pattern + + +### Return type + +[**ApiResponseLocalTxMonitorSizes**](ApiResponseLocalTxMonitorSizes.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LocaltxmonitorTxsGet + +> []ApiResponseLocalTxMonitorTxs LocaltxmonitorTxsGet(ctx).Execute() + +List all transactions in the mempool + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.LocaltxmonitorAPI.LocaltxmonitorTxsGet(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LocaltxmonitorAPI.LocaltxmonitorTxsGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `LocaltxmonitorTxsGet`: []ApiResponseLocalTxMonitorTxs + fmt.Fprintf(os.Stdout, "Response from `LocaltxmonitorAPI.LocaltxmonitorTxsGet`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiLocaltxmonitorTxsGetRequest struct via the builder pattern + + +### Return type + +[**[]ApiResponseLocalTxMonitorTxs**](ApiResponseLocalTxMonitorTxs.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/openapi/go.mod b/openapi/go.mod new file mode 100644 index 0000000..8689470 --- /dev/null +++ b/openapi/go.mod @@ -0,0 +1,11 @@ +module github.com/blinklabs-io/cardano-node-api/openapi + +go 1.21 + +require github.com/stretchr/testify v1.9.0 + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/openapi/go.sum b/openapi/go.sum new file mode 100644 index 0000000..60ce688 --- /dev/null +++ b/openapi/go.sum @@ -0,0 +1,10 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/openapi/model_api_response_api_error.go b/openapi/model_api_response_api_error.go new file mode 100644 index 0000000..b2da9d1 --- /dev/null +++ b/openapi/model_api_response_api_error.go @@ -0,0 +1,127 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ApiResponseApiError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApiResponseApiError{} + +// ApiResponseApiError struct for ApiResponseApiError +type ApiResponseApiError struct { + Msg *string `json:"msg,omitempty"` +} + +// NewApiResponseApiError instantiates a new ApiResponseApiError object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewApiResponseApiError() *ApiResponseApiError { + this := ApiResponseApiError{} + return &this +} + +// NewApiResponseApiErrorWithDefaults instantiates a new ApiResponseApiError object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewApiResponseApiErrorWithDefaults() *ApiResponseApiError { + this := ApiResponseApiError{} + return &this +} + +// GetMsg returns the Msg field value if set, zero value otherwise. +func (o *ApiResponseApiError) GetMsg() string { + if o == nil || IsNil(o.Msg) { + var ret string + return ret + } + return *o.Msg +} + +// GetMsgOk returns a tuple with the Msg field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseApiError) GetMsgOk() (*string, bool) { + if o == nil || IsNil(o.Msg) { + return nil, false + } + return o.Msg, true +} + +// HasMsg returns a boolean if a field has been set. +func (o *ApiResponseApiError) HasMsg() bool { + if o != nil && !IsNil(o.Msg) { + return true + } + + return false +} + +// SetMsg gets a reference to the given string and assigns it to the Msg field. +func (o *ApiResponseApiError) SetMsg(v string) { + o.Msg = &v +} + +func (o ApiResponseApiError) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApiResponseApiError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Msg) { + toSerialize["msg"] = o.Msg + } + return toSerialize, nil +} + +type NullableApiResponseApiError struct { + value *ApiResponseApiError + isSet bool +} + +func (v NullableApiResponseApiError) Get() *ApiResponseApiError { + return v.value +} + +func (v *NullableApiResponseApiError) Set(val *ApiResponseApiError) { + v.value = val + v.isSet = true +} + +func (v NullableApiResponseApiError) IsSet() bool { + return v.isSet +} + +func (v *NullableApiResponseApiError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApiResponseApiError(val *ApiResponseApiError) *NullableApiResponseApiError { + return &NullableApiResponseApiError{value: val, isSet: true} +} + +func (v NullableApiResponseApiError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApiResponseApiError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/openapi/model_api_response_local_state_query_current_era.go b/openapi/model_api_response_local_state_query_current_era.go new file mode 100644 index 0000000..68d0b7d --- /dev/null +++ b/openapi/model_api_response_local_state_query_current_era.go @@ -0,0 +1,163 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ApiResponseLocalStateQueryCurrentEra type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApiResponseLocalStateQueryCurrentEra{} + +// ApiResponseLocalStateQueryCurrentEra struct for ApiResponseLocalStateQueryCurrentEra +type ApiResponseLocalStateQueryCurrentEra struct { + Id *int32 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} + +// NewApiResponseLocalStateQueryCurrentEra instantiates a new ApiResponseLocalStateQueryCurrentEra object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewApiResponseLocalStateQueryCurrentEra() *ApiResponseLocalStateQueryCurrentEra { + this := ApiResponseLocalStateQueryCurrentEra{} + return &this +} + +// NewApiResponseLocalStateQueryCurrentEraWithDefaults instantiates a new ApiResponseLocalStateQueryCurrentEra object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewApiResponseLocalStateQueryCurrentEraWithDefaults() *ApiResponseLocalStateQueryCurrentEra { + this := ApiResponseLocalStateQueryCurrentEra{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ApiResponseLocalStateQueryCurrentEra) GetId() int32 { + if o == nil || IsNil(o.Id) { + var ret int32 + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalStateQueryCurrentEra) GetIdOk() (*int32, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *ApiResponseLocalStateQueryCurrentEra) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given int32 and assigns it to the Id field. +func (o *ApiResponseLocalStateQueryCurrentEra) SetId(v int32) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ApiResponseLocalStateQueryCurrentEra) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalStateQueryCurrentEra) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *ApiResponseLocalStateQueryCurrentEra) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ApiResponseLocalStateQueryCurrentEra) SetName(v string) { + o.Name = &v +} + +func (o ApiResponseLocalStateQueryCurrentEra) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApiResponseLocalStateQueryCurrentEra) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableApiResponseLocalStateQueryCurrentEra struct { + value *ApiResponseLocalStateQueryCurrentEra + isSet bool +} + +func (v NullableApiResponseLocalStateQueryCurrentEra) Get() *ApiResponseLocalStateQueryCurrentEra { + return v.value +} + +func (v *NullableApiResponseLocalStateQueryCurrentEra) Set(val *ApiResponseLocalStateQueryCurrentEra) { + v.value = val + v.isSet = true +} + +func (v NullableApiResponseLocalStateQueryCurrentEra) IsSet() bool { + return v.isSet +} + +func (v *NullableApiResponseLocalStateQueryCurrentEra) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApiResponseLocalStateQueryCurrentEra(val *ApiResponseLocalStateQueryCurrentEra) *NullableApiResponseLocalStateQueryCurrentEra { + return &NullableApiResponseLocalStateQueryCurrentEra{value: val, isSet: true} +} + +func (v NullableApiResponseLocalStateQueryCurrentEra) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApiResponseLocalStateQueryCurrentEra) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/openapi/model_api_response_local_state_query_system_start.go b/openapi/model_api_response_local_state_query_system_start.go new file mode 100644 index 0000000..fe742bc --- /dev/null +++ b/openapi/model_api_response_local_state_query_system_start.go @@ -0,0 +1,199 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ApiResponseLocalStateQuerySystemStart type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApiResponseLocalStateQuerySystemStart{} + +// ApiResponseLocalStateQuerySystemStart struct for ApiResponseLocalStateQuerySystemStart +type ApiResponseLocalStateQuerySystemStart struct { + Day *int32 `json:"day,omitempty"` + Picoseconds *int32 `json:"picoseconds,omitempty"` + Year *int32 `json:"year,omitempty"` +} + +// NewApiResponseLocalStateQuerySystemStart instantiates a new ApiResponseLocalStateQuerySystemStart object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewApiResponseLocalStateQuerySystemStart() *ApiResponseLocalStateQuerySystemStart { + this := ApiResponseLocalStateQuerySystemStart{} + return &this +} + +// NewApiResponseLocalStateQuerySystemStartWithDefaults instantiates a new ApiResponseLocalStateQuerySystemStart object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewApiResponseLocalStateQuerySystemStartWithDefaults() *ApiResponseLocalStateQuerySystemStart { + this := ApiResponseLocalStateQuerySystemStart{} + return &this +} + +// GetDay returns the Day field value if set, zero value otherwise. +func (o *ApiResponseLocalStateQuerySystemStart) GetDay() int32 { + if o == nil || IsNil(o.Day) { + var ret int32 + return ret + } + return *o.Day +} + +// GetDayOk returns a tuple with the Day field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalStateQuerySystemStart) GetDayOk() (*int32, bool) { + if o == nil || IsNil(o.Day) { + return nil, false + } + return o.Day, true +} + +// HasDay returns a boolean if a field has been set. +func (o *ApiResponseLocalStateQuerySystemStart) HasDay() bool { + if o != nil && !IsNil(o.Day) { + return true + } + + return false +} + +// SetDay gets a reference to the given int32 and assigns it to the Day field. +func (o *ApiResponseLocalStateQuerySystemStart) SetDay(v int32) { + o.Day = &v +} + +// GetPicoseconds returns the Picoseconds field value if set, zero value otherwise. +func (o *ApiResponseLocalStateQuerySystemStart) GetPicoseconds() int32 { + if o == nil || IsNil(o.Picoseconds) { + var ret int32 + return ret + } + return *o.Picoseconds +} + +// GetPicosecondsOk returns a tuple with the Picoseconds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalStateQuerySystemStart) GetPicosecondsOk() (*int32, bool) { + if o == nil || IsNil(o.Picoseconds) { + return nil, false + } + return o.Picoseconds, true +} + +// HasPicoseconds returns a boolean if a field has been set. +func (o *ApiResponseLocalStateQuerySystemStart) HasPicoseconds() bool { + if o != nil && !IsNil(o.Picoseconds) { + return true + } + + return false +} + +// SetPicoseconds gets a reference to the given int32 and assigns it to the Picoseconds field. +func (o *ApiResponseLocalStateQuerySystemStart) SetPicoseconds(v int32) { + o.Picoseconds = &v +} + +// GetYear returns the Year field value if set, zero value otherwise. +func (o *ApiResponseLocalStateQuerySystemStart) GetYear() int32 { + if o == nil || IsNil(o.Year) { + var ret int32 + return ret + } + return *o.Year +} + +// GetYearOk returns a tuple with the Year field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalStateQuerySystemStart) GetYearOk() (*int32, bool) { + if o == nil || IsNil(o.Year) { + return nil, false + } + return o.Year, true +} + +// HasYear returns a boolean if a field has been set. +func (o *ApiResponseLocalStateQuerySystemStart) HasYear() bool { + if o != nil && !IsNil(o.Year) { + return true + } + + return false +} + +// SetYear gets a reference to the given int32 and assigns it to the Year field. +func (o *ApiResponseLocalStateQuerySystemStart) SetYear(v int32) { + o.Year = &v +} + +func (o ApiResponseLocalStateQuerySystemStart) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApiResponseLocalStateQuerySystemStart) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Day) { + toSerialize["day"] = o.Day + } + if !IsNil(o.Picoseconds) { + toSerialize["picoseconds"] = o.Picoseconds + } + if !IsNil(o.Year) { + toSerialize["year"] = o.Year + } + return toSerialize, nil +} + +type NullableApiResponseLocalStateQuerySystemStart struct { + value *ApiResponseLocalStateQuerySystemStart + isSet bool +} + +func (v NullableApiResponseLocalStateQuerySystemStart) Get() *ApiResponseLocalStateQuerySystemStart { + return v.value +} + +func (v *NullableApiResponseLocalStateQuerySystemStart) Set(val *ApiResponseLocalStateQuerySystemStart) { + v.value = val + v.isSet = true +} + +func (v NullableApiResponseLocalStateQuerySystemStart) IsSet() bool { + return v.isSet +} + +func (v *NullableApiResponseLocalStateQuerySystemStart) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApiResponseLocalStateQuerySystemStart(val *ApiResponseLocalStateQuerySystemStart) *NullableApiResponseLocalStateQuerySystemStart { + return &NullableApiResponseLocalStateQuerySystemStart{value: val, isSet: true} +} + +func (v NullableApiResponseLocalStateQuerySystemStart) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApiResponseLocalStateQuerySystemStart) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/openapi/model_api_response_local_state_query_tip.go b/openapi/model_api_response_local_state_query_tip.go new file mode 100644 index 0000000..52a28af --- /dev/null +++ b/openapi/model_api_response_local_state_query_tip.go @@ -0,0 +1,271 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ApiResponseLocalStateQueryTip type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApiResponseLocalStateQueryTip{} + +// ApiResponseLocalStateQueryTip struct for ApiResponseLocalStateQueryTip +type ApiResponseLocalStateQueryTip struct { + BlockNo *int32 `json:"block_no,omitempty"` + EpochNo *int32 `json:"epoch_no,omitempty"` + Era *string `json:"era,omitempty"` + Hash *string `json:"hash,omitempty"` + SlotNo *int32 `json:"slot_no,omitempty"` +} + +// NewApiResponseLocalStateQueryTip instantiates a new ApiResponseLocalStateQueryTip object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewApiResponseLocalStateQueryTip() *ApiResponseLocalStateQueryTip { + this := ApiResponseLocalStateQueryTip{} + return &this +} + +// NewApiResponseLocalStateQueryTipWithDefaults instantiates a new ApiResponseLocalStateQueryTip object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewApiResponseLocalStateQueryTipWithDefaults() *ApiResponseLocalStateQueryTip { + this := ApiResponseLocalStateQueryTip{} + return &this +} + +// GetBlockNo returns the BlockNo field value if set, zero value otherwise. +func (o *ApiResponseLocalStateQueryTip) GetBlockNo() int32 { + if o == nil || IsNil(o.BlockNo) { + var ret int32 + return ret + } + return *o.BlockNo +} + +// GetBlockNoOk returns a tuple with the BlockNo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalStateQueryTip) GetBlockNoOk() (*int32, bool) { + if o == nil || IsNil(o.BlockNo) { + return nil, false + } + return o.BlockNo, true +} + +// HasBlockNo returns a boolean if a field has been set. +func (o *ApiResponseLocalStateQueryTip) HasBlockNo() bool { + if o != nil && !IsNil(o.BlockNo) { + return true + } + + return false +} + +// SetBlockNo gets a reference to the given int32 and assigns it to the BlockNo field. +func (o *ApiResponseLocalStateQueryTip) SetBlockNo(v int32) { + o.BlockNo = &v +} + +// GetEpochNo returns the EpochNo field value if set, zero value otherwise. +func (o *ApiResponseLocalStateQueryTip) GetEpochNo() int32 { + if o == nil || IsNil(o.EpochNo) { + var ret int32 + return ret + } + return *o.EpochNo +} + +// GetEpochNoOk returns a tuple with the EpochNo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalStateQueryTip) GetEpochNoOk() (*int32, bool) { + if o == nil || IsNil(o.EpochNo) { + return nil, false + } + return o.EpochNo, true +} + +// HasEpochNo returns a boolean if a field has been set. +func (o *ApiResponseLocalStateQueryTip) HasEpochNo() bool { + if o != nil && !IsNil(o.EpochNo) { + return true + } + + return false +} + +// SetEpochNo gets a reference to the given int32 and assigns it to the EpochNo field. +func (o *ApiResponseLocalStateQueryTip) SetEpochNo(v int32) { + o.EpochNo = &v +} + +// GetEra returns the Era field value if set, zero value otherwise. +func (o *ApiResponseLocalStateQueryTip) GetEra() string { + if o == nil || IsNil(o.Era) { + var ret string + return ret + } + return *o.Era +} + +// GetEraOk returns a tuple with the Era field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalStateQueryTip) GetEraOk() (*string, bool) { + if o == nil || IsNil(o.Era) { + return nil, false + } + return o.Era, true +} + +// HasEra returns a boolean if a field has been set. +func (o *ApiResponseLocalStateQueryTip) HasEra() bool { + if o != nil && !IsNil(o.Era) { + return true + } + + return false +} + +// SetEra gets a reference to the given string and assigns it to the Era field. +func (o *ApiResponseLocalStateQueryTip) SetEra(v string) { + o.Era = &v +} + +// GetHash returns the Hash field value if set, zero value otherwise. +func (o *ApiResponseLocalStateQueryTip) GetHash() string { + if o == nil || IsNil(o.Hash) { + var ret string + return ret + } + return *o.Hash +} + +// GetHashOk returns a tuple with the Hash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalStateQueryTip) GetHashOk() (*string, bool) { + if o == nil || IsNil(o.Hash) { + return nil, false + } + return o.Hash, true +} + +// HasHash returns a boolean if a field has been set. +func (o *ApiResponseLocalStateQueryTip) HasHash() bool { + if o != nil && !IsNil(o.Hash) { + return true + } + + return false +} + +// SetHash gets a reference to the given string and assigns it to the Hash field. +func (o *ApiResponseLocalStateQueryTip) SetHash(v string) { + o.Hash = &v +} + +// GetSlotNo returns the SlotNo field value if set, zero value otherwise. +func (o *ApiResponseLocalStateQueryTip) GetSlotNo() int32 { + if o == nil || IsNil(o.SlotNo) { + var ret int32 + return ret + } + return *o.SlotNo +} + +// GetSlotNoOk returns a tuple with the SlotNo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalStateQueryTip) GetSlotNoOk() (*int32, bool) { + if o == nil || IsNil(o.SlotNo) { + return nil, false + } + return o.SlotNo, true +} + +// HasSlotNo returns a boolean if a field has been set. +func (o *ApiResponseLocalStateQueryTip) HasSlotNo() bool { + if o != nil && !IsNil(o.SlotNo) { + return true + } + + return false +} + +// SetSlotNo gets a reference to the given int32 and assigns it to the SlotNo field. +func (o *ApiResponseLocalStateQueryTip) SetSlotNo(v int32) { + o.SlotNo = &v +} + +func (o ApiResponseLocalStateQueryTip) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApiResponseLocalStateQueryTip) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BlockNo) { + toSerialize["block_no"] = o.BlockNo + } + if !IsNil(o.EpochNo) { + toSerialize["epoch_no"] = o.EpochNo + } + if !IsNil(o.Era) { + toSerialize["era"] = o.Era + } + if !IsNil(o.Hash) { + toSerialize["hash"] = o.Hash + } + if !IsNil(o.SlotNo) { + toSerialize["slot_no"] = o.SlotNo + } + return toSerialize, nil +} + +type NullableApiResponseLocalStateQueryTip struct { + value *ApiResponseLocalStateQueryTip + isSet bool +} + +func (v NullableApiResponseLocalStateQueryTip) Get() *ApiResponseLocalStateQueryTip { + return v.value +} + +func (v *NullableApiResponseLocalStateQueryTip) Set(val *ApiResponseLocalStateQueryTip) { + v.value = val + v.isSet = true +} + +func (v NullableApiResponseLocalStateQueryTip) IsSet() bool { + return v.isSet +} + +func (v *NullableApiResponseLocalStateQueryTip) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApiResponseLocalStateQueryTip(val *ApiResponseLocalStateQueryTip) *NullableApiResponseLocalStateQueryTip { + return &NullableApiResponseLocalStateQueryTip{value: val, isSet: true} +} + +func (v NullableApiResponseLocalStateQueryTip) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApiResponseLocalStateQueryTip) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/openapi/model_api_response_local_tx_monitor_has_tx.go b/openapi/model_api_response_local_tx_monitor_has_tx.go new file mode 100644 index 0000000..f61bcea --- /dev/null +++ b/openapi/model_api_response_local_tx_monitor_has_tx.go @@ -0,0 +1,127 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ApiResponseLocalTxMonitorHasTx type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApiResponseLocalTxMonitorHasTx{} + +// ApiResponseLocalTxMonitorHasTx struct for ApiResponseLocalTxMonitorHasTx +type ApiResponseLocalTxMonitorHasTx struct { + HasTx *bool `json:"has_tx,omitempty"` +} + +// NewApiResponseLocalTxMonitorHasTx instantiates a new ApiResponseLocalTxMonitorHasTx object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewApiResponseLocalTxMonitorHasTx() *ApiResponseLocalTxMonitorHasTx { + this := ApiResponseLocalTxMonitorHasTx{} + return &this +} + +// NewApiResponseLocalTxMonitorHasTxWithDefaults instantiates a new ApiResponseLocalTxMonitorHasTx object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewApiResponseLocalTxMonitorHasTxWithDefaults() *ApiResponseLocalTxMonitorHasTx { + this := ApiResponseLocalTxMonitorHasTx{} + return &this +} + +// GetHasTx returns the HasTx field value if set, zero value otherwise. +func (o *ApiResponseLocalTxMonitorHasTx) GetHasTx() bool { + if o == nil || IsNil(o.HasTx) { + var ret bool + return ret + } + return *o.HasTx +} + +// GetHasTxOk returns a tuple with the HasTx field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalTxMonitorHasTx) GetHasTxOk() (*bool, bool) { + if o == nil || IsNil(o.HasTx) { + return nil, false + } + return o.HasTx, true +} + +// HasHasTx returns a boolean if a field has been set. +func (o *ApiResponseLocalTxMonitorHasTx) HasHasTx() bool { + if o != nil && !IsNil(o.HasTx) { + return true + } + + return false +} + +// SetHasTx gets a reference to the given bool and assigns it to the HasTx field. +func (o *ApiResponseLocalTxMonitorHasTx) SetHasTx(v bool) { + o.HasTx = &v +} + +func (o ApiResponseLocalTxMonitorHasTx) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApiResponseLocalTxMonitorHasTx) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.HasTx) { + toSerialize["has_tx"] = o.HasTx + } + return toSerialize, nil +} + +type NullableApiResponseLocalTxMonitorHasTx struct { + value *ApiResponseLocalTxMonitorHasTx + isSet bool +} + +func (v NullableApiResponseLocalTxMonitorHasTx) Get() *ApiResponseLocalTxMonitorHasTx { + return v.value +} + +func (v *NullableApiResponseLocalTxMonitorHasTx) Set(val *ApiResponseLocalTxMonitorHasTx) { + v.value = val + v.isSet = true +} + +func (v NullableApiResponseLocalTxMonitorHasTx) IsSet() bool { + return v.isSet +} + +func (v *NullableApiResponseLocalTxMonitorHasTx) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApiResponseLocalTxMonitorHasTx(val *ApiResponseLocalTxMonitorHasTx) *NullableApiResponseLocalTxMonitorHasTx { + return &NullableApiResponseLocalTxMonitorHasTx{value: val, isSet: true} +} + +func (v NullableApiResponseLocalTxMonitorHasTx) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApiResponseLocalTxMonitorHasTx) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/openapi/model_api_response_local_tx_monitor_sizes.go b/openapi/model_api_response_local_tx_monitor_sizes.go new file mode 100644 index 0000000..7d810f5 --- /dev/null +++ b/openapi/model_api_response_local_tx_monitor_sizes.go @@ -0,0 +1,199 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ApiResponseLocalTxMonitorSizes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApiResponseLocalTxMonitorSizes{} + +// ApiResponseLocalTxMonitorSizes struct for ApiResponseLocalTxMonitorSizes +type ApiResponseLocalTxMonitorSizes struct { + Capacity *int32 `json:"capacity,omitempty"` + Size *int32 `json:"size,omitempty"` + TxCount *int32 `json:"tx_count,omitempty"` +} + +// NewApiResponseLocalTxMonitorSizes instantiates a new ApiResponseLocalTxMonitorSizes object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewApiResponseLocalTxMonitorSizes() *ApiResponseLocalTxMonitorSizes { + this := ApiResponseLocalTxMonitorSizes{} + return &this +} + +// NewApiResponseLocalTxMonitorSizesWithDefaults instantiates a new ApiResponseLocalTxMonitorSizes object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewApiResponseLocalTxMonitorSizesWithDefaults() *ApiResponseLocalTxMonitorSizes { + this := ApiResponseLocalTxMonitorSizes{} + return &this +} + +// GetCapacity returns the Capacity field value if set, zero value otherwise. +func (o *ApiResponseLocalTxMonitorSizes) GetCapacity() int32 { + if o == nil || IsNil(o.Capacity) { + var ret int32 + return ret + } + return *o.Capacity +} + +// GetCapacityOk returns a tuple with the Capacity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalTxMonitorSizes) GetCapacityOk() (*int32, bool) { + if o == nil || IsNil(o.Capacity) { + return nil, false + } + return o.Capacity, true +} + +// HasCapacity returns a boolean if a field has been set. +func (o *ApiResponseLocalTxMonitorSizes) HasCapacity() bool { + if o != nil && !IsNil(o.Capacity) { + return true + } + + return false +} + +// SetCapacity gets a reference to the given int32 and assigns it to the Capacity field. +func (o *ApiResponseLocalTxMonitorSizes) SetCapacity(v int32) { + o.Capacity = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *ApiResponseLocalTxMonitorSizes) GetSize() int32 { + if o == nil || IsNil(o.Size) { + var ret int32 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalTxMonitorSizes) GetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *ApiResponseLocalTxMonitorSizes) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given int32 and assigns it to the Size field. +func (o *ApiResponseLocalTxMonitorSizes) SetSize(v int32) { + o.Size = &v +} + +// GetTxCount returns the TxCount field value if set, zero value otherwise. +func (o *ApiResponseLocalTxMonitorSizes) GetTxCount() int32 { + if o == nil || IsNil(o.TxCount) { + var ret int32 + return ret + } + return *o.TxCount +} + +// GetTxCountOk returns a tuple with the TxCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalTxMonitorSizes) GetTxCountOk() (*int32, bool) { + if o == nil || IsNil(o.TxCount) { + return nil, false + } + return o.TxCount, true +} + +// HasTxCount returns a boolean if a field has been set. +func (o *ApiResponseLocalTxMonitorSizes) HasTxCount() bool { + if o != nil && !IsNil(o.TxCount) { + return true + } + + return false +} + +// SetTxCount gets a reference to the given int32 and assigns it to the TxCount field. +func (o *ApiResponseLocalTxMonitorSizes) SetTxCount(v int32) { + o.TxCount = &v +} + +func (o ApiResponseLocalTxMonitorSizes) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApiResponseLocalTxMonitorSizes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Capacity) { + toSerialize["capacity"] = o.Capacity + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + if !IsNil(o.TxCount) { + toSerialize["tx_count"] = o.TxCount + } + return toSerialize, nil +} + +type NullableApiResponseLocalTxMonitorSizes struct { + value *ApiResponseLocalTxMonitorSizes + isSet bool +} + +func (v NullableApiResponseLocalTxMonitorSizes) Get() *ApiResponseLocalTxMonitorSizes { + return v.value +} + +func (v *NullableApiResponseLocalTxMonitorSizes) Set(val *ApiResponseLocalTxMonitorSizes) { + v.value = val + v.isSet = true +} + +func (v NullableApiResponseLocalTxMonitorSizes) IsSet() bool { + return v.isSet +} + +func (v *NullableApiResponseLocalTxMonitorSizes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApiResponseLocalTxMonitorSizes(val *ApiResponseLocalTxMonitorSizes) *NullableApiResponseLocalTxMonitorSizes { + return &NullableApiResponseLocalTxMonitorSizes{value: val, isSet: true} +} + +func (v NullableApiResponseLocalTxMonitorSizes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApiResponseLocalTxMonitorSizes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/openapi/model_api_response_local_tx_monitor_txs.go b/openapi/model_api_response_local_tx_monitor_txs.go new file mode 100644 index 0000000..cc42188 --- /dev/null +++ b/openapi/model_api_response_local_tx_monitor_txs.go @@ -0,0 +1,163 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// checks if the ApiResponseLocalTxMonitorTxs type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApiResponseLocalTxMonitorTxs{} + +// ApiResponseLocalTxMonitorTxs struct for ApiResponseLocalTxMonitorTxs +type ApiResponseLocalTxMonitorTxs struct { + TxBytes *string `json:"tx_bytes,omitempty"` + TxHash *string `json:"tx_hash,omitempty"` +} + +// NewApiResponseLocalTxMonitorTxs instantiates a new ApiResponseLocalTxMonitorTxs object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewApiResponseLocalTxMonitorTxs() *ApiResponseLocalTxMonitorTxs { + this := ApiResponseLocalTxMonitorTxs{} + return &this +} + +// NewApiResponseLocalTxMonitorTxsWithDefaults instantiates a new ApiResponseLocalTxMonitorTxs object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewApiResponseLocalTxMonitorTxsWithDefaults() *ApiResponseLocalTxMonitorTxs { + this := ApiResponseLocalTxMonitorTxs{} + return &this +} + +// GetTxBytes returns the TxBytes field value if set, zero value otherwise. +func (o *ApiResponseLocalTxMonitorTxs) GetTxBytes() string { + if o == nil || IsNil(o.TxBytes) { + var ret string + return ret + } + return *o.TxBytes +} + +// GetTxBytesOk returns a tuple with the TxBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalTxMonitorTxs) GetTxBytesOk() (*string, bool) { + if o == nil || IsNil(o.TxBytes) { + return nil, false + } + return o.TxBytes, true +} + +// HasTxBytes returns a boolean if a field has been set. +func (o *ApiResponseLocalTxMonitorTxs) HasTxBytes() bool { + if o != nil && !IsNil(o.TxBytes) { + return true + } + + return false +} + +// SetTxBytes gets a reference to the given string and assigns it to the TxBytes field. +func (o *ApiResponseLocalTxMonitorTxs) SetTxBytes(v string) { + o.TxBytes = &v +} + +// GetTxHash returns the TxHash field value if set, zero value otherwise. +func (o *ApiResponseLocalTxMonitorTxs) GetTxHash() string { + if o == nil || IsNil(o.TxHash) { + var ret string + return ret + } + return *o.TxHash +} + +// GetTxHashOk returns a tuple with the TxHash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ApiResponseLocalTxMonitorTxs) GetTxHashOk() (*string, bool) { + if o == nil || IsNil(o.TxHash) { + return nil, false + } + return o.TxHash, true +} + +// HasTxHash returns a boolean if a field has been set. +func (o *ApiResponseLocalTxMonitorTxs) HasTxHash() bool { + if o != nil && !IsNil(o.TxHash) { + return true + } + + return false +} + +// SetTxHash gets a reference to the given string and assigns it to the TxHash field. +func (o *ApiResponseLocalTxMonitorTxs) SetTxHash(v string) { + o.TxHash = &v +} + +func (o ApiResponseLocalTxMonitorTxs) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApiResponseLocalTxMonitorTxs) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.TxBytes) { + toSerialize["tx_bytes"] = o.TxBytes + } + if !IsNil(o.TxHash) { + toSerialize["tx_hash"] = o.TxHash + } + return toSerialize, nil +} + +type NullableApiResponseLocalTxMonitorTxs struct { + value *ApiResponseLocalTxMonitorTxs + isSet bool +} + +func (v NullableApiResponseLocalTxMonitorTxs) Get() *ApiResponseLocalTxMonitorTxs { + return v.value +} + +func (v *NullableApiResponseLocalTxMonitorTxs) Set(val *ApiResponseLocalTxMonitorTxs) { + v.value = val + v.isSet = true +} + +func (v NullableApiResponseLocalTxMonitorTxs) IsSet() bool { + return v.isSet +} + +func (v *NullableApiResponseLocalTxMonitorTxs) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableApiResponseLocalTxMonitorTxs(val *ApiResponseLocalTxMonitorTxs) *NullableApiResponseLocalTxMonitorTxs { + return &NullableApiResponseLocalTxMonitorTxs{value: val, isSet: true} +} + +func (v NullableApiResponseLocalTxMonitorTxs) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableApiResponseLocalTxMonitorTxs) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/openapi/response.go b/openapi/response.go new file mode 100644 index 0000000..bfb20c0 --- /dev/null +++ b/openapi/response.go @@ -0,0 +1,48 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/openapi/test/api_chainsync_test.go b/openapi/test/api_chainsync_test.go new file mode 100644 index 0000000..f6fab9d --- /dev/null +++ b/openapi/test/api_chainsync_test.go @@ -0,0 +1,36 @@ +/* +cardano-node-api + +Testing ChainsyncAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func Test_openapi_ChainsyncAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test ChainsyncAPIService ChainsyncSyncGet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + httpRes, err := apiClient.ChainsyncAPI.ChainsyncSyncGet(context.Background()).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/openapi/test/api_default_test.go b/openapi/test/api_default_test.go new file mode 100644 index 0000000..52da65e --- /dev/null +++ b/openapi/test/api_default_test.go @@ -0,0 +1,37 @@ +/* +cardano-node-api + +Testing DefaultAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func Test_openapi_DefaultAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test DefaultAPIService LocaltxsubmissionTxPost", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultAPI.LocaltxsubmissionTxPost(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/openapi/test/api_localstatequery_test.go b/openapi/test/api_localstatequery_test.go new file mode 100644 index 0000000..6ace219 --- /dev/null +++ b/openapi/test/api_localstatequery_test.go @@ -0,0 +1,97 @@ +/* +cardano-node-api + +Testing LocalstatequeryAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func Test_openapi_LocalstatequeryAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test LocalstatequeryAPIService LocalstatequeryCurrentEraGet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.LocalstatequeryAPI.LocalstatequeryCurrentEraGet(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test LocalstatequeryAPIService LocalstatequeryEraHistoryGet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.LocalstatequeryAPI.LocalstatequeryEraHistoryGet(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test LocalstatequeryAPIService LocalstatequeryGenesisConfigGet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.LocalstatequeryAPI.LocalstatequeryGenesisConfigGet(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test LocalstatequeryAPIService LocalstatequeryProtocolParamsGet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.LocalstatequeryAPI.LocalstatequeryProtocolParamsGet(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test LocalstatequeryAPIService LocalstatequerySystemStartGet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.LocalstatequeryAPI.LocalstatequerySystemStartGet(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test LocalstatequeryAPIService LocalstatequeryTipGet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.LocalstatequeryAPI.LocalstatequeryTipGet(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/openapi/test/api_localtxmonitor_test.go b/openapi/test/api_localtxmonitor_test.go new file mode 100644 index 0000000..5be8017 --- /dev/null +++ b/openapi/test/api_localtxmonitor_test.go @@ -0,0 +1,63 @@ +/* +cardano-node-api + +Testing LocaltxmonitorAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package openapi + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/blinklabs-io/cardano-node-api/openapi" +) + +func Test_openapi_LocaltxmonitorAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test LocaltxmonitorAPIService LocaltxmonitorHasTxTxHashGet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var txHash string + + resp, httpRes, err := apiClient.LocaltxmonitorAPI.LocaltxmonitorHasTxTxHashGet(context.Background(), txHash).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test LocaltxmonitorAPIService LocaltxmonitorSizesGet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.LocaltxmonitorAPI.LocaltxmonitorSizesGet(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test LocaltxmonitorAPIService LocaltxmonitorTxsGet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.LocaltxmonitorAPI.LocaltxmonitorTxsGet(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/openapi/utils.go b/openapi/utils.go new file mode 100644 index 0000000..f7a857a --- /dev/null +++ b/openapi/utils.go @@ -0,0 +1,362 @@ +/* +cardano-node-api + +Cardano Node API + +API version: 1.0 +Contact: support@blinklabs.io +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} \ No newline at end of file