Files
schemas/ctl/generated.go
T

357 lines
11 KiB
Go

// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
package ctl
import (
"context"
"encoding/json"
"fmt"
"time"
"github.com/Khan/genqlient/graphql"
)
type InputSubGraph struct {
Ref string `json:"ref"`
Service string `json:"service"`
Url *string `json:"url"`
WsUrl *string `json:"wsUrl"`
Sdl string `json:"sdl"`
}
// GetRef returns InputSubGraph.Ref, and is useful for accessing the field via an interface.
func (v *InputSubGraph) GetRef() string { return v.Ref }
// GetService returns InputSubGraph.Service, and is useful for accessing the field via an interface.
func (v *InputSubGraph) GetService() string { return v.Service }
// GetUrl returns InputSubGraph.Url, and is useful for accessing the field via an interface.
func (v *InputSubGraph) GetUrl() *string { return v.Url }
// GetWsUrl returns InputSubGraph.WsUrl, and is useful for accessing the field via an interface.
func (v *InputSubGraph) GetWsUrl() *string { return v.WsUrl }
// GetSdl returns InputSubGraph.Sdl, and is useful for accessing the field via an interface.
func (v *InputSubGraph) GetSdl() string { return v.Sdl }
// SubGraphsResponse is returned by SubGraphs on success.
type SubGraphsResponse struct {
Supergraph SubGraphsSupergraph `json:"-"`
}
// GetSupergraph returns SubGraphsResponse.Supergraph, and is useful for accessing the field via an interface.
func (v *SubGraphsResponse) GetSupergraph() SubGraphsSupergraph { return v.Supergraph }
func (v *SubGraphsResponse) UnmarshalJSON(b []byte) error {
if string(b) == "null" {
return nil
}
var firstPass struct {
*SubGraphsResponse
Supergraph json.RawMessage `json:"supergraph"`
graphql.NoUnmarshalJSON
}
firstPass.SubGraphsResponse = v
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
{
dst := &v.Supergraph
src := firstPass.Supergraph
if len(src) != 0 && string(src) != "null" {
err = __unmarshalSubGraphsSupergraph(
src, dst)
if err != nil {
return fmt.Errorf(
"unable to unmarshal SubGraphsResponse.Supergraph: %w", err)
}
}
}
return nil
}
type __premarshalSubGraphsResponse struct {
Supergraph json.RawMessage `json:"supergraph"`
}
func (v *SubGraphsResponse) MarshalJSON() ([]byte, error) {
premarshaled, err := v.__premarshalJSON()
if err != nil {
return nil, err
}
return json.Marshal(premarshaled)
}
func (v *SubGraphsResponse) __premarshalJSON() (*__premarshalSubGraphsResponse, error) {
var retval __premarshalSubGraphsResponse
{
dst := &retval.Supergraph
src := v.Supergraph
var err error
*dst, err = __marshalSubGraphsSupergraph(
&src)
if err != nil {
return nil, fmt.Errorf(
"unable to marshal SubGraphsResponse.Supergraph: %w", err)
}
}
return &retval, nil
}
// SubGraphsSupergraph includes the requested fields of the GraphQL interface Supergraph.
//
// SubGraphsSupergraph is implemented by the following types:
// SubGraphsSupergraphSubGraphs
// SubGraphsSupergraphUnchanged
type SubGraphsSupergraph interface {
implementsGraphQLInterfaceSubGraphsSupergraph()
// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
GetTypename() *string
}
func (v *SubGraphsSupergraphSubGraphs) implementsGraphQLInterfaceSubGraphsSupergraph() {}
func (v *SubGraphsSupergraphUnchanged) implementsGraphQLInterfaceSubGraphsSupergraph() {}
func __unmarshalSubGraphsSupergraph(b []byte, v *SubGraphsSupergraph) error {
if string(b) == "null" {
return nil
}
var tn struct {
TypeName string `json:"__typename"`
}
err := json.Unmarshal(b, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "SubGraphs":
*v = new(SubGraphsSupergraphSubGraphs)
return json.Unmarshal(b, *v)
case "Unchanged":
*v = new(SubGraphsSupergraphUnchanged)
return json.Unmarshal(b, *v)
case "":
return fmt.Errorf(
"response was missing Supergraph.__typename")
default:
return fmt.Errorf(
`unexpected concrete type for SubGraphsSupergraph: "%v"`, tn.TypeName)
}
}
func __marshalSubGraphsSupergraph(v *SubGraphsSupergraph) ([]byte, error) {
var typename string
switch v := (*v).(type) {
case *SubGraphsSupergraphSubGraphs:
typename = "SubGraphs"
result := struct {
TypeName string `json:"__typename"`
*SubGraphsSupergraphSubGraphs
}{typename, v}
return json.Marshal(result)
case *SubGraphsSupergraphUnchanged:
typename = "Unchanged"
result := struct {
TypeName string `json:"__typename"`
*SubGraphsSupergraphUnchanged
}{typename, v}
return json.Marshal(result)
case nil:
return []byte("null"), nil
default:
return nil, fmt.Errorf(
`unexpected concrete type for SubGraphsSupergraph: "%T"`, v)
}
}
// SubGraphsSupergraphSubGraphs includes the requested fields of the GraphQL type SubGraphs.
type SubGraphsSupergraphSubGraphs struct {
Typename *string `json:"__typename"`
SubGraphs []*SubGraphsSupergraphSubGraphsSubGraphsSubGraph `json:"subGraphs"`
}
// GetTypename returns SubGraphsSupergraphSubGraphs.Typename, and is useful for accessing the field via an interface.
func (v *SubGraphsSupergraphSubGraphs) GetTypename() *string { return v.Typename }
// GetSubGraphs returns SubGraphsSupergraphSubGraphs.SubGraphs, and is useful for accessing the field via an interface.
func (v *SubGraphsSupergraphSubGraphs) GetSubGraphs() []*SubGraphsSupergraphSubGraphsSubGraphsSubGraph {
return v.SubGraphs
}
// SubGraphsSupergraphSubGraphsSubGraphsSubGraph includes the requested fields of the GraphQL type SubGraph.
type SubGraphsSupergraphSubGraphsSubGraphsSubGraph struct {
Service string `json:"service"`
Url *string `json:"url"`
WsUrl *string `json:"wsUrl"`
ChangedBy string `json:"changedBy"`
ChangedAt time.Time `json:"changedAt"`
}
// GetService returns SubGraphsSupergraphSubGraphsSubGraphsSubGraph.Service, and is useful for accessing the field via an interface.
func (v *SubGraphsSupergraphSubGraphsSubGraphsSubGraph) GetService() string { return v.Service }
// GetUrl returns SubGraphsSupergraphSubGraphsSubGraphsSubGraph.Url, and is useful for accessing the field via an interface.
func (v *SubGraphsSupergraphSubGraphsSubGraphsSubGraph) GetUrl() *string { return v.Url }
// GetWsUrl returns SubGraphsSupergraphSubGraphsSubGraphsSubGraph.WsUrl, and is useful for accessing the field via an interface.
func (v *SubGraphsSupergraphSubGraphsSubGraphsSubGraph) GetWsUrl() *string { return v.WsUrl }
// GetChangedBy returns SubGraphsSupergraphSubGraphsSubGraphsSubGraph.ChangedBy, and is useful for accessing the field via an interface.
func (v *SubGraphsSupergraphSubGraphsSubGraphsSubGraph) GetChangedBy() string { return v.ChangedBy }
// GetChangedAt returns SubGraphsSupergraphSubGraphsSubGraphsSubGraph.ChangedAt, and is useful for accessing the field via an interface.
func (v *SubGraphsSupergraphSubGraphsSubGraphsSubGraph) GetChangedAt() time.Time { return v.ChangedAt }
// SubGraphsSupergraphUnchanged includes the requested fields of the GraphQL type Unchanged.
type SubGraphsSupergraphUnchanged struct {
Typename *string `json:"__typename"`
}
// GetTypename returns SubGraphsSupergraphUnchanged.Typename, and is useful for accessing the field via an interface.
func (v *SubGraphsSupergraphUnchanged) GetTypename() *string { return v.Typename }
// UpdateSubGraphResponse is returned by UpdateSubGraph on success.
type UpdateSubGraphResponse struct {
UpdateSubGraph *UpdateSubGraphUpdateSubGraph `json:"updateSubGraph"`
}
// GetUpdateSubGraph returns UpdateSubGraphResponse.UpdateSubGraph, and is useful for accessing the field via an interface.
func (v *UpdateSubGraphResponse) GetUpdateSubGraph() *UpdateSubGraphUpdateSubGraph {
return v.UpdateSubGraph
}
// UpdateSubGraphUpdateSubGraph includes the requested fields of the GraphQL type SubGraph.
type UpdateSubGraphUpdateSubGraph struct {
Service string `json:"service"`
Url *string `json:"url"`
WsUrl *string `json:"wsUrl"`
ChangedBy string `json:"changedBy"`
ChangedAt time.Time `json:"changedAt"`
}
// GetService returns UpdateSubGraphUpdateSubGraph.Service, and is useful for accessing the field via an interface.
func (v *UpdateSubGraphUpdateSubGraph) GetService() string { return v.Service }
// GetUrl returns UpdateSubGraphUpdateSubGraph.Url, and is useful for accessing the field via an interface.
func (v *UpdateSubGraphUpdateSubGraph) GetUrl() *string { return v.Url }
// GetWsUrl returns UpdateSubGraphUpdateSubGraph.WsUrl, and is useful for accessing the field via an interface.
func (v *UpdateSubGraphUpdateSubGraph) GetWsUrl() *string { return v.WsUrl }
// GetChangedBy returns UpdateSubGraphUpdateSubGraph.ChangedBy, and is useful for accessing the field via an interface.
func (v *UpdateSubGraphUpdateSubGraph) GetChangedBy() string { return v.ChangedBy }
// GetChangedAt returns UpdateSubGraphUpdateSubGraph.ChangedAt, and is useful for accessing the field via an interface.
func (v *UpdateSubGraphUpdateSubGraph) GetChangedAt() time.Time { return v.ChangedAt }
// __SubGraphsInput is used internally by genqlient
type __SubGraphsInput struct {
Ref string `json:"ref"`
}
// GetRef returns __SubGraphsInput.Ref, and is useful for accessing the field via an interface.
func (v *__SubGraphsInput) GetRef() string { return v.Ref }
// __UpdateSubGraphInput is used internally by genqlient
type __UpdateSubGraphInput struct {
Input *InputSubGraph `json:"input,omitempty"`
}
// GetInput returns __UpdateSubGraphInput.Input, and is useful for accessing the field via an interface.
func (v *__UpdateSubGraphInput) GetInput() *InputSubGraph { return v.Input }
// The query or mutation executed by SubGraphs.
const SubGraphs_Operation = `
query SubGraphs ($ref: String!) {
supergraph(ref: $ref) {
__typename
... on SubGraphs {
subGraphs {
service
url
wsUrl
changedBy
changedAt
}
}
}
}
`
func SubGraphs(
ctx_ context.Context,
client_ graphql.Client,
ref string,
) (*SubGraphsResponse, error) {
req_ := &graphql.Request{
OpName: "SubGraphs",
Query: SubGraphs_Operation,
Variables: &__SubGraphsInput{
Ref: ref,
},
}
var err_ error
var data_ SubGraphsResponse
resp_ := &graphql.Response{Data: &data_}
err_ = client_.MakeRequest(
ctx_,
req_,
resp_,
)
return &data_, err_
}
// The query or mutation executed by UpdateSubGraph.
const UpdateSubGraph_Operation = `
mutation UpdateSubGraph ($input: InputSubGraph!) {
updateSubGraph(input: $input) {
service
url
wsUrl
changedBy
changedAt
}
}
`
func UpdateSubGraph(
ctx_ context.Context,
client_ graphql.Client,
input *InputSubGraph,
) (*UpdateSubGraphResponse, error) {
req_ := &graphql.Request{
OpName: "UpdateSubGraph",
Query: UpdateSubGraph_Operation,
Variables: &__UpdateSubGraphInput{
Input: input,
},
}
var err_ error
var data_ UpdateSubGraphResponse
resp_ := &graphql.Response{Data: &data_}
err_ = client_.MakeRequest(
ctx_,
req_,
resp_,
)
return &data_, err_
}