github.com/algorand/go-algorand-sdk@v1.24.0/client/v2/indexer/lookupAssetByID.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 // LookupAssetByIDParams contains all of the query parameters for url serialization. 12 type LookupAssetByIDParams struct { 13 14 // IncludeAll include all items including closed accounts, deleted applications, 15 // destroyed assets, opted-out asset holdings, and closed-out application 16 // localstates. 17 IncludeAll bool `url:"include-all,omitempty"` 18 } 19 20 // LookupAssetByID lookup asset information. 21 type LookupAssetByID struct { 22 c *Client 23 24 assetId uint64 25 26 p LookupAssetByIDParams 27 } 28 29 // IncludeAll include all items including closed accounts, deleted applications, 30 // destroyed assets, opted-out asset holdings, and closed-out application 31 // localstates. 32 func (s *LookupAssetByID) IncludeAll(IncludeAll bool) *LookupAssetByID { 33 s.p.IncludeAll = IncludeAll 34 35 return s 36 } 37 38 // Do performs the HTTP request 39 func (s *LookupAssetByID) Do(ctx context.Context, headers ...*common.Header) (validRound uint64, result models.Asset, err error) { 40 response := models.AssetResponse{} 41 err = s.c.get(ctx, &response, fmt.Sprintf("/v2/assets/%d", s.assetId), s.p, headers) 42 validRound = response.CurrentRound 43 result = response.Asset 44 return 45 }