transcodely 0.3.0__tar.gz → 0.3.1__tar.gz

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 (88) hide show
  1. {transcodely-0.3.0 → transcodely-0.3.1}/PKG-INFO +1 -1
  2. {transcodely-0.3.0 → transcodely-0.3.1}/pyproject.toml +1 -1
  3. transcodely-0.3.1/src/transcodely/resources/_helpers.py +66 -0
  4. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/apps.py +12 -0
  5. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/jobs.py +65 -30
  6. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/memberships.py +16 -2
  7. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/users.py +14 -2
  8. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/version.py +1 -1
  9. transcodely-0.3.0/src/transcodely/resources/_helpers.py +0 -29
  10. {transcodely-0.3.0 → transcodely-0.3.1}/.gitignore +0 -0
  11. {transcodely-0.3.0 → transcodely-0.3.1}/LICENSE +0 -0
  12. {transcodely-0.3.0 → transcodely-0.3.1}/README.md +0 -0
  13. {transcodely-0.3.0 → transcodely-0.3.1}/src/buf/__init__.py +0 -0
  14. {transcodely-0.3.0 → transcodely-0.3.1}/src/buf/validate/__init__.py +0 -0
  15. {transcodely-0.3.0 → transcodely-0.3.1}/src/buf/validate/validate_pb2.py +0 -0
  16. {transcodely-0.3.0 → transcodely-0.3.1}/src/buf/validate/validate_pb2.pyi +0 -0
  17. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/__init__.py +0 -0
  18. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/_codec/__init__.py +0 -0
  19. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/_codec/json_codec.py +0 -0
  20. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/_transport/__init__.py +0 -0
  21. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/_transport/error_mapping.py +0 -0
  22. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/_transport/headers.py +0 -0
  23. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/_transport/transport.py +0 -0
  24. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/client.py +0 -0
  25. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/errors.py +0 -0
  26. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/pagination.py +0 -0
  27. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/py.typed +0 -0
  28. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/__init__.py +0 -0
  29. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/api_keys.py +0 -0
  30. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/events.py +0 -0
  31. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/health.py +0 -0
  32. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/organizations.py +0 -0
  33. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/origins.py +0 -0
  34. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/presets.py +0 -0
  35. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/videos.py +0 -0
  36. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/resources/webhook_endpoints.py +0 -0
  37. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/streaming.py +0 -0
  38. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/types.py +0 -0
  39. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/api_key_pb2.py +0 -0
  40. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/api_key_pb2.pyi +0 -0
  41. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/app_pb2.py +0 -0
  42. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/app_pb2.pyi +0 -0
  43. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/codec_av1_pb2.py +0 -0
  44. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/codec_av1_pb2.pyi +0 -0
  45. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/codec_h264_pb2.py +0 -0
  46. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/codec_h264_pb2.pyi +0 -0
  47. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/codec_h265_pb2.py +0 -0
  48. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/codec_h265_pb2.pyi +0 -0
  49. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/codec_vp9_pb2.py +0 -0
  50. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/codec_vp9_pb2.pyi +0 -0
  51. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/common_pb2.py +0 -0
  52. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/common_pb2.pyi +0 -0
  53. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/content_aware_pb2.py +0 -0
  54. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/content_aware_pb2.pyi +0 -0
  55. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/drm_pb2.py +0 -0
  56. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/drm_pb2.pyi +0 -0
  57. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/hdr_pb2.py +0 -0
  58. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/hdr_pb2.pyi +0 -0
  59. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/health_pb2.py +0 -0
  60. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/health_pb2.pyi +0 -0
  61. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/job_pb2.py +0 -0
  62. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/job_pb2.pyi +0 -0
  63. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/media_pb2.py +0 -0
  64. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/media_pb2.pyi +0 -0
  65. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/membership_pb2.py +0 -0
  66. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/membership_pb2.pyi +0 -0
  67. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/organization_pb2.py +0 -0
  68. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/organization_pb2.pyi +0 -0
  69. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/origin_pb2.py +0 -0
  70. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/origin_pb2.pyi +0 -0
  71. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/preset_pb2.py +0 -0
  72. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/preset_pb2.pyi +0 -0
  73. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/streaming_pb2.py +0 -0
  74. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/streaming_pb2.pyi +0 -0
  75. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/subtitles_pb2.py +0 -0
  76. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/subtitles_pb2.pyi +0 -0
  77. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/thumbnails_pb2.py +0 -0
  78. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/thumbnails_pb2.pyi +0 -0
  79. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/user_pb2.py +0 -0
  80. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/user_pb2.pyi +0 -0
  81. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/video_pb2.py +0 -0
  82. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/video_pb2.pyi +0 -0
  83. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/webhook_pb2.py +0 -0
  84. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/v1/webhook_pb2.pyi +0 -0
  85. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/webhooks/__init__.py +0 -0
  86. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/webhooks/construct_event.py +0 -0
  87. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/webhooks/signature.py +0 -0
  88. {transcodely-0.3.0 → transcodely-0.3.1}/src/transcodely/webhooks/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: transcodely
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Official Python SDK for the Transcodely video transcoding API
5
5
  Project-URL: Homepage, https://transcodely.com
6
6
  Project-URL: Documentation, https://transcodely.com/docs
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "transcodely"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "Official Python SDK for the Transcodely video transcoding API"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -0,0 +1,66 @@
1
+ """Internal helpers shared by resource modules."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Mapping, Optional, Union
6
+
7
+ from google.protobuf import json_format
8
+ from google.protobuf.descriptor import EnumDescriptor
9
+ from google.protobuf.message import Message
10
+
11
+ from .._codec.json_codec import expand_enum_value, simplify_enum_value, transform_enums_in_dict
12
+
13
+
14
+ def fill_from_dict(msg: Message, data: Mapping[str, Any]) -> Message:
15
+ """Populate ``msg`` from a plain dict, accepting simplified-enum strings.
16
+
17
+ The codec's enum-expand pass lets callers pass ``{"codec": "h264"}`` while
18
+ the proto stores ``VIDEO_CODEC_H264`` (an int after parse).
19
+ """
20
+ payload = dict(data)
21
+ transform_enums_in_dict(payload, msg.DESCRIPTOR, mode="expand")
22
+ json_format.ParseDict(payload, msg, ignore_unknown_fields=True)
23
+ return msg
24
+
25
+
26
+ def resolve_enum(value: Union[int, str], enum_desc: EnumDescriptor) -> int:
27
+ """Resolve an enum value from either the raw proto int or a string.
28
+
29
+ Strings may be the simplified lowercase wire form (``"standard"``,
30
+ ``"processing"``) or the canonical proto name (``"JOB_PRIORITY_STANDARD"``) —
31
+ both resolve to the same int via the codec's inbound ``expand`` rule. Ints
32
+ pass through unchanged (proto3 enums are open, so an unknown int is the
33
+ caller's responsibility). Used for scalar enum kwargs that are set on a
34
+ request directly rather than through :func:`fill_from_dict`.
35
+ """
36
+ if isinstance(value, bool): # bool is an int subclass — reject it explicitly.
37
+ raise TypeError(f"{enum_desc.name} value must be an int or str, got bool: {value!r}")
38
+ if isinstance(value, int):
39
+ return value
40
+ if isinstance(value, str):
41
+ name = expand_enum_value(value, enum_desc)
42
+ entry = enum_desc.values_by_name.get(name)
43
+ if entry is None:
44
+ allowed = ", ".join(
45
+ simplify_enum_value(v.name, enum_desc) for v in enum_desc.values if v.number != 0
46
+ )
47
+ raise ValueError(
48
+ f"unknown {enum_desc.name} value {value!r}; expected one of: {allowed}"
49
+ )
50
+ return int(entry.number)
51
+ raise TypeError(f"{enum_desc.name} value must be an int or str, got {type(value).__name__}")
52
+
53
+
54
+ def assign_pagination(
55
+ req_pagination: Any,
56
+ *,
57
+ limit: Optional[int] = None,
58
+ cursor: Optional[str] = None,
59
+ offset: Optional[int] = None,
60
+ ) -> None:
61
+ if limit is not None:
62
+ req_pagination.limit = limit
63
+ if cursor is not None:
64
+ req_pagination.cursor = cursor
65
+ if offset is not None:
66
+ req_pagination.offset = offset
@@ -31,11 +31,23 @@ class Apps:
31
31
  def list(
32
32
  self,
33
33
  *,
34
+ org_id: Optional[str] = None,
34
35
  limit: Optional[int] = None,
36
+ include_archived: Optional[bool] = None,
35
37
  opts: Optional[CallOptions] = None,
36
38
  ) -> Page[app_pb2.App]:
39
+ """List apps in an organization.
40
+
41
+ ``org_id`` (the parent organization, e.g. ``"org_a1b2c3d4e5"``) is required
42
+ by the API. Pass ``include_archived=True`` to include archived apps.
43
+ """
44
+
37
45
  def fetch(cursor: Optional[str]) -> PageContents[app_pb2.App]:
38
46
  req = app_pb2.ListAppsRequest()
47
+ if org_id is not None:
48
+ req.org_id = org_id
49
+ if include_archived is not None:
50
+ req.include_archived = include_archived
39
51
  assign_pagination(req.pagination, limit=limit, cursor=cursor)
40
52
  res = self._t.unary(_SERVICE, "List", req, app_pb2.ListAppsResponse(), opts)
41
53
  return PageContents(
@@ -2,12 +2,13 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Any, Generator, Mapping, Optional
5
+ from typing import Any, Generator, Mapping, Optional, Union
6
6
 
7
7
  from .._transport.transport import CallOptions, Transport
8
8
  from ..pagination import Page, PageContents
9
9
  from ..streaming import watch
10
10
  from ..v1 import job_pb2
11
+ from ._helpers import assign_pagination, fill_from_dict, resolve_enum
11
12
 
12
13
  _SERVICE = "transcodely.v1.JobService"
13
14
 
@@ -21,35 +22,54 @@ class Jobs:
21
22
  input_url: Optional[str] = None,
22
23
  outputs: Optional[list[Mapping[str, Any]]] = None,
23
24
  *,
24
- idempotency_key: Optional[str] = None,
25
+ output_origin_id: Optional[str] = None,
26
+ output_path_template: Optional[str] = None,
27
+ input_origin_id: Optional[str] = None,
28
+ input_path: Optional[str] = None,
29
+ priority: Optional[Union[int, str]] = None,
30
+ delayed_start: Optional[bool] = None,
25
31
  webhook_url: Optional[str] = None,
26
- priority: Optional[int] = None,
27
32
  metadata: Optional[Mapping[str, str]] = None,
33
+ idempotency_key: Optional[str] = None,
28
34
  request: Optional[job_pb2.CreateJobRequest] = None,
29
35
  opts: Optional[CallOptions] = None,
30
36
  ) -> job_pb2.Job:
31
- """Create a new transcoding job. Auto-fills ``idempotency_key`` if omitted."""
37
+ """Create a new transcoding job.
38
+
39
+ Keyword arguments mirror the API's snake_case fields. Enum-valued fields —
40
+ ``priority`` here, plus any enum inside ``outputs`` dicts — accept either the
41
+ simplified lowercase string (``"standard"``, ``"h264"``) or the raw proto int.
42
+ Provide inputs via ``input_url`` (direct URL) OR ``input_origin_id`` +
43
+ ``input_path`` (origin mode); the server rejects both. Pass a fully-built
44
+ ``request=`` to bypass the convenience kwargs entirely. ``idempotency_key`` is
45
+ auto-filled with a uuid4 when omitted. ``output_path_template`` overrides where
46
+ rendered outputs are written within the output origin (e.g.
47
+ ``"videos/{job_id}/{output}"``).
48
+ """
32
49
  if request is None:
33
- req = job_pb2.CreateJobRequest()
50
+ payload: dict[str, Any] = {}
34
51
  if input_url is not None:
35
- req.input_url = input_url
52
+ payload["input_url"] = input_url
53
+ if input_origin_id is not None:
54
+ payload["input_origin_id"] = input_origin_id
55
+ if input_path is not None:
56
+ payload["input_path"] = input_path
57
+ if output_origin_id is not None:
58
+ payload["output_origin_id"] = output_origin_id
59
+ if output_path_template is not None:
60
+ payload["output_path_template"] = output_path_template
36
61
  if outputs:
37
- from google.protobuf import json_format
38
-
39
- from .._codec.json_codec import transform_enums_in_dict
40
-
41
- # Outputs are nested messages — round-trip through JSON so callers can
42
- # pass plain dicts with simplified-enum strings.
43
- payload = {"outputs": list(outputs)}
44
- transform_enums_in_dict(payload, req.DESCRIPTOR, mode="expand")
45
- json_format.ParseDict(payload, req, ignore_unknown_fields=True)
46
- if webhook_url is not None:
47
- req.webhook_url = webhook_url
62
+ payload["outputs"] = list(outputs)
48
63
  if priority is not None:
49
- req.priority = priority
64
+ payload["priority"] = priority
65
+ if delayed_start is not None:
66
+ payload["delayed_start"] = delayed_start
67
+ if webhook_url is not None:
68
+ payload["webhook_url"] = webhook_url
50
69
  if metadata:
51
- for k, v in metadata.items():
52
- req.metadata[k] = v
70
+ payload["metadata"] = dict(metadata)
71
+ req = job_pb2.CreateJobRequest()
72
+ fill_from_dict(req, payload)
53
73
  else:
54
74
  req = request
55
75
  if not req.idempotency_key:
@@ -66,22 +86,37 @@ class Jobs:
66
86
  def list(
67
87
  self,
68
88
  *,
69
- status: Optional[int] = None,
89
+ status: Optional[Union[int, str]] = None,
70
90
  limit: Optional[int] = None,
91
+ offset: Optional[int] = None,
92
+ pagination: Optional[Mapping[str, Any]] = None,
71
93
  opts: Optional[CallOptions] = None,
72
94
  ) -> Page[job_pb2.Job]:
73
- from ..v1 import common_pb2
95
+ """List jobs, optionally filtered by ``status``.
96
+
97
+ ``status`` accepts the simplified lowercase string (``"processing"``) or the
98
+ raw ``JobStatus`` int. Pagination may be given as ``limit`` / ``offset``
99
+ keyword args or as a ``pagination={"limit": ..., "offset": ..., "cursor": ...}``
100
+ mapping; explicit keyword args take precedence over the mapping.
101
+ """
102
+ status_value = (
103
+ resolve_enum(status, job_pb2.JobStatus.DESCRIPTOR) if status is not None else None
104
+ )
105
+ pag = dict(pagination) if pagination else {}
106
+ eff_limit = limit if limit is not None else pag.get("limit")
107
+ eff_offset = offset if offset is not None else pag.get("offset")
108
+ start_cursor = pag.get("cursor")
74
109
 
75
110
  def fetch(cursor: Optional[str]) -> PageContents[job_pb2.Job]:
76
111
  req = job_pb2.ListJobsRequest()
77
- if status is not None:
78
- req.status = status
79
- pagination = common_pb2.PaginationRequest()
80
- if limit is not None:
81
- pagination.limit = limit
82
- if cursor is not None:
83
- pagination.cursor = cursor
84
- req.pagination.CopyFrom(pagination)
112
+ if status_value is not None:
113
+ req.status = status_value
114
+ assign_pagination(
115
+ req.pagination,
116
+ limit=eff_limit,
117
+ cursor=cursor if cursor is not None else start_cursor,
118
+ offset=eff_offset,
119
+ )
85
120
  res = self._t.unary(_SERVICE, "List", req, job_pb2.ListJobsResponse(), opts)
86
121
  return PageContents(
87
122
  items=list(res.jobs),
@@ -2,12 +2,12 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Any, Optional
5
+ from typing import Any, Optional, Union
6
6
 
7
7
  from .._transport.transport import CallOptions, Transport
8
8
  from ..pagination import Page, PageContents
9
9
  from ..v1 import membership_pb2
10
- from ._helpers import assign_pagination, fill_from_dict
10
+ from ._helpers import assign_pagination, fill_from_dict, resolve_enum
11
11
 
12
12
  _SERVICE = "transcodely.v1.MembershipService"
13
13
 
@@ -19,11 +19,25 @@ class Memberships:
19
19
  def list(
20
20
  self,
21
21
  *,
22
+ status: Optional[Union[int, str]] = None,
22
23
  limit: Optional[int] = None,
23
24
  opts: Optional[CallOptions] = None,
24
25
  ) -> Page[membership_pb2.MembershipWithUser]:
26
+ """List memberships, optionally filtered by ``status``.
27
+
28
+ ``status`` accepts the simplified lowercase string (``"active"``,
29
+ ``"invited"``, ``"suspended"``) or the raw ``MembershipStatus`` int.
30
+ """
31
+ status_value = (
32
+ resolve_enum(status, membership_pb2.MembershipStatus.DESCRIPTOR)
33
+ if status is not None
34
+ else None
35
+ )
36
+
25
37
  def fetch(cursor: Optional[str]) -> PageContents[membership_pb2.MembershipWithUser]:
26
38
  req = membership_pb2.ListMembershipsRequest()
39
+ if status_value is not None:
40
+ req.status = status_value
27
41
  assign_pagination(req.pagination, limit=limit, cursor=cursor)
28
42
  res = self._t.unary(
29
43
  _SERVICE, "List", req, membership_pb2.ListMembershipsResponse(), opts
@@ -2,12 +2,12 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Any, Optional
5
+ from typing import Any, Optional, Union
6
6
 
7
7
  from .._transport.transport import CallOptions, Transport
8
8
  from ..pagination import Page, PageContents
9
9
  from ..v1 import user_pb2
10
- from ._helpers import assign_pagination, fill_from_dict
10
+ from ._helpers import assign_pagination, fill_from_dict, resolve_enum
11
11
 
12
12
  _SERVICE = "transcodely.v1.UserService"
13
13
 
@@ -32,11 +32,23 @@ class Users:
32
32
  def list(
33
33
  self,
34
34
  *,
35
+ status: Optional[Union[int, str]] = None,
35
36
  limit: Optional[int] = None,
36
37
  opts: Optional[CallOptions] = None,
37
38
  ) -> Page[user_pb2.User]:
39
+ """List users, optionally filtered by ``status``.
40
+
41
+ ``status`` accepts the simplified lowercase string (``"active"``,
42
+ ``"suspended"``, ``"deleted"``) or the raw ``UserStatus`` int.
43
+ """
44
+ status_value = (
45
+ resolve_enum(status, user_pb2.UserStatus.DESCRIPTOR) if status is not None else None
46
+ )
47
+
38
48
  def fetch(cursor: Optional[str]) -> PageContents[user_pb2.User]:
39
49
  req = user_pb2.ListUsersRequest()
50
+ if status_value is not None:
51
+ req.status = status_value
40
52
  assign_pagination(req.pagination, limit=limit, cursor=cursor)
41
53
  res = self._t.unary(_SERVICE, "List", req, user_pb2.ListUsersResponse(), opts)
42
54
  return PageContents(
@@ -1,7 +1,7 @@
1
1
  """Version constants exposed at the top of the package."""
2
2
 
3
3
  #: SDK package version. Bumped by release-please from pyproject.toml.
4
- SDK_VERSION = "0.3.0" # x-release-please-version
4
+ SDK_VERSION = "0.3.1" # x-release-please-version
5
5
 
6
6
  #: Calendar-versioned API this release pins. Sent on every request as
7
7
  #: `Transcodely-Version`. Override per-client via ``api_version=``.
@@ -1,29 +0,0 @@
1
- """Internal helpers shared by resource modules."""
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Any, Mapping, Optional
6
-
7
- from google.protobuf import json_format
8
- from google.protobuf.message import Message
9
-
10
- from .._codec.json_codec import transform_enums_in_dict
11
-
12
-
13
- def fill_from_dict(msg: Message, data: Mapping[str, Any]) -> Message:
14
- """Populate ``msg`` from a plain dict, accepting simplified-enum strings.
15
-
16
- The codec's enum-expand pass lets callers pass ``{"codec": "h264"}`` while
17
- the proto stores ``VIDEO_CODEC_H264`` (an int after parse).
18
- """
19
- payload = dict(data)
20
- transform_enums_in_dict(payload, msg.DESCRIPTOR, mode="expand")
21
- json_format.ParseDict(payload, msg, ignore_unknown_fields=True)
22
- return msg
23
-
24
-
25
- def assign_pagination(req_pagination: Any, *, limit: Optional[int], cursor: Optional[str]) -> None:
26
- if limit is not None:
27
- req_pagination.limit = limit
28
- if cursor is not None:
29
- req_pagination.cursor = cursor
File without changes
File without changes
File without changes