1+ from __future__ import annotations
2+
13from collections .abc import Mapping
24from typing import Any
35
@@ -90,14 +92,127 @@ def delete(
9092 f"{ workspace_slug } /projects/{ project_id } /work-item-types/{ type_id } /work-item-properties/{ work_item_property_id } "
9193 )
9294
95+ def list_project (
96+ self ,
97+ workspace_slug : str ,
98+ project_id : str ,
99+ params : Mapping [str , Any ] | None = None ,
100+ ) -> list [WorkItemProperty ]:
101+ """List all work item properties for a project regardless of work item type.
102+
103+ Args:
104+ workspace_slug: The workspace slug identifier
105+ project_id: UUID of the project
106+ params: Optional query parameters
107+ """
108+ response = self ._get (
109+ f"{ workspace_slug } /projects/{ project_id } /work-item-properties" ,
110+ params = params ,
111+ )
112+ return [WorkItemProperty .model_validate (item ) for item in response ]
113+
114+ def create_project (
115+ self , workspace_slug : str , project_id : str , data : CreateWorkItemProperty
116+ ) -> WorkItemProperty :
117+ """Create a project-level work item property (not linked to a specific type).
118+
119+ Args:
120+ workspace_slug: The workspace slug identifier
121+ project_id: UUID of the project
122+ data: Work item property data
123+ """
124+ response = self ._post (
125+ f"{ workspace_slug } /projects/{ project_id } /work-item-properties" ,
126+ data .model_dump (exclude_none = True ),
127+ )
128+ return WorkItemProperty .model_validate (response )
129+
130+ def retrieve_project (
131+ self , workspace_slug : str , project_id : str , property_id : str
132+ ) -> WorkItemProperty :
133+ """Retrieve a project-level work item property by ID.
134+
135+ Args:
136+ workspace_slug: The workspace slug identifier
137+ project_id: UUID of the project
138+ property_id: UUID of the property
139+ """
140+ response = self ._get (
141+ f"{ workspace_slug } /projects/{ project_id } /work-item-properties/{ property_id } "
142+ )
143+ return WorkItemProperty .model_validate (response )
144+
145+ def update_project (
146+ self , workspace_slug : str , project_id : str , property_id : str , data : UpdateWorkItemProperty
147+ ) -> WorkItemProperty :
148+ """Update a project-level work item property by ID.
149+
150+ Args:
151+ workspace_slug: The workspace slug identifier
152+ project_id: UUID of the project
153+ property_id: UUID of the property
154+ data: Updated property data
155+ """
156+ response = self ._patch (
157+ f"{ workspace_slug } /projects/{ project_id } /work-item-properties/{ property_id } " ,
158+ data .model_dump (exclude_none = True ),
159+ )
160+ return WorkItemProperty .model_validate (response )
161+
162+ def delete_project (
163+ self , workspace_slug : str , project_id : str , property_id : str
164+ ) -> None :
165+ """Delete a project-level work item property by ID.
166+
167+ Args:
168+ workspace_slug: The workspace slug identifier
169+ project_id: UUID of the project
170+ property_id: UUID of the property
171+ """
172+ return self ._delete (
173+ f"{ workspace_slug } /projects/{ project_id } /work-item-properties/{ property_id } "
174+ )
175+
176+ def attach_to_type (
177+ self , workspace_slug : str , project_id : str , type_id : str , property_ids : list [str ]
178+ ) -> list [str ]:
179+ """Attach existing project-level properties to a work item type.
180+
181+ Args:
182+ workspace_slug: The workspace slug identifier
183+ project_id: UUID of the project
184+ type_id: UUID of the work item type
185+ property_ids: List of property UUIDs to attach
186+ """
187+ response = self ._post (
188+ f"{ workspace_slug } /projects/{ project_id } /work-item-types/{ type_id } /properties" ,
189+ {"properties" : property_ids },
190+ )
191+ return response .get ("properties" , [])
192+
193+ def detach_from_type (
194+ self , workspace_slug : str , project_id : str , type_id : str , property_id : str
195+ ) -> None :
196+ """Detach a property from a work item type.
197+
198+ Args:
199+ workspace_slug: The workspace slug identifier
200+ project_id: UUID of the project
201+ type_id: UUID of the work item type
202+ property_id: UUID of the property to detach
203+ """
204+ return self ._delete (
205+ f"{ workspace_slug } /projects/{ project_id } /work-item-types/{ type_id } /properties/{ property_id } "
206+ )
207+
93208 def list (
94209 self ,
95210 workspace_slug : str ,
96211 project_id : str ,
97212 type_id : str ,
98213 params : Mapping [str , Any ] | None = None ,
99214 ) -> list [WorkItemProperty ]:
100- """List work item properties with optional filtering parameters .
215+ """List project-level work item properties for a type .
101216
102217 Args:
103218 workspace_slug: The workspace slug identifier
@@ -110,3 +225,4 @@ def list(
110225 params = params ,
111226 )
112227 return [WorkItemProperty .model_validate (item ) for item in response ]
228+
0 commit comments