PsaConnectionCreate, PsaConnectionUpdate, PsaConnectionResponse, and PsaConnectionTestResponse — registered in schemas __init__. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
"""Pydantic schemas for PSA connection management."""
|
|
from __future__ import annotations
|
|
from datetime import datetime
|
|
from uuid import UUID
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class PsaConnectionCreate(BaseModel):
|
|
provider: str = Field(default="connectwise", pattern="^(connectwise|autotask)$")
|
|
display_name: str = Field(min_length=1, max_length=100)
|
|
site_url: str = Field(min_length=1, max_length=255)
|
|
company_id: str = Field(min_length=1, max_length=100)
|
|
public_key: str = Field(min_length=1)
|
|
private_key: str = Field(min_length=1)
|
|
client_id: str = Field(min_length=1)
|
|
|
|
|
|
class PsaConnectionUpdate(BaseModel):
|
|
display_name: str | None = None
|
|
site_url: str | None = None
|
|
company_id: str | None = None
|
|
public_key: str | None = None
|
|
private_key: str | None = None
|
|
client_id: str | None = None
|
|
|
|
|
|
class PsaConnectionResponse(BaseModel):
|
|
id: UUID
|
|
account_id: UUID
|
|
provider: str
|
|
display_name: str
|
|
site_url: str
|
|
company_id: str
|
|
is_active: bool
|
|
last_validated_at: datetime | None
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
public_key_hint: str
|
|
private_key_hint: str
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class PsaConnectionTestResponse(BaseModel):
|
|
success: bool
|
|
message: str
|
|
server_version: str | None = None
|