-
Hello, I have problems, I want to convert: This is what I got:
The code that is calling it:
Thank you :) I have read the mutation section in the readme, I am beginning to learn GraphQL and still have not wrapped my head around it I have problem figuring out how I can get the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
One path you can try is to define a struct that corresponds to the input and pass that in. For example: type CreateOneAppInput struct {
App struct {
Slug string `json:"slug"`
} `json:"app"`
}
var input CreateOneAppInput
input.App.Slug = "amazing-app-name"
err := client2.Mutate(context.Background(), &models.CreateApp, map[string]interface{}{"input": input})
// ... That's the general approach I've used for mutations when dealing with GitHub's GraphQL API (see input.go in the Alternatively, you might be able to make a smaller adjustment to your code. It seems to be missing the "input" layer. Notably, it's present in the GraphQL mutation you mentioned:
But not in the call to
Try making that:
There may be more nuances to get right, but perhaps this'll steer your attempt in the right direction. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your help. This is what the mutation looks like in GraphQL playground:
This is what the response looks like:
This is what I currently have:
This is the error I get:
also tried:
With the same response |
Beta Was this translation helpful? Give feedback.
-
Tried it, getting following error:
|
Beta Was this translation helpful? Give feedback.
Tried it, getting following error: