resources

package
v0.0.0-...-ad1f59c Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Details

type Details json.RawMessage

func (Details) MarshalJSON

func (d Details) MarshalJSON() ([]byte, error)

MarshalJSON - casts Details to []byte

func (*Details) Scan

func (r *Details) Scan(src interface{}) error

Scan - implements db driver method for auto unmarshal

func (Details) String

func (d Details) String() string

func (*Details) UnmarshalJSON

func (d *Details) UnmarshalJSON(data []byte) error

UnmarshalJSON - casts data to Details

func (Details) Value

func (r Details) Value() (driver.Value, error)

Value - implements db driver method for auto marshal

type Flag

type Flag struct {
	Name  string `json:"name"`
	Value int32  `json:"value"`
}

type Flagger

type Flagger interface {
	IsFlag() bool
}

type Flags

type Flags struct {
	Mask   int32  `json:"mask"`
	Values []Flag `json:"flags"`
}

func FlagsFromMask

func FlagsFromMask(mask int32, allFlags map[int32]string) Flags

type Included

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

Included - an array of Resource objects that are related to the primary data and/or each other (“included resources”).

func (*Included) Add

func (c *Included) Add(includes ...Resource)

Add - adds new include into collection. If one already present - skips it

func (Included) MarshalJSON

func (c Included) MarshalJSON() ([]byte, error)

MarshalJSON - marshals include collection as array of json objects

func (*Included) MustNftPrice

func (c *Included) MustNftPrice(key Key) *NftPrice

MustNftPrice - returns NftPrice from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustPlatform

func (c *Included) MustPlatform(key Key) *Platform

MustPlatform - returns Platform from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustPrice

func (c *Included) MustPrice(key Key) *Price

MustPrice - returns Price from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) UnmarshalJSON

func (c *Included) UnmarshalJSON(data []byte) error

UmarshalJSON - unmarshal array of json objects into include collection

type Key

type Key struct {
	ID   string       `json:"id"`
	Type ResourceType `json:"type"`
}

func NewKeyInt64

func NewKeyInt64(id int64, resourceType ResourceType) Key

func (Key) AsRelation

func (r Key) AsRelation() *Relation

func (*Key) GetKey

func (r *Key) GetKey() Key

func (Key) GetKeyP

func (r Key) GetKeyP() *Key
type Links struct {
	First string `json:"first"`
	Last  string `json:"last"`
	Next  string `json:"next"`
	Prev  string `json:"prev"`
	Self  string `json:"self"`
}

type NftPrice

type NftPrice struct {
	Key
	Attributes NftPriceAttributes `json:"attributes"`
}

type NftPriceAttributes

type NftPriceAttributes struct {
	// price of NFT in native currency
	NativeCurrency float32 `json:"native_currency"`
	// price of NFT in $
	Usd float32 `json:"usd"`
}

type NftPriceListResponse

type NftPriceListResponse struct {
	Data     []NftPrice `json:"data"`
	Included Included   `json:"included"`
	Links    *Links     `json:"links"`
}

type NftPriceResponse

type NftPriceResponse struct {
	Data     NftPrice `json:"data"`
	Included Included `json:"included"`
}

type OffsetPageParams

type OffsetPageParams struct {
	Limit      uint64 `page:"limit" default:"15"`
	PageNumber uint64 `page:"number"`
}

type Platform

type Platform struct {
	Key
	Attributes PlatformAttributes `json:"attributes"`
}

type PlatformAttributes

type PlatformAttributes struct {
	// network chain id
	ChainIdentifier int32 `json:"chain_identifier"`
	// platform name
	Name string `json:"name"`
	// platform shortname
	Shortname string `json:"shortname"`
}

type PlatformListResponse

type PlatformListResponse struct {
	Data     []Platform `json:"data"`
	Included Included   `json:"included"`
	Links    *Links     `json:"links"`
}

type PlatformResponse

type PlatformResponse struct {
	Data     Platform `json:"data"`
	Included Included `json:"included"`
}

type Price

type Price struct {
	Key
	Attributes PriceAttributes `json:"attributes"`
}

type PriceAttributes

type PriceAttributes struct {
	// price in $
	Price string `json:"price"`
	// Token metadata information
	Token Token `json:"token"`
}

type PriceListResponse

type PriceListResponse struct {
	Data     []Price  `json:"data"`
	Included Included `json:"included"`
	Links    *Links   `json:"links"`
}

type PriceResponse

type PriceResponse struct {
	Data     Price    `json:"data"`
	Included Included `json:"included"`
}

type Relation

type Relation struct {
	Data  *Key   `json:"data,omitempty"`
	Links *Links `json:"links,omitempty"`
}

type RelationCollection

type RelationCollection struct {
	Data  []Key  `json:"data"`
	Links *Links `json:"links,omitempty"`
}

func (RelationCollection) MarshalJSON

func (r RelationCollection) MarshalJSON() ([]byte, error)

type Resource

type Resource interface {
	//GetKey - returns key of the Resource
	GetKey() Key
}

type ResourceType

type ResourceType string
const (
	NFT_PRICE ResourceType = "nft-price"
	PLATFORMS ResourceType = "platforms"
	PRICES    ResourceType = "prices"
)

List of ResourceType

type Token

type Token struct {
	// Token's decimals
	Decimals int32 `json:"decimals"`
	// Token's name
	Name string `json:"name"`
	// Token's symbol
	Symbol string `json:"symbol"`
}

Jump to

Keyboard shortcuts

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