dvcurator.github_projectv2

Module Contents

Functions

gql_query(query, token[, params])

Run a gql API query on Github

get_org_id(endpoint[, token])

Get the ID of an organization

get_team_id(team, token[, org])

Get node ID of a team

get_repo(token, search[, repo])

Get the ID of a repository

alter_column(project_id, item_id, field_id, option_id, ...)

Put a created issue into a different column

draft_issue(pid, template, token)

Create a draft issue in a project based on a template

new_projectv2(dv, title, token)

Create new github project (version 2)

generate_templatev2(dv, project_name, token)

Create new github project and associated tickets for a project

add_issue(project_name, template, repo, pid, token)

Create an issue and associate it with a project v2

Attributes

github_api

dvcurator.github_projectv2.github_api = 'https://api.github.com'
dvcurator.github_projectv2.gql_query(query, token, params=None)

Run a gql API query on Github

Parameters:
  • query (string) – The gql query

  • token (string) – Github API token

  • params (dict) – Parameters to pass to the gql query

Returns:

The response from the API

dvcurator.github_projectv2.get_org_id(endpoint, token=None)

Get the ID of an organization

Parameters:
  • endpoint (string) – Name of the organization

  • token (string) – Github API token

Returns:

Organization github ID

Return type:

string

dvcurator.github_projectv2.get_team_id(team, token, org=None)

Get node ID of a team

Parameters:
  • team (string) – Name of the team (slug format, i.e. “Curation and recruitment” becomes “curation-and-recruitment”)

  • token (string) – Github API token

  • org (string) – Github organization, defaults to github_org in hosts.py

Returns:

Node ID of the team

Return type:

string

dvcurator.github_projectv2.get_repo(token, search, repo=None)

Get the ID of a repository

Parameters:
  • token (string) – Github API token

  • search (string) – Name of a project to search for an existing one

  • repo (string) – Github repository (e.g. QualitativeDataRepository/dvcurator-python)

Returns:

ID of the repository, or none if an existing project is detected

Return type:

string

dvcurator.github_projectv2.alter_column(project_id, item_id, field_id, option_id, token)

Put a created issue into a different column

Parameters:
  • project_id (string) – Project ID

  • item_id (string) – Issue ID

  • field_id (string) – ID of the columns option

  • option_id (string) – ID of the option to change to (i.e. which column)

  • token (string) – Github API token

Returns:

results of API query

dvcurator.github_projectv2.draft_issue(pid, template, token)

Create a draft issue in a project based on a template

Parameters:
  • pid (String) – Github project ID

  • template (Path, as string) – Path to template txt file

  • token (string) – Github API token

Returns:

ID of draft issue

Return type:

string

dvcurator.github_projectv2.new_projectv2(dv, title, token)

Create new github project (version 2)

Parameters:
  • dv – Dataverse metadata block from get_metadata()

  • title (string) – Title of the project

  • token (string) – Github API token

Returns:

ProjectV2 object from API

dvcurator.github_projectv2.generate_templatev2(dv, project_name, token)

Create new github project and associated tickets for a project

Parameters:
  • dv – Dataverse metadata block from get_metadata()

  • project_name (string) – Project name (used as prefix)

  • token (string) – Github API token

dvcurator.github_projectv2.add_issue(project_name, template, repo, pid, token)

Create an issue and associate it with a project v2

Parameters:
  • project_name (string) – Prefix to attach to the ticket name

  • template (Path, as string) – Path to the issue template that will be the body of the issue

  • repo (string) – Github repository (e.g. QualitativeDataRepository/dvcurator-python)

  • pid (string) – Project ID

  • token (string) – Github API token

Returns:

ID of the newly created issue, or the API error

Return type:

string or list[str]