tokenMetadataV1

package
v0.0.0-...-346157b Latest Latest
Warning

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

Go to latest
Published: May 27, 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.5.1 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 generates requests for GetInstrument

func NewGetRegistryInfoRequest

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

NewGetRegistryInfoRequest generates requests for GetRegistryInfo

func NewListInstrumentsRequest

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

NewListInstrumentsRequest generates requests for ListInstruments

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)

func (*Client) GetRegistryInfo

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

func (*Client) ListInstruments

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

type ClientInterface

type ClientInterface interface {
	// GetRegistryInfo request
	GetRegistryInfo(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListInstruments request
	ListInstruments(ctx context.Context, params *ListInstrumentsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetInstrument request
	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 request returning *GetInstrumentResp

func (*ClientWithResponses) GetRegistryInfoWithResponse

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

GetRegistryInfoWithResponse request returning *GetRegistryInfoResp

func (*ClientWithResponses) ListInstrumentsWithResponse

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

ListInstrumentsWithResponse request returning *ListInstrumentsResp

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetRegistryInfoWithResponse request
	GetRegistryInfoWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetRegistryInfoResp, error)

	// ListInstrumentsWithResponse request
	ListInstrumentsWithResponse(ctx context.Context, params *ListInstrumentsParams, reqEditors ...RequestEditorFn) (*ListInstrumentsResp, error)

	// GetInstrumentWithResponse request
	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      *Instrument
	JSON404      *N404
	JSON500      *N500
}

func ParseGetInstrumentResp

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

ParseGetInstrumentResp parses an HTTP response from a GetInstrumentWithResponse call

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      *GetRegistryInfoResponse
	JSON404      *N404
	JSON500      *N500
}

func ParseGetRegistryInfoResp

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

ParseGetRegistryInfoResp parses an HTTP response from a GetRegistryInfoWithResponse call

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      *ListInstrumentsResponse
	JSON404      *N404
	JSON500      *N500
}

func ParseListInstrumentsResp

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

ParseListInstrumentsResp parses an HTTP response from a ListInstrumentsWithResponse call

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