Method: Appwrite::Graphql#mutation

Defined in:
lib/appwrite/services/graphql.rb

#mutation(query:) ⇒ Any

Execute a GraphQL mutation.

Parameters:

  • query (Hash)

    The query or queries to execute.

Returns:

  • (Any)


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/appwrite/services/graphql.rb', line 45

def mutation(query:)
    path = '/graphql/mutation'

    if query.nil?
      raise Appwrite::Exception.new('Missing required parameter: "query"')
    end

    params = {
        query: query,
    }
    
    headers = {
        "x-sdk-graphql": 'true',
        "content-type": 'application/json',
    }

    @client.call(
        method: 'POST',
        path: path,
        headers: headers,
        params: params,
    )
end