Coverage for src/paperap/resources/tasks.py: 80%

1"""

2----------------------------------------------------------------------------

3

4 METADATA:

5

6 File: tasks.py

7 Project: paperap

8 Created: 2025-03-04

9 Version: 0.0.5

10 Author: Jess Mann

11 Email: jess@jmann.me

12 Copyright (c) 2025 Jess Mann

13

14----------------------------------------------------------------------------

15

16 LAST MODIFIED:

17

18 2025-03-04 By Jess Mann

19

20"""

21

22 from __future__ import annotations

23

24 from typing import Any, Optional

25

26 from paperap.models.task import Task, TaskQuerySet

27 from paperap.resources.base import BaseResource, StandardResource

28

29

30 class TaskResource(StandardResource[Task, TaskQuerySet]):

31 """Resource for managing tasks."""

32

33 model_class = Task

34

35 def acknowledge(self, task_id: int) -> None:

36 """

37 Acknowledge a task.

38

39 Args:

40 task_id: ID of the task to acknowledge.

41

42 """

43 self.client.request("PUT", f"tasks/{task_id}/acknowledge/")

44

45 def bulk_acknowledge(self, task_ids: list[int]) -> None:

46 """

47 Acknowledge multiple tasks.

48

49 Args:

50 task_ids: list of task IDs to acknowledge.

51

52 """

53 self.client.request("POST", "tasks/bulk_acknowledge/", data={"tasks": task_ids})