Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def execute(cls, client: GraphqlClient, locationID: str, parentLocationID: Optional[str] = None) -> MoveLocationMutationData.Location:
# fmt: off
variables: Dict[str, Any] = {"locationID": locationID, "parentLocationID": parentLocationID}
try:
network_start = perf_counter()
response_text = client.call(''.join(set(QUERY)), variables=variables)
decode_start = perf_counter()
res = cls.from_json(response_text).data
decode_time = perf_counter() - decode_start
network_time = decode_start - network_start
client.reporter.log_successful_operation("MoveLocationMutation", variables, network_time, decode_time)
return res.moveLocation
except OperationException as e:
raise FailedOperationException(
client.reporter,
e.err_msg,
e.err_id,
"MoveLocationMutation",
variables,
)
def execute(cls, client: GraphqlClient, input: EditEquipmentTypeInput) -> EditEquipmentTypeMutationData.EquipmentType:
# fmt: off
variables: Dict[str, Any] = {"input": input}
try:
network_start = perf_counter()
response_text = client.call(''.join(set(QUERY)), variables=variables)
decode_start = perf_counter()
res = cls.from_json(response_text).data
decode_time = perf_counter() - decode_start
network_time = decode_start - network_start
client.reporter.log_successful_operation("EditEquipmentTypeMutation", variables, network_time, decode_time)
return res.editEquipmentType
except OperationException as e:
raise FailedOperationException(
client.reporter,
e.err_msg,
e.err_id,
"EditEquipmentTypeMutation",
variables,
)
def execute(cls, client: GraphqlClient, id: str) -> Optional[ServiceEndpointsQueryData.Node]:
# fmt: off
variables: Dict[str, Any] = {"id": id}
try:
network_start = perf_counter()
response_text = client.call(''.join(set(QUERY)), variables=variables)
decode_start = perf_counter()
res = cls.from_json(response_text).data
decode_time = perf_counter() - decode_start
network_time = decode_start - network_start
client.reporter.log_successful_operation("ServiceEndpointsQuery", variables, network_time, decode_time)
return res.service
except OperationException as e:
raise FailedOperationException(
client.reporter,
e.err_msg,
e.err_id,
"ServiceEndpointsQuery",
variables,
)
def execute(cls, client: GraphqlClient, authID: str) -> Optional[UserQueryData.User]:
# fmt: off
variables: Dict[str, Any] = {"authID": authID}
try:
network_start = perf_counter()
response_text = client.call(''.join(set(QUERY)), variables=variables)
decode_start = perf_counter()
res = cls.from_json(response_text).data
decode_time = perf_counter() - decode_start
network_time = decode_start - network_start
client.reporter.log_successful_operation("UserQuery", variables, network_time, decode_time)
return res.user
except OperationException as e:
raise FailedOperationException(
client.reporter,
e.err_msg,
e.err_id,
"UserQuery",
variables,
)
name=location_name,
type=client.locationTypes[location_type].id,
latitude=lat,
longitude=long,
properties=properties,
externalID=externalID,
)
try:
result = AddLocationMutation.execute(
client, add_location_input
).__dict__[ADD_LOCATION_MUTATION_NAME]
client.reporter.log_successful_operation(
ADD_LOCATION_MUTATION_NAME, add_location_input.__dict__
)
except OperationException as e:
raise FailedOperationException(
client.reporter,
e.err_msg,
e.err_id,
ADD_LOCATION_MUTATION_NAME,
add_location_input.__dict__,
)
last_location = Location(
name=result.name,
id=result.id,
latitude=result.latitude,
longitude=result.longitude,
externalId=result.externalId,
locationTypeName=result.locationType.name,
)
else:
def execute(cls, client: GraphqlClient, id: str) -> str:
# fmt: off
variables: Dict[str, Any] = {"id": id}
try:
network_start = perf_counter()
response_text = client.call(''.join(set(QUERY)), variables=variables)
decode_start = perf_counter()
res = cls.from_json(response_text).data
decode_time = perf_counter() - decode_start
network_time = decode_start - network_start
client.reporter.log_successful_operation("RemoveServiceTypeMutation", variables, network_time, decode_time)
return res.removeServiceType
except OperationException as e:
raise FailedOperationException(
client.reporter,
e.err_msg,
e.err_id,
"RemoveServiceTypeMutation",
variables,
)
def execute(cls, client: GraphqlClient, data: SurveyCreateData) -> str:
# fmt: off
variables: Dict[str, Any] = {"data": data}
try:
network_start = perf_counter()
response_text = client.call(''.join(set(QUERY)), variables=variables)
decode_start = perf_counter()
res = cls.from_json(response_text).data
decode_time = perf_counter() - decode_start
network_time = decode_start - network_start
client.reporter.log_successful_operation("CreateSurveyMutation", variables, network_time, decode_time)
return res.createSurvey
except OperationException as e:
raise FailedOperationException(
client.reporter,
e.err_msg,
e.err_id,
"CreateSurveyMutation",
variables,
)
def execute(cls, client: GraphqlClient, input: EditEquipmentInput) -> EditEquipmentMutationData.Equipment:
# fmt: off
variables: Dict[str, Any] = {"input": input}
try:
network_start = perf_counter()
response_text = client.call(''.join(set(QUERY)), variables=variables)
decode_start = perf_counter()
res = cls.from_json(response_text).data
decode_time = perf_counter() - decode_start
network_time = decode_start - network_start
client.reporter.log_successful_operation("EditEquipmentMutation", variables, network_time, decode_time)
return res.editEquipment
except OperationException as e:
raise FailedOperationException(
client.reporter,
e.err_msg,
e.err_id,
"EditEquipmentMutation",
variables,
)
def execute(cls, client: GraphqlClient, input: EditLocationInput) -> EditLocationMutationData.Location:
# fmt: off
variables: Dict[str, Any] = {"input": input}
try:
network_start = perf_counter()
response_text = client.call(''.join(set(QUERY)), variables=variables)
decode_start = perf_counter()
res = cls.from_json(response_text).data
decode_time = perf_counter() - decode_start
network_time = decode_start - network_start
client.reporter.log_successful_operation("EditLocationMutation", variables, network_time, decode_time)
return res.editLocation
except OperationException as e:
raise FailedOperationException(
client.reporter,
e.err_msg,
e.err_id,
"EditLocationMutation",
variables,
)
def execute(cls, client: GraphqlClient, entityType: ImageEntity, entityId: str, id: str) -> DeleteImageMutationData.File:
# fmt: off
variables: Dict[str, Any] = {"entityType": entityType, "entityId": entityId, "id": id}
try:
network_start = perf_counter()
response_text = client.call(''.join(set(QUERY)), variables=variables)
decode_start = perf_counter()
res = cls.from_json(response_text).data
decode_time = perf_counter() - decode_start
network_time = decode_start - network_start
client.reporter.log_successful_operation("DeleteImageMutation", variables, network_time, decode_time)
return res.deleteImage
except OperationException as e:
raise FailedOperationException(
client.reporter,
e.err_msg,
e.err_id,
"DeleteImageMutation",
variables,
)