87 lines
1.9 KiB
Python
87 lines
1.9 KiB
Python
from datetime import datetime
|
|
from typing import Any
|
|
from uuid import UUID
|
|
|
|
from ninja import Schema
|
|
|
|
|
|
class ChannelEndpointIn(Schema):
|
|
name: str
|
|
adapter_type: str = "generic_webhook"
|
|
outbound_url: str = ""
|
|
webhook_secret: str
|
|
outbound_token: str = ""
|
|
enabled: bool = True
|
|
|
|
|
|
class ChannelEndpointOut(Schema):
|
|
id: int
|
|
public_id: UUID
|
|
name: str
|
|
adapter_type: str
|
|
outbound_url: str
|
|
webhook_secret_set: bool
|
|
outbound_token_set: bool
|
|
enabled: bool
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class ChannelEndpointUpdateIn(Schema):
|
|
name: str | None = None
|
|
outbound_url: str | None = None
|
|
webhook_secret: str | None = None
|
|
outbound_token: str | None = None
|
|
enabled: bool | None = None
|
|
|
|
|
|
class ChannelInboundIn(Schema):
|
|
external_message_id: str
|
|
external_conversation_id: str
|
|
text: str
|
|
sender: str = ""
|
|
title: str = ""
|
|
participants: list[str] = []
|
|
occurred_at: datetime | None = None
|
|
payload: dict[str, Any] = {}
|
|
|
|
|
|
class ChannelReceiptIn(Schema):
|
|
external_message_id: str
|
|
external_receipt_id: str
|
|
receipt_type: str
|
|
payload: dict[str, Any] = {}
|
|
|
|
|
|
class ChannelOutboundIn(Schema):
|
|
external_conversation_id: str
|
|
idempotency_key: str
|
|
customer_reply_task_id: int
|
|
expected_revision: int
|
|
payload: dict[str, Any] = {}
|
|
|
|
|
|
class ChannelMessageOut(Schema):
|
|
public_id: UUID
|
|
endpoint_id: int
|
|
endpoint_name: str
|
|
conversation_public_id: UUID | None
|
|
external_conversation_id: str
|
|
ticket_id: int | None
|
|
customer_reply_task_id: int | None
|
|
reply_revision: int | None
|
|
direction: str
|
|
external_message_id: str
|
|
idempotency_key: str
|
|
sender: str
|
|
message_type: str
|
|
text: str
|
|
payload: dict[str, Any]
|
|
status: str
|
|
error_message: str
|
|
occurred_at: datetime | None
|
|
sent_at: datetime | None
|
|
delivered_at: datetime | None
|
|
created_at: datetime
|
|
updated_at: datetime
|