mirror of
https://github.com/langgenius/dify.git
synced 2026-11-13 06:41:07 +08:00
37 lines
1.0 KiB
Python
37 lines
1.0 KiB
Python
"""Credential check and OAuth revocation results returned by plugin providers."""
|
|
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, StrictBool
|
|
|
|
AuthReasonCode = Literal[
|
|
"credential_invalid",
|
|
"credential_expired",
|
|
"credential_revoked",
|
|
"provider_timeout",
|
|
"provider_network_error",
|
|
"provider_rate_limited",
|
|
"provider_unavailable",
|
|
]
|
|
|
|
|
|
class CredentialCheckResponse(BaseModel):
|
|
model_config = ConfigDict(extra="forbid", hide_input_in_errors=True)
|
|
|
|
# None means the provider supplied no more specific reason.
|
|
reason_code: AuthReasonCode | None
|
|
retryable: StrictBool
|
|
status: Literal["valid", "invalid", "temporarily_unavailable", "unsupported"]
|
|
|
|
|
|
class CredentialCheckResult(CredentialCheckResponse):
|
|
checked_at: int
|
|
|
|
|
|
class OAuthRevokeResult(BaseModel):
|
|
model_config = ConfigDict(extra="forbid", hide_input_in_errors=True)
|
|
|
|
reason_code: AuthReasonCode | None
|
|
retryable: StrictBool
|
|
status: Literal["revoked", "unsupported", "temporarily_unavailable", "failed"]
|