Skip to content

git

Accessed as client.repos.hooks.git; the async client mirrors it.

ReposHooksGit

The repos.hooks.git namespace.

delete

delete(owner: str, repo: str, id: str) -> None

Delete a Git hook in a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id str

id of the hook to get

required

Returns:

Type Description
None

No content.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoDeleteGitHook

get

get(owner: str, repo: str, id: str) -> GitHook

Get a Git hook.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id str

id of the hook to get

required

Returns:

Type Description
GitHook

GitHook.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetGitHook

list

list(owner: str, repo: str) -> list[GitHook]

List the Git hooks in a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
list[GitHook]

GitHookList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoListGitHooks

update

update(owner: str, repo: str, id: str, *, content: str | None = None) -> GitHook

Edit a Git hook in a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id str

id of the hook to get

required
content str | None
None

Returns:

Type Description
GitHook

GitHook.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoEditGitHook

AsyncReposHooksGit

The repos.hooks.git namespace.

delete

delete(owner: str, repo: str, id: str) -> None

Delete a Git hook in a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id str

id of the hook to get

required

Returns:

Type Description
None

No content.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoDeleteGitHook

get

get(owner: str, repo: str, id: str) -> GitHook

Get a Git hook.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id str

id of the hook to get

required

Returns:

Type Description
GitHook

GitHook.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoGetGitHook

list

list(owner: str, repo: str) -> list[GitHook]

List the Git hooks in a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required

Returns:

Type Description
list[GitHook]

GitHookList.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoListGitHooks

update

update(owner: str, repo: str, id: str, *, content: str | None = None) -> GitHook

Edit a Git hook in a repository.

Parameters:

Name Type Description Default
owner str

owner of the repo

required
repo str

name of the repo

required
id str

id of the hook to get

required
content str | None
None

Returns:

Type Description
GitHook

GitHook.

Raises:

Type Description
NotFoundError
  1. APINotFound is a not found error response.

Operation ID: repoEditGitHook