mirror of
https://github.com/zeldaret/tp
synced 2026-08-11 19:39:16 -04:00
Assignees (#1876)
* checkpoint * finish adding assignee support * test * use test command * use test command * skip build check * add state to common options, move version check * cleanup ok-check * undo dylink change
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
from .graphql import GraphQLClient
|
||||
from logger import LOG
|
||||
|
||||
import sys
|
||||
|
||||
class User:
|
||||
def __init__(self, id = None, name = None):
|
||||
self.id = id
|
||||
self.name = name
|
||||
|
||||
def get_id(self):
|
||||
LOG.debug(f'Fetch ID for user {self.name}')
|
||||
|
||||
query = '''
|
||||
query ($name: String!) {
|
||||
user(login: $name) {
|
||||
id
|
||||
}
|
||||
}
|
||||
'''
|
||||
variables = {
|
||||
"name": self.name,
|
||||
}
|
||||
|
||||
data = GraphQLClient.get_instance().make_request(query, variables)
|
||||
if data:
|
||||
self.id = data['data']['user']['id']
|
||||
LOG.info(f"Found user {self.name} with ID {self.id}!")
|
||||
else:
|
||||
LOG.error(f'Failed to find user {self.name}!')
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user