-
Notifications
You must be signed in to change notification settings - Fork 90
/
searchForAccounts.go
155 lines (119 loc) · 5.16 KB
/
searchForAccounts.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
package indexer
import (
"context"
"github.com/algorand/go-algorand-sdk/client/v2/common"
"github.com/algorand/go-algorand-sdk/client/v2/common/models"
)
// SearchAccountsParams contains all of the query parameters for url serialization.
type SearchAccountsParams struct {
// ApplicationId application ID
ApplicationId uint64 `url:"application-id,omitempty"`
// AssetID asset ID
AssetID uint64 `url:"asset-id,omitempty"`
// AuthAddress include accounts configured to use this spending key.
AuthAddress string `url:"auth-addr,omitempty"`
// CurrencyGreaterThan results should have an amount greater than this value.
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
CurrencyGreaterThan uint64 `url:"currency-greater-than,omitempty"`
// CurrencyLessThan results should have an amount less than this value. MicroAlgos
// are the default currency unless an asset-id is provided, in which case the asset
// will be used.
CurrencyLessThan uint64 `url:"currency-less-than,omitempty"`
// Exclude exclude additional items such as asset holdings, application local data
// stored for this account, asset parameters created by this account, and
// application parameters created by this account.
Exclude []string `url:"exclude,omitempty,comma"`
// 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. There could be additional pages even
// if the limit is not reached.
Limit uint64 `url:"limit,omitempty"`
// NextToken the next page of results. Use the next token provided by the previous
// results.
NextToken string `url:"next,omitempty"`
// Round include results for the specified round. For performance reasons, this
// parameter may be disabled on some configurations. Using application-id or
// asset-id filters will return both creator and opt-in accounts. Filtering by
// include-all will return creator and opt-in accounts for deleted assets and
// accounts. Non-opt-in managers are not included in the results when asset-id is
// used.
Round uint64 `url:"round,omitempty"`
}
// SearchAccounts search for accounts.
type SearchAccounts struct {
c *Client
p SearchAccountsParams
}
// ApplicationId application ID
func (s *SearchAccounts) ApplicationId(ApplicationId uint64) *SearchAccounts {
s.p.ApplicationId = ApplicationId
return s
}
// AssetID asset ID
func (s *SearchAccounts) AssetID(AssetID uint64) *SearchAccounts {
s.p.AssetID = AssetID
return s
}
// AuthAddress include accounts configured to use this spending key.
func (s *SearchAccounts) AuthAddress(AuthAddress string) *SearchAccounts {
s.p.AuthAddress = AuthAddress
return s
}
// CurrencyGreaterThan results should have an amount greater than this value.
// MicroAlgos are the default currency unless an asset-id is provided, in which
// case the asset will be used.
func (s *SearchAccounts) CurrencyGreaterThan(CurrencyGreaterThan uint64) *SearchAccounts {
s.p.CurrencyGreaterThan = CurrencyGreaterThan
return s
}
// CurrencyLessThan results should have an amount less than this value. MicroAlgos
// are the default currency unless an asset-id is provided, in which case the asset
// will be used.
func (s *SearchAccounts) CurrencyLessThan(CurrencyLessThan uint64) *SearchAccounts {
s.p.CurrencyLessThan = CurrencyLessThan
return s
}
// Exclude exclude additional items such as asset holdings, application local data
// stored for this account, asset parameters created by this account, and
// application parameters created by this account.
func (s *SearchAccounts) Exclude(Exclude []string) *SearchAccounts {
s.p.Exclude = Exclude
return s
}
// IncludeAll include all items including closed accounts, deleted applications,
// destroyed assets, opted-out asset holdings, and closed-out application
// localstates.
func (s *SearchAccounts) IncludeAll(IncludeAll bool) *SearchAccounts {
s.p.IncludeAll = IncludeAll
return s
}
// Limit maximum number of results to return. There could be additional pages even
// if the limit is not reached.
func (s *SearchAccounts) Limit(Limit uint64) *SearchAccounts {
s.p.Limit = Limit
return s
}
// NextToken the next page of results. Use the next token provided by the previous
// results.
func (s *SearchAccounts) NextToken(NextToken string) *SearchAccounts {
s.p.NextToken = NextToken
return s
}
// Round include results for the specified round. For performance reasons, this
// parameter may be disabled on some configurations. Using application-id or
// asset-id filters will return both creator and opt-in accounts. Filtering by
// include-all will return creator and opt-in accounts for deleted assets and
// accounts. Non-opt-in managers are not included in the results when asset-id is
// used.
func (s *SearchAccounts) Round(Round uint64) *SearchAccounts {
s.p.Round = Round
return s
}
// Do performs the HTTP request
func (s *SearchAccounts) Do(ctx context.Context, headers ...*common.Header) (response models.AccountsResponse, err error) {
err = s.c.get(ctx, &response, "/v2/accounts", s.p, headers)
return
}