Files
Harry 3a66fc061b refactor(trigger): remove resubscribe functionality and update subscription handling
- Removed the resubscribe_trigger method and its associated request entity.
- Updated subscription parameters to streamline the subscribe and unsubscribe processes.
- Enhanced the trigger provider interface to utilize the new subscription schema.
- Adjusted GitHub provider implementation to align with the updated subscription structure.
2025-08-29 15:07:26 +08:00

45 lines
1.7 KiB
Python

from collections.abc import Mapping, Sequence
from typing import Any
from pydantic import BaseModel, Field
from dify_plugin.core.documentation.schema_doc import docs
from dify_plugin.entities.provider_config import ProviderConfig
@docs(
name="OAuthSchema",
description="The schema of the OAuth",
)
class OAuthSchema(BaseModel):
client_schema: Sequence[ProviderConfig] = Field(default_factory=list, description="The schema of the OAuth client")
credentials_schema: Sequence[ProviderConfig] = Field(
default_factory=list, description="The schema of the OAuth credentials"
)
class OAuthCredentials(BaseModel):
metadata: Mapping[str, Any] = Field(default_factory=dict, description="The metadata like avatar_url, name, etc.")
credentials: Mapping[str, Any] = Field(..., description="The credentials of the OAuth")
expires_at: int = Field(
default=-1, description="The timestamp of the credentials expiration, -1 means never expires"
)
class ToolOAuthCredentials(BaseModel):
credentials: Mapping[str, Any] = Field(..., description="The credentials of the tool")
expires_at: int | None = Field(
default=-1,
description="""The expiration timestamp (in seconds since Unix epoch, UTC) of the credentials.
Set to -1 or None if the credentials do not expire.""",
)
class TriggerOAuthCredentials(BaseModel):
credentials: Mapping[str, Any] = Field(..., description="The credentials of the trigger")
expires_at: int | None = Field(
default=-1,
description="""The expiration timestamp (in seconds since Unix epoch, UTC) of the credentials.
Set to -1 or None if the credentials do not expire.""",
)