# Code generated by openapi-nexus. DO NOT EDIT.
#
# Multi Status API — 1.0.0
"""Authentication helpers."""
from __future__ import annotations
from abc import ABC, abstractmethod
class Authenticator(ABC):
"""Base class for request authenticators."""
@abstractmethod
def auth_headers(self) -> dict[str, str]:
"""Return headers to attach to every request."""
...
class BearerAuth(Authenticator):
"""Bearer token authentication."""
def __init__(self, token: str) -> None:
self._token = token
def auth_headers(self) -> dict[str, str]:
return {"Authorization": f"Bearer {self._token}"}
class ApiKeyAuth(Authenticator):
"""API key authentication via a custom header."""
def __init__(self, header_name: str, api_key: str) -> None:
self._header_name = header_name
self._api_key = api_key
def auth_headers(self) -> dict[str, str]:
return {self._header_name: self._api_key}