tokenMetadataV1

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package tokenMetadataV1 provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGetInstrumentRequest

func NewGetInstrumentRequest(server string, instrumentId string) (*http.Request, error)

NewGetInstrumentRequest constructs an http.Request for the GetInstrument method

func NewGetRegistryInfoRequest

func NewGetRegistryInfoRequest(server string) (*http.Request, error)

NewGetRegistryInfoRequest constructs an http.Request for the GetRegistryInfo method

func NewListInstrumentsRequest

func NewListInstrumentsRequest(server string, params *ListInstrumentsParams) (*http.Request, error)

NewListInstrumentsRequest constructs an http.Request for the ListInstruments method

func RegisterHandlers

func RegisterHandlers(router gin.IRouter, si ServerInterface)

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetInstrument

func (c *Client) GetInstrument(ctx context.Context, instrumentId string, reqEditors ...RequestEditorFn) (*http.Response, error)

GetInstrument performs a GET /registry/metadata/v1/instruments/{instrumentId} (the `GetInstrument` operationId) request.

Retrieve an instrument's metadata.

func (*Client) GetRegistryInfo

func (c *Client) GetRegistryInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

GetRegistryInfo performs a GET /registry/metadata/v1/info (the `GetRegistryInfo` operationId) request.

Get information about the registry. The response includes the standards supported by the registry.

func (*Client) ListInstruments

func (c *Client) ListInstruments(ctx context.Context, params *ListInstrumentsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

ListInstruments performs a GET /registry/metadata/v1/instruments (the `ListInstruments` operationId) request.

List all instruments managed by this instrument admin.

type ClientInterface

type ClientInterface interface {

	// GetRegistryInfo performs a GET /registry/metadata/v1/info (the `GetRegistryInfo` operationId) request.
	//
	// Get information about the registry.
	// The response includes the standards supported by the registry.
	GetRegistryInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListInstruments performs a GET /registry/metadata/v1/instruments (the `ListInstruments` operationId) request.
	//
	// List all instruments managed by this instrument admin.
	ListInstruments(ctx context.Context, params *ListInstrumentsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetInstrument performs a GET /registry/metadata/v1/instruments/{instrumentId} (the `GetInstrument` operationId) request.
	//
	// Retrieve an instrument's metadata.
	GetInstrument(ctx context.Context, instrumentId string, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) GetInstrumentWithResponse

func (c *ClientWithResponses) GetInstrumentWithResponse(ctx context.Context, instrumentId string, reqEditors ...RequestEditorFn) (*GetInstrumentResp, error)

GetInstrumentWithResponse performs a GET /registry/metadata/v1/instruments/{instrumentId} (the `GetInstrument` operationId) request.

Retrieve an instrument's metadata.

Returns a wrapper object for the known response body format(s).

func (*ClientWithResponses) GetRegistryInfoWithResponse

func (c *ClientWithResponses) GetRegistryInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetRegistryInfoResp, error)

GetRegistryInfoWithResponse performs a GET /registry/metadata/v1/info (the `GetRegistryInfo` operationId) request.

Get information about the registry. The response includes the standards supported by the registry.

Returns a wrapper object for the known response body format(s).

func (*ClientWithResponses) ListInstrumentsWithResponse

func (c *ClientWithResponses) ListInstrumentsWithResponse(ctx context.Context, params *ListInstrumentsParams, reqEditors ...RequestEditorFn) (*ListInstrumentsResp, error)

ListInstrumentsWithResponse performs a GET /registry/metadata/v1/instruments (the `ListInstruments` operationId) request.

List all instruments managed by this instrument admin.

Returns a wrapper object for the known response body format(s).

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {

	// GetRegistryInfoWithResponse performs a GET /registry/metadata/v1/info (the `GetRegistryInfo` operationId) request.
	//
	// Get information about the registry.
	// The response includes the standards supported by the registry.
	//
	// Returns a wrapper object for the known response body format(s).
	GetRegistryInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetRegistryInfoResp, error)

	// ListInstrumentsWithResponse performs a GET /registry/metadata/v1/instruments (the `ListInstruments` operationId) request.
	//
	// List all instruments managed by this instrument admin.
	//
	// Returns a wrapper object for the known response body format(s).
	ListInstrumentsWithResponse(ctx context.Context, params *ListInstrumentsParams, reqEditors ...RequestEditorFn) (*ListInstrumentsResp, error)

	// GetInstrumentWithResponse performs a GET /registry/metadata/v1/instruments/{instrumentId} (the `GetInstrument` operationId) request.
	//
	// Retrieve an instrument's metadata.
	//
	// Returns a wrapper object for the known response body format(s).
	GetInstrumentWithResponse(ctx context.Context, instrumentId string, reqEditors ...RequestEditorFn) (*GetInstrumentResp, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse defines model for ErrorResponse.

type GetInstrumentResp

type GetInstrumentResp struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *Instrument
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *N404
	// JSON500 the response for an HTTP 500 `application/json` response
	JSON500 *N500
}

func ParseGetInstrumentResp

func ParseGetInstrumentResp(rsp *http.Response) (*GetInstrumentResp, error)

ParseGetInstrumentResp parses an HTTP response from a GetInstrumentWithResponse call

func (GetInstrumentResp) ContentType

func (r GetInstrumentResp) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetInstrumentResp) GetBody

func (r GetInstrumentResp) GetBody() []byte

GetBody returns the raw response body bytes

func (GetInstrumentResp) GetJSON200

func (r GetInstrumentResp) GetJSON200() *Instrument

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (GetInstrumentResp) GetJSON404

func (r GetInstrumentResp) GetJSON404() *N404

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (GetInstrumentResp) GetJSON500

func (r GetInstrumentResp) GetJSON500() *N500

GetJSON500 returns the response for an HTTP 500 `application/json` response

func (GetInstrumentResp) Status

func (r GetInstrumentResp) Status() string

Status returns HTTPResponse.Status

func (GetInstrumentResp) StatusCode

func (r GetInstrumentResp) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetRegistryInfoResp

type GetRegistryInfoResp struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *GetRegistryInfoResponse
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *N404
	// JSON500 the response for an HTTP 500 `application/json` response
	JSON500 *N500
}

func ParseGetRegistryInfoResp

func ParseGetRegistryInfoResp(rsp *http.Response) (*GetRegistryInfoResp, error)

ParseGetRegistryInfoResp parses an HTTP response from a GetRegistryInfoWithResponse call

func (GetRegistryInfoResp) ContentType

func (r GetRegistryInfoResp) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (GetRegistryInfoResp) GetBody

func (r GetRegistryInfoResp) GetBody() []byte

GetBody returns the raw response body bytes

func (GetRegistryInfoResp) GetJSON200

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (GetRegistryInfoResp) GetJSON404

func (r GetRegistryInfoResp) GetJSON404() *N404

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (GetRegistryInfoResp) GetJSON500

func (r GetRegistryInfoResp) GetJSON500() *N500

GetJSON500 returns the response for an HTTP 500 `application/json` response

func (GetRegistryInfoResp) Status

func (r GetRegistryInfoResp) Status() string

Status returns HTTPResponse.Status

func (GetRegistryInfoResp) StatusCode

func (r GetRegistryInfoResp) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetRegistryInfoResponse

type GetRegistryInfoResponse struct {
	// AdminId The Daml party representing the registry app
	AdminId string `json:"adminId"`

	// SupportedApis Map from token standard API name to the minor version of the API supported, e.g.,
	// splice-api-token-metadata-v1 -> 1 where the `1` corresponds to the minor version.
	SupportedApis SupportedApis `json:"supportedApis"`
}

GetRegistryInfoResponse defines model for GetRegistryInfoResponse.

type GinServerOptions

type GinServerOptions struct {
	BaseURL      string
	Middlewares  []MiddlewareFunc
	ErrorHandler func(*gin.Context, error, int)
}

GinServerOptions provides options for the Gin server.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type Instrument

type Instrument struct {
	// Decimals The number of decimal places used by the instrument.
	//
	// Must be a number between 0 and 10, as the Daml interfaces represent holding amounts as
	// `Decimal` values, which use 10 decimal places and are precise for 38 digits.
	// Setting this to 0 means that the instrument can only be held in whole units.
	//
	// This number SHOULD be used for display purposes in a wallet to decide how many
	// decimal places to show and accept when displaying or entering amounts.
	Decimals int8 `json:"decimals"`

	// Id The unique identifier assigned by the admin to the instrument.
	Id string `json:"id"`

	// Name The display name for the instrument recommended by the instrument admin. This is not necessarily unique.
	Name string `json:"name"`

	// SupportedApis Map from token standard API name to the minor version of the API supported, e.g.,
	// splice-api-token-metadata-v1 -> 1 where the `1` corresponds to the minor version.
	SupportedApis SupportedApis `json:"supportedApis"`

	// Symbol The symbol for the instrument recommended by the instrument admin. This is not necessarily unique.
	Symbol string `json:"symbol"`

	// TotalSupply Decimal encoded current total supply of the instrument.
	TotalSupply *string `json:"totalSupply,omitempty"`

	// TotalSupplyAsOf The timestamp when the total supply was last computed.
	TotalSupplyAsOf *time.Time `json:"totalSupplyAsOf,omitempty"`
}

Instrument defines model for Instrument.

type ListInstrumentsParams

type ListInstrumentsParams struct {
	// PageSize Number of instruments per page.
	PageSize *int32 `form:"pageSize,omitempty" json:"pageSize,omitempty"`

	// PageToken The `nextPageToken` received from the response for the previous page.
	PageToken *string `form:"pageToken,omitempty" json:"pageToken,omitempty"`
}

ListInstrumentsParams defines parameters for ListInstruments.

type ListInstrumentsResp

type ListInstrumentsResp struct {
	Body         []byte
	HTTPResponse *http.Response
	// JSON200 the response for an HTTP 200 `application/json` response
	JSON200 *ListInstrumentsResponse
	// JSON404 the response for an HTTP 404 `application/json` response
	JSON404 *N404
	// JSON500 the response for an HTTP 500 `application/json` response
	JSON500 *N500
}

func ParseListInstrumentsResp

func ParseListInstrumentsResp(rsp *http.Response) (*ListInstrumentsResp, error)

ParseListInstrumentsResp parses an HTTP response from a ListInstrumentsWithResponse call

func (ListInstrumentsResp) ContentType

func (r ListInstrumentsResp) ContentType() string

ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers

func (ListInstrumentsResp) GetBody

func (r ListInstrumentsResp) GetBody() []byte

GetBody returns the raw response body bytes

func (ListInstrumentsResp) GetJSON200

GetJSON200 returns the response for an HTTP 200 `application/json` response

func (ListInstrumentsResp) GetJSON404

func (r ListInstrumentsResp) GetJSON404() *N404

GetJSON404 returns the response for an HTTP 404 `application/json` response

func (ListInstrumentsResp) GetJSON500

func (r ListInstrumentsResp) GetJSON500() *N500

GetJSON500 returns the response for an HTTP 500 `application/json` response

func (ListInstrumentsResp) Status

func (r ListInstrumentsResp) Status() string

Status returns HTTPResponse.Status

func (ListInstrumentsResp) StatusCode

func (r ListInstrumentsResp) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ListInstrumentsResponse

type ListInstrumentsResponse struct {
	Instruments []Instrument `json:"instruments"`

	// NextPageToken The token for the next page of results, to be used as the lastInstrumentId for the next page.
	NextPageToken *string `json:"nextPageToken,omitempty"`
}

ListInstrumentsResponse defines model for ListInstrumentsResponse.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type N404

type N404 = ErrorResponse

N404 defines model for 404.

type N500

type N500 = ErrorResponse

N500 defines model for 500.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type ServerInterface

type ServerInterface interface {

	// (GET /registry/metadata/v1/info)
	GetRegistryInfo(c *gin.Context)

	// (GET /registry/metadata/v1/instruments)
	ListInstruments(c *gin.Context, params ListInstrumentsParams)

	// (GET /registry/metadata/v1/instruments/{instrumentId})
	GetInstrument(c *gin.Context, instrumentId string)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandler       func(*gin.Context, error, int)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) GetInstrument

func (siw *ServerInterfaceWrapper) GetInstrument(c *gin.Context)

GetInstrument operation middleware

func (*ServerInterfaceWrapper) GetRegistryInfo

func (siw *ServerInterfaceWrapper) GetRegistryInfo(c *gin.Context)

GetRegistryInfo operation middleware

func (*ServerInterfaceWrapper) ListInstruments

func (siw *ServerInterfaceWrapper) ListInstruments(c *gin.Context)

ListInstruments operation middleware

type SupportedApis

type SupportedApis map[string]int32

SupportedApis Map from token standard API name to the minor version of the API supported, e.g., splice-api-token-metadata-v1 -> 1 where the `1` corresponds to the minor version.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL