taolib.testing.oauth.models.connection

目录

taolib.testing.oauth.models.connection#

OAuth 连接数据模型模块。

定义 OAuth 连接(用户与第三方提供商的关联)相关的 Pydantic 模型。

Classes#

OAuthConnectionBase

OAuth 连接基础模型。

OAuthConnectionCreate

创建 OAuth 连接请求模型。

OAuthConnectionUpdate

更新 OAuth 连接请求模型。

OAuthConnectionResponse

OAuth 连接响应模型。

OAuthConnectionDocument

MongoDB OAuth 连接文档模型。

Module Contents#

class taolib.testing.oauth.models.connection.OAuthConnectionBase#

Bases: pydantic.BaseModel

OAuth 连接基础模型。

provider: taolib.testing.oauth.models.enums.OAuthProvider#
provider_user_id: str#
email: str | None#
display_name: str#
avatar_url: str#
class taolib.testing.oauth.models.connection.OAuthConnectionCreate#

Bases: OAuthConnectionBase

创建 OAuth 连接请求模型。

user_id: str#
access_token_encrypted: str#
refresh_token_encrypted: str | None#
token_expires_at: datetime.datetime | None#
scopes: list[str]#
class taolib.testing.oauth.models.connection.OAuthConnectionUpdate#

Bases: pydantic.BaseModel

更新 OAuth 连接请求模型。

access_token_encrypted: str | None#
refresh_token_encrypted: str | None#
token_expires_at: datetime.datetime | None#
status: taolib.testing.oauth.models.enums.OAuthConnectionStatus | None#
display_name: str | None#
avatar_url: str | None#
email: str | None#
last_used_at: datetime.datetime | None#
class taolib.testing.oauth.models.connection.OAuthConnectionResponse#

Bases: OAuthConnectionBase

OAuth 连接响应模型。

不包含加密的 Token 信息。

id: str#
user_id: str#
status: taolib.testing.oauth.models.enums.OAuthConnectionStatus#
scopes: list[str]#
token_expires_at: datetime.datetime | None#
last_used_at: datetime.datetime | None#
created_at: datetime.datetime#
updated_at: datetime.datetime#
model_config: dict[str, Any]#
class taolib.testing.oauth.models.connection.OAuthConnectionDocument#

Bases: OAuthConnectionBase

MongoDB OAuth 连接文档模型。

id: str#
user_id: str#
access_token_encrypted: str#
refresh_token_encrypted: str | None#
token_expires_at: datetime.datetime | None#
scopes: list[str]#
status: taolib.testing.oauth.models.enums.OAuthConnectionStatus#
last_used_at: datetime.datetime | None#
created_at: datetime.datetime#
updated_at: datetime.datetime#
model_config: dict[str, Any]#
to_response() OAuthConnectionResponse#

转换为响应模型(不包含加密 Token)。