module

Gitlab::Client::User

Defines methods related to users.

See http://docs.gitlab.com/ce/api/users.html

Instance methods

add_email(user_id : Int32, email) : JSON::Any

Creates a new email for a user.

  • params [Int32] user_id The ID of a user.
  • params [String] email Email address
  • return [JSON::Any]
client.add_email('email@example.com', 2)
Source
add_email(email) : JSON::Any

Creates a new email for current user.

  • params [String] email Email address
  • return [JSON::Any]
client.add_email('email@example.com')
Source
block_user(user_id : Int32) : JSON::Any

Blocks the specified user.

Available only for admin.

  • param [Int32] user_id The Id of user
  • return [JSON::Any] success or not
client.block_user(4)
Source
create_ssh_key(user_id, title, key) : JSON::Any

Creates a new SSH key for a user.

  • param [Int32] user_id The Id of user.
  • param [String] key The SSH key body.
  • return [JSON::Any] Information about created SSH key.
client.create_ssh_key(2, "key title", "key body")
Source
create_ssh_key(title, key) : JSON::Any

Creates a new SSH key for current user.

  • param [String] title The title of an SSH key.
  • param [String] key The SSH key body.
  • return [JSON::Any] Information about created SSH key.
client.create_ssh_key("key title", "key body")
Source
create_user(email : String, password : String, username : String, form : Hash = {} of String => String) : JSON::Any

Creates a new user. Requires authentication from an admin account.

  • param [String] email The email of a user.
  • param [String] password The password of a user.
  • param [String] username The username of a user.
  • param [Hash] form A customizable set of form.
  • option form [String] :name The name of a user. Defaults to email.
  • option form [String] :skype The skype of a user.
  • option form [String] :linkedin The linkedin of a user.
  • option form [String] :twitter The twitter of a user.
  • option form [Int32] :projects_limit The limit of projects for a user.
  • return [JSON::Any] Information about created user.
Gitlab.create_user("icy.leaf@kaifeng.cn", "secret", "icyleaf", {"name" => "三火"})
Gitlab.create_user("icy.leaf@kaifeng.cn", "secret", "icyleaf")
Source
delete_email(email_id : Int32, user_id : Int32) : JSON::Any | Bool

Delete email for current user

  • params [Int32] user_id The ID of a user.
  • params [Int32] email_id Email address ID
  • return [JSON::Any]
client.delete_email(1, 2)
Source
delete_email(email_id : Int32) : JSON::Any | Bool

Delete email for current user

  • params [Int32] email_id Email address ID
  • return [JSON::Any]
client.delete_email(2)
Source
delete_ssh_key(user_id : Int32, ssh_key_id : Int32) : JSON::Any | Bool

Deletes an SSH key for a user.

  • param [Int32] user_id The Id of user.
  • param [Int32] ssh_key_id The ID of a user"s SSH key.
  • return [JSON::Any] Information about deleted SSH key.
client.delete_ssh_key(1, 1)
Source
delete_ssh_key(ssh_key_id : Int32) : JSON::Any | Bool

Deletes an SSH key for current user.

  • param [Int32] ssh_key_id The ID of a user"s SSH key.
  • return [JSON::Any] Information about deleted SSH key.
client.delete_ssh_key(1)
Source
delete_user(user_id : Int32) : JSON::Any | Bool

Deletes a user.

  • param [Int32] user_id The ID of a user.
  • return [JSON::Any] Information about deleted user.
client.delete_user(1)
Source
edit_user(user_id : Int32, form : Hash = {} of String => String) : JSON::Any

Updates a user.

  • param [Int32] id The ID of a user.
  • param [Hash] params A customizable set of params.
  • option params [String] :email The email of a user.
  • option params [String] :password The password of a user.
  • option params [String] :name The name of a user. Defaults to email.
  • option params [String] :skype The skype of a user.
  • option params [String] :linkedin The linkedin of a user.
  • option params [String] :twitter The twitter of a user.
  • option params [String] :projects_limit The limit of projects for a user.
  • return [JSON::Any] Information about edit user.
client.edit_user(4, {"email" => "icy.leaf@kaifeng.cn", "projects_limit" => "100"})
Source
email(email_id : Int32) : JSON::Any

Get a single email.

  • param [Int32] email_id The ID of a email.
  • return [JSON::Any]
client.email(3)
Source
emails(user_id : Int32) : JSON::Any

Gets a user emails.

  • param [Int32] user_id The ID of a user.
  • return [JSON::Any]
client.emails(2)
Source
emails

Gets current user emails.

  • return [JSON::Any]
client.emails
Source
ssh_key(ssh_key_id : Int32) : JSON::Any

Gets information about SSH key.

  • param [Int32] ssh_key_id The ID of a user"s SSH key.
  • return [JSON::Any]
client.ssh_key(1)
Source
ssh_keys(user_id : Int32) : JSON::Any

Gets a list of a user"s SSH keys.

  • param [Int32] user_id The Id of user.
  • return [JSON::Any]
client.ssh_keys(4)
Source
ssh_keys

Gets a list of current user"s SSH keys.

  • return [JSON::Any]
client.ssh_keys
Source
unblock_user(user_id : Int32) : JSON::Any

Unblocks the specified user.

Available only for admin.

  • param [Int32] user_id The Id of user
  • return [JSON::Any] success or not
client.unblock_user(4)
Source
user(user_id : Int32) : JSON::Any

Gets information about a user.

  • param [Int32] user_id The ID of a user.
  • return [JSON::Any]
client.user(2)
Source
user

Gets information about current user.

  • return [JSON::Any]
client.user
Source
user_add_custom_attribute(user_id : Int32, key : String, params : Hash = {} of String => String) : JSON::Any

Add's a user custom attribute

Available only for admin.

  • param [Int32] user_id The Id of user
  • param [String] the key of the custom attribute
  • param [Hash] params A single param with the value of the custom attribute
  • params [String] :value The value of the custom attribute.
  • return [JSON::Any] information about the custom_attribute
client.user_add_custom_attribute(4, custom_key, {"value" => "custom_value"})
Source
user_custom_attribute(user_id : Int32, key : String) : JSON::Any

Gets a single user custom attribute

Available only for admin.

  • param [Int32] user_id The Id of user
  • param [String] the key of the custom attribute
  • return [JSON::Any] information about the custom_attribute
client.user_custom_attribute(4, "custom_key")
Source
user_custom_attributes(user_id : Int32) : JSON::Any

List user custom attributes

Available only for admin.

  • param [Int32] user_id The Id of user
  • return [JSON::Any] information about the custom_attribute
client.user_custom_attributes(4)
Source
user_delete_custom_attribute(user_id : Int32, key : String) : JSON::Any | Bool

Deletes a user custom attribute

Available only for admin.

  • param [Int32] user_id The Id of user
  • param [String] the key of the custom attribute
  • return [JSON::Any] information about the custom_attribute
client.user_delete_custom_attribute(4, custom_key)
Source
user_search(query, params : Hash = {} of String => String) : JSON::Any

Search for user by name

  • param [String] query A string to search for in group names and paths.
  • param [Hash] params A customizable set of params.
  • option params [String] :per_page Number of projects to return per page
  • option params [String] :page The page to retrieve
  • return [JSON::Any] List of projects under search qyery
client.group_search("icyleaf")
client.group_search("icyleaf", {"per_page" => 50})
Source
users(params : Hash | Nil = nil) : JSON::Any

Gets a list of users.

  • param [Hash] params A customizable set of params.
  • option params [String] :page The page number.
  • option params [String] :per_page The number of results per page.
  • return [JSON::Any]
client.users
client.users({"per_page" => "10", "page" => "2"})
Source