github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/graphql/request/organization.go (about)

     1  package request
     2  
     3  import (
     4  	"github.com/go-openapi/strfmt"
     5  )
     6  
     7  // OrganizationsByIDs returns the query for retrieving orgs by ids
     8  func OrganizationsByIDs(orgIDs []strfmt.UUID) *organizationByIDs {
     9  	return &organizationByIDs{vars: map[string]interface{}{
    10  		"organization_ids": orgIDs,
    11  	}}
    12  }
    13  
    14  type organizationByIDs struct {
    15  	vars map[string]interface{}
    16  }
    17  
    18  func (p *organizationByIDs) Query() string {
    19  	return `query ($organization_ids: [uuid!]) {
    20  		organizations(where: {organization_id:{_in: $organization_ids}}) {
    21  		  organization_id
    22  		  display_name
    23  		  url_name
    24  		}
    25  	  }
    26  	  `
    27  }
    28  
    29  func (p *organizationByIDs) Vars() (map[string]interface{}, error) {
    30  	return p.vars, nil
    31  }
    32  
    33  // OrganizationsByName returns the query for retrieving org by name
    34  func OrganizationsByName(name string) *organizationByName {
    35  	return &organizationByName{vars: map[string]interface{}{
    36  		"name": name,
    37  	}}
    38  }
    39  
    40  type organizationByName struct {
    41  	vars map[string]interface{}
    42  }
    43  
    44  func (p *organizationByName) Query() string {
    45  	return `query ($name: String) {
    46  		organizations(where: {url_name:{_eq: $name}}) {
    47  			organization_id
    48  			display_name
    49  			url_name
    50  		}
    51  	}`
    52  }
    53  
    54  func (p *organizationByName) Vars() (map[string]interface{}, error) {
    55  	return p.vars, nil
    56  }