gbr/gh
Github REST API v3 client
Types
pub type GHApiOptions {
GHApiOptions(
query: option.Option(List(#(String, String))),
header: option.Option(List(#(String, String))),
path: option.Option(List(#(String, String))),
cookie: option.Option(List(#(String, String))),
body: option.Option(String),
)
}
Constructors
-
GHApiOptions( query: option.Option(List(#(String, String))), header: option.Option(List(#(String, String))), path: option.Option(List(#(String, String))), cookie: option.Option(List(#(String, String))), body: option.Option(String), )
pub type GHLicense {
GHLicense(
key: option.Option(String),
name: option.Option(String),
spdx_id: option.Option(String),
url: option.Option(String),
node_id: option.Option(String),
)
}
Constructors
-
GHLicense( key: option.Option(String), name: option.Option(String), spdx_id: option.Option(String), url: option.Option(String), node_id: option.Option(String), )
Github reponse from “/orgs/{name}”
pub type GHOrg {
GHOrg(
id: Int,
login: String,
node_id: String,
url: String,
repos_url: String,
events_url: String,
hooks_url: String,
issues_url: String,
members_url: String,
public_members_url: String,
avatar_url: String,
description: String,
name: String,
company: String,
blog: String,
location: String,
email: String,
twitter_username: String,
is_verified: Bool,
has_organization_projects: Bool,
has_repository_projects: Bool,
public_repos: Int,
public_gists: Int,
followers: Int,
following: Int,
html_url: String,
created_at: String,
updated_at: String,
archived_at: String,
kind: String,
)
}
Constructors
-
GHOrg( id: Int, login: String, node_id: String, url: String, repos_url: String, events_url: String, hooks_url: String, issues_url: String, members_url: String, public_members_url: String, avatar_url: String, description: String, name: String, company: String, blog: String, location: String, email: String, twitter_username: String, is_verified: Bool, has_organization_projects: Bool, has_repository_projects: Bool, public_repos: Int, public_gists: Int, followers: Int, following: Int, html_url: String, created_at: String, updated_at: String, archived_at: String, kind: String, )
pub type GHPermissions {
GHPermissions(
admin: Bool,
maintain: Bool,
push: Bool,
triage: Bool,
pull: Bool,
)
}
Constructors
-
GHPermissions( admin: Bool, maintain: Bool, push: Bool, triage: Bool, pull: Bool, )
pub type GHQuery {
GHQuery(
kind: option.Option(String),
sort: option.Option(String),
direction: option.Option(String),
per_page: option.Option(Int),
page: option.Option(Int),
)
}
Constructors
-
GHQuery( kind: option.Option(String), sort: option.Option(String), direction: option.Option(String), per_page: option.Option(Int), page: option.Option(Int), )
pub type GHRepo {
GHRepo(
id: Int,
node_id: String,
name: String,
full_name: String,
private: Bool,
owner: GHOrg,
html_url: String,
description: String,
fork: Bool,
url: String,
forks_url: String,
keys_url: String,
collaborators_url: String,
teams_url: String,
hooks_url: String,
issue_events_url: String,
events_url: String,
assignees_url: String,
branches_url: String,
tags_url: String,
blobs_url: String,
git_tags_url: String,
git_refs_url: String,
trees_url: String,
statuses_url: String,
languages_url: String,
stargazers_url: String,
contributors_url: String,
subscribers_url: String,
subscription_url: String,
commits_url: String,
git_commits_url: String,
comments_url: String,
issue_comment_url: String,
contents_url: String,
compare_url: String,
merges_url: String,
archive_url: String,
downloads_url: String,
issues_url: String,
pulls_url: String,
milestones_url: String,
notifications_url: String,
labels_url: String,
releases_url: String,
deployments_url: String,
created_at: String,
updated_at: String,
pushed_at: String,
git_url: String,
ssh_url: String,
clone_url: String,
svn_url: String,
homepage: String,
size: Int,
stargazers_count: Int,
watchers_count: Int,
language: String,
has_issues: Bool,
has_projects: Bool,
has_downloads: Bool,
has_wiki: Bool,
has_pages: Bool,
has_discussions: Bool,
forks_count: Int,
mirror_url: String,
archived: Bool,
disabled: Bool,
open_issues_count: Int,
license: String,
allow_forking: Bool,
is_template: Bool,
web_commit_signoff_required: Bool,
topics: List(String),
visibility: String,
forks: Int,
open_issues: Int,
watchers: Int,
default_branch: String,
permissions: GHPermissions,
)
}
Constructors
-
GHRepo( id: Int, node_id: String, name: String, full_name: String, private: Bool, owner: GHOrg, html_url: String, description: String, fork: Bool, url: String, forks_url: String, keys_url: String, collaborators_url: String, teams_url: String, hooks_url: String, issue_events_url: String, events_url: String, assignees_url: String, branches_url: String, tags_url: String, blobs_url: String, git_tags_url: String, git_refs_url: String, trees_url: String, statuses_url: String, languages_url: String, stargazers_url: String, contributors_url: String, subscribers_url: String, subscription_url: String, commits_url: String, git_commits_url: String, comments_url: String, issue_comment_url: String, contents_url: String, compare_url: String, merges_url: String, archive_url: String, downloads_url: String, issues_url: String, pulls_url: String, milestones_url: String, notifications_url: String, labels_url: String, releases_url: String, deployments_url: String, created_at: String, updated_at: String, pushed_at: String, git_url: String, ssh_url: String, clone_url: String, svn_url: String, homepage: String, size: Int, stargazers_count: Int, watchers_count: Int, language: String, has_issues: Bool, has_projects: Bool, has_downloads: Bool, has_wiki: Bool, has_pages: Bool, has_discussions: Bool, forks_count: Int, mirror_url: String, archived: Bool, disabled: Bool, open_issues_count: Int, license: String, allow_forking: Bool, is_template: Bool, web_commit_signoff_required: Bool, topics: List(String), visibility: String, forks: Int, open_issues: Int, watchers: Int, default_branch: String, permissions: GHPermissions, )
pub type GHRepoSimple {
GHRepoSimple(
id: Int,
node_id: String,
name: String,
full_name: String,
forks_count: Int,
html_url: String,
description: option.Option(String),
fork: Bool,
created_at: String,
updated_at: String,
pushed_at: String,
git_url: String,
ssh_url: String,
clone_url: String,
homepage: option.Option(String),
size: Int,
open_issues_count: Int,
license: option.Option(GHLicense),
forks: Int,
open_issues: Int,
watchers: Int,
default_branch: String,
permissions: GHPermissions,
)
}
Constructors
-
GHRepoSimple( id: Int, node_id: String, name: String, full_name: String, forks_count: Int, html_url: String, description: option.Option(String), fork: Bool, created_at: String, updated_at: String, pushed_at: String, git_url: String, ssh_url: String, clone_url: String, homepage: option.Option(String), size: Int, open_issues_count: Int, license: option.Option(GHLicense), forks: Int, open_issues: Int, watchers: Int, default_branch: String, permissions: GHPermissions, )
Github response from “/” root.
pub type GHRoot {
GHRoot(
current_user_url: String,
current_user_authorizations_html_url: String,
authorizations_url: String,
code_search_url: String,
commit_search_url: String,
emails_url: String,
emojis_url: String,
events_url: String,
feeds_url: String,
followers_url: String,
following_url: String,
gists_url: String,
hub_url: String,
issue_search_url: String,
issues_url: String,
keys_url: String,
label_search_url: String,
notifications_url: String,
organization_url: String,
organization_repositories_url: String,
organization_teams_url: String,
public_gists_url: String,
rate_limit_url: String,
repository_url: String,
repository_search_url: String,
current_user_repositories_url: String,
starred_url: String,
starred_gists_url: String,
topic_search_url: String,
user_url: String,
user_organizations_url: String,
user_repositories_url: String,
user_search_url: String,
)
}
Constructors
-
GHRoot( current_user_url: String, current_user_authorizations_html_url: String, authorizations_url: String, code_search_url: String, commit_search_url: String, emails_url: String, emojis_url: String, events_url: String, feeds_url: String, followers_url: String, following_url: String, gists_url: String, hub_url: String, issue_search_url: String, issues_url: String, keys_url: String, label_search_url: String, notifications_url: String, organization_url: String, organization_repositories_url: String, organization_teams_url: String, public_gists_url: String, rate_limit_url: String, repository_url: String, repository_search_url: String, current_user_repositories_url: String, starred_url: String, starred_gists_url: String, topic_search_url: String, user_url: String, user_organizations_url: String, user_repositories_url: String, user_search_url: String, )
Values
pub fn fetch(
path path: String,
method method: http.Method,
options options: option.Option(GHApiOptions),
) -> promise.Promise(dynamic.Dynamic)
Fetch github api from url
- path: Github api path
- method: Http method
- options: Github api options { query, path, header, cookie, body}
pub fn org(
name: String,
query: option.Option(GHQuery),
) -> promise.Promise(Result(GHOrg, List(decode.DecodeError)))
Fetch organization by name
- name: Org name
- query: Query filter
pub fn org_decoder() -> decode.Decoder(GHOrg)
pub fn permissions_decoder() -> decode.Decoder(GHPermissions)
pub fn repos(
org: String,
query: option.Option(GHQuery),
) -> promise.Promise(
Result(List(GHRepoSimple), List(decode.DecodeError)),
)
Fetch repositories from org name filtering or not
- org: Org name
- query: Query filter
pub fn root() -> promise.Promise(
Result(GHRoot, List(decode.DecodeError)),
)
Fetch “/” root github resources
Return all init urls
pub fn root_decoder() -> decode.Decoder(GHRoot)
Github root decoder dynamic response
pub fn to_query(
query: option.Option(GHQuery),
) -> option.Option(List(#(String, String)))