-
Notifications
You must be signed in to change notification settings - Fork 8
/
asset.go
37 lines (34 loc) · 1.32 KB
/
asset.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package opensea
import (
"context"
"github.com/pinealctx/opensea-go/model"
"github.com/pinealctx/restgo"
)
// Asset Used to fetch more in-depth information about an individual asset
func (c *Client) Asset(ctx context.Context, req *AssetRequest) (*model.Asset, error) {
var rsp, err = c.get(ctx, "/api/v1/asset/:asset_contract_address/:token_id", restgo.ObjectParams(req)...)
if err != nil {
return nil, err
}
var response model.Asset
err = ParseRsp(rsp, &response)
if err != nil {
return nil, err
}
return &response, nil
}
type AssetRequest struct {
// The NFT contract address for the assets
AssetContractAddress string `path:"asset_contract_address,required"`
// Address of the contract for this NFT
TokenID string `path:"token_id,required"`
// Address of an owner of the token.
// If you include this, the response will include an ownership object that includes
// the number of tokens owned by the address provided instead of the top_ownerships object
// included in the standard response, which provides the number of tokens owned by each of
// the 10 addresses with the greatest supply of the token.
AccountAddress string `query:"account_address"`
// A flag determining if order information should be included in the response.
// The default value of this flag is false.
IncludeOrders bool `query:"include_orders"`
}