Closed galambocskam closed 2 years ago
Hi, thanks for any help you may offer.
I need to mutate using this graphql mutation quide: https://shopify.dev/docs/admin-api/graphql/reference/mutation/inventoryadjustquantity?api[version]=2020-07
I looked here at the mutations example but surely I missed something or wrongfully applied the logic because I cannot get it to work: https://github.com/shurcooL/graphql
import ( "context" "fmt" shopifygraphql "github.com/r0busta/go-shopify-graphql" "github.com/shurcooL/graphql" ) func main() { // Create client opts := []shopifygraphql.Option{ shopifygraphql.WithVersion("2020-07"), shopifygraphql.WithPrivateAppAuth("myappkey", "myapppass"), } client := shopifygraphql.NewClient("myshopify", opts...) type InventoryAdjustQuantityInput struct { InventoryLevelId graphql.String AvailableDelta graphql.Int } var m struct { InventoryAdjustQuantity struct { InventoryLevel struct { ID graphql.String } } `graphql:"inventoryAdjustQuantity(input: $input)"` } vars := map[string]interface{}{ "input": InventoryAdjustQuantityInput{ InventoryLevelId: graphql.String("gid://shopify/Product/5544934473882"), AvailableDelta: graphql.Int(5), }, } err := client.Mutate(context.Background(), &m, vars) if err != nil { panic(err) } fmt.Printf("Inventory adjusted %v\n", m.InventoryAdjustQuantity.InventoryLevel.ID) }
What's your graphql string mutation that you're trying to build?
graphql
Hi, thanks for any help you may offer.
I need to mutate using this graphql mutation quide: https://shopify.dev/docs/admin-api/graphql/reference/mutation/inventoryadjustquantity?api[version]=2020-07
I looked here at the mutations example but surely I missed something or wrongfully applied the logic because I cannot get it to work: https://github.com/shurcooL/graphql