1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// Generated by basecamp-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.
//! Reports operations.
#![allow(
clippy::too_many_arguments,
clippy::wildcard_imports,
clippy::doc_markdown
)]
use crate::client::AccountClient;
use crate::error::Error;
use crate::generated::routes;
#[allow(unused_imports)]
use crate::generated::types::*;
use crate::pagination::Page;
/// Optional query parameters for `GetAssignedTodos`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetAssignedTodosParams {
/// Group by "bucket" or "date"
pub group_by: Option<String>,
}
/// Optional query parameters for `GetOverdueTodos`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetOverdueTodosParams {
/// Page number for paginating through results. Defaults to 1. This
/// operation is not auto-paginated in any SDK, so a page is returned as
/// asked for and later pages are not followed.
pub page: Option<i32>,
}
/// Optional query parameters for `GetPersonProgress`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetPersonProgressParams {
/// Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
pub page: Option<i32>,
}
/// Optional query parameters for `GetProgressReport`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetProgressReportParams {
/// Page number for paginating through results. Defaults to 1. A positive value selects exactly that page, not a starting offset; see SPEC section 8.
pub page: Option<i32>,
}
/// `Reports` operations, sent through one [`AccountClient`].
#[derive(Debug, Clone, Copy)]
pub struct ReportsService<'a> {
client: &'a AccountClient,
}
impl<'a> ReportsService<'a> {
pub(crate) fn new(client: &'a AccountClient) -> Self {
Self { client }
}
/// The client this service sends through.
pub fn client(&self) -> &'a AccountClient {
self.client
}
/// Get todos assigned to a specific person
///
/// `GET /reports/todos/assigned/{personId}` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn assigned(
&self,
person_id: i64,
params: &GetAssignedTodosParams,
) -> Result<GetAssignedTodosResponseContent, Error> {
let mut operation = self
.client
.operation(&routes::GET_ASSIGNED_TODOS, &[&person_id]);
operation.query_optional("group_by", params.group_by.as_ref());
self.client.send(operation).await
}
/// Get one page of overdue todos grouped by lateness, latest first.
///
/// Pages hold 15, 30, 50, then 100 to-dos, and each page fills the same four
/// groups with only its own to-dos, so a group can continue onto the next
/// page. A `Link: rel="next"` header names the next page and `X-Total-Count`
/// the total. This operation is not auto-paginated in any SDK: the response
/// is an object of four arrays, which no pagination key can name.
///
/// `GET /reports/todos/overdue.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn overdue(
&self,
params: &GetOverdueTodosParams,
) -> Result<GetOverdueTodosResponseContent, Error> {
let mut operation = self.client.operation(&routes::GET_OVERDUE_TODOS, &[]);
operation.query_optional("page", params.page.as_ref());
self.client.send(operation).await
}
/// Get a person's activity timeline
///
/// Each page is the envelope; its `events` member is the collection, which [`AccountClient::collect_all`] and [`AccountClient::items`] gather across pages. The other members are on every page: read them off the first.
///
/// `GET /reports/users/progress/{personId}.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn person_progress(
&self,
person_id: i64,
params: &GetPersonProgressParams,
) -> Result<Page<GetPersonProgressResponseContent>, Error> {
let mut operation = self
.client
.operation(&routes::GET_PERSON_PROGRESS, &[&person_id]);
operation.query_optional("page", params.page.as_ref());
self.client.send_page(operation).await
}
/// Get account-wide activity feed (progress report)
///
/// `GET /reports/progress.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn progress(
&self,
params: &GetProgressReportParams,
) -> Result<Page<GetProgressReportResponseContent>, Error> {
let mut operation = self.client.operation(&routes::GET_PROGRESS_REPORT, &[]);
operation.query_optional("page", params.page.as_ref());
self.client.send_page(operation).await
}
/// Get upcoming schedule entries and assignable items within a date window.
/// This endpoint is preserved as the canonical API path on BC5;
/// the BC5 `/calendar` web view is HTML-only.
///
/// The three arrays carry the report's own reduced projections —
/// UpcomingScheduleEntry and UpcomingAssignable — not the shared ScheduleEntry
/// and Todo/Card shapes. BC3 renders this report through
/// `app/views/api/schedules/calendar/_entry.json.jbuilder` and
/// `_assignable.json.jbuilder`, which emit a narrower key set than the
/// per-resource partials, plus keys those partials never emit. See
/// UpcomingScheduleEntry for the full accounting.
///
/// `GET /reports/schedules/upcoming.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn upcoming(
&self,
window_starts_on: &str,
window_ends_on: &str,
) -> Result<GetUpcomingScheduleResponseContent, Error> {
let mut operation = self.client.operation(&routes::GET_UPCOMING_SCHEDULE, &[]);
operation.query("window_starts_on", window_starts_on);
operation.query("window_ends_on", window_ends_on);
self.client.send(operation).await
}
}