Module egithub

Main module that implements the functions to interact with the GitHub's API.

Description

Main module that implements the functions to interact with the GitHub's API.

Data Types

credentials()

credentials() = {basic, Username::string(), Password::string()} | {oauth, Token::string()}

issue_labels()

issue_labels() = [string()]

options()

options() = #{post_method => queue | run}

repository()

repository() = string()

"username/reponame"

result()

result() = ok | {ok, map() | [map()]} | egithub_req:error()

state()

state() = pending | success | error | failure

user()

user() = string() | undefined

Function Index

add_collaborator/3Add a collaborator to a repository.
add_team_member/3Add a member to a team.
add_team_repository/3Add a repository to a team.
all_issues/2List all issues across all the authenticated user's visible repositories including owned repositories, member repositories, and organization repositories.
all_issues/3List issues for a specific owner repository.
all_org_repos/3Same as all_repos/3 but for an organization.
all_repos/2Same as repos/2 but if there are a lot of repos that need to be paged handles the paging, asking for all pages until it gets an empty page.
all_repos/3Same as repos/3 but if there are a lot of repos that need to be paged handles the paging, asking for all pages until it gets an empty page.
basic_auth/2Takes a username and a password.
branch/3Get a single branch for a repository of the authenticated user.
branches/3List all branches for a repository for the authenticated user.
collaborators/2Get all collaborators in a repository.
combined_status/3Get a result with the combined values of all statuses for the provided repository and SHA.
create_issue/7Create an issue.
create_issue/8Create an issue.
create_issue/9Create an issue.
create_status/6Equivalent to create_status(Cred, Repo, Sha, State, Description, Context, undefined).
create_status/7Create a new status for the provided SHA.
create_team/5Creates a team in an organization.
create_webhook/4Create a webhook in a repository.
delete_team_member/3Delete a member from a team.
delete_webhook/3Delete a webhook from a repository.
dismiss_pr_review/5Takes valid credentials, a string representing a repository (i.e "username/reponame", the issue/pull number, review ID, and a PR review dismissal message.
file_content/4Fetches the contents of a file for a given repository and commit SHA.
hooks/2Get all hooks for a repository.
issue/3Get a single issue for a specific owner repository and its id.
issue_comment/4Equivalent to issue_comment(Cred, Repo, PR, Text, #{post_method => run}).
issue_comment/5Takes valid credentials, a string representing a repository (i.e "username/reponame", the issue number, the comment's text and some options.
issue_comments/3Takes valid credentials, a string representing a repository (i.e "username/reponame" and the issue number.
issues_org/3List all issues for a given organization for the authenticated user.
issues_user/2List all issues across owned and member repositories for the authenticated user.
languages/2
oauth/1Takes a valid OAuth token.
org_membership/2Check if the user associated with the provided credentials is a member of OrgName.
org_repos/3Same as repos/3 but for an organization.
orgs/1Get the organizations for the user associated with the provided credentials.
orgs/2Get the organizations for the user associated with the provided Username.
pr_review/5Takes valid credentials, a string representing a repository (i.e "username/reponame", the issue/pull number, the PR review object and some options.
pr_reviews/3Takes valid credentials, a string representing a repository (i.e "username/reponame", and the issue/pull number.
pull_req/3Get a list of details of a pull request by providing its number.
pull_req_comment_line/7Equivalent to pull_req_comment_line(Credentials, Repo, PR, CommitId, Filename, Line, Text, #{post_method => run}).
pull_req_comment_line/8Takes valid credentials, a string representing a repository (i.e "username/reponame", the pull request number, the commit SHA, the relative path to the repository's file, the line where the comment shuold be added, the comment's text and some options.
pull_req_comments/3Takes valid credentials, a string representing a repository (i.e "username/reponame" and the pull request number.
pull_req_files/3Takes valid credentials, a string representing a repository (i.e "username/reponame" and the pull request number.
pull_reqs/3List pull requests for a repository for the authenticated user.
release/3Get a single release for a repository of the authenticated user.
release_latest/2Get the latest release for a repository of the authenticated user.
releases/2List all releases for a repository for the authenticated user.
releases/3List all releases for a repository for the authenticated user.
remove_collaborator/3Remove a collaborator from a repository.
repo/2Get the repository information of RepoFullName (i.e.
repos/2Equivalent to repos(Cred, undefined, Opts).
repos/3Get the repositories associated with the user provided taking into account the options supplied.
statuses/3Get all statuses for the provided repository and SHA.
tag/3Get one tags for a repository of the authenticated user.
tags/3Get all of the tags for a repository of the authenticated user.
team_membership/3Check the membership of a user in a team.
teams/2Gets all the teams from an organization.
user/1Get the information for the user associated with the provided credentials.
user/2Get the information for the user associated with the provided Username.
user_emails/1Get the emails registered for the user associated with the provided credentials.

Function Details

add_collaborator/3

add_collaborator(Cred::credentials(), Repo::repository(), Collaborator::string()) -> result()

Add a collaborator to a repository.

add_team_member/3

add_team_member(Cred::credentials(), TeamId::integer(), Username::string()) -> result()

Add a member to a team.

add_team_repository/3

add_team_repository(Cred::credentials(), TeamId::integer(), RepoFullName::string()) -> result()

Add a repository to a team.

all_issues/2

all_issues(Cred::credentials(), Opts::map()) -> result()

List all issues across all the authenticated user's visible repositories including owned repositories, member repositories, and organization repositories

all_issues/3

all_issues(Cred::credentials(), Repo::repository(), Opts::map()) -> result()

List issues for a specific owner repository

all_org_repos/3

all_org_repos(Cred::credentials(), Org::string(), Opts::map()) -> result()

Same as all_repos/3 but for an organization.

all_repos/2

all_repos(Cred::credentials(), Opts::map()) -> result()

Same as repos/2 but if there are a lot of repos that need to be paged handles the paging, asking for all pages until it gets an empty page.

all_repos/3

all_repos(Cred::credentials(), User::string(), Opts::map()) -> result()

Same as repos/3 but if there are a lot of repos that need to be paged handles the paging, asking for all pages until it gets an empty page.

basic_auth/2

basic_auth(User::string(), Password::string()) -> egithub:credentials()

Takes a username and a password. Returns a value that can be used for basic authentication.

branch/3

branch(Cred::credentials(), Repo::repository(), Name::string()) -> result()

Get a single branch for a repository of the authenticated user.

branches/3

branches(Cred::credentials(), Repo::repository(), Opts::map()) -> result()

List all branches for a repository for the authenticated user

collaborators/2

collaborators(Cred::credentials(), Repo::repository()) -> result()

Get all collaborators in a repository.

combined_status/3

combined_status(Cred::credentials(), Repo::repository(), Ref::string()) -> result()

Get a result with the combined values of all statuses for the provided repository and SHA.

create_issue/7

create_issue(Cred::credentials(), Username::string(), Repo::repository(), Title::string(), Text::string(), Assignee::string(), Labels::issue_labels()) -> egithub_req:result()

Create an issue

create_issue/8

create_issue(Cred::credentials(), Username::string(), Repo::repository(), Title::string(), Text::string(), Assignee::string(), Milestone::pos_integer(), Labels::issue_labels()) -> result()

Create an issue

create_issue/9

create_issue(Cred::credentials(), Username::string(), Repo::repository(), Title::string(), Text::string(), Assignee::string(), Milestone::pos_integer(), Labels::issue_labels(), Options::options()) -> egithub_req:result() | ok

Create an issue

create_status/6

create_status(Cred::credentials(), Repo::repository(), Sha::string(), State::state(), Description::string(), Context::string()) -> result()

Equivalent to create_status(Cred, Repo, Sha, State, Description, Context, undefined).

create_status/7

create_status(Cred::credentials(), Repo::repository(), Sha::string(), State::state(), Description::string(), Context::string(), TargetUrl::string() | undefined) -> result()

Create a new status for the provided SHA.

create_team/5

create_team(Cred::credentials(), Org::string(), Name::string(), Permission::string(), Repos::[string()]) -> {ok, already_exists} | {ok, jsx:json_term()} | egithub_req:result()

Creates a team in an organization.

create_webhook/4

create_webhook(Cred::credentials(), Repo::repository(), WebhookUrl::string(), Events::[string()]) -> result()

Create a webhook in a repository.

delete_team_member/3

delete_team_member(Cred::credentials(), TeamId::integer(), Username::string()) -> result()

Delete a member from a team.

delete_webhook/3

delete_webhook(Cred::credentials(), Repo::repository(), Id::string()) -> result()

Delete a webhook from a repository.

dismiss_pr_review/5

dismiss_pr_review(Cred::credentials(), Repo::repository(), PR::integer(), RId::integer(), Body::map()) -> result()

Takes valid credentials, a string representing a repository (i.e "username/reponame", the issue/pull number, review ID, and a PR review dismissal message. Returns {ok, RespBody} if everything goes well, where RespBody is the plain text body returned by GitHub.

file_content/4

file_content(Cred::credentials(), Repo::repository(), CommitId::string(), Filename::string()) -> {ok, binary()} | egithub_req:error()

Fetches the contents of a file for a given repository and commit SHA.

hooks/2

hooks(Cred::credentials(), Repo::repository()) -> result()

Get all hooks for a repository.

issue/3

issue(Cred::credentials(), Repo::repository(), IssueId::integer()) -> result()

Get a single issue for a specific owner repository and its id.

issue_comment/4

issue_comment(Cred::credentials(), Repo::repository(), PR::integer(), Text::iodata()) -> egithub_req:result()

Equivalent to issue_comment(Cred, Repo, PR, Text, #{post_method => run}).

issue_comment/5

issue_comment(Cred::credentials(), Repo::repository(), PR::integer(), Text::iodata(), Options::options()) -> egithub_req:result() | ok

Takes valid credentials, a string representing a repository (i.e "username/reponame", the issue number, the comment's text and some options. Returns {ok, RespBody} if everything goes well, where RespBody is the plain text body returned by GitHub.

issue_comments/3

issue_comments(Cred::credentials(), Repo::repository(), PR::integer()) -> result()

Takes valid credentials, a string representing a repository (i.e "username/reponame" and the issue number. Returns {ok, Comments} where Comments is the decoded JSON representation of GitHub's response.

issues_org/3

issues_org(Cred::credentials(), Org::string(), Opts::map()) -> result()

List all issues for a given organization for the authenticated user.

issues_user/2

issues_user(Cred::credentials(), Opts::map()) -> result()

List all issues across owned and member repositories for the authenticated user.

languages/2

languages(Cred::credentials(), Repo::repository()) -> result()

oauth/1

oauth(Token::binary()) -> egithub:credentials()

Takes a valid OAuth token. Returns a value that can be used for OAuth authentication.

org_membership/2

org_membership(Cred::credentials(), OrgName::string()) -> result()

Check if the user associated with the provided credentials is a member of OrgName.

org_repos/3

org_repos(Cred::credentials(), Org::string(), Opts::map()) -> result()

Same as repos/3 but for an organization.

orgs/1

orgs(Cred::credentials()) -> result()

Get the organizations for the user associated with the provided credentials.

orgs/2

orgs(Cred::credentials(), User::user()) -> result()

Get the organizations for the user associated with the provided Username.

pr_review/5

pr_review(Cred::credentials(), Repo::repository(), PR::integer(), Body::egithub_webhook:review(), Options::options()) -> result()

Takes valid credentials, a string representing a repository (i.e "username/reponame", the issue/pull number, the PR review object and some options. Returns {ok, RespBody} if everything goes well, where RespBody is the plain text body returned by GitHub.

pr_reviews/3

pr_reviews(Cred::credentials(), Repo::repository(), PR::integer()) -> result()

Takes valid credentials, a string representing a repository (i.e "username/reponame", and the issue/pull number. Returns {ok, [map()]} if everything goes well, where [map()] is a list of reviews.

pull_req/3

pull_req(Cred::credentials(), Repo::repository(), PR::integer()) -> result()

Get a list of details of a pull request by providing its number. for authenticated user

pull_req_comment_line/7

pull_req_comment_line(Cred::credentials(), Repo::repository(), PR::integer(), CommitId::string(), Filename::binary(), Line::integer(), Text::iodata()) -> egithub_req:result()

Equivalent to pull_req_comment_line(Credentials, Repo, PR, CommitId, Filename, Line, Text, #{post_method => run}).

pull_req_comment_line/8

pull_req_comment_line(Cred::credentials(), Repo::repository(), PR::integer(), CommitId::string(), Filename::binary(), Line::integer(), Text::iodata(), Options::options()) -> ok | egithub_req:result()

Takes valid credentials, a string representing a repository (i.e "username/reponame", the pull request number, the commit SHA, the relative path to the repository's file, the line where the comment shuold be added, the comment's text and some options. Returns ok if everything goes well.

pull_req_comments/3

pull_req_comments(Cred::credentials(), Repo::repository(), PR::integer()) -> result()

Takes valid credentials, a string representing a repository (i.e "username/reponame" and the pull request number. Returns {ok, Comments} where Comments is the decoded JSON representation of GitHub's response.

pull_req_files/3

pull_req_files(Cred::credentials(), Repo::repository(), PR::integer()) -> result()

Takes valid credentials, a string representing a repository (i.e "username/reponame" and the pull request number. Returns {ok, Files} where Files is the decoded JSON representation of GitHub's response.

pull_reqs/3

pull_reqs(Cred::credentials(), Repo::repository(), Opts::map()) -> result()

List pull requests for a repository for the authenticated user

release/3

release(Cred::credentials(), Repo::repository(), Id::pos_integer()) -> result()

Get a single release for a repository of the authenticated user.

release_latest/2

release_latest(Cred::credentials(), Repo::repository()) -> result()

Get the latest release for a repository of the authenticated user.

releases/2

releases(Cred::credentials(), Repo::repository()) -> result()

List all releases for a repository for the authenticated user

releases/3

releases(Cred::credentials(), Repo::repository(), Opts::map()) -> result()

List all releases for a repository for the authenticated user.

remove_collaborator/3

remove_collaborator(Cred::credentials(), Repo::repository(), Collaborator::string()) -> result()

Remove a collaborator from a repository.

repo/2

repo(Cred::credentials(), RepoFullName::string()) -> result()

Get the repository information of RepoFullName (i.e. "username/reponame").

repos/2

repos(Cred::credentials(), Opts::map()) -> result()

Equivalent to repos(Cred, undefined, Opts).

repos/3

repos(Cred::credentials(), User::user(), Opts::map()) -> result()

Get the repositories associated with the user provided taking into account the options supplied. If the User is undefined then the user taken into account is the one with the credentials. The options available depend on the GitHub API specs. Check here for more information.

statuses/3

statuses(Cred::credentials(), Repo::repository(), Ref::string()) -> result()

Get all statuses for the provided repository and SHA.

tag/3

tag(Cred::credentials(), Repo::string(), TagSha::string()) -> result()

Get one tags for a repository of the authenticated user.

tags/3

tags(Cred::credentials(), Repo::string(), Opts::map()) -> result()

Get all of the tags for a repository of the authenticated user.

team_membership/3

team_membership(Cred::credentials(), TeamId::integer(), Username::string()) -> active | pending | none

Check the membership of a user in a team.

teams/2

teams(Cred::credentials(), Org::string()) -> result()

Gets all the teams from an organization.

user/1

user(Cred::credentials()) -> result()

Get the information for the user associated with the provided credentials.

user/2

user(Cred::credentials(), Username::string()) -> result()

Get the information for the user associated with the provided Username.

user_emails/1

user_emails(Cred::credentials()) -> result()

Get the emails registered for the user associated with the provided credentials.


Generated by EDoc