Expose the graphql operation as a constant in the generated genqlient file (#238)
This allows client code to see the operation (query or mutation) exactly
as genqlient sends it over the wire. This data was already available in
the generated safelist.json file, but now it's easily available from Go
code as well.
Fixes #236
I have:
- [x] Written a clear PR title and description (above)
- [x] Signed the [Khan Academy CLA](https://www.khanacademy.org/r/cla)
- [x] Added tests covering my changes, if applicable
- [x] Included a link to the issue fixed, if applicable
- [x] Included documentation, for new features
- [x] Added an entry to the changelog
This commit is contained in:
Vendored
+10
-7
@@ -43,12 +43,8 @@ func (v *QueryWithStructsUserAuthMethodsAuthMethod) GetProvider() string { retur
|
||||
// GetEmail returns QueryWithStructsUserAuthMethodsAuthMethod.Email, and is useful for accessing the field via an interface.
|
||||
func (v *QueryWithStructsUserAuthMethodsAuthMethod) GetEmail() string { return v.Email }
|
||||
|
||||
func QueryWithStructs(
|
||||
client graphql.Client,
|
||||
) (*QueryWithStructsResponse, error) {
|
||||
req := &graphql.Request{
|
||||
OpName: "QueryWithStructs",
|
||||
Query: `
|
||||
// The query or mutation executed by QueryWithStructs.
|
||||
const QueryWithStructsOperation = `
|
||||
query QueryWithStructs {
|
||||
user {
|
||||
authMethods {
|
||||
@@ -57,7 +53,14 @@ query QueryWithStructs {
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
`
|
||||
|
||||
func QueryWithStructs(
|
||||
client graphql.Client,
|
||||
) (*QueryWithStructsResponse, error) {
|
||||
req := &graphql.Request{
|
||||
OpName: "QueryWithStructs",
|
||||
Query: QueryWithStructsOperation,
|
||||
}
|
||||
var err error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user