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

     1  package indexer
     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  // LookupAccountCreatedAssetsParams contains all of the query parameters for url serialization.
    12  type LookupAccountCreatedAssetsParams struct {
    13  
    14  	// AssetID asset ID
    15  	AssetID uint64 `url:"asset-id,omitempty"`
    16  
    17  	// IncludeAll include all items including closed accounts, deleted applications,
    18  	// destroyed assets, opted-out asset holdings, and closed-out application
    19  	// localstates.
    20  	IncludeAll bool `url:"include-all,omitempty"`
    21  
    22  	// Limit maximum number of results to return. There could be additional pages even
    23  	// if the limit is not reached.
    24  	Limit uint64 `url:"limit,omitempty"`
    25  
    26  	// Next the next page of results. Use the next token provided by the previous
    27  	// results.
    28  	Next string `url:"next,omitempty"`
    29  }
    30  
    31  // LookupAccountCreatedAssets lookup an account's created asset parameters,
    32  // optionally for a specific ID.
    33  type LookupAccountCreatedAssets struct {
    34  	c *Client
    35  
    36  	accountId string
    37  
    38  	p LookupAccountCreatedAssetsParams
    39  }
    40  
    41  // AssetID asset ID
    42  func (s *LookupAccountCreatedAssets) AssetID(AssetID uint64) *LookupAccountCreatedAssets {
    43  	s.p.AssetID = AssetID
    44  
    45  	return s
    46  }
    47  
    48  // IncludeAll include all items including closed accounts, deleted applications,
    49  // destroyed assets, opted-out asset holdings, and closed-out application
    50  // localstates.
    51  func (s *LookupAccountCreatedAssets) IncludeAll(IncludeAll bool) *LookupAccountCreatedAssets {
    52  	s.p.IncludeAll = IncludeAll
    53  
    54  	return s
    55  }
    56  
    57  // Limit maximum number of results to return. There could be additional pages even
    58  // if the limit is not reached.
    59  func (s *LookupAccountCreatedAssets) Limit(Limit uint64) *LookupAccountCreatedAssets {
    60  	s.p.Limit = Limit
    61  
    62  	return s
    63  }
    64  
    65  // Next the next page of results. Use the next token provided by the previous
    66  // results.
    67  func (s *LookupAccountCreatedAssets) Next(Next string) *LookupAccountCreatedAssets {
    68  	s.p.Next = Next
    69  
    70  	return s
    71  }
    72  
    73  // Do performs the HTTP request
    74  func (s *LookupAccountCreatedAssets) Do(ctx context.Context, headers ...*common.Header) (response models.AssetsResponse, err error) {
    75  	err = s.c.get(ctx, &response, fmt.Sprintf("/v2/accounts/%s/created-assets", common.EscapeParams(s.accountId)...), s.p, headers)
    76  	return
    77  }