sg-python-api 0.1.1__py3-none-any.whl → 0.2.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.
Files changed (56) hide show
  1. {sg_python_api-0.1.1.dist-info → sg_python_api-0.2.0.dist-info}/METADATA +21 -24
  2. sg_python_api-0.2.0.dist-info/RECORD +58 -0
  3. shotgun_api3/__init__.py +4 -0
  4. shotgun_api3/_async_client.py +404 -316
  5. shotgun_api3/_async_driver.py +25 -55
  6. shotgun_api3/_async_httpx2.py +92 -59
  7. shotgun_api3/_async_transport.py +38 -3
  8. shotgun_api3/_capabilities.py +4 -3
  9. shotgun_api3/_client.py +354 -462
  10. shotgun_api3/_config.py +245 -120
  11. shotgun_api3/_connections.py +144 -0
  12. shotgun_api3/_crud.py +25 -250
  13. shotgun_api3/_driver.py +29 -54
  14. shotgun_api3/_execution.py +1 -3
  15. shotgun_api3/_files.py +215 -123
  16. shotgun_api3/_methods.py +153 -412
  17. shotgun_api3/_protocol.py +27 -146
  18. shotgun_api3/_transport.py +82 -407
  19. shotgun_api3/_version.py +7 -2
  20. shotgun_api3/lib/mockgun/__init__.py +20 -7
  21. shotgun_api3/lib/mockgun/_activity.py +510 -0
  22. shotgun_api3/lib/mockgun/_async_client.py +196 -0
  23. shotgun_api3/lib/mockgun/_dates.py +164 -0
  24. shotgun_api3/lib/mockgun/_errors.py +18 -0
  25. shotgun_api3/lib/mockgun/_events.py +1031 -0
  26. shotgun_api3/lib/mockgun/_follows.py +217 -0
  27. shotgun_api3/lib/mockgun/_handlers.py +558 -0
  28. shotgun_api3/lib/mockgun/_links.py +440 -0
  29. shotgun_api3/lib/mockgun/_new_client.py +92 -0
  30. shotgun_api3/lib/mockgun/_presets.py +492 -0
  31. shotgun_api3/lib/mockgun/_query.py +2163 -0
  32. shotgun_api3/lib/mockgun/_retirement.py +368 -0
  33. shotgun_api3/lib/mockgun/_schema.py +172 -0
  34. shotgun_api3/lib/mockgun/_schema_writes.py +425 -0
  35. shotgun_api3/lib/mockgun/_search.py +378 -0
  36. shotgun_api3/lib/mockgun/_server.py +169 -0
  37. shotgun_api3/lib/mockgun/_sessions.py +206 -0
  38. shotgun_api3/lib/mockgun/_site.py +150 -0
  39. shotgun_api3/lib/mockgun/_site_data.py +584 -0
  40. shotgun_api3/lib/mockgun/_storage.py +208 -0
  41. shotgun_api3/lib/mockgun/_store.py +1446 -0
  42. shotgun_api3/lib/mockgun/_summaries.py +964 -0
  43. shotgun_api3/lib/mockgun/_sync_client.py +190 -0
  44. shotgun_api3/lib/mockgun/_threads.py +226 -0
  45. shotgun_api3/lib/mockgun/_thumbnails.py +146 -0
  46. shotgun_api3/lib/mockgun/_transport.py +145 -0
  47. shotgun_api3/lib/mockgun/_uploads.py +417 -0
  48. shotgun_api3/lib/mockgun/_wire.py +120 -0
  49. shotgun_api3/lib/mockgun/mockgun.py +14 -0
  50. shotgun_api3/lib/sgtimezone.py +24 -1
  51. sg_python_api-0.1.1.dist-info/RECORD +0 -31
  52. shotgun_api3/_signatures.py +0 -53
  53. shotgun_api3/lib/mockgun/_async.py +0 -315
  54. shotgun_api3/lib/mockgun/_mockgun.py +0 -1666
  55. {sg_python_api-0.1.1.dist-info → sg_python_api-0.2.0.dist-info}/WHEEL +0 -0
  56. {sg_python_api-0.1.1.dist-info → sg_python_api-0.2.0.dist-info}/licenses/LICENSE +0 -0
shotgun_api3/_methods.py CHANGED
@@ -2,242 +2,27 @@
2
2
 
3
3
  import dataclasses
4
4
  import datetime
5
- import inspect
6
- from collections.abc import Callable
7
- from typing import Any, NotRequired, TypedDict, cast
5
+ from collections.abc import Mapping
6
+ from typing import cast
8
7
 
9
8
  from . import _crud, _protocol
10
9
  from ._errors import ShotgunError
11
- from ._signatures import bind_arguments, expose_signature
12
-
13
- _ACTIVITY_STREAM_READ_DOCSTRING = """Read the activity stream for one entity.
14
-
15
- Args:
16
- entity_type: Entity type whose activity stream to read.
17
- entity_id: Numeric identifier of the entity.
18
- entity_fields: Optional fields to return for linked entity types.
19
- min_id: Optional minimum activity identifier.
20
- max_id: Optional maximum activity identifier.
21
- limit: Optional maximum number of activity records.
22
-
23
- Returns:
24
- Activity stream data returned by the server.
25
-
26
- Raises:
27
- TypeError: If arguments do not match the documented signature.
28
- ShotgunError: If an RPC fault or terminal transport failure
29
- occurs, or if the server result has the wrong type.
30
- ProtocolError: If a server request returns an HTTP error.
31
- ValueError: If authenticated HTTP violates the configured origin policy.
32
- """
33
- _ACTIVITY_STREAM_READ_PARAMETERS = (
34
- inspect.Parameter('entity_type', inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=str),
35
- inspect.Parameter('entity_id', inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=int),
36
- inspect.Parameter(
37
- 'entity_fields',
38
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
39
- default=None,
40
- annotation=dict[str, list[str]] | None,
41
- ),
42
- inspect.Parameter(
43
- 'min_id',
44
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
45
- default=None,
46
- annotation=int | None,
47
- ),
48
- inspect.Parameter(
49
- 'max_id',
50
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
51
- default=None,
52
- annotation=int | None,
53
- ),
54
- inspect.Parameter(
55
- 'limit',
56
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
57
- default=None,
58
- annotation=int | None,
59
- ),
60
- )
61
- _ACTIVITY_STREAM_READ_SIGNATURE = inspect.Signature(
62
- _ACTIVITY_STREAM_READ_PARAMETERS,
63
- return_annotation=dict[str, object],
64
- )
65
- _EXPORT_PAGE_DOCSTRING = """Export a page using the documented arguments.
66
-
67
- Args:
68
- page_id: Numeric page identifier.
69
- format: Required nonempty export format name.
70
- layout_name: Optional layout name, including an empty name.
71
-
72
- Returns:
73
- Exported page text returned by the server.
74
-
75
- Raises:
76
- TypeError: If arguments do not match the documented signature.
77
- ShotgunError: If an RPC fault or terminal transport failure
78
- occurs, or if `page_id`, `format`, or the server result is invalid.
79
- ProtocolError: If a server request returns an HTTP error.
80
- ValueError: If authenticated HTTP violates the configured origin policy.
81
- """
82
- _EXPORT_PAGE_PARAMETERS = (
83
- inspect.Parameter('page_id', inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=int),
84
- inspect.Parameter('format', inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=str),
85
- inspect.Parameter(
86
- 'layout_name',
87
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
88
- default=None,
89
- annotation=str | None,
90
- ),
91
- )
92
- _EXPORT_PAGE_SIGNATURE = inspect.Signature(
93
- _EXPORT_PAGE_PARAMETERS,
94
- return_annotation=str,
95
- )
96
- _METHOD_ACTIVITY_STREAM_READ_SIGNATURE = inspect.Signature(
97
- (
98
- inspect.Parameter('self', inspect.Parameter.POSITIONAL_OR_KEYWORD),
99
- *_ACTIVITY_STREAM_READ_PARAMETERS,
100
- ),
101
- return_annotation=dict[str, object],
102
- )
103
- _METHOD_EXPORT_PAGE_SIGNATURE = inspect.Signature(
104
- (
105
- inspect.Parameter('self', inspect.Parameter.POSITIONAL_OR_KEYWORD),
106
- *_EXPORT_PAGE_PARAMETERS,
107
- ),
108
- return_annotation=str,
109
- )
10
+
110
11
  _SCHEDULE_DATE_LENGTH = 10
111
- _SUMMARIZE_DOCSTRING = """Summarize field data returned by a query.
112
-
113
- Args:
114
- entity_type: Entity type to summarize.
115
- filters: Filters in list or dict syntax.
116
- summary_fields: List of `{'field': ..., 'type': ...}` summaries.
117
- filter_operator: `'all'` or `'any'` for list-syntax filters.
118
- grouping: Optional grouping specs.
119
- include_archived_projects: Include archived projects when `True`.
120
-
121
- Returns:
122
- Dict with `summaries` and (when grouped) `groups`.
123
-
124
- Raises:
125
- TypeError: If arguments do not match the documented signature.
126
- ShotgunError: If an RPC fault or terminal transport failure
127
- occurs, or if `filters`, `summary_fields`, or the server result has the
128
- wrong type.
129
- ProtocolError: If a server request returns an HTTP error.
130
- ValueError: If authenticated HTTP violates the configured origin policy.
131
- """
132
- _SUMMARIZE_PARAMETERS = (
133
- inspect.Parameter('entity_type', inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=str),
134
- inspect.Parameter(
135
- 'filters',
136
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
137
- annotation=list[Any] | tuple[Any, ...] | dict[str, Any],
138
- ),
139
- inspect.Parameter(
140
- 'summary_fields',
141
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
142
- annotation=list[dict[str, Any]],
143
- ),
144
- inspect.Parameter(
145
- 'filter_operator',
146
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
147
- default=None,
148
- annotation=str | None,
149
- ),
150
- inspect.Parameter(
151
- 'grouping',
152
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
153
- default=None,
154
- annotation=list[dict[str, Any]] | None,
155
- ),
156
- inspect.Parameter(
157
- 'include_archived_projects',
158
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
159
- default=True,
160
- annotation=bool,
161
- ),
162
- )
163
- _METHOD_SUMMARIZE_SIGNATURE = inspect.Signature(
164
- (
165
- inspect.Parameter('self', inspect.Parameter.POSITIONAL_OR_KEYWORD),
166
- *_SUMMARIZE_PARAMETERS,
167
- ),
168
- return_annotation=dict[str, object],
169
- )
170
- _SUMMARIZE_SIGNATURE = inspect.Signature(
171
- _SUMMARIZE_PARAMETERS,
172
- return_annotation=dict[str, object],
173
- )
174
- _WORK_SCHEDULE_UPDATE_DOCSTRING = """Update a work schedule.
175
-
176
- Args:
177
- date: Date or exact `YYYY-MM-DD` string to update.
178
- working: Whether the date is a working day.
179
- description: Optional schedule description.
180
- project: Optional project entity restriction.
181
- user: Optional user entity restriction.
182
- recalculate_field: Optional field to recalculate.
183
-
184
- Returns:
185
- Updated work schedule data returned by the server.
186
-
187
- Raises:
188
- TypeError: If arguments do not match the documented signature.
189
- ShotgunError: If an RPC fault or terminal transport failure
190
- occurs, or if the date, project/user exclusivity, or server result is
191
- invalid.
192
- ProtocolError: If a server request returns an HTTP error.
193
- ValueError: If authenticated HTTP violates the configured origin policy.
194
- """
195
- _WORK_SCHEDULE_UPDATE_PARAMETERS = (
196
- inspect.Parameter(
197
- 'date', inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=datetime.date | str
198
- ),
199
- inspect.Parameter('working', inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=bool),
200
- inspect.Parameter(
201
- 'description',
202
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
203
- default=None,
204
- annotation=str | None,
205
- ),
206
- inspect.Parameter(
207
- 'project',
208
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
209
- default=None,
210
- annotation=dict[str, Any] | None,
211
- ),
212
- inspect.Parameter(
213
- 'user',
214
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
215
- default=None,
216
- annotation=dict[str, Any] | None,
217
- ),
218
- inspect.Parameter(
219
- 'recalculate_field',
220
- inspect.Parameter.POSITIONAL_OR_KEYWORD,
221
- default=None,
222
- annotation=str | None,
223
- ),
224
- )
225
- _METHOD_WORK_SCHEDULE_UPDATE_SIGNATURE = inspect.Signature(
226
- (
227
- inspect.Parameter('self', inspect.Parameter.POSITIONAL_OR_KEYWORD),
228
- *_WORK_SCHEDULE_UPDATE_PARAMETERS,
229
- ),
230
- return_annotation=dict[str, object],
231
- )
232
- _WORK_SCHEDULE_UPDATE_SIGNATURE = inspect.Signature(
233
- _WORK_SCHEDULE_UPDATE_PARAMETERS,
234
- return_annotation=dict[str, object],
235
- )
236
12
 
237
13
 
238
14
  @dataclasses.dataclass(frozen=True)
239
- class _ActivityStreamReadOptions:
240
- """Collect exact public activity stream arguments for validation."""
15
+ class ActivityStreamReadOptions:
16
+ """Collect exact public activity stream arguments for validation.
17
+
18
+ Attributes:
19
+ entity_type: Entity type whose activity stream to read.
20
+ entity_id: Numeric identifier of the entity.
21
+ entity_fields: Optional fields to return for linked entity types.
22
+ min_id: Optional minimum activity identifier.
23
+ max_id: Optional maximum activity identifier.
24
+ limit: Optional maximum number of activity records.
25
+ """
241
26
 
242
27
  entity_type: str
243
28
  entity_id: int
@@ -255,30 +40,33 @@ class _AuthenticationPlan:
255
40
  params: dict[str, object]
256
41
 
257
42
 
258
- class ExportPageKeywordArguments(TypedDict):
259
- """Describe supported keyword calls to `export_page`.
43
+ @dataclasses.dataclass(frozen=True)
44
+ class ExportPageOptions:
45
+ """Collect exact public export-page arguments for validation.
260
46
 
261
47
  Attributes:
262
- format: Required nonempty export format.
263
- layout_name: Optional page layout name.
48
+ page_id: Numeric page identifier.
49
+ format: Required nonempty export format name.
50
+ layout_name: Optional layout name, including an empty name.
264
51
  """
265
52
 
266
- format: str
267
- layout_name: NotRequired[str | None]
268
-
269
-
270
- @dataclasses.dataclass(frozen=True)
271
- class _ExportPageOptions:
272
- """Collect exact public export-page arguments for validation."""
273
-
274
53
  page_id: int
275
54
  format: str
276
55
  layout_name: str | None = None
277
56
 
278
57
 
279
58
  @dataclasses.dataclass(frozen=True)
280
- class _SummarizeOptions:
281
- """Collect exact public `summarize` arguments for runtime validation."""
59
+ class SummarizeOptions:
60
+ """Collect exact public `summarize` arguments for runtime validation.
61
+
62
+ Attributes:
63
+ entity_type: Entity type to summarize.
64
+ filters: Filters in list or dict syntax.
65
+ summary_fields: List of `{'field': ..., 'type': ...}` summaries.
66
+ filter_operator: `'all'` or `'any'` for list-syntax filters.
67
+ grouping: Optional grouping specs.
68
+ include_archived_projects: Include archived projects when `True`.
69
+ """
282
70
 
283
71
  entity_type: str
284
72
  filters: object
@@ -289,8 +77,17 @@ class _SummarizeOptions:
289
77
 
290
78
 
291
79
  @dataclasses.dataclass(frozen=True)
292
- class _WorkScheduleUpdateOptions:
293
- """Collect exact public work-schedule update arguments for validation."""
80
+ class WorkScheduleUpdateOptions:
81
+ """Collect exact public work-schedule update arguments for validation.
82
+
83
+ Attributes:
84
+ date: Date or exact `YYYY-MM-DD` string to update.
85
+ working: Whether the date is a working day.
86
+ description: Optional schedule description.
87
+ project: Optional project entity restriction.
88
+ user: Optional user entity restriction.
89
+ recalculate_field: Optional field to recalculate.
90
+ """
294
91
 
295
92
  date: object
296
93
  working: bool
@@ -328,6 +125,18 @@ def _entity(value: object) -> object:
328
125
  return _protocol.optimize_entity(value)
329
126
 
330
127
 
128
+ def _is_subscription_value(value: object) -> bool:
129
+ """Check the supported subscription value forms."""
130
+ return (
131
+ value is None
132
+ or isinstance(value, str)
133
+ or (
134
+ isinstance(value, list)
135
+ and all(isinstance(item, str) for item in cast('list[object]', value))
136
+ )
137
+ )
138
+
139
+
331
140
  def _project_entity(value: object) -> object:
332
141
  """Optimize an optional project entity."""
333
142
  return None if value is None else _entity(value)
@@ -354,103 +163,7 @@ def _require_nonempty_string(value: object, message: str) -> str:
354
163
  return value
355
164
 
356
165
 
357
- def bind_activity_stream_read(
358
- args: tuple[object, ...],
359
- kwargs: dict[str, object],
360
- owner_name: str,
361
- ) -> _ActivityStreamReadOptions:
362
- """Bind runtime activity-stream arguments.
363
-
364
- Args:
365
- args: Positional arguments supplied by the caller.
366
- kwargs: Keyword arguments supplied by the caller.
367
- owner_name: Public client class name used in errors.
368
-
369
- Returns:
370
- Bound activity-stream options.
371
-
372
- Raises:
373
- TypeError: If the arguments do not match the public signature.
374
- """
375
- bound = bind_arguments(
376
- _ACTIVITY_STREAM_READ_SIGNATURE, args, kwargs, f'{owner_name}.activity_stream_read()'
377
- )
378
- options = cast('Callable[..., _ActivityStreamReadOptions]', _ActivityStreamReadOptions)
379
- return options(**bound.arguments)
380
-
381
-
382
- def bind_export_page(
383
- args: tuple[object, ...],
384
- kwargs: dict[str, object],
385
- owner_name: str,
386
- ) -> _ExportPageOptions:
387
- """Bind runtime export-page arguments.
388
-
389
- Args:
390
- args: Positional arguments supplied by the caller.
391
- kwargs: Keyword arguments supplied by the caller.
392
- owner_name: Public client class name used in errors.
393
-
394
- Returns:
395
- Bound export-page options.
396
-
397
- Raises:
398
- TypeError: If the arguments do not match the public signature.
399
- """
400
- bound = bind_arguments(_EXPORT_PAGE_SIGNATURE, args, kwargs, f'{owner_name}.export_page()')
401
- options = cast('Callable[..., _ExportPageOptions]', _ExportPageOptions)
402
- return options(**bound.arguments)
403
-
404
-
405
- def bind_summarize(
406
- args: tuple[object, ...],
407
- kwargs: dict[str, object],
408
- owner_name: str,
409
- ) -> _SummarizeOptions:
410
- """Bind runtime summarize arguments.
411
-
412
- Args:
413
- args: Positional arguments supplied by the caller.
414
- kwargs: Keyword arguments supplied by the caller.
415
- owner_name: Public client class name used in errors.
416
-
417
- Returns:
418
- Bound summarize options.
419
-
420
- Raises:
421
- TypeError: If the arguments do not match the public signature.
422
- """
423
- bound = bind_arguments(_SUMMARIZE_SIGNATURE, args, kwargs, f'{owner_name}.summarize()')
424
- options = cast('Callable[..., _SummarizeOptions]', _SummarizeOptions)
425
- return options(**bound.arguments)
426
-
427
-
428
- def bind_work_schedule_update(
429
- args: tuple[object, ...],
430
- kwargs: dict[str, object],
431
- owner_name: str,
432
- ) -> _WorkScheduleUpdateOptions:
433
- """Bind runtime work-schedule update arguments.
434
-
435
- Args:
436
- args: Positional arguments supplied by the caller.
437
- kwargs: Keyword arguments supplied by the caller.
438
- owner_name: Public client class name used in errors.
439
-
440
- Returns:
441
- Bound schedule-update options.
442
-
443
- Raises:
444
- TypeError: If the arguments do not match the public signature.
445
- """
446
- bound = bind_arguments(
447
- _WORK_SCHEDULE_UPDATE_SIGNATURE, args, kwargs, f'{owner_name}.work_schedule_update()'
448
- )
449
- options = cast('Callable[..., _WorkScheduleUpdateOptions]', _WorkScheduleUpdateOptions)
450
- return options(**bound.arguments)
451
-
452
-
453
- def build_activity_stream_read_params(options: _ActivityStreamReadOptions) -> dict[str, object]:
166
+ def build_activity_stream_read_params(options: ActivityStreamReadOptions) -> dict[str, object]:
454
167
  """Build activity-stream parameters.
455
168
 
456
169
  Args:
@@ -521,7 +234,7 @@ def build_authentication_plan(
521
234
  )
522
235
 
523
236
 
524
- def build_export_page_params(options: _ExportPageOptions) -> dict[str, object]:
237
+ def build_export_page_params(options: ExportPageOptions) -> dict[str, object]:
525
238
  """Build validated page-export parameters.
526
239
 
527
240
  Args:
@@ -811,7 +524,7 @@ def build_schema_field_update_params(
811
524
  return params
812
525
 
813
526
 
814
- def build_summarize_params(options: _SummarizeOptions) -> dict[str, object]:
527
+ def build_summarize_params(options: SummarizeOptions) -> dict[str, object]:
815
528
  """Build validated summarize parameters.
816
529
 
817
530
  Args:
@@ -867,7 +580,8 @@ def build_text_search_params(
867
580
  RPC parameters copied by the client before dispatch.
868
581
 
869
582
  Raises:
870
- ShotgunError: If `entity_types` is not a dictionary.
583
+ ShotgunError: If `entity_types` is not a dictionary or an entity filter
584
+ has invalid container or filter syntax.
871
585
  """
872
586
  validated_entity_types = _crud.require_dictionary(
873
587
  entity_types,
@@ -897,10 +611,19 @@ def build_update_project_last_accessed_params(
897
611
 
898
612
  Returns:
899
613
  RPC parameters copied by the client before dispatch.
614
+
615
+ Raises:
616
+ ShotgunError: If a project or user ID is missing or invalid.
900
617
  """
901
- params: dict[str, object] = {'project_id': project['id']}
618
+ params: dict[str, object] = {
619
+ 'project_id': _crud.require_entity_id(
620
+ project.get('id'), 'update_project_last_accessed project id must be an integer'
621
+ )
622
+ }
902
623
  if user is not None:
903
- params['user_id'] = user['id']
624
+ params['user_id'] = _crud.require_entity_id(
625
+ user.get('id'), 'update_project_last_accessed user id must be an integer'
626
+ )
904
627
  return params
905
628
 
906
629
 
@@ -920,11 +643,38 @@ def build_user_subscriptions_create_params(users: object) -> dict[str, object]:
920
643
  users,
921
644
  'user_subscriptions_create users must be a list',
922
645
  )
923
- message = 'user_subscriptions_create users must contain dictionaries with a user_id key'
646
+ entry_message = (
647
+ 'user_subscriptions_create users must contain dictionaries with '
648
+ 'humanUserId and subscription keys'
649
+ )
650
+ params: dict[str, object] = {}
924
651
  for member in validated:
925
- if not isinstance(member, dict) or 'user_id' not in member:
926
- raise ShotgunError(message)
927
- return {'users': cast('list[dict[str, object]]', validated)}
652
+ if not isinstance(member, dict):
653
+ raise ShotgunError(entry_message)
654
+ entry = cast('dict[str, object]', member)
655
+ if 'humanUserId' not in entry or 'subscription' not in entry:
656
+ raise ShotgunError(entry_message)
657
+ user_id = entry['humanUserId']
658
+ if isinstance(user_id, bool) or not isinstance(user_id, (str, int)):
659
+ raise ShotgunError(
660
+ 'user_subscriptions_create users must contain string or integer humanUserId values'
661
+ )
662
+ if not _is_subscription_value(entry['subscription']):
663
+ raise ShotgunError(
664
+ 'user_subscriptions_create users must contain valid subscription values'
665
+ )
666
+ key = str(user_id)
667
+ if key in params:
668
+ raise ShotgunError(
669
+ 'user_subscriptions_create users must not contain duplicate user IDs'
670
+ )
671
+ subscription = entry['subscription']
672
+ params[key] = (
673
+ cast('list[str]', subscription).copy()
674
+ if isinstance(subscription, list)
675
+ else subscription
676
+ )
677
+ return params
928
678
 
929
679
 
930
680
  def build_work_schedule_read_params(
@@ -961,7 +711,7 @@ def build_work_schedule_read_params(
961
711
 
962
712
 
963
713
  def build_work_schedule_update_params(
964
- options: _WorkScheduleUpdateOptions,
714
+ options: WorkScheduleUpdateOptions,
965
715
  ) -> dict[str, object]:
966
716
  """Build validated schedule-update parameters.
967
717
 
@@ -1002,66 +752,6 @@ def entity_types_alias_error() -> ShotgunError:
1002
752
  return ShotgunError('Deprecated: use schema_entity_read() instead')
1003
753
 
1004
754
 
1005
- def expose_activity_stream_read_signature(
1006
- function: Callable[..., object],
1007
- ) -> Callable[..., object]:
1008
- """Expose the documented activity-stream signature.
1009
-
1010
- Args:
1011
- function: Variadic implementation.
1012
-
1013
- Returns:
1014
- The implementation with public reflection metadata.
1015
- """
1016
- return expose_signature(
1017
- function, _METHOD_ACTIVITY_STREAM_READ_SIGNATURE, _ACTIVITY_STREAM_READ_DOCSTRING
1018
- )
1019
-
1020
-
1021
- def expose_export_page_signature(
1022
- function: Callable[..., object],
1023
- ) -> Callable[..., object]:
1024
- """Expose the documented page-export signature.
1025
-
1026
- Args:
1027
- function: Variadic implementation.
1028
-
1029
- Returns:
1030
- The implementation with public reflection metadata.
1031
- """
1032
- return expose_signature(function, _METHOD_EXPORT_PAGE_SIGNATURE, _EXPORT_PAGE_DOCSTRING)
1033
-
1034
-
1035
- def expose_summarize_signature(
1036
- function: Callable[..., object],
1037
- ) -> Callable[..., object]:
1038
- """Expose the documented summarize signature.
1039
-
1040
- Args:
1041
- function: Variadic implementation.
1042
-
1043
- Returns:
1044
- The implementation with public reflection metadata.
1045
- """
1046
- return expose_signature(function, _METHOD_SUMMARIZE_SIGNATURE, _SUMMARIZE_DOCSTRING)
1047
-
1048
-
1049
- def expose_work_schedule_update_signature(
1050
- function: Callable[..., object],
1051
- ) -> Callable[..., object]:
1052
- """Expose the documented schedule-update signature.
1053
-
1054
- Args:
1055
- function: Variadic implementation.
1056
-
1057
- Returns:
1058
- The implementation with public reflection metadata.
1059
- """
1060
- return expose_signature(
1061
- function, _METHOD_WORK_SCHEDULE_UPDATE_SIGNATURE, _WORK_SCHEDULE_UPDATE_DOCSTRING
1062
- )
1063
-
1064
-
1065
755
  def require_dictionary_list_result(
1066
756
  value: object,
1067
757
  method_name: str,
@@ -1124,6 +814,57 @@ def require_string_result(value: object, method_name: str) -> str:
1124
814
  return value
1125
815
 
1126
816
 
817
+ def require_user_subscriptions_create_result(value: object) -> bool:
818
+ """Interpret a mapping of per-user subscription assignment reports.
819
+
820
+ Args:
821
+ value: Raw result returned by the server.
822
+
823
+ Returns:
824
+ `True` if every report is `None`, otherwise `False`.
825
+
826
+ Raises:
827
+ ShotgunError: If the result is not a mapping with string keys.
828
+ """
829
+ message = 'user_subscriptions_create returned an invalid result mapping'
830
+ if not isinstance(value, Mapping):
831
+ raise ShotgunError(message)
832
+ reports = cast('Mapping[object, object]', value)
833
+ if any(not isinstance(key, str) for key in reports):
834
+ raise ShotgunError(message)
835
+ return all(report is None for report in reports.values())
836
+
837
+
838
+ def require_user_subscriptions_result(value: object) -> list[dict[str, object]]:
839
+ """Convert a subscription mapping to ordered public entries.
840
+
841
+ Args:
842
+ value: Raw subscription mapping returned by the server.
843
+
844
+ Returns:
845
+ Entries with unchanged string `humanUserId` and `subscription` values
846
+ of `None`, string, or list of strings. Lists are copied.
847
+
848
+ Raises:
849
+ ShotgunError: If the result is not a valid subscription mapping.
850
+ """
851
+ if not isinstance(value, Mapping):
852
+ raise ShotgunError('user_subscriptions_read did not return a dictionary')
853
+ subscriptions: list[dict[str, object]] = []
854
+ for user_id, subscription in cast('Mapping[object, object]', value).items():
855
+ if not isinstance(user_id, str) or not user_id:
856
+ raise ShotgunError('user_subscriptions_read returned an invalid user ID')
857
+ if not _is_subscription_value(subscription):
858
+ raise ShotgunError('user_subscriptions_read returned an invalid subscription')
859
+ public_subscription = (
860
+ cast('list[str]', subscription).copy()
861
+ if isinstance(subscription, list)
862
+ else subscription
863
+ )
864
+ subscriptions.append({'humanUserId': user_id, 'subscription': public_subscription})
865
+ return subscriptions
866
+
867
+
1127
868
  def schema_alias_error(entity_type: object) -> ShotgunError:
1128
869
  """Build the error raised by the deprecated `schema` alias.
1129
870