github.com/algorand/go-algorand-sdk@v1.24.0/client/v2/indexer/searchForApplications.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  // SearchForApplicationsParams contains all of the query parameters for url serialization.
    11  type SearchForApplicationsParams struct {
    12  
    13  	// ApplicationId application ID
    14  	ApplicationId uint64 `url:"application-id,omitempty"`
    15  
    16  	// Creator filter just applications 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  	// Next the next page of results. Use the next token provided by the previous
    29  	// results.
    30  	Next string `url:"next,omitempty"`
    31  }
    32  
    33  // SearchForApplications search for applications
    34  type SearchForApplications struct {
    35  	c *Client
    36  
    37  	p SearchForApplicationsParams
    38  }
    39  
    40  // ApplicationId application ID
    41  func (s *SearchForApplications) ApplicationId(ApplicationId uint64) *SearchForApplications {
    42  	s.p.ApplicationId = ApplicationId
    43  
    44  	return s
    45  }
    46  
    47  // Creator filter just applications with the given creator address.
    48  func (s *SearchForApplications) Creator(Creator string) *SearchForApplications {
    49  	s.p.Creator = Creator
    50  
    51  	return s
    52  }
    53  
    54  // IncludeAll include all items including closed accounts, deleted applications,
    55  // destroyed assets, opted-out asset holdings, and closed-out application
    56  // localstates.
    57  func (s *SearchForApplications) IncludeAll(IncludeAll bool) *SearchForApplications {
    58  	s.p.IncludeAll = IncludeAll
    59  
    60  	return s
    61  }
    62  
    63  // Limit maximum number of results to return. There could be additional pages even
    64  // if the limit is not reached.
    65  func (s *SearchForApplications) Limit(Limit uint64) *SearchForApplications {
    66  	s.p.Limit = Limit
    67  
    68  	return s
    69  }
    70  
    71  // Next the next page of results. Use the next token provided by the previous
    72  // results.
    73  func (s *SearchForApplications) Next(Next string) *SearchForApplications {
    74  	s.p.Next = Next
    75  
    76  	return s
    77  }
    78  
    79  // Do performs the HTTP request
    80  func (s *SearchForApplications) Do(ctx context.Context, headers ...*common.Header) (response models.ApplicationsResponse, err error) {
    81  	err = s.c.get(ctx, &response, "/v2/applications", s.p, headers)
    82  	return
    83  }