import json, subprocess

def api(path, **fields):
    args = ['glab', 'api', path, '--method', 'POST']
    for key, value in fields.items(): args += ['-f', f'{key}={value}']
    return json.loads(subprocess.check_output(args))

project = api('projects', name='factory-44511-readable-proof', visibility='private', initialize_with_readme='true')
p = f"projects/{project['id']}"
for title in ['किताब', 'cafe\u0301 menu', 'unrelated bug']:
    api(p + '/issues', title=title)
api(p + '/repository/branches', branch='proof', ref='main')
api(p + '/repository/files/proof.txt', branch='proof', content='Synthetic proof', commit_message='proof')
api(p + '/merge_requests', source_branch='proof', target_branch='main', title='किताब')
print(project['path_with_namespace'])
