Skip to content

gitea.user.async_user

async_user

Asynchronous User Resource for Gitea API.

Classes

gitea.user.async_user.AsyncUser

AsyncUser(client: AsyncClientProtocol)

Bases: BaseUser, AsyncResource

Asynchronous Gitea User resource.

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

    Args:
        client: An instance of the AsyncGitea client.

    """
    self.client = client
Methods:
gitea.user.async_user.AsyncUser.get_user async
get_user(
    username: 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
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing the user information as a dictionary and a dictionary with the status code.

Source code in src/gitea/user/async_user.py
async def get_user(self, username: 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.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the user information as a dictionary and a dictionary with the status code.

    """
    response = await self._get_user(username=username, **kwargs)
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.user.async_user.AsyncUser.update_user_settings async
update_user_settings(
    diff_view_style: str | None = None,
    full_name: str | None = None,
    hide_activity: bool | None = None,
    hide_email: bool | None = None,
    language: str | None = None,
    location: str | None = None,
    theme: str | None = None,
    website: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Asynchronously update user settings.

Parameters:

Name Type Description Default
diff_view_style str | None

The preferred diff view style.

None
full_name str | None

The full name of the user.

None
hide_activity bool | None

Whether to hide user activity.

None
hide_email bool | None

Whether to hide user email.

None
language str | None

The preferred language.

None
location str | None

The location of the user.

None
theme str | None

The preferred theme.

None
website str | None

The user's website.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing the updated user information as a dictionary and a dictionary with the status code.

Source code in src/gitea/user/async_user.py
async def update_user_settings(
    self,
    diff_view_style: str | None = None,
    full_name: str | None = None,
    hide_activity: bool | None = None,
    hide_email: bool | None = None,
    language: str | None = None,
    location: str | None = None,
    theme: str | None = None,
    website: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Asynchronously update user settings.

    Args:
        diff_view_style: The preferred diff view style.
        full_name: The full name of the user.
        hide_activity: Whether to hide user activity.
        hide_email: Whether to hide user email.
        language: The preferred language.
        location: The location of the user.
        theme: The preferred theme.
        website: The user's website.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the updated user information as a dictionary and a dictionary with the status code.

    """
    response = await self._update_user_settings(
        diff_view_style=diff_view_style,
        full_name=full_name,
        hide_activity=hide_activity,
        hide_email=hide_email,
        language=language,
        location=location,
        theme=theme,
        website=website,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}

Functions: