-
Notifications
You must be signed in to change notification settings - Fork 90
/
lookupAccountByID.go
53 lines (42 loc) · 1.52 KB
/
lookupAccountByID.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
package indexer
import (
"context"
"fmt"
"github.com/algorand/go-algorand-sdk/client/v2/common"
"github.com/algorand/go-algorand-sdk/client/v2/common/models"
)
// LookupAccountByIDParams contains all of the query parameters for url serialization.
type LookupAccountByIDParams 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"`
// Round include results for the specified round.
Round uint64 `url:"round,omitempty"`
}
// LookupAccountByID lookup account information.
type LookupAccountByID struct {
c *Client
accountId string
p LookupAccountByIDParams
}
// IncludeAll include all items including closed accounts, deleted applications,
// destroyed assets, opted-out asset holdings, and closed-out application
// localstates.
func (s *LookupAccountByID) IncludeAll(IncludeAll bool) *LookupAccountByID {
s.p.IncludeAll = IncludeAll
return s
}
// Round include results for the specified round.
func (s *LookupAccountByID) Round(Round uint64) *LookupAccountByID {
s.p.Round = Round
return s
}
// Do performs the HTTP request
func (s *LookupAccountByID) Do(ctx context.Context, headers ...*common.Header) (validRound uint64, result models.Account, err error) {
response := models.AccountResponse{}
err = s.c.get(ctx, &response, fmt.Sprintf("/v2/accounts/%s", s.accountId), s.p, headers)
validRound = response.CurrentRound
result = response.Account
return
}