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
// Generated by basecamp-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.
//! MyAssignments 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::*;
/// Optional query parameters for `GetMyDueAssignments`.
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GetMyDueAssignmentsParams {
/// Filter by due date range: overdue, due_today, due_tomorrow,
/// due_later_this_week, due_next_week, due_later
pub scope: Option<String>,
}
/// `MyAssignments` operations, sent through one [`AccountClient`].
#[derive(Debug, Clone, Copy)]
pub struct MyAssignmentsService<'a> {
client: &'a AccountClient,
}
impl<'a> MyAssignmentsService<'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
}
/// Remove a recording from Up Next (returns 204 No Content). Exact-target:
/// only the priority carried by the identified recording is cleared, and
/// deleting an absent priority is a no-op 204 — so the DELETE is idempotent
/// and safe to retry (BC3 #12483). Address a surfaced card table step by its
/// priority_recording_id, not its parent card's id.
///
/// `DELETE /my/priorities/{recordingId}` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn deprioritize_assignment(&self, recording_id: i64) -> Result<(), Error> {
let operation = self
.client
.operation(&routes::DEPRIORITIZE_ASSIGNMENT, &[&recording_id]);
self.client.send_unit(operation).await
}
/// Get the current user's active assignments grouped into priorities and non_priorities.
/// Card table steps are normalized to their parent card with steps as children.
/// This endpoint is not paginated.
///
/// `GET /my/assignments.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn my_assignments(&self) -> Result<GetMyAssignmentsResponseContent, Error> {
let operation = self.client.operation(&routes::GET_MY_ASSIGNMENTS, &[]);
self.client.send(operation).await
}
/// Get the current user's completed assignments.
/// Archived and trashed recordings are excluded. This endpoint is not paginated.
///
/// `GET /my/assignments/completed.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn my_completed_assignments(
&self,
) -> Result<GetMyCompletedAssignmentsResponseContent, Error> {
let operation = self
.client
.operation(&routes::GET_MY_COMPLETED_ASSIGNMENTS, &[]);
self.client.send(operation).await
}
/// Get the current user's assignments filtered by due date scope.
/// Defaults to overdue when no scope is provided. This endpoint is not paginated.
///
/// `GET /my/assignments/due.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn my_due_assignments(
&self,
params: &GetMyDueAssignmentsParams,
) -> Result<GetMyDueAssignmentsResponseContent, Error> {
let mut operation = self.client.operation(&routes::GET_MY_DUE_ASSIGNMENTS, &[]);
operation.query_optional("scope", params.scope.as_ref());
self.client.send(operation).await
}
/// Add a recording to Up Next — the current user's ordered list of prioritized
/// assignments (the priorities returned by GetMyAssignments). Identify the item
/// by the recording id that carries the priority; for a card table step
/// surfaced under its parent card, that is the entry's priority_recording_id.
/// Idempotent: re-prioritizing an already-prioritized recording is a no-op.
///
/// `POST /my/priorities.json` — idempotent; retries up to 3 attempt(s) on 429, 503.
pub async fn prioritize_assignment(
&self,
body: &PrioritizeAssignmentRequestContent,
) -> Result<(), Error> {
let mut operation = self.client.operation(&routes::PRIORITIZE_ASSIGNMENT, &[]);
operation.json(body)?;
self.client.send_unit(operation).await
}
/// Move an already-prioritized recording to a new 1-based position in Up Next
/// (returns 204 No Content). NOT idempotent: a positional move's meaning
/// shifts as the list changes, so a retry can land the item somewhere else —
/// no retry gating is declared. Errors: 400 for a missing or non-integer
/// position, 422 (flat {error} body) for an out-of-range position or an
/// unprioritized recording, and a bare bodyless 404 for an inaccessible
/// recording.
///
/// `POST /my/priority_moves.json` — not idempotent, sent exactly once.
pub async fn reorder_up_next(&self, body: &ReorderUpNextRequestContent) -> Result<(), Error> {
let mut operation = self.client.operation(&routes::REORDER_UP_NEXT, &[]);
operation.json(body)?;
self.client.send_unit(operation).await
}
}