feat(psa): implement get_ticket in ConnectWise provider
Replace NotImplementedError stub with real implementation that fetches a ticket by ID via CW REST API and maps it to PSATicket. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -39,7 +39,24 @@ class ConnectWiseProvider(PSAProvider):
|
|||||||
# ── Stubs for Phase A slices 2-5 ─────────────────────────────────
|
# ── Stubs for Phase A slices 2-5 ─────────────────────────────────
|
||||||
|
|
||||||
async def get_ticket(self, ticket_id: str) -> PSATicket:
|
async def get_ticket(self, ticket_id: str) -> PSATicket:
|
||||||
raise NotImplementedError("Implemented in Slice 2")
|
"""Fetch a single ticket by ID from ConnectWise."""
|
||||||
|
data = await self.client.get(
|
||||||
|
f"/service/tickets/{ticket_id}",
|
||||||
|
params={"fields": "id,summary,company,board,status,priority,closedFlag"},
|
||||||
|
)
|
||||||
|
return PSATicket(
|
||||||
|
id=str(data["id"]),
|
||||||
|
summary=data.get("summary", ""),
|
||||||
|
company_name=data.get("company", {}).get("name"),
|
||||||
|
company_id=str(data["company"]["id"]) if data.get("company") else None,
|
||||||
|
board_name=data.get("board", {}).get("name"),
|
||||||
|
board_id=data.get("board", {}).get("id"),
|
||||||
|
status_name=data.get("status", {}).get("name"),
|
||||||
|
status_id=data.get("status", {}).get("id"),
|
||||||
|
priority_name=data.get("priority", {}).get("name"),
|
||||||
|
priority_id=data.get("priority", {}).get("id"),
|
||||||
|
closed=data.get("closedFlag", False),
|
||||||
|
)
|
||||||
|
|
||||||
async def search_tickets(self, query: str, **filters) -> list[PSATicket]:
|
async def search_tickets(self, query: str, **filters) -> list[PSATicket]:
|
||||||
raise NotImplementedError("Implemented in Slice 3")
|
raise NotImplementedError("Implemented in Slice 3")
|
||||||
|
|||||||
Reference in New Issue
Block a user