Skip to main content

redmine_api/api/
issues.rs

1//! Issues Rest API Endpoint definitions
2//! [Redmine Documentation](https://www.redmine.org/projects/redmine/wiki/Rest_Issues)
3//!
4//! [Redmine Documentation Journals](https://www.redmine.org/projects/redmine/wiki/Rest_IssueJournals)
5//! (Journals in Redmine terminology are notes/comments and change histories for an issue)
6//!
7//! - [ ] all issues endpoint
8//!   - [x] sort
9//!     - [ ] limit sort to the existing columns only instead of a string value
10//!   - [x] query_id parameter
11//!   - [x] pagination
12//!   - [x] issue_id filter
13//!     - [x] issue id (multiple are possible, comma separated)
14//!   - [x] project_id filter
15//!     - [x] project id (multiple are possible, comma separated)
16//!   - [x] subproject_id filter
17//!     - [x] !* filter to only get parent project issues
18//!   - [x] tracker_id filter
19//!     - [x] tracker id (multiple are possible, comma separated)
20//!   - [x] status_id filter
21//!     - [x] open (default)
22//!     - [x] closed
23//!     - [x] for both
24//!     - [x] status id (multiple are possible, comma separated)
25//!   - [x] category_id filter
26//!     - [x] category id (multiple are possible, comma separated)
27//!   - [x] priority_id filter
28//!     - [x] priority id (multiple are possible, comma separated)
29//!   - [x] author_id filter
30//!     - [x] any
31//!     - [x] me
32//!     - [x] !me
33//!     - [x] user/group id (multiple are possible, comma separated)
34//!     - [x] negation of list
35//!   - [x] assigned_to_id filter
36//!     - [x] any
37//!     - [x] me
38//!     - [x] !me
39//!     - [x] user/group id (multiple are possible, comma separated)
40//!     - [x] negation of list
41//!     - [x] none (!*)
42//!   - [x] fixed_version_id filter (Target version, API uses old name)
43//!     - [x] version id (multiple are possible, comma separated)
44//!   - [x] is_private filter
45//!   - [x] parent_id filter
46//!     - [x] issue id (multiple are possible, comma separated)
47//!   - [x] custom field filter
48//!     - [x] exact match
49//!     - [ ] substring match
50//!     - [ ] what about multiple value custom fields?
51//!   - [x] subject filter
52//!     - [x] exact match
53//!     - [x] substring match
54//!   - [x] description filter
55//!     - [x] exact match
56//!     - [x] substring match
57//!   - [x] done_ratio filter
58//!     - [x] exact match
59//!     - [x] less than, greater than ?
60//!     - [x] range?
61//!   - [x] estimated_hours filter
62//!     - [x] exact match
63//!     - [x] less than, greater than ?
64//!     - [x] range?
65//!   - [x] created_on filter
66//!     - [x] exact match
67//!     - [x] less than, greater than
68//!     - [x] date range
69//!   - [x] updated_on filter
70//!     - [x] exact match
71//!     - [x] less than, greater than
72//!     - [x] date range
73//!   - [x] start_date filter
74//!     - [x] exact match
75//!     - [x] less than, greater than
76//!     - [x] date range
77//!   - [x] due_date filter
78//!     - [x] exact match
79//!     - [x] less than, greater than
80//!     - [x] date range
81//! - [x] specific issue endpoint
82//! - [x] create issue endpoint
83//!   - [ ] attachments
84//! - [x] update issue endpoint
85//!   - [ ] attachments
86//! - [x] delete issue endpoint
87//! - [x] add watcher endpoint
88//! - [x] remove watcher endpoint
89//! - [ ] fields for issue changesets
90//!
91use derive_builder::Builder;
92use reqwest::Method;
93use std::borrow::Cow;
94
95use crate::api::attachments::Attachment;
96use crate::api::custom_fields::{CustomField, CustomFieldEssentialsWithValue};
97use crate::api::enumerations::IssuePriorityEssentials;
98use crate::api::groups::{Group, GroupEssentials};
99use crate::api::issue_categories::IssueCategoryEssentials;
100use crate::api::issue_relations::IssueRelation;
101use crate::api::issue_statuses::IssueStatusEssentials;
102use crate::api::projects::ProjectEssentials;
103use crate::api::projects::ProjectStatusFilter;
104use crate::api::trackers::TrackerEssentials;
105use crate::api::users::UserEssentials;
106use crate::api::versions::VersionEssentials;
107use crate::api::{
108    CustomFieldFilter, DateFilter, DateTimeFilterPast, Endpoint, FloatFilter, IntegerFilter,
109    NoPagination, Pageable, QueryParams, ReturnsJsonResponse, StringFieldFilter,
110};
111use serde::Serialize;
112
113/// a minimal type for Redmine users or groups used in lists of assignees included in
114/// other Redmine objects
115#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
116pub struct AssigneeEssentials {
117    /// numeric id
118    pub id: u64,
119    /// display name
120    pub name: String,
121}
122
123impl From<UserEssentials> for AssigneeEssentials {
124    fn from(v: UserEssentials) -> Self {
125        Self {
126            id: v.id,
127            name: v.name,
128        }
129    }
130}
131
132impl From<&UserEssentials> for AssigneeEssentials {
133    fn from(v: &UserEssentials) -> Self {
134        Self {
135            id: v.id,
136            name: v.name.to_owned(),
137        }
138    }
139}
140
141impl From<GroupEssentials> for AssigneeEssentials {
142    fn from(v: GroupEssentials) -> Self {
143        Self {
144            id: v.id,
145            name: v.name,
146        }
147    }
148}
149
150impl From<&GroupEssentials> for AssigneeEssentials {
151    fn from(v: &GroupEssentials) -> Self {
152        Self {
153            id: v.id,
154            name: v.name.to_owned(),
155        }
156    }
157}
158
159impl From<Group> for AssigneeEssentials {
160    fn from(v: Group) -> Self {
161        Self {
162            id: v.id,
163            name: v.name,
164        }
165    }
166}
167
168impl From<&Group> for AssigneeEssentials {
169    fn from(v: &Group) -> Self {
170        Self {
171            id: v.id,
172            name: v.name.to_owned(),
173        }
174    }
175}
176
177/// a minimal type for Redmine issues included in
178/// other Redmine objects
179#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
180pub struct IssueEssentials {
181    /// numeric id
182    pub id: u64,
183}
184
185impl From<Issue> for IssueEssentials {
186    fn from(v: Issue) -> Self {
187        Self { id: v.id }
188    }
189}
190
191impl From<&Issue> for IssueEssentials {
192    fn from(v: &Issue) -> Self {
193        Self { id: v.id }
194    }
195}
196
197/// the minimal data about a code repository included in other
198/// redmine objects
199#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
200pub struct RepositoryEssentials {
201    /// numeric id
202    pub id: u64,
203    /// the textual identifier
204    pub identifier: String,
205}
206
207/// the type of issue changesets
208#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
209pub struct IssueChangeset {
210    /// the revision of the changeset (e.g. commit id or number depending on VCS)
211    revision: String,
212    /// the committer
213    user: UserEssentials,
214    /// the commit message
215    comments: String,
216    /// the timestamp when this was committed
217    #[serde(
218        serialize_with = "crate::api::serialize_rfc3339",
219        deserialize_with = "crate::api::deserialize_rfc3339"
220    )]
221    committed_on: time::OffsetDateTime,
222}
223
224/// the type of journal change
225#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
226pub enum ChangePropertyType {
227    /// issue attribute change
228    #[serde(rename = "attr")]
229    Attr,
230    /// Custom field change
231    #[serde(rename = "cf")]
232    Cf,
233    /// change in issue relations
234    #[serde(rename = "relation")]
235    Relation,
236    /// change in attachments
237    #[serde(rename = "attachment")]
238    Attachment,
239}
240
241/// a changed attribute entry in a journal entry
242#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
243pub struct JournalChange {
244    /// name of the attribute
245    pub name: String,
246    /// old value
247    pub old_value: Option<String>,
248    /// new value
249    pub new_value: Option<String>,
250    /// what kind of property we are dealing with
251    pub property: ChangePropertyType,
252}
253
254/// journals (issue comments and changes)
255#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
256pub struct Journal {
257    /// numeric id
258    pub id: u64,
259    /// the author of the journal entry
260    pub user: UserEssentials,
261    /// the comment content
262    pub notes: Option<String>,
263    /// is this a private comment
264    pub private_notes: bool,
265    /// The time when this comment/change was created
266    #[serde(
267        serialize_with = "crate::api::serialize_rfc3339",
268        deserialize_with = "crate::api::deserialize_rfc3339"
269    )]
270    pub created_on: time::OffsetDateTime,
271    /// The time when this comment/change was last updated
272    #[serde(
273        serialize_with = "crate::api::serialize_rfc3339",
274        deserialize_with = "crate::api::deserialize_rfc3339"
275    )]
276    pub updated_on: time::OffsetDateTime,
277    /// The user who updated the comment/change if it differs from the author
278    #[serde(default, skip_serializing_if = "Option::is_none")]
279    pub updated_by: Option<UserEssentials>,
280    /// changed issue attributes
281    pub details: Vec<JournalChange>,
282}
283
284/// minimal issue used e.g. in child issues
285#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
286pub struct ChildIssue {
287    /// numeric id
288    pub id: u64,
289    /// subject
290    pub subject: String,
291    /// tracker
292    pub tracker: TrackerEssentials,
293    /// children
294    #[serde(default, skip_serializing_if = "Option::is_none")]
295    pub children: Option<Vec<Self>>,
296}
297
298/// a type for issue to use as an API return type
299///
300/// alternatively you can use your own type limited to the fields you need
301#[derive(Debug, Clone, Serialize, serde::Deserialize)]
302pub struct Issue {
303    /// numeric id
304    pub id: u64,
305    /// parent issue
306    #[serde(skip_serializing_if = "Option::is_none")]
307    pub parent: Option<IssueEssentials>,
308    /// the project of the issue
309    pub project: ProjectEssentials,
310    /// the tracker of the issue
311    pub tracker: TrackerEssentials,
312    /// the issue status
313    pub status: IssueStatusEssentials,
314    /// the issue priority
315    pub priority: IssuePriorityEssentials,
316    /// the issue author
317    pub author: UserEssentials,
318    /// the user or group the issue is assigned to
319    #[serde(skip_serializing_if = "Option::is_none")]
320    pub assigned_to: Option<AssigneeEssentials>,
321    /// the issue category
322    #[serde(skip_serializing_if = "Option::is_none")]
323    pub category: Option<IssueCategoryEssentials>,
324    /// the version the issue is assigned to
325    #[serde(rename = "fixed_version", skip_serializing_if = "Option::is_none")]
326    pub version: Option<VersionEssentials>,
327    /// the issue subject
328    #[serde(skip_serializing_if = "Option::is_none")]
329    pub subject: Option<String>,
330    /// the issue description
331    pub description: Option<String>,
332    /// is the issue private (only visible to roles that have the relevant permission enabled)
333    is_private: Option<bool>,
334    /// the start date for the issue
335    pub start_date: Option<time::Date>,
336    /// the due date for the issue
337    pub due_date: Option<time::Date>,
338    /// the time when the issue was closed
339    #[serde(
340        serialize_with = "crate::api::serialize_optional_rfc3339",
341        deserialize_with = "crate::api::deserialize_optional_rfc3339"
342    )]
343    pub closed_on: Option<time::OffsetDateTime>,
344    /// the percentage done
345    pub done_ratio: u64,
346    /// custom fields with values
347    #[serde(default, skip_serializing_if = "Option::is_none")]
348    pub custom_fields: Option<Vec<CustomFieldEssentialsWithValue>>,
349    /// estimated hours it will take to implement this issue
350    pub estimated_hours: Option<f64>,
351    /// The time when this issue was created
352    #[serde(
353        serialize_with = "crate::api::serialize_rfc3339",
354        deserialize_with = "crate::api::deserialize_rfc3339"
355    )]
356    pub created_on: time::OffsetDateTime,
357    /// The time when this issue was last updated
358    #[serde(
359        serialize_with = "crate::api::serialize_rfc3339",
360        deserialize_with = "crate::api::deserialize_rfc3339"
361    )]
362    pub updated_on: time::OffsetDateTime,
363    /// issue attachments (only when include parameter is used)
364    #[serde(default, skip_serializing_if = "Option::is_none")]
365    pub attachments: Option<Vec<Attachment>>,
366    /// issue relations (only when include parameter is used)
367    #[serde(default, skip_serializing_if = "Option::is_none")]
368    pub relations: Option<Vec<IssueRelation>>,
369    /// issue changesets (only when include parameter is used)
370    #[serde(default, skip_serializing_if = "Option::is_none")]
371    pub changesets: Option<Vec<IssueChangeset>>,
372    /// journal entries (comments and changes), only when include parameter is used
373    #[serde(default, skip_serializing_if = "Option::is_none")]
374    pub journals: Option<Vec<Journal>>,
375    /// child issues (only when include parameter is used)
376    #[serde(default, skip_serializing_if = "Option::is_none")]
377    pub children: Option<Vec<ChildIssue>>,
378    /// watchers
379    #[serde(default, skip_serializing_if = "Option::is_none")]
380    pub watchers: Option<Vec<UserEssentials>>,
381    /// the hours spent
382    #[serde(default, skip_serializing_if = "Option::is_none")]
383    pub spent_hours: Option<f64>,
384    /// the total hours spent on this and sub-tasks
385    #[serde(default, skip_serializing_if = "Option::is_none")]
386    pub total_spent_hours: Option<f64>,
387    /// the total hours estimated on this and sub-tasks
388    #[serde(default, skip_serializing_if = "Option::is_none")]
389    pub total_estimated_hours: Option<f64>,
390}
391
392/// ways to filter for subproject
393#[derive(Debug, Clone)]
394pub enum SubProjectFilter {
395    /// return no issues from subjects
396    OnlyParentProject,
397    /// return issues from a specific list of sub project ids
398    TheseSubProjects(Vec<u64>),
399    /// return issues from any but a specific list of sub project ids
400    NotTheseSubProjects(Vec<u64>),
401}
402
403impl std::fmt::Display for SubProjectFilter {
404    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
405        match self {
406            Self::OnlyParentProject => {
407                write!(f, "!*")
408            }
409            Self::TheseSubProjects(ids) => {
410                let s: String = ids
411                    .iter()
412                    .map(|e| e.to_string())
413                    .collect::<Vec<_>>()
414                    .join(",");
415                write!(f, "{s}")
416            }
417            Self::NotTheseSubProjects(ids) => {
418                let s: String = ids
419                    .iter()
420                    .map(|e| format!("!{e}"))
421                    .collect::<Vec<_>>()
422                    .join(",");
423                write!(f, "{s}")
424            }
425        }
426    }
427}
428
429/// ways to filter for issue status
430#[derive(Debug, Clone)]
431pub enum IssueStatusFilter {
432    /// match all open statuses (default if no status filter is specified
433    Open,
434    /// match all closed statuses
435    Closed,
436    /// match both open and closed statuses
437    All,
438    /// match a specific list of statuses
439    TheseStatuses(Vec<u64>),
440    /// match any status but a specific list of statuses
441    NotTheseStatuses(Vec<u64>),
442}
443
444impl std::fmt::Display for IssueStatusFilter {
445    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
446        match self {
447            Self::Open => {
448                write!(f, "open")
449            }
450            Self::Closed => {
451                write!(f, "closed")
452            }
453            Self::All => {
454                write!(f, "*")
455            }
456            Self::TheseStatuses(ids) => {
457                let s: String = ids
458                    .iter()
459                    .map(|e| e.to_string())
460                    .collect::<Vec<_>>()
461                    .join(",");
462                write!(f, "{s}")
463            }
464            Self::NotTheseStatuses(ids) => {
465                let s: String = ids
466                    .iter()
467                    .map(|e| format!("!{e}"))
468                    .collect::<Vec<_>>()
469                    .join(",");
470                write!(f, "{s}")
471            }
472        }
473    }
474}
475
476/// ways to filter for users in author (always a user (not group), never !*)
477#[derive(Debug, Clone)]
478pub enum UserFilter {
479    /// match any user
480    AnyUser,
481    /// match the current API user
482    Me,
483    /// match any user but the current API user
484    NotMe,
485    /// match a specific list of users
486    TheseUsers(Vec<u64>),
487    /// match a negated specific list of users
488    NotTheseUsers(Vec<u64>),
489}
490
491impl std::fmt::Display for UserFilter {
492    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
493        match self {
494            Self::AnyUser => {
495                write!(f, "*")
496            }
497            Self::Me => {
498                write!(f, "me")
499            }
500            Self::NotMe => {
501                write!(f, "!me")
502            }
503            Self::TheseUsers(ids) => {
504                let s: String = ids
505                    .iter()
506                    .map(|e| e.to_string())
507                    .collect::<Vec<_>>()
508                    .join(",");
509                write!(f, "{s}")
510            }
511            Self::NotTheseUsers(ids) => {
512                let s: String = ids
513                    .iter()
514                    .map(|e| format!("!{e}"))
515                    .collect::<Vec<_>>()
516                    .join(",");
517                write!(f, "{s}")
518            }
519        }
520    }
521}
522
523/// ways to filter for roles
524#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
525pub enum RoleFilter {
526    /// match any role
527    AnyRole,
528    /// match a specific list of role ids
529    TheseRoles(Vec<u64>),
530    /// match any role but a specific list of role ids
531    NotTheseRoles(Vec<u64>),
532}
533
534impl std::fmt::Display for RoleFilter {
535    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
536        match self {
537            Self::AnyRole => {
538                write!(f, "*")
539            }
540            Self::TheseRoles(ids) => {
541                let s: String = ids
542                    .iter()
543                    .map(|e| e.to_string())
544                    .collect::<Vec<_>>()
545                    .join(",");
546                write!(f, "{s}")
547            }
548            Self::NotTheseRoles(ids) => {
549                let s: String = ids
550                    .iter()
551                    .map(|e| format!("!{e}"))
552                    .collect::<Vec<_>>()
553                    .join(",");
554                write!(f, "{s}")
555            }
556        }
557    }
558}
559
560/// ways to filter for groups the assignee is a member of
561#[derive(Debug, Clone)]
562pub enum MemberOfGroupFilter {
563    /// match any group
564    AnyGroup,
565    /// match a specific list of group ids
566    TheseGroups(Vec<u64>),
567    /// match any group but a specific list of group ids
568    NotTheseGroups(Vec<u64>),
569}
570
571impl std::fmt::Display for MemberOfGroupFilter {
572    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
573        match self {
574            Self::AnyGroup => {
575                write!(f, "*")
576            }
577            Self::TheseGroups(ids) => {
578                let s: String = ids
579                    .iter()
580                    .map(|e| e.to_string())
581                    .collect::<Vec<_>>()
582                    .join(",");
583                write!(f, "{s}")
584            }
585            Self::NotTheseGroups(ids) => {
586                let s: String = ids
587                    .iter()
588                    .map(|e| format!("!{e}"))
589                    .collect::<Vec<_>>()
590                    .join(",");
591                write!(f, "{s}")
592            }
593        }
594    }
595}
596
597/// ways to filter for users or groups in assignee
598#[derive(Debug, Clone)]
599pub enum FixedVersionStatusFilter {
600    /// match open versions
601    Open,
602    /// match locked versions
603    Locked,
604    /// match closed versions
605    Closed,
606}
607
608impl std::fmt::Display for FixedVersionStatusFilter {
609    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
610        match self {
611            Self::Open => {
612                write!(f, "open")
613            }
614            Self::Locked => {
615                write!(f, "locked")
616            }
617            Self::Closed => {
618                write!(f, "closed")
619            }
620        }
621    }
622}
623
624/// ways to filter for users or groups in assignee
625#[derive(Debug, Clone)]
626pub enum AssigneeFilter {
627    /// match any user or group
628    AnyAssignee,
629    /// match the current API user
630    Me,
631    /// match any assignee but the current API user
632    NotMe,
633    /// match a specific list of users or groups
634    TheseAssignees(Vec<u64>),
635    /// match a negated specific list of users or groups
636    NotTheseAssignees(Vec<u64>),
637    /// match unassigned
638    NoAssignee,
639}
640
641impl std::fmt::Display for AssigneeFilter {
642    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
643        match self {
644            Self::AnyAssignee => {
645                write!(f, "*")
646            }
647            Self::Me => {
648                write!(f, "me")
649            }
650            Self::NotMe => {
651                write!(f, "!me")
652            }
653            Self::TheseAssignees(ids) => {
654                let s: String = ids
655                    .iter()
656                    .map(|e| e.to_string())
657                    .collect::<Vec<_>>()
658                    .join(",");
659                write!(f, "{s}")
660            }
661            Self::NotTheseAssignees(ids) => {
662                let s: String = ids
663                    .iter()
664                    .map(|e| format!("!{e}"))
665                    .collect::<Vec<_>>()
666                    .join(",");
667                write!(f, "{s}")
668            }
669            Self::NoAssignee => {
670                write!(f, "!*")
671            }
672        }
673    }
674}
675
676/// Filter for a custom field, consisting of its ID and a StringFieldFilter for its value.
677#[derive(Debug, Clone)]
678pub enum SortByColumn {
679    /// Sort in an ascending direction
680    Forward {
681        /// the column to sort by
682        column_name: String,
683    },
684    /// Sort in a descending direction
685    Reverse {
686        /// the column to sort by
687        column_name: String,
688    },
689}
690
691impl std::fmt::Display for SortByColumn {
692    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
693        match self {
694            Self::Forward { column_name } => {
695                write!(f, "{column_name}")
696            }
697            Self::Reverse { column_name } => {
698                write!(f, "{column_name}:desc")
699            }
700        }
701    }
702}
703
704/// The types of associated data which can be fetched along with a issue
705#[derive(Debug, Clone)]
706pub enum IssueListInclude {
707    /// Issue relations
708    Relations,
709    /// Issue time entries
710    TimeEntries,
711}
712
713impl std::fmt::Display for IssueListInclude {
714    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
715        match self {
716            Self::Relations => {
717                write!(f, "relations")
718            }
719            Self::TimeEntries => {
720                write!(f, "time_entries")
721            }
722        }
723    }
724}
725
726/// The endpoint for all Redmine issues
727#[derive(Debug, Clone, Builder)]
728#[builder(setter(strip_option))]
729pub struct ListIssues {
730    /// Include associated data
731    #[builder(default)]
732    include: Option<Vec<IssueListInclude>>,
733    /// Sort by column
734    #[builder(default)]
735    sort: Option<Vec<SortByColumn>>,
736    /// Filter by issue id(s)
737    #[builder(default)]
738    issue_id: Option<Vec<u64>>,
739    /// Filter by project id
740    #[builder(default)]
741    project_id: Option<Vec<u64>>,
742    /// Filter by subproject
743    #[builder(default)]
744    subproject_id: Option<SubProjectFilter>,
745    /// Filter by tracker id
746    #[builder(default)]
747    tracker_id: Option<Vec<u64>>,
748    /// Filter by priority id
749    #[builder(default)]
750    priority_id: Option<Vec<u64>>,
751    /// Filter by parent issue id
752    #[builder(default)]
753    parent_id: Option<Vec<u64>>,
754    /// Filter by issue category id
755    #[builder(default)]
756    category_id: Option<Vec<u64>>,
757    /// Filter by issue status
758    #[builder(default)]
759    status_id: Option<IssueStatusFilter>,
760    /// Filter by subject
761    #[builder(default)]
762    subject: Option<StringFieldFilter>,
763    /// Filter by description
764    #[builder(default)]
765    description: Option<StringFieldFilter>,
766    /// Filter by notes (journal content)
767    #[builder(default)]
768    notes: Option<StringFieldFilter>,
769    /// Filter by watcher id
770    #[builder(default)]
771    watcher_id: Option<Vec<u64>>,
772    /// Filter by author
773    #[builder(default)]
774    author: Option<UserFilter>,
775    /// Filter by updated_by
776    #[builder(default)]
777    updated_by: Option<UserFilter>,
778    /// Filter by last_updated_by
779    #[builder(default)]
780    last_updated_by: Option<UserFilter>,
781    /// Filter by attachment
782    #[builder(default)]
783    attachment: Option<bool>,
784    /// Filter by attachment description
785    #[builder(default)]
786    attachment_description: Option<StringFieldFilter>,
787    /// Filter by project status
788    #[builder(default)]
789    project_status: Option<ProjectStatusFilter>,
790    /// Filter by any searchable field (free-text search)
791    #[builder(default)]
792    any_searchable: Option<StringFieldFilter>,
793    /// Filter by custom fields
794    #[builder(default)]
795    custom_field_filters: Option<Vec<CustomFieldFilter>>,
796    /// Filter by assignee
797    #[builder(default)]
798    assignee: Option<AssigneeFilter>,
799    /// Filter by a saved query
800    #[builder(default)]
801    query_id: Option<u64>,
802    /// Filter by target version
803    #[builder(default)]
804    version_id: Option<Vec<u64>>,
805    /// Filter by creation time
806    #[builder(default)]
807    created_on: Option<DateTimeFilterPast>,
808    /// Filter by update time
809    #[builder(default)]
810    updated_on: Option<DateTimeFilterPast>,
811    /// Filter by start date
812    #[builder(default)]
813    start_date: Option<DateFilter>,
814    /// Filter by due date
815    #[builder(default)]
816    due_date: Option<DateFilter>,
817    /// Filter by spent time
818    #[builder(default)]
819    spent_time: Option<FloatFilter>,
820    /// Filter by closed on date
821    #[builder(default)]
822    closed_on: Option<DateTimeFilterPast>,
823    /// Filter by estimated hours
824    #[builder(default)]
825    estimated_hours: Option<FloatFilter>,
826    /// Filter by done ratio
827    #[builder(default)]
828    done_ratio: Option<IntegerFilter>,
829    /// Filter by author group
830    #[builder(default)]
831    author_group: Option<MemberOfGroupFilter>,
832    /// Filter by author role
833    #[builder(default)]
834    author_role: Option<RoleFilter>,
835    /// Filter by groups the assignee is a member of
836    #[builder(default)]
837    member_of_group: Option<MemberOfGroupFilter>,
838    /// Filter by roles the assignee has
839    #[builder(default)]
840    assigned_to_role: Option<RoleFilter>,
841    /// Filter by fixed version due date
842    #[builder(default)]
843    fixed_version_due_date: Option<DateFilter>,
844    /// Filter by fixed version status
845    #[builder(default)]
846    fixed_version_status: Option<FixedVersionStatusFilter>,
847    /// Filter by child issue id
848    #[builder(default)]
849    child_id: Option<Vec<u64>>,
850    /// Filter by private status
851    #[builder(default)]
852    is_private: Option<bool>,
853}
854
855impl ReturnsJsonResponse for ListIssues {}
856
857impl Pageable for ListIssues {
858    fn response_wrapper_key(&self) -> String {
859        "issues".to_string()
860    }
861}
862
863impl ListIssues {
864    /// Create a builder for the endpoint.
865    #[must_use]
866    pub fn builder() -> ListIssuesBuilder {
867        ListIssuesBuilder::default()
868    }
869}
870
871impl Endpoint for ListIssues {
872    fn method(&self) -> Method {
873        Method::GET
874    }
875
876    fn endpoint(&self) -> Cow<'static, str> {
877        "issues.json".into()
878    }
879
880    fn parameters(&self) -> QueryParams<'_> {
881        let mut params = QueryParams::default();
882        params.push_opt("include", self.include.as_ref());
883        params.push_opt("sort", self.sort.as_ref());
884        params.push_opt("issue_id", self.issue_id.as_ref());
885        params.push_opt("project_id", self.project_id.as_ref());
886        params.push_opt(
887            "subproject_id",
888            self.subproject_id.as_ref().map(|s| s.to_string()),
889        );
890        params.push_opt("tracker_id", self.tracker_id.as_ref());
891        params.push_opt("priority_id", self.priority_id.as_ref());
892        params.push_opt("parent_id", self.parent_id.as_ref());
893        params.push_opt("category_id", self.category_id.as_ref());
894        params.push_opt("status_id", self.status_id.as_ref().map(|s| s.to_string()));
895        params.push_opt("subject", self.subject.as_ref().map(|s| s.to_string()));
896        params.push_opt(
897            "description",
898            self.description.as_ref().map(|s| s.to_string()),
899        );
900        params.push_opt("notes", self.notes.as_ref().map(|s| s.to_string()));
901        params.push_opt("author_id", self.author.as_ref().map(|s| s.to_string()));
902        params.push_opt(
903            "updated_by_id",
904            self.updated_by.as_ref().map(|s| s.to_string()),
905        );
906        params.push_opt(
907            "last_updated_by_id",
908            self.last_updated_by.as_ref().map(|s| s.to_string()),
909        );
910        params.push_opt("attachment", self.attachment);
911        params.push_opt(
912            "attachment_description",
913            self.attachment_description.as_ref().map(|s| s.to_string()),
914        );
915        params.push_opt(
916            "project_status",
917            self.project_status.as_ref().map(|s| s.to_string()),
918        );
919        params.push_opt(
920            "any_searchable",
921            self.any_searchable.as_ref().map(|s| s.to_string()),
922        );
923        if let Some(filters) = self.custom_field_filters.as_ref() {
924            for filter in filters {
925                params.push(format!("cf_{}", filter.id), filter.value.to_string());
926            }
927        }
928        params.push_opt(
929            "assigned_to_id",
930            self.assignee.as_ref().map(|s| s.to_string()),
931        );
932        params.push_opt("query_id", self.query_id);
933        params.push_opt("fixed_version_id", self.version_id.as_ref());
934        params.push_opt(
935            "created_on",
936            self.created_on.as_ref().map(|s| s.to_string()),
937        );
938        params.push_opt(
939            "updated_on",
940            self.updated_on.as_ref().map(|s| s.to_string()),
941        );
942        params.push_opt(
943            "start_date",
944            self.start_date.as_ref().map(|s| s.to_string()),
945        );
946        params.push_opt("due_date", self.due_date.as_ref().map(|s| s.to_string()));
947        params.push_opt(
948            "spent_time",
949            self.spent_time.as_ref().map(|s| s.to_string()),
950        );
951        params.push_opt("closed_on", self.closed_on.as_ref().map(|s| s.to_string()));
952        params.push_opt(
953            "estimated_hours",
954            self.estimated_hours.as_ref().map(|s| s.to_string()),
955        );
956        params.push_opt(
957            "done_ratio",
958            self.done_ratio.as_ref().map(|s| s.to_string()),
959        );
960        params.push_opt(
961            "author.group",
962            self.author_group.as_ref().map(|s| s.to_string()),
963        );
964        params.push_opt(
965            "author.role",
966            self.author_role.as_ref().map(|s| s.to_string()),
967        );
968        params.push_opt(
969            "member_of_group",
970            self.member_of_group.as_ref().map(|s| s.to_string()),
971        );
972        params.push_opt(
973            "assigned_to_role",
974            self.assigned_to_role.as_ref().map(|s| s.to_string()),
975        );
976        params.push_opt(
977            "fixed_version.due_date",
978            self.fixed_version_due_date.as_ref().map(|s| s.to_string()),
979        );
980        params.push_opt(
981            "fixed_version.status",
982            self.fixed_version_status.as_ref().map(|s| s.to_string()),
983        );
984        params.push_opt("child_id", self.child_id.as_ref());
985        params.push_opt("is_private", self.is_private);
986        params.push_opt(
987            "watcher_id",
988            self.watcher_id.as_ref().map(|ids| {
989                ids.iter()
990                    .map(std::string::ToString::to_string)
991                    .collect::<Vec<String>>()
992                    .join(",")
993            }),
994        );
995        params
996    }
997}
998
999/// The types of associated data which can be fetched along with a issue
1000#[derive(Debug, Clone)]
1001pub enum IssueInclude {
1002    /// Child issues
1003    Children,
1004    /// Issue attachments
1005    Attachments,
1006    /// Issue relations
1007    Relations,
1008    /// VCS changesets
1009    Changesets,
1010    /// the notes and changes to the issue
1011    Journals,
1012    /// Users watching the issue
1013    Watchers,
1014    /// The statuses this issue can transition to
1015    ///
1016    /// This can be influenced by
1017    ///
1018    /// - the defined workflow
1019    ///   - the issue's current tracker
1020    ///   - the issue's current status
1021    ///   - the member's role
1022    /// - the existence of any open subtask(s)
1023    /// - the existence of any open blocking issue(s)
1024    /// - the existence of a closed parent issue
1025    ///
1026    AllowedStatuses,
1027}
1028
1029impl std::fmt::Display for IssueInclude {
1030    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1031        match self {
1032            Self::Children => {
1033                write!(f, "children")
1034            }
1035            Self::Attachments => {
1036                write!(f, "attachments")
1037            }
1038            Self::Relations => {
1039                write!(f, "relations")
1040            }
1041            Self::Changesets => {
1042                write!(f, "changesets")
1043            }
1044            Self::Journals => {
1045                write!(f, "journals")
1046            }
1047            Self::Watchers => {
1048                write!(f, "watchers")
1049            }
1050            Self::AllowedStatuses => {
1051                write!(f, "allowed_statuses")
1052            }
1053        }
1054    }
1055}
1056
1057/// The endpoint for a specific Redmine issue
1058#[derive(Debug, Clone, Builder)]
1059#[builder(setter(strip_option))]
1060pub struct GetIssue {
1061    /// id of the issue to retrieve
1062    id: u64,
1063    /// associated data to include
1064    #[builder(default)]
1065    include: Option<Vec<IssueInclude>>,
1066}
1067
1068impl ReturnsJsonResponse for GetIssue {}
1069impl NoPagination for GetIssue {}
1070
1071impl GetIssue {
1072    /// Create a builder for the endpoint.
1073    #[must_use]
1074    pub fn builder() -> GetIssueBuilder {
1075        GetIssueBuilder::default()
1076    }
1077}
1078
1079impl Endpoint for GetIssue {
1080    fn method(&self) -> Method {
1081        Method::GET
1082    }
1083
1084    fn endpoint(&self) -> Cow<'static, str> {
1085        format!("issues/{}.json", self.id).into()
1086    }
1087
1088    fn parameters(&self) -> QueryParams<'_> {
1089        let mut params = QueryParams::default();
1090        params.push_opt("include", self.include.as_ref());
1091        params
1092    }
1093}
1094
1095/// the information the uploader needs to supply for an attachment
1096/// in [CreateIssue] or [UpdateIssue]
1097#[derive(Debug, Clone, Serialize)]
1098pub struct UploadedAttachment<'a> {
1099    /// the upload token from [UploadFile|crate::api::uploads::UploadFile]
1100    pub token: Cow<'a, str>,
1101    /// the filename
1102    pub filename: Cow<'a, str>,
1103    /// a description for the file
1104    #[serde(skip_serializing_if = "Option::is_none")]
1105    pub description: Option<Cow<'a, str>>,
1106    /// the MIME content type of the file
1107    pub content_type: Cow<'a, str>,
1108}
1109
1110/// The endpoint to create a Redmine issue
1111#[serde_with::skip_serializing_none]
1112#[derive(Debug, Clone, Builder, Serialize)]
1113#[builder(setter(strip_option))]
1114pub struct CreateIssue<'a> {
1115    /// project for the issue
1116    project_id: u64,
1117    /// tracker for the issue
1118    #[builder(default)]
1119    tracker_id: Option<u64>,
1120    /// status of the issue
1121    #[builder(default)]
1122    status_id: Option<u64>,
1123    /// issue priority
1124    #[builder(default)]
1125    priority_id: Option<u64>,
1126    /// issue subject
1127    #[builder(setter(into), default)]
1128    subject: Option<Cow<'a, str>>,
1129    /// issue description
1130    #[builder(setter(into), default)]
1131    description: Option<Cow<'a, str>>,
1132    /// issue category
1133    #[builder(default)]
1134    category_id: Option<u64>,
1135    /// ID of the Target Versions (previously called 'Fixed Version' and still referred to as such in the API)
1136    #[builder(default, setter(name = "version"))]
1137    fixed_version_id: Option<u64>,
1138    /// user/group id the issue will be assigned to
1139    #[builder(default)]
1140    assigned_to_id: Option<u64>,
1141    /// Id of the parent issue
1142    #[builder(default)]
1143    parent_issue_id: Option<u64>,
1144    /// custom field values
1145    #[builder(default)]
1146    custom_fields: Option<Vec<CustomField<'a>>>,
1147    /// user ids of watchers of the issue
1148    #[builder(default)]
1149    watcher_user_ids: Option<Vec<u64>>,
1150    /// is the issue private (only visible to roles that have the relevant permission enabled)
1151    #[builder(default)]
1152    is_private: Option<bool>,
1153    /// estimated hours it will take to implement this issue
1154    #[builder(default)]
1155    estimated_hours: Option<f64>,
1156    /// the start date for the issue
1157    #[builder(default)]
1158    start_date: Option<time::Date>,
1159    /// the due date for the issue
1160    #[builder(default)]
1161    due_date: Option<time::Date>,
1162    /// the percentage done (0-100)
1163    #[builder(default)]
1164    done_ratio: Option<u64>,
1165    /// attachments (files)
1166    #[builder(default)]
1167    uploads: Option<Vec<UploadedAttachment<'a>>>,
1168}
1169
1170impl<'a> CreateIssue<'a> {
1171    /// Create a builder for the endpoint.
1172    #[must_use]
1173    pub fn builder() -> CreateIssueBuilder<'a> {
1174        CreateIssueBuilder::default()
1175    }
1176}
1177
1178impl ReturnsJsonResponse for CreateIssue<'_> {}
1179impl NoPagination for CreateIssue<'_> {}
1180
1181impl Endpoint for CreateIssue<'_> {
1182    fn method(&self) -> Method {
1183        Method::POST
1184    }
1185
1186    fn endpoint(&self) -> Cow<'static, str> {
1187        "issues.json".into()
1188    }
1189
1190    fn body(&self) -> Result<Option<(&'static str, Vec<u8>)>, crate::Error> {
1191        Ok(Some((
1192            "application/json",
1193            serde_json::to_vec(&IssueWrapper::<CreateIssue> {
1194                issue: (*self).to_owned(),
1195            })?,
1196        )))
1197    }
1198}
1199
1200/// The endpoint to update an existing Redmine issue
1201#[serde_with::skip_serializing_none]
1202#[derive(Debug, Clone, Builder, Serialize)]
1203#[builder(setter(strip_option))]
1204pub struct UpdateIssue<'a> {
1205    /// id of the issue to update
1206    #[serde(skip_serializing)]
1207    id: u64,
1208    /// project for the issue
1209    #[builder(default)]
1210    project_id: Option<u64>,
1211    /// tracker for the issue
1212    #[builder(default)]
1213    tracker_id: Option<u64>,
1214    /// status of the issue
1215    #[builder(default)]
1216    status_id: Option<u64>,
1217    /// issue priority
1218    #[builder(default)]
1219    priority_id: Option<u64>,
1220    /// issue subject
1221    #[builder(setter(into), default)]
1222    subject: Option<Cow<'a, str>>,
1223    /// issue description
1224    #[builder(setter(into), default)]
1225    description: Option<Cow<'a, str>>,
1226    /// issue category
1227    #[builder(default)]
1228    category_id: Option<u64>,
1229    /// ID of the Target Versions (previously called 'Fixed Version' and still referred to as such in the API)
1230    #[builder(default, setter(name = "version"))]
1231    fixed_version_id: Option<u64>,
1232    /// user/group id the issue will be assigned to
1233    #[builder(default)]
1234    assigned_to_id: Option<u64>,
1235    /// Id of the parent issue
1236    #[builder(default)]
1237    parent_issue_id: Option<u64>,
1238    /// custom field values
1239    #[builder(default)]
1240    custom_fields: Option<Vec<CustomField<'a>>>,
1241    /// user ids of watchers of the issue
1242    #[builder(default)]
1243    watcher_user_ids: Option<Vec<u64>>,
1244    /// is the issue private (only visible to roles that have the relevant permission enabled)
1245    #[builder(default)]
1246    is_private: Option<bool>,
1247    /// estimated hours it will take to implement this issue
1248    #[builder(default)]
1249    estimated_hours: Option<f64>,
1250    /// the start date for the issue
1251    #[builder(default)]
1252    start_date: Option<time::Date>,
1253    /// the due date for the issue
1254    #[builder(default)]
1255    due_date: Option<time::Date>,
1256    /// the percentage done (0-100)
1257    #[builder(default)]
1258    done_ratio: Option<u64>,
1259    /// add a comment (note)
1260    #[builder(default)]
1261    notes: Option<Cow<'a, str>>,
1262    /// is the added comment/note private
1263    #[builder(default)]
1264    private_notes: Option<bool>,
1265    /// attachments (files)
1266    #[builder(default)]
1267    uploads: Option<Vec<UploadedAttachment<'a>>>,
1268}
1269
1270impl<'a> UpdateIssue<'a> {
1271    /// Create a builder for the endpoint.
1272    #[must_use]
1273    pub fn builder() -> UpdateIssueBuilder<'a> {
1274        UpdateIssueBuilder::default()
1275    }
1276}
1277
1278impl Endpoint for UpdateIssue<'_> {
1279    fn method(&self) -> Method {
1280        Method::PUT
1281    }
1282
1283    fn endpoint(&self) -> Cow<'static, str> {
1284        format!("issues/{}.json", self.id).into()
1285    }
1286
1287    fn body(&self) -> Result<Option<(&'static str, Vec<u8>)>, crate::Error> {
1288        Ok(Some((
1289            "application/json",
1290            serde_json::to_vec(&IssueWrapper::<UpdateIssue> {
1291                issue: (*self).to_owned(),
1292            })?,
1293        )))
1294    }
1295}
1296
1297/// The endpoint to delete a Redmine issue
1298#[derive(Debug, Clone, Builder)]
1299#[builder(setter(strip_option))]
1300pub struct DeleteIssue {
1301    /// id of the issue to delete
1302    id: u64,
1303}
1304
1305impl DeleteIssue {
1306    /// Create a builder for the endpoint.
1307    #[must_use]
1308    pub fn builder() -> DeleteIssueBuilder {
1309        DeleteIssueBuilder::default()
1310    }
1311}
1312
1313impl Endpoint for DeleteIssue {
1314    fn method(&self) -> Method {
1315        Method::DELETE
1316    }
1317
1318    fn endpoint(&self) -> Cow<'static, str> {
1319        format!("issues/{}.json", self.id).into()
1320    }
1321}
1322
1323/// The endpoint to add a Redmine user as a watcher on a Redmine issue
1324#[derive(Debug, Clone, Builder, Serialize)]
1325#[builder(setter(strip_option))]
1326pub struct AddWatcher {
1327    /// id of the issue to add the watcher to
1328    #[serde(skip_serializing)]
1329    issue_id: u64,
1330    /// id of the user to add as a watcher
1331    user_id: u64,
1332}
1333
1334impl AddWatcher {
1335    /// Create a builder for the endpoint.
1336    #[must_use]
1337    pub fn builder() -> AddWatcherBuilder {
1338        AddWatcherBuilder::default()
1339    }
1340}
1341
1342impl Endpoint for AddWatcher {
1343    fn method(&self) -> Method {
1344        Method::POST
1345    }
1346
1347    fn endpoint(&self) -> Cow<'static, str> {
1348        format!("issues/{}/watchers.json", self.issue_id).into()
1349    }
1350
1351    fn body(&self) -> Result<Option<(&'static str, Vec<u8>)>, crate::Error> {
1352        Ok(Some(("application/json", serde_json::to_vec(self)?)))
1353    }
1354}
1355
1356/// The endpoint to remove a Redmine user from a Redmine issue as a watcher
1357#[derive(Debug, Clone, Builder)]
1358#[builder(setter(strip_option))]
1359pub struct RemoveWatcher {
1360    /// id of the issue to remove the watcher from
1361    issue_id: u64,
1362    /// id of the user to remove as a watcher
1363    user_id: u64,
1364}
1365
1366impl RemoveWatcher {
1367    /// Create a builder for the endpoint.
1368    #[must_use]
1369    pub fn builder() -> RemoveWatcherBuilder {
1370        RemoveWatcherBuilder::default()
1371    }
1372}
1373
1374impl Endpoint for RemoveWatcher {
1375    fn method(&self) -> Method {
1376        Method::DELETE
1377    }
1378
1379    fn endpoint(&self) -> Cow<'static, str> {
1380        format!("issues/{}/watchers/{}.json", self.issue_id, self.user_id).into()
1381    }
1382}
1383
1384/// helper struct for outer layers with a issues field holding the inner data
1385#[derive(Debug, Clone, PartialEq, Eq, Serialize, serde::Deserialize)]
1386pub struct IssuesWrapper<T> {
1387    /// to parse JSON with issues key
1388    pub issues: Vec<T>,
1389}
1390
1391/// A lot of APIs in Redmine wrap their data in an extra layer, this is a
1392/// helper struct for outer layers with a issue field holding the inner data
1393#[derive(Debug, Clone, PartialEq, Eq, Serialize, serde::Deserialize)]
1394pub struct IssueWrapper<T> {
1395    /// to parse JSON with an issue key
1396    pub issue: T,
1397}
1398
1399#[cfg(test)]
1400pub(crate) mod test {
1401    use super::*;
1402    use crate::api::ResponsePage;
1403    use crate::api::test_helpers::with_project;
1404    use pretty_assertions::assert_eq;
1405    use std::error::Error;
1406    use tokio::sync::RwLock;
1407    use tracing_test::traced_test;
1408
1409    /// needed so we do not get 404s when listing while
1410    /// creating/deleting or creating/updating/deleting
1411    pub static ISSUES_LOCK: RwLock<()> = RwLock::const_new(());
1412
1413    #[traced_test]
1414    #[test]
1415    fn test_list_issues_first_page() -> Result<(), Box<dyn Error>> {
1416        let _r_issues = ISSUES_LOCK.blocking_read();
1417        dotenvy::dotenv()?;
1418        let redmine = crate::api::Redmine::from_env(
1419            reqwest::blocking::Client::builder()
1420                .tls_backend_rustls()
1421                .build()?,
1422        )?;
1423        let endpoint = ListIssues::builder().build()?;
1424        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1425        Ok(())
1426    }
1427
1428    /// this version of the test will load all pages of issues which means it
1429    /// can take a while (a minute or more) so you need to use --include-ignored
1430    /// or --ignored to run it
1431    #[traced_test]
1432    #[test]
1433    #[ignore = "loads all pages of issues; runtime ~1m, run with --include-ignored"]
1434    fn test_list_issues_all_pages() -> Result<(), Box<dyn Error>> {
1435        let _r_issues = ISSUES_LOCK.blocking_read();
1436        dotenvy::dotenv()?;
1437        let redmine = crate::api::Redmine::from_env(
1438            reqwest::blocking::Client::builder()
1439                .tls_backend_rustls()
1440                .build()?,
1441        )?;
1442        let endpoint = ListIssues::builder().build()?;
1443        redmine.json_response_body_all_pages::<_, Issue>(&endpoint)?;
1444        Ok(())
1445    }
1446
1447    /// this version of the test will load all pages of issues which means it
1448    /// can take a while (a minute or more) so you need to use --include-ignored
1449    /// or --ignored to run it
1450    #[traced_test]
1451    #[test]
1452    #[ignore = "loads all pages of issues; runtime ~1m, run with --include-ignored"]
1453    fn test_list_issues_all_pages_iter() -> Result<(), Box<dyn Error>> {
1454        let _r_issues = ISSUES_LOCK.blocking_read();
1455        dotenvy::dotenv()?;
1456        let redmine = crate::api::Redmine::from_env(
1457            reqwest::blocking::Client::builder()
1458                .tls_backend_rustls()
1459                .build()?,
1460        )?;
1461        let endpoint = ListIssues::builder().build()?;
1462        let mut i = 0;
1463        for issue in redmine.json_response_body_all_pages_iter::<_, Issue>(&endpoint) {
1464            let _issue = issue?;
1465            i += 1;
1466        }
1467        assert!(i > 0);
1468
1469        Ok(())
1470    }
1471
1472    /// this version of the test will load all pages of issues which means it
1473    /// can take a while (a minute or more) so you need to use --include-ignored
1474    /// or --ignored to run it
1475    #[traced_test]
1476    #[tokio::test]
1477    #[ignore = "loads all pages of issues; runtime ~1m, run with --include-ignored"]
1478    async fn test_list_issues_all_pages_stream() -> Result<(), Box<dyn Error>> {
1479        let _r_issues = ISSUES_LOCK.read().await;
1480        dotenvy::dotenv()?;
1481        let redmine = crate::api::RedmineAsync::from_env(
1482            reqwest::Client::builder().tls_backend_rustls().build()?,
1483        )?;
1484        let endpoint = ListIssues::builder().build()?;
1485        let mut i = 0;
1486        let mut stream = redmine.json_response_body_all_pages_stream::<_, Issue>(&endpoint);
1487        while let Some(issue) = <_ as futures::stream::StreamExt>::next(&mut stream).await {
1488            let _issue = issue?;
1489            i += 1;
1490        }
1491        assert!(i > 0);
1492
1493        Ok(())
1494    }
1495
1496    #[traced_test]
1497    #[test]
1498    fn test_get_issue() -> Result<(), Box<dyn Error>> {
1499        let _r_issues = ISSUES_LOCK.blocking_read();
1500        dotenvy::dotenv()?;
1501        let redmine = crate::api::Redmine::from_env(
1502            reqwest::blocking::Client::builder()
1503                .tls_backend_rustls()
1504                .build()?,
1505        )?;
1506        let endpoint = GetIssue::builder().id(40000).build()?;
1507        redmine.json_response_body::<_, IssueWrapper<Issue>>(&endpoint)?;
1508        Ok(())
1509    }
1510
1511    #[function_name::named]
1512    #[traced_test]
1513    #[test]
1514    fn test_create_issue() -> Result<(), Box<dyn Error>> {
1515        let _w_issues = ISSUES_LOCK.blocking_write();
1516        let name = format!("unittest_{}", function_name!());
1517        with_project(&name, |redmine, project_id, _| {
1518            let create_endpoint = super::CreateIssue::builder()
1519                .project_id(project_id)
1520                .subject("old test subject")
1521                .build()?;
1522            redmine.json_response_body::<_, IssueWrapper<Issue>>(&create_endpoint)?;
1523            Ok(())
1524        })?;
1525        Ok(())
1526    }
1527
1528    #[function_name::named]
1529    #[traced_test]
1530    #[test]
1531    fn test_update_issue() -> Result<(), Box<dyn Error>> {
1532        let _w_issues = ISSUES_LOCK.blocking_write();
1533        let name = format!("unittest_{}", function_name!());
1534        with_project(&name, |redmine, project_id, _name| {
1535            let create_endpoint = super::CreateIssue::builder()
1536                .project_id(project_id)
1537                .subject("old test subject")
1538                .build()?;
1539            let IssueWrapper { issue }: IssueWrapper<Issue> =
1540                redmine.json_response_body::<_, _>(&create_endpoint)?;
1541            let update_endpoint = super::UpdateIssue::builder()
1542                .id(issue.id)
1543                .subject("New test subject")
1544                .build()?;
1545            redmine.ignore_response_body::<_>(&update_endpoint)?;
1546            Ok(())
1547        })?;
1548        Ok(())
1549    }
1550
1551    #[function_name::named]
1552    #[traced_test]
1553    #[test]
1554    fn test_create_and_update_issue_dates_and_done_ratio() -> Result<(), Box<dyn Error>> {
1555        let _w_issues = ISSUES_LOCK.blocking_write();
1556        let name = format!("unittest_{}", function_name!());
1557        with_project(&name, |redmine, project_id, _name| {
1558            let create_endpoint = super::CreateIssue::builder()
1559                .project_id(project_id)
1560                .subject("test subject")
1561                .start_date(time::macros::date!(2026 - 01 - 05))
1562                .due_date(time::macros::date!(2026 - 01 - 30))
1563                .done_ratio(20)
1564                .build()?;
1565            let IssueWrapper { issue }: IssueWrapper<Issue> =
1566                redmine.json_response_body::<_, _>(&create_endpoint)?;
1567            assert_eq!(issue.start_date, Some(time::macros::date!(2026 - 01 - 05)));
1568            assert_eq!(issue.due_date, Some(time::macros::date!(2026 - 01 - 30)));
1569            assert_eq!(issue.done_ratio, 20);
1570            let update_endpoint = super::UpdateIssue::builder()
1571                .id(issue.id)
1572                .start_date(time::macros::date!(2026 - 02 - 02))
1573                .due_date(time::macros::date!(2026 - 02 - 27))
1574                .done_ratio(60)
1575                .build()?;
1576            redmine.ignore_response_body::<_>(&update_endpoint)?;
1577            let get_endpoint = GetIssue::builder().id(issue.id).build()?;
1578            let IssueWrapper { issue }: IssueWrapper<Issue> =
1579                redmine.json_response_body::<_, _>(&get_endpoint)?;
1580            assert_eq!(issue.start_date, Some(time::macros::date!(2026 - 02 - 02)));
1581            assert_eq!(issue.due_date, Some(time::macros::date!(2026 - 02 - 27)));
1582            assert_eq!(issue.done_ratio, 60);
1583            Ok(())
1584        })?;
1585        Ok(())
1586    }
1587
1588    #[function_name::named]
1589    #[traced_test]
1590    #[test]
1591    fn test_delete_issue() -> Result<(), Box<dyn Error>> {
1592        let _w_issues = ISSUES_LOCK.blocking_write();
1593        let name = format!("unittest_{}", function_name!());
1594        with_project(&name, |redmine, project_id, _name| {
1595            let create_endpoint = super::CreateIssue::builder()
1596                .project_id(project_id)
1597                .subject("test subject")
1598                .build()?;
1599            let IssueWrapper { issue }: IssueWrapper<Issue> =
1600                redmine.json_response_body::<_, _>(&create_endpoint)?;
1601            let delete_endpoint = super::DeleteIssue::builder().id(issue.id).build()?;
1602            redmine.ignore_response_body::<_>(&delete_endpoint)?;
1603            Ok(())
1604        })?;
1605        Ok(())
1606    }
1607
1608    /// this tests if any of the results contain a field we are not deserializing
1609    ///
1610    /// this will only catch fields we missed if they are part of the response but
1611    /// it is better than nothing
1612    #[traced_test]
1613    #[test]
1614    fn test_completeness_issue_type_first_page() -> Result<(), Box<dyn Error>> {
1615        let _r_issues = ISSUES_LOCK.blocking_read();
1616        dotenvy::dotenv()?;
1617        let redmine = crate::api::Redmine::from_env(
1618            reqwest::blocking::Client::builder()
1619                .tls_backend_rustls()
1620                .build()?,
1621        )?;
1622        let endpoint = ListIssues::builder()
1623            .include(vec![
1624                IssueListInclude::TimeEntries,
1625                IssueListInclude::Relations,
1626            ])
1627            .build()?;
1628        let ResponsePage {
1629            values,
1630            total_count: _,
1631            offset: _,
1632            limit: _,
1633        } = redmine.json_response_body_page::<_, serde_json::Value>(&endpoint, 0, 100)?;
1634        for value in values {
1635            let o: Issue = serde_json::from_value(value.clone())?;
1636            let reserialized = serde_json::to_value(o)?;
1637            let expected_value = if let serde_json::Value::Object(obj) = value {
1638                let mut expected_obj = obj.clone();
1639                if obj
1640                    .get("total_estimated_hours")
1641                    .is_some_and(|v| *v == serde_json::Value::Null)
1642                {
1643                    expected_obj.remove("total_estimated_hours");
1644                }
1645                serde_json::Value::Object(expected_obj)
1646            } else {
1647                value
1648            };
1649            assert_eq!(expected_value, reserialized);
1650        }
1651        Ok(())
1652    }
1653
1654    /// this tests if any of the results contain a field we are not deserializing
1655    ///
1656    /// this will only catch fields we missed if they are part of the response but
1657    /// it is better than nothing
1658    ///
1659    /// this version of the test will load all pages of issues which means it
1660    /// can take a while (a minute or more) so you need to use --include-ignored
1661    /// or --ignored to run it
1662    #[traced_test]
1663    #[test]
1664    #[ignore = "loads all pages of issues; runtime ~1m, run with --include-ignored"]
1665    fn test_completeness_issue_type_all_pages() -> Result<(), Box<dyn Error>> {
1666        let _r_issues = ISSUES_LOCK.blocking_read();
1667        dotenvy::dotenv()?;
1668        let redmine = crate::api::Redmine::from_env(
1669            reqwest::blocking::Client::builder()
1670                .tls_backend_rustls()
1671                .build()?,
1672        )?;
1673        let endpoint = ListIssues::builder()
1674            .include(vec![
1675                IssueListInclude::TimeEntries,
1676                IssueListInclude::Relations,
1677            ])
1678            .build()?;
1679        let values = redmine.json_response_body_all_pages::<_, serde_json::Value>(&endpoint)?;
1680        for value in values {
1681            let o: Issue = serde_json::from_value(value.clone())?;
1682            let reserialized = serde_json::to_value(o)?;
1683            let expected_value = if let serde_json::Value::Object(obj) = value {
1684                let mut expected_obj = obj.clone();
1685                if obj
1686                    .get("total_estimated_hours")
1687                    .is_some_and(|v| *v == serde_json::Value::Null)
1688                {
1689                    expected_obj.remove("total_estimated_hours");
1690                }
1691                serde_json::Value::Object(expected_obj)
1692            } else {
1693                value
1694            };
1695            assert_eq!(expected_value, reserialized);
1696        }
1697        Ok(())
1698    }
1699
1700    /// this tests if any of the results contain a field we are not deserializing
1701    ///
1702    /// this will only catch fields we missed if they are part of the response but
1703    /// it is better than nothing
1704    ///
1705    /// this version of the test will load all pages of issues and the individual
1706    /// issues for each via GetIssue which means it
1707    /// can take a while (about 400 seconds) so you need to use --include-ignored
1708    /// or --ignored to run it
1709    #[traced_test]
1710    #[test]
1711    #[ignore = "fetches every issue via GetIssue; runtime ~400s, run with --include-ignored"]
1712    fn test_completeness_issue_type_all_pages_all_issue_details() -> Result<(), Box<dyn Error>> {
1713        let _r_issues = ISSUES_LOCK.blocking_read();
1714        dotenvy::dotenv()?;
1715        let redmine = crate::api::Redmine::from_env(
1716            reqwest::blocking::Client::builder()
1717                .tls_backend_rustls()
1718                .build()?,
1719        )?;
1720        let endpoint = ListIssues::builder()
1721            .include(vec![
1722                IssueListInclude::TimeEntries,
1723                IssueListInclude::Relations,
1724            ])
1725            .build()?;
1726        let issues = redmine.json_response_body_all_pages::<_, Issue>(&endpoint)?;
1727        for issue in issues {
1728            let get_endpoint = GetIssue::builder()
1729                .id(issue.id)
1730                .include(vec![
1731                    IssueInclude::Attachments,
1732                    IssueInclude::Children,
1733                    IssueInclude::Changesets,
1734                    IssueInclude::Relations,
1735                    IssueInclude::Journals,
1736                    IssueInclude::Watchers,
1737                ])
1738                .build()?;
1739            let IssueWrapper { issue: mut value } =
1740                redmine.json_response_body::<_, IssueWrapper<serde_json::Value>>(&get_endpoint)?;
1741            let o: Issue = serde_json::from_value(value.clone())?;
1742            // workaround for the fact that the field total_estimated_hours is put into the result
1743            // when its null in the GetIssue endpoint but not in the ListIssues one
1744            // we can only do one or the other in our JSON serialization unless we want to add
1745            // extra fields just to keep track of the missing field vs. field with null value
1746            // difference
1747            let value_object = value.as_object_mut().unwrap();
1748            if value_object.get("total_estimated_hours") == Some(&serde_json::Value::Null) {
1749                value_object.remove("total_estimated_hours");
1750            }
1751            let reserialized = serde_json::to_value(o)?;
1752            assert_eq!(value, reserialized);
1753        }
1754        Ok(())
1755    }
1756
1757    #[traced_test]
1758    #[test]
1759    fn test_list_issues_created_on_filter_exact_match() -> Result<(), Box<dyn Error>> {
1760        let _r_issues = ISSUES_LOCK.blocking_read();
1761        dotenvy::dotenv()?;
1762        let redmine = crate::api::Redmine::from_env(
1763            reqwest::blocking::Client::builder()
1764                .tls_backend_rustls()
1765                .build()?,
1766        )?;
1767
1768        let dt = time::macros::datetime!(2023-01-15 10:30:00 UTC);
1769        let endpoint = ListIssues::builder()
1770            .created_on(DateTimeFilterPast::ExactMatch(dt))
1771            .build()?;
1772        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1773
1774        Ok(())
1775    }
1776
1777    #[traced_test]
1778    #[test]
1779    fn test_list_issues_created_on_filter_range() -> Result<(), Box<dyn Error>> {
1780        let _r_issues = ISSUES_LOCK.blocking_read();
1781        dotenvy::dotenv()?;
1782        let redmine = crate::api::Redmine::from_env(
1783            reqwest::blocking::Client::builder()
1784                .tls_backend_rustls()
1785                .build()?,
1786        )?;
1787
1788        let dt_start = time::macros::datetime!(2023-01-01 00:00:00 UTC);
1789        let dt_end = time::macros::datetime!(2023-01-31 23:59:59 UTC);
1790        let endpoint = ListIssues::builder()
1791            .created_on(DateTimeFilterPast::Range(dt_start, dt_end))
1792            .build()?;
1793        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1794
1795        Ok(())
1796    }
1797
1798    #[traced_test]
1799    #[test]
1800    fn test_list_issues_created_on_filter_less_than_or_equal() -> Result<(), Box<dyn Error>> {
1801        let _r_issues = ISSUES_LOCK.blocking_read();
1802        dotenvy::dotenv()?;
1803        let redmine = crate::api::Redmine::from_env(
1804            reqwest::blocking::Client::builder()
1805                .tls_backend_rustls()
1806                .build()?,
1807        )?;
1808
1809        let dt = time::macros::datetime!(2023-01-15 10:30:00 UTC);
1810        let endpoint = ListIssues::builder()
1811            .created_on(DateTimeFilterPast::LessThanOrEqual(dt))
1812            .build()?;
1813        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1814
1815        Ok(())
1816    }
1817
1818    #[traced_test]
1819    #[test]
1820    fn test_list_issues_created_on_filter_greater_than_or_equal() -> Result<(), Box<dyn Error>> {
1821        let _r_issues = ISSUES_LOCK.blocking_read();
1822        dotenvy::dotenv()?;
1823        let redmine = crate::api::Redmine::from_env(
1824            reqwest::blocking::Client::builder()
1825                .tls_backend_rustls()
1826                .build()?,
1827        )?;
1828
1829        let dt = time::macros::datetime!(2023-01-15 10:30:00 UTC);
1830        let endpoint = ListIssues::builder()
1831            .created_on(DateTimeFilterPast::GreaterThanOrEqual(dt))
1832            .build()?;
1833        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1834
1835        Ok(())
1836    }
1837
1838    #[traced_test]
1839    #[test]
1840    fn test_list_issues_created_on_filter_less_than_days_ago() -> Result<(), Box<dyn Error>> {
1841        let _r_issues = ISSUES_LOCK.blocking_read();
1842        dotenvy::dotenv()?;
1843        let redmine = crate::api::Redmine::from_env(
1844            reqwest::blocking::Client::builder()
1845                .tls_backend_rustls()
1846                .build()?,
1847        )?;
1848
1849        let endpoint = ListIssues::builder()
1850            .created_on(DateTimeFilterPast::LessThanDaysAgo(5))
1851            .build()?;
1852        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1853
1854        Ok(())
1855    }
1856
1857    #[traced_test]
1858    #[test]
1859    fn test_list_issues_created_on_filter_more_than_days_ago() -> Result<(), Box<dyn Error>> {
1860        let _r_issues = ISSUES_LOCK.blocking_read();
1861        dotenvy::dotenv()?;
1862        let redmine = crate::api::Redmine::from_env(
1863            reqwest::blocking::Client::builder()
1864                .tls_backend_rustls()
1865                .build()?,
1866        )?;
1867
1868        let endpoint = ListIssues::builder()
1869            .created_on(DateTimeFilterPast::MoreThanDaysAgo(10))
1870            .build()?;
1871        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1872
1873        Ok(())
1874    }
1875
1876    #[traced_test]
1877    #[test]
1878    fn test_list_issues_created_on_filter_within_past_days() -> Result<(), Box<dyn Error>> {
1879        let _r_issues = ISSUES_LOCK.blocking_read();
1880        dotenvy::dotenv()?;
1881        let redmine = crate::api::Redmine::from_env(
1882            reqwest::blocking::Client::builder()
1883                .tls_backend_rustls()
1884                .build()?,
1885        )?;
1886
1887        let endpoint = ListIssues::builder()
1888            .created_on(DateTimeFilterPast::WithinPastDays(7))
1889            .build()?;
1890        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1891
1892        Ok(())
1893    }
1894
1895    #[traced_test]
1896    #[test]
1897    fn test_list_issues_created_on_filter_exact_days_ago() -> Result<(), Box<dyn Error>> {
1898        let _r_issues = ISSUES_LOCK.blocking_read();
1899        dotenvy::dotenv()?;
1900        let redmine = crate::api::Redmine::from_env(
1901            reqwest::blocking::Client::builder()
1902                .tls_backend_rustls()
1903                .build()?,
1904        )?;
1905
1906        let endpoint = ListIssues::builder()
1907            .created_on(DateTimeFilterPast::ExactDaysAgo(3))
1908            .build()?;
1909        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1910
1911        Ok(())
1912    }
1913
1914    #[traced_test]
1915    #[test]
1916    fn test_list_issues_created_on_filter_today() -> Result<(), Box<dyn Error>> {
1917        let _r_issues = ISSUES_LOCK.blocking_read();
1918        dotenvy::dotenv()?;
1919        let redmine = crate::api::Redmine::from_env(
1920            reqwest::blocking::Client::builder()
1921                .tls_backend_rustls()
1922                .build()?,
1923        )?;
1924
1925        let endpoint = ListIssues::builder()
1926            .created_on(DateTimeFilterPast::Today)
1927            .build()?;
1928        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1929
1930        Ok(())
1931    }
1932
1933    #[traced_test]
1934    #[test]
1935    fn test_list_issues_created_on_filter_yesterday() -> Result<(), Box<dyn Error>> {
1936        let _r_issues = ISSUES_LOCK.blocking_read();
1937        dotenvy::dotenv()?;
1938        let redmine = crate::api::Redmine::from_env(
1939            reqwest::blocking::Client::builder()
1940                .tls_backend_rustls()
1941                .build()?,
1942        )?;
1943
1944        let endpoint = ListIssues::builder()
1945            .created_on(DateTimeFilterPast::Yesterday)
1946            .build()?;
1947        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1948
1949        Ok(())
1950    }
1951
1952    #[traced_test]
1953    #[test]
1954    fn test_list_issues_created_on_filter_this_week() -> Result<(), Box<dyn Error>> {
1955        let _r_issues = ISSUES_LOCK.blocking_read();
1956        dotenvy::dotenv()?;
1957        let redmine = crate::api::Redmine::from_env(
1958            reqwest::blocking::Client::builder()
1959                .tls_backend_rustls()
1960                .build()?,
1961        )?;
1962
1963        let endpoint = ListIssues::builder()
1964            .created_on(DateTimeFilterPast::ThisWeek)
1965            .build()?;
1966        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1967
1968        Ok(())
1969    }
1970
1971    #[traced_test]
1972    #[test]
1973    fn test_list_issues_created_on_filter_last_week() -> Result<(), Box<dyn Error>> {
1974        let _r_issues = ISSUES_LOCK.blocking_read();
1975        dotenvy::dotenv()?;
1976        let redmine = crate::api::Redmine::from_env(
1977            reqwest::blocking::Client::builder()
1978                .tls_backend_rustls()
1979                .build()?,
1980        )?;
1981
1982        let endpoint = ListIssues::builder()
1983            .created_on(DateTimeFilterPast::LastWeek)
1984            .build()?;
1985        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
1986
1987        Ok(())
1988    }
1989
1990    #[traced_test]
1991    #[test]
1992    fn test_list_issues_created_on_filter_last_two_weeks() -> Result<(), Box<dyn Error>> {
1993        let _r_issues = ISSUES_LOCK.blocking_read();
1994        dotenvy::dotenv()?;
1995        let redmine = crate::api::Redmine::from_env(
1996            reqwest::blocking::Client::builder()
1997                .tls_backend_rustls()
1998                .build()?,
1999        )?;
2000
2001        let endpoint = ListIssues::builder()
2002            .created_on(DateTimeFilterPast::LastTwoWeeks)
2003            .build()?;
2004        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2005
2006        Ok(())
2007    }
2008
2009    #[traced_test]
2010    #[test]
2011    fn test_list_issues_created_on_filter_this_month() -> Result<(), Box<dyn Error>> {
2012        let _r_issues = ISSUES_LOCK.blocking_read();
2013        dotenvy::dotenv()?;
2014        let redmine = crate::api::Redmine::from_env(
2015            reqwest::blocking::Client::builder()
2016                .tls_backend_rustls()
2017                .build()?,
2018        )?;
2019
2020        let endpoint = ListIssues::builder()
2021            .created_on(DateTimeFilterPast::ThisMonth)
2022            .build()?;
2023        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2024
2025        Ok(())
2026    }
2027
2028    #[traced_test]
2029    #[test]
2030    fn test_list_issues_created_on_filter_last_month() -> Result<(), Box<dyn Error>> {
2031        let _r_issues = ISSUES_LOCK.blocking_read();
2032        dotenvy::dotenv()?;
2033        let redmine = crate::api::Redmine::from_env(
2034            reqwest::blocking::Client::builder()
2035                .tls_backend_rustls()
2036                .build()?,
2037        )?;
2038
2039        let endpoint = ListIssues::builder()
2040            .created_on(DateTimeFilterPast::LastMonth)
2041            .build()?;
2042        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2043
2044        Ok(())
2045    }
2046
2047    #[traced_test]
2048    #[test]
2049    fn test_list_issues_created_on_filter_this_year() -> Result<(), Box<dyn Error>> {
2050        let _r_issues = ISSUES_LOCK.blocking_read();
2051        dotenvy::dotenv()?;
2052        let redmine = crate::api::Redmine::from_env(
2053            reqwest::blocking::Client::builder()
2054                .tls_backend_rustls()
2055                .build()?,
2056        )?;
2057
2058        let endpoint = ListIssues::builder()
2059            .created_on(DateTimeFilterPast::ThisYear)
2060            .build()?;
2061        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2062
2063        Ok(())
2064    }
2065
2066    #[traced_test]
2067    #[test]
2068    fn test_list_issues_created_on_filter_unset() -> Result<(), Box<dyn Error>> {
2069        let _r_issues = ISSUES_LOCK.blocking_read();
2070        dotenvy::dotenv()?;
2071        let redmine = crate::api::Redmine::from_env(
2072            reqwest::blocking::Client::builder()
2073                .tls_backend_rustls()
2074                .build()?,
2075        )?;
2076
2077        let endpoint = ListIssues::builder()
2078            .created_on(DateTimeFilterPast::Unset)
2079            .build()?;
2080        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2081
2082        Ok(())
2083    }
2084
2085    #[traced_test]
2086    #[test]
2087    fn test_list_issues_created_on_filter_any() -> Result<(), Box<dyn Error>> {
2088        let _r_issues = ISSUES_LOCK.blocking_read();
2089        dotenvy::dotenv()?;
2090        let redmine = crate::api::Redmine::from_env(
2091            reqwest::blocking::Client::builder()
2092                .tls_backend_rustls()
2093                .build()?,
2094        )?;
2095
2096        let endpoint = ListIssues::builder()
2097            .created_on(DateTimeFilterPast::Any)
2098            .build()?;
2099        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2100
2101        Ok(())
2102    }
2103
2104    #[traced_test]
2105    #[test]
2106    fn test_list_issues_updated_on_filter_exact_match() -> Result<(), Box<dyn Error>> {
2107        let _r_issues = ISSUES_LOCK.blocking_read();
2108        dotenvy::dotenv()?;
2109        let redmine = crate::api::Redmine::from_env(
2110            reqwest::blocking::Client::builder()
2111                .tls_backend_rustls()
2112                .build()?,
2113        )?;
2114
2115        let dt = time::macros::datetime!(2023-01-15 10:30:00 UTC);
2116        let endpoint = ListIssues::builder()
2117            .updated_on(DateTimeFilterPast::ExactMatch(dt))
2118            .build()?;
2119        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2120
2121        Ok(())
2122    }
2123
2124    #[traced_test]
2125    #[test]
2126    fn test_list_issues_updated_on_filter_range() -> Result<(), Box<dyn Error>> {
2127        let _r_issues = ISSUES_LOCK.blocking_read();
2128        dotenvy::dotenv()?;
2129        let redmine = crate::api::Redmine::from_env(
2130            reqwest::blocking::Client::builder()
2131                .tls_backend_rustls()
2132                .build()?,
2133        )?;
2134
2135        let dt_start = time::macros::datetime!(2023-01-01 00:00:00 UTC);
2136        let dt_end = time::macros::datetime!(2023-01-31 23:59:59 UTC);
2137        let endpoint = ListIssues::builder()
2138            .updated_on(DateTimeFilterPast::Range(dt_start, dt_end))
2139            .build()?;
2140        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2141
2142        Ok(())
2143    }
2144
2145    #[traced_test]
2146    #[test]
2147    fn test_list_issues_updated_on_filter_less_than_or_equal() -> Result<(), Box<dyn Error>> {
2148        let _r_issues = ISSUES_LOCK.blocking_read();
2149        dotenvy::dotenv()?;
2150        let redmine = crate::api::Redmine::from_env(
2151            reqwest::blocking::Client::builder()
2152                .tls_backend_rustls()
2153                .build()?,
2154        )?;
2155
2156        let dt = time::macros::datetime!(2023-01-15 10:30:00 UTC);
2157        let endpoint = ListIssues::builder()
2158            .updated_on(DateTimeFilterPast::LessThanOrEqual(dt))
2159            .build()?;
2160        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2161
2162        Ok(())
2163    }
2164
2165    #[traced_test]
2166    #[test]
2167    fn test_list_issues_updated_on_filter_greater_than_or_equal() -> Result<(), Box<dyn Error>> {
2168        let _r_issues = ISSUES_LOCK.blocking_read();
2169        dotenvy::dotenv()?;
2170        let redmine = crate::api::Redmine::from_env(
2171            reqwest::blocking::Client::builder()
2172                .tls_backend_rustls()
2173                .build()?,
2174        )?;
2175
2176        let dt = time::macros::datetime!(2023-01-15 10:30:00 UTC);
2177        let endpoint = ListIssues::builder()
2178            .updated_on(DateTimeFilterPast::GreaterThanOrEqual(dt))
2179            .build()?;
2180        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2181
2182        Ok(())
2183    }
2184
2185    #[traced_test]
2186    #[test]
2187    fn test_list_issues_updated_on_filter_less_than_days_ago() -> Result<(), Box<dyn Error>> {
2188        let _r_issues = ISSUES_LOCK.blocking_read();
2189        dotenvy::dotenv()?;
2190        let redmine = crate::api::Redmine::from_env(
2191            reqwest::blocking::Client::builder()
2192                .tls_backend_rustls()
2193                .build()?,
2194        )?;
2195
2196        let endpoint = ListIssues::builder()
2197            .updated_on(DateTimeFilterPast::LessThanDaysAgo(5))
2198            .build()?;
2199        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2200
2201        Ok(())
2202    }
2203
2204    #[traced_test]
2205    #[test]
2206    fn test_list_issues_updated_on_filter_more_than_days_ago() -> Result<(), Box<dyn Error>> {
2207        let _r_issues = ISSUES_LOCK.blocking_read();
2208        dotenvy::dotenv()?;
2209        let redmine = crate::api::Redmine::from_env(
2210            reqwest::blocking::Client::builder()
2211                .tls_backend_rustls()
2212                .build()?,
2213        )?;
2214
2215        let endpoint = ListIssues::builder()
2216            .updated_on(DateTimeFilterPast::MoreThanDaysAgo(10))
2217            .build()?;
2218        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2219
2220        Ok(())
2221    }
2222
2223    #[traced_test]
2224    #[test]
2225    fn test_list_issues_updated_on_filter_within_past_days() -> Result<(), Box<dyn Error>> {
2226        let _r_issues = ISSUES_LOCK.blocking_read();
2227        dotenvy::dotenv()?;
2228        let redmine = crate::api::Redmine::from_env(
2229            reqwest::blocking::Client::builder()
2230                .tls_backend_rustls()
2231                .build()?,
2232        )?;
2233
2234        let endpoint = ListIssues::builder()
2235            .updated_on(DateTimeFilterPast::WithinPastDays(7))
2236            .build()?;
2237        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2238
2239        Ok(())
2240    }
2241
2242    #[traced_test]
2243    #[test]
2244    fn test_list_issues_updated_on_filter_exact_days_ago() -> Result<(), Box<dyn Error>> {
2245        let _r_issues = ISSUES_LOCK.blocking_read();
2246        dotenvy::dotenv()?;
2247        let redmine = crate::api::Redmine::from_env(
2248            reqwest::blocking::Client::builder()
2249                .tls_backend_rustls()
2250                .build()?,
2251        )?;
2252
2253        let endpoint = ListIssues::builder()
2254            .updated_on(DateTimeFilterPast::ExactDaysAgo(3))
2255            .build()?;
2256        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2257
2258        Ok(())
2259    }
2260
2261    #[traced_test]
2262    #[test]
2263    fn test_list_issues_updated_on_filter_today() -> Result<(), Box<dyn Error>> {
2264        let _r_issues = ISSUES_LOCK.blocking_read();
2265        dotenvy::dotenv()?;
2266        let redmine = crate::api::Redmine::from_env(
2267            reqwest::blocking::Client::builder()
2268                .tls_backend_rustls()
2269                .build()?,
2270        )?;
2271
2272        let endpoint = ListIssues::builder()
2273            .updated_on(DateTimeFilterPast::Today)
2274            .build()?;
2275        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2276
2277        Ok(())
2278    }
2279
2280    #[traced_test]
2281    #[test]
2282    fn test_list_issues_updated_on_filter_yesterday() -> Result<(), Box<dyn Error>> {
2283        let _r_issues = ISSUES_LOCK.blocking_read();
2284        dotenvy::dotenv()?;
2285        let redmine = crate::api::Redmine::from_env(
2286            reqwest::blocking::Client::builder()
2287                .tls_backend_rustls()
2288                .build()?,
2289        )?;
2290
2291        let endpoint = ListIssues::builder()
2292            .updated_on(DateTimeFilterPast::Yesterday)
2293            .build()?;
2294        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2295
2296        Ok(())
2297    }
2298
2299    #[traced_test]
2300    #[test]
2301    fn test_list_issues_updated_on_filter_this_week() -> Result<(), Box<dyn Error>> {
2302        let _r_issues = ISSUES_LOCK.blocking_read();
2303        dotenvy::dotenv()?;
2304        let redmine = crate::api::Redmine::from_env(
2305            reqwest::blocking::Client::builder()
2306                .tls_backend_rustls()
2307                .build()?,
2308        )?;
2309
2310        let endpoint = ListIssues::builder()
2311            .updated_on(DateTimeFilterPast::ThisWeek)
2312            .build()?;
2313        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2314
2315        Ok(())
2316    }
2317
2318    #[traced_test]
2319    #[test]
2320    fn test_list_issues_updated_on_filter_last_week() -> Result<(), Box<dyn Error>> {
2321        let _r_issues = ISSUES_LOCK.blocking_read();
2322        dotenvy::dotenv()?;
2323        let redmine = crate::api::Redmine::from_env(
2324            reqwest::blocking::Client::builder()
2325                .tls_backend_rustls()
2326                .build()?,
2327        )?;
2328
2329        let endpoint = ListIssues::builder()
2330            .updated_on(DateTimeFilterPast::LastWeek)
2331            .build()?;
2332        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2333
2334        Ok(())
2335    }
2336
2337    #[traced_test]
2338    #[test]
2339    fn test_list_issues_updated_on_filter_last_two_weeks() -> Result<(), Box<dyn Error>> {
2340        let _r_issues = ISSUES_LOCK.blocking_read();
2341        dotenvy::dotenv()?;
2342        let redmine = crate::api::Redmine::from_env(
2343            reqwest::blocking::Client::builder()
2344                .tls_backend_rustls()
2345                .build()?,
2346        )?;
2347
2348        let endpoint = ListIssues::builder()
2349            .updated_on(DateTimeFilterPast::LastTwoWeeks)
2350            .build()?;
2351        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2352
2353        Ok(())
2354    }
2355
2356    #[traced_test]
2357    #[test]
2358    fn test_list_issues_updated_on_filter_this_month() -> Result<(), Box<dyn Error>> {
2359        let _r_issues = ISSUES_LOCK.blocking_read();
2360        dotenvy::dotenv()?;
2361        let redmine = crate::api::Redmine::from_env(
2362            reqwest::blocking::Client::builder()
2363                .tls_backend_rustls()
2364                .build()?,
2365        )?;
2366
2367        let endpoint = ListIssues::builder()
2368            .updated_on(DateTimeFilterPast::ThisMonth)
2369            .build()?;
2370        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2371
2372        Ok(())
2373    }
2374
2375    #[traced_test]
2376    #[test]
2377    fn test_list_issues_updated_on_filter_last_month() -> Result<(), Box<dyn Error>> {
2378        let _r_issues = ISSUES_LOCK.blocking_read();
2379        dotenvy::dotenv()?;
2380        let redmine = crate::api::Redmine::from_env(
2381            reqwest::blocking::Client::builder()
2382                .tls_backend_rustls()
2383                .build()?,
2384        )?;
2385
2386        let endpoint = ListIssues::builder()
2387            .updated_on(DateTimeFilterPast::LastMonth)
2388            .build()?;
2389        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2390
2391        Ok(())
2392    }
2393
2394    #[traced_test]
2395    #[test]
2396    fn test_list_issues_updated_on_filter_this_year() -> Result<(), Box<dyn Error>> {
2397        let _r_issues = ISSUES_LOCK.blocking_read();
2398        dotenvy::dotenv()?;
2399        let redmine = crate::api::Redmine::from_env(
2400            reqwest::blocking::Client::builder()
2401                .tls_backend_rustls()
2402                .build()?,
2403        )?;
2404
2405        let endpoint = ListIssues::builder()
2406            .updated_on(DateTimeFilterPast::ThisYear)
2407            .build()?;
2408        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2409
2410        Ok(())
2411    }
2412
2413    #[traced_test]
2414    #[test]
2415    fn test_list_issues_updated_on_filter_unset() -> Result<(), Box<dyn Error>> {
2416        let _r_issues = ISSUES_LOCK.blocking_read();
2417        dotenvy::dotenv()?;
2418        let redmine = crate::api::Redmine::from_env(
2419            reqwest::blocking::Client::builder()
2420                .tls_backend_rustls()
2421                .build()?,
2422        )?;
2423
2424        let endpoint = ListIssues::builder()
2425            .updated_on(DateTimeFilterPast::Unset)
2426            .build()?;
2427        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2428
2429        Ok(())
2430    }
2431
2432    #[traced_test]
2433    #[test]
2434    fn test_list_issues_updated_on_filter_any() -> Result<(), Box<dyn Error>> {
2435        let _r_issues = ISSUES_LOCK.blocking_read();
2436        dotenvy::dotenv()?;
2437        let redmine = crate::api::Redmine::from_env(
2438            reqwest::blocking::Client::builder()
2439                .tls_backend_rustls()
2440                .build()?,
2441        )?;
2442
2443        let endpoint = ListIssues::builder()
2444            .updated_on(DateTimeFilterPast::Any)
2445            .build()?;
2446        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2447
2448        Ok(())
2449    }
2450
2451    #[traced_test]
2452    #[test]
2453    fn test_list_issues_start_date_filter_exact_match() -> Result<(), Box<dyn Error>> {
2454        let _r_issues = ISSUES_LOCK.blocking_read();
2455        dotenvy::dotenv()?;
2456        let redmine = crate::api::Redmine::from_env(
2457            reqwest::blocking::Client::builder()
2458                .tls_backend_rustls()
2459                .build()?,
2460        )?;
2461
2462        let dt = time::macros::date!(2023 - 01 - 15);
2463        let endpoint = ListIssues::builder()
2464            .start_date(DateFilter::ExactMatch(dt))
2465            .build()?;
2466        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2467
2468        Ok(())
2469    }
2470
2471    #[traced_test]
2472    #[test]
2473    fn test_list_issues_start_date_filter_range() -> Result<(), Box<dyn Error>> {
2474        let _r_issues = ISSUES_LOCK.blocking_read();
2475        dotenvy::dotenv()?;
2476        let redmine = crate::api::Redmine::from_env(
2477            reqwest::blocking::Client::builder()
2478                .tls_backend_rustls()
2479                .build()?,
2480        )?;
2481
2482        let dt_start = time::macros::date!(2023 - 01 - 01);
2483        let dt_end = time::macros::date!(2023 - 01 - 31);
2484        let endpoint = ListIssues::builder()
2485            .start_date(DateFilter::Range(dt_start, dt_end))
2486            .build()?;
2487        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2488
2489        Ok(())
2490    }
2491
2492    #[traced_test]
2493    #[test]
2494    fn test_list_issues_start_date_filter_less_than_or_equal() -> Result<(), Box<dyn Error>> {
2495        let _r_issues = ISSUES_LOCK.blocking_read();
2496        dotenvy::dotenv()?;
2497        let redmine = crate::api::Redmine::from_env(
2498            reqwest::blocking::Client::builder()
2499                .tls_backend_rustls()
2500                .build()?,
2501        )?;
2502
2503        let dt = time::macros::date!(2023 - 01 - 15);
2504        let endpoint = ListIssues::builder()
2505            .start_date(DateFilter::LessThanOrEqual(dt))
2506            .build()?;
2507        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2508
2509        Ok(())
2510    }
2511
2512    #[traced_test]
2513    #[test]
2514    fn test_list_issues_start_date_filter_greater_than_or_equal() -> Result<(), Box<dyn Error>> {
2515        let _r_issues = ISSUES_LOCK.blocking_read();
2516        dotenvy::dotenv()?;
2517        let redmine = crate::api::Redmine::from_env(
2518            reqwest::blocking::Client::builder()
2519                .tls_backend_rustls()
2520                .build()?,
2521        )?;
2522
2523        let dt = time::macros::date!(2023 - 01 - 15);
2524        let endpoint = ListIssues::builder()
2525            .start_date(DateFilter::GreaterThanOrEqual(dt))
2526            .build()?;
2527        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2528
2529        Ok(())
2530    }
2531
2532    #[traced_test]
2533    #[test]
2534    fn test_list_issues_start_date_filter_less_than_days_ago() -> Result<(), Box<dyn Error>> {
2535        let _r_issues = ISSUES_LOCK.blocking_read();
2536        dotenvy::dotenv()?;
2537        let redmine = crate::api::Redmine::from_env(
2538            reqwest::blocking::Client::builder()
2539                .tls_backend_rustls()
2540                .build()?,
2541        )?;
2542
2543        let endpoint = ListIssues::builder()
2544            .start_date(DateFilter::LessThanDaysAgo(5))
2545            .build()?;
2546        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2547
2548        Ok(())
2549    }
2550
2551    #[traced_test]
2552    #[test]
2553    fn test_list_issues_start_date_filter_more_than_days_ago() -> Result<(), Box<dyn Error>> {
2554        let _r_issues = ISSUES_LOCK.blocking_read();
2555        dotenvy::dotenv()?;
2556        let redmine = crate::api::Redmine::from_env(
2557            reqwest::blocking::Client::builder()
2558                .tls_backend_rustls()
2559                .build()?,
2560        )?;
2561
2562        let endpoint = ListIssues::builder()
2563            .start_date(DateFilter::MoreThanDaysAgo(10))
2564            .build()?;
2565        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2566
2567        Ok(())
2568    }
2569
2570    #[traced_test]
2571    #[test]
2572    fn test_list_issues_start_date_filter_within_past_days() -> Result<(), Box<dyn Error>> {
2573        let _r_issues = ISSUES_LOCK.blocking_read();
2574        dotenvy::dotenv()?;
2575        let redmine = crate::api::Redmine::from_env(
2576            reqwest::blocking::Client::builder()
2577                .tls_backend_rustls()
2578                .build()?,
2579        )?;
2580
2581        let endpoint = ListIssues::builder()
2582            .start_date(DateFilter::WithinPastDays(7))
2583            .build()?;
2584        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2585
2586        Ok(())
2587    }
2588
2589    #[traced_test]
2590    #[test]
2591    fn test_list_issues_start_date_filter_exact_days_ago() -> Result<(), Box<dyn Error>> {
2592        let _r_issues = ISSUES_LOCK.blocking_read();
2593        dotenvy::dotenv()?;
2594        let redmine = crate::api::Redmine::from_env(
2595            reqwest::blocking::Client::builder()
2596                .tls_backend_rustls()
2597                .build()?,
2598        )?;
2599
2600        let endpoint = ListIssues::builder()
2601            .start_date(DateFilter::ExactDaysAgo(3))
2602            .build()?;
2603        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2604
2605        Ok(())
2606    }
2607
2608    #[traced_test]
2609    #[test]
2610    fn test_list_issues_start_date_filter_in_less_than_days() -> Result<(), Box<dyn Error>> {
2611        let _r_issues = ISSUES_LOCK.blocking_read();
2612        dotenvy::dotenv()?;
2613        let redmine = crate::api::Redmine::from_env(
2614            reqwest::blocking::Client::builder()
2615                .tls_backend_rustls()
2616                .build()?,
2617        )?;
2618
2619        let endpoint = ListIssues::builder()
2620            .start_date(DateFilter::InLessThanDays(5))
2621            .build()?;
2622        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2623
2624        Ok(())
2625    }
2626
2627    #[traced_test]
2628    #[test]
2629    fn test_list_issues_start_date_filter_in_more_than_days() -> Result<(), Box<dyn Error>> {
2630        let _r_issues = ISSUES_LOCK.blocking_read();
2631        dotenvy::dotenv()?;
2632        let redmine = crate::api::Redmine::from_env(
2633            reqwest::blocking::Client::builder()
2634                .tls_backend_rustls()
2635                .build()?,
2636        )?;
2637
2638        let endpoint = ListIssues::builder()
2639            .start_date(DateFilter::InMoreThanDays(10))
2640            .build()?;
2641        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2642
2643        Ok(())
2644    }
2645
2646    #[traced_test]
2647    #[test]
2648    fn test_list_issues_start_date_filter_within_future_days() -> Result<(), Box<dyn Error>> {
2649        let _r_issues = ISSUES_LOCK.blocking_read();
2650        dotenvy::dotenv()?;
2651        let redmine = crate::api::Redmine::from_env(
2652            reqwest::blocking::Client::builder()
2653                .tls_backend_rustls()
2654                .build()?,
2655        )?;
2656
2657        let endpoint = ListIssues::builder()
2658            .start_date(DateFilter::WithinFutureDays(7))
2659            .build()?;
2660        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2661
2662        Ok(())
2663    }
2664
2665    #[traced_test]
2666    #[test]
2667    fn test_list_issues_start_date_filter_in_exact_days() -> Result<(), Box<dyn Error>> {
2668        let _r_issues = ISSUES_LOCK.blocking_read();
2669        dotenvy::dotenv()?;
2670        let redmine = crate::api::Redmine::from_env(
2671            reqwest::blocking::Client::builder()
2672                .tls_backend_rustls()
2673                .build()?,
2674        )?;
2675
2676        let endpoint = ListIssues::builder()
2677            .start_date(DateFilter::InExactDays(3))
2678            .build()?;
2679        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2680
2681        Ok(())
2682    }
2683
2684    #[traced_test]
2685    #[test]
2686    fn test_list_issues_start_date_filter_today() -> Result<(), Box<dyn Error>> {
2687        let _r_issues = ISSUES_LOCK.blocking_read();
2688        dotenvy::dotenv()?;
2689        let redmine = crate::api::Redmine::from_env(
2690            reqwest::blocking::Client::builder()
2691                .tls_backend_rustls()
2692                .build()?,
2693        )?;
2694
2695        let endpoint = ListIssues::builder()
2696            .start_date(DateFilter::Today)
2697            .build()?;
2698        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2699
2700        Ok(())
2701    }
2702
2703    #[traced_test]
2704    #[test]
2705    fn test_list_issues_start_date_filter_yesterday() -> Result<(), Box<dyn Error>> {
2706        let _r_issues = ISSUES_LOCK.blocking_read();
2707        dotenvy::dotenv()?;
2708        let redmine = crate::api::Redmine::from_env(
2709            reqwest::blocking::Client::builder()
2710                .tls_backend_rustls()
2711                .build()?,
2712        )?;
2713
2714        let endpoint = ListIssues::builder()
2715            .start_date(DateFilter::Yesterday)
2716            .build()?;
2717        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2718
2719        Ok(())
2720    }
2721
2722    #[traced_test]
2723    #[test]
2724    fn test_list_issues_start_date_filter_tomorrow() -> Result<(), Box<dyn Error>> {
2725        let _r_issues = ISSUES_LOCK.blocking_read();
2726        dotenvy::dotenv()?;
2727        let redmine = crate::api::Redmine::from_env(
2728            reqwest::blocking::Client::builder()
2729                .tls_backend_rustls()
2730                .build()?,
2731        )?;
2732
2733        let endpoint = ListIssues::builder()
2734            .start_date(DateFilter::Tomorrow)
2735            .build()?;
2736        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2737
2738        Ok(())
2739    }
2740
2741    #[traced_test]
2742    #[test]
2743    fn test_list_issues_start_date_filter_this_week() -> Result<(), Box<dyn Error>> {
2744        let _r_issues = ISSUES_LOCK.blocking_read();
2745        dotenvy::dotenv()?;
2746        let redmine = crate::api::Redmine::from_env(
2747            reqwest::blocking::Client::builder()
2748                .tls_backend_rustls()
2749                .build()?,
2750        )?;
2751
2752        let endpoint = ListIssues::builder()
2753            .start_date(DateFilter::ThisWeek)
2754            .build()?;
2755        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2756
2757        Ok(())
2758    }
2759
2760    #[traced_test]
2761    #[test]
2762    fn test_list_issues_start_date_filter_last_week() -> Result<(), Box<dyn Error>> {
2763        let _r_issues = ISSUES_LOCK.blocking_read();
2764        dotenvy::dotenv()?;
2765        let redmine = crate::api::Redmine::from_env(
2766            reqwest::blocking::Client::builder()
2767                .tls_backend_rustls()
2768                .build()?,
2769        )?;
2770
2771        let endpoint = ListIssues::builder()
2772            .start_date(DateFilter::LastWeek)
2773            .build()?;
2774        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2775
2776        Ok(())
2777    }
2778
2779    #[traced_test]
2780    #[test]
2781    fn test_list_issues_start_date_filter_last_two_weeks() -> Result<(), Box<dyn Error>> {
2782        let _r_issues = ISSUES_LOCK.blocking_read();
2783        dotenvy::dotenv()?;
2784        let redmine = crate::api::Redmine::from_env(
2785            reqwest::blocking::Client::builder()
2786                .tls_backend_rustls()
2787                .build()?,
2788        )?;
2789
2790        let endpoint = ListIssues::builder()
2791            .start_date(DateFilter::LastTwoWeeks)
2792            .build()?;
2793        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2794
2795        Ok(())
2796    }
2797
2798    #[traced_test]
2799    #[test]
2800    fn test_list_issues_start_date_filter_next_week() -> Result<(), Box<dyn Error>> {
2801        let _r_issues = ISSUES_LOCK.blocking_read();
2802        dotenvy::dotenv()?;
2803        let redmine = crate::api::Redmine::from_env(
2804            reqwest::blocking::Client::builder()
2805                .tls_backend_rustls()
2806                .build()?,
2807        )?;
2808
2809        let endpoint = ListIssues::builder()
2810            .start_date(DateFilter::NextWeek)
2811            .build()?;
2812        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2813
2814        Ok(())
2815    }
2816
2817    #[traced_test]
2818    #[test]
2819    fn test_list_issues_start_date_filter_this_month() -> Result<(), Box<dyn Error>> {
2820        let _r_issues = ISSUES_LOCK.blocking_read();
2821        dotenvy::dotenv()?;
2822        let redmine = crate::api::Redmine::from_env(
2823            reqwest::blocking::Client::builder()
2824                .tls_backend_rustls()
2825                .build()?,
2826        )?;
2827
2828        let endpoint = ListIssues::builder()
2829            .start_date(DateFilter::ThisMonth)
2830            .build()?;
2831        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2832
2833        Ok(())
2834    }
2835
2836    #[traced_test]
2837    #[test]
2838    fn test_list_issues_start_date_filter_last_month() -> Result<(), Box<dyn Error>> {
2839        let _r_issues = ISSUES_LOCK.blocking_read();
2840        dotenvy::dotenv()?;
2841        let redmine = crate::api::Redmine::from_env(
2842            reqwest::blocking::Client::builder()
2843                .tls_backend_rustls()
2844                .build()?,
2845        )?;
2846
2847        let endpoint = ListIssues::builder()
2848            .start_date(DateFilter::LastMonth)
2849            .build()?;
2850        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2851
2852        Ok(())
2853    }
2854
2855    #[traced_test]
2856    #[test]
2857    fn test_list_issues_start_date_filter_next_month() -> Result<(), Box<dyn Error>> {
2858        let _r_issues = ISSUES_LOCK.blocking_read();
2859        dotenvy::dotenv()?;
2860        let redmine = crate::api::Redmine::from_env(
2861            reqwest::blocking::Client::builder()
2862                .tls_backend_rustls()
2863                .build()?,
2864        )?;
2865
2866        let endpoint = ListIssues::builder()
2867            .start_date(DateFilter::NextMonth)
2868            .build()?;
2869        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2870
2871        Ok(())
2872    }
2873
2874    #[traced_test]
2875    #[test]
2876    fn test_list_issues_start_date_filter_this_year() -> Result<(), Box<dyn Error>> {
2877        let _r_issues = ISSUES_LOCK.blocking_read();
2878        dotenvy::dotenv()?;
2879        let redmine = crate::api::Redmine::from_env(
2880            reqwest::blocking::Client::builder()
2881                .tls_backend_rustls()
2882                .build()?,
2883        )?;
2884
2885        let endpoint = ListIssues::builder()
2886            .start_date(DateFilter::ThisYear)
2887            .build()?;
2888        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2889
2890        Ok(())
2891    }
2892
2893    #[traced_test]
2894    #[test]
2895    fn test_list_issues_start_date_filter_unset() -> Result<(), Box<dyn Error>> {
2896        let _r_issues = ISSUES_LOCK.blocking_read();
2897        dotenvy::dotenv()?;
2898        let redmine = crate::api::Redmine::from_env(
2899            reqwest::blocking::Client::builder()
2900                .tls_backend_rustls()
2901                .build()?,
2902        )?;
2903
2904        let endpoint = ListIssues::builder()
2905            .start_date(DateFilter::Unset)
2906            .build()?;
2907        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2908
2909        Ok(())
2910    }
2911
2912    #[traced_test]
2913    #[test]
2914    fn test_list_issues_start_date_filter_any() -> Result<(), Box<dyn Error>> {
2915        let _r_issues = ISSUES_LOCK.blocking_read();
2916        dotenvy::dotenv()?;
2917        let redmine = crate::api::Redmine::from_env(
2918            reqwest::blocking::Client::builder()
2919                .tls_backend_rustls()
2920                .build()?,
2921        )?;
2922
2923        let endpoint = ListIssues::builder().start_date(DateFilter::Any).build()?;
2924        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2925
2926        Ok(())
2927    }
2928
2929    #[traced_test]
2930    #[test]
2931    fn test_list_issues_due_date_filter_exact_match() -> Result<(), Box<dyn Error>> {
2932        let _r_issues = ISSUES_LOCK.blocking_read();
2933        dotenvy::dotenv()?;
2934        let redmine = crate::api::Redmine::from_env(
2935            reqwest::blocking::Client::builder()
2936                .tls_backend_rustls()
2937                .build()?,
2938        )?;
2939
2940        let dt = time::macros::date!(2023 - 01 - 15);
2941        let endpoint = ListIssues::builder()
2942            .due_date(DateFilter::ExactMatch(dt))
2943            .build()?;
2944        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2945
2946        Ok(())
2947    }
2948
2949    #[traced_test]
2950    #[test]
2951    fn test_list_issues_due_date_filter_range() -> Result<(), Box<dyn Error>> {
2952        let _r_issues = ISSUES_LOCK.blocking_read();
2953        dotenvy::dotenv()?;
2954        let redmine = crate::api::Redmine::from_env(
2955            reqwest::blocking::Client::builder()
2956                .tls_backend_rustls()
2957                .build()?,
2958        )?;
2959
2960        let dt_start = time::macros::date!(2023 - 01 - 01);
2961        let dt_end = time::macros::date!(2023 - 01 - 31);
2962        let endpoint = ListIssues::builder()
2963            .due_date(DateFilter::Range(dt_start, dt_end))
2964            .build()?;
2965        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2966
2967        Ok(())
2968    }
2969
2970    #[traced_test]
2971    #[test]
2972    fn test_list_issues_due_date_filter_less_than_or_equal() -> Result<(), Box<dyn Error>> {
2973        let _r_issues = ISSUES_LOCK.blocking_read();
2974        dotenvy::dotenv()?;
2975        let redmine = crate::api::Redmine::from_env(
2976            reqwest::blocking::Client::builder()
2977                .tls_backend_rustls()
2978                .build()?,
2979        )?;
2980
2981        let dt = time::macros::date!(2023 - 01 - 15);
2982        let endpoint = ListIssues::builder()
2983            .due_date(DateFilter::LessThanOrEqual(dt))
2984            .build()?;
2985        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
2986
2987        Ok(())
2988    }
2989
2990    #[traced_test]
2991    #[test]
2992    fn test_list_issues_due_date_filter_greater_than_or_equal() -> Result<(), Box<dyn Error>> {
2993        let _r_issues = ISSUES_LOCK.blocking_read();
2994        dotenvy::dotenv()?;
2995        let redmine = crate::api::Redmine::from_env(
2996            reqwest::blocking::Client::builder()
2997                .tls_backend_rustls()
2998                .build()?,
2999        )?;
3000
3001        let dt = time::macros::date!(2023 - 01 - 15);
3002        let endpoint = ListIssues::builder()
3003            .due_date(DateFilter::GreaterThanOrEqual(dt))
3004            .build()?;
3005        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3006
3007        Ok(())
3008    }
3009
3010    #[traced_test]
3011    #[test]
3012    fn test_list_issues_due_date_filter_less_than_days_ago() -> Result<(), Box<dyn Error>> {
3013        let _r_issues = ISSUES_LOCK.blocking_read();
3014        dotenvy::dotenv()?;
3015        let redmine = crate::api::Redmine::from_env(
3016            reqwest::blocking::Client::builder()
3017                .tls_backend_rustls()
3018                .build()?,
3019        )?;
3020
3021        let endpoint = ListIssues::builder()
3022            .due_date(DateFilter::LessThanDaysAgo(5))
3023            .build()?;
3024        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3025
3026        Ok(())
3027    }
3028
3029    #[traced_test]
3030    #[test]
3031    fn test_list_issues_due_date_filter_more_than_days_ago() -> Result<(), Box<dyn Error>> {
3032        let _r_issues = ISSUES_LOCK.blocking_read();
3033        dotenvy::dotenv()?;
3034        let redmine = crate::api::Redmine::from_env(
3035            reqwest::blocking::Client::builder()
3036                .tls_backend_rustls()
3037                .build()?,
3038        )?;
3039
3040        let endpoint = ListIssues::builder()
3041            .due_date(DateFilter::MoreThanDaysAgo(10))
3042            .build()?;
3043        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3044
3045        Ok(())
3046    }
3047
3048    #[traced_test]
3049    #[test]
3050    fn test_list_issues_due_date_filter_within_past_days() -> Result<(), Box<dyn Error>> {
3051        let _r_issues = ISSUES_LOCK.blocking_read();
3052        dotenvy::dotenv()?;
3053        let redmine = crate::api::Redmine::from_env(
3054            reqwest::blocking::Client::builder()
3055                .tls_backend_rustls()
3056                .build()?,
3057        )?;
3058
3059        let endpoint = ListIssues::builder()
3060            .due_date(DateFilter::WithinPastDays(7))
3061            .build()?;
3062        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3063
3064        Ok(())
3065    }
3066
3067    #[traced_test]
3068    #[test]
3069    fn test_list_issues_due_date_filter_exact_days_ago() -> Result<(), Box<dyn Error>> {
3070        let _r_issues = ISSUES_LOCK.blocking_read();
3071        dotenvy::dotenv()?;
3072        let redmine = crate::api::Redmine::from_env(
3073            reqwest::blocking::Client::builder()
3074                .tls_backend_rustls()
3075                .build()?,
3076        )?;
3077
3078        let endpoint = ListIssues::builder()
3079            .due_date(DateFilter::ExactDaysAgo(3))
3080            .build()?;
3081        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3082
3083        Ok(())
3084    }
3085
3086    #[traced_test]
3087    #[test]
3088    fn test_list_issues_due_date_filter_in_less_than_days() -> Result<(), Box<dyn Error>> {
3089        let _r_issues = ISSUES_LOCK.blocking_read();
3090        dotenvy::dotenv()?;
3091        let redmine = crate::api::Redmine::from_env(
3092            reqwest::blocking::Client::builder()
3093                .tls_backend_rustls()
3094                .build()?,
3095        )?;
3096
3097        let endpoint = ListIssues::builder()
3098            .due_date(DateFilter::InLessThanDays(5))
3099            .build()?;
3100        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3101
3102        Ok(())
3103    }
3104
3105    #[traced_test]
3106    #[test]
3107    fn test_list_issues_due_date_filter_in_more_than_days() -> Result<(), Box<dyn Error>> {
3108        let _r_issues = ISSUES_LOCK.blocking_read();
3109        dotenvy::dotenv()?;
3110        let redmine = crate::api::Redmine::from_env(
3111            reqwest::blocking::Client::builder()
3112                .tls_backend_rustls()
3113                .build()?,
3114        )?;
3115
3116        let endpoint = ListIssues::builder()
3117            .due_date(DateFilter::InMoreThanDays(10))
3118            .build()?;
3119        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3120
3121        Ok(())
3122    }
3123
3124    #[traced_test]
3125    #[test]
3126    fn test_list_issues_due_date_filter_within_future_days() -> Result<(), Box<dyn Error>> {
3127        let _r_issues = ISSUES_LOCK.blocking_read();
3128        dotenvy::dotenv()?;
3129        let redmine = crate::api::Redmine::from_env(
3130            reqwest::blocking::Client::builder()
3131                .tls_backend_rustls()
3132                .build()?,
3133        )?;
3134
3135        let endpoint = ListIssues::builder()
3136            .due_date(DateFilter::WithinFutureDays(7))
3137            .build()?;
3138        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3139
3140        Ok(())
3141    }
3142
3143    #[traced_test]
3144    #[test]
3145    fn test_list_issues_due_date_filter_in_exact_days() -> Result<(), Box<dyn Error>> {
3146        let _r_issues = ISSUES_LOCK.blocking_read();
3147        dotenvy::dotenv()?;
3148        let redmine = crate::api::Redmine::from_env(
3149            reqwest::blocking::Client::builder()
3150                .tls_backend_rustls()
3151                .build()?,
3152        )?;
3153
3154        let endpoint = ListIssues::builder()
3155            .due_date(DateFilter::InExactDays(3))
3156            .build()?;
3157        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3158
3159        Ok(())
3160    }
3161
3162    #[traced_test]
3163    #[test]
3164    fn test_list_issues_due_date_filter_today() -> Result<(), Box<dyn Error>> {
3165        let _r_issues = ISSUES_LOCK.blocking_read();
3166        dotenvy::dotenv()?;
3167        let redmine = crate::api::Redmine::from_env(
3168            reqwest::blocking::Client::builder()
3169                .tls_backend_rustls()
3170                .build()?,
3171        )?;
3172
3173        let endpoint = ListIssues::builder().due_date(DateFilter::Today).build()?;
3174        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3175
3176        Ok(())
3177    }
3178
3179    #[traced_test]
3180    #[test]
3181    fn test_list_issues_due_date_filter_yesterday() -> Result<(), Box<dyn Error>> {
3182        let _r_issues = ISSUES_LOCK.blocking_read();
3183        dotenvy::dotenv()?;
3184        let redmine = crate::api::Redmine::from_env(
3185            reqwest::blocking::Client::builder()
3186                .tls_backend_rustls()
3187                .build()?,
3188        )?;
3189
3190        let endpoint = ListIssues::builder()
3191            .due_date(DateFilter::Yesterday)
3192            .build()?;
3193        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3194
3195        Ok(())
3196    }
3197
3198    #[traced_test]
3199    #[test]
3200    fn test_list_issues_due_date_filter_tomorrow() -> Result<(), Box<dyn Error>> {
3201        let _r_issues = ISSUES_LOCK.blocking_read();
3202        dotenvy::dotenv()?;
3203        let redmine = crate::api::Redmine::from_env(
3204            reqwest::blocking::Client::builder()
3205                .tls_backend_rustls()
3206                .build()?,
3207        )?;
3208
3209        let endpoint = ListIssues::builder()
3210            .due_date(DateFilter::Tomorrow)
3211            .build()?;
3212        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3213
3214        Ok(())
3215    }
3216
3217    #[traced_test]
3218    #[test]
3219    fn test_list_issues_due_date_filter_this_week() -> Result<(), Box<dyn Error>> {
3220        let _r_issues = ISSUES_LOCK.blocking_read();
3221        dotenvy::dotenv()?;
3222        let redmine = crate::api::Redmine::from_env(
3223            reqwest::blocking::Client::builder()
3224                .tls_backend_rustls()
3225                .build()?,
3226        )?;
3227
3228        let endpoint = ListIssues::builder()
3229            .due_date(DateFilter::ThisWeek)
3230            .build()?;
3231        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3232
3233        Ok(())
3234    }
3235
3236    #[traced_test]
3237    #[test]
3238    fn test_list_issues_due_date_filter_last_week() -> Result<(), Box<dyn Error>> {
3239        let _r_issues = ISSUES_LOCK.blocking_read();
3240        dotenvy::dotenv()?;
3241        let redmine = crate::api::Redmine::from_env(
3242            reqwest::blocking::Client::builder()
3243                .tls_backend_rustls()
3244                .build()?,
3245        )?;
3246
3247        let endpoint = ListIssues::builder()
3248            .due_date(DateFilter::LastWeek)
3249            .build()?;
3250        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3251
3252        Ok(())
3253    }
3254
3255    #[traced_test]
3256    #[test]
3257    fn test_list_issues_due_date_filter_last_two_weeks() -> Result<(), Box<dyn Error>> {
3258        let _r_issues = ISSUES_LOCK.blocking_read();
3259        dotenvy::dotenv()?;
3260        let redmine = crate::api::Redmine::from_env(
3261            reqwest::blocking::Client::builder()
3262                .tls_backend_rustls()
3263                .build()?,
3264        )?;
3265
3266        let endpoint = ListIssues::builder()
3267            .due_date(DateFilter::LastTwoWeeks)
3268            .build()?;
3269        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3270
3271        Ok(())
3272    }
3273
3274    #[traced_test]
3275    #[test]
3276    fn test_list_issues_due_date_filter_next_week() -> Result<(), Box<dyn Error>> {
3277        let _r_issues = ISSUES_LOCK.blocking_read();
3278        dotenvy::dotenv()?;
3279        let redmine = crate::api::Redmine::from_env(
3280            reqwest::blocking::Client::builder()
3281                .tls_backend_rustls()
3282                .build()?,
3283        )?;
3284
3285        let endpoint = ListIssues::builder()
3286            .due_date(DateFilter::NextWeek)
3287            .build()?;
3288        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3289
3290        Ok(())
3291    }
3292
3293    #[traced_test]
3294    #[test]
3295    fn test_list_issues_due_date_filter_this_month() -> Result<(), Box<dyn Error>> {
3296        let _r_issues = ISSUES_LOCK.blocking_read();
3297        dotenvy::dotenv()?;
3298        let redmine = crate::api::Redmine::from_env(
3299            reqwest::blocking::Client::builder()
3300                .tls_backend_rustls()
3301                .build()?,
3302        )?;
3303
3304        let endpoint = ListIssues::builder()
3305            .due_date(DateFilter::ThisMonth)
3306            .build()?;
3307        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3308
3309        Ok(())
3310    }
3311
3312    #[traced_test]
3313    #[test]
3314    fn test_list_issues_due_date_filter_last_month() -> Result<(), Box<dyn Error>> {
3315        let _r_issues = ISSUES_LOCK.blocking_read();
3316        dotenvy::dotenv()?;
3317        let redmine = crate::api::Redmine::from_env(
3318            reqwest::blocking::Client::builder()
3319                .tls_backend_rustls()
3320                .build()?,
3321        )?;
3322
3323        let endpoint = ListIssues::builder()
3324            .due_date(DateFilter::LastMonth)
3325            .build()?;
3326        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3327
3328        Ok(())
3329    }
3330
3331    #[traced_test]
3332    #[test]
3333    fn test_list_issues_due_date_filter_next_month() -> Result<(), Box<dyn Error>> {
3334        let _r_issues = ISSUES_LOCK.blocking_read();
3335        dotenvy::dotenv()?;
3336        let redmine = crate::api::Redmine::from_env(
3337            reqwest::blocking::Client::builder()
3338                .tls_backend_rustls()
3339                .build()?,
3340        )?;
3341
3342        let endpoint = ListIssues::builder()
3343            .due_date(DateFilter::NextMonth)
3344            .build()?;
3345        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3346
3347        Ok(())
3348    }
3349
3350    #[traced_test]
3351    #[test]
3352    fn test_list_issues_due_date_filter_this_year() -> Result<(), Box<dyn Error>> {
3353        let _r_issues = ISSUES_LOCK.blocking_read();
3354        dotenvy::dotenv()?;
3355        let redmine = crate::api::Redmine::from_env(
3356            reqwest::blocking::Client::builder()
3357                .tls_backend_rustls()
3358                .build()?,
3359        )?;
3360
3361        let endpoint = ListIssues::builder()
3362            .due_date(DateFilter::ThisYear)
3363            .build()?;
3364        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3365
3366        Ok(())
3367    }
3368
3369    #[traced_test]
3370    #[test]
3371    fn test_list_issues_due_date_filter_unset() -> Result<(), Box<dyn Error>> {
3372        let _r_issues = ISSUES_LOCK.blocking_read();
3373        dotenvy::dotenv()?;
3374        let redmine = crate::api::Redmine::from_env(
3375            reqwest::blocking::Client::builder()
3376                .tls_backend_rustls()
3377                .build()?,
3378        )?;
3379
3380        let endpoint = ListIssues::builder().due_date(DateFilter::Unset).build()?;
3381        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3382
3383        Ok(())
3384    }
3385
3386    #[traced_test]
3387    #[test]
3388    fn test_list_issues_due_date_filter_any() -> Result<(), Box<dyn Error>> {
3389        let _r_issues = ISSUES_LOCK.blocking_read();
3390        dotenvy::dotenv()?;
3391        let redmine = crate::api::Redmine::from_env(
3392            reqwest::blocking::Client::builder()
3393                .tls_backend_rustls()
3394                .build()?,
3395        )?;
3396
3397        let endpoint = ListIssues::builder().due_date(DateFilter::Any).build()?;
3398        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3399
3400        Ok(())
3401    }
3402
3403    #[traced_test]
3404    #[test]
3405    fn test_list_issues_child_id_filter() -> Result<(), Box<dyn Error>> {
3406        let _r_issues = ISSUES_LOCK.blocking_read();
3407        dotenvy::dotenv()?;
3408        let redmine = crate::api::Redmine::from_env(
3409            reqwest::blocking::Client::builder()
3410                .tls_backend_rustls()
3411                .build()?,
3412        )?;
3413
3414        let endpoint = ListIssues::builder().child_id(vec![123, 456]).build()?;
3415        redmine.json_response_body_page::<_, Issue>(&endpoint, 0, 25)?;
3416
3417        Ok(())
3418    }
3419}