-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathquery_params.py
More file actions
78 lines (60 loc) · 2.28 KB
/
query_params.py
File metadata and controls
78 lines (60 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"""Query parameter DTOs for list/retrieve endpoints."""
from pydantic import BaseModel, ConfigDict, Field
class BaseQueryParams(BaseModel):
"""Base query parameters for API requests."""
model_config = ConfigDict(extra="ignore", populate_by_name=True)
expand: str | None = Field(
None,
description="Comma-separated list of related fields to expand in response",
)
fields: str | None = Field(
None,
description="Comma-separated list of fields to include in response",
)
external_id: str | None = Field(
None,
description="External system identifier for filtering or lookup",
)
external_source: str | None = Field(
None,
description="External system source name for filtering or lookup",
)
order_by: str | None = Field(
None,
description="Field to order results by. Prefix with '-' for descending order",
)
pql: str | None = Field(None, description="Field to apply PQL filters")
class PaginatedQueryParams(BaseQueryParams):
"""Query parameters for paginated list endpoints."""
model_config = ConfigDict(extra="ignore", populate_by_name=True)
cursor: str | None = Field(
None,
description="Pagination cursor for getting next set of results",
)
per_page: int | None = Field(
None,
description="Number of results per page",
ge=1,
le=100,
)
class WorkItemQueryParams(PaginatedQueryParams):
"""Query parameters for work item list endpoints.
Inherits all documented query parameters from PaginatedQueryParams:
- cursor: Pagination cursor
- expand: Comma-separated fields to expand
- external_id: External system identifier
- external_source: External system source name
- fields: Comma-separated fields to include
- order_by: Field to order by (prefix with '-' for descending)
- per_page: Number of results per page (1-100)
"""
model_config = ConfigDict(extra="ignore", populate_by_name=True)
class RetrieveQueryParams(BaseQueryParams):
"""Query parameters for retrieve endpoints."""
model_config = ConfigDict(extra="ignore", populate_by_name=True)
__all__ = [
"BaseQueryParams",
"PaginatedQueryParams",
"RetrieveQueryParams",
"WorkItemQueryParams",
]