MCPcopy
hub / github.com/PyGithub/PyGithub / graphql_named_mutation

Method graphql_named_mutation

github/Requester.py:812–838  ·  view source on GitHub ↗

Send a GraphQL mutation to the GraphQL API. This sends the following GraphQL request:: mutation Mutation($input: MutationNameInput!) { mutationName(input: $input) { } } Uses :func:`graphql

(
        self, mutation_name: str, mutation_input: dict[str, Any], output_schema: str
    )

Source from the content-addressed store, hash-verified

810 return self.data_as_class(headers, data, ["data", "node"], klass)
811
812 def graphql_named_mutation(
813 self, mutation_name: str, mutation_input: dict[str, Any], output_schema: str
814 ) -> tuple[dict[str, Any], dict[str, Any]]:
815 """
816 Send a GraphQL mutation to the GraphQL API.
817
818 This sends the following GraphQL request::
819
820 mutation Mutation($input: MutationNameInput!) {
821 mutationName(input: $input) {
822 <output_schema>
823 }
824 }
825
826 Uses :func:`graphql_query` to send the request to the GraphQL API.
827
828 :param mutation_name: name of the mutation
829 :param mutation_input: input data for the mutation
830 :param output_schema: The schema of the retrieved properties of the mutation, without enclosing curly brackets
831 :return: ``(headers: dict, JSON Response: dict)``
832 :raises: :class:`GithubException` for error status codes
833
834 """
835 mutation_input_name = mutation_name[:1].upper() + mutation_name[1:] + "Input!"
836 query = f"mutation Mutation($input: {mutation_input_name}) {{ {mutation_name}(input: $input) {{ {output_schema} }} }}"
837 headers, data = self.graphql_query(query, {"input": mutation_input})
838 return headers, data.get("data", {}).get(mutation_name, {})
839
840 def graphql_named_mutation_class(
841 self, mutation_name: str, mutation_input: dict[str, Any], output_schema: str, item: str, klass: type[T_gh]

Callers 8

enable_automergeMethod · 0.80
disable_automergeMethod · 0.80
convert_to_draftMethod · 0.80
mark_ready_for_reviewMethod · 0.80
minimizeMethod · 0.80
unminimizeMethod · 0.80
testMutationMethod · 0.80

Calls 2

graphql_queryMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected