import json, os, urllib.request
# Load the test credential into the environment before running; never print it.
query = "mutation($input: IssueCreateInput!) { issueCreate(input:$input) { success issue { id identifier url title } } }"
payload = {"query": query, "variables": {"input": {"teamId": os.environ["LINEAR_TEST_TEAM_ID"], "title": "Factory 38742 evidence: open Linear link in issue panel", "description": "Synthetic issue for the before and after link interaction."}}}
request = urllib.request.Request("https://api.linear.app/graphql", data=json.dumps(payload).encode(), headers={"Authorization": os.environ["LINEAR_API_KEY"], "Content-Type": "application/json"})
print(json.dumps(json.load(urllib.request.urlopen(request))))
# Use the returned identifier and URL in the scenario. Archive the returned issue id afterward.
