github.com/algorand/go-algorand-sdk@v1.24.0/client/v2/indexer/lookupApplicationBoxByIDandName.go (about) 1 package indexer 2 3 import ( 4 "context" 5 "encoding/base64" 6 "fmt" 7 8 "github.com/algorand/go-algorand-sdk/client/v2/common" 9 "github.com/algorand/go-algorand-sdk/client/v2/common/models" 10 ) 11 12 // LookupApplicationBoxByIDAndNameParams contains all of the query parameters for url serialization. 13 type LookupApplicationBoxByIDAndNameParams struct { 14 15 // Name a box name in goal-arg form 'encoding:value'. For ints, use the form 16 // 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use 17 // the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. 18 Name string `url:"name,omitempty"` 19 } 20 21 // LookupApplicationBoxByIDAndName given an application ID and box name, returns 22 // base64 encoded box name and value. Box names must be in the goal app call arg 23 // form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, encode 24 // base 64 and use 'b64' prefix as in 'b64:A=='. For printable strings, use the 25 // form 'str:hello'. For addresses, use the form 'addr:XYZ...'. 26 type LookupApplicationBoxByIDAndName struct { 27 c *Client 28 29 applicationId uint64 30 31 p LookupApplicationBoxByIDAndNameParams 32 } 33 34 // name a box name in goal-arg form 'encoding:value'. For ints, use the form 35 // 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use 36 // the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. 37 func (s *LookupApplicationBoxByIDAndName) name(name []byte) *LookupApplicationBoxByIDAndName { 38 s.p.Name = "b64:" + base64.StdEncoding.EncodeToString(name) 39 40 return s 41 } 42 43 // Do performs the HTTP request 44 func (s *LookupApplicationBoxByIDAndName) Do(ctx context.Context, headers ...*common.Header) (response models.Box, err error) { 45 err = s.c.get(ctx, &response, fmt.Sprintf("/v2/applications/%s/box", common.EscapeParams(s.applicationId)...), s.p, headers) 46 return 47 }