|
1 | | -from typing import TYPE_CHECKING, Any |
| 1 | +from typing import TYPE_CHECKING, Any, Literal |
2 | 2 |
|
3 | 3 | from pydantic import BaseModel, ConfigDict, Field |
4 | 4 |
|
@@ -201,7 +201,7 @@ class WorkItemSearchItem(BaseModel): |
201 | 201 |
|
202 | 202 | id: str = Field(..., description="Issue ID") |
203 | 203 | name: str = Field(..., description="Issue name") |
204 | | - sequence_id: str = Field(..., description="Issue sequence ID") |
| 204 | + sequence_id: int = Field(..., description="Issue sequence ID") |
205 | 205 | project__identifier: str = Field(..., description="Project identifier") |
206 | 206 | project_id: str = Field(..., description="Project ID") |
207 | 207 | workspace__slug: str = Field(..., description="Workspace slug") |
@@ -525,6 +525,110 @@ class WorkItemRelationResponse(BaseModel): |
525 | 525 | ) |
526 | 526 |
|
527 | 527 |
|
| 528 | +DependencyTypeEnum = Literal[ |
| 529 | + "blocking", |
| 530 | + "blocked_by", |
| 531 | + "start_before", |
| 532 | + "start_after", |
| 533 | + "finish_before", |
| 534 | + "finish_after", |
| 535 | +] |
| 536 | + |
| 537 | + |
| 538 | +class WorkItemWithRelationType(BaseModel): |
| 539 | + """Work item with an injected relation_type label.""" |
| 540 | + |
| 541 | + model_config = ConfigDict(extra="allow", populate_by_name=True) |
| 542 | + |
| 543 | + id: str | None = None |
| 544 | + name: str | None = None |
| 545 | + sequence_id: int | None = None |
| 546 | + project_id: str | None = None |
| 547 | + state_id: str | None = None |
| 548 | + priority: str | None = None |
| 549 | + type_id: str | None = None |
| 550 | + is_epic: bool | None = None |
| 551 | + label_ids: list[str] = Field(default_factory=list) |
| 552 | + assignee_ids: list[str] = Field(default_factory=list) |
| 553 | + sort_order: float | None = None |
| 554 | + created_at: str | None = None |
| 555 | + updated_at: str | None = None |
| 556 | + created_by: str | None = None |
| 557 | + updated_by: str | None = None |
| 558 | + relation_type: str | None = None |
| 559 | + |
| 560 | + |
| 561 | +class WorkItemDependencyResponse(BaseModel): |
| 562 | + """Response model for GET /relation-dependencies/.""" |
| 563 | + |
| 564 | + model_config = ConfigDict(extra="allow", populate_by_name=True) |
| 565 | + |
| 566 | + blocking: list[WorkItemWithRelationType] = Field(default_factory=list) |
| 567 | + blocked_by: list[WorkItemWithRelationType] = Field(default_factory=list) |
| 568 | + start_before: list[WorkItemWithRelationType] = Field(default_factory=list) |
| 569 | + start_after: list[WorkItemWithRelationType] = Field(default_factory=list) |
| 570 | + finish_before: list[WorkItemWithRelationType] = Field(default_factory=list) |
| 571 | + finish_after: list[WorkItemWithRelationType] = Field(default_factory=list) |
| 572 | + |
| 573 | + |
| 574 | +class CreateWorkItemDependency(BaseModel): |
| 575 | + """Request model for creating work item dependency relations.""" |
| 576 | + |
| 577 | + model_config = ConfigDict(extra="ignore", populate_by_name=True) |
| 578 | + |
| 579 | + relation_type: DependencyTypeEnum = Field( |
| 580 | + ..., |
| 581 | + description="Dependency direction from the perspective of this work item", |
| 582 | + ) |
| 583 | + work_item_ids: list[str] = Field( |
| 584 | + ..., |
| 585 | + description="UUIDs of work items to create dependencies with", |
| 586 | + min_length=1, |
| 587 | + ) |
| 588 | + |
| 589 | + |
| 590 | +class RemoveWorkItemDependency(BaseModel): |
| 591 | + """Request model for removing a work item dependency.""" |
| 592 | + |
| 593 | + model_config = ConfigDict(extra="ignore", populate_by_name=True) |
| 594 | + |
| 595 | + work_item_id: str = Field( |
| 596 | + ..., |
| 597 | + description="UUID of the related work item whose dependency should be removed", |
| 598 | + ) |
| 599 | + |
| 600 | + |
| 601 | +class CreateWorkItemCustomRelation(BaseModel): |
| 602 | + """Request model for creating a custom (definition-based) work item relation.""" |
| 603 | + |
| 604 | + model_config = ConfigDict(extra="ignore", populate_by_name=True) |
| 605 | + |
| 606 | + relation_definition_id: str = Field( |
| 607 | + ..., |
| 608 | + description="UUID of the workspace relation definition", |
| 609 | + ) |
| 610 | + relation_definition_type: str = Field( |
| 611 | + ..., |
| 612 | + description="The outward or inward label of the definition (controls directionality)", |
| 613 | + ) |
| 614 | + work_item_ids: list[str] = Field( |
| 615 | + ..., |
| 616 | + description="UUIDs of work items to create the relation with", |
| 617 | + min_length=1, |
| 618 | + ) |
| 619 | + |
| 620 | + |
| 621 | +class RemoveWorkItemCustomRelation(BaseModel): |
| 622 | + """Request model for removing a custom work item relation.""" |
| 623 | + |
| 624 | + model_config = ConfigDict(extra="ignore", populate_by_name=True) |
| 625 | + |
| 626 | + work_item_id: str = Field( |
| 627 | + ..., |
| 628 | + description="UUID of the related work item whose custom relation should be removed", |
| 629 | + ) |
| 630 | + |
| 631 | + |
528 | 632 | class WorkItemWorkLog(BaseModel): |
529 | 633 | """Work item work log model.""" |
530 | 634 |
|
|
0 commit comments