diff --git a/example/generated.go b/example/generated.go index a0476bdf..301b3847 100644 --- a/example/generated.go +++ b/example/generated.go @@ -75,7 +75,7 @@ func getUser( client graphql.Client, Login string, ) (*getUserResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "getUser", Query: ` query getUser ($Login: String!) { @@ -109,7 +109,7 @@ func getViewer( ctx context.Context, client graphql.Client, ) (*getViewerResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "getViewer", Query: ` query getViewer { diff --git a/generate/operation.go.tmpl b/generate/operation.go.tmpl index 71f992a6..9126e68b 100644 --- a/generate/operation.go.tmpl +++ b/generate/operation.go.tmpl @@ -13,7 +13,7 @@ func {{.Name}}( {{end -}} {{end -}} ) (*{{.ResponseName}}, {{if .Config.Extensions -}}map[string]interface{},{{end}} error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "{{.Name}}", Query: `{{.Body}}`, {{if .Input -}} diff --git a/generate/testdata/snapshots/TestGenerate-ComplexInlineFragments.graphql-ComplexInlineFragments.graphql.go b/generate/testdata/snapshots/TestGenerate-ComplexInlineFragments.graphql-ComplexInlineFragments.graphql.go index f9ab687e..22440799 100644 --- a/generate/testdata/snapshots/TestGenerate-ComplexInlineFragments.graphql-ComplexInlineFragments.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-ComplexInlineFragments.graphql-ComplexInlineFragments.graphql.go @@ -1348,7 +1348,7 @@ func (v *ComplexInlineFragmentsRootTopic) GetName() string { return v.Name } func ComplexInlineFragments( client graphql.Client, ) (*ComplexInlineFragmentsResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "ComplexInlineFragments", Query: ` query ComplexInlineFragments { diff --git a/generate/testdata/snapshots/TestGenerate-ComplexNamedFragments.graphql-ComplexNamedFragments.graphql.go b/generate/testdata/snapshots/TestGenerate-ComplexNamedFragments.graphql-ComplexNamedFragments.graphql.go index f65fdb70..93b39ca8 100644 --- a/generate/testdata/snapshots/TestGenerate-ComplexNamedFragments.graphql-ComplexNamedFragments.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-ComplexNamedFragments.graphql-ComplexNamedFragments.graphql.go @@ -1742,7 +1742,7 @@ func (v *VideoFieldsThumbnail) GetId() testutil.ID { return v.Id } func ComplexNamedFragments( client graphql.Client, ) (*ComplexNamedFragmentsResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "ComplexNamedFragments", Query: ` query ComplexNamedFragments { diff --git a/generate/testdata/snapshots/TestGenerate-CustomMarshal.graphql-CustomMarshal.graphql.go b/generate/testdata/snapshots/TestGenerate-CustomMarshal.graphql-CustomMarshal.graphql.go index 21476ac9..a777fcb1 100644 --- a/generate/testdata/snapshots/TestGenerate-CustomMarshal.graphql-CustomMarshal.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-CustomMarshal.graphql-CustomMarshal.graphql.go @@ -178,7 +178,7 @@ func CustomMarshal( client graphql.Client, date time.Time, ) (*CustomMarshalResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "CustomMarshal", Query: ` query CustomMarshal ($date: Date!) { diff --git a/generate/testdata/snapshots/TestGenerate-CustomMarshalSlice.graphql-CustomMarshalSlice.graphql.go b/generate/testdata/snapshots/TestGenerate-CustomMarshalSlice.graphql-CustomMarshalSlice.graphql.go index 630dd484..529f0402 100644 --- a/generate/testdata/snapshots/TestGenerate-CustomMarshalSlice.graphql-CustomMarshalSlice.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-CustomMarshalSlice.graphql-CustomMarshalSlice.graphql.go @@ -208,7 +208,7 @@ func CustomMarshalSlice( datesss [][][]time.Time, datesssp [][][]*time.Time, ) (*CustomMarshalSliceResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "CustomMarshalSlice", Query: ` query CustomMarshalSlice ($datesss: [[[Date!]!]!]!, $datesssp: [[[Date!]!]!]!) { diff --git a/generate/testdata/snapshots/TestGenerate-DateTime.graphql-DateTime.graphql.go b/generate/testdata/snapshots/TestGenerate-DateTime.graphql-DateTime.graphql.go index 8721f24d..cd243589 100644 --- a/generate/testdata/snapshots/TestGenerate-DateTime.graphql-DateTime.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-DateTime.graphql-DateTime.graphql.go @@ -33,7 +33,7 @@ func convertTimezone( dt time.Time, tz string, ) (*convertTimezoneResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "convertTimezone", Query: ` query convertTimezone ($dt: DateTime!, $tz: String) { diff --git a/generate/testdata/snapshots/TestGenerate-EmptyInterface.graphql-EmptyInterface.graphql.go b/generate/testdata/snapshots/TestGenerate-EmptyInterface.graphql-EmptyInterface.graphql.go index e7658b99..89a575cd 100644 --- a/generate/testdata/snapshots/TestGenerate-EmptyInterface.graphql-EmptyInterface.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-EmptyInterface.graphql-EmptyInterface.graphql.go @@ -23,7 +23,7 @@ func (v *EmptyInterfaceResponse) GetGetComplexJunk() []map[string]*[]*map[string func EmptyInterface( client graphql.Client, ) (*EmptyInterfaceResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "EmptyInterface", Query: ` query EmptyInterface { diff --git a/generate/testdata/snapshots/TestGenerate-Flatten.graphql-Flatten.graphql.go b/generate/testdata/snapshots/TestGenerate-Flatten.graphql-Flatten.graphql.go index 84dbed23..1db1d545 100644 --- a/generate/testdata/snapshots/TestGenerate-Flatten.graphql-Flatten.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-Flatten.graphql-Flatten.graphql.go @@ -269,7 +269,7 @@ func (v *VideoFieldsParentTopic) GetVideoChildren() []ChildVideoFields { return func ComplexNamedFragments( client graphql.Client, ) (*InnerQueryFragment, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "ComplexNamedFragments", Query: ` query ComplexNamedFragments { diff --git a/generate/testdata/snapshots/TestGenerate-InputEnum.graphql-InputEnum.graphql.go b/generate/testdata/snapshots/TestGenerate-InputEnum.graphql-InputEnum.graphql.go index 26fa1d11..3bccd3c1 100644 --- a/generate/testdata/snapshots/TestGenerate-InputEnum.graphql-InputEnum.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-InputEnum.graphql-InputEnum.graphql.go @@ -58,7 +58,7 @@ func InputEnumQuery( client graphql.Client, role Role, ) (*InputEnumQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "InputEnumQuery", Query: ` query InputEnumQuery ($role: Role!) { diff --git a/generate/testdata/snapshots/TestGenerate-InputObject.graphql-InputObject.graphql.go b/generate/testdata/snapshots/TestGenerate-InputObject.graphql-InputObject.graphql.go index 5baa712e..920de9d9 100644 --- a/generate/testdata/snapshots/TestGenerate-InputObject.graphql-InputObject.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-InputObject.graphql-InputObject.graphql.go @@ -181,7 +181,7 @@ func InputObjectQuery( client graphql.Client, query UserQueryInput, ) (*InputObjectQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "InputObjectQuery", Query: ` query InputObjectQuery ($query: UserQueryInput) { diff --git a/generate/testdata/snapshots/TestGenerate-InterfaceListField.graphql-InterfaceListField.graphql.go b/generate/testdata/snapshots/TestGenerate-InterfaceListField.graphql-InterfaceListField.graphql.go index 652a2478..a85d291f 100644 --- a/generate/testdata/snapshots/TestGenerate-InterfaceListField.graphql-InterfaceListField.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-InterfaceListField.graphql-InterfaceListField.graphql.go @@ -523,7 +523,7 @@ func (v *InterfaceListFieldWithPointerTopicChildrenVideo) GetName() string { ret func InterfaceListField( client graphql.Client, ) (*InterfaceListFieldResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "InterfaceListField", Query: ` query InterfaceListField { diff --git a/generate/testdata/snapshots/TestGenerate-InterfaceListOfListsOfListsField.graphql-InterfaceListOfListsOfListsField.graphql.go b/generate/testdata/snapshots/TestGenerate-InterfaceListOfListsOfListsField.graphql-InterfaceListOfListsOfListsField.graphql.go index b3555044..bc48e9cf 100644 --- a/generate/testdata/snapshots/TestGenerate-InterfaceListOfListsOfListsField.graphql-InterfaceListOfListsOfListsField.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-InterfaceListOfListsOfListsField.graphql-InterfaceListOfListsOfListsField.graphql.go @@ -509,7 +509,7 @@ func (v *InterfaceListOfListOfListsFieldWithPointerVideo) GetName() *string { re func InterfaceListOfListOfListsField( client graphql.Client, ) (*InterfaceListOfListOfListsFieldResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "InterfaceListOfListOfListsField", Query: ` query InterfaceListOfListOfListsField { diff --git a/generate/testdata/snapshots/TestGenerate-InterfaceNesting.graphql-InterfaceNesting.graphql.go b/generate/testdata/snapshots/TestGenerate-InterfaceNesting.graphql-InterfaceNesting.graphql.go index cfbaf162..1f19dad9 100644 --- a/generate/testdata/snapshots/TestGenerate-InterfaceNesting.graphql-InterfaceNesting.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-InterfaceNesting.graphql-InterfaceNesting.graphql.go @@ -507,7 +507,7 @@ func (v *InterfaceNestingRootTopicChildrenVideo) GetParent() InterfaceNestingRoo func InterfaceNesting( client graphql.Client, ) (*InterfaceNestingResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "InterfaceNesting", Query: ` query InterfaceNesting { diff --git a/generate/testdata/snapshots/TestGenerate-InterfaceNoFragments.graphql-InterfaceNoFragments.graphql.go b/generate/testdata/snapshots/TestGenerate-InterfaceNoFragments.graphql-InterfaceNoFragments.graphql.go index e8d15fd4..65d2e164 100644 --- a/generate/testdata/snapshots/TestGenerate-InterfaceNoFragments.graphql-InterfaceNoFragments.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-InterfaceNoFragments.graphql-InterfaceNoFragments.graphql.go @@ -629,7 +629,7 @@ func (v *InterfaceNoFragmentsQueryWithPointerVideo) GetName() *string { return v func InterfaceNoFragmentsQuery( client graphql.Client, ) (*InterfaceNoFragmentsQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "InterfaceNoFragmentsQuery", Query: ` query InterfaceNoFragmentsQuery { diff --git a/generate/testdata/snapshots/TestGenerate-ListInput.graphql-ListInput.graphql.go b/generate/testdata/snapshots/TestGenerate-ListInput.graphql-ListInput.graphql.go index 96b7731b..387de625 100644 --- a/generate/testdata/snapshots/TestGenerate-ListInput.graphql-ListInput.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-ListInput.graphql-ListInput.graphql.go @@ -45,7 +45,7 @@ func ListInputQuery( client graphql.Client, names []string, ) (*ListInputQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "ListInputQuery", Query: ` query ListInputQuery ($names: [String]) { diff --git a/generate/testdata/snapshots/TestGenerate-ListOfListsOfLists.graphql-ListOfListsOfLists.graphql.go b/generate/testdata/snapshots/TestGenerate-ListOfListsOfLists.graphql-ListOfListsOfLists.graphql.go index 1df2ab19..a1e30863 100644 --- a/generate/testdata/snapshots/TestGenerate-ListOfListsOfLists.graphql-ListOfListsOfLists.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-ListOfListsOfLists.graphql-ListOfListsOfLists.graphql.go @@ -19,7 +19,7 @@ func (v *ListOfListsOfListsResponse) GetListOfListsOfLists() [][][]string { func ListOfListsOfLists( client graphql.Client, ) (*ListOfListsOfListsResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "ListOfListsOfLists", Query: ` query ListOfListsOfLists { diff --git a/generate/testdata/snapshots/TestGenerate-MultipleDirectives.graphql-MultipleDirectives.graphql.go b/generate/testdata/snapshots/TestGenerate-MultipleDirectives.graphql-MultipleDirectives.graphql.go index cdba3004..c4ad14de 100644 --- a/generate/testdata/snapshots/TestGenerate-MultipleDirectives.graphql-MultipleDirectives.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-MultipleDirectives.graphql-MultipleDirectives.graphql.go @@ -330,7 +330,7 @@ func MultipleDirectives( query MyInput, queries []*UserQueryInput, ) (*MyMultipleDirectivesResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "MultipleDirectives", Query: ` query MultipleDirectives ($query: UserQueryInput, $queries: [UserQueryInput]) { diff --git a/generate/testdata/snapshots/TestGenerate-Omitempty.graphql-Omitempty.graphql.go b/generate/testdata/snapshots/TestGenerate-Omitempty.graphql-Omitempty.graphql.go index 8d357ee6..b04eaf3d 100644 --- a/generate/testdata/snapshots/TestGenerate-Omitempty.graphql-Omitempty.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-Omitempty.graphql-Omitempty.graphql.go @@ -227,7 +227,7 @@ func OmitEmptyQuery( tz string, tzNoOmitEmpty string, ) (*OmitEmptyQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "OmitEmptyQuery", Query: ` query OmitEmptyQuery ($query: UserQueryInput, $queries: [UserQueryInput], $dt: DateTime, $tz: String, $tzNoOmitEmpty: String) { diff --git a/generate/testdata/snapshots/TestGenerate-Pointers.graphql-Pointers.graphql.go b/generate/testdata/snapshots/TestGenerate-Pointers.graphql-Pointers.graphql.go index 409297e8..8285c95d 100644 --- a/generate/testdata/snapshots/TestGenerate-Pointers.graphql-Pointers.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-Pointers.graphql-Pointers.graphql.go @@ -236,7 +236,7 @@ func PointersQuery( dt time.Time, tz *string, ) (*PointersQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "PointersQuery", Query: ` query PointersQuery ($query: UserQueryInput, $dt: DateTime, $tz: String) { diff --git a/generate/testdata/snapshots/TestGenerate-PointersInline.graphql-PointersInline.graphql.go b/generate/testdata/snapshots/TestGenerate-PointersInline.graphql-PointersInline.graphql.go index 04c552a5..b2921e7d 100644 --- a/generate/testdata/snapshots/TestGenerate-PointersInline.graphql-PointersInline.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-PointersInline.graphql-PointersInline.graphql.go @@ -233,7 +233,7 @@ func PointersQuery( dt *time.Time, tz string, ) (*PointersQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "PointersQuery", Query: ` query PointersQuery ($query: UserQueryInput, $dt: DateTime, $tz: String) { diff --git a/generate/testdata/snapshots/TestGenerate-Pokemon.graphql-Pokemon.graphql.go b/generate/testdata/snapshots/TestGenerate-Pokemon.graphql-Pokemon.graphql.go index 14b42928..d34529fc 100644 --- a/generate/testdata/snapshots/TestGenerate-Pokemon.graphql-Pokemon.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-Pokemon.graphql-Pokemon.graphql.go @@ -75,7 +75,7 @@ func GetPokemonSiblings( client graphql.Client, input testutil.Pokemon, ) (*GetPokemonSiblingsResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "GetPokemonSiblings", Query: ` query GetPokemonSiblings ($input: PokemonInput!) { diff --git a/generate/testdata/snapshots/TestGenerate-QueryWithAlias.graphql-QueryWithAlias.graphql.go b/generate/testdata/snapshots/TestGenerate-QueryWithAlias.graphql-QueryWithAlias.graphql.go index 552baf1a..a26c6732 100644 --- a/generate/testdata/snapshots/TestGenerate-QueryWithAlias.graphql-QueryWithAlias.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-QueryWithAlias.graphql-QueryWithAlias.graphql.go @@ -43,7 +43,7 @@ func (v *QueryWithAliasUser) GetOtherID() testutil.ID { return v.OtherID } func QueryWithAlias( client graphql.Client, ) (*QueryWithAliasResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "QueryWithAlias", Query: ` query QueryWithAlias { diff --git a/generate/testdata/snapshots/TestGenerate-QueryWithDoubleAlias.graphql-QueryWithDoubleAlias.graphql.go b/generate/testdata/snapshots/TestGenerate-QueryWithDoubleAlias.graphql-QueryWithDoubleAlias.graphql.go index 51d9ce47..795941e1 100644 --- a/generate/testdata/snapshots/TestGenerate-QueryWithDoubleAlias.graphql-QueryWithDoubleAlias.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-QueryWithDoubleAlias.graphql-QueryWithDoubleAlias.graphql.go @@ -43,7 +43,7 @@ func (v *QueryWithDoubleAliasUser) GetAlsoID() testutil.ID { return v.AlsoID } func QueryWithDoubleAlias( client graphql.Client, ) (*QueryWithDoubleAliasResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "QueryWithDoubleAlias", Query: ` query QueryWithDoubleAlias { diff --git a/generate/testdata/snapshots/TestGenerate-QueryWithEnums.graphql-QueryWithEnums.graphql.go b/generate/testdata/snapshots/TestGenerate-QueryWithEnums.graphql-QueryWithEnums.graphql.go index c0226153..791cda21 100644 --- a/generate/testdata/snapshots/TestGenerate-QueryWithEnums.graphql-QueryWithEnums.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-QueryWithEnums.graphql-QueryWithEnums.graphql.go @@ -65,7 +65,7 @@ const ( func QueryWithEnums( client graphql.Client, ) (*QueryWithEnumsResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "QueryWithEnums", Query: ` query QueryWithEnums { diff --git a/generate/testdata/snapshots/TestGenerate-QueryWithSlices.graphql-QueryWithSlices.graphql.go b/generate/testdata/snapshots/TestGenerate-QueryWithSlices.graphql-QueryWithSlices.graphql.go index 21069a5d..16b11665 100644 --- a/generate/testdata/snapshots/TestGenerate-QueryWithSlices.graphql-QueryWithSlices.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-QueryWithSlices.graphql-QueryWithSlices.graphql.go @@ -44,7 +44,7 @@ func (v *QueryWithSlicesUser) GetEmailsWithNullsOrNull() []string { return v.Ema func QueryWithSlices( client graphql.Client, ) (*QueryWithSlicesResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "QueryWithSlices", Query: ` query QueryWithSlices { diff --git a/generate/testdata/snapshots/TestGenerate-QueryWithStructs.graphql-QueryWithStructs.graphql.go b/generate/testdata/snapshots/TestGenerate-QueryWithStructs.graphql-QueryWithStructs.graphql.go index 33a7fa6b..4fb2b47e 100644 --- a/generate/testdata/snapshots/TestGenerate-QueryWithStructs.graphql-QueryWithStructs.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-QueryWithStructs.graphql-QueryWithStructs.graphql.go @@ -46,7 +46,7 @@ func (v *QueryWithStructsUserAuthMethodsAuthMethod) GetEmail() string { return v func QueryWithStructs( client graphql.Client, ) (*QueryWithStructsResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "QueryWithStructs", Query: ` query QueryWithStructs { diff --git a/generate/testdata/snapshots/TestGenerate-Recursion.graphql-Recursion.graphql.go b/generate/testdata/snapshots/TestGenerate-Recursion.graphql-Recursion.graphql.go index ce07a485..61eafc1f 100644 --- a/generate/testdata/snapshots/TestGenerate-Recursion.graphql-Recursion.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-Recursion.graphql-Recursion.graphql.go @@ -72,7 +72,7 @@ func Recursion( client graphql.Client, input RecursiveInput, ) (*RecursionResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "Recursion", Query: ` query Recursion ($input: RecursiveInput!) { diff --git a/generate/testdata/snapshots/TestGenerate-SimpleInlineFragment.graphql-SimpleInlineFragment.graphql.go b/generate/testdata/snapshots/TestGenerate-SimpleInlineFragment.graphql-SimpleInlineFragment.graphql.go index 2227003f..a21e7f41 100644 --- a/generate/testdata/snapshots/TestGenerate-SimpleInlineFragment.graphql-SimpleInlineFragment.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-SimpleInlineFragment.graphql-SimpleInlineFragment.graphql.go @@ -242,7 +242,7 @@ func (v *SimpleInlineFragmentResponse) __premarshalJSON() (*__premarshalSimpleIn func SimpleInlineFragment( client graphql.Client, ) (*SimpleInlineFragmentResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleInlineFragment", Query: ` query SimpleInlineFragment { diff --git a/generate/testdata/snapshots/TestGenerate-SimpleInput.graphql-SimpleInput.graphql.go b/generate/testdata/snapshots/TestGenerate-SimpleInput.graphql-SimpleInput.graphql.go index f689b585..20d13207 100644 --- a/generate/testdata/snapshots/TestGenerate-SimpleInput.graphql-SimpleInput.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-SimpleInput.graphql-SimpleInput.graphql.go @@ -45,7 +45,7 @@ func SimpleInputQuery( client graphql.Client, name string, ) (*SimpleInputQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleInputQuery", Query: ` query SimpleInputQuery ($name: String!) { diff --git a/generate/testdata/snapshots/TestGenerate-SimpleMutation.graphql-SimpleMutation.graphql.go b/generate/testdata/snapshots/TestGenerate-SimpleMutation.graphql-SimpleMutation.graphql.go index 66f3a4ce..283a8a53 100644 --- a/generate/testdata/snapshots/TestGenerate-SimpleMutation.graphql-SimpleMutation.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-SimpleMutation.graphql-SimpleMutation.graphql.go @@ -49,7 +49,7 @@ func SimpleMutation( client graphql.Client, name string, ) (*SimpleMutationResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleMutation", Query: ` mutation SimpleMutation ($name: String!) { diff --git a/generate/testdata/snapshots/TestGenerate-SimpleNamedFragment.graphql-SimpleNamedFragment.graphql.go b/generate/testdata/snapshots/TestGenerate-SimpleNamedFragment.graphql-SimpleNamedFragment.graphql.go index 5ca9c01d..175c50a9 100644 --- a/generate/testdata/snapshots/TestGenerate-SimpleNamedFragment.graphql-SimpleNamedFragment.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-SimpleNamedFragment.graphql-SimpleNamedFragment.graphql.go @@ -549,7 +549,7 @@ func (v *VideoFieldsThumbnail) GetId() testutil.ID { return v.Id } func SimpleNamedFragment( client graphql.Client, ) (*SimpleNamedFragmentResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleNamedFragment", Query: ` query SimpleNamedFragment { diff --git a/generate/testdata/snapshots/TestGenerate-SimpleQuery.graphql-SimpleQuery.graphql.go b/generate/testdata/snapshots/TestGenerate-SimpleQuery.graphql-SimpleQuery.graphql.go index fd843199..589a50a3 100644 --- a/generate/testdata/snapshots/TestGenerate-SimpleQuery.graphql-SimpleQuery.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-SimpleQuery.graphql-SimpleQuery.graphql.go @@ -36,7 +36,7 @@ func (v *SimpleQueryUser) GetId() testutil.ID { return v.Id } func SimpleQuery( client graphql.Client, ) (*SimpleQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/generate/testdata/snapshots/TestGenerate-StructOption.graphql-StructOption.graphql.go b/generate/testdata/snapshots/TestGenerate-StructOption.graphql-StructOption.graphql.go index 06ec1c7c..de07f933 100644 --- a/generate/testdata/snapshots/TestGenerate-StructOption.graphql-StructOption.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-StructOption.graphql-StructOption.graphql.go @@ -427,7 +427,7 @@ func (v *VideoFields) GetDuration() int { return v.Duration } func StructOption( client graphql.Client, ) (*StructOptionResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "StructOption", Query: ` query StructOption { diff --git a/generate/testdata/snapshots/TestGenerate-TypeName.graphql-TypeName.graphql.go b/generate/testdata/snapshots/TestGenerate-TypeName.graphql-TypeName.graphql.go index efd07c7e..ba8d8e64 100644 --- a/generate/testdata/snapshots/TestGenerate-TypeName.graphql-TypeName.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-TypeName.graphql-TypeName.graphql.go @@ -40,7 +40,7 @@ func (v *TypeNameQueryUser) GetId() testutil.ID { return v.Id } func TypeNameQuery( client graphql.Client, ) (*TypeNameQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "TypeNameQuery", Query: ` query TypeNameQuery { diff --git a/generate/testdata/snapshots/TestGenerate-TypeNames.graphql-TypeNames.graphql.go b/generate/testdata/snapshots/TestGenerate-TypeNames.graphql-TypeNames.graphql.go index 9e8cac34..fc35a5d8 100644 --- a/generate/testdata/snapshots/TestGenerate-TypeNames.graphql-TypeNames.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-TypeNames.graphql-TypeNames.graphql.go @@ -267,7 +267,7 @@ func (v *User) GetName() string { return v.Name } func TypeNames( client graphql.Client, ) (*Resp, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "TypeNames", Query: ` query TypeNames { diff --git a/generate/testdata/snapshots/TestGenerate-UnionNoFragments.graphql-UnionNoFragments.graphql.go b/generate/testdata/snapshots/TestGenerate-UnionNoFragments.graphql-UnionNoFragments.graphql.go index 5c6868d5..44d17710 100644 --- a/generate/testdata/snapshots/TestGenerate-UnionNoFragments.graphql-UnionNoFragments.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-UnionNoFragments.graphql-UnionNoFragments.graphql.go @@ -177,7 +177,7 @@ func (v *UnionNoFragmentsQueryResponse) __premarshalJSON() (*__premarshalUnionNo func UnionNoFragmentsQuery( client graphql.Client, ) (*UnionNoFragmentsQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "UnionNoFragmentsQuery", Query: ` query UnionNoFragmentsQuery { diff --git a/generate/testdata/snapshots/TestGenerate-UsesEnumTwice.graphql-UsesEnumTwice.graphql.go b/generate/testdata/snapshots/TestGenerate-UsesEnumTwice.graphql-UsesEnumTwice.graphql.go index 324232a5..8cbc3bdd 100644 --- a/generate/testdata/snapshots/TestGenerate-UsesEnumTwice.graphql-UsesEnumTwice.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-UsesEnumTwice.graphql-UsesEnumTwice.graphql.go @@ -65,7 +65,7 @@ func (v *UsesEnumTwiceQueryResponse) GetOtherUser() UsesEnumTwiceQueryOtherUser func UsesEnumTwiceQuery( client graphql.Client, ) (*UsesEnumTwiceQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "UsesEnumTwiceQuery", Query: ` query UsesEnumTwiceQuery { diff --git a/generate/testdata/snapshots/TestGenerate-unexported.graphql-unexported.graphql.go b/generate/testdata/snapshots/TestGenerate-unexported.graphql-unexported.graphql.go index a4fdb723..d26881bd 100644 --- a/generate/testdata/snapshots/TestGenerate-unexported.graphql-unexported.graphql.go +++ b/generate/testdata/snapshots/TestGenerate-unexported.graphql-unexported.graphql.go @@ -181,7 +181,7 @@ func unexported( client graphql.Client, query UserQueryInput, ) (*unexportedResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "unexported", Query: ` query unexported ($query: UserQueryInput) { diff --git a/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetter-testdata-queries-generated.go b/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetter-testdata-queries-generated.go index bec4045d..8cea8275 100644 --- a/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetter-testdata-queries-generated.go +++ b/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetter-testdata-queries-generated.go @@ -38,7 +38,7 @@ func (v *SimpleQueryUser) GetId() string { return v.Id } func SimpleQuery( ctx context.Context, ) (*SimpleQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetterCustomContext-testdata-queries-generated.go b/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetterCustomContext-testdata-queries-generated.go index d76501d1..485e0b74 100644 --- a/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetterCustomContext-testdata-queries-generated.go +++ b/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetterCustomContext-testdata-queries-generated.go @@ -41,7 +41,7 @@ func (v *SimpleQueryUser) GetId() string { return v.Id } func SimpleQuery( ctx testutil.MyContext, ) (*SimpleQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetterNoContext-testdata-queries-generated.go b/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetterNoContext-testdata-queries-generated.go index da22afb4..602ac866 100644 --- a/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetterNoContext-testdata-queries-generated.go +++ b/generate/testdata/snapshots/TestGenerateWithConfig-ClientGetterNoContext-testdata-queries-generated.go @@ -34,7 +34,7 @@ type SimpleQueryUser struct { func (v *SimpleQueryUser) GetId() string { return v.Id } func SimpleQuery() (*SimpleQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/generate/testdata/snapshots/TestGenerateWithConfig-CustomContext-testdata-queries-generated.go b/generate/testdata/snapshots/TestGenerateWithConfig-CustomContext-testdata-queries-generated.go index df3597a2..7a345af2 100644 --- a/generate/testdata/snapshots/TestGenerateWithConfig-CustomContext-testdata-queries-generated.go +++ b/generate/testdata/snapshots/TestGenerateWithConfig-CustomContext-testdata-queries-generated.go @@ -42,7 +42,7 @@ func SimpleQuery( ctx testutil.MyContext, client graphql.Client, ) (*SimpleQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/generate/testdata/snapshots/TestGenerateWithConfig-DefaultConfig-testdata-queries-generated.go b/generate/testdata/snapshots/TestGenerateWithConfig-DefaultConfig-testdata-queries-generated.go index 6aaf238e..035ca9e8 100644 --- a/generate/testdata/snapshots/TestGenerateWithConfig-DefaultConfig-testdata-queries-generated.go +++ b/generate/testdata/snapshots/TestGenerateWithConfig-DefaultConfig-testdata-queries-generated.go @@ -38,7 +38,7 @@ func SimpleQuery( ctx context.Context, client graphql.Client, ) (*SimpleQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/generate/testdata/snapshots/TestGenerateWithConfig-ExportOperations-testdata-queries-generated.go b/generate/testdata/snapshots/TestGenerateWithConfig-ExportOperations-testdata-queries-generated.go index 6aaf238e..035ca9e8 100644 --- a/generate/testdata/snapshots/TestGenerateWithConfig-ExportOperations-testdata-queries-generated.go +++ b/generate/testdata/snapshots/TestGenerateWithConfig-ExportOperations-testdata-queries-generated.go @@ -38,7 +38,7 @@ func SimpleQuery( ctx context.Context, client graphql.Client, ) (*SimpleQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/generate/testdata/snapshots/TestGenerateWithConfig-Extensions-testdata-queries-generated.go b/generate/testdata/snapshots/TestGenerateWithConfig-Extensions-testdata-queries-generated.go index f7eaa8f3..3246165d 100644 --- a/generate/testdata/snapshots/TestGenerateWithConfig-Extensions-testdata-queries-generated.go +++ b/generate/testdata/snapshots/TestGenerateWithConfig-Extensions-testdata-queries-generated.go @@ -38,7 +38,7 @@ func SimpleQuery( ctx context.Context, client graphql.Client, ) (*SimpleQueryResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/generate/testdata/snapshots/TestGenerateWithConfig-NoContext-testdata-queries-generated.go b/generate/testdata/snapshots/TestGenerateWithConfig-NoContext-testdata-queries-generated.go index 9d62c480..b689d31b 100644 --- a/generate/testdata/snapshots/TestGenerateWithConfig-NoContext-testdata-queries-generated.go +++ b/generate/testdata/snapshots/TestGenerateWithConfig-NoContext-testdata-queries-generated.go @@ -35,7 +35,7 @@ func (v *SimpleQueryUser) GetId() string { return v.Id } func SimpleQuery( client graphql.Client, ) (*SimpleQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/generate/testdata/snapshots/TestGenerateWithConfig-PackageName-testdata-queries-myfile.go b/generate/testdata/snapshots/TestGenerateWithConfig-PackageName-testdata-queries-myfile.go index 48d86cc9..e88ab2c2 100644 --- a/generate/testdata/snapshots/TestGenerateWithConfig-PackageName-testdata-queries-myfile.go +++ b/generate/testdata/snapshots/TestGenerateWithConfig-PackageName-testdata-queries-myfile.go @@ -38,7 +38,7 @@ func SimpleQuery( ctx context.Context, client graphql.Client, ) (*SimpleQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/generate/testdata/snapshots/TestGenerateWithConfig-StructReferences-testdata-queries-generated-structrefs.go b/generate/testdata/snapshots/TestGenerateWithConfig-StructReferences-testdata-queries-generated-structrefs.go index f0bfaf97..85356e26 100644 --- a/generate/testdata/snapshots/TestGenerateWithConfig-StructReferences-testdata-queries-generated-structrefs.go +++ b/generate/testdata/snapshots/TestGenerateWithConfig-StructReferences-testdata-queries-generated-structrefs.go @@ -38,7 +38,7 @@ func SimpleQuery( ctx context.Context, client graphql.Client, ) (*SimpleQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/generate/testdata/snapshots/TestGenerateWithConfig-Subpackage-testdata-queries-mypkg-myfile.go b/generate/testdata/snapshots/TestGenerateWithConfig-Subpackage-testdata-queries-mypkg-myfile.go index 48d86cc9..e88ab2c2 100644 --- a/generate/testdata/snapshots/TestGenerateWithConfig-Subpackage-testdata-queries-mypkg-myfile.go +++ b/generate/testdata/snapshots/TestGenerateWithConfig-Subpackage-testdata-queries-mypkg-myfile.go @@ -38,7 +38,7 @@ func SimpleQuery( ctx context.Context, client graphql.Client, ) (*SimpleQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/generate/testdata/snapshots/TestGenerateWithConfig-SubpackageConfig-testdata-queries-mypkg-myfile.go b/generate/testdata/snapshots/TestGenerateWithConfig-SubpackageConfig-testdata-queries-mypkg-myfile.go index 48d86cc9..e88ab2c2 100644 --- a/generate/testdata/snapshots/TestGenerateWithConfig-SubpackageConfig-testdata-queries-mypkg-myfile.go +++ b/generate/testdata/snapshots/TestGenerateWithConfig-SubpackageConfig-testdata-queries-mypkg-myfile.go @@ -38,7 +38,7 @@ func SimpleQuery( ctx context.Context, client graphql.Client, ) (*SimpleQueryResponse, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "SimpleQuery", Query: ` query SimpleQuery { diff --git a/graphql/client.go b/graphql/client.go index a2233147..1d9486ee 100644 --- a/graphql/client.go +++ b/graphql/client.go @@ -40,7 +40,7 @@ type Client interface { // (Errors are returned.) But again, MakeRequest may customize this. MakeRequest( ctx context.Context, - req *Payload, + req *Request, resp *Response, ) error } @@ -74,9 +74,9 @@ type Doer interface { Do(*http.Request) (*http.Response, error) } -// Payload contains all the values required to build queries executed by +// Request contains all the values required to build queries executed by // the graphql.Client. -type Payload struct { +type Request struct { Query string `json:"query"` Variables interface{} `json:"variables,omitempty"` // OpName is only required if there are multiple queries in the document, @@ -92,7 +92,7 @@ type Response struct { Errors gqlerror.List `json:"errors,omitempty"` } -func (c *client) MakeRequest(ctx context.Context, req *Payload, resp *Response) error { +func (c *client) MakeRequest(ctx context.Context, req *Request, resp *Response) error { body, err := json.Marshal(req) if err != nil { return err diff --git a/internal/integration/generated.go b/internal/integration/generated.go index 006a8a4c..08593b2b 100644 --- a/internal/integration/generated.go +++ b/internal/integration/generated.go @@ -3047,7 +3047,7 @@ func failingQuery( ctx context.Context, client graphql.Client, ) (*failingQueryResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "failingQuery", Query: ` query failingQuery { @@ -3079,7 +3079,7 @@ func queryWithCustomMarshal( client graphql.Client, date time.Time, ) (*queryWithCustomMarshalResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "queryWithCustomMarshal", Query: ` query queryWithCustomMarshal ($date: Date!) { @@ -3116,7 +3116,7 @@ func queryWithCustomMarshalOptional( date *time.Time, id *string, ) (*queryWithCustomMarshalOptionalResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "queryWithCustomMarshalOptional", Query: ` query queryWithCustomMarshalOptional ($date: Date, $id: ID) { @@ -3153,7 +3153,7 @@ func queryWithCustomMarshalSlice( client graphql.Client, dates []time.Time, ) (*queryWithCustomMarshalSliceResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "queryWithCustomMarshalSlice", Query: ` query queryWithCustomMarshalSlice ($dates: [Date!]!) { @@ -3189,7 +3189,7 @@ func queryWithFlatten( client graphql.Client, ids []string, ) (*QueryFragment, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "queryWithFlatten", Query: ` query queryWithFlatten ($ids: [ID!]!) { @@ -3259,7 +3259,7 @@ func queryWithFragments( client graphql.Client, ids []string, ) (*queryWithFragmentsResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "queryWithFragments", Query: ` query queryWithFragments ($ids: [ID!]!) { @@ -3323,7 +3323,7 @@ func queryWithInterfaceListField( client graphql.Client, ids []string, ) (*queryWithInterfaceListFieldResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "queryWithInterfaceListField", Query: ` query queryWithInterfaceListField ($ids: [ID!]!) { @@ -3359,7 +3359,7 @@ func queryWithInterfaceListPointerField( client graphql.Client, ids []string, ) (*queryWithInterfaceListPointerFieldResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "queryWithInterfaceListPointerField", Query: ` query queryWithInterfaceListPointerField ($ids: [ID!]!) { @@ -3395,7 +3395,7 @@ func queryWithInterfaceNoFragments( client graphql.Client, id string, ) (*queryWithInterfaceNoFragmentsResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "queryWithInterfaceNoFragments", Query: ` query queryWithInterfaceNoFragments ($id: ID!) { @@ -3435,7 +3435,7 @@ func queryWithNamedFragments( client graphql.Client, ids []string, ) (*queryWithNamedFragmentsResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "queryWithNamedFragments", Query: ` query queryWithNamedFragments ($ids: [ID!]!) { @@ -3499,7 +3499,7 @@ func queryWithOmitempty( client graphql.Client, id string, ) (*queryWithOmitemptyResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "queryWithOmitempty", Query: ` query queryWithOmitempty ($id: ID) { @@ -3535,7 +3535,7 @@ func queryWithVariables( client graphql.Client, id string, ) (*queryWithVariablesResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "queryWithVariables", Query: ` query queryWithVariables ($id: ID!) { @@ -3570,7 +3570,7 @@ func simpleQuery( ctx context.Context, client graphql.Client, ) (*simpleQueryResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "simpleQuery", Query: ` query simpleQuery { @@ -3602,7 +3602,7 @@ func simpleQueryExt( ctx context.Context, client graphql.Client, ) (*simpleQueryExtResponse, map[string]interface{}, error) { - req := &graphql.Payload{ + req := &graphql.Request{ OpName: "simpleQueryExt", Query: ` query simpleQueryExt { diff --git a/internal/integration/roundtrip.go b/internal/integration/roundtrip.go index 583b4441..4653b18e 100644 --- a/internal/integration/roundtrip.go +++ b/internal/integration/roundtrip.go @@ -88,7 +88,7 @@ func (c *roundtripClient) roundtripResponse(resp interface{}) { assert.Equal(c.t, string(body), string(bodyAgain)) } -func (c *roundtripClient) MakeRequest(ctx context.Context, req *graphql.Payload, resp *graphql.Response) error { +func (c *roundtripClient) MakeRequest(ctx context.Context, req *graphql.Request, resp *graphql.Response) error { // TODO(benkraft): Also check the variables round-trip. This is a bit less // important since most of the code is the same (and input types are // strictly simpler), and a bit hard to do because when asserting about