-
Notifications
You must be signed in to change notification settings - Fork 90
/
searchForAssets.go
94 lines (74 loc) · 2.56 KB
/
searchForAssets.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package indexer
import (
"context"
"github.com/algorand/go-algorand-sdk/client/v2/common"
"github.com/algorand/go-algorand-sdk/client/v2/common/models"
)
// SearchForAssetsParams contains all of the query parameters for url serialization.
type SearchForAssetsParams struct {
// AssetID asset ID
AssetID uint64 `url:"asset-id,omitempty"`
// Creator filter just assets with the given creator address.
Creator string `url:"creator,omitempty"`
// 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"`
// Limit maximum number of results to return.
Limit uint64 `url:"limit,omitempty"`
// Name filter just assets with the given name.
Name string `url:"name,omitempty"`
// NextToken the next page of results. Use the next token provided by the previous
// results.
NextToken string `url:"next,omitempty"`
// Unit filter just assets with the given unit.
Unit string `url:"unit,omitempty"`
}
// SearchForAssets search for assets.
type SearchForAssets struct {
c *Client
p SearchForAssetsParams
}
// AssetID asset ID
func (s *SearchForAssets) AssetID(AssetID uint64) *SearchForAssets {
s.p.AssetID = AssetID
return s
}
// Creator filter just assets with the given creator address.
func (s *SearchForAssets) Creator(Creator string) *SearchForAssets {
s.p.Creator = Creator
return s
}
// IncludeAll include all items including closed accounts, deleted applications,
// destroyed assets, opted-out asset holdings, and closed-out application
// localstates.
func (s *SearchForAssets) IncludeAll(IncludeAll bool) *SearchForAssets {
s.p.IncludeAll = IncludeAll
return s
}
// Limit maximum number of results to return.
func (s *SearchForAssets) Limit(Limit uint64) *SearchForAssets {
s.p.Limit = Limit
return s
}
// Name filter just assets with the given name.
func (s *SearchForAssets) Name(Name string) *SearchForAssets {
s.p.Name = Name
return s
}
// NextToken the next page of results. Use the next token provided by the previous
// results.
func (s *SearchForAssets) NextToken(NextToken string) *SearchForAssets {
s.p.NextToken = NextToken
return s
}
// Unit filter just assets with the given unit.
func (s *SearchForAssets) Unit(Unit string) *SearchForAssets {
s.p.Unit = Unit
return s
}
// Do performs the HTTP request
func (s *SearchForAssets) Do(ctx context.Context, headers ...*common.Header) (response models.AssetsResponse, err error) {
err = s.c.get(ctx, &response, "/v2/assets", s.p, headers)
return
}