github.com/algorand/go-algorand-sdk@v1.24.0/client/v2/indexer/searchForAssets.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 // SearchForAssetsParams contains all of the query parameters for url serialization. 11 type SearchForAssetsParams struct { 12 13 // AssetID asset ID 14 AssetID uint64 `url:"asset-id,omitempty"` 15 16 // Creator filter just assets with the given creator address. 17 Creator string `url:"creator,omitempty"` 18 19 // IncludeAll include all items including closed accounts, deleted applications, 20 // destroyed assets, opted-out asset holdings, and closed-out application 21 // localstates. 22 IncludeAll bool `url:"include-all,omitempty"` 23 24 // Limit maximum number of results to return. There could be additional pages even 25 // if the limit is not reached. 26 Limit uint64 `url:"limit,omitempty"` 27 28 // Name filter just assets with the given name. 29 Name string `url:"name,omitempty"` 30 31 // NextToken the next page of results. Use the next token provided by the previous 32 // results. 33 NextToken string `url:"next,omitempty"` 34 35 // Unit filter just assets with the given unit. 36 Unit string `url:"unit,omitempty"` 37 } 38 39 // SearchForAssets search for assets. 40 type SearchForAssets struct { 41 c *Client 42 43 p SearchForAssetsParams 44 } 45 46 // AssetID asset ID 47 func (s *SearchForAssets) AssetID(AssetID uint64) *SearchForAssets { 48 s.p.AssetID = AssetID 49 50 return s 51 } 52 53 // Creator filter just assets with the given creator address. 54 func (s *SearchForAssets) Creator(Creator string) *SearchForAssets { 55 s.p.Creator = Creator 56 57 return s 58 } 59 60 // IncludeAll include all items including closed accounts, deleted applications, 61 // destroyed assets, opted-out asset holdings, and closed-out application 62 // localstates. 63 func (s *SearchForAssets) IncludeAll(IncludeAll bool) *SearchForAssets { 64 s.p.IncludeAll = IncludeAll 65 66 return s 67 } 68 69 // Limit maximum number of results to return. There could be additional pages even 70 // if the limit is not reached. 71 func (s *SearchForAssets) Limit(Limit uint64) *SearchForAssets { 72 s.p.Limit = Limit 73 74 return s 75 } 76 77 // Name filter just assets with the given name. 78 func (s *SearchForAssets) Name(Name string) *SearchForAssets { 79 s.p.Name = Name 80 81 return s 82 } 83 84 // NextToken the next page of results. Use the next token provided by the previous 85 // results. 86 func (s *SearchForAssets) NextToken(NextToken string) *SearchForAssets { 87 s.p.NextToken = NextToken 88 89 return s 90 } 91 92 // Unit filter just assets with the given unit. 93 func (s *SearchForAssets) Unit(Unit string) *SearchForAssets { 94 s.p.Unit = Unit 95 96 return s 97 } 98 99 // Do performs the HTTP request 100 func (s *SearchForAssets) Do(ctx context.Context, headers ...*common.Header) (response models.AssetsResponse, err error) { 101 err = s.c.get(ctx, &response, "/v2/assets", s.p, headers) 102 return 103 }