aapi

package
v0.0.0-...-c8fe3c6 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 26 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithServerURL

func WithServerURL(ctx context.Context, u *url.URL) context.Context

WithServerURL sets context key to override server URL.

Types

type Balance

type Balance struct {
	Blockchain        OptString  `json:"blockchain"`
	TokenName         OptString  `json:"tokenName"`
	TokenSymbol       OptString  `json:"tokenSymbol"`
	TokenDecimals     OptFloat64 `json:"tokenDecimals"`
	TokenType         OptString  `json:"tokenType"`
	ContractAddress   OptString  `json:"contractAddress"`
	HolderAddress     OptString  `json:"holderAddress"`
	Balance           OptString  `json:"balance"`
	BalanceRawInteger OptString  `json:"balanceRawInteger"`
	BalanceUsd        OptString  `json:"balanceUsd"`
	TokenPrice        OptString  `json:"tokenPrice"`
	Thumbnail         OptString  `json:"thumbnail"`
}

Ref: #/components/schemas/Balance

func (*Balance) Decode

func (s *Balance) Decode(d *jx.Decoder) error

Decode decodes Balance from json.

func (*Balance) Encode

func (s *Balance) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Balance) GetBalance

func (s *Balance) GetBalance() OptString

GetBalance returns the value of Balance.

func (*Balance) GetBalanceRawInteger

func (s *Balance) GetBalanceRawInteger() OptString

GetBalanceRawInteger returns the value of BalanceRawInteger.

func (*Balance) GetBalanceUsd

func (s *Balance) GetBalanceUsd() OptString

GetBalanceUsd returns the value of BalanceUsd.

func (*Balance) GetBlockchain

func (s *Balance) GetBlockchain() OptString

GetBlockchain returns the value of Blockchain.

func (*Balance) GetContractAddress

func (s *Balance) GetContractAddress() OptString

GetContractAddress returns the value of ContractAddress.

func (*Balance) GetHolderAddress

func (s *Balance) GetHolderAddress() OptString

GetHolderAddress returns the value of HolderAddress.

func (*Balance) GetThumbnail

func (s *Balance) GetThumbnail() OptString

GetThumbnail returns the value of Thumbnail.

func (*Balance) GetTokenDecimals

func (s *Balance) GetTokenDecimals() OptFloat64

GetTokenDecimals returns the value of TokenDecimals.

func (*Balance) GetTokenName

func (s *Balance) GetTokenName() OptString

GetTokenName returns the value of TokenName.

func (*Balance) GetTokenPrice

func (s *Balance) GetTokenPrice() OptString

GetTokenPrice returns the value of TokenPrice.

func (*Balance) GetTokenSymbol

func (s *Balance) GetTokenSymbol() OptString

GetTokenSymbol returns the value of TokenSymbol.

func (*Balance) GetTokenType

func (s *Balance) GetTokenType() OptString

GetTokenType returns the value of TokenType.

func (*Balance) MarshalJSON

func (s *Balance) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Balance) SetBalance

func (s *Balance) SetBalance(val OptString)

SetBalance sets the value of Balance.

func (*Balance) SetBalanceRawInteger

func (s *Balance) SetBalanceRawInteger(val OptString)

SetBalanceRawInteger sets the value of BalanceRawInteger.

func (*Balance) SetBalanceUsd

func (s *Balance) SetBalanceUsd(val OptString)

SetBalanceUsd sets the value of BalanceUsd.

func (*Balance) SetBlockchain

func (s *Balance) SetBlockchain(val OptString)

SetBlockchain sets the value of Blockchain.

func (*Balance) SetContractAddress

func (s *Balance) SetContractAddress(val OptString)

SetContractAddress sets the value of ContractAddress.

func (*Balance) SetHolderAddress

func (s *Balance) SetHolderAddress(val OptString)

SetHolderAddress sets the value of HolderAddress.

func (*Balance) SetThumbnail

func (s *Balance) SetThumbnail(val OptString)

SetThumbnail sets the value of Thumbnail.

func (*Balance) SetTokenDecimals

func (s *Balance) SetTokenDecimals(val OptFloat64)

SetTokenDecimals sets the value of TokenDecimals.

func (*Balance) SetTokenName

func (s *Balance) SetTokenName(val OptString)

SetTokenName sets the value of TokenName.

func (*Balance) SetTokenPrice

func (s *Balance) SetTokenPrice(val OptString)

SetTokenPrice sets the value of TokenPrice.

func (*Balance) SetTokenSymbol

func (s *Balance) SetTokenSymbol(val OptString)

SetTokenSymbol sets the value of TokenSymbol.

func (*Balance) SetTokenType

func (s *Balance) SetTokenType(val OptString)

SetTokenType sets the value of TokenType.

func (*Balance) UnmarshalJSON

func (s *Balance) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Balance) Validate

func (s *Balance) Validate() error

type BalancesReply

type BalancesReply struct {
	NextPageToken   OptString  `json:"nextPageToken"`
	TotalBalanceUsd OptString  `json:"totalBalanceUsd"`
	TotalCount      OptFloat64 `json:"totalCount"`
	Assets          []Balance  `json:"assets"`
	BlockHeight     OptFloat64 `json:"blockHeight"`
}

Ref: #/components/schemas/BalancesReply

func (*BalancesReply) Decode

func (s *BalancesReply) Decode(d *jx.Decoder) error

Decode decodes BalancesReply from json.

func (*BalancesReply) Encode

func (s *BalancesReply) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*BalancesReply) GetAssets

func (s *BalancesReply) GetAssets() []Balance

GetAssets returns the value of Assets.

func (*BalancesReply) GetBlockHeight

func (s *BalancesReply) GetBlockHeight() OptFloat64

GetBlockHeight returns the value of BlockHeight.

func (*BalancesReply) GetNextPageToken

func (s *BalancesReply) GetNextPageToken() OptString

GetNextPageToken returns the value of NextPageToken.

func (*BalancesReply) GetTotalBalanceUsd

func (s *BalancesReply) GetTotalBalanceUsd() OptString

GetTotalBalanceUsd returns the value of TotalBalanceUsd.

func (*BalancesReply) GetTotalCount

func (s *BalancesReply) GetTotalCount() OptFloat64

GetTotalCount returns the value of TotalCount.

func (*BalancesReply) MarshalJSON

func (s *BalancesReply) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*BalancesReply) SetAssets

func (s *BalancesReply) SetAssets(val []Balance)

SetAssets sets the value of Assets.

func (*BalancesReply) SetBlockHeight

func (s *BalancesReply) SetBlockHeight(val OptFloat64)

SetBlockHeight sets the value of BlockHeight.

func (*BalancesReply) SetNextPageToken

func (s *BalancesReply) SetNextPageToken(val OptString)

SetNextPageToken sets the value of NextPageToken.

func (*BalancesReply) SetTotalBalanceUsd

func (s *BalancesReply) SetTotalBalanceUsd(val OptString)

SetTotalBalanceUsd sets the value of TotalBalanceUsd.

func (*BalancesReply) SetTotalCount

func (s *BalancesReply) SetTotalCount(val OptFloat64)

SetTotalCount sets the value of TotalCount.

func (*BalancesReply) UnmarshalJSON

func (s *BalancesReply) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*BalancesReply) Validate

func (s *BalancesReply) Validate() error

type BalancesRequest

type BalancesRequest struct {
	WalletAddress   string     `json:"walletAddress"`
	Blockchain      []string   `json:"blockchain"`
	BlockHeight     OptFloat64 `json:"blockHeight"`
	OnlyWhitelisted OptBool    `json:"onlyWhitelisted"`
	NativeFirst     OptBool    `json:"nativeFirst"`
	PageSize        OptString  `json:"pageSize"`
	PageToken       OptString  `json:"pageToken"`
}

Ref: #/components/schemas/BalancesRequest

func (*BalancesRequest) Decode

func (s *BalancesRequest) Decode(d *jx.Decoder) error

Decode decodes BalancesRequest from json.

func (*BalancesRequest) Encode

func (s *BalancesRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*BalancesRequest) GetBlockHeight

func (s *BalancesRequest) GetBlockHeight() OptFloat64

GetBlockHeight returns the value of BlockHeight.

func (*BalancesRequest) GetBlockchain

func (s *BalancesRequest) GetBlockchain() []string

GetBlockchain returns the value of Blockchain.

func (*BalancesRequest) GetNativeFirst

func (s *BalancesRequest) GetNativeFirst() OptBool

GetNativeFirst returns the value of NativeFirst.

func (*BalancesRequest) GetOnlyWhitelisted

func (s *BalancesRequest) GetOnlyWhitelisted() OptBool

GetOnlyWhitelisted returns the value of OnlyWhitelisted.

func (*BalancesRequest) GetPageSize

func (s *BalancesRequest) GetPageSize() OptString

GetPageSize returns the value of PageSize.

func (*BalancesRequest) GetPageToken

func (s *BalancesRequest) GetPageToken() OptString

GetPageToken returns the value of PageToken.

func (*BalancesRequest) GetWalletAddress

func (s *BalancesRequest) GetWalletAddress() string

GetWalletAddress returns the value of WalletAddress.

func (*BalancesRequest) MarshalJSON

func (s *BalancesRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*BalancesRequest) SetBlockHeight

func (s *BalancesRequest) SetBlockHeight(val OptFloat64)

SetBlockHeight sets the value of BlockHeight.

func (*BalancesRequest) SetBlockchain

func (s *BalancesRequest) SetBlockchain(val []string)

SetBlockchain sets the value of Blockchain.

func (*BalancesRequest) SetNativeFirst

func (s *BalancesRequest) SetNativeFirst(val OptBool)

SetNativeFirst sets the value of NativeFirst.

func (*BalancesRequest) SetOnlyWhitelisted

func (s *BalancesRequest) SetOnlyWhitelisted(val OptBool)

SetOnlyWhitelisted sets the value of OnlyWhitelisted.

func (*BalancesRequest) SetPageSize

func (s *BalancesRequest) SetPageSize(val OptString)

SetPageSize sets the value of PageSize.

func (*BalancesRequest) SetPageToken

func (s *BalancesRequest) SetPageToken(val OptString)

SetPageToken sets the value of PageToken.

func (*BalancesRequest) SetWalletAddress

func (s *BalancesRequest) SetWalletAddress(val string)

SetWalletAddress sets the value of WalletAddress.

func (*BalancesRequest) UnmarshalJSON

func (s *BalancesRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*BalancesRequest) Validate

func (s *BalancesRequest) Validate() error

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements OAS client.

func NewClient

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

NewClient initializes new Client defined by OAS.

func (*Client) GetAccountBalance

func (c *Client) GetAccountBalance(ctx context.Context, request *BalancesRequest) (*BalancesReply, error)

GetAccountBalance invokes getAccountBalance operation.

Returns geven address balance in all requested chains.

POST /accountBalance

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is client config option.

func WithClient

func WithClient(client ht.Client) ClientOption

WithClient specifies http client to use.

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type Handler

type Handler interface {
	// GetAccountBalance implements getAccountBalance operation.
	//
	// Returns geven address balance in all requested chains.
	//
	// POST /accountBalance
	GetAccountBalance(ctx context.Context, req *BalancesRequest) (*BalancesReply, error)
}

Handler handles operations described by OpenAPI v3 specification.

type Invoker

type Invoker interface {
	// GetAccountBalance invokes getAccountBalance operation.
	//
	// Returns geven address balance in all requested chains.
	//
	// POST /accountBalance
	GetAccountBalance(ctx context.Context, request *BalancesRequest) (*BalancesReply, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type OptBool

type OptBool struct {
	Value bool
	Set   bool
}

OptBool is optional bool.

func NewOptBool

func NewOptBool(v bool) OptBool

NewOptBool returns new OptBool with value set to v.

func (*OptBool) Decode

func (o *OptBool) Decode(d *jx.Decoder) error

Decode decodes bool from json.

func (OptBool) Encode

func (o OptBool) Encode(e *jx.Encoder)

Encode encodes bool as json.

func (OptBool) Get

func (o OptBool) Get() (v bool, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptBool) IsSet

func (o OptBool) IsSet() bool

IsSet returns true if OptBool was set.

func (OptBool) MarshalJSON

func (s OptBool) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptBool) Or

func (o OptBool) Or(d bool) bool

Or returns value if set, or given parameter if does not.

func (*OptBool) Reset

func (o *OptBool) Reset()

Reset unsets value.

func (*OptBool) SetTo

func (o *OptBool) SetTo(v bool)

SetTo sets value to v.

func (*OptBool) UnmarshalJSON

func (s *OptBool) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptFloat64

type OptFloat64 struct {
	Value float64
	Set   bool
}

OptFloat64 is optional float64.

func NewOptFloat64

func NewOptFloat64(v float64) OptFloat64

NewOptFloat64 returns new OptFloat64 with value set to v.

func (*OptFloat64) Decode

func (o *OptFloat64) Decode(d *jx.Decoder) error

Decode decodes float64 from json.

func (OptFloat64) Encode

func (o OptFloat64) Encode(e *jx.Encoder)

Encode encodes float64 as json.

func (OptFloat64) Get

func (o OptFloat64) Get() (v float64, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptFloat64) IsSet

func (o OptFloat64) IsSet() bool

IsSet returns true if OptFloat64 was set.

func (OptFloat64) MarshalJSON

func (s OptFloat64) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptFloat64) Or

func (o OptFloat64) Or(d float64) float64

Or returns value if set, or given parameter if does not.

func (*OptFloat64) Reset

func (o *OptFloat64) Reset()

Reset unsets value.

func (*OptFloat64) SetTo

func (o *OptFloat64) SetTo(v float64)

SetTo sets value to v.

func (*OptFloat64) UnmarshalJSON

func (s *OptFloat64) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptString

type OptString struct {
	Value string
	Set   bool
}

OptString is optional string.

func NewOptString

func NewOptString(v string) OptString

NewOptString returns new OptString with value set to v.

func (*OptString) Decode

func (o *OptString) Decode(d *jx.Decoder) error

Decode decodes string from json.

func (OptString) Encode

func (o OptString) Encode(e *jx.Encoder)

Encode encodes string as json.

func (OptString) Get

func (o OptString) Get() (v string, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptString) IsSet

func (o OptString) IsSet() bool

IsSet returns true if OptString was set.

func (OptString) MarshalJSON

func (s OptString) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptString) Or

func (o OptString) Or(d string) string

Or returns value if set, or given parameter if does not.

func (*OptString) Reset

func (o *OptString) Reset()

Reset unsets value.

func (*OptString) SetTo

func (o *OptString) SetTo(v string)

SetTo sets value to v.

func (*OptString) UnmarshalJSON

func (s *OptString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Option

type Option interface {
	ServerOption
	ClientOption
}

Option is config option.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for creating a meter.

If none is specified, the otel.GetMeterProvider() is used.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer.

If none is specified, the global provider is used.

type Route

type Route struct {
	// contains filtered or unexported fields
}

Route is route object.

func (Route) Args

func (r Route) Args() []string

Args returns parsed arguments.

func (Route) Name

func (r Route) Name() string

Name returns ogen operation name.

It is guaranteed to be unique and not empty.

func (Route) OperationID

func (r Route) OperationID() string

OperationID returns OpenAPI operationId.

func (Route) PathPattern

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

func (Route) Summary

func (r Route) Summary() string

Summary returns OpenAPI summary.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements http server based on OpenAPI v3 specification and calls Handler to handle requests.

func NewServer

func NewServer(h Handler, opts ...ServerOption) (*Server, error)

NewServer creates new Server.

func (*Server) FindPath

func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool)

FindPath finds Route for given method and URL.

func (*Server) FindRoute

func (s *Server) FindRoute(method, path string) (Route, bool)

FindRoute finds Route for given method and path.

Note: this method does not unescape path or handle reserved characters in path properly. Use FindPath instead.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http request as defined by OpenAPI v3 specification, calling handler that matches the path or returning not found error.

type ServerOption

type ServerOption interface {
	// contains filtered or unexported methods
}

ServerOption is server config option.

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) ServerOption

WithErrorHandler specifies error handler to use.

func WithMaxMultipartMemory

func WithMaxMultipartMemory(max int64) ServerOption

WithMaxMultipartMemory specifies limit of memory for storing file parts. File parts which can't be stored in memory will be stored on disk in temporary files.

func WithMethodNotAllowed

func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption

WithMethodNotAllowed specifies Method Not Allowed handler to use.

func WithMiddleware

func WithMiddleware(m ...Middleware) ServerOption

WithMiddleware specifies middlewares to use.

func WithNotFound

func WithNotFound(notFound http.HandlerFunc) ServerOption

WithNotFound specifies Not Found handler to use.

func WithPathPrefix

func WithPathPrefix(prefix string) ServerOption

WithPathPrefix specifies server path prefix.

type UnimplementedHandler

type UnimplementedHandler struct{}

UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.

func (UnimplementedHandler) GetAccountBalance

func (UnimplementedHandler) GetAccountBalance(ctx context.Context, req *BalancesRequest) (r *BalancesReply, _ error)

GetAccountBalance implements getAccountBalance operation.

Returns geven address balance in all requested chains.

POST /accountBalance

Jump to

Keyboard shortcuts

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