shurcooL / graphql

Package graphql provides a GraphQL client implementation.
MIT License
709 stars 282 forks source link

How to define struct #106

Closed Ignorant-lxf closed 4 months ago

Ignorant-lxf commented 1 year ago

Hi,I wanna to invoke an graphql api,but the request body about struct is too long! I need help for how to define struct like thie:

mutation {
    createShoppingProducts( 
        adId: "12345678", 
        shoppingProducts: [
            {
                id: "P11", 
                title: "New Earpods", 
                description: "Noise cancellation enabled earpods", 
                price: {
                    amount: "111.5", 
                    currency: "USD"
                }, 
                availability: "in stock", 
                condition: "Used", 
                link: "https://xxx.com"
            }
        ]
    ) {
        response {
            id
            title
            price {
                amount
            }
        }
        errors {
            id
            field
            messages
            warnings
            originalValue
        }
    }
}

Look forward to reply!

Ignorant-lxf commented 1 year ago

@dmitshur @shuheiktgw @david-bain

dthisner commented 1 year ago

Can you please share what you have gotten so far along with the error you see? :)

koote commented 6 months ago

first part is the filter, second part is the query struct, not very complicate i think?