@@ -138,6 +138,42 @@ category. If your GLPI workflow requires any of those values, set them on
138138` status ` , ` type ` , ` category ` , ` location ` , ` date_creation ` , ` date_mod ` ,
139139` date_close ` , ` user_recipient ` , ` user_editor ` , and ` team ` .
140140
141+ When you request extra ticket fields that do not map to typed ` GlpiTicket `
142+ attributes, the package preserves them in ` ticket.extra_payload ` instead of
143+ dropping them. This keeps the modeled fields typed while still exposing the raw
144+ requested GLPI keys through a public field.
145+
146+ ``` python
147+ tickets = glpi.search_ticket_records(
148+ query = ' status.id=in=(1,2)' ,
149+ fields = (" resolution_date" , " date_solve" ),
150+ )
151+
152+ first_ticket = tickets[0 ]
153+ print (first_ticket.extra_payload[" resolution_date" ])
154+ print (first_ticket.extra_payload[" date_solve" ])
155+ ```
156+
157+ ## Entities
158+
159+ Use ` search_entities() ` when you need typed entity lookup from the public
160+ package root.
161+
162+ ``` python
163+ from glpi_python_client import GlpiEntity
164+
165+ entities = glpi.search_entities(
166+ rsql_filter = ' name=like=*novahe*' ,
167+ limit = 50 ,
168+ start = 0 ,
169+ )
170+
171+ for entity in entities:
172+ print (entity.entity_id, entity.name, entity.complete_name)
173+ ```
174+
175+ Unmodeled entity payload keys are preserved in ` GlpiEntity.extra_payload ` .
176+
141177## Models and Content Formatting
142178
143179Public GLPI objects are field-validated Pydantic models. Create and update GLPI
@@ -204,6 +240,78 @@ solutions = glpi.get_solution_records("123")
204240Public client methods accept GLPI identifiers as either ` str ` or ` int ` and
205241normalize them into request paths as needed.
206242
243+ ## Tasks And Duration Statistics
244+
245+ Use ` search_task_records() ` for global task searches and ` get_task_durations() `
246+ when you need aggregated duration reports.
247+
248+ ``` python
249+ tasks = glpi.search_task_records(
250+ query = ' date=ge=2026-01-01;date=le=2026-01-31' ,
251+ fields = (" id" , " tickets_id" , " users_id" , " actiontime" , " date" , " content" ),
252+ sort = " date:desc" ,
253+ )
254+
255+ summary = glpi.get_task_durations(
256+ start_date = " 2026-01-01" ,
257+ end_date = " 2026-01-31" ,
258+ entity_name = " Novahe" ,
259+ return_task_details = True ,
260+ )
261+
262+ print (summary[" total_duration" ])
263+ print (summary[" duration_by_user" ])
264+ ```
265+
266+ ` GlpiTask ` keeps typed fields such as ` ticket_id ` , ` user_id ` , ` duration ` ,
267+ ` date ` , and ` entity ` . Additional task payload keys remain available through
268+ ` GlpiTask.extra_payload ` .
269+
270+ ## Ticket Statistics And User Activity
271+
272+ Public enums keep the GLPI numeric constants at the package root and can be
273+ used directly in filters.
274+
275+ ``` python
276+ from glpi_python_client import GlpiPriority, GlpiTicketStatus, GlpiTicketType
277+
278+ open_ticket_query = GlpiTicketStatus.NEW .rsql_equals(" status" )
279+ request_query = GlpiTicketType.REQUEST .rsql_equals(" type" )
280+
281+ stats = glpi.get_ticket_statistics(
282+ entity_name = " Novahe" ,
283+ start_date = " 2026-01-01" ,
284+ end_date = " 2026-01-31" ,
285+ extra_filter = f " { open_ticket_query} ; { request_query} " ,
286+ )
287+
288+ activity = glpi.get_user_activity(
289+ email = " jane.doe@example.com" ,
290+ start_date = " 2026-01-01" ,
291+ end_date = " 2026-01-31" ,
292+ )
293+
294+ print (stats[" entities" ])
295+ print (activity[" users" ])
296+ ```
297+
298+ The statistics output groups counts by entity, status, priority, and type. The
299+ activity output groups requester counts, technician counts, and nested task
300+ duration summaries by user.
301+
302+ ## Ticket Context
303+
304+ Use ` get_ticket_context() ` when you need the core ticket together with the
305+ common timeline and document records in one public object.
306+
307+ ``` python
308+ bundle = glpi.get_ticket_context(" 123" )
309+
310+ print (bundle.ticket.id)
311+ print (len (bundle.tasks), len (bundle.followups), len (bundle.solutions))
312+ print (len (bundle.documents))
313+ ```
314+
207315## Users and Locations
208316
209317``` python
0 commit comments