View Source GitHub.Users (GitHub REST API Client v0.2.2)

Provides API endpoints related to users

Link to this section Summary

Functions

Add an email address for the authenticated user

Add social accounts for the authenticated user

Check if a user is blocked by the authenticated user

Check if a person is followed by the authenticated user

Create a GPG key for the authenticated user

Create a public SSH key for the authenticated user

Create a SSH signing key for the authenticated user

Delete an email address for the authenticated user

Delete a GPG key for the authenticated user

Delete a public SSH key for the authenticated user

Delete social accounts for the authenticated user

Delete an SSH signing key for the authenticated user

Get the authenticated user

Get contextual information for a user

Get a GPG key for the authenticated user

Get a public SSH key for the authenticated user

Get an SSH signing key for the authenticated user

List users

List users blocked by the authenticated user

List email addresses for the authenticated user

List the people the authenticated user follows

List followers of the authenticated user

List the people a user follows

List GPG keys for the authenticated user

List public email addresses for the authenticated user

List public SSH keys for the authenticated user

List social accounts for the authenticated user

List social accounts for a user

List SSH signing keys for the authenticated user

List SSH signing keys for a user

Set primary email visibility for the authenticated user

Update the authenticated user

Link to this section Functions

Link to this function

add_email_for_authenticated_user(body, opts \\ [])

View Source
@spec add_email_for_authenticated_user(
  map() | String.t() | [String.t()],
  keyword()
) :: {:ok, [GitHub.Email.t()]} | {:error, GitHub.Error.t()}

Add an email address for the authenticated user

This endpoint is accessible with the user scope.

resources

Resources

Link to this function

add_social_account_for_authenticated_user(body, opts \\ [])

View Source
@spec add_social_account_for_authenticated_user(
  map(),
  keyword()
) :: {:ok, [GitHub.SocialAccount.t()]} | {:error, GitHub.Error.t()}

Add social accounts for the authenticated user

Add one or more social accounts to the authenticated user's profile. This endpoint is accessible with the user scope.

resources

Resources

Link to this function

block(username, opts \\ [])

View Source
@spec block(
  String.t(),
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Block a user

Blocks the given user and returns a 204. If the authenticated user cannot block the given user a 422 is returned.

resources

Resources

Link to this function

check_blocked(username, opts \\ [])

View Source
@spec check_blocked(
  String.t(),
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Check if a user is blocked by the authenticated user

Returns a 204 if the given user is blocked by the authenticated user. Returns a 404 if the given user is not blocked by the authenticated user, or if the given user account has been identified as spam by GitHub.

resources

Resources

Link to this function

check_following_for_user(username, target_user, opts \\ [])

View Source
@spec check_following_for_user(String.t(), String.t(), keyword()) ::
  :ok | {:error, GitHub.Error.t()}

Check if a user follows another user

resources

Resources

Link to this function

check_person_is_followed_by_authenticated(username, opts \\ [])

View Source
@spec check_person_is_followed_by_authenticated(
  String.t(),
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Check if a person is followed by the authenticated user

resources

Resources

Link to this function

create_gpg_key_for_authenticated_user(body, opts \\ [])

View Source
@spec create_gpg_key_for_authenticated_user(
  map(),
  keyword()
) :: {:ok, GitHub.GpgKey.t()} | {:error, GitHub.Error.t()}

Create a GPG key for the authenticated user

Adds a GPG key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least write:gpg_key scope.

resources

Resources

Link to this function

create_public_ssh_key_for_authenticated_user(body, opts \\ [])

View Source
@spec create_public_ssh_key_for_authenticated_user(
  map(),
  keyword()
) :: {:ok, GitHub.Key.t()} | {:error, GitHub.Error.t()}

Create a public SSH key for the authenticated user

Adds a public SSH key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least write:public_key scope.

resources

Resources

Link to this function

create_ssh_signing_key_for_authenticated_user(body, opts \\ [])

View Source
@spec create_ssh_signing_key_for_authenticated_user(
  map(),
  keyword()
) :: {:ok, GitHub.SSHSigningKey.t()} | {:error, GitHub.Error.t()}

Create a SSH signing key for the authenticated user

Creates an SSH signing key for the authenticated user's GitHub account. You must authenticate with Basic Authentication, or you must authenticate with OAuth with at least write:ssh_signing_key scope. For more information, see "Understanding scopes for OAuth apps."

resources

Resources

Link to this function

delete_email_for_authenticated_user(body, opts \\ [])

View Source
@spec delete_email_for_authenticated_user(
  map() | String.t() | [String.t()],
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Delete an email address for the authenticated user

This endpoint is accessible with the user scope.

resources

Resources

Link to this function

delete_gpg_key_for_authenticated_user(gpg_key_id, opts \\ [])

View Source
@spec delete_gpg_key_for_authenticated_user(
  integer(),
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Delete a GPG key for the authenticated user

Removes a GPG key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:gpg_key scope.

resources

Resources

Link to this function

delete_public_ssh_key_for_authenticated_user(key_id, opts \\ [])

View Source
@spec delete_public_ssh_key_for_authenticated_user(
  integer(),
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Delete a public SSH key for the authenticated user

Removes a public SSH key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope.

resources

Resources

Link to this function

delete_social_account_for_authenticated_user(body, opts \\ [])

View Source
@spec delete_social_account_for_authenticated_user(
  map(),
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Delete social accounts for the authenticated user

Deletes one or more social accounts from the authenticated user's profile. This endpoint is accessible with the user scope.

resources

Resources

Link to this function

delete_ssh_signing_key_for_authenticated_user(ssh_signing_key_id, opts \\ [])

View Source
@spec delete_ssh_signing_key_for_authenticated_user(
  integer(),
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Delete an SSH signing key for the authenticated user

Deletes an SSH signing key from the authenticated user's GitHub account. You must authenticate with Basic Authentication, or you must authenticate with OAuth with at least admin:ssh_signing_key scope. For more information, see "Understanding scopes for OAuth apps."

resources

Resources

Link to this function

follow(username, opts \\ [])

View Source
@spec follow(
  String.t(),
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Follow a user

Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."

Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope.

resources

Resources

Link to this function

get_authenticated(opts \\ [])

View Source
@spec get_authenticated(keyword()) ::
  {:ok, GitHub.User.private() | GitHub.User.public()}
  | {:error, GitHub.Error.t()}

Get the authenticated user

If the authenticated user is authenticated with an OAuth token with the user scope, then the response lists public and private profile information.

If the authenticated user is authenticated through OAuth without the user scope, then the response lists only public profile information.

resources

Resources

Link to this function

get_by_username(username, opts \\ [])

View Source
@spec get_by_username(
  String.t(),
  keyword()
) ::
  {:ok, GitHub.User.private() | GitHub.User.public()}
  | {:error, GitHub.Error.t()}

Get a user

Provides publicly available information about someone with a GitHub account.

GitHub Apps with the Plan user permission can use this endpoint to retrieve information about a user's GitHub plan. The GitHub App must be authenticated as a user. See "Identifying and authorizing users for GitHub Apps" for details about authentication. For an example response, see 'Response with GitHub plan information' below"

The email key in the following response is the publicly visible email address from your GitHub profile page. When setting up your profile, you can select a primary email address to be “public” which provides an email entry for this endpoint. If you do not set a public email address for email, then it will have a value of null. You only see publicly visible email addresses when authenticated with GitHub. For more information, see Authentication.

The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see "Emails API".

resources

Resources

Link to this function

get_context_for_user(username, opts \\ [])

View Source
@spec get_context_for_user(
  String.t(),
  keyword()
) :: {:ok, GitHub.Hovercard.t()} | {:error, GitHub.Error.t()}

Get contextual information for a user

Provides hovercard information when authenticated through basic auth or OAuth with the repo scope. You can find out more about someone in relation to their pull requests, issues, repositories, and organizations.

The subject_type and subject_id parameters provide context for the person's hovercard, which returns more information than without the parameters. For example, if you wanted to find out more about octocat who owns the Spoon-Knife repository via cURL, it would look like this:

 curl -u username:token
  https://api.github.com/users/octocat/hovercard?subject_type=repository&subject_id=1300192

options

Options

  • subject_type: Identifies which additional information you'd like to receive about the person's hovercard. Can be organization, repository, issue, pull_request. Required when using subject_id.
  • subject_id: Uses the ID for the subject_type you specified. Required when using subject_type.

resources

Resources

Link to this function

get_gpg_key_for_authenticated_user(gpg_key_id, opts \\ [])

View Source
@spec get_gpg_key_for_authenticated_user(
  integer(),
  keyword()
) :: {:ok, GitHub.GpgKey.t()} | {:error, GitHub.Error.t()}

Get a GPG key for the authenticated user

View extended details for a single GPG key. Requires that you are authenticated via Basic Auth or via OAuth with at least read:gpg_key scope.

resources

Resources

Link to this function

get_public_ssh_key_for_authenticated_user(key_id, opts \\ [])

View Source
@spec get_public_ssh_key_for_authenticated_user(
  integer(),
  keyword()
) :: {:ok, GitHub.Key.t()} | {:error, GitHub.Error.t()}

Get a public SSH key for the authenticated user

View extended details for a single public SSH key. Requires that you are authenticated via Basic Auth or via OAuth with at least read:public_key scope.

resources

Resources

Link to this function

get_ssh_signing_key_for_authenticated_user(ssh_signing_key_id, opts \\ [])

View Source
@spec get_ssh_signing_key_for_authenticated_user(
  integer(),
  keyword()
) :: {:ok, GitHub.SSHSigningKey.t()} | {:error, GitHub.Error.t()}

Get an SSH signing key for the authenticated user

Gets extended details for an SSH signing key. You must authenticate with Basic Authentication, or you must authenticate with OAuth with at least read:ssh_signing_key scope. For more information, see "Understanding scopes for OAuth apps."

resources

Resources

@spec list(keyword()) :: {:ok, [GitHub.User.simple()]} | {:error, GitHub.Error.t()}

List users

Lists all users, in the order that they signed up on GitHub. This list includes personal user accounts and organization accounts.

Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users.

options

Options

  • since: A user ID. Only return users with an ID greater than this ID.
  • per_page: The number of results per page (max 100).

resources

Resources

Link to this function

list_blocked_by_authenticated_user(opts \\ [])

View Source
@spec list_blocked_by_authenticated_user(keyword()) ::
  {:ok, [GitHub.User.simple()]} | {:error, GitHub.Error.t()}

List users blocked by the authenticated user

List the users you've blocked on your personal account.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_emails_for_authenticated_user(opts \\ [])

View Source
@spec list_emails_for_authenticated_user(keyword()) ::
  {:ok, [GitHub.Email.t()]} | {:error, GitHub.Error.t()}

List email addresses for the authenticated user

Lists all of your email addresses, and specifies which one is visible to the public. This endpoint is accessible with the user:email scope.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_followed_by_authenticated_user(opts \\ [])

View Source
@spec list_followed_by_authenticated_user(keyword()) ::
  {:ok, [GitHub.User.simple()]} | {:error, GitHub.Error.t()}

List the people the authenticated user follows

Lists the people who the authenticated user follows.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_followers_for_authenticated_user(opts \\ [])

View Source
@spec list_followers_for_authenticated_user(keyword()) ::
  {:ok, [GitHub.User.simple()]} | {:error, GitHub.Error.t()}

List followers of the authenticated user

Lists the people following the authenticated user.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_followers_for_user(username, opts \\ [])

View Source
@spec list_followers_for_user(
  String.t(),
  keyword()
) :: {:ok, [GitHub.User.simple()]} | {:error, GitHub.Error.t()}

List followers of a user

Lists the people following the specified user.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_following_for_user(username, opts \\ [])

View Source
@spec list_following_for_user(
  String.t(),
  keyword()
) :: {:ok, [GitHub.User.simple()]} | {:error, GitHub.Error.t()}

List the people a user follows

Lists the people who the specified user follows.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_gpg_keys_for_authenticated_user(opts \\ [])

View Source
@spec list_gpg_keys_for_authenticated_user(keyword()) ::
  {:ok, [GitHub.GpgKey.t()]} | {:error, GitHub.Error.t()}

List GPG keys for the authenticated user

Lists the current user's GPG keys. Requires that you are authenticated via Basic Auth or via OAuth with at least read:gpg_key scope.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_gpg_keys_for_user(username, opts \\ [])

View Source
@spec list_gpg_keys_for_user(
  String.t(),
  keyword()
) :: {:ok, [GitHub.GpgKey.t()]} | {:error, GitHub.Error.t()}

List GPG keys for a user

Lists the GPG keys for a user. This information is accessible by anyone.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_public_emails_for_authenticated_user(opts \\ [])

View Source
@spec list_public_emails_for_authenticated_user(keyword()) ::
  {:ok, [GitHub.Email.t()]} | {:error, GitHub.Error.t()}

List public email addresses for the authenticated user

Lists your publicly visible email address, which you can set with the Set primary email visibility for the authenticated user endpoint. This endpoint is accessible with the user:email scope.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_public_keys_for_user(username, opts \\ [])

View Source
@spec list_public_keys_for_user(
  String.t(),
  keyword()
) :: {:ok, [GitHub.Key.simple()]} | {:error, GitHub.Error.t()}

List public keys for a user

Lists the verified public SSH keys for a user. This is accessible by anyone.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_public_ssh_keys_for_authenticated_user(opts \\ [])

View Source
@spec list_public_ssh_keys_for_authenticated_user(keyword()) ::
  {:ok, [GitHub.Key.t()]} | {:error, GitHub.Error.t()}

List public SSH keys for the authenticated user

Lists the public SSH keys for the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least read:public_key scope.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_social_accounts_for_authenticated_user(opts \\ [])

View Source
@spec list_social_accounts_for_authenticated_user(keyword()) ::
  {:ok, [GitHub.SocialAccount.t()]} | {:error, GitHub.Error.t()}

List social accounts for the authenticated user

Lists all of your social accounts.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_social_accounts_for_user(username, opts \\ [])

View Source
@spec list_social_accounts_for_user(
  String.t(),
  keyword()
) :: {:ok, [GitHub.SocialAccount.t()]} | {:error, GitHub.Error.t()}

List social accounts for a user

Lists social media accounts for a user. This endpoint is accessible by anyone.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_ssh_signing_keys_for_authenticated_user(opts \\ [])

View Source
@spec list_ssh_signing_keys_for_authenticated_user(keyword()) ::
  {:ok, [GitHub.SSHSigningKey.t()]} | {:error, GitHub.Error.t()}

List SSH signing keys for the authenticated user

Lists the SSH signing keys for the authenticated user's GitHub account. You must authenticate with Basic Authentication, or you must authenticate with OAuth with at least read:ssh_signing_key scope. For more information, see "Understanding scopes for OAuth apps."

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

list_ssh_signing_keys_for_user(username, opts \\ [])

View Source
@spec list_ssh_signing_keys_for_user(
  String.t(),
  keyword()
) :: {:ok, [GitHub.SSHSigningKey.t()]} | {:error, GitHub.Error.t()}

List SSH signing keys for a user

Lists the SSH signing keys for a user. This operation is accessible by anyone.

options

Options

  • per_page: The number of results per page (max 100).
  • page: Page number of the results to fetch.

resources

Resources

Link to this function

set_primary_email_visibility_for_authenticated_user(body, opts \\ [])

View Source
@spec set_primary_email_visibility_for_authenticated_user(
  map(),
  keyword()
) :: {:ok, [GitHub.Email.t()]} | {:error, GitHub.Error.t()}

Set primary email visibility for the authenticated user

Sets the visibility for your primary email addresses.

resources

Resources

Link to this function

unblock(username, opts \\ [])

View Source
@spec unblock(
  String.t(),
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Unblock a user

Unblocks the given user and returns a 204.

resources

Resources

Link to this function

unfollow(username, opts \\ [])

View Source
@spec unfollow(
  String.t(),
  keyword()
) :: :ok | {:error, GitHub.Error.t()}

Unfollow a user

Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope.

resources

Resources

Link to this function

update_authenticated(body, opts \\ [])

View Source
@spec update_authenticated(
  map(),
  keyword()
) :: {:ok, GitHub.User.private()} | {:error, GitHub.Error.t()}

Update the authenticated user

Note: If your email is set to private and you send an email parameter as part of this request to update your profile, your privacy settings are still enforced: the email address will not be displayed on your public profile or via the API.

resources

Resources