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
65 lines
1.5 KiB
Go
65 lines
1.5 KiB
Go
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
|
|
|
package test
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/Khan/genqlient/graphql"
|
|
)
|
|
|
|
// __convertTimezoneInput is used internally by genqlient
|
|
type __convertTimezoneInput struct {
|
|
Dt time.Time `json:"dt"`
|
|
Tz string `json:"tz"`
|
|
}
|
|
|
|
// GetDt returns __convertTimezoneInput.Dt, and is useful for accessing the field via an interface.
|
|
func (v *__convertTimezoneInput) GetDt() time.Time { return v.Dt }
|
|
|
|
// GetTz returns __convertTimezoneInput.Tz, and is useful for accessing the field via an interface.
|
|
func (v *__convertTimezoneInput) GetTz() string { return v.Tz }
|
|
|
|
// convertTimezoneResponse is returned by convertTimezone on success.
|
|
type convertTimezoneResponse struct {
|
|
Convert time.Time `json:"convert"`
|
|
}
|
|
|
|
// GetConvert returns convertTimezoneResponse.Convert, and is useful for accessing the field via an interface.
|
|
func (v *convertTimezoneResponse) GetConvert() time.Time { return v.Convert }
|
|
|
|
// The query or mutation executed by convertTimezone.
|
|
const convertTimezoneOperation = `
|
|
query convertTimezone ($dt: DateTime!, $tz: String) {
|
|
convert(dt: $dt, tz: $tz)
|
|
}
|
|
`
|
|
|
|
func convertTimezone(
|
|
client graphql.Client,
|
|
dt time.Time,
|
|
tz string,
|
|
) (*convertTimezoneResponse, error) {
|
|
req := &graphql.Request{
|
|
OpName: "convertTimezone",
|
|
Query: convertTimezoneOperation,
|
|
Variables: &__convertTimezoneInput{
|
|
Dt: dt,
|
|
Tz: tz,
|
|
},
|
|
}
|
|
var err error
|
|
|
|
var data convertTimezoneResponse
|
|
resp := &graphql.Response{Data: &data}
|
|
|
|
err = client.MakeRequest(
|
|
nil,
|
|
req,
|
|
resp,
|
|
)
|
|
|
|
return &data, err
|
|
}
|
|
|