brellium-api-client 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 (89) hide show
  1. brellium_api_client/__init__.py +98 -0
  2. brellium_api_client/_base_client.py +2904 -0
  3. brellium_api_client/_client.py +721 -0
  4. brellium_api_client/_compat.py +195 -0
  5. brellium_api_client/_constants.py +14 -0
  6. brellium_api_client/_decoding.py +187 -0
  7. brellium_api_client/_event_handler.py +85 -0
  8. brellium_api_client/_exceptions.py +126 -0
  9. brellium_api_client/_files.py +173 -0
  10. brellium_api_client/_models.py +965 -0
  11. brellium_api_client/_qs.py +147 -0
  12. brellium_api_client/_resource.py +43 -0
  13. brellium_api_client/_response.py +842 -0
  14. brellium_api_client/_send_queue.py +90 -0
  15. brellium_api_client/_streaming.py +412 -0
  16. brellium_api_client/_types.py +279 -0
  17. brellium_api_client/_utils/__init__.py +64 -0
  18. brellium_api_client/_utils/_compat.py +45 -0
  19. brellium_api_client/_utils/_datetime_parse.py +156 -0
  20. brellium_api_client/_utils/_json.py +35 -0
  21. brellium_api_client/_utils/_logs.py +356 -0
  22. brellium_api_client/_utils/_path.py +127 -0
  23. brellium_api_client/_utils/_proxy.py +65 -0
  24. brellium_api_client/_utils/_reflection.py +42 -0
  25. brellium_api_client/_utils/_resources_proxy.py +24 -0
  26. brellium_api_client/_utils/_streams.py +12 -0
  27. brellium_api_client/_utils/_sync.py +58 -0
  28. brellium_api_client/_utils/_transform.py +472 -0
  29. brellium_api_client/_utils/_typing.py +156 -0
  30. brellium_api_client/_utils/_utils.py +428 -0
  31. brellium_api_client/_version.py +4 -0
  32. brellium_api_client/py.typed +0 -0
  33. brellium_api_client/resources/__init__.py +89 -0
  34. brellium_api_client/resources/audits.py +597 -0
  35. brellium_api_client/resources/coding_evaluations.py +354 -0
  36. brellium_api_client/resources/documents.py +654 -0
  37. brellium_api_client/resources/email_recipients.py +718 -0
  38. brellium_api_client/resources/question_sets.py +313 -0
  39. brellium_api_client/resources/users.py +852 -0
  40. brellium_api_client/types/__init__.py +49 -0
  41. brellium_api_client/types/audit.py +56 -0
  42. brellium_api_client/types/audit_batch_result.py +59 -0
  43. brellium_api_client/types/audit_batch_update_flags_params.py +22 -0
  44. brellium_api_client/types/audit_display_info_item.py +21 -0
  45. brellium_api_client/types/audit_list.py +26 -0
  46. brellium_api_client/types/audit_list_params.py +56 -0
  47. brellium_api_client/types/audit_person.py +23 -0
  48. brellium_api_client/types/audit_response.py +32 -0
  49. brellium_api_client/types/audit_update_params.py +13 -0
  50. brellium_api_client/types/coding_evaluation.py +54 -0
  51. brellium_api_client/types/coding_evaluation_list.py +26 -0
  52. brellium_api_client/types/coding_evaluation_list_params.py +50 -0
  53. brellium_api_client/types/created_user.py +13 -0
  54. brellium_api_client/types/document.py +64 -0
  55. brellium_api_client/types/document_create_params.py +32 -0
  56. brellium_api_client/types/document_list.py +26 -0
  57. brellium_api_client/types/document_list_params.py +50 -0
  58. brellium_api_client/types/document_update_params.py +16 -0
  59. brellium_api_client/types/document_upload_list.py +26 -0
  60. brellium_api_client/types/document_with_upload.py +15 -0
  61. brellium_api_client/types/em_evaluation.py +85 -0
  62. brellium_api_client/types/email_recipient.py +37 -0
  63. brellium_api_client/types/email_recipient_create_params.py +22 -0
  64. brellium_api_client/types/email_recipient_list.py +26 -0
  65. brellium_api_client/types/email_recipient_list_params.py +38 -0
  66. brellium_api_client/types/email_recipient_update_params.py +22 -0
  67. brellium_api_client/types/icd_code_finding.py +22 -0
  68. brellium_api_client/types/icd_criterion.py +21 -0
  69. brellium_api_client/types/icd_evaluation.py +32 -0
  70. brellium_api_client/types/mdm_data.py +18 -0
  71. brellium_api_client/types/mdm_problem.py +18 -0
  72. brellium_api_client/types/mdm_risk.py +18 -0
  73. brellium_api_client/types/presigned_upload.py +25 -0
  74. brellium_api_client/types/question.py +33 -0
  75. brellium_api_client/types/question_set.py +42 -0
  76. brellium_api_client/types/question_set_list.py +26 -0
  77. brellium_api_client/types/question_set_list_params.py +29 -0
  78. brellium_api_client/types/user.py +37 -0
  79. brellium_api_client/types/user_batch_result.py +59 -0
  80. brellium_api_client/types/user_batch_update_params.py +27 -0
  81. brellium_api_client/types/user_create_params.py +19 -0
  82. brellium_api_client/types/user_invitation.py +17 -0
  83. brellium_api_client/types/user_list.py +26 -0
  84. brellium_api_client/types/user_list_params.py +38 -0
  85. brellium_api_client/types/user_update_params.py +19 -0
  86. brellium_api_client-0.2.0.dist-info/METADATA +183 -0
  87. brellium_api_client-0.2.0.dist-info/RECORD +89 -0
  88. brellium_api_client-0.2.0.dist-info/WHEEL +4 -0
  89. brellium_api_client-0.2.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,147 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any, List, Tuple, Union, Mapping, TypeVar
4
+ from urllib.parse import parse_qs, urlencode
5
+ from typing_extensions import get_args
6
+
7
+ from ._types import NotGiven, ArrayFormat, NestedFormat, not_given
8
+ from ._utils import flatten
9
+
10
+ _T = TypeVar("_T")
11
+
12
+ PrimitiveData = Union[str, int, float, bool, None]
13
+ # this should be Data = Union[PrimitiveData, "List[Data]", "Tuple[Data]", "Mapping[str, Data]"]
14
+ # https://github.com/microsoft/pyright/issues/3555
15
+ Data = Union[PrimitiveData, List[Any], Tuple[Any], "Mapping[str, Any]"]
16
+ Params = Mapping[str, Data]
17
+
18
+
19
+ class Querystring:
20
+ array_format: ArrayFormat
21
+ nested_format: NestedFormat
22
+
23
+ def __init__(
24
+ self,
25
+ *,
26
+ array_format: ArrayFormat = "repeat",
27
+ nested_format: NestedFormat = "brackets",
28
+ ) -> None:
29
+ self.array_format = array_format
30
+ self.nested_format = nested_format
31
+
32
+ def parse(self, query: str) -> Mapping[str, object]:
33
+ # Note: custom format syntax is not supported yet
34
+ return parse_qs(query)
35
+
36
+ def stringify(
37
+ self,
38
+ params: Params,
39
+ *,
40
+ array_format: ArrayFormat | NotGiven = not_given,
41
+ nested_format: NestedFormat | NotGiven = not_given,
42
+ ) -> str:
43
+ return urlencode(
44
+ self.stringify_items(
45
+ params,
46
+ array_format=array_format,
47
+ nested_format=nested_format,
48
+ )
49
+ )
50
+
51
+ def stringify_items(
52
+ self,
53
+ params: Params,
54
+ *,
55
+ array_format: ArrayFormat | NotGiven = not_given,
56
+ nested_format: NestedFormat | NotGiven = not_given,
57
+ ) -> list[tuple[str, str]]:
58
+ opts = Options(
59
+ qs=self,
60
+ array_format=array_format,
61
+ nested_format=nested_format,
62
+ )
63
+ return flatten([self._stringify_item(key, value, opts) for key, value in params.items()])
64
+
65
+ def _stringify_item(
66
+ self,
67
+ key: str,
68
+ value: Data,
69
+ opts: Options,
70
+ ) -> list[tuple[str, str]]:
71
+ if isinstance(value, Mapping):
72
+ items: list[tuple[str, str]] = []
73
+ nested_format = opts.nested_format
74
+ for subkey, subvalue in value.items():
75
+ items.extend(
76
+ self._stringify_item(
77
+ # TODO: error if unknown format
78
+ f"{key}.{subkey}" if nested_format == "dots" else f"{key}[{subkey}]",
79
+ subvalue,
80
+ opts,
81
+ )
82
+ )
83
+ return items
84
+
85
+ if isinstance(value, (list, tuple)):
86
+ array_format = opts.array_format
87
+ if array_format == "comma":
88
+ return [
89
+ (
90
+ key,
91
+ ",".join(self._primitive_value_to_str(item) for item in value if item is not None),
92
+ ),
93
+ ]
94
+ elif array_format == "repeat":
95
+ items = []
96
+ for item in value:
97
+ items.extend(self._stringify_item(key, item, opts))
98
+ return items
99
+ elif array_format == "indices":
100
+ items = []
101
+ for i, item in enumerate(value):
102
+ items.extend(self._stringify_item(f"{key}[{i}]", item, opts))
103
+ return items
104
+ elif array_format == "brackets":
105
+ items = []
106
+ key = key + "[]"
107
+ for item in value:
108
+ items.extend(self._stringify_item(key, item, opts))
109
+ return items
110
+ else:
111
+ raise NotImplementedError(
112
+ f"Unknown array_format value: {array_format}, choose from {', '.join(get_args(ArrayFormat))}"
113
+ )
114
+
115
+ serialised = self._primitive_value_to_str(value)
116
+ if not serialised:
117
+ return []
118
+ return [(key, serialised)]
119
+
120
+ def _primitive_value_to_str(self, value: PrimitiveData) -> str:
121
+ """Renders one query value: booleans as lowercase `true` / `false`, and `None` as empty."""
122
+ if value is None:
123
+ return ""
124
+ if isinstance(value, bool):
125
+ return "true" if value else "false"
126
+ return str(value)
127
+
128
+
129
+ _qs = Querystring()
130
+ parse = _qs.parse
131
+ stringify = _qs.stringify
132
+ stringify_items = _qs.stringify_items
133
+
134
+
135
+ class Options:
136
+ array_format: ArrayFormat
137
+ nested_format: NestedFormat
138
+
139
+ def __init__(
140
+ self,
141
+ qs: Querystring = _qs,
142
+ *,
143
+ array_format: ArrayFormat | NotGiven = not_given,
144
+ nested_format: NestedFormat | NotGiven = not_given,
145
+ ) -> None:
146
+ self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format
147
+ self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format
@@ -0,0 +1,43 @@
1
+ # File generated from our OpenAPI spec by Scalar. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import time
6
+ from typing import TYPE_CHECKING
7
+
8
+ import anyio
9
+
10
+ if TYPE_CHECKING:
11
+ from ._client import BrelliumClient, AsyncBrelliumClient
12
+
13
+
14
+ class SyncAPIResource:
15
+ _client: BrelliumClient
16
+
17
+ def __init__(self, client: BrelliumClient) -> None:
18
+ self._client = client
19
+ self._get = client.get
20
+ self._post = client.post
21
+ self._patch = client.patch
22
+ self._put = client.put
23
+ self._delete = client.delete
24
+ self._get_api_list = client.get_api_list
25
+
26
+ def _sleep(self, seconds: float) -> None:
27
+ time.sleep(seconds)
28
+
29
+
30
+ class AsyncAPIResource:
31
+ _client: AsyncBrelliumClient
32
+
33
+ def __init__(self, client: AsyncBrelliumClient) -> None:
34
+ self._client = client
35
+ self._get = client.get
36
+ self._post = client.post
37
+ self._patch = client.patch
38
+ self._put = client.put
39
+ self._delete = client.delete
40
+ self._get_api_list = client.get_api_list
41
+
42
+ async def _sleep(self, seconds: float) -> None:
43
+ await anyio.sleep(seconds)