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

     1  package algod
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  
     7  	"github.com/algorand/go-algorand-sdk/client/v2/common"
     8  	"github.com/algorand/go-algorand-sdk/client/v2/common/models"
     9  )
    10  
    11  // AccountInformationParams contains all of the query parameters for url serialization.
    12  type AccountInformationParams struct {
    13  
    14  	// Exclude when set to `all` will exclude asset holdings, application local state,
    15  	// created asset parameters, any created application parameters. Defaults to
    16  	// `none`.
    17  	Exclude string `url:"exclude,omitempty"`
    18  
    19  	// Format configures whether the response object is JSON or MessagePack encoded.
    20  	Format string `url:"format,omitempty"`
    21  }
    22  
    23  // AccountInformation given a specific account public key, this call returns the
    24  // accounts status, balance and spendable amounts
    25  type AccountInformation struct {
    26  	c *Client
    27  
    28  	address string
    29  
    30  	p AccountInformationParams
    31  }
    32  
    33  // Exclude when set to `all` will exclude asset holdings, application local state,
    34  // created asset parameters, any created application parameters. Defaults to
    35  // `none`.
    36  func (s *AccountInformation) Exclude(Exclude string) *AccountInformation {
    37  	s.p.Exclude = Exclude
    38  
    39  	return s
    40  }
    41  
    42  // Do performs the HTTP request
    43  func (s *AccountInformation) Do(ctx context.Context, headers ...*common.Header) (response models.Account, err error) {
    44  	err = s.c.get(ctx, &response, fmt.Sprintf("/v2/accounts/%s", common.EscapeParams(s.address)...), s.p, headers)
    45  	return
    46  }