Skip to content

ghnova.user

user

GitHub user module.

Classes

ghnova.user.AsyncUser

AsyncUser(client: AsyncGitHub)

Bases: BaseUser, AsyncResource

GitHub Asynchronous User resource.

Source code in src/ghnova/resource/async_resource.py
def __init__(self, client: AsyncGitHub) -> None:
    """Initialize the Resource with a AsyncGitHub client.

    Args:
        client: An instance of the AsyncGitHub client.

    """
    self.client = client
Functions
ghnova.user.AsyncUser.get_user async
get_user(username: str | None = None, account_id: int | None = None, etag: str | None = None, last_modified: str | None = None, **kwargs: Any) -> tuple[dict[str, Any], dict[str, Any]]

Asynchronously get user information.

Parameters:

Name Type Description Default
username str | None

The username of the user to retrieve. If None, retrieves the authenticated user.

None
account_id int | None

The account ID of the user to retrieve. If None, retrieves by username.

None
etag str | None

The ETag value for conditional requests.

None
last_modified str | None

The Last-Modified timestamp for conditional requests.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[dict[str, Any], dict[str, Any]]

A tuple containing:

  • A dictionary with user information (empty if 304 Not Modified).
  • A dictionary with metadata including status_code, etag, and last_modified.
Source code in src/ghnova/user/async_user.py
async def get_user(
    self,
    username: str | None = None,
    account_id: int | None = None,
    etag: str | None = None,
    last_modified: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Asynchronously get user information.

    Args:
        username: The username of the user to retrieve. If None, retrieves the authenticated user.
        account_id: The account ID of the user to retrieve. If None, retrieves by username.
        etag: The ETag value for conditional requests.
        last_modified: The Last-Modified timestamp for conditional requests.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing:

            - A dictionary with user information (empty if 304 Not Modified).
            - A dictionary with metadata including status_code, etag, and last_modified.

    """
    response = await self._get_user(
        username=username, account_id=account_id, etag=etag, last_modified=last_modified, **kwargs
    )
    data, status_code, etag_value, last_modified_value = await process_async_response_with_last_modified(response)
    data = cast(dict[str, Any], data)
    return data, {"status_code": status_code, "etag": etag_value, "last_modified": last_modified_value}
ghnova.user.AsyncUser.update_user async
update_user(name: str | None = None, email: str | None = None, blog: str | None = None, twitter_username: str | None = None, company: str | None = None, location: str | None = None, hireable: bool | None = None, bio: str | None = None, etag: str | None = None, last_modified: str | None = None, **kwargs: Any) -> tuple[dict[str, Any], dict[str, Any]]

Asynchronously update the authenticated user's information.

Parameters:

Name Type Description Default
name str | None

The user's name.

None
email str | None

The user's email.

None
blog str | None

The user's blog URL.

None
twitter_username str | None

The user's Twitter username.

None
company str | None

The user's company.

None
location str | None

The user's location.

None
hireable bool | None

Whether the user is available for hire.

None
bio str | None

The user's bio.

None
etag str | None

The ETag value for conditional requests.

None
last_modified str | None

The Last-Modified timestamp for conditional requests.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[dict[str, Any], dict[str, Any]]

A tuple containing:

  • A dictionary with updated user information.
  • A dictionary with metadata including status_code, etag, and last_modified.
Source code in src/ghnova/user/async_user.py
async def update_user(  # noqa: PLR0913
    self,
    name: str | None = None,
    email: str | None = None,
    blog: str | None = None,
    twitter_username: str | None = None,
    company: str | None = None,
    location: str | None = None,
    hireable: bool | None = None,
    bio: str | None = None,
    etag: str | None = None,
    last_modified: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Asynchronously update the authenticated user's information.

    Args:
        name: The user's name.
        email: The user's email.
        blog: The user's blog URL.
        twitter_username: The user's Twitter username.
        company: The user's company.
        location: The user's location.
        hireable: Whether the user is available for hire.
        bio: The user's bio.
        etag: The ETag value for conditional requests.
        last_modified: The Last-Modified timestamp for conditional requests.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing:

            - A dictionary with updated user information.
            - A dictionary with metadata including status_code, etag, and last_modified.

    """
    response = await self._update_user(
        name=name,
        email=email,
        blog=blog,
        twitter_username=twitter_username,
        company=company,
        location=location,
        hireable=hireable,
        bio=bio,
        etag=etag,
        last_modified=last_modified,
        **kwargs,
    )
    data, status_code, etag, last_modified = await process_async_response_with_last_modified(response)
    data = cast(dict[str, Any], data)
    return data, {"status_code": status_code, "etag": etag, "last_modified": last_modified}
ghnova.user.AsyncUser.list_users async
list_users(since: int | None = None, per_page: int | None = None, etag: str | None = None, last_modified: str | None = None, **kwargs: Any) -> tuple[list[dict[str, Any]], dict[str, Any]]

Asynchronously list all users.

Parameters:

Name Type Description Default
since int | None

The integer ID of the last User that you've seen.

None
per_page int | None

The number of results per page (max 100).

None
etag str | None

The ETag value for conditional requests.

None
last_modified str | None

The Last-Modified timestamp for conditional requests.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[list[dict[str, Any]], dict[str, Any]]

A tuple containing:

  • A list of user dictionaries (empty if 304 Not Modified).
  • A dictionary with metadata including status_code, etag, and last_modified.
Source code in src/ghnova/user/async_user.py
async def list_users(
    self,
    since: int | None = None,
    per_page: int | None = None,
    etag: str | None = None,
    last_modified: str | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """Asynchronously list all users.

    Args:
        since: The integer ID of the last User that you've seen.
        per_page: The number of results per page (max 100).
        etag: The ETag value for conditional requests.
        last_modified: The Last-Modified timestamp for conditional requests.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing:

            - A list of user dictionaries (empty if 304 Not Modified).
            - A dictionary with metadata including status_code, etag, and last_modified.

    """
    response = await self._list_users(
        since=since, per_page=per_page, etag=etag, last_modified=last_modified, **kwargs
    )
    data, status_code, etag_value, last_modified_value = await process_async_response_with_last_modified(response)
    data = cast(list[dict[str, Any]], data)
    return data, {"status_code": status_code, "etag": etag_value, "last_modified": last_modified_value}
ghnova.user.AsyncUser.get_contextual_information async
get_contextual_information(username: str, subject_type: str | None = None, subject_id: str | None = None, **kwargs: Any) -> tuple[dict[str, Any], dict[str, Any]]

Asynchronously get contextual information about a user.

Parameters:

Name Type Description Default
username str

The username of the user.

required
subject_type str | None

The type of subject for the hovercard.

None
subject_id str | None

The ID of the subject for the hovercard.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[dict[str, Any], dict[str, Any]]

A tuple containing:

  • A dictionary with contextual information.
  • A dictionary with metadata including status_code, etag, and last_modified.
Source code in src/ghnova/user/async_user.py
async def get_contextual_information(
    self,
    username: str,
    subject_type: str | None = None,
    subject_id: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Asynchronously get contextual information about a user.

    Args:
        username: The username of the user.
        subject_type: The type of subject for the hovercard.
        subject_id: The ID of the subject for the hovercard.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing:

            - A dictionary with contextual information.
            - A dictionary with metadata including status_code, etag, and last_modified.

    """
    response = await self._get_contextual_information(
        username=username, subject_type=subject_type, subject_id=subject_id, **kwargs
    )
    data, status_code, etag_value, last_modified_value = await process_async_response_with_last_modified(response)
    data = cast(dict[str, Any], data)
    return data, {"status_code": status_code, "etag": etag_value, "last_modified": last_modified_value}

ghnova.user.User

User(client: GitHub)

Bases: BaseUser, Resource

GitHub User resource.

Source code in src/ghnova/resource/resource.py
def __init__(self, client: GitHub) -> None:
    """Initialize the Resource with a GitHub client.

    Args:
        client: An instance of the GitHub client.

    """
    self.client = client
Functions
ghnova.user.User.get_user
get_user(username: str | None = None, account_id: int | None = None, etag: str | None = None, last_modified: str | None = None, **kwargs: Any) -> tuple[dict[str, Any], dict[str, Any]]

Get user information.

Parameters:

Name Type Description Default
username str | None

The username of the user to retrieve. If None, retrieves the authenticated user.

None
account_id int | None

The account ID of the user to retrieve. If None, retrieves by username.

None
etag str | None

The ETag value for conditional requests.

None
last_modified str | None

The Last-Modified timestamp for conditional requests.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[dict[str, Any], dict[str, Any]]

A tuple containing:

  • A dictionary with user information (empty if 304 Not Modified).
  • A dictionary with metadata including status_code, etag, and last_modified.
Source code in src/ghnova/user/user.py
def get_user(
    self,
    username: str | None = None,
    account_id: int | None = None,
    etag: str | None = None,
    last_modified: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Get user information.

    Args:
        username: The username of the user to retrieve. If None, retrieves the authenticated user.
        account_id: The account ID of the user to retrieve. If None, retrieves by username.
        etag: The ETag value for conditional requests.
        last_modified: The Last-Modified timestamp for conditional requests.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing:

            - A dictionary with user information (empty if 304 Not Modified).
            - A dictionary with metadata including status_code, etag, and last_modified.

    """
    response = self._get_user(
        username=username, account_id=account_id, etag=etag, last_modified=last_modified, **kwargs
    )
    data, status_code, etag_value, last_modified_value = process_response_with_last_modified(response)
    data = cast(dict[str, Any], data)
    return data, {"status_code": status_code, "etag": etag_value, "last_modified": last_modified_value}
ghnova.user.User.update_user
update_user(name: str | None = None, email: str | None = None, blog: str | None = None, twitter_username: str | None = None, company: str | None = None, location: str | None = None, hireable: bool | None = None, bio: str | None = None, etag: str | None = None, last_modified: str | None = None, **kwargs: Any) -> tuple[dict[str, Any], dict[str, Any]]

Update the authenticated user's information.

Parameters:

Name Type Description Default
name str | None

The name of the user.

None
email str | None

The email of the user.

None
blog str | None

The blog URL of the user.

None
twitter_username str | None

The Twitter username of the user.

None
company str | None

The company of the user.

None
location str | None

The location of the user.

None
hireable bool | None

The hireable status of the user.

None
bio str | None

The bio of the user.

None
etag str | None

The ETag value for conditional requests.

None
last_modified str | None

The Last-Modified timestamp for conditional requests.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[dict[str, Any], dict[str, Any]]

A tuple containing:

  • A dictionary with updated user information (empty if 304 Not Modified).
  • A dictionary with metadata including status_code, etag, and last_modified.
Source code in src/ghnova/user/user.py
def update_user(  # noqa: PLR0913
    self,
    name: str | None = None,
    email: str | None = None,
    blog: str | None = None,
    twitter_username: str | None = None,
    company: str | None = None,
    location: str | None = None,
    hireable: bool | None = None,
    bio: str | None = None,
    etag: str | None = None,
    last_modified: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Update the authenticated user's information.

    Args:
        name: The name of the user.
        email: The email of the user.
        blog: The blog URL of the user.
        twitter_username: The Twitter username of the user.
        company: The company of the user.
        location: The location of the user.
        hireable: The hireable status of the user.
        bio: The bio of the user.
        etag: The ETag value for conditional requests.
        last_modified: The Last-Modified timestamp for conditional requests.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing:

            - A dictionary with updated user information (empty if 304 Not Modified).
            - A dictionary with metadata including status_code, etag, and last_modified.

    """
    response = self._update_user(
        name=name,
        email=email,
        blog=blog,
        twitter_username=twitter_username,
        company=company,
        location=location,
        hireable=hireable,
        bio=bio,
        etag=etag,
        last_modified=last_modified,
        **kwargs,
    )
    data, status_code, etag_value, last_modified_value = process_response_with_last_modified(response)
    data = cast(dict[str, Any], data)

    return data, {"status_code": status_code, "etag": etag_value, "last_modified": last_modified_value}
ghnova.user.User.list_users
list_users(since: int | None = None, per_page: int | None = None, etag: str | None = None, last_modified: str | None = None, **kwargs: Any) -> tuple[list[dict[str, Any]], dict[str, Any]]

List all users.

Parameters:

Name Type Description Default
since int | None

The integer ID of the last User that you've seen.

None
per_page int | None

The number of results per page (max 100).

None
etag str | None

The ETag value for conditional requests.

None
last_modified str | None

The Last-Modified timestamp for conditional requests.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[list[dict[str, Any]], dict[str, Any]]

A tuple containing:

  • A list of user dictionaries (empty if 304 Not Modified).
  • A dictionary with metadata including status_code, etag, and last_modified.
Source code in src/ghnova/user/user.py
def list_users(
    self,
    since: int | None = None,
    per_page: int | None = None,
    etag: str | None = None,
    last_modified: str | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """List all users.

    Args:
        since: The integer ID of the last User that you've seen.
        per_page: The number of results per page (max 100).
        etag: The ETag value for conditional requests.
        last_modified: The Last-Modified timestamp for conditional requests.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing:

            - A list of user dictionaries (empty if 304 Not Modified).
            - A dictionary with metadata including status_code, etag, and last_modified.

    """
    response = self._list_users(since=since, per_page=per_page, etag=etag, last_modified=last_modified, **kwargs)
    data, status_code, etag_value, last_modified_value = process_response_with_last_modified(response)
    if status_code == 304:  # noqa: PLR2004
        data = []
    return cast(list[dict[str, Any]], data), {
        "status_code": status_code,
        "etag": etag_value,
        "last_modified": last_modified_value,
    }
ghnova.user.User.get_contextual_information
get_contextual_information(username: str, subject_type: str | None = None, subject_id: str | None = None, **kwargs: Any) -> tuple[dict[str, Any], dict[str, Any]]

Get contextual information about a user.

Parameters:

Name Type Description Default
username str

The username of the user.

required
subject_type str | None

The type of subject for the hovercard.

None
subject_id str | None

The ID of the subject for the hovercard.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[dict[str, Any], dict[str, Any]]

A tuple containing:

  • A dictionary with contextual information about the user.
  • A dictionary with metadata including status_code, etag, and last_modified.
Source code in src/ghnova/user/user.py
def get_contextual_information(
    self,
    username: str,
    subject_type: str | None = None,
    subject_id: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Get contextual information about a user.

    Args:
        username: The username of the user.
        subject_type: The type of subject for the hovercard.
        subject_id: The ID of the subject for the hovercard.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing:

            - A dictionary with contextual information about the user.
            - A dictionary with metadata including status_code, etag, and last_modified.

    """
    response = self._get_contextual_information(
        username=username, subject_type=subject_type, subject_id=subject_id, **kwargs
    )
    data, status_code, etag_value, last_modified_value = process_response_with_last_modified(response)
    data = cast(dict[str, Any], data)
    return data, {"status_code": status_code, "etag": etag_value, "last_modified": last_modified_value}