class Gitlab::Client

Overview

Gitlab API Client wrapper

See the Gitlab Offical API Document for more details.

Included Modules

Defined in:

gitlab/client.cr
gitlab/client/branch.cr
gitlab/client/commit.cr
gitlab/client/deploy_key.cr
gitlab/client/group.cr
gitlab/client/issue.cr
gitlab/client/key.cr
gitlab/client/label.cr
gitlab/client/merge_request.cr
gitlab/client/milestone.cr
gitlab/client/note.cr
gitlab/client/project.cr
gitlab/client/repository.cr
gitlab/client/repository_file.cr
gitlab/client/session.cr
gitlab/client/tag.cr
gitlab/client/user.cr
gitlab/client/version.cr

Constructors

Instance Method Summary

Instance methods inherited from module Gitlab::Client::Version

version version

Instance methods inherited from module Gitlab::Client::Key

key(key_id : Int32) : JSON::Any key, key_by_fingerprint(fingerprint : String) : JSON::Any key_by_fingerprint

Instance methods inherited from module Gitlab::Client::DeployKey

create_deploy_key(project_id : Int32, title : String, key : String, form : Hash = {} of String => String) : JSON::Any create_deploy_key, deploy_key(project_id : Int32, key_id : Int32) : JSON::Any deploy_key, deploy_keys(project_id : Int32, params : Hash? = nil) deploy_keys, disable_deploy_key(project_id : Int32, key_id : Int32) : JSON::Any disable_deploy_key, enable_deploy_key(project_id : Int32, key_id : Int32) : JSON::Any enable_deploy_key, remove_deploy_key(project_id : Int32, key_id : Int32) : JSON::Any remove_deploy_key

Instance methods inherited from module Gitlab::Client::Milestone

create_milestone(project_id : Int32, title : String, params : Hash = {} of String => String) : JSON::Any create_milestone, edit_milestone(project_id : Int32, milestone_id : Int32, title : String, form : Hash = {} of String => String) : JSON::Any edit_milestone, milestone(project_id : Int32, milestone_id : Int32) : JSON::Any milestone, milestone_issues(project_id : Int32, milestone_id : Int32, params : Hash = {} of String => String) : JSON::Any milestone_issues, milestone_merge_requests(project_id : Int32, milestone_id : Int32, params : Hash = {} of String => String) milestone_merge_requests, milestones(project_id : Int32, params : Hash? = nil) : JSON::Any milestones

Instance methods inherited from module Gitlab::Client::MergeRequest

accept_merge_request(project_id : Int32, merge_request_id : Int32, form : Hash? = nil) : JSON::Any accept_merge_request, cancel_merge_request_when_build_succeed(project_id : Int32, merge_request_id : Int32) : JSON::Any cancel_merge_request_when_build_succeed, create_merge_request(project_id : Int32, source_branch : String, target_branch : String, title : String, params : Hash = {} of String => String) : JSON::Any create_merge_request, delete_merge_request(project_id : Int32, merge_request_id : Int32) : JSON::Any | Bool delete_merge_request, edit_merge_request(project_id : Int32, merge_request_id : Int32, source_branch : String, target_branch : String, title : String, form : Hash = {} of String => String) : JSON::Any edit_merge_request, merge_request(project_id : Int32, merge_request_id : Int32) : JSON::Any merge_request, merge_request_changes(project_id : Int32, merge_request_id : Int32, params : Hash = {} of String => String) : JSON::Any merge_request_changes, merge_request_closes_issues(project_id : Int32, merge_request_id : Int32, params : Hash = {} of String => String) : JSON::Any merge_request_closes_issues, merge_request_commits(project_id : Int32, merge_request_id : Int32) : JSON::Any merge_request_commits, merge_requests(project_id : Int32, params : Hash? = nil) : JSON::Any merge_requests, subscribe_merge_request(project_id : Int32, merge_request_id : Int32) : JSON::Any subscribe_merge_request, unsubscribe_merge_request(project_id : Int32, merge_request_id : Int32) : JSON::Any unsubscribe_merge_request, update_merge_request(project_id : Int32, merge_request_id, form : Hash? = nil) update_merge_request

Instance methods inherited from module Gitlab::Client::Label

create_label(project_id : Int32, name : String, color : String, description : String? = nil) : JSON::Any create_label, delete_label(project_id : Int32, name : String) : JSON::Any | Bool delete_label, edit_label(project_id : Int32, name : String, form : Hash = {} of String => String) : JSON::Any edit_label, labels(project_id : Int32, params : Hash? = nil) : JSON::Any labels, subscribe_label(project_id : Int32, label_id : Int32 | String) : JSON::Any subscribe_label, unsubscribe_label(project_id : Int32, label_id : Int32 | String) : JSON::Any unsubscribe_label

Instance methods inherited from module Gitlab::Client::Issue

close_issue(project_id : Int32, issue_id : Int32) : JSON::Any close_issue, create_issue(project_id : Int32, title : String, params : Hash = {} of String => String) : JSON::Any create_issue, delete_issue(project_id : Int32, issue_id : Int32) : JSON::Any | Bool delete_issue, edit_issue(project_id : Int32, issue_id : Int32, form : Hash = {} of String => String) : JSON::Any edit_issue, issue(project_id : Int32, issue_id : Int32) : JSON::Any issue, issues(params : Hash? = nil) : JSON::Any
issues(project_id : Int32 | String, params : Hash? = nil) : JSON::Any
issues
, move_issue(project_id : Int32, issue_id : Int32, to_project_id : Int32) : JSON::Any move_issue, reopen_issue(project_id : Int32, issue_id : Int32) : JSON::Any reopen_issue, subscribe_issue(project_id : Int32, issue_id : Int32) : JSON::Any subscribe_issue, unsubscribe_issue(project_id : Int32, issue_id : Int32) : JSON::Any unsubscribe_issue

Instance methods inherited from module Gitlab::Client::Note

create_issue_note(project_id : Int32, issue_id : Int32, body : String, created_at : String? = nil) : JSON::Any create_issue_note, create_merge_request_note(project_id : Int32, merge_request_id : Int32, body : String, created_at : String? = nil) : JSON::Any create_merge_request_note, create_snippet_note(project_id : Int32, snippet_id : Int32, body : String) : JSON::Any create_snippet_note, delete_issue_note(project_id : Int32, issue_id : Int32, note_id : Int32) : JSON::Any | Bool delete_issue_note, delete_merge_request_note(project_id : Int32, merge_request_id : Int32, note_id : Int32) : JSON::Any | Bool delete_merge_request_note, delete_snippet_note(project_id : Int32, snippet_id : Int32, note_id : Int32) : JSON::Any | Bool delete_snippet_note, edit_issue_note(project_id : Int32, issue_id : Int32, note_id : Int32, body : String) : JSON::Any edit_issue_note, edit_merge_request_note(project_id : Int32, merge_requests_id : Int32, note_id : Int32, body : String) : JSON::Any edit_merge_request_note, edit_snippet_note(project_id : Int32, snippet_id : Int32, note_id : Int32, body : String) : JSON::Any edit_snippet_note, issue_note(project_id : Int32, issue_id : Int32, note_id : Int32) : JSON::Any issue_note, issue_notes(project_id : Int32, issue_id : Int32, params : Hash? = nil) : JSON::Any issue_notes, merge_request_note(project_id : Int32, merge_request_id : Int32, note_id : Int32) : JSON::Any merge_request_note, merge_request_notes(project_id : Int32, merge_request_id : Int32, params : Hash? = nil) : JSON::Any merge_request_notes, snippet_note(project_id : Int32, snippet_id : Int32, note_id : Int32) : JSON::Any snippet_note, snippet_notes(project_id : Int32, snippet_id : Int32, params : Hash? = nil) : JSON::Any snippet_notes

Instance methods inherited from module Gitlab::Client::Commit

commit(project_id : Int32, commit : String) : JSON::Any commit, commit_comments(project_id : Int32, sha : String, params : Hash = {} of String => String) : JSON::Any commit_comments, commit_diff(project_id : Int32, sha : String) : JSON::Any commit_diff, commit_status(project_id : Int32, sha : String, params : Hash = {} of String => String) : JSON::Any commit_status, commits(project_id : Int32, params : Hash? = nil) : JSON::Any commits, create_commit_comment(project_id : Int32, sha : String, note : String, params : Hash = {} of String => String) : JSON::Any create_commit_comment, update_commit_status(project_id : Int32, sha : String, state : String, params : Hash = {} of String => String) : JSON::Any update_commit_status

Instance methods inherited from module Gitlab::Client::Tag

create_release_notes(project_id : Int32, tag : String, description : String) : JSON::Any create_release_notes, create_tag(project_id : Int32, tag : String, ref : String, form : Hash = {} of String => String) : JSON::Any create_tag, delete_tag(project_id : Int32, tag : String) : JSON::Any | Bool delete_tag, tag(project_id : Int32, tag : String) : JSON::Any tag, tags(project_id : Int32, params : Hash? = nil) : JSON::Any tags, update_release_notes(project_id : Int32, tag : String, description : String) : JSON::Any update_release_notes

Instance methods inherited from module Gitlab::Client::Branch

branch(project_id : Int32, branch : String) : JSON::Any branch, branches(project_id : Int32, params : Hash? = nil) : JSON::Any branches, create_branch(project_id : Int32, branch : String, ref : String) : JSON::Any create_branch, delete_branch(project_id : Int32, branch : String) : JSON::Any | Bool delete_branch, protect_branch(project_id : Int32, branch : String, form : Hash? = nil) : JSON::Any protect_branch, unprotect_branch(project_id : Int32, branch : String) : JSON::Any unprotect_branch

Instance methods inherited from module Gitlab::Client::RepositoryFile

create_file(project : String | Int32, path : String, branch : String, content : String, commit_message : String, options : Hash = {} of String => String) : JSON::Any create_file, file_contents(project_id : Int32, filepath : String, sha = "HEAD") : String file_contents, get_file(project_id : Int32, filepath : String, ref = "HEAD") get_file

Instance methods inherited from module Gitlab::Client::Repository

blob(project_id : Int32, sha = "HEAD", params : Hash? = nil) : String blob, compare(project_id : Int32, from : String, to : String) : JSON::Any compare, contributors(project_id : Int32, params : Hash? = nil) : JSON::Any contributors, repo_archive(project_id : Int32, sha = "HEAD") : Gitlab::FileResponse | JSON::Any repo_archive, tree(project_id : Int32, params : Hash? = nil) : JSON::Any tree

Instance methods inherited from module Gitlab::Client::Project

add_project_hook(project : Int32 | String, url : String, form : Hash = {} of String => String) : JSON::Any add_project_hook, add_project_member(project : Int32 | String, user_id : Int32, access_level : Int32) : JSON::Any add_project_member, add_project_pages_domain(project : Int32 | String, domain : String, form : Hash = {} of String => String) : JSON::Any add_project_pages_domain, all_projects(params : Hash = {} of String => String) : JSON::Any all_projects, archive_project(project : Int32 | String) : JSON::Any archive_project, create_fork_from(project : Int32 | String, forked_from_id : Int32) : JSON::Any create_fork_from, create_project(user_id : Int32, name : String, params : Hash = {} of String => String) : JSON::Any
create_project(name : String, form : Hash = {} of String => String) : JSON::Any
create_project
, delete_project(project : Int32 | String) : JSON::Any | Bool delete_project, edit_project(project : Int32 | String, form : Hash = {} of String => String) : JSON::Any edit_project, edit_project_hook(project : Int32 | String, hook_id : Int32, url : String, form : Hash = {} of String => String) : JSON::Any edit_project_hook, edit_project_member(project : Int32 | String, user_id, access_level) : JSON::Any edit_project_member, edit_project_pages_domain(project : Int32 | String, domain : String, form : Hash = {} of String => String) : JSON::Any edit_project_pages_domain, fork_project(project : Int32 | String, form : Hash = {} of String => String) : JSON::Any fork_project, owned_projects(params : Hash? = {} of String => String) : JSON::Any owned_projects, project(project : Int32 | String) : JSON::Any project, project_add_custom_attribute(project_id : Int32, key : String, params : Hash = {} of String => String) : JSON::Any project_add_custom_attribute, project_branch(project : Int32 | String, branch : String) : JSON::Any project_branch, project_branchs(project : Int32 | String, params : Hash = {} of String => String) : JSON::Any project_branchs, project_custom_attribute(project_id : Int32, key : String) : JSON::Any project_custom_attribute, project_custom_attributes(project_id : Int32) : JSON::Any project_custom_attributes, project_delete_custom_attribute(project_id : Int32, key : String) : JSON::Any | Bool project_delete_custom_attribute, project_events(project : Int32 | String, params : Hash? = nil) : JSON::Any project_events, project_hook(project : Int32 | String, hook_id : Int32) : JSON::Any project_hook, project_hooks(project : Int32 | String, params : Hash? = nil) : JSON::Any project_hooks, project_member(project : Int32 | String, user_id : Int32) : JSON::Any project_member, project_members(project : Int32 | String, params : Hash = {} of String => String) : JSON::Any project_members, project_pages_domain(project : Int32 | String, domain : String) : JSON::Any project_pages_domain, project_pages_domains(project : Int32 | String) : JSON::Any project_pages_domains, project_search(query, params : Hash = {} of String => String) : JSON::Any project_search, projects(params : Hash = {} of String => String) : JSON::Any projects, protect_project_branch(project : Int32 | String, branch : String) : JSON::Any protect_project_branch, remove_fork(project : Int32 | String) : JSON::Any remove_fork, remove_project_hook(project : Int32 | String, hook_id : Int32) : JSON::Any? remove_project_hook, remove_project_member(project : Int32 | String, user_id : Int32) : JSON::Any | Bool remove_project_member, remove_project_pages_domain(project : Int32 | String, domain : String) : JSON::Any | Bool remove_project_pages_domain, share_project(project : Int32 | String, group_id : Int32, group_access = nil) : JSON::Any share_project, star_project(project : Int32 | String) : JSON::Any star_project, starred_projects(params : Hash = {} of String => String) : JSON::Any starred_projects, unarchive_project(project : Int32 | String) : JSON::Any unarchive_project, unprotect_project_branch(project : Int32 | String, branch : String) : JSON::Any unprotect_project_branch, unstar_project(project : Int32 | String) : JSON::Any unstar_project, upload_file(project : Int32 | String, file : String) : JSON::Any
upload_file(project : Int32 | String, file : File) : JSON::Any
upload_file

Instance methods inherited from module Gitlab::Client::Group

add_group_member(group_id : Int32, user_id : Int32, access_level) : JSON::Any add_group_member, create_group(name : String, path : String, form : Hash? = nil) : JSON::Any create_group, delete_group(group_id : Int32) : JSON::Any | Bool delete_group, edit_group(group_id : Int32, form : Hash? = nil) : JSON::Any edit_group, edit_group_member(group_id : Int32, user_id : Int32, access_level) : JSON::Any edit_group_member, group(group : Int32 | String) : JSON::Any group, group_add_custom_attribute(group_id : Int32, key : String, params : Hash = {} of String => String) : JSON::Any group_add_custom_attribute, group_custom_attribute(group_id : Int32, key : String) : JSON::Any group_custom_attribute, group_custom_attributes(group_id : Int32) : JSON::Any group_custom_attributes, group_delete_custom_attribute(group_id : Int32, key : String) : JSON::Any | Bool group_delete_custom_attribute, group_member(group_id : Int32, user_id : Int32) : JSON::Any group_member, group_members(group_id : Int32, params : Hash? = nil) : JSON::Any group_members, group_projects(group_id : Int32, params : Hash? = nil) : JSON::Any group_projects, group_search(query, params : Hash = {} of String => String) : JSON::Any group_search, groups(params : Hash? = nil) : JSON::Any groups, remove_group_member(group_id : Int32, user_id : Int32) : JSON::Any remove_group_member, transfer_project_to_group(group_id, project_id) : JSON::Any transfer_project_to_group

Instance methods inherited from module Gitlab::Client::Session

session(login : String, password : String) : JSON::Any session

Instance methods inherited from module Gitlab::Client::User

add_email(email) : JSON::Any
add_email(user_id : Int32, email) : JSON::Any
add_email
, block_user(user_id : Int32) : JSON::Any block_user, create_ssh_key(title, key) : JSON::Any
create_ssh_key(user_id, title, key) : JSON::Any
create_ssh_key
, create_user(email : String, password : String, username : String, form : Hash = {} of String => String) : JSON::Any create_user, delete_email(email_id : Int32) : JSON::Any | Bool
delete_email(email_id : Int32, user_id : Int32) : JSON::Any | Bool
delete_email
, delete_ssh_key(ssh_key_id : Int32) : JSON::Any | Bool
delete_ssh_key(user_id : Int32, ssh_key_id : Int32) : JSON::Any | Bool
delete_ssh_key
, delete_user(user_id : Int32) : JSON::Any | Bool delete_user, edit_user(user_id : Int32, form : Hash = {} of String => String) : JSON::Any edit_user, email(email_id : Int32) : JSON::Any email, emails : JSON::Any
emails(user_id : Int32) : JSON::Any
emails
, ssh_key(ssh_key_id : Int32) : JSON::Any ssh_key, ssh_keys : JSON::Any
ssh_keys(user_id : Int32) : JSON::Any
ssh_keys
, unblock_user(user_id : Int32) : JSON::Any unblock_user, user : JSON::Any
user(user_id : Int32) : JSON::Any
user
, user_add_custom_attribute(user_id : Int32, key : String, params : Hash = {} of String => String) : JSON::Any user_add_custom_attribute, user_custom_attribute(user_id : Int32, key : String) : JSON::Any user_custom_attribute, user_custom_attributes(user_id : Int32) : JSON::Any user_custom_attributes, user_delete_custom_attribute(user_id : Int32, key : String) : JSON::Any | Bool user_delete_custom_attribute, user_search(query, params : Hash = {} of String => String) : JSON::Any user_search, users(params : Hash? = nil) : JSON::Any users

Constructor Detail

def self.new(endpoint : String, token : String) #

Create a new client

Gitlab::Client.new("<endpoint>", "<token")

Instance Method Detail

def available? #

Return a Bool status by gitlab api service

  • Return Bool
client.available? # => true

def delete(path : String, headers : Hash(String, _) | NamedTuple? = nil, params : Hash(String, _) | NamedTuple? = nil, form : Hash(String, _) | NamedTuple? = nil, json : Hash(String, _) | NamedTuple? = nil) : Halite::Response #

Return a Halite::Response by sending a DELETE http request

client.delete("path", form: {
  first_name: "foo",
  last_name:  "bar"
})

def endpoint : String #

The endpoint of Gitlab


def endpoint=(endpoint : String) #

Setter for endpoint


def get(path : String, headers : Hash(String, _) | NamedTuple? = nil, params : Hash(String, _) | NamedTuple? = nil) : Halite::Response #

Return a Halite::Response by sending a GET method http request

client.get("path", params: {
  first_name: "foo",
  last_name:  "bar"
})

def head(path : String, headers : Hash(String, _) | NamedTuple? = nil, params : Hash(String, _) | NamedTuple? = nil) : Halite::Response #

Return a Halite::Response by sending a HEAD method http request

client.head("path", params: {
  first_name: "foo",
  last_name:  "bar"
})

def patch(path : String, headers : Hash(String, _) | NamedTuple? = nil, params : Hash(String, _) | NamedTuple? = nil, form : Hash(String, _) | NamedTuple? = nil, json : Hash(String, _) | NamedTuple? = nil) : Halite::Response #

Return a Halite::Response by sending a PATCH http request

client.patch("path", form: {
  first_name: "foo",
  last_name:  "bar"
})

def post(path : String, headers : Hash(String, _) | NamedTuple? = nil, params : Hash(String, _) | NamedTuple? = nil, form : Hash(String, _) | NamedTuple? = nil, json : Hash(String, _) | NamedTuple? = nil) : Halite::Response #

Return a Halite::Response by sending a POST http request

client.post("path", form: {
  first_name: "foo",
  last_name:  "bar"
})

def put(path : String, headers : Hash(String, _) | NamedTuple? = nil, params : Hash(String, _) | NamedTuple? = nil, form : Hash(String, _) | NamedTuple? = nil, json : Hash(String, _) | NamedTuple? = nil) : Halite::Response #

Return a Halite::Response by sending a PUT http request

client.put("path", form: {
  first_name: "foo",
  last_name:  "bar"
})

def token : String #

The token(private-token or OAuth2 access token) of Gitlab


def token=(token : String) #

The token(private-token or OAuth2 access token) of Gitlab