24 lines
806 B
Go
24 lines
806 B
Go
package api
|
|
|
|
import "fmt"
|
|
|
|
// using API v3 here because the equivalent in GraphQL needs `read:org` scope
|
|
func resolveOrganization(client *Client, orgName string) (string, error) {
|
|
var response struct {
|
|
NodeID string `json:"node_id"`
|
|
}
|
|
err := client.REST("GET", fmt.Sprintf("users/%s", orgName), nil, &response)
|
|
return response.NodeID, err
|
|
}
|
|
|
|
// using API v3 here because the equivalent in GraphQL needs `read:org` scope
|
|
func resolveOrganizationTeam(client *Client, orgName, teamSlug string) (string, string, error) {
|
|
var response struct {
|
|
NodeID string `json:"node_id"`
|
|
Organization struct {
|
|
NodeID string `json:"node_id"`
|
|
}
|
|
}
|
|
err := client.REST("GET", fmt.Sprintf("orgs/%s/teams/%s", orgName, teamSlug), nil, &response)
|
|
return response.Organization.NodeID, response.NodeID, err
|
|
}
|