-
Notifications
You must be signed in to change notification settings - Fork 90
/
lookupAssetByID.go
45 lines (35 loc) · 1.26 KB
/
lookupAssetByID.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
38
39
40
41
42
43
44
45
package indexer
import (
"context"
"fmt"
"github.com/algorand/go-algorand-sdk/client/v2/common"
"github.com/algorand/go-algorand-sdk/client/v2/common/models"
)
// LookupAssetByIDParams contains all of the query parameters for url serialization.
type LookupAssetByIDParams struct {
// IncludeAll include all items including closed accounts, deleted applications,
// destroyed assets, opted-out asset holdings, and closed-out application
// localstates.
IncludeAll bool `url:"include-all,omitempty"`
}
// LookupAssetByID lookup asset information.
type LookupAssetByID struct {
c *Client
assetId uint64
p LookupAssetByIDParams
}
// IncludeAll include all items including closed accounts, deleted applications,
// destroyed assets, opted-out asset holdings, and closed-out application
// localstates.
func (s *LookupAssetByID) IncludeAll(IncludeAll bool) *LookupAssetByID {
s.p.IncludeAll = IncludeAll
return s
}
// Do performs the HTTP request
func (s *LookupAssetByID) Do(ctx context.Context, headers ...*common.Header) (validRound uint64, result models.Asset, err error) {
response := models.AssetResponse{}
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/assets/%d", s.assetId), s.p, headers)
validRound = response.CurrentRound
result = response.Asset
return
}