From 4c177aec64dfb5f52e3870da3b2ca9ec25230c1c Mon Sep 17 00:00:00 2001 From: david-littlefarmer Date: Mon, 4 Mar 2024 16:08:07 +0100 Subject: [PATCH] metadata go client --- metadata/metadata.gen.go | 434 +++++++++++++++++++++++++++++++++++---- 1 file changed, 399 insertions(+), 35 deletions(-) diff --git a/metadata/metadata.gen.go b/metadata/metadata.gen.go index ff0c9e0d..1baebc54 100644 --- a/metadata/metadata.gen.go +++ b/metadata/metadata.gen.go @@ -1,8 +1,8 @@ -// sequence-metadata v0.4.0 4abf3a2d23aa0f4c036e7392ac23919dc611f1c3 +// sequence-metadata v0.4.0 1672b357567e66d10c8d9392638f9089c26a3082 // -- // Code generated by webrpc-gen@v0.14.0-dev with golang@v0.10.0 generator. DO NOT EDIT. // -// webrpc-gen -schema=metadata.ridl -target=golang@v0.10.0 -pkg=metadata -client -out=./clients/metadata.gen.go +// webrpc-gen -schema=./proto/metadata.ridl -target=golang@v0.10.0 -pkg=metadata -client -out=../../go-sequence/metadata/metadata.gen.go package metadata import ( @@ -32,7 +32,7 @@ func WebRPCSchemaVersion() string { // Schema hash generated from your RIDL schema func WebRPCSchemaHash() string { - return "4abf3a2d23aa0f4c036e7392ac23919dc611f1c3" + return "1672b357567e66d10c8d9392638f9089c26a3082" } // @@ -274,6 +274,7 @@ type RuntimeChecks struct { } type ContractIndex struct { + CollectionId *uint64 `json:"collectionId,omitempty" db:"collection_id"` ChainID uint64 `json:"chainId" db:"chain_id"` Address prototyp.Hash `json:"address" db:"contract_address"` Type ContractType `json:"type" db:"type"` @@ -331,16 +332,17 @@ type TokenMetadata struct { Name string `json:"name" cbor:"-"` Description string `json:"description" cbor:"-"` Image string `json:"image" cbor:"-"` - Decimals uint64 `json:"decimals" cbor:"-"` + Decimals uint64 `json:"decimals,omitempty" cbor:"-"` Properties map[string]interface{} `json:"properties" cbor:"-"` Video string `json:"video,omitempty" cbor:"-"` Audio string `json:"audio,omitempty" cbor:"-"` + UpdatedAt time.Time `json:"updatedAt" cbor:"-"` ImageData string `json:"image_data,omitempty" cbor:"-"` ExternalUrl string `json:"external_url,omitempty" cbor:"-"` BackgroundColor string `json:"background_color,omitempty" cbor:"-"` AnimationUrl string `json:"animation_url,omitempty" cbor:"-"` Attributes []map[string]interface{} `json:"attributes" cbor:"-"` - UpdatedAt time.Time `json:"updatedAt" cbor:"-"` + Assets []*Asset `json:"assets,omitempty" cbor:"-"` } type PropertyFilter struct { @@ -356,6 +358,49 @@ type Filter struct { Properties []*PropertyFilter `json:"properties"` } +type Collection struct { + ID uint64 `json:"id,omitempty" db:"id,omitempty"` + ProjectID uint64 `json:"project_id,omitempty" db:"project_id"` + Name string `json:"name,omitempty" db:"name"` + Description string `json:"description,omitempty" db:"description"` + TitleImageUrl string `json:"title_image_url,omitempty" db:"title_image_url"` + ExternalLink string `json:"external_link,omitempty" db:"external_link"` + Private bool `json:"private,omitempty" db:"private"` + RevealKey string `json:"reveal_key,omitempty" db:"reveal_key"` + CreatedAt time.Time `json:"created_at,omitempty" db:"created_at"` + UpdatedAt time.Time `json:"updated_at,omitempty" db:"updated_at"` + DeletedAt *time.Time `json:"deleted_at,omitempty" db:"deleted_at"` + BaseURIs *CollectionBaseURIs `json:"baseURIs,omitempty" db:"-"` +} + +type CollectionBaseURIs struct { + ContractMetadataURI string `json:"contractMetadataURI"` + TokenMetadataURI string `json:"tokenMetadataURI"` +} + +type Asset struct { + ID uint64 `json:"id" db:"id,omitempty"` + CollectionID uint64 `json:"collectionId" db:"collection_id"` + TokenID prototyp.BigInt `json:"tokenId" db:"token_id"` + MetadataField string `json:"metadataField,omitempty" db:"metadata_field"` + Filename string `json:"filename,omitempty" db:"filename"` + Filesize uint32 `json:"filesize,omitempty" db:"filesize"` + MimeType string `json:"mimeType,omitempty" db:"mime_type"` + Width *uint16 `json:"width,omitempty" db:"width"` + Height *uint16 `json:"height,omitempty" db:"height"` + UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` + PublicUrl string `json:"publicUrl,omitempty"` +} + +type Token struct { + CollectionID uint64 `json:"collectionId" db:"collection_id"` + TokenID prototyp.BigInt `json:"tokenId" db:"token_id"` + TokenMetadata *TokenMetadata `json:"tokenMetadata" db:"metadata"` + Private bool `json:"private" db:"private"` + SearchColumn string `json:"-" db:"search_col"` + UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` +} + type GetNiftyswapUnitPricesRequest struct { SwapType *SwapType `json:"swapType"` Ids []prototyp.BigInt `json:"ids"` @@ -401,6 +446,7 @@ type Metadata interface { Version(ctx context.Context) (*Version, error) RuntimeStatus(ctx context.Context) (*RuntimeStatus, error) GetTokenMetadata(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) ([]*TokenMetadata, error) + RefreshTokenMetadata(ctx context.Context, chainID string, contractAddress string, tokenIDs []string, refreshAll *bool) (uint64, error) EnqueueTokensForRefresh(ctx context.Context, chainID string, contractAddress string, tokenIDs []string, refreshAll *bool) (uint64, error) GetTokenRefreshStatus(ctx context.Context, taskId uint64) (*TaskStatus, error) GetTokenRefreshResult(ctx context.Context, taskId uint64) (*TaskStatus, map[string]bool, map[string]string, error) @@ -414,7 +460,6 @@ type Metadata interface { SearchContractInfo(ctx context.Context, contractAddress string) ([]*ContractInfo, error) SearchContractInfoBatch(ctx context.Context, contractAddresses []string) (map[string][]*ContractInfo, error) SearchMetadata(ctx context.Context, filter string, chainID *string, types []*ContractType, excludeTokenMetadata *bool) ([]*TokenMetadata, []*ContractInfo, error) - ProjectSetTokenMetadata(ctx context.Context, projectID *uint64, chainID string, tokenMetadata *TokenMetadata) (bool, error) GetNiftyswapTokenQuantity(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) (map[string]string, error) GetNiftyswapUnitPrices(ctx context.Context, chainID string, contractAddress string, req *GetNiftyswapUnitPricesRequest, fresh bool) (map[string]string, error) GetNiftyswapUnitPricesWithQuantities(ctx context.Context, chainID string, contractAddress string, req *GetNiftyswapUnitPricesRequest, fresh bool) (map[string]*GetNiftyswapUnitPricesResponse, error) @@ -424,12 +469,34 @@ type Metadata interface { MintMonitorTriggerJob(ctx context.Context, chainID string, contractAddress string) (bool, error) } +type Collections interface { + CreateCollection(ctx context.Context, projectId *uint64, collection *Collection) (*Collection, error) + GetCollection(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) + ListCollections(ctx context.Context, projectId *uint64, page *Page) (*Page, []*Collection, error) + UpdateCollection(ctx context.Context, projectId *uint64, collection *Collection) (*Collection, error) + DeleteCollection(ctx context.Context, projectId *uint64, collectionId uint64) (bool, error) + PublishCollection(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) + UnpublishCollection(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) + PublishCollectionTokens(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) + UnpublishCollectionTokens(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) + CreateAsset(ctx context.Context, projectId *uint64, asset *Asset) (*Asset, error) + GetAsset(ctx context.Context, projectId *uint64, assetId uint64) (*Asset, error) + UpdateAsset(ctx context.Context, projectId *uint64, asset *Asset) (*Asset, error) + DeleteAsset(ctx context.Context, projectId *uint64, assetId uint64) (bool, error) + CreateToken(ctx context.Context, projectId *uint64, collectionId uint64, token *TokenMetadata) (*TokenMetadata, []*Asset, error) + GetToken(ctx context.Context, projectId *uint64, collectionId uint64, tokenId string) (*TokenMetadata, []*Asset, error) + ListTokens(ctx context.Context, projectId *uint64, collectionId uint64, page *Page) (*Page, []*TokenMetadata, error) + UpdateToken(ctx context.Context, projectId *uint64, collectionId uint64, token *TokenMetadata) (*TokenMetadata, error) + DeleteToken(ctx context.Context, projectId *uint64, collectionId uint64, tokenId string) (bool, error) +} + var WebRPCServices = map[string][]string{ "Metadata": { "Ping", "Version", "RuntimeStatus", "GetTokenMetadata", + "RefreshTokenMetadata", "EnqueueTokensForRefresh", "GetTokenRefreshStatus", "GetTokenRefreshResult", @@ -443,7 +510,6 @@ var WebRPCServices = map[string][]string{ "SearchContractInfo", "SearchContractInfoBatch", "SearchMetadata", - "ProjectSetTokenMetadata", "GetNiftyswapTokenQuantity", "GetNiftyswapUnitPrices", "GetNiftyswapUnitPricesWithQuantities", @@ -452,6 +518,26 @@ var WebRPCServices = map[string][]string{ "MintMonitorJobStatus", "MintMonitorTriggerJob", }, + "Collections": { + "CreateCollection", + "GetCollection", + "ListCollections", + "UpdateCollection", + "DeleteCollection", + "PublishCollection", + "UnpublishCollection", + "PublishCollectionTokens", + "UnpublishCollectionTokens", + "CreateAsset", + "GetAsset", + "UpdateAsset", + "DeleteAsset", + "CreateToken", + "GetToken", + "ListTokens", + "UpdateToken", + "DeleteToken", + }, } // @@ -459,6 +545,7 @@ var WebRPCServices = map[string][]string{ // const MetadataPathPrefix = "/rpc/Metadata/" +const CollectionsPathPrefix = "/rpc/Collections/" type metadataClient struct { client HTTPClient @@ -472,6 +559,7 @@ func NewMetadataClient(addr string, client HTTPClient) Metadata { prefix + "Version", prefix + "RuntimeStatus", prefix + "GetTokenMetadata", + prefix + "RefreshTokenMetadata", prefix + "EnqueueTokensForRefresh", prefix + "GetTokenRefreshStatus", prefix + "GetTokenRefreshResult", @@ -485,7 +573,6 @@ func NewMetadataClient(addr string, client HTTPClient) Metadata { prefix + "SearchContractInfo", prefix + "SearchContractInfoBatch", prefix + "SearchMetadata", - prefix + "ProjectSetTokenMetadata", prefix + "GetNiftyswapTokenQuantity", prefix + "GetNiftyswapUnitPrices", prefix + "GetNiftyswapUnitPricesWithQuantities", @@ -541,7 +628,7 @@ func (c *metadataClient) GetTokenMetadata(ctx context.Context, chainID string, c return out.Ret0, err } -func (c *metadataClient) EnqueueTokensForRefresh(ctx context.Context, chainID string, contractAddress string, tokenIDs []string, refreshAll *bool) (uint64, error) { +func (c *metadataClient) RefreshTokenMetadata(ctx context.Context, chainID string, contractAddress string, tokenIDs []string, refreshAll *bool) (uint64, error) { in := struct { Arg0 string `json:"chainID"` Arg1 string `json:"contractAddress"` @@ -556,6 +643,21 @@ func (c *metadataClient) EnqueueTokensForRefresh(ctx context.Context, chainID st return out.Ret0, err } +func (c *metadataClient) EnqueueTokensForRefresh(ctx context.Context, chainID string, contractAddress string, tokenIDs []string, refreshAll *bool) (uint64, error) { + in := struct { + Arg0 string `json:"chainID"` + Arg1 string `json:"contractAddress"` + Arg2 []string `json:"tokenIDs"` + Arg3 *bool `json:"refreshAll"` + }{chainID, contractAddress, tokenIDs, refreshAll} + out := struct { + Ret0 uint64 `json:"taskId"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[5], in, &out) + return out.Ret0, err +} + func (c *metadataClient) GetTokenRefreshStatus(ctx context.Context, taskId uint64) (*TaskStatus, error) { in := struct { Arg0 uint64 `json:"taskId"` @@ -564,7 +666,7 @@ func (c *metadataClient) GetTokenRefreshStatus(ctx context.Context, taskId uint6 Ret0 *TaskStatus `json:"status"` }{} - err := doJSONRequest(ctx, c.client, c.urls[5], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[6], in, &out) return out.Ret0, err } @@ -578,7 +680,7 @@ func (c *metadataClient) GetTokenRefreshResult(ctx context.Context, taskId uint6 Ret2 map[string]string `json:"failureReasons"` }{} - err := doJSONRequest(ctx, c.client, c.urls[6], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[7], in, &out) return out.Ret0, out.Ret1, out.Ret2, err } @@ -590,7 +692,7 @@ func (c *metadataClient) CancelRefreshJob(ctx context.Context, taskId uint64) (b Ret0 bool `json:"ok"` }{} - err := doJSONRequest(ctx, c.client, c.urls[7], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[8], in, &out) return out.Ret0, err } @@ -603,7 +705,7 @@ func (c *metadataClient) GetTokenMetadataBatch(ctx context.Context, chainID stri Ret0 map[string][]*TokenMetadata `json:"contractTokenMetadata"` }{} - err := doJSONRequest(ctx, c.client, c.urls[8], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[9], in, &out) return out.Ret0, err } @@ -619,7 +721,7 @@ func (c *metadataClient) SearchTokenMetadata(ctx context.Context, chainID string Ret1 []*TokenMetadata `json:"tokenMetadata"` }{} - err := doJSONRequest(ctx, c.client, c.urls[9], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[10], in, &out) return out.Ret0, out.Ret1, err } @@ -635,7 +737,7 @@ func (c *metadataClient) SearchTokenIDs(ctx context.Context, chainID string, con Ret1 []string `json:"tokenIds"` }{} - err := doJSONRequest(ctx, c.client, c.urls[10], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[11], in, &out) return out.Ret0, out.Ret1, err } @@ -648,7 +750,7 @@ func (c *metadataClient) TokenCollectionFilters(ctx context.Context, chainID str Ret0 []*PropertyFilter `json:"filters"` }{} - err := doJSONRequest(ctx, c.client, c.urls[11], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[12], in, &out) return out.Ret0, err } @@ -661,7 +763,7 @@ func (c *metadataClient) GetContractInfo(ctx context.Context, chainID string, co Ret0 *ContractInfo `json:"contractInfo"` }{} - err := doJSONRequest(ctx, c.client, c.urls[12], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[13], in, &out) return out.Ret0, err } @@ -674,7 +776,7 @@ func (c *metadataClient) GetContractInfoBatch(ctx context.Context, chainID strin Ret0 map[string]*ContractInfo `json:"contractInfoMap"` }{} - err := doJSONRequest(ctx, c.client, c.urls[13], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[14], in, &out) return out.Ret0, err } @@ -686,7 +788,7 @@ func (c *metadataClient) SearchContractInfo(ctx context.Context, contractAddress Ret0 []*ContractInfo `json:"contractInfoList"` }{} - err := doJSONRequest(ctx, c.client, c.urls[14], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[15], in, &out) return out.Ret0, err } @@ -698,7 +800,7 @@ func (c *metadataClient) SearchContractInfoBatch(ctx context.Context, contractAd Ret0 map[string][]*ContractInfo `json:"contractInfoByChain"` }{} - err := doJSONRequest(ctx, c.client, c.urls[15], in, &out) + err := doJSONRequest(ctx, c.client, c.urls[16], in, &out) return out.Ret0, err } @@ -714,22 +816,8 @@ func (c *metadataClient) SearchMetadata(ctx context.Context, filter string, chai Ret1 []*ContractInfo `json:"contractInfo"` }{} - err := doJSONRequest(ctx, c.client, c.urls[16], in, &out) - return out.Ret0, out.Ret1, err -} - -func (c *metadataClient) ProjectSetTokenMetadata(ctx context.Context, projectID *uint64, chainID string, tokenMetadata *TokenMetadata) (bool, error) { - in := struct { - Arg0 *uint64 `json:"projectID"` - Arg1 string `json:"chainID"` - Arg2 *TokenMetadata `json:"tokenMetadata"` - }{projectID, chainID, tokenMetadata} - out := struct { - Ret0 bool `json:"ok"` - }{} - err := doJSONRequest(ctx, c.client, c.urls[17], in, &out) - return out.Ret0, err + return out.Ret0, out.Ret1, err } func (c *metadataClient) GetNiftyswapTokenQuantity(ctx context.Context, chainID string, contractAddress string, tokenIDs []string) (map[string]string, error) { @@ -828,6 +916,282 @@ func (c *metadataClient) MintMonitorTriggerJob(ctx context.Context, chainID stri return out.Ret0, err } +type collectionsClient struct { + client HTTPClient + urls [18]string +} + +func NewCollectionsClient(addr string, client HTTPClient) Collections { + prefix := urlBase(addr) + CollectionsPathPrefix + urls := [18]string{ + prefix + "CreateCollection", + prefix + "GetCollection", + prefix + "ListCollections", + prefix + "UpdateCollection", + prefix + "DeleteCollection", + prefix + "PublishCollection", + prefix + "UnpublishCollection", + prefix + "PublishCollectionTokens", + prefix + "UnpublishCollectionTokens", + prefix + "CreateAsset", + prefix + "GetAsset", + prefix + "UpdateAsset", + prefix + "DeleteAsset", + prefix + "CreateToken", + prefix + "GetToken", + prefix + "ListTokens", + prefix + "UpdateToken", + prefix + "DeleteToken", + } + return &collectionsClient{ + client: client, + urls: urls, + } +} + +func (c *collectionsClient) CreateCollection(ctx context.Context, projectId *uint64, collection *Collection) (*Collection, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 *Collection `json:"collection"` + }{projectId, collection} + out := struct { + Ret0 *Collection `json:"collection"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[0], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) GetCollection(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"collectionId"` + }{projectId, collectionId} + out := struct { + Ret0 *Collection `json:"collection"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[1], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) ListCollections(ctx context.Context, projectId *uint64, page *Page) (*Page, []*Collection, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 *Page `json:"page"` + }{projectId, page} + out := struct { + Ret0 *Page `json:"page"` + Ret1 []*Collection `json:"collections"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[2], in, &out) + return out.Ret0, out.Ret1, err +} + +func (c *collectionsClient) UpdateCollection(ctx context.Context, projectId *uint64, collection *Collection) (*Collection, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 *Collection `json:"collection"` + }{projectId, collection} + out := struct { + Ret0 *Collection `json:"collection"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[3], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) DeleteCollection(ctx context.Context, projectId *uint64, collectionId uint64) (bool, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"collectionId"` + }{projectId, collectionId} + out := struct { + Ret0 bool `json:"status"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[4], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) PublishCollection(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"collectionId"` + }{projectId, collectionId} + out := struct { + Ret0 *Collection `json:"collection"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[5], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) UnpublishCollection(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"collectionId"` + }{projectId, collectionId} + out := struct { + Ret0 *Collection `json:"collection"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[6], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) PublishCollectionTokens(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"collectionId"` + }{projectId, collectionId} + out := struct { + Ret0 *Collection `json:"collection"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[7], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) UnpublishCollectionTokens(ctx context.Context, projectId *uint64, collectionId uint64) (*Collection, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"collectionId"` + }{projectId, collectionId} + out := struct { + Ret0 *Collection `json:"collection"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[8], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) CreateAsset(ctx context.Context, projectId *uint64, asset *Asset) (*Asset, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 *Asset `json:"asset"` + }{projectId, asset} + out := struct { + Ret0 *Asset `json:"asset"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[9], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) GetAsset(ctx context.Context, projectId *uint64, assetId uint64) (*Asset, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"assetId"` + }{projectId, assetId} + out := struct { + Ret0 *Asset `json:"asset"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[10], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) UpdateAsset(ctx context.Context, projectId *uint64, asset *Asset) (*Asset, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 *Asset `json:"asset"` + }{projectId, asset} + out := struct { + Ret0 *Asset `json:"asset"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[11], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) DeleteAsset(ctx context.Context, projectId *uint64, assetId uint64) (bool, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"assetId"` + }{projectId, assetId} + out := struct { + Ret0 bool `json:"status"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[12], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) CreateToken(ctx context.Context, projectId *uint64, collectionId uint64, token *TokenMetadata) (*TokenMetadata, []*Asset, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"collectionId"` + Arg2 *TokenMetadata `json:"token"` + }{projectId, collectionId, token} + out := struct { + Ret0 *TokenMetadata `json:"token"` + Ret1 []*Asset `json:"assets"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[13], in, &out) + return out.Ret0, out.Ret1, err +} + +func (c *collectionsClient) GetToken(ctx context.Context, projectId *uint64, collectionId uint64, tokenId string) (*TokenMetadata, []*Asset, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"collectionId"` + Arg2 string `json:"tokenId"` + }{projectId, collectionId, tokenId} + out := struct { + Ret0 *TokenMetadata `json:"token"` + Ret1 []*Asset `json:"assets"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[14], in, &out) + return out.Ret0, out.Ret1, err +} + +func (c *collectionsClient) ListTokens(ctx context.Context, projectId *uint64, collectionId uint64, page *Page) (*Page, []*TokenMetadata, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"collectionId"` + Arg2 *Page `json:"page"` + }{projectId, collectionId, page} + out := struct { + Ret0 *Page `json:"page"` + Ret1 []*TokenMetadata `json:"tokens"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[15], in, &out) + return out.Ret0, out.Ret1, err +} + +func (c *collectionsClient) UpdateToken(ctx context.Context, projectId *uint64, collectionId uint64, token *TokenMetadata) (*TokenMetadata, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"collectionId"` + Arg2 *TokenMetadata `json:"token"` + }{projectId, collectionId, token} + out := struct { + Ret0 *TokenMetadata `json:"token"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[16], in, &out) + return out.Ret0, err +} + +func (c *collectionsClient) DeleteToken(ctx context.Context, projectId *uint64, collectionId uint64, tokenId string) (bool, error) { + in := struct { + Arg0 *uint64 `json:"projectId"` + Arg1 uint64 `json:"collectionId"` + Arg2 string `json:"tokenId"` + }{projectId, collectionId, tokenId} + out := struct { + Ret0 bool `json:"status"` + }{} + + err := doJSONRequest(ctx, c.client, c.urls[17], in, &out) + return out.Ret0, err +} + // HTTPClient is the interface used by generated clients to send HTTP requests. // It is fulfilled by *(net/http).Client, which is sufficient for most users. // Users can provide their own implementation for special retry policies.