samsara-api 5.3.1__py3-none-any.whl → 5.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- samsara/__init__.py +6 -0
- samsara/alerts/client.py +4 -0
- samsara/alerts/raw_client.py +4 -0
- samsara/beta_ap_is/client.py +0 -630
- samsara/beta_ap_is/raw_client.py +1496 -3144
- samsara/client.py +38 -0
- samsara/core/client_wrapper.py +2 -2
- samsara/media/client.py +4 -4
- samsara/media/raw_client.py +4 -4
- samsara/training_assignments/__init__.py +4 -0
- samsara/training_assignments/client.py +528 -0
- samsara/training_assignments/raw_client.py +1330 -0
- samsara/training_courses/__init__.py +4 -0
- samsara/training_courses/client.py +168 -0
- samsara/training_courses/raw_client.py +364 -0
- samsara/types/harsh_event_trigger_details_object_request_body_types_item.py +1 -0
- samsara/types/harsh_event_trigger_details_object_response_body_types_item.py +1 -0
- samsara/types/webhook_response_response_body_event_types_item.py +1 -0
- samsara/types/webhooks_get_webhook_response_body_event_types_item.py +1 -0
- samsara/types/webhooks_patch_webhook_response_body_event_types_item.py +1 -0
- samsara/types/webhooks_post_webhooks_response_body_event_types_item.py +1 -0
- samsara/types/workflow_trigger_object_request_body.py +2 -4
- samsara/types/workflow_trigger_object_response_body.py +2 -4
- samsara/webhooks/types/webhooks_post_webhooks_request_body_event_types_item.py +1 -0
- {samsara_api-5.3.1.dist-info → samsara_api-5.4.0.dist-info}/METADATA +1 -1
- {samsara_api-5.3.1.dist-info → samsara_api-5.4.0.dist-info}/RECORD +28 -22
- {samsara_api-5.3.1.dist-info → samsara_api-5.4.0.dist-info}/LICENSE +0 -0
- {samsara_api-5.3.1.dist-info → samsara_api-5.4.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from ..types.training_assignments_get_training_assignments_stream_response_body import (
|
|
8
|
+
TrainingAssignmentsGetTrainingAssignmentsStreamResponseBody,
|
|
9
|
+
)
|
|
10
|
+
from ..types.training_assignments_patch_training_assignments_response_body import (
|
|
11
|
+
TrainingAssignmentsPatchTrainingAssignmentsResponseBody,
|
|
12
|
+
)
|
|
13
|
+
from ..types.training_assignments_post_training_assignments_response_body import (
|
|
14
|
+
TrainingAssignmentsPostTrainingAssignmentsResponseBody,
|
|
15
|
+
)
|
|
16
|
+
from .raw_client import AsyncRawTrainingAssignmentsClient, RawTrainingAssignmentsClient
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class TrainingAssignmentsClient:
|
|
20
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
21
|
+
self._raw_client = RawTrainingAssignmentsClient(client_wrapper=client_wrapper)
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def with_raw_response(self) -> RawTrainingAssignmentsClient:
|
|
25
|
+
"""
|
|
26
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
-------
|
|
30
|
+
RawTrainingAssignmentsClient
|
|
31
|
+
"""
|
|
32
|
+
return self._raw_client
|
|
33
|
+
|
|
34
|
+
def post_training_assignments(
|
|
35
|
+
self,
|
|
36
|
+
*,
|
|
37
|
+
course_id: str,
|
|
38
|
+
due_at_time: str,
|
|
39
|
+
learner_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
40
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
41
|
+
) -> TrainingAssignmentsPostTrainingAssignmentsResponseBody:
|
|
42
|
+
"""
|
|
43
|
+
Create training assignments. Existing assignments will remain unchanged.
|
|
44
|
+
|
|
45
|
+
<b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
46
|
+
|
|
47
|
+
To use this endpoint, select **Write Training Assignments** under the Training Assignments category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
**Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
51
|
+
|
|
52
|
+
Parameters
|
|
53
|
+
----------
|
|
54
|
+
course_id : str
|
|
55
|
+
String for the course ID.
|
|
56
|
+
|
|
57
|
+
due_at_time : str
|
|
58
|
+
Due date of the training assignment in RFC 3339 format. Millisecond precision and timezones are supported.
|
|
59
|
+
|
|
60
|
+
learner_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
61
|
+
Optional string of comma separated learner IDs. If learner ID is present, training assignments for the specified learner(s) will be returned. Max value for this value is 100 objects. Example: `learnerIds=driver-281474,driver-46282156`
|
|
62
|
+
|
|
63
|
+
request_options : typing.Optional[RequestOptions]
|
|
64
|
+
Request-specific configuration.
|
|
65
|
+
|
|
66
|
+
Returns
|
|
67
|
+
-------
|
|
68
|
+
TrainingAssignmentsPostTrainingAssignmentsResponseBody
|
|
69
|
+
OK response.
|
|
70
|
+
|
|
71
|
+
Examples
|
|
72
|
+
--------
|
|
73
|
+
from samsara import Samsara
|
|
74
|
+
|
|
75
|
+
client = Samsara(
|
|
76
|
+
token="YOUR_TOKEN",
|
|
77
|
+
)
|
|
78
|
+
client.training_assignments.post_training_assignments(
|
|
79
|
+
course_id="courseId",
|
|
80
|
+
due_at_time="dueAtTime",
|
|
81
|
+
)
|
|
82
|
+
"""
|
|
83
|
+
_response = self._raw_client.post_training_assignments(
|
|
84
|
+
course_id=course_id, due_at_time=due_at_time, learner_ids=learner_ids, request_options=request_options
|
|
85
|
+
)
|
|
86
|
+
return _response.data
|
|
87
|
+
|
|
88
|
+
def delete_training_assignments(
|
|
89
|
+
self,
|
|
90
|
+
*,
|
|
91
|
+
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
92
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
93
|
+
) -> None:
|
|
94
|
+
"""
|
|
95
|
+
This endpoint supports batch deletion operations. The response does not indicate which specific deletions, if any, have failed. On a successful deletion or partial failure, a ‘204 No Content’ status is returned.
|
|
96
|
+
|
|
97
|
+
<b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
98
|
+
|
|
99
|
+
To use this endpoint, select **Write Training Assignments** under the Training Assignments category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
**Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
103
|
+
|
|
104
|
+
Parameters
|
|
105
|
+
----------
|
|
106
|
+
ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
107
|
+
String of comma separated assignments IDs. Max value for this value is 100 objects. Example: `ids=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
|
|
108
|
+
|
|
109
|
+
request_options : typing.Optional[RequestOptions]
|
|
110
|
+
Request-specific configuration.
|
|
111
|
+
|
|
112
|
+
Returns
|
|
113
|
+
-------
|
|
114
|
+
None
|
|
115
|
+
|
|
116
|
+
Examples
|
|
117
|
+
--------
|
|
118
|
+
from samsara import Samsara
|
|
119
|
+
|
|
120
|
+
client = Samsara(
|
|
121
|
+
token="YOUR_TOKEN",
|
|
122
|
+
)
|
|
123
|
+
client.training_assignments.delete_training_assignments()
|
|
124
|
+
"""
|
|
125
|
+
_response = self._raw_client.delete_training_assignments(ids=ids, request_options=request_options)
|
|
126
|
+
return _response.data
|
|
127
|
+
|
|
128
|
+
def patch_training_assignments(
|
|
129
|
+
self,
|
|
130
|
+
*,
|
|
131
|
+
due_at_time: str,
|
|
132
|
+
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
133
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
134
|
+
) -> TrainingAssignmentsPatchTrainingAssignmentsResponseBody:
|
|
135
|
+
"""
|
|
136
|
+
Update training assignments.
|
|
137
|
+
|
|
138
|
+
<b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
139
|
+
|
|
140
|
+
To use this endpoint, select **Write Training Assignments** under the Training Assignments category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
**Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
144
|
+
|
|
145
|
+
Parameters
|
|
146
|
+
----------
|
|
147
|
+
due_at_time : str
|
|
148
|
+
Due date of the training assignment in RFC 3339 format. Millisecond precision and timezones are supported.
|
|
149
|
+
|
|
150
|
+
ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
151
|
+
String of comma separated assignments IDs. Max value for this value is 100 objects. Example: `ids=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
|
|
152
|
+
|
|
153
|
+
request_options : typing.Optional[RequestOptions]
|
|
154
|
+
Request-specific configuration.
|
|
155
|
+
|
|
156
|
+
Returns
|
|
157
|
+
-------
|
|
158
|
+
TrainingAssignmentsPatchTrainingAssignmentsResponseBody
|
|
159
|
+
OK response.
|
|
160
|
+
|
|
161
|
+
Examples
|
|
162
|
+
--------
|
|
163
|
+
from samsara import Samsara
|
|
164
|
+
|
|
165
|
+
client = Samsara(
|
|
166
|
+
token="YOUR_TOKEN",
|
|
167
|
+
)
|
|
168
|
+
client.training_assignments.patch_training_assignments(
|
|
169
|
+
due_at_time="dueAtTime",
|
|
170
|
+
)
|
|
171
|
+
"""
|
|
172
|
+
_response = self._raw_client.patch_training_assignments(
|
|
173
|
+
due_at_time=due_at_time, ids=ids, request_options=request_options
|
|
174
|
+
)
|
|
175
|
+
return _response.data
|
|
176
|
+
|
|
177
|
+
def get_training_assignments_stream(
|
|
178
|
+
self,
|
|
179
|
+
*,
|
|
180
|
+
start_time: str,
|
|
181
|
+
after: typing.Optional[str] = None,
|
|
182
|
+
end_time: typing.Optional[str] = None,
|
|
183
|
+
learner_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
184
|
+
course_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
185
|
+
status: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
186
|
+
is_overdue: typing.Optional[bool] = None,
|
|
187
|
+
category_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
188
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
189
|
+
) -> TrainingAssignmentsGetTrainingAssignmentsStreamResponseBody:
|
|
190
|
+
"""
|
|
191
|
+
Returns all training assignments data that has been created or modified for your organization based on the time parameters passed in. Results are paginated and are sorted by last modified date. If you include an endTime, the endpoint will return data up until that point (exclusive). If you don't include an endTime, the API will continue to poll with the pagination cursor that gets returned on every call. The hasNextPage response value will be true if there is no endTime specified and endCursor is nonempty.
|
|
192
|
+
|
|
193
|
+
<b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
194
|
+
|
|
195
|
+
To use this endpoint, select **Read Training Assignments** under the Training Assignments category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
**Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
199
|
+
|
|
200
|
+
Parameters
|
|
201
|
+
----------
|
|
202
|
+
start_time : str
|
|
203
|
+
A start time in RFC 3339 format. Defaults to now if not provided. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00).
|
|
204
|
+
|
|
205
|
+
after : typing.Optional[str]
|
|
206
|
+
If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results.
|
|
207
|
+
|
|
208
|
+
end_time : typing.Optional[str]
|
|
209
|
+
An end time in RFC 3339 format. Defaults to now if not provided. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00).
|
|
210
|
+
|
|
211
|
+
learner_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
212
|
+
Optional string of comma separated learner IDs. If learner ID is present, training assignments for the specified learner(s) will be returned. Max value for this value is 100 objects. Example: `learnerIds=driver-281474,driver-46282156`
|
|
213
|
+
|
|
214
|
+
course_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
215
|
+
Optional string of comma separated course IDs. If course ID is present, training assignments for the specified course ID(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses. Example: `courseIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
|
|
216
|
+
|
|
217
|
+
status : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
218
|
+
Optional string of comma separated values. If status is present, training assignments for the specified status(s) will be returned. Valid values: "notStarted", "inProgress", "completed". Defaults to returning all courses.
|
|
219
|
+
|
|
220
|
+
is_overdue : typing.Optional[bool]
|
|
221
|
+
Optional boolean value. If present, training assignments for the specified overdue status will be returned. Valid values: true, false. Defaults to returning all assignments.
|
|
222
|
+
|
|
223
|
+
category_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
224
|
+
Optional string of comma separated category IDs. If category ID is present, training assignments for the specified category ID(s) will be returned. Max value for this value is 100 objects. Example: `categoryIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
|
|
225
|
+
|
|
226
|
+
request_options : typing.Optional[RequestOptions]
|
|
227
|
+
Request-specific configuration.
|
|
228
|
+
|
|
229
|
+
Returns
|
|
230
|
+
-------
|
|
231
|
+
TrainingAssignmentsGetTrainingAssignmentsStreamResponseBody
|
|
232
|
+
OK response.
|
|
233
|
+
|
|
234
|
+
Examples
|
|
235
|
+
--------
|
|
236
|
+
from samsara import Samsara
|
|
237
|
+
|
|
238
|
+
client = Samsara(
|
|
239
|
+
token="YOUR_TOKEN",
|
|
240
|
+
)
|
|
241
|
+
client.training_assignments.get_training_assignments_stream(
|
|
242
|
+
start_time="startTime",
|
|
243
|
+
)
|
|
244
|
+
"""
|
|
245
|
+
_response = self._raw_client.get_training_assignments_stream(
|
|
246
|
+
start_time=start_time,
|
|
247
|
+
after=after,
|
|
248
|
+
end_time=end_time,
|
|
249
|
+
learner_ids=learner_ids,
|
|
250
|
+
course_ids=course_ids,
|
|
251
|
+
status=status,
|
|
252
|
+
is_overdue=is_overdue,
|
|
253
|
+
category_ids=category_ids,
|
|
254
|
+
request_options=request_options,
|
|
255
|
+
)
|
|
256
|
+
return _response.data
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
class AsyncTrainingAssignmentsClient:
|
|
260
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
261
|
+
self._raw_client = AsyncRawTrainingAssignmentsClient(client_wrapper=client_wrapper)
|
|
262
|
+
|
|
263
|
+
@property
|
|
264
|
+
def with_raw_response(self) -> AsyncRawTrainingAssignmentsClient:
|
|
265
|
+
"""
|
|
266
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
267
|
+
|
|
268
|
+
Returns
|
|
269
|
+
-------
|
|
270
|
+
AsyncRawTrainingAssignmentsClient
|
|
271
|
+
"""
|
|
272
|
+
return self._raw_client
|
|
273
|
+
|
|
274
|
+
async def post_training_assignments(
|
|
275
|
+
self,
|
|
276
|
+
*,
|
|
277
|
+
course_id: str,
|
|
278
|
+
due_at_time: str,
|
|
279
|
+
learner_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
280
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
281
|
+
) -> TrainingAssignmentsPostTrainingAssignmentsResponseBody:
|
|
282
|
+
"""
|
|
283
|
+
Create training assignments. Existing assignments will remain unchanged.
|
|
284
|
+
|
|
285
|
+
<b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
286
|
+
|
|
287
|
+
To use this endpoint, select **Write Training Assignments** under the Training Assignments category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
**Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
291
|
+
|
|
292
|
+
Parameters
|
|
293
|
+
----------
|
|
294
|
+
course_id : str
|
|
295
|
+
String for the course ID.
|
|
296
|
+
|
|
297
|
+
due_at_time : str
|
|
298
|
+
Due date of the training assignment in RFC 3339 format. Millisecond precision and timezones are supported.
|
|
299
|
+
|
|
300
|
+
learner_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
301
|
+
Optional string of comma separated learner IDs. If learner ID is present, training assignments for the specified learner(s) will be returned. Max value for this value is 100 objects. Example: `learnerIds=driver-281474,driver-46282156`
|
|
302
|
+
|
|
303
|
+
request_options : typing.Optional[RequestOptions]
|
|
304
|
+
Request-specific configuration.
|
|
305
|
+
|
|
306
|
+
Returns
|
|
307
|
+
-------
|
|
308
|
+
TrainingAssignmentsPostTrainingAssignmentsResponseBody
|
|
309
|
+
OK response.
|
|
310
|
+
|
|
311
|
+
Examples
|
|
312
|
+
--------
|
|
313
|
+
import asyncio
|
|
314
|
+
|
|
315
|
+
from samsara import AsyncSamsara
|
|
316
|
+
|
|
317
|
+
client = AsyncSamsara(
|
|
318
|
+
token="YOUR_TOKEN",
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
async def main() -> None:
|
|
323
|
+
await client.training_assignments.post_training_assignments(
|
|
324
|
+
course_id="courseId",
|
|
325
|
+
due_at_time="dueAtTime",
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
asyncio.run(main())
|
|
330
|
+
"""
|
|
331
|
+
_response = await self._raw_client.post_training_assignments(
|
|
332
|
+
course_id=course_id, due_at_time=due_at_time, learner_ids=learner_ids, request_options=request_options
|
|
333
|
+
)
|
|
334
|
+
return _response.data
|
|
335
|
+
|
|
336
|
+
async def delete_training_assignments(
|
|
337
|
+
self,
|
|
338
|
+
*,
|
|
339
|
+
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
340
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
341
|
+
) -> None:
|
|
342
|
+
"""
|
|
343
|
+
This endpoint supports batch deletion operations. The response does not indicate which specific deletions, if any, have failed. On a successful deletion or partial failure, a ‘204 No Content’ status is returned.
|
|
344
|
+
|
|
345
|
+
<b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
346
|
+
|
|
347
|
+
To use this endpoint, select **Write Training Assignments** under the Training Assignments category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
**Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
351
|
+
|
|
352
|
+
Parameters
|
|
353
|
+
----------
|
|
354
|
+
ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
355
|
+
String of comma separated assignments IDs. Max value for this value is 100 objects. Example: `ids=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
|
|
356
|
+
|
|
357
|
+
request_options : typing.Optional[RequestOptions]
|
|
358
|
+
Request-specific configuration.
|
|
359
|
+
|
|
360
|
+
Returns
|
|
361
|
+
-------
|
|
362
|
+
None
|
|
363
|
+
|
|
364
|
+
Examples
|
|
365
|
+
--------
|
|
366
|
+
import asyncio
|
|
367
|
+
|
|
368
|
+
from samsara import AsyncSamsara
|
|
369
|
+
|
|
370
|
+
client = AsyncSamsara(
|
|
371
|
+
token="YOUR_TOKEN",
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
async def main() -> None:
|
|
376
|
+
await client.training_assignments.delete_training_assignments()
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
asyncio.run(main())
|
|
380
|
+
"""
|
|
381
|
+
_response = await self._raw_client.delete_training_assignments(ids=ids, request_options=request_options)
|
|
382
|
+
return _response.data
|
|
383
|
+
|
|
384
|
+
async def patch_training_assignments(
|
|
385
|
+
self,
|
|
386
|
+
*,
|
|
387
|
+
due_at_time: str,
|
|
388
|
+
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
389
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
390
|
+
) -> TrainingAssignmentsPatchTrainingAssignmentsResponseBody:
|
|
391
|
+
"""
|
|
392
|
+
Update training assignments.
|
|
393
|
+
|
|
394
|
+
<b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
395
|
+
|
|
396
|
+
To use this endpoint, select **Write Training Assignments** under the Training Assignments category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
**Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
400
|
+
|
|
401
|
+
Parameters
|
|
402
|
+
----------
|
|
403
|
+
due_at_time : str
|
|
404
|
+
Due date of the training assignment in RFC 3339 format. Millisecond precision and timezones are supported.
|
|
405
|
+
|
|
406
|
+
ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
407
|
+
String of comma separated assignments IDs. Max value for this value is 100 objects. Example: `ids=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
|
|
408
|
+
|
|
409
|
+
request_options : typing.Optional[RequestOptions]
|
|
410
|
+
Request-specific configuration.
|
|
411
|
+
|
|
412
|
+
Returns
|
|
413
|
+
-------
|
|
414
|
+
TrainingAssignmentsPatchTrainingAssignmentsResponseBody
|
|
415
|
+
OK response.
|
|
416
|
+
|
|
417
|
+
Examples
|
|
418
|
+
--------
|
|
419
|
+
import asyncio
|
|
420
|
+
|
|
421
|
+
from samsara import AsyncSamsara
|
|
422
|
+
|
|
423
|
+
client = AsyncSamsara(
|
|
424
|
+
token="YOUR_TOKEN",
|
|
425
|
+
)
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
async def main() -> None:
|
|
429
|
+
await client.training_assignments.patch_training_assignments(
|
|
430
|
+
due_at_time="dueAtTime",
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
asyncio.run(main())
|
|
435
|
+
"""
|
|
436
|
+
_response = await self._raw_client.patch_training_assignments(
|
|
437
|
+
due_at_time=due_at_time, ids=ids, request_options=request_options
|
|
438
|
+
)
|
|
439
|
+
return _response.data
|
|
440
|
+
|
|
441
|
+
async def get_training_assignments_stream(
|
|
442
|
+
self,
|
|
443
|
+
*,
|
|
444
|
+
start_time: str,
|
|
445
|
+
after: typing.Optional[str] = None,
|
|
446
|
+
end_time: typing.Optional[str] = None,
|
|
447
|
+
learner_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
448
|
+
course_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
449
|
+
status: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
450
|
+
is_overdue: typing.Optional[bool] = None,
|
|
451
|
+
category_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
452
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
453
|
+
) -> TrainingAssignmentsGetTrainingAssignmentsStreamResponseBody:
|
|
454
|
+
"""
|
|
455
|
+
Returns all training assignments data that has been created or modified for your organization based on the time parameters passed in. Results are paginated and are sorted by last modified date. If you include an endTime, the endpoint will return data up until that point (exclusive). If you don't include an endTime, the API will continue to poll with the pagination cursor that gets returned on every call. The hasNextPage response value will be true if there is no endTime specified and endCursor is nonempty.
|
|
456
|
+
|
|
457
|
+
<b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
458
|
+
|
|
459
|
+
To use this endpoint, select **Read Training Assignments** under the Training Assignments category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
**Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
463
|
+
|
|
464
|
+
Parameters
|
|
465
|
+
----------
|
|
466
|
+
start_time : str
|
|
467
|
+
A start time in RFC 3339 format. Defaults to now if not provided. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00).
|
|
468
|
+
|
|
469
|
+
after : typing.Optional[str]
|
|
470
|
+
If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results.
|
|
471
|
+
|
|
472
|
+
end_time : typing.Optional[str]
|
|
473
|
+
An end time in RFC 3339 format. Defaults to now if not provided. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00).
|
|
474
|
+
|
|
475
|
+
learner_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
476
|
+
Optional string of comma separated learner IDs. If learner ID is present, training assignments for the specified learner(s) will be returned. Max value for this value is 100 objects. Example: `learnerIds=driver-281474,driver-46282156`
|
|
477
|
+
|
|
478
|
+
course_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
479
|
+
Optional string of comma separated course IDs. If course ID is present, training assignments for the specified course ID(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses. Example: `courseIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
|
|
480
|
+
|
|
481
|
+
status : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
482
|
+
Optional string of comma separated values. If status is present, training assignments for the specified status(s) will be returned. Valid values: "notStarted", "inProgress", "completed". Defaults to returning all courses.
|
|
483
|
+
|
|
484
|
+
is_overdue : typing.Optional[bool]
|
|
485
|
+
Optional boolean value. If present, training assignments for the specified overdue status will be returned. Valid values: true, false. Defaults to returning all assignments.
|
|
486
|
+
|
|
487
|
+
category_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
488
|
+
Optional string of comma separated category IDs. If category ID is present, training assignments for the specified category ID(s) will be returned. Max value for this value is 100 objects. Example: `categoryIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
|
|
489
|
+
|
|
490
|
+
request_options : typing.Optional[RequestOptions]
|
|
491
|
+
Request-specific configuration.
|
|
492
|
+
|
|
493
|
+
Returns
|
|
494
|
+
-------
|
|
495
|
+
TrainingAssignmentsGetTrainingAssignmentsStreamResponseBody
|
|
496
|
+
OK response.
|
|
497
|
+
|
|
498
|
+
Examples
|
|
499
|
+
--------
|
|
500
|
+
import asyncio
|
|
501
|
+
|
|
502
|
+
from samsara import AsyncSamsara
|
|
503
|
+
|
|
504
|
+
client = AsyncSamsara(
|
|
505
|
+
token="YOUR_TOKEN",
|
|
506
|
+
)
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
async def main() -> None:
|
|
510
|
+
await client.training_assignments.get_training_assignments_stream(
|
|
511
|
+
start_time="startTime",
|
|
512
|
+
)
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
asyncio.run(main())
|
|
516
|
+
"""
|
|
517
|
+
_response = await self._raw_client.get_training_assignments_stream(
|
|
518
|
+
start_time=start_time,
|
|
519
|
+
after=after,
|
|
520
|
+
end_time=end_time,
|
|
521
|
+
learner_ids=learner_ids,
|
|
522
|
+
course_ids=course_ids,
|
|
523
|
+
status=status,
|
|
524
|
+
is_overdue=is_overdue,
|
|
525
|
+
category_ids=category_ids,
|
|
526
|
+
request_options=request_options,
|
|
527
|
+
)
|
|
528
|
+
return _response.data
|