Module ogr.services.github.auth_providers.abstract

Classes

class GithubAuthentication
Expand source code
class GithubAuthentication:
    """
    Represents a token manager for authentication via GitHub App.
    """

    def get_token(self, namespace: str, repo: str) -> str:
        """
        Get a GitHub token for requested repository.

        Args:
            namespace: Namespace of the repository.
            repo: Name of the repository.

        Returns:
            A token that can be used in PyGithub instance for authentication.
        """
        raise NotImplementedError()

    @property
    def pygithub_instance(self) -> "github.Github":
        """
        Returns:
            Generic PyGithub instance. Used for `GitUser` for example.
        """
        raise NotImplementedError()

    @staticmethod
    def try_create(**kwargs) -> Optional["GithubAuthentication"]:
        """
        Tries to construct authentication object from provided keyword arguments.

        Returns:
            `GithubAuthentication` object or `None` if the creation was not
            successful.
        """
        raise NotImplementedError()

Represents a token manager for authentication via GitHub App.

Subclasses

Static methods

def try_create(**kwargs) ‑> GithubAuthentication | None
Expand source code
@staticmethod
def try_create(**kwargs) -> Optional["GithubAuthentication"]:
    """
    Tries to construct authentication object from provided keyword arguments.

    Returns:
        `GithubAuthentication` object or `None` if the creation was not
        successful.
    """
    raise NotImplementedError()

Tries to construct authentication object from provided keyword arguments.

Returns -----= GithubAuthentication object or None if the creation was not successful.

Instance variables

prop pygithub_instance : github.Github
Expand source code
@property
def pygithub_instance(self) -> "github.Github":
    """
    Returns:
        Generic PyGithub instance. Used for `GitUser` for example.
    """
    raise NotImplementedError()

Returns -----= Generic PyGithub instance. Used for GitUser for example.

Methods

def get_token(self, namespace: str, repo: str) ‑> str
Expand source code
def get_token(self, namespace: str, repo: str) -> str:
    """
    Get a GitHub token for requested repository.

    Args:
        namespace: Namespace of the repository.
        repo: Name of the repository.

    Returns:
        A token that can be used in PyGithub instance for authentication.
    """
    raise NotImplementedError()

Get a GitHub token for requested repository.

Args
-----=
namespace
Namespace of the repository.
repo
Name of the repository.

Returns -----= A token that can be used in PyGithub instance for authentication.