-
Notifications
You must be signed in to change notification settings - Fork 24
feat: initiative work items, rich text values, and customer property enums #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
5141048
feat: introduce InitiativeWorkItems API client
akhil-vamshi-konam 7cda080
fix: update WorkItems API to use exclude_unset for model serialization
akhil-vamshi-konam e613beb
refactor: update customer property models to use new enums for proper…
akhil-vamshi-konam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| from collections.abc import Iterable, Mapping | ||
| from typing import Any | ||
|
|
||
| from ...models.work_items import PaginatedWorkItemResponse, WorkItem | ||
| from ..base_resource import BaseResource | ||
|
|
||
|
|
||
| class InitiativeWorkItems(BaseResource): | ||
| """API client for managing work items associated with initiatives. | ||
|
|
||
| This is the successor to :class:`~plane.api.initiatives.epics.InitiativeEpics`. | ||
| The two surfaces share one implementation server-side and one association | ||
| model, so they behave identically; they differ only in the URL and in the | ||
| request field name (``work_item_ids`` here, ``epic_ids`` there). Any | ||
| work-item type is accepted -- the ``/epics/`` spelling reflects the old | ||
| Epic-only model and is deprecated. | ||
| """ | ||
|
|
||
| def __init__(self, config: Any) -> None: | ||
| super().__init__(config, "/workspaces/") | ||
|
|
||
| def list( | ||
| self, workspace_slug: str, initiative_id: str, params: Mapping[str, Any] | None = None | ||
| ) -> PaginatedWorkItemResponse: | ||
| """List the work items associated with an initiative (paginated). | ||
|
|
||
| Returns one page (20 by default). Pass `per_page`/`cursor` in params and | ||
| follow `next_cursor` to page through the rest. | ||
|
|
||
| Args: | ||
| workspace_slug: The workspace slug identifier | ||
| initiative_id: UUID of the initiative | ||
| params: Optional query parameters, e.g. `per_page`, `cursor` | ||
|
|
||
| Returns: | ||
| Paginated list of work items | ||
| """ | ||
| response = self._get( | ||
| f"{workspace_slug}/initiatives/{initiative_id}/work-items", params=params | ||
| ) | ||
| return PaginatedWorkItemResponse.model_validate(response) | ||
|
|
||
| def add( | ||
| self, workspace_slug: str, initiative_id: str, work_item_ids: Iterable[str] | ||
| ) -> Iterable[WorkItem]: | ||
| """Associate work items with an initiative. | ||
|
|
||
| Work items already associated are skipped. The response covers every id | ||
| requested, not only the newly added ones. | ||
|
|
||
| Args: | ||
| workspace_slug: The workspace slug identifier | ||
| initiative_id: UUID of the initiative | ||
| work_item_ids: List of work item UUIDs to associate | ||
|
|
||
| Returns: | ||
| List of the work items named in the request | ||
| """ | ||
| response = self._post( | ||
| f"{workspace_slug}/initiatives/{initiative_id}/work-items", | ||
| {"work_item_ids": work_item_ids}, | ||
| ) | ||
| return [WorkItem.model_validate(work_item) for work_item in response] | ||
|
|
||
| def remove(self, workspace_slug: str, initiative_id: str, work_item_ids: Iterable[str]) -> None: | ||
| """Remove work items from an initiative. | ||
|
|
||
| Args: | ||
| workspace_slug: The workspace slug identifier | ||
| initiative_id: UUID of the initiative | ||
| work_item_ids: List of work item UUIDs to remove | ||
| """ | ||
| return self._delete( | ||
| f"{workspace_slug}/initiatives/{initiative_id}/work-items", | ||
| {"work_item_ids": work_item_ids}, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.