openmeter 1.0.0b53__py3-none-any.whl → 2.0.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.

Potentially problematic release.


This version of openmeter might be problematic. Click here for more details.

Files changed (132) hide show
  1. openmeter/__init__.py +89 -15
  2. openmeter/_base_client.py +2041 -0
  3. openmeter/_client.py +518 -70
  4. openmeter/_compat.py +221 -0
  5. openmeter/_constants.py +14 -0
  6. openmeter/_exceptions.py +108 -0
  7. openmeter/_files.py +127 -0
  8. openmeter/_models.py +777 -0
  9. openmeter/_qs.py +150 -0
  10. openmeter/_resource.py +43 -0
  11. openmeter/_response.py +820 -0
  12. openmeter/_streaming.py +333 -0
  13. openmeter/_types.py +222 -0
  14. openmeter/_utils/__init__.py +56 -0
  15. openmeter/_utils/_logs.py +25 -0
  16. openmeter/_utils/_proxy.py +63 -0
  17. openmeter/_utils/_reflection.py +42 -0
  18. openmeter/_utils/_streams.py +12 -0
  19. openmeter/_utils/_sync.py +81 -0
  20. openmeter/_utils/_transform.py +387 -0
  21. openmeter/_utils/_typing.py +120 -0
  22. openmeter/_utils/_utils.py +419 -0
  23. openmeter/_version.py +4 -0
  24. openmeter/lib/.keep +4 -0
  25. openmeter/py.typed +0 -1
  26. openmeter/resources/__init__.py +103 -0
  27. openmeter/resources/debug/__init__.py +33 -0
  28. openmeter/resources/debug/debug.py +102 -0
  29. openmeter/resources/debug/metrics.py +146 -0
  30. openmeter/resources/entitlements/__init__.py +47 -0
  31. openmeter/resources/entitlements/entitlements.py +450 -0
  32. openmeter/resources/entitlements/features.py +578 -0
  33. openmeter/resources/entitlements/grants.py +389 -0
  34. openmeter/resources/events.py +442 -0
  35. openmeter/resources/meters/__init__.py +33 -0
  36. openmeter/resources/meters/meters.py +666 -0
  37. openmeter/resources/meters/subjects.py +163 -0
  38. openmeter/resources/notifications/__init__.py +75 -0
  39. openmeter/resources/notifications/channels.py +686 -0
  40. openmeter/resources/notifications/events.py +365 -0
  41. openmeter/resources/notifications/notifications.py +198 -0
  42. openmeter/resources/notifications/rules.py +781 -0
  43. openmeter/resources/notifications/webhook.py +208 -0
  44. openmeter/resources/portal/__init__.py +47 -0
  45. openmeter/resources/portal/meters.py +230 -0
  46. openmeter/resources/portal/portal.py +112 -0
  47. openmeter/resources/portal/tokens.py +359 -0
  48. openmeter/resources/subjects/entitlements/__init__.py +33 -0
  49. openmeter/resources/subjects/entitlements/entitlements.py +1881 -0
  50. openmeter/resources/subjects/entitlements/grants.py +453 -0
  51. openmeter/resources/subjects.py +419 -0
  52. openmeter/types/__init__.py +21 -0
  53. openmeter/types/debug/__init__.py +5 -0
  54. openmeter/types/debug/metric_list_response.py +7 -0
  55. openmeter/types/entitlement.py +238 -0
  56. openmeter/types/entitlements/__init__.py +11 -0
  57. openmeter/types/entitlements/feature.py +61 -0
  58. openmeter/types/entitlements/feature_create_params.py +43 -0
  59. openmeter/types/entitlements/feature_list_params.py +23 -0
  60. openmeter/types/entitlements/grant_list_params.py +57 -0
  61. openmeter/types/entitlements/grant_list_response.py +11 -0
  62. openmeter/types/entitlements/grant_paginated_response.py +24 -0
  63. openmeter/types/entitlements/list_features_result.py +28 -0
  64. openmeter/types/event_ingest_params.py +46 -0
  65. openmeter/types/event_ingest_response.py +43 -0
  66. openmeter/types/event_list_params.py +22 -0
  67. openmeter/types/event_list_response.py +9 -0
  68. openmeter/types/ingested_event.py +59 -0
  69. openmeter/types/list_entitlements_result.py +28 -0
  70. openmeter/types/meter.py +53 -0
  71. openmeter/types/meter_create_params.py +50 -0
  72. openmeter/types/meter_list_response.py +9 -0
  73. openmeter/types/meter_query_params.py +50 -0
  74. openmeter/types/meter_query_result.py +35 -0
  75. openmeter/types/meters/__init__.py +5 -0
  76. openmeter/types/meters/subject_list_response.py +8 -0
  77. openmeter/types/notifications/__init__.py +18 -0
  78. openmeter/types/notifications/channel_create_params.py +34 -0
  79. openmeter/types/notifications/channel_list_params.py +41 -0
  80. openmeter/types/notifications/channel_list_response.py +24 -0
  81. openmeter/types/notifications/channel_update_params.py +34 -0
  82. openmeter/types/notifications/event_list_params.py +61 -0
  83. openmeter/types/notifications/event_list_response.py +24 -0
  84. openmeter/types/notifications/notification_channel.py +47 -0
  85. openmeter/types/notifications/notification_event.py +215 -0
  86. openmeter/types/notifications/notification_rule.py +70 -0
  87. openmeter/types/notifications/rule_create_params.py +39 -0
  88. openmeter/types/notifications/rule_list_params.py +54 -0
  89. openmeter/types/notifications/rule_list_response.py +24 -0
  90. openmeter/types/notifications/rule_update_params.py +39 -0
  91. openmeter/types/notifications/webhook_svix_params.py +26 -0
  92. openmeter/types/portal/__init__.py +10 -0
  93. openmeter/types/portal/meter_query_params.py +44 -0
  94. openmeter/types/portal/portal_token.py +28 -0
  95. openmeter/types/portal/token_create_params.py +17 -0
  96. openmeter/types/portal/token_invalidate_params.py +15 -0
  97. openmeter/types/portal/token_list_params.py +12 -0
  98. openmeter/types/portal/token_list_response.py +9 -0
  99. openmeter/types/shared/__init__.py +3 -0
  100. openmeter/types/subject.py +37 -0
  101. openmeter/types/subject_list_response.py +9 -0
  102. openmeter/types/subject_param.py +27 -0
  103. openmeter/types/subject_upsert_params.py +39 -0
  104. openmeter/types/subject_upsert_response.py +10 -0
  105. openmeter/types/subjects/__init__.py +13 -0
  106. openmeter/types/subjects/entitlement_history_params.py +35 -0
  107. openmeter/types/subjects/entitlement_history_response.py +98 -0
  108. openmeter/types/subjects/entitlement_list_response.py +10 -0
  109. openmeter/types/subjects/entitlements/__init__.py +8 -0
  110. openmeter/types/subjects/entitlements/entitlement_grant.py +103 -0
  111. openmeter/types/subjects/entitlements/grant_list_response.py +10 -0
  112. openmeter-2.0.0.dist-info/METADATA +396 -0
  113. openmeter-2.0.0.dist-info/RECORD +115 -0
  114. {openmeter-1.0.0b53.dist-info → openmeter-2.0.0.dist-info}/WHEEL +1 -1
  115. openmeter-2.0.0.dist-info/licenses/LICENSE +201 -0
  116. openmeter/_configuration.py +0 -36
  117. openmeter/_operations/__init__.py +0 -17
  118. openmeter/_operations/_operations.py +0 -2098
  119. openmeter/_operations/_patch.py +0 -20
  120. openmeter/_patch.py +0 -20
  121. openmeter/_serialization.py +0 -2008
  122. openmeter/_vendor.py +0 -24
  123. openmeter/aio/__init__.py +0 -21
  124. openmeter/aio/_client.py +0 -83
  125. openmeter/aio/_configuration.py +0 -36
  126. openmeter/aio/_operations/__init__.py +0 -17
  127. openmeter/aio/_operations/_operations.py +0 -1771
  128. openmeter/aio/_operations/_patch.py +0 -20
  129. openmeter/aio/_patch.py +0 -20
  130. openmeter/aio/_vendor.py +0 -24
  131. openmeter-1.0.0b53.dist-info/METADATA +0 -92
  132. openmeter-1.0.0b53.dist-info/RECORD +0 -21
@@ -0,0 +1,419 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import re
5
+ import inspect
6
+ import functools
7
+ from typing import (
8
+ Any,
9
+ Tuple,
10
+ Mapping,
11
+ TypeVar,
12
+ Callable,
13
+ Iterable,
14
+ Sequence,
15
+ cast,
16
+ overload,
17
+ )
18
+ from pathlib import Path
19
+ from datetime import date, datetime
20
+ from typing_extensions import TypeGuard
21
+
22
+ import sniffio
23
+
24
+ from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike
25
+ from .._compat import parse_date as parse_date, parse_datetime as parse_datetime
26
+
27
+ _T = TypeVar("_T")
28
+ _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])
29
+ _MappingT = TypeVar("_MappingT", bound=Mapping[str, object])
30
+ _SequenceT = TypeVar("_SequenceT", bound=Sequence[object])
31
+ CallableT = TypeVar("CallableT", bound=Callable[..., Any])
32
+
33
+
34
+ def flatten(t: Iterable[Iterable[_T]]) -> list[_T]:
35
+ return [item for sublist in t for item in sublist]
36
+
37
+
38
+ def extract_files(
39
+ # TODO: this needs to take Dict but variance issues.....
40
+ # create protocol type ?
41
+ query: Mapping[str, object],
42
+ *,
43
+ paths: Sequence[Sequence[str]],
44
+ ) -> list[tuple[str, FileTypes]]:
45
+ """Recursively extract files from the given dictionary based on specified paths.
46
+
47
+ A path may look like this ['foo', 'files', '<array>', 'data'].
48
+
49
+ Note: this mutates the given dictionary.
50
+ """
51
+ files: list[tuple[str, FileTypes]] = []
52
+ for path in paths:
53
+ files.extend(_extract_items(query, path, index=0, flattened_key=None))
54
+ return files
55
+
56
+
57
+ def _extract_items(
58
+ obj: object,
59
+ path: Sequence[str],
60
+ *,
61
+ index: int,
62
+ flattened_key: str | None,
63
+ ) -> list[tuple[str, FileTypes]]:
64
+ try:
65
+ key = path[index]
66
+ except IndexError:
67
+ if isinstance(obj, NotGiven):
68
+ # no value was provided - we can safely ignore
69
+ return []
70
+
71
+ # cyclical import
72
+ from .._files import assert_is_file_content
73
+
74
+ # We have exhausted the path, return the entry we found.
75
+ assert_is_file_content(obj, key=flattened_key)
76
+ assert flattened_key is not None
77
+ return [(flattened_key, cast(FileTypes, obj))]
78
+
79
+ index += 1
80
+ if is_dict(obj):
81
+ try:
82
+ # We are at the last entry in the path so we must remove the field
83
+ if (len(path)) == index:
84
+ item = obj.pop(key)
85
+ else:
86
+ item = obj[key]
87
+ except KeyError:
88
+ # Key was not present in the dictionary, this is not indicative of an error
89
+ # as the given path may not point to a required field. We also do not want
90
+ # to enforce required fields as the API may differ from the spec in some cases.
91
+ return []
92
+ if flattened_key is None:
93
+ flattened_key = key
94
+ else:
95
+ flattened_key += f"[{key}]"
96
+ return _extract_items(
97
+ item,
98
+ path,
99
+ index=index,
100
+ flattened_key=flattened_key,
101
+ )
102
+ elif is_list(obj):
103
+ if key != "<array>":
104
+ return []
105
+
106
+ return flatten(
107
+ [
108
+ _extract_items(
109
+ item,
110
+ path,
111
+ index=index,
112
+ flattened_key=flattened_key + "[]" if flattened_key is not None else "[]",
113
+ )
114
+ for item in obj
115
+ ]
116
+ )
117
+
118
+ # Something unexpected was passed, just ignore it.
119
+ return []
120
+
121
+
122
+ def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]:
123
+ return not isinstance(obj, NotGiven)
124
+
125
+
126
+ # Type safe methods for narrowing types with TypeVars.
127
+ # The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
128
+ # however this cause Pyright to rightfully report errors. As we know we don't
129
+ # care about the contained types we can safely use `object` in it's place.
130
+ #
131
+ # There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
132
+ # `is_*` is for when you're dealing with an unknown input
133
+ # `is_*_t` is for when you're narrowing a known union type to a specific subset
134
+
135
+
136
+ def is_tuple(obj: object) -> TypeGuard[tuple[object, ...]]:
137
+ return isinstance(obj, tuple)
138
+
139
+
140
+ def is_tuple_t(obj: _TupleT | object) -> TypeGuard[_TupleT]:
141
+ return isinstance(obj, tuple)
142
+
143
+
144
+ def is_sequence(obj: object) -> TypeGuard[Sequence[object]]:
145
+ return isinstance(obj, Sequence)
146
+
147
+
148
+ def is_sequence_t(obj: _SequenceT | object) -> TypeGuard[_SequenceT]:
149
+ return isinstance(obj, Sequence)
150
+
151
+
152
+ def is_mapping(obj: object) -> TypeGuard[Mapping[str, object]]:
153
+ return isinstance(obj, Mapping)
154
+
155
+
156
+ def is_mapping_t(obj: _MappingT | object) -> TypeGuard[_MappingT]:
157
+ return isinstance(obj, Mapping)
158
+
159
+
160
+ def is_dict(obj: object) -> TypeGuard[dict[object, object]]:
161
+ return isinstance(obj, dict)
162
+
163
+
164
+ def is_list(obj: object) -> TypeGuard[list[object]]:
165
+ return isinstance(obj, list)
166
+
167
+
168
+ def is_iterable(obj: object) -> TypeGuard[Iterable[object]]:
169
+ return isinstance(obj, Iterable)
170
+
171
+
172
+ def deepcopy_minimal(item: _T) -> _T:
173
+ """Minimal reimplementation of copy.deepcopy() that will only copy certain object types:
174
+
175
+ - mappings, e.g. `dict`
176
+ - list
177
+
178
+ This is done for performance reasons.
179
+ """
180
+ if is_mapping(item):
181
+ return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()})
182
+ if is_list(item):
183
+ return cast(_T, [deepcopy_minimal(entry) for entry in item])
184
+ return item
185
+
186
+
187
+ # copied from https://github.com/Rapptz/RoboDanny
188
+ def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str:
189
+ size = len(seq)
190
+ if size == 0:
191
+ return ""
192
+
193
+ if size == 1:
194
+ return seq[0]
195
+
196
+ if size == 2:
197
+ return f"{seq[0]} {final} {seq[1]}"
198
+
199
+ return delim.join(seq[:-1]) + f" {final} {seq[-1]}"
200
+
201
+
202
+ def quote(string: str) -> str:
203
+ """Add single quotation marks around the given string. Does *not* do any escaping."""
204
+ return f"'{string}'"
205
+
206
+
207
+ def required_args(*variants: Sequence[str]) -> Callable[[CallableT], CallableT]:
208
+ """Decorator to enforce a given set of arguments or variants of arguments are passed to the decorated function.
209
+
210
+ Useful for enforcing runtime validation of overloaded functions.
211
+
212
+ Example usage:
213
+ ```py
214
+ @overload
215
+ def foo(*, a: str) -> str:
216
+ ...
217
+
218
+
219
+ @overload
220
+ def foo(*, b: bool) -> str:
221
+ ...
222
+
223
+
224
+ # This enforces the same constraints that a static type checker would
225
+ # i.e. that either a or b must be passed to the function
226
+ @required_args(["a"], ["b"])
227
+ def foo(*, a: str | None = None, b: bool | None = None) -> str:
228
+ ...
229
+ ```
230
+ """
231
+
232
+ def inner(func: CallableT) -> CallableT:
233
+ params = inspect.signature(func).parameters
234
+ positional = [
235
+ name
236
+ for name, param in params.items()
237
+ if param.kind
238
+ in {
239
+ param.POSITIONAL_ONLY,
240
+ param.POSITIONAL_OR_KEYWORD,
241
+ }
242
+ ]
243
+
244
+ @functools.wraps(func)
245
+ def wrapper(*args: object, **kwargs: object) -> object:
246
+ given_params: set[str] = set()
247
+ for i, _ in enumerate(args):
248
+ try:
249
+ given_params.add(positional[i])
250
+ except IndexError:
251
+ raise TypeError(
252
+ f"{func.__name__}() takes {len(positional)} argument(s) but {len(args)} were given"
253
+ ) from None
254
+
255
+ for key in kwargs.keys():
256
+ given_params.add(key)
257
+
258
+ for variant in variants:
259
+ matches = all((param in given_params for param in variant))
260
+ if matches:
261
+ break
262
+ else: # no break
263
+ if len(variants) > 1:
264
+ variations = human_join(
265
+ ["(" + human_join([quote(arg) for arg in variant], final="and") + ")" for variant in variants]
266
+ )
267
+ msg = f"Missing required arguments; Expected either {variations} arguments to be given"
268
+ else:
269
+ assert len(variants) > 0
270
+
271
+ # TODO: this error message is not deterministic
272
+ missing = list(set(variants[0]) - given_params)
273
+ if len(missing) > 1:
274
+ msg = f"Missing required arguments: {human_join([quote(arg) for arg in missing])}"
275
+ else:
276
+ msg = f"Missing required argument: {quote(missing[0])}"
277
+ raise TypeError(msg)
278
+ return func(*args, **kwargs)
279
+
280
+ return wrapper # type: ignore
281
+
282
+ return inner
283
+
284
+
285
+ _K = TypeVar("_K")
286
+ _V = TypeVar("_V")
287
+
288
+
289
+ @overload
290
+ def strip_not_given(obj: None) -> None:
291
+ ...
292
+
293
+
294
+ @overload
295
+ def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]:
296
+ ...
297
+
298
+
299
+ @overload
300
+ def strip_not_given(obj: object) -> object:
301
+ ...
302
+
303
+
304
+ def strip_not_given(obj: object | None) -> object:
305
+ """Remove all top-level keys where their values are instances of `NotGiven`"""
306
+ if obj is None:
307
+ return None
308
+
309
+ if not is_mapping(obj):
310
+ return obj
311
+
312
+ return {key: value for key, value in obj.items() if not isinstance(value, NotGiven)}
313
+
314
+
315
+ def coerce_integer(val: str) -> int:
316
+ return int(val, base=10)
317
+
318
+
319
+ def coerce_float(val: str) -> float:
320
+ return float(val)
321
+
322
+
323
+ def coerce_boolean(val: str) -> bool:
324
+ return val == "true" or val == "1" or val == "on"
325
+
326
+
327
+ def maybe_coerce_integer(val: str | None) -> int | None:
328
+ if val is None:
329
+ return None
330
+ return coerce_integer(val)
331
+
332
+
333
+ def maybe_coerce_float(val: str | None) -> float | None:
334
+ if val is None:
335
+ return None
336
+ return coerce_float(val)
337
+
338
+
339
+ def maybe_coerce_boolean(val: str | None) -> bool | None:
340
+ if val is None:
341
+ return None
342
+ return coerce_boolean(val)
343
+
344
+
345
+ def removeprefix(string: str, prefix: str) -> str:
346
+ """Remove a prefix from a string.
347
+
348
+ Backport of `str.removeprefix` for Python < 3.9
349
+ """
350
+ if string.startswith(prefix):
351
+ return string[len(prefix) :]
352
+ return string
353
+
354
+
355
+ def removesuffix(string: str, suffix: str) -> str:
356
+ """Remove a suffix from a string.
357
+
358
+ Backport of `str.removesuffix` for Python < 3.9
359
+ """
360
+ if string.endswith(suffix):
361
+ return string[: -len(suffix)]
362
+ return string
363
+
364
+
365
+ def file_from_path(path: str) -> FileTypes:
366
+ contents = Path(path).read_bytes()
367
+ file_name = os.path.basename(path)
368
+ return (file_name, contents)
369
+
370
+
371
+ def get_required_header(headers: HeadersLike, header: str) -> str:
372
+ lower_header = header.lower()
373
+ if isinstance(headers, Mapping):
374
+ for k, v in headers.items():
375
+ if k.lower() == lower_header and isinstance(v, str):
376
+ return v
377
+
378
+ """ to deal with the case where the header looks like Stainless-Event-Id """
379
+ intercaps_header = re.sub(r"([^\w])(\w)", lambda pat: pat.group(1) + pat.group(2).upper(), header.capitalize())
380
+
381
+ for normalized_header in [header, lower_header, header.upper(), intercaps_header]:
382
+ value = headers.get(normalized_header)
383
+ if value:
384
+ return value
385
+
386
+ raise ValueError(f"Could not find {header} header")
387
+
388
+
389
+ def get_async_library() -> str:
390
+ try:
391
+ return sniffio.current_async_library()
392
+ except Exception:
393
+ return "false"
394
+
395
+
396
+ def lru_cache(*, maxsize: int | None = 128) -> Callable[[CallableT], CallableT]:
397
+ """A version of functools.lru_cache that retains the type signature
398
+ for the wrapped function arguments.
399
+ """
400
+ wrapper = functools.lru_cache( # noqa: TID251
401
+ maxsize=maxsize,
402
+ )
403
+ return cast(Any, wrapper) # type: ignore[no-any-return]
404
+
405
+
406
+ def json_safe(data: object) -> object:
407
+ """Translates a mapping / sequence recursively in the same fashion
408
+ as `pydantic` v2's `model_dump(mode="json")`.
409
+ """
410
+ if is_mapping(data):
411
+ return {json_safe(key): json_safe(value) for key, value in data.items()}
412
+
413
+ if is_iterable(data) and not isinstance(data, (str, bytes, bytearray)):
414
+ return [json_safe(item) for item in data]
415
+
416
+ if isinstance(data, (datetime, date)):
417
+ return data.isoformat()
418
+
419
+ return data
openmeter/_version.py ADDED
@@ -0,0 +1,4 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ __title__ = "openmeter"
4
+ __version__ = "2.0.0" # x-release-please-version
openmeter/lib/.keep ADDED
@@ -0,0 +1,4 @@
1
+ File generated from our OpenAPI spec by Stainless.
2
+
3
+ This directory can be used to store custom files to expand the SDK.
4
+ It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
openmeter/py.typed CHANGED
@@ -1 +0,0 @@
1
- # Marker file for PEP 561.
@@ -0,0 +1,103 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .debug import (
4
+ DebugResource,
5
+ AsyncDebugResource,
6
+ DebugResourceWithRawResponse,
7
+ AsyncDebugResourceWithRawResponse,
8
+ DebugResourceWithStreamingResponse,
9
+ AsyncDebugResourceWithStreamingResponse,
10
+ )
11
+ from .events import (
12
+ EventsResource,
13
+ AsyncEventsResource,
14
+ EventsResourceWithRawResponse,
15
+ AsyncEventsResourceWithRawResponse,
16
+ EventsResourceWithStreamingResponse,
17
+ AsyncEventsResourceWithStreamingResponse,
18
+ )
19
+ from .meters import (
20
+ MetersResource,
21
+ AsyncMetersResource,
22
+ MetersResourceWithRawResponse,
23
+ AsyncMetersResourceWithRawResponse,
24
+ MetersResourceWithStreamingResponse,
25
+ AsyncMetersResourceWithStreamingResponse,
26
+ )
27
+ from .portal import (
28
+ PortalResource,
29
+ AsyncPortalResource,
30
+ PortalResourceWithRawResponse,
31
+ AsyncPortalResourceWithRawResponse,
32
+ PortalResourceWithStreamingResponse,
33
+ AsyncPortalResourceWithStreamingResponse,
34
+ )
35
+ from .subjects import (
36
+ SubjectsResource,
37
+ AsyncSubjectsResource,
38
+ SubjectsResourceWithRawResponse,
39
+ AsyncSubjectsResourceWithRawResponse,
40
+ SubjectsResourceWithStreamingResponse,
41
+ AsyncSubjectsResourceWithStreamingResponse,
42
+ )
43
+ from .entitlements import (
44
+ EntitlementsResource,
45
+ AsyncEntitlementsResource,
46
+ EntitlementsResourceWithRawResponse,
47
+ AsyncEntitlementsResourceWithRawResponse,
48
+ EntitlementsResourceWithStreamingResponse,
49
+ AsyncEntitlementsResourceWithStreamingResponse,
50
+ )
51
+ from .notifications import (
52
+ NotificationsResource,
53
+ AsyncNotificationsResource,
54
+ NotificationsResourceWithRawResponse,
55
+ AsyncNotificationsResourceWithRawResponse,
56
+ NotificationsResourceWithStreamingResponse,
57
+ AsyncNotificationsResourceWithStreamingResponse,
58
+ )
59
+
60
+ __all__ = [
61
+ "EventsResource",
62
+ "AsyncEventsResource",
63
+ "EventsResourceWithRawResponse",
64
+ "AsyncEventsResourceWithRawResponse",
65
+ "EventsResourceWithStreamingResponse",
66
+ "AsyncEventsResourceWithStreamingResponse",
67
+ "MetersResource",
68
+ "AsyncMetersResource",
69
+ "MetersResourceWithRawResponse",
70
+ "AsyncMetersResourceWithRawResponse",
71
+ "MetersResourceWithStreamingResponse",
72
+ "AsyncMetersResourceWithStreamingResponse",
73
+ "SubjectsResource",
74
+ "AsyncSubjectsResource",
75
+ "SubjectsResourceWithRawResponse",
76
+ "AsyncSubjectsResourceWithRawResponse",
77
+ "SubjectsResourceWithStreamingResponse",
78
+ "AsyncSubjectsResourceWithStreamingResponse",
79
+ "EntitlementsResource",
80
+ "AsyncEntitlementsResource",
81
+ "EntitlementsResourceWithRawResponse",
82
+ "AsyncEntitlementsResourceWithRawResponse",
83
+ "EntitlementsResourceWithStreamingResponse",
84
+ "AsyncEntitlementsResourceWithStreamingResponse",
85
+ "NotificationsResource",
86
+ "AsyncNotificationsResource",
87
+ "NotificationsResourceWithRawResponse",
88
+ "AsyncNotificationsResourceWithRawResponse",
89
+ "NotificationsResourceWithStreamingResponse",
90
+ "AsyncNotificationsResourceWithStreamingResponse",
91
+ "PortalResource",
92
+ "AsyncPortalResource",
93
+ "PortalResourceWithRawResponse",
94
+ "AsyncPortalResourceWithRawResponse",
95
+ "PortalResourceWithStreamingResponse",
96
+ "AsyncPortalResourceWithStreamingResponse",
97
+ "DebugResource",
98
+ "AsyncDebugResource",
99
+ "DebugResourceWithRawResponse",
100
+ "AsyncDebugResourceWithRawResponse",
101
+ "DebugResourceWithStreamingResponse",
102
+ "AsyncDebugResourceWithStreamingResponse",
103
+ ]
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .debug import (
4
+ DebugResource,
5
+ AsyncDebugResource,
6
+ DebugResourceWithRawResponse,
7
+ AsyncDebugResourceWithRawResponse,
8
+ DebugResourceWithStreamingResponse,
9
+ AsyncDebugResourceWithStreamingResponse,
10
+ )
11
+ from .metrics import (
12
+ MetricsResource,
13
+ AsyncMetricsResource,
14
+ MetricsResourceWithRawResponse,
15
+ AsyncMetricsResourceWithRawResponse,
16
+ MetricsResourceWithStreamingResponse,
17
+ AsyncMetricsResourceWithStreamingResponse,
18
+ )
19
+
20
+ __all__ = [
21
+ "MetricsResource",
22
+ "AsyncMetricsResource",
23
+ "MetricsResourceWithRawResponse",
24
+ "AsyncMetricsResourceWithRawResponse",
25
+ "MetricsResourceWithStreamingResponse",
26
+ "AsyncMetricsResourceWithStreamingResponse",
27
+ "DebugResource",
28
+ "AsyncDebugResource",
29
+ "DebugResourceWithRawResponse",
30
+ "AsyncDebugResourceWithRawResponse",
31
+ "DebugResourceWithStreamingResponse",
32
+ "AsyncDebugResourceWithStreamingResponse",
33
+ ]
@@ -0,0 +1,102 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from .metrics import (
6
+ MetricsResource,
7
+ AsyncMetricsResource,
8
+ MetricsResourceWithRawResponse,
9
+ AsyncMetricsResourceWithRawResponse,
10
+ MetricsResourceWithStreamingResponse,
11
+ AsyncMetricsResourceWithStreamingResponse,
12
+ )
13
+ from ..._compat import cached_property
14
+ from ..._resource import SyncAPIResource, AsyncAPIResource
15
+
16
+ __all__ = ["DebugResource", "AsyncDebugResource"]
17
+
18
+
19
+ class DebugResource(SyncAPIResource):
20
+ @cached_property
21
+ def metrics(self) -> MetricsResource:
22
+ return MetricsResource(self._client)
23
+
24
+ @cached_property
25
+ def with_raw_response(self) -> DebugResourceWithRawResponse:
26
+ """
27
+ This property can be used as a prefix for any HTTP method call to return the
28
+ the raw response object instead of the parsed content.
29
+
30
+ For more information, see https://www.github.com/openmeterio/openmeter-python#accessing-raw-response-data-eg-headers
31
+ """
32
+ return DebugResourceWithRawResponse(self)
33
+
34
+ @cached_property
35
+ def with_streaming_response(self) -> DebugResourceWithStreamingResponse:
36
+ """
37
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
38
+
39
+ For more information, see https://www.github.com/openmeterio/openmeter-python#with_streaming_response
40
+ """
41
+ return DebugResourceWithStreamingResponse(self)
42
+
43
+
44
+ class AsyncDebugResource(AsyncAPIResource):
45
+ @cached_property
46
+ def metrics(self) -> AsyncMetricsResource:
47
+ return AsyncMetricsResource(self._client)
48
+
49
+ @cached_property
50
+ def with_raw_response(self) -> AsyncDebugResourceWithRawResponse:
51
+ """
52
+ This property can be used as a prefix for any HTTP method call to return the
53
+ the raw response object instead of the parsed content.
54
+
55
+ For more information, see https://www.github.com/openmeterio/openmeter-python#accessing-raw-response-data-eg-headers
56
+ """
57
+ return AsyncDebugResourceWithRawResponse(self)
58
+
59
+ @cached_property
60
+ def with_streaming_response(self) -> AsyncDebugResourceWithStreamingResponse:
61
+ """
62
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
63
+
64
+ For more information, see https://www.github.com/openmeterio/openmeter-python#with_streaming_response
65
+ """
66
+ return AsyncDebugResourceWithStreamingResponse(self)
67
+
68
+
69
+ class DebugResourceWithRawResponse:
70
+ def __init__(self, debug: DebugResource) -> None:
71
+ self._debug = debug
72
+
73
+ @cached_property
74
+ def metrics(self) -> MetricsResourceWithRawResponse:
75
+ return MetricsResourceWithRawResponse(self._debug.metrics)
76
+
77
+
78
+ class AsyncDebugResourceWithRawResponse:
79
+ def __init__(self, debug: AsyncDebugResource) -> None:
80
+ self._debug = debug
81
+
82
+ @cached_property
83
+ def metrics(self) -> AsyncMetricsResourceWithRawResponse:
84
+ return AsyncMetricsResourceWithRawResponse(self._debug.metrics)
85
+
86
+
87
+ class DebugResourceWithStreamingResponse:
88
+ def __init__(self, debug: DebugResource) -> None:
89
+ self._debug = debug
90
+
91
+ @cached_property
92
+ def metrics(self) -> MetricsResourceWithStreamingResponse:
93
+ return MetricsResourceWithStreamingResponse(self._debug.metrics)
94
+
95
+
96
+ class AsyncDebugResourceWithStreamingResponse:
97
+ def __init__(self, debug: AsyncDebugResource) -> None:
98
+ self._debug = debug
99
+
100
+ @cached_property
101
+ def metrics(self) -> AsyncMetricsResourceWithStreamingResponse:
102
+ return AsyncMetricsResourceWithStreamingResponse(self._debug.metrics)