github.com/algorand/go-algorand-sdk@v1.24.0/client/v2/indexer/searchForAccounts.go (about)

     1  package indexer
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/algorand/go-algorand-sdk/client/v2/common"
     7  	"github.com/algorand/go-algorand-sdk/client/v2/common/models"
     8  )
     9  
    10  // SearchAccountsParams contains all of the query parameters for url serialization.
    11  type SearchAccountsParams struct {
    12  
    13  	// ApplicationId application ID
    14  	ApplicationId uint64 `url:"application-id,omitempty"`
    15  
    16  	// AssetID asset ID
    17  	AssetID uint64 `url:"asset-id,omitempty"`
    18  
    19  	// AuthAddress include accounts configured to use this spending key.
    20  	AuthAddress string `url:"auth-addr,omitempty"`
    21  
    22  	// CurrencyGreaterThan results should have an amount greater than this value.
    23  	// MicroAlgos are the default currency unless an asset-id is provided, in which
    24  	// case the asset will be used.
    25  	CurrencyGreaterThan uint64 `url:"currency-greater-than,omitempty"`
    26  
    27  	// CurrencyLessThan results should have an amount less than this value. MicroAlgos
    28  	// are the default currency unless an asset-id is provided, in which case the asset
    29  	// will be used.
    30  	CurrencyLessThan uint64 `url:"currency-less-than,omitempty"`
    31  
    32  	// Exclude exclude additional items such as asset holdings, application local data
    33  	// stored for this account, asset parameters created by this account, and
    34  	// application parameters created by this account.
    35  	Exclude []string `url:"exclude,omitempty,comma"`
    36  
    37  	// IncludeAll include all items including closed accounts, deleted applications,
    38  	// destroyed assets, opted-out asset holdings, and closed-out application
    39  	// localstates.
    40  	IncludeAll bool `url:"include-all,omitempty"`
    41  
    42  	// Limit maximum number of results to return. There could be additional pages even
    43  	// if the limit is not reached.
    44  	Limit uint64 `url:"limit,omitempty"`
    45  
    46  	// NextToken the next page of results. Use the next token provided by the previous
    47  	// results.
    48  	NextToken string `url:"next,omitempty"`
    49  
    50  	// Round include results for the specified round. For performance reasons, this
    51  	// parameter may be disabled on some configurations. Using application-id or
    52  	// asset-id filters will return both creator and opt-in accounts. Filtering by
    53  	// include-all will return creator and opt-in accounts for deleted assets and
    54  	// accounts. Non-opt-in managers are not included in the results when asset-id is
    55  	// used.
    56  	Round uint64 `url:"round,omitempty"`
    57  }
    58  
    59  // SearchAccounts search for accounts.
    60  type SearchAccounts struct {
    61  	c *Client
    62  
    63  	p SearchAccountsParams
    64  }
    65  
    66  // ApplicationId application ID
    67  func (s *SearchAccounts) ApplicationId(ApplicationId uint64) *SearchAccounts {
    68  	s.p.ApplicationId = ApplicationId
    69  
    70  	return s
    71  }
    72  
    73  // AssetID asset ID
    74  func (s *SearchAccounts) AssetID(AssetID uint64) *SearchAccounts {
    75  	s.p.AssetID = AssetID
    76  
    77  	return s
    78  }
    79  
    80  // AuthAddress include accounts configured to use this spending key.
    81  func (s *SearchAccounts) AuthAddress(AuthAddress string) *SearchAccounts {
    82  	s.p.AuthAddress = AuthAddress
    83  
    84  	return s
    85  }
    86  
    87  // CurrencyGreaterThan results should have an amount greater than this value.
    88  // MicroAlgos are the default currency unless an asset-id is provided, in which
    89  // case the asset will be used.
    90  func (s *SearchAccounts) CurrencyGreaterThan(CurrencyGreaterThan uint64) *SearchAccounts {
    91  	s.p.CurrencyGreaterThan = CurrencyGreaterThan
    92  
    93  	return s
    94  }
    95  
    96  // CurrencyLessThan results should have an amount less than this value. MicroAlgos
    97  // are the default currency unless an asset-id is provided, in which case the asset
    98  // will be used.
    99  func (s *SearchAccounts) CurrencyLessThan(CurrencyLessThan uint64) *SearchAccounts {
   100  	s.p.CurrencyLessThan = CurrencyLessThan
   101  
   102  	return s
   103  }
   104  
   105  // Exclude exclude additional items such as asset holdings, application local data
   106  // stored for this account, asset parameters created by this account, and
   107  // application parameters created by this account.
   108  func (s *SearchAccounts) Exclude(Exclude []string) *SearchAccounts {
   109  	s.p.Exclude = Exclude
   110  
   111  	return s
   112  }
   113  
   114  // IncludeAll include all items including closed accounts, deleted applications,
   115  // destroyed assets, opted-out asset holdings, and closed-out application
   116  // localstates.
   117  func (s *SearchAccounts) IncludeAll(IncludeAll bool) *SearchAccounts {
   118  	s.p.IncludeAll = IncludeAll
   119  
   120  	return s
   121  }
   122  
   123  // Limit maximum number of results to return. There could be additional pages even
   124  // if the limit is not reached.
   125  func (s *SearchAccounts) Limit(Limit uint64) *SearchAccounts {
   126  	s.p.Limit = Limit
   127  
   128  	return s
   129  }
   130  
   131  // NextToken the next page of results. Use the next token provided by the previous
   132  // results.
   133  func (s *SearchAccounts) NextToken(NextToken string) *SearchAccounts {
   134  	s.p.NextToken = NextToken
   135  
   136  	return s
   137  }
   138  
   139  // Round include results for the specified round. For performance reasons, this
   140  // parameter may be disabled on some configurations. Using application-id or
   141  // asset-id filters will return both creator and opt-in accounts. Filtering by
   142  // include-all will return creator and opt-in accounts for deleted assets and
   143  // accounts. Non-opt-in managers are not included in the results when asset-id is
   144  // used.
   145  func (s *SearchAccounts) Round(Round uint64) *SearchAccounts {
   146  	s.p.Round = Round
   147  
   148  	return s
   149  }
   150  
   151  // Do performs the HTTP request
   152  func (s *SearchAccounts) Do(ctx context.Context, headers ...*common.Header) (response models.AccountsResponse, err error) {
   153  	err = s.c.get(ctx, &response, "/v2/accounts", s.p, headers)
   154  	return
   155  }