mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +08:00
feat(trigger): enhance trigger subscription management and processing
- Refactor trigger provider classes to improve naming consistency and clarity - Introduce new methods for managing trigger subscriptions, including validation and dispatching - Update API endpoints to reflect changes in subscription handling - Implement logging and request management for endpoint interactions - Enhance data models to support subscription attributes and lifecycle management Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@ -7,6 +7,7 @@ from core.entities.provider_entities import ProviderConfig
|
||||
from core.plugin.entities.plugin_daemon import CredentialType
|
||||
from core.trigger.entities.entities import (
|
||||
OAuthSchema,
|
||||
Subscription,
|
||||
SubscriptionSchema,
|
||||
TriggerDescription,
|
||||
TriggerEntity,
|
||||
@ -39,5 +40,27 @@ class TriggerApiEntity(BaseModel):
|
||||
parameters: list[TriggerParameter] = Field(description="The parameters of the trigger")
|
||||
output_schema: Optional[Mapping[str, Any]] = Field(description="The output schema of the trigger")
|
||||
|
||||
class SubscriptionValidation(BaseModel):
|
||||
id: str
|
||||
name: str
|
||||
tenant_id: str
|
||||
user_id: str
|
||||
provider_id: str
|
||||
endpoint: str
|
||||
parameters: dict
|
||||
properties: dict
|
||||
credentials: dict
|
||||
credential_type: str
|
||||
credential_expires_at: int
|
||||
expires_at: int
|
||||
|
||||
def to_subscription(self) -> Subscription:
|
||||
return Subscription(
|
||||
expires_at=self.expires_at,
|
||||
endpoint=self.endpoint,
|
||||
parameters=self.parameters,
|
||||
properties=self.properties,
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["TriggerApiEntity", "TriggerProviderApiEntity", "TriggerProviderSubscriptionApiEntity"]
|
||||
|
||||
Reference in New Issue
Block a user