Add idiomatic documentation to Go, Java, Python, and Rust clients
This commit is contained in:
@@ -14,13 +14,16 @@ class ApiKey:
|
||||
value: str
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
"""Validate that the API key value is non-empty."""
|
||||
if not self.value:
|
||||
raise ValueError("api_key must not be empty")
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""Return a repr that redacts the secret value."""
|
||||
return f"{type(self).__name__}({REDACTED!r})"
|
||||
|
||||
def bearer_value(self) -> str:
|
||||
"""Return the value formatted as an HTTP `Bearer` token."""
|
||||
return f"Bearer {self.value}"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user