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:
+10
-7
@@ -424,12 +424,8 @@ type VideoFields struct {
|
||||
// GetDuration returns VideoFields.Duration, and is useful for accessing the field via an interface.
|
||||
func (v *VideoFields) GetDuration() int { return v.Duration }
|
||||
|
||||
func StructOption(
|
||||
client graphql.Client,
|
||||
) (*StructOptionResponse, error) {
|
||||
req := &graphql.Request{
|
||||
OpName: "StructOption",
|
||||
Query: `
|
||||
// The query or mutation executed by StructOption.
|
||||
const StructOptionOperation = `
|
||||
query StructOption {
|
||||
root {
|
||||
id
|
||||
@@ -457,7 +453,14 @@ query StructOption {
|
||||
fragment VideoFields on Video {
|
||||
duration
|
||||
}
|
||||
`,
|
||||
`
|
||||
|
||||
func StructOption(
|
||||
client graphql.Client,
|
||||
) (*StructOptionResponse, error) {
|
||||
req := &graphql.Request{
|
||||
OpName: "StructOption",
|
||||
Query: StructOptionOperation,
|
||||
}
|
||||
var err error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user