novellia

package
v0.0.0-...-6e54b07 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSMiddleware

func CORSMiddleware(r *mux.Router) mux.MiddlewareFunc

func EncodeJSONResponse

func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error

EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code

func Logger

func Logger(inner http.Handler, name string) http.Handler

func NewRouter

func NewRouter(routers ...Router) *mux.Router

NewRouter creates a new router for any number of api routers

func ReadFormFileToTempFile

func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error)

ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file

func ReadFormFilesToTempFiles

func ReadFormFilesToTempFiles(r *http.Request, key string) ([]*os.File, error)

ReadFormFilesToTempFiles reads files array data from a request form and writes it to a temporary files

Types

type Attribution

type Attribution struct {

	// Name to give attribution to
	AuthorName string `json:"author_name"`

	// URLs to portfolios, websites, etc.
	Url []string `json:"url"`

	// Description of work attributed
	WorkAttributed string `json:"work_attributed"`
}

Attribution - Attribution information for artist, sculptor, whoever.

type CardanoTip

type CardanoTip struct {

	// Latest Cardano block
	Block int32 `json:"block"`

	// Latest Cardano epoch
	Epoch int32 `json:"epoch"`
}

CardanoTip - Cardano chain tip information

type CardanoTransaction

type CardanoTransaction struct {

	// text of transaction file
	Transaction string `json:"transaction"`

	// Cost to submit TX in lovelace (1 ADA = 1,000,000 lovelace)
	FeeLovelace int32 `json:"fee_lovelace"`

	// Indicates if the transaction is signed or raw
	Signed bool `json:"signed"`
}

CardanoTransaction - A Cardano transaction to be signed and submitted.

type Commission

type Commission struct {

	// Name of entity taking commissions
	Name string `json:"name"`

	// Address to deposit commissions
	Address string `json:"address"`

	// Recommended commission percentage
	Percent float32 `json:"percent,omitempty"`
}

Commission - A recommended commission for clients that will abide by it

type DefaultApiController

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

A DefaultApiController binds http requests to an api service and writes the service results to the http response

func (*DefaultApiController) GetCardanoTip

func (c *DefaultApiController) GetCardanoTip(w http.ResponseWriter, r *http.Request)

GetCardanoTip - Your GET endpoint

func (*DefaultApiController) GetProducts

func (c *DefaultApiController) GetProducts(w http.ResponseWriter, r *http.Request)

GetProducts - Your GET endpoint

func (*DefaultApiController) GetStatus

func (c *DefaultApiController) GetStatus(w http.ResponseWriter, r *http.Request)

GetStatus - Your GET endpoint

func (*DefaultApiController) GetWorkflowMinterNvla

func (c *DefaultApiController) GetWorkflowMinterNvla(w http.ResponseWriter, r *http.Request)

GetWorkflowMinterNvla -

func (*DefaultApiController) PostCardanoTransaction

func (c *DefaultApiController) PostCardanoTransaction(w http.ResponseWriter, r *http.Request)

PostCardanoTransaction -

func (*DefaultApiController) PostProducts

func (c *DefaultApiController) PostProducts(w http.ResponseWriter, r *http.Request)

PostProducts -

func (*DefaultApiController) PostTokens

func (c *DefaultApiController) PostTokens(w http.ResponseWriter, r *http.Request)

PostTokens -

func (*DefaultApiController) PostWallet

func (c *DefaultApiController) PostWallet(w http.ResponseWriter, r *http.Request)

PostWallet - POST Wallet

func (*DefaultApiController) PostWorkflowMinterNvla

func (c *DefaultApiController) PostWorkflowMinterNvla(w http.ResponseWriter, r *http.Request)

PostWorkflowMinterNvla -

func (*DefaultApiController) Routes

func (c *DefaultApiController) Routes() Routes

Routes returns all of the api route for the DefaultApiController

type DefaultApiRouter

type DefaultApiRouter interface {
	GetCardanoTip(http.ResponseWriter, *http.Request)
	GetProducts(http.ResponseWriter, *http.Request)
	GetStatus(http.ResponseWriter, *http.Request)
	GetWorkflowMinterNvla(http.ResponseWriter, *http.Request)
	PostCardanoTransaction(http.ResponseWriter, *http.Request)
	PostProducts(http.ResponseWriter, *http.Request)
	PostTokens(http.ResponseWriter, *http.Request)
	PostWallet(http.ResponseWriter, *http.Request)
	PostWorkflowMinterNvla(http.ResponseWriter, *http.Request)
}

DefaultApiRouter defines the required methods for binding the api requests to a responses for the DefaultApi The DefaultApiRouter implementation should parse necessary information from the http request, pass the data to a DefaultApiServicer to perform the required actions, then write the service results to the http response.

type DefaultApiService

type DefaultApiService struct {
}

DefaultApiService is a service that implents the logic for the DefaultApiServicer This service should implement the business logic for every endpoint for the DefaultApi API. Include any external packages or services that will be required by this service.

func (*DefaultApiService) GetCardanoTip

func (s *DefaultApiService) GetCardanoTip(ctx context.Context) (ImplResponse, error)

GetCardanoTip - Your GET endpoint

func (*DefaultApiService) GetProducts

func (s *DefaultApiService) GetProducts(ctx context.Context, marketId string, organizationId string) (ImplResponse, error)

GetProducts - Your GET endpoint

func (*DefaultApiService) GetStatus

func (s *DefaultApiService) GetStatus(ctx context.Context) (ImplResponse, error)

GetStatus - Your GET endpoint

func (*DefaultApiService) GetWorkflowMinterNvla

func (s *DefaultApiService) GetWorkflowMinterNvla(ctx context.Context) (ImplResponse, error)

GetWorkflowMinterNvla -

func (*DefaultApiService) PostCardanoTransaction

func (s *DefaultApiService) PostCardanoTransaction(ctx context.Context, cardanoTransaction CardanoTransaction) (ImplResponse, error)

PostCardanoTransaction -

func (*DefaultApiService) PostProducts

func (s *DefaultApiService) PostProducts(ctx context.Context, productsList ProductsList) (ImplResponse, error)

PostProducts -

func (*DefaultApiService) PostTokens

func (s *DefaultApiService) PostTokens(ctx context.Context, tokenSearch TokenSearch) (ImplResponse, error)

PostTokens -

func (*DefaultApiService) PostWallet

func (s *DefaultApiService) PostWallet(ctx context.Context, wallet Wallet) (ImplResponse, error)

PostWallet - POST Wallet

func (*DefaultApiService) PostWorkflowMinterNvla

func (s *DefaultApiService) PostWorkflowMinterNvla(ctx context.Context, minterInfo MinterInfo) (ImplResponse, error)

PostWorkflowMinterNvla -

type DefaultApiServicer

type DefaultApiServicer interface {
	GetCardanoTip(context.Context) (ImplResponse, error)
	GetProducts(context.Context, string, string) (ImplResponse, error)
	GetStatus(context.Context) (ImplResponse, error)
	GetWorkflowMinterNvla(context.Context) (ImplResponse, error)
	PostCardanoTransaction(context.Context, CardanoTransaction) (ImplResponse, error)
	PostProducts(context.Context, ProductsList) (ImplResponse, error)
	PostTokens(context.Context, TokenSearch) (ImplResponse, error)
	PostWallet(context.Context, Wallet) (ImplResponse, error)
	PostWorkflowMinterNvla(context.Context, MinterInfo) (ImplResponse, error)
}

DefaultApiServicer defines the api actions for the DefaultApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewDefaultApiService

func NewDefaultApiService() DefaultApiServicer

NewDefaultApiService creates a default api service

type DescriptionSet

type DescriptionSet struct {

	// A short description makes a good header
	Short string `json:"short"`

	// A long description makes a good paragraph body. Supports Markdown.
	Long string `json:"long"`
}

DescriptionSet - Set of descriptions

type Extended721File

type Extended721File struct {

	// identifier for file
	Name string `json:"name,omitempty"`

	// MIME type of file
	MediaType string `json:"mediaType,omitempty"`
}

Extended721File - See: https://github.com/cardano-foundation/CIPs/pull/85#discussion_r629120254

type Extended721Token

type Extended721Token struct {
	NativeToken NativeToken `json:"native_token,omitempty"`

	// List of extensions for parser to understand feature set. This may be empty, in which case the token is interpreted as just a 721 token.
	Extension []string `json:"extension,omitempty"`

	// Token number in a set. Redundant field which makes no sense for tokens without a total-order.
	Id int32 `json:"id"`

	// Display name for token.
	Name string `json:"name"`

	// Image URL without source redundancy.
	Image string `json:"image"`

	// List of token's asset files
	Files []Extended721File `json:"files,omitempty"`

	// MIME type of \"image\"
	MediaType string `json:"mediaType,omitempty"`

	// short token description
	Description string `json:"description,omitempty"`
}

Extended721Token - Easily parsable data for Extended 721 Token See: https://github.com/cardano-foundation/CIPs/pull/85#discussion_r629120254 for updated version

type ImplResponse

type ImplResponse struct {
	Code int
	Body interface{}
}

Implementation response defines an error code with the associated body

func Response

func Response(code int, body interface{}) ImplResponse

Response return a ImplResponse struct filled

type MinterInfo

type MinterInfo struct {

	// Wallet that pays transaction fee
	WalletAddress string `json:"wallet_address"`

	// Wallet that received minted tokens
	MinterDepositAddress string `json:"minter_deposit_address"`
}

MinterInfo - Generic information required for minter workflows.

type NativeToken

type NativeToken struct {

	// On-chain policy-id
	PolicyId string `json:"policy_id"`

	// On-chain asset-id
	AssetId string `json:"asset_id"`
}

NativeToken - Definitions required to reference a native token

type NovelliaProduct

type NovelliaProduct struct {

	// Attribution of rights to product.
	Copyright string `json:"copyright"`

	// List of publishers or entities involved in token creation. Useful for onlookers to determine token origin.
	Publisher []string `json:"publisher"`

	// Iteration in update sequence for product.
	Version int32 `json:"version"`

	// Display name for token.
	Name string `json:"name"`

	// Tags for sorting and filtering. \"nsfw\" indicates NSFW content
	Tags []string `json:"tags"`

	Commission []Commission `json:"commission,omitempty"`

	Description DescriptionSet `json:"description"`

	Resource []OffChainResource `json:"resource"`

	// Token number in a set. Redundant field which makes no sense for tokens without a total-order.
	Id int32 `json:"id,omitempty"`
}

NovelliaProduct - Product listed on Novelia without a token

type NovelliaStandardToken

type NovelliaStandardToken struct {

	// Attribution of rights.
	Copyright string `json:"copyright"`

	// List of publishers or entities involved in token creation. Useful for onlookers to determine token origin. These can be URLs.
	Publisher []string `json:"publisher"`

	// Token version. May have future use such as for clients optionally using later metadata iterations.
	Version int32 `json:"version"`

	// List of extensions for parser to understand feature set. This may be empty, in which case the token is interpreted as just a 721 token.
	Extension []string `json:"extension"`

	// Token number in a set. Redundant field which makes no sense for tokens without a total-order.
	Id int32 `json:"id"`

	// Display name for token.
	Name string `json:"name"`

	// Image URL without source redundancy.
	Image string `json:"image"`

	Description DescriptionSet `json:"description"`

	Resource []OffChainResource `json:"resource"`

	Commission []Commission `json:"commission,omitempty"`

	NativeToken NativeToken `json:"native_token"`

	// Identifies the version of the specification in use.
	NovelliaVersion int32 `json:"novellia_version"`

	// Tags for sorting and filtering. \"nsfw\" indicates NSFW content
	Tags []string `json:"tags"`
}

NovelliaStandardToken - Novellia Token Standard on-chain metadata

type OccultaNovelliaCharacter

type OccultaNovelliaCharacter struct {

	// Specification version for parsing the resource
	OccultaNovelliaVersion int32 `json:"occulta_novellia_version"`

	// Character name
	Name string `json:"name"`

	Card OccultaNovelliaCharacterCard `json:"card"`

	Progression OccultaNovelliaCharacterProgression `json:"progression"`

	Stats OccultaNovelliaCharacterStats `json:"stats"`

	// List of attribute strings relating to character abilities, faction, types, etc.
	Attributes []string `json:"attributes"`

	// Description of character
	Description string `json:"description"`
}

OccultaNovelliaCharacter - Model for an Occulta Novellia character

type OccultaNovelliaCharacterCard

type OccultaNovelliaCharacterCard struct {

	// The character number
	Number int32 `json:"number"`

	// The set this character was released in
	ReleaseSet string `json:"release_set"`

	// Rarity of card (\"Rare\", \"Kinda Not\", \"Not That Rare\")
	Rarity string `json:"rarity"`
}

OccultaNovelliaCharacterCard - Metadata relating to card / distribution

type OccultaNovelliaCharacterProgression

type OccultaNovelliaCharacterProgression struct {

	// Character progression class
	Class string `json:"class"`

	// Stage of character in class progression (1,2,3)
	Stage int32 `json:"stage"`
}

OccultaNovelliaCharacterProgression - Character leveling progression between card variants

type OccultaNovelliaCharacterStats

type OccultaNovelliaCharacterStats struct {

	// Damage sustained before dying
	Health int32 `json:"health"`

	// Multiplier for damage dealt as defined by attribute moves
	Attack int32 `json:"attack"`

	// Action points cost per unit of movement
	Move int32 `json:"move"`

	// Slots used by character when added to a squad
	Slots int32 `json:"slots"`
}

OccultaNovelliaCharacterStats - Integer stats

type OffChainResource

type OffChainResource struct {

	// Resource identifier interpreted by application. These may correspond to specific names resources a client expects.
	ResourceId string `json:"resource_id"`

	// Short text describing resource. Helpful to know what the resource should have been if the resource breaks.
	Description string `json:"description"`

	// Order to load resource. Lower numbers load first. Resources with the same name will progressively overwrite each other.
	Priority int32 `json:"priority"`

	// The multihash of the resource. In most cases, this may be identical to an IPFS hash.
	Multihash string `json:"multihash"`

	// Hint regarding file state prior to hashing (ipfs, direct)
	HashSourceType string `json:"hash_source_type"`

	// Redundant resource URLs. These should all point to the same file on different hosts.
	Url []string `json:"url"`

	// MIME type of resource.
	ContentType string `json:"content_type"`
}

OffChainResource - Off-chain resource used in Novellia Token Standard

type Product

type Product struct {
	Pricing ProductPricing `json:"pricing"`

	Organization ProductOrganization `json:"organization"`

	Market ProductMarket `json:"market"`

	Stock ProductStock `json:"stock"`

	Metadata ProductMetadata `json:"metadata"`

	Product ProductProduct `json:"product"`

	// List of entities to give attribution to for product
	Attribution []Attribution `json:"attribution,omitempty"`

	// When the product was last modified
	Modified string `json:"modified,omitempty"`
}

Product - Describes a Product served from the Novellia microservice

type ProductListElement

type ProductListElement struct {

	// Product ID
	ProductId string `json:"product_id"`

	// Last modified date of the product
	Modified string `json:"modified,omitempty"`

	// Optional token ID returned to associate with product
	NativeTokenId string `json:"native_token_id,omitempty"`
}

ProductListElement - Item in an array of product IDs and metadata

type ProductMarket

type ProductMarket struct {
	Name string `json:"name"`

	MarketId string `json:"market_id"`

	// Market description. This can be markdown.
	Description string `json:"description"`
}

type ProductMetadata

type ProductMetadata struct {
	DateListed string `json:"date_listed"`

	DateAvailable string `json:"date_available"`
}

type ProductOrganization

type ProductOrganization struct {
	Name string `json:"name"`

	OrganizationId string `json:"organization_id"`

	// Organization description. This can be markdown.
	Description string `json:"description"`
}

type ProductPricing

type ProductPricing struct {
	PriceCurrencyId string `json:"price_currency_id"`

	PriceUnitAmount float32 `json:"price_unit_amount"`

	MaxOrderSize int32 `json:"max_order_size"`
}

type ProductProduct

type ProductProduct struct {
	Extended721Token *Extended721Token `json:"extended_721_token,omitempty"`

	NovelliaStandardToken *NovelliaStandardToken `json:"novellia_standard_token,omitempty"`

	NativeToken *NativeToken `json:"native_token,omitempty"`

	NovelliaProduct *NovelliaProduct `json:"novellia_product,omitempty"`

	// Unique identifier of product
	ProductId string `json:"product_id,omitempty"`
}

ProductProduct - Immutable

type ProductStock

type ProductStock struct {
	Available float32 `json:"available"`

	TotalSupply float32 `json:"total_supply"`
}

type ProductsList

type ProductsList struct {

	// List of available products
	Products []ProductListElement `json:"products"`
}

ProductsList - Light-weight list of products for further querying

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

A Route defines the parameters for an api endpoint

type Router

type Router interface {
	Routes() Routes
}

Router defines the required methods for retrieving api routes

func NewDefaultApiController

func NewDefaultApiController(s DefaultApiServicer) Router

NewDefaultApiController creates a default api controller

type Routes

type Routes []Route

Routes are a collection of defined api endpoints

type Status

type Status struct {
	Cardano StatusCardano `json:"cardano"`

	// kill-switch to tell users that the backend is not working correctly / is under maintenance
	Maintenance bool `json:"maintenance"`

	// Status string. \"UP\" if everything is fine.
	Status string `json:"status"`

	// List of errors for bad statuses
	Errors []string `json:"errors,omitempty"`
}

Status - Status of microservice, indicating service availabilities

type StatusCardano

type StatusCardano struct {

	// whether cardano-graphql is initialized
	Initialized bool `json:"initialized"`

	// cardano-graphql sync percentage, used to gauge when APIs will be available
	SyncPercentage float32 `json:"sync_percentage"`
}

type Token

type Token struct {

	// Token asset ID registered on Cardano
	NativeTokenId string `json:"native_token_id"`

	// Amount of token held in Cardano wallet (in discrete units, i.e. lovelace)
	Amount uint64 `json:"amount,omitempty"`

	// Name or ticker as interpreted by Novellia (e.g. NVLA, ADA)
	Name string `json:"name,omitempty"`

	// Short description of token as interpreted by Novellia
	Description string `json:"description,omitempty"`

	// Onchain metadata attached to the initial mint TX
	InitialMintTxMetadata string `json:"initial_mint_tx_metadata,omitempty"`
}

Token - Generalizes the data required to describe a token in a Cardano wallet.

type TokenList

type TokenList struct {

	// List of tokens returned
	Tokens []Token `json:"tokens,omitempty"`
}

TokenList - List of token information to return

type TokenSearch

type TokenSearch struct {

	// List of asset_id, policy_id, or token name
	CardanoIdentifiers []string `json:"cardano_identifiers"`
}

type Wallet

type Wallet struct {

	// List of Cardano addresses and/or stake keys
	CardanoIdentifiers []string `json:"cardano_identifiers"`
}

Wallet - Parameters identifying a wallet

type WorkflowInformation

type WorkflowInformation struct {

	// The lovelace cost to execute the workflow
	FeeLovelace int32 `json:"fee_lovelace,omitempty"`
}

WorkflowInformation - Returns preconditions relevant to a user wanting to execute a workflow. I.e. costs.

Jump to

Keyboard shortcuts

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