Coverage for graphqler / graph / node.py: 92%
13 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-20 10:09 -0400
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-20 10:09 -0400
1"""A node object
2Graphql type: One of [Object, Query, Mutation]
3"""
6class Node:
7 def __init__(self, graphql_type: str, name: str, body: dict):
8 """Initialize a node, saving information about the graphql type
10 Args:
11 graphql_type (str): One of [Object, Query, Mutation]
12 name (str): The name of the grpahql object
13 body (dict): The body of the graphql type
14 """
15 self.graphql_type = graphql_type
16 self.mutation_type = None
17 self.name = name
18 self.body = body
20 def set_mutation_type(self, mutation_type: str):
21 """Only use this if its a mutation type
23 Args:
24 mutation_type (str): One of [CREATE,UPDATE,DELETE,UNKNOWN]
25 """
26 if self.graphql_type == "Mutation":
27 self.mutation_type = mutation_type
29 def __str__(self):
30 return f"Node({self.graphql_type} | {self.name})"
32 def __repr__(self):
33 return f"Node({self.graphql_type} | {self.name})"