basecamp-sdk 0.38.0

Official client for Basecamp - https://basecamp.com
Documentation
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
// Generated by basecamp-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.

//! Everything 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 `GetEverythingCheckins`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingCheckinsParams {
    /// 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 `GetEverythingComments`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingCommentsParams {
    /// 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 `GetEverythingCompletedCards`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingCompletedCardsParams {
    /// Restrict to tasks assigned to at least one of the given people (repeatable).
    /// Assignees on nested steps are not considered.
    pub assignee_ids: Option<Vec<i64>>,
    /// Filter by due date: with, without, or overdue. Unrecognized values are ignored.
    pub due: Option<String>,
    /// 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 `GetEverythingCompletedTodos`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingCompletedTodosParams {
    /// Restrict to tasks assigned to at least one of the given people (repeatable).
    /// Assignees on nested steps are not considered.
    pub assignee_ids: Option<Vec<i64>>,
    /// Filter by due date: with, without, or overdue. Unrecognized values are ignored.
    pub due: Option<String>,
    /// 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 `GetEverythingFiles`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingFilesParams {
    /// Filter by file kind: all (default), images, pdfs, documents, or videos.
    pub kind: Option<String>,
    /// Restrict to files created by the given people (repeatable).
    pub people_ids: Option<Vec<i64>>,
    /// 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 `GetEverythingForwards`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingForwardsParams {
    /// 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 `GetEverythingMessages`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingMessagesParams {
    /// 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 `GetEverythingNoDueDateCards`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingNoDueDateCardsParams {
    /// Restrict to tasks assigned to at least one of the given people (repeatable).
    /// Assignees on nested steps are not considered.
    pub assignee_ids: Option<Vec<i64>>,
    /// Filter by due date: with, without, or overdue. Unrecognized values are ignored.
    pub due: Option<String>,
    /// 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 `GetEverythingNoDueDateTodos`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingNoDueDateTodosParams {
    /// Restrict to tasks assigned to at least one of the given people (repeatable).
    /// Assignees on nested steps are not considered.
    pub assignee_ids: Option<Vec<i64>>,
    /// Filter by due date: with, without, or overdue. Unrecognized values are ignored.
    pub due: Option<String>,
    /// 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 `GetEverythingNotNowCards`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingNotNowCardsParams {
    /// Restrict to tasks assigned to at least one of the given people (repeatable).
    /// Assignees on nested steps are not considered.
    pub assignee_ids: Option<Vec<i64>>,
    /// Filter by due date: with, without, or overdue. Unrecognized values are ignored.
    pub due: Option<String>,
    /// 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 `GetEverythingOpenCards`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingOpenCardsParams {
    /// Restrict to tasks assigned to at least one of the given people (repeatable).
    /// Assignees on nested steps are not considered.
    pub assignee_ids: Option<Vec<i64>>,
    /// Filter by due date: with, without, or overdue. Unrecognized values are ignored.
    pub due: Option<String>,
    /// 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 `GetEverythingOpenTodos`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingOpenTodosParams {
    /// Restrict to tasks assigned to at least one of the given people (repeatable).
    /// Assignees on nested steps are not considered.
    pub assignee_ids: Option<Vec<i64>>,
    /// Filter by due date: with, without, or overdue. Unrecognized values are ignored.
    pub due: Option<String>,
    /// 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 `GetEverythingOverdueCards`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingOverdueCardsParams {
    /// Restrict to tasks assigned to at least one of the given people (repeatable).
    /// Assignees on nested steps are not considered.
    pub assignee_ids: Option<Vec<i64>>,
    /// Filter by due date: with, without, or overdue. Unrecognized values are ignored.
    pub due: Option<String>,
}

/// Optional query parameters for `GetEverythingOverdueTodos`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingOverdueTodosParams {
    /// Restrict to tasks assigned to at least one of the given people (repeatable).
    /// Assignees on nested steps are not considered.
    pub assignee_ids: Option<Vec<i64>>,
    /// Filter by due date: with, without, or overdue. Unrecognized values are ignored.
    pub due: Option<String>,
}

/// Optional query parameters for `GetEverythingUnassignedCards`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingUnassignedCardsParams {
    /// Restrict to tasks assigned to at least one of the given people (repeatable).
    /// Assignees on nested steps are not considered.
    pub assignee_ids: Option<Vec<i64>>,
    /// Filter by due date: with, without, or overdue. Unrecognized values are ignored.
    pub due: Option<String>,
    /// 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 `GetEverythingUnassignedTodos`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetEverythingUnassignedTodosParams {
    /// Restrict to tasks assigned to at least one of the given people (repeatable).
    /// Assignees on nested steps are not considered.
    pub assignee_ids: Option<Vec<i64>>,
    /// Filter by due date: with, without, or overdue. Unrecognized values are ignored.
    pub due: Option<String>,
    /// 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>,
}

/// `Everything` operations, sent through one [`AccountClient`].
#[derive(Debug, Clone, Copy)]
pub struct EverythingService<'a> {
    client: &'a AccountClient,
}

impl<'a> EverythingService<'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 every automatic check-in answer across all accessible projects, newest-first.
    /// Paginated; each item embeds its `bucket`.
    ///
    /// `GET /checkins.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_checkins(
        &self,
        params: &GetEverythingCheckinsParams,
    ) -> Result<Page<GetEverythingCheckinsResponseContent>, Error> {
        let mut operation = self.client.operation(&routes::GET_EVERYTHING_CHECKINS, &[]);
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Get every comment across all accessible projects, newest-first (paginated).
    /// Each item embeds its `bucket`.
    ///
    /// `GET /comments.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_comments(
        &self,
        params: &GetEverythingCommentsParams,
    ) -> Result<Page<GetEverythingCommentsResponseContent>, Error> {
        let mut operation = self.client.operation(&routes::GET_EVERYTHING_COMMENTS, &[]);
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Completed cards across all accessible projects, grouped by project (paginated).
    ///
    /// `GET /cards/completed.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_completed_cards(
        &self,
        params: &GetEverythingCompletedCardsParams,
    ) -> Result<Page<GetEverythingCompletedCardsResponseContent>, Error> {
        let mut operation = self
            .client
            .operation(&routes::GET_EVERYTHING_COMPLETED_CARDS, &[]);
        operation.query_list_optional("assignee_ids[]", params.assignee_ids.as_deref());
        operation.query_optional("due", params.due.as_ref());
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Completed to-dos across all accessible projects, grouped by project (paginated).
    ///
    /// `GET /todos/completed.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_completed_todos(
        &self,
        params: &GetEverythingCompletedTodosParams,
    ) -> Result<Page<GetEverythingCompletedTodosResponseContent>, Error> {
        let mut operation = self
            .client
            .operation(&routes::GET_EVERYTHING_COMPLETED_TODOS, &[]);
        operation.query_list_optional("assignee_ids[]", params.assignee_ids.as_deref());
        operation.query_optional("due", params.due.as_ref());
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Get every file recording across all accessible projects, newest-first (paginated).
    /// Heterogeneous: uploads and Basecamp documents carry their
    /// standard recording shapes, while rich-text attachments are wrapped in a
    /// recording envelope plus an `attachable_sgid` and blob metadata. Modeled as
    /// an optional-field superset (EverythingFile) so one element type decodes any
    /// variant.
    ///
    /// `GET /files.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_files(
        &self,
        params: &GetEverythingFilesParams,
    ) -> Result<Page<GetEverythingFilesResponseContent>, Error> {
        let mut operation = self.client.operation(&routes::GET_EVERYTHING_FILES, &[]);
        operation.query_optional("kind", params.kind.as_ref());
        operation.query_list_optional("people_ids[]", params.people_ids.as_deref());
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Get every inbox forward across all accessible projects, newest-first (paginated).
    /// Each item embeds its `bucket`.
    ///
    /// `GET /forwards.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_forwards(
        &self,
        params: &GetEverythingForwardsParams,
    ) -> Result<Page<GetEverythingForwardsResponseContent>, Error> {
        let mut operation = self.client.operation(&routes::GET_EVERYTHING_FORWARDS, &[]);
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Get every message across all accessible projects, newest-first (paginated).
    /// Each item embeds its `bucket` for project context.
    ///
    /// `GET /messages.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_messages(
        &self,
        params: &GetEverythingMessagesParams,
    ) -> Result<Page<GetEverythingMessagesResponseContent>, Error> {
        let mut operation = self.client.operation(&routes::GET_EVERYTHING_MESSAGES, &[]);
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Open cards with no due date across all accessible projects, grouped by project (paginated).
    ///
    /// `GET /cards/no_due_date.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_no_due_date_cards(
        &self,
        params: &GetEverythingNoDueDateCardsParams,
    ) -> Result<Page<GetEverythingNoDueDateCardsResponseContent>, Error> {
        let mut operation = self
            .client
            .operation(&routes::GET_EVERYTHING_NO_DUE_DATE_CARDS, &[]);
        operation.query_list_optional("assignee_ids[]", params.assignee_ids.as_deref());
        operation.query_optional("due", params.due.as_ref());
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Open to-dos with no due date across all accessible projects, grouped by project (paginated).
    ///
    /// `GET /todos/no_due_date.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_no_due_date_todos(
        &self,
        params: &GetEverythingNoDueDateTodosParams,
    ) -> Result<Page<GetEverythingNoDueDateTodosResponseContent>, Error> {
        let mut operation = self
            .client
            .operation(&routes::GET_EVERYTHING_NO_DUE_DATE_TODOS, &[]);
        operation.query_list_optional("assignee_ids[]", params.assignee_ids.as_deref());
        operation.query_optional("due", params.due.as_ref());
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Cards parked in a project's "Not now" column across all accessible projects, grouped by project (paginated).
    ///
    /// `GET /cards/not_now.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_not_now_cards(
        &self,
        params: &GetEverythingNotNowCardsParams,
    ) -> Result<Page<GetEverythingNotNowCardsResponseContent>, Error> {
        let mut operation = self
            .client
            .operation(&routes::GET_EVERYTHING_NOT_NOW_CARDS, &[]);
        operation.query_list_optional("assignee_ids[]", params.assignee_ids.as_deref());
        operation.query_optional("due", params.due.as_ref());
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Incomplete cards in active columns across all accessible projects, grouped by project (paginated).
    /// Each bucket entry carries the matching cards and their steps.
    ///
    /// `GET /cards/open.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_open_cards(
        &self,
        params: &GetEverythingOpenCardsParams,
    ) -> Result<Page<GetEverythingOpenCardsResponseContent>, Error> {
        let mut operation = self
            .client
            .operation(&routes::GET_EVERYTHING_OPEN_CARDS, &[]);
        operation.query_list_optional("assignee_ids[]", params.assignee_ids.as_deref());
        operation.query_optional("due", params.due.as_ref());
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Active, incomplete to-dos across all accessible projects, grouped by project (paginated).
    /// Each bucket entry carries the matching to-dos and their steps.
    ///
    /// `GET /todos/open.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_open_todos(
        &self,
        params: &GetEverythingOpenTodosParams,
    ) -> Result<Page<GetEverythingOpenTodosResponseContent>, Error> {
        let mut operation = self
            .client
            .operation(&routes::GET_EVERYTHING_OPEN_TODOS, &[]);
        operation.query_list_optional("assignee_ids[]", params.assignee_ids.as_deref());
        operation.query_optional("due", params.due.as_ref());
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Get every overdue card across all accessible projects, oldest-due-date-first.
    /// A complete, unpaginated array; each item embeds its `bucket`.
    ///
    /// `GET /cards/overdue.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_overdue_cards(
        &self,
        params: &GetEverythingOverdueCardsParams,
    ) -> Result<GetEverythingOverdueCardsResponseContent, Error> {
        let mut operation = self
            .client
            .operation(&routes::GET_EVERYTHING_OVERDUE_CARDS, &[]);
        operation.query_list_optional("assignee_ids[]", params.assignee_ids.as_deref());
        operation.query_optional("due", params.due.as_ref());
        self.client.send(operation).await
    }

    /// Get every overdue to-do across all accessible projects, oldest-due-date-first.
    /// A complete, unpaginated array; each item embeds its `bucket`.
    ///
    /// `GET /todos/overdue.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_overdue_todos(
        &self,
        params: &GetEverythingOverdueTodosParams,
    ) -> Result<GetEverythingOverdueTodosResponseContent, Error> {
        let mut operation = self
            .client
            .operation(&routes::GET_EVERYTHING_OVERDUE_TODOS, &[]);
        operation.query_list_optional("assignee_ids[]", params.assignee_ids.as_deref());
        operation.query_optional("due", params.due.as_ref());
        self.client.send(operation).await
    }

    /// Open, unassigned cards across all accessible projects, grouped by project (paginated).
    ///
    /// `GET /cards/unassigned.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_unassigned_cards(
        &self,
        params: &GetEverythingUnassignedCardsParams,
    ) -> Result<Page<GetEverythingUnassignedCardsResponseContent>, Error> {
        let mut operation = self
            .client
            .operation(&routes::GET_EVERYTHING_UNASSIGNED_CARDS, &[]);
        operation.query_list_optional("assignee_ids[]", params.assignee_ids.as_deref());
        operation.query_optional("due", params.due.as_ref());
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }

    /// Open, unassigned to-dos across all accessible projects, grouped by project (paginated).
    ///
    /// `GET /todos/unassigned.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
    pub async fn everything_unassigned_todos(
        &self,
        params: &GetEverythingUnassignedTodosParams,
    ) -> Result<Page<GetEverythingUnassignedTodosResponseContent>, Error> {
        let mut operation = self
            .client
            .operation(&routes::GET_EVERYTHING_UNASSIGNED_TODOS, &[]);
        operation.query_list_optional("assignee_ids[]", params.assignee_ids.as_deref());
        operation.query_optional("due", params.due.as_ref());
        operation.query_optional("page", params.page.as_ref());
        self.client.send_page(operation).await
    }
}