recoms 0.1.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 (161) hide show
  1. recoms/__init__.py +329 -0
  2. recoms/_default_clients.py +30 -0
  3. recoms/client.py +328 -0
  4. recoms/comments/__init__.py +34 -0
  5. recoms/comments/client.py +705 -0
  6. recoms/comments/raw_client.py +1805 -0
  7. recoms/comments/types/__init__.py +34 -0
  8. recoms/comments/types/list_comments_request_sort.py +5 -0
  9. recoms/core/__init__.py +135 -0
  10. recoms/core/api_error.py +23 -0
  11. recoms/core/client_wrapper.py +150 -0
  12. recoms/core/datetime_utils.py +70 -0
  13. recoms/core/file.py +67 -0
  14. recoms/core/force_multipart.py +18 -0
  15. recoms/core/http_client.py +975 -0
  16. recoms/core/http_response.py +63 -0
  17. recoms/core/http_sse/__init__.py +42 -0
  18. recoms/core/http_sse/_api.py +455 -0
  19. recoms/core/http_sse/_decoders.py +74 -0
  20. recoms/core/http_sse/_exceptions.py +7 -0
  21. recoms/core/http_sse/_models.py +17 -0
  22. recoms/core/idempotency.py +7 -0
  23. recoms/core/jsonable_encoder.py +133 -0
  24. recoms/core/logging.py +107 -0
  25. recoms/core/pagination.py +165 -0
  26. recoms/core/parse_error.py +36 -0
  27. recoms/core/pydantic_utilities.py +486 -0
  28. recoms/core/query_encoder.py +58 -0
  29. recoms/core/remove_none_from_dict.py +11 -0
  30. recoms/core/request_options.py +43 -0
  31. recoms/core/serialization.py +347 -0
  32. recoms/dashboard/__init__.py +4 -0
  33. recoms/dashboard/client.py +163 -0
  34. recoms/dashboard/raw_client.py +298 -0
  35. recoms/environment.py +7 -0
  36. recoms/errors/__init__.py +68 -0
  37. recoms/errors/bad_request_error.py +11 -0
  38. recoms/errors/conflict_error.py +11 -0
  39. recoms/errors/content_too_large_error.py +11 -0
  40. recoms/errors/forbidden_error.py +11 -0
  41. recoms/errors/internal_server_error.py +11 -0
  42. recoms/errors/method_not_allowed_error.py +11 -0
  43. recoms/errors/not_found_error.py +11 -0
  44. recoms/errors/payment_required_error.py +11 -0
  45. recoms/errors/too_many_requests_error.py +11 -0
  46. recoms/errors/unauthorized_error.py +11 -0
  47. recoms/errors/unprocessable_entity_error.py +11 -0
  48. recoms/me/__init__.py +40 -0
  49. recoms/me/client.py +82 -0
  50. recoms/me/comments/__init__.py +37 -0
  51. recoms/me/comments/client.py +288 -0
  52. recoms/me/comments/raw_client.py +544 -0
  53. recoms/me/comments/types/__init__.py +38 -0
  54. recoms/me/comments/types/list_comments_request_latest_revision_status_item.py +7 -0
  55. recoms/me/comments/types/list_comments_request_sort.py +5 -0
  56. recoms/me/raw_client.py +13 -0
  57. recoms/me/reactions/__init__.py +4 -0
  58. recoms/me/reactions/client.py +183 -0
  59. recoms/me/reactions/raw_client.py +261 -0
  60. recoms/project/__init__.py +42 -0
  61. recoms/project/client.py +730 -0
  62. recoms/project/comments/__init__.py +34 -0
  63. recoms/project/comments/client.py +364 -0
  64. recoms/project/comments/raw_client.py +766 -0
  65. recoms/project/comments/types/__init__.py +34 -0
  66. recoms/project/comments/types/review_comment_decision.py +5 -0
  67. recoms/project/moderation/__init__.py +4 -0
  68. recoms/project/moderation/client.py +151 -0
  69. recoms/project/moderation/raw_client.py +271 -0
  70. recoms/project/provider/__init__.py +34 -0
  71. recoms/project/provider/client.py +242 -0
  72. recoms/project/provider/raw_client.py +502 -0
  73. recoms/project/provider/types/__init__.py +34 -0
  74. recoms/project/provider/types/configure_provider_credential_intent.py +5 -0
  75. recoms/project/raw_client.py +1604 -0
  76. recoms/py.typed +0 -0
  77. recoms/reactions/__init__.py +34 -0
  78. recoms/reactions/client.py +270 -0
  79. recoms/reactions/raw_client.py +708 -0
  80. recoms/reactions/types/__init__.py +34 -0
  81. recoms/reactions/types/set_reaction_request_type.py +5 -0
  82. recoms/resources/__init__.py +4 -0
  83. recoms/resources/client.py +120 -0
  84. recoms/resources/raw_client.py +191 -0
  85. recoms/types/__init__.py +259 -0
  86. recoms/types/accessible_project.py +42 -0
  87. recoms/types/accessible_project_role.py +5 -0
  88. recoms/types/allowed_policy_test.py +17 -0
  89. recoms/types/analytics_bucket.py +5 -0
  90. recoms/types/analytics_range_preset.py +8 -0
  91. recoms/types/author_comment.py +162 -0
  92. recoms/types/author_comment_list_response.py +37 -0
  93. recoms/types/author_comment_response.py +24 -0
  94. recoms/types/author_comment_status.py +5 -0
  95. recoms/types/author_reaction.py +41 -0
  96. recoms/types/author_reaction_list_response.py +37 -0
  97. recoms/types/author_reaction_type.py +5 -0
  98. recoms/types/comment_list_response.py +37 -0
  99. recoms/types/comment_response.py +24 -0
  100. recoms/types/dashboard_comment_list_row.py +127 -0
  101. recoms/types/dashboard_comment_list_row_status.py +7 -0
  102. recoms/types/dashboard_comment_revision.py +157 -0
  103. recoms/types/dashboard_comment_revision_ai_outcome.py +5 -0
  104. recoms/types/dashboard_comment_revision_reviewed_by.py +36 -0
  105. recoms/types/dashboard_comment_revision_status.py +5 -0
  106. recoms/types/dashboard_comment_sort.py +5 -0
  107. recoms/types/dashboard_comment_status.py +7 -0
  108. recoms/types/dashboard_comments.py +55 -0
  109. recoms/types/dashboard_comments_queues.py +31 -0
  110. recoms/types/delete_comment_response.py +24 -0
  111. recoms/types/deleted_comment.py +32 -0
  112. recoms/types/deleted_comment_status.py +5 -0
  113. recoms/types/disallowed_policy_test.py +19 -0
  114. recoms/types/discussion_analytics.py +105 -0
  115. recoms/types/discussion_analytics_comparison.py +64 -0
  116. recoms/types/discussion_analytics_range.py +43 -0
  117. recoms/types/discussion_analytics_series_item.py +74 -0
  118. recoms/types/discussion_analytics_top_authors_item.py +42 -0
  119. recoms/types/discussion_analytics_top_resources_item.py +57 -0
  120. recoms/types/error_response.py +27 -0
  121. recoms/types/error_response_error.py +32 -0
  122. recoms/types/error_response_error_code.py +27 -0
  123. recoms/types/failed_policy_test.py +23 -0
  124. recoms/types/latest_revision.py +32 -0
  125. recoms/types/latest_revision_status.py +5 -0
  126. recoms/types/moderation_analytics.py +98 -0
  127. recoms/types/moderation_analytics_outcomes_item.py +44 -0
  128. recoms/types/moderation_mode.py +5 -0
  129. recoms/types/o_auth_availability.py +20 -0
  130. recoms/types/policy_test_result.py +71 -0
  131. recoms/types/project.py +81 -0
  132. recoms/types/project_action_result.py +46 -0
  133. recoms/types/project_action_result_status.py +5 -0
  134. recoms/types/project_ai_configuration.py +70 -0
  135. recoms/types/project_ai_configuration_availability.py +7 -0
  136. recoms/types/project_ai_configuration_source.py +5 -0
  137. recoms/types/project_analytics.py +30 -0
  138. recoms/types/project_billing_account.py +63 -0
  139. recoms/types/project_billing_account_access_state.py +5 -0
  140. recoms/types/project_billing_account_plan_code.py +5 -0
  141. recoms/types/project_comment_moderation_summary.py +57 -0
  142. recoms/types/project_comment_moderation_summary_comparison.py +31 -0
  143. recoms/types/project_comment_moderation_summary_series_item.py +39 -0
  144. recoms/types/project_context.py +35 -0
  145. recoms/types/project_membership.py +28 -0
  146. recoms/types/project_membership_role.py +5 -0
  147. recoms/types/project_review_queues.py +27 -0
  148. recoms/types/project_usage.py +37 -0
  149. recoms/types/project_usage_period.py +42 -0
  150. recoms/types/public_comment.py +157 -0
  151. recoms/types/public_comment_status.py +5 -0
  152. recoms/types/reaction_response.py +24 -0
  153. recoms/types/reaction_result.py +77 -0
  154. recoms/types/reaction_result_type.py +5 -0
  155. recoms/types/resource_comment_count.py +59 -0
  156. recoms/types/resource_comment_counts_response.py +23 -0
  157. recoms/version.py +3 -0
  158. recoms-0.1.0.dist-info/LICENSE +21 -0
  159. recoms-0.1.0.dist-info/METADATA +263 -0
  160. recoms-0.1.0.dist-info/RECORD +161 -0
  161. recoms-0.1.0.dist-info/WHEEL +4 -0
recoms/__init__.py ADDED
@@ -0,0 +1,329 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from .types import (
10
+ AccessibleProject,
11
+ AccessibleProjectRole,
12
+ AllowedPolicyTest,
13
+ AnalyticsBucket,
14
+ AnalyticsRangePreset,
15
+ AuthorComment,
16
+ AuthorCommentListResponse,
17
+ AuthorCommentResponse,
18
+ AuthorCommentStatus,
19
+ AuthorReaction,
20
+ AuthorReactionListResponse,
21
+ AuthorReactionType,
22
+ CommentListResponse,
23
+ CommentResponse,
24
+ DashboardCommentListRow,
25
+ DashboardCommentListRowStatus,
26
+ DashboardCommentRevision,
27
+ DashboardCommentRevisionAiOutcome,
28
+ DashboardCommentRevisionReviewedBy,
29
+ DashboardCommentRevisionStatus,
30
+ DashboardCommentSort,
31
+ DashboardCommentStatus,
32
+ DashboardComments,
33
+ DashboardCommentsQueues,
34
+ DeleteCommentResponse,
35
+ DeletedComment,
36
+ DeletedCommentStatus,
37
+ DisallowedPolicyTest,
38
+ DiscussionAnalytics,
39
+ DiscussionAnalyticsComparison,
40
+ DiscussionAnalyticsRange,
41
+ DiscussionAnalyticsSeriesItem,
42
+ DiscussionAnalyticsTopAuthorsItem,
43
+ DiscussionAnalyticsTopResourcesItem,
44
+ ErrorResponse,
45
+ ErrorResponseError,
46
+ ErrorResponseErrorCode,
47
+ FailedPolicyTest,
48
+ LatestRevision,
49
+ LatestRevisionStatus,
50
+ ModerationAnalytics,
51
+ ModerationAnalyticsOutcomesItem,
52
+ ModerationMode,
53
+ OAuthAvailability,
54
+ PolicyTestResult,
55
+ PolicyTestResult_Allowed,
56
+ PolicyTestResult_Disallowed,
57
+ PolicyTestResult_Failed,
58
+ Project,
59
+ ProjectActionResult,
60
+ ProjectActionResultStatus,
61
+ ProjectAiConfiguration,
62
+ ProjectAiConfigurationAvailability,
63
+ ProjectAiConfigurationSource,
64
+ ProjectAnalytics,
65
+ ProjectBillingAccount,
66
+ ProjectBillingAccountAccessState,
67
+ ProjectBillingAccountPlanCode,
68
+ ProjectCommentModerationSummary,
69
+ ProjectCommentModerationSummaryComparison,
70
+ ProjectCommentModerationSummarySeriesItem,
71
+ ProjectContext,
72
+ ProjectMembership,
73
+ ProjectMembershipRole,
74
+ ProjectReviewQueues,
75
+ ProjectUsage,
76
+ ProjectUsagePeriod,
77
+ PublicComment,
78
+ PublicCommentStatus,
79
+ ReactionResponse,
80
+ ReactionResult,
81
+ ReactionResultType,
82
+ ResourceCommentCount,
83
+ ResourceCommentCountsResponse,
84
+ )
85
+ from .errors import (
86
+ BadRequestError,
87
+ ConflictError,
88
+ ContentTooLargeError,
89
+ ForbiddenError,
90
+ InternalServerError,
91
+ MethodNotAllowedError,
92
+ NotFoundError,
93
+ PaymentRequiredError,
94
+ TooManyRequestsError,
95
+ UnauthorizedError,
96
+ UnprocessableEntityError,
97
+ )
98
+ from . import comments, dashboard, me, project, reactions, resources
99
+ from ._default_clients import DefaultAioHttpClient, DefaultAsyncHttpxClient
100
+ from .client import AsyncRecomsClient, RecomsClient
101
+ from .comments import ListCommentsRequestSort
102
+ from .environment import RecomsClientEnvironment
103
+ from .reactions import SetReactionRequestType
104
+ from .version import __version__
105
+ _dynamic_imports: typing.Dict[str, str] = {
106
+ "AccessibleProject": ".types",
107
+ "AccessibleProjectRole": ".types",
108
+ "AllowedPolicyTest": ".types",
109
+ "AnalyticsBucket": ".types",
110
+ "AnalyticsRangePreset": ".types",
111
+ "AsyncRecomsClient": ".client",
112
+ "AuthorComment": ".types",
113
+ "AuthorCommentListResponse": ".types",
114
+ "AuthorCommentResponse": ".types",
115
+ "AuthorCommentStatus": ".types",
116
+ "AuthorReaction": ".types",
117
+ "AuthorReactionListResponse": ".types",
118
+ "AuthorReactionType": ".types",
119
+ "BadRequestError": ".errors",
120
+ "CommentListResponse": ".types",
121
+ "CommentResponse": ".types",
122
+ "ConflictError": ".errors",
123
+ "ContentTooLargeError": ".errors",
124
+ "DashboardCommentListRow": ".types",
125
+ "DashboardCommentListRowStatus": ".types",
126
+ "DashboardCommentRevision": ".types",
127
+ "DashboardCommentRevisionAiOutcome": ".types",
128
+ "DashboardCommentRevisionReviewedBy": ".types",
129
+ "DashboardCommentRevisionStatus": ".types",
130
+ "DashboardCommentSort": ".types",
131
+ "DashboardCommentStatus": ".types",
132
+ "DashboardComments": ".types",
133
+ "DashboardCommentsQueues": ".types",
134
+ "DefaultAioHttpClient": "._default_clients",
135
+ "DefaultAsyncHttpxClient": "._default_clients",
136
+ "DeleteCommentResponse": ".types",
137
+ "DeletedComment": ".types",
138
+ "DeletedCommentStatus": ".types",
139
+ "DisallowedPolicyTest": ".types",
140
+ "DiscussionAnalytics": ".types",
141
+ "DiscussionAnalyticsComparison": ".types",
142
+ "DiscussionAnalyticsRange": ".types",
143
+ "DiscussionAnalyticsSeriesItem": ".types",
144
+ "DiscussionAnalyticsTopAuthorsItem": ".types",
145
+ "DiscussionAnalyticsTopResourcesItem": ".types",
146
+ "ErrorResponse": ".types",
147
+ "ErrorResponseError": ".types",
148
+ "ErrorResponseErrorCode": ".types",
149
+ "FailedPolicyTest": ".types",
150
+ "ForbiddenError": ".errors",
151
+ "InternalServerError": ".errors",
152
+ "LatestRevision": ".types",
153
+ "LatestRevisionStatus": ".types",
154
+ "ListCommentsRequestSort": ".comments",
155
+ "MethodNotAllowedError": ".errors",
156
+ "ModerationAnalytics": ".types",
157
+ "ModerationAnalyticsOutcomesItem": ".types",
158
+ "ModerationMode": ".types",
159
+ "NotFoundError": ".errors",
160
+ "OAuthAvailability": ".types",
161
+ "PaymentRequiredError": ".errors",
162
+ "PolicyTestResult": ".types",
163
+ "PolicyTestResult_Allowed": ".types",
164
+ "PolicyTestResult_Disallowed": ".types",
165
+ "PolicyTestResult_Failed": ".types",
166
+ "Project": ".types",
167
+ "ProjectActionResult": ".types",
168
+ "ProjectActionResultStatus": ".types",
169
+ "ProjectAiConfiguration": ".types",
170
+ "ProjectAiConfigurationAvailability": ".types",
171
+ "ProjectAiConfigurationSource": ".types",
172
+ "ProjectAnalytics": ".types",
173
+ "ProjectBillingAccount": ".types",
174
+ "ProjectBillingAccountAccessState": ".types",
175
+ "ProjectBillingAccountPlanCode": ".types",
176
+ "ProjectCommentModerationSummary": ".types",
177
+ "ProjectCommentModerationSummaryComparison": ".types",
178
+ "ProjectCommentModerationSummarySeriesItem": ".types",
179
+ "ProjectContext": ".types",
180
+ "ProjectMembership": ".types",
181
+ "ProjectMembershipRole": ".types",
182
+ "ProjectReviewQueues": ".types",
183
+ "ProjectUsage": ".types",
184
+ "ProjectUsagePeriod": ".types",
185
+ "PublicComment": ".types",
186
+ "PublicCommentStatus": ".types",
187
+ "ReactionResponse": ".types",
188
+ "ReactionResult": ".types",
189
+ "ReactionResultType": ".types",
190
+ "RecomsClient": ".client",
191
+ "RecomsClientEnvironment": ".environment",
192
+ "ResourceCommentCount": ".types",
193
+ "ResourceCommentCountsResponse": ".types",
194
+ "SetReactionRequestType": ".reactions",
195
+ "TooManyRequestsError": ".errors",
196
+ "UnauthorizedError": ".errors",
197
+ "UnprocessableEntityError": ".errors",
198
+ "__version__": ".version",
199
+ "comments": ".comments",
200
+ "dashboard": ".dashboard",
201
+ "me": ".me",
202
+ "project": ".project",
203
+ "reactions": ".reactions",
204
+ "resources": ".resources",
205
+ }
206
+
207
+
208
+ def __getattr__(attr_name: str) -> typing.Any:
209
+ module_name = _dynamic_imports.get(attr_name)
210
+ if module_name is None:
211
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
212
+ try:
213
+ module = import_module(module_name, __package__)
214
+ if module_name == f".{attr_name}":
215
+ return module
216
+ else:
217
+ return getattr(module, attr_name)
218
+ except ImportError as e:
219
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
220
+ except AttributeError as e:
221
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
222
+
223
+
224
+ def __dir__():
225
+ lazy_attrs = list(_dynamic_imports.keys())
226
+ return sorted(lazy_attrs)
227
+
228
+
229
+ __all__ = [
230
+ "AccessibleProject",
231
+ "AccessibleProjectRole",
232
+ "AllowedPolicyTest",
233
+ "AnalyticsBucket",
234
+ "AnalyticsRangePreset",
235
+ "AsyncRecomsClient",
236
+ "AuthorComment",
237
+ "AuthorCommentListResponse",
238
+ "AuthorCommentResponse",
239
+ "AuthorCommentStatus",
240
+ "AuthorReaction",
241
+ "AuthorReactionListResponse",
242
+ "AuthorReactionType",
243
+ "BadRequestError",
244
+ "CommentListResponse",
245
+ "CommentResponse",
246
+ "ConflictError",
247
+ "ContentTooLargeError",
248
+ "DashboardCommentListRow",
249
+ "DashboardCommentListRowStatus",
250
+ "DashboardCommentRevision",
251
+ "DashboardCommentRevisionAiOutcome",
252
+ "DashboardCommentRevisionReviewedBy",
253
+ "DashboardCommentRevisionStatus",
254
+ "DashboardCommentSort",
255
+ "DashboardCommentStatus",
256
+ "DashboardComments",
257
+ "DashboardCommentsQueues",
258
+ "DefaultAioHttpClient",
259
+ "DefaultAsyncHttpxClient",
260
+ "DeleteCommentResponse",
261
+ "DeletedComment",
262
+ "DeletedCommentStatus",
263
+ "DisallowedPolicyTest",
264
+ "DiscussionAnalytics",
265
+ "DiscussionAnalyticsComparison",
266
+ "DiscussionAnalyticsRange",
267
+ "DiscussionAnalyticsSeriesItem",
268
+ "DiscussionAnalyticsTopAuthorsItem",
269
+ "DiscussionAnalyticsTopResourcesItem",
270
+ "ErrorResponse",
271
+ "ErrorResponseError",
272
+ "ErrorResponseErrorCode",
273
+ "FailedPolicyTest",
274
+ "ForbiddenError",
275
+ "InternalServerError",
276
+ "LatestRevision",
277
+ "LatestRevisionStatus",
278
+ "ListCommentsRequestSort",
279
+ "MethodNotAllowedError",
280
+ "ModerationAnalytics",
281
+ "ModerationAnalyticsOutcomesItem",
282
+ "ModerationMode",
283
+ "NotFoundError",
284
+ "OAuthAvailability",
285
+ "PaymentRequiredError",
286
+ "PolicyTestResult",
287
+ "PolicyTestResult_Allowed",
288
+ "PolicyTestResult_Disallowed",
289
+ "PolicyTestResult_Failed",
290
+ "Project",
291
+ "ProjectActionResult",
292
+ "ProjectActionResultStatus",
293
+ "ProjectAiConfiguration",
294
+ "ProjectAiConfigurationAvailability",
295
+ "ProjectAiConfigurationSource",
296
+ "ProjectAnalytics",
297
+ "ProjectBillingAccount",
298
+ "ProjectBillingAccountAccessState",
299
+ "ProjectBillingAccountPlanCode",
300
+ "ProjectCommentModerationSummary",
301
+ "ProjectCommentModerationSummaryComparison",
302
+ "ProjectCommentModerationSummarySeriesItem",
303
+ "ProjectContext",
304
+ "ProjectMembership",
305
+ "ProjectMembershipRole",
306
+ "ProjectReviewQueues",
307
+ "ProjectUsage",
308
+ "ProjectUsagePeriod",
309
+ "PublicComment",
310
+ "PublicCommentStatus",
311
+ "ReactionResponse",
312
+ "ReactionResult",
313
+ "ReactionResultType",
314
+ "RecomsClient",
315
+ "RecomsClientEnvironment",
316
+ "ResourceCommentCount",
317
+ "ResourceCommentCountsResponse",
318
+ "SetReactionRequestType",
319
+ "TooManyRequestsError",
320
+ "UnauthorizedError",
321
+ "UnprocessableEntityError",
322
+ "__version__",
323
+ "comments",
324
+ "dashboard",
325
+ "me",
326
+ "project",
327
+ "reactions",
328
+ "resources",
329
+ ]
@@ -0,0 +1,30 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import httpx
6
+
7
+ SDK_DEFAULT_TIMEOUT = 60
8
+
9
+ try:
10
+ import httpx_aiohttp # type: ignore[import-not-found]
11
+ except ImportError:
12
+
13
+ class DefaultAioHttpClient(httpx.AsyncClient): # type: ignore
14
+ def __init__(self, **kwargs: typing.Any) -> None:
15
+ raise RuntimeError("To use the aiohttp client, install the aiohttp extra: pip install recoms[aiohttp]")
16
+
17
+ else:
18
+
19
+ class DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
20
+ def __init__(self, **kwargs: typing.Any) -> None:
21
+ kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
22
+ kwargs.setdefault("follow_redirects", True)
23
+ super().__init__(**kwargs)
24
+
25
+
26
+ class DefaultAsyncHttpxClient(httpx.AsyncClient):
27
+ def __init__(self, **kwargs: typing.Any) -> None:
28
+ kwargs.setdefault("timeout", SDK_DEFAULT_TIMEOUT)
29
+ kwargs.setdefault("follow_redirects", True)
30
+ super().__init__(**kwargs)
recoms/client.py ADDED
@@ -0,0 +1,328 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from __future__ import annotations
4
+
5
+ import typing
6
+
7
+ import httpx
8
+ from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from .core.logging import LogConfig, Logger
10
+ from .environment import RecomsClientEnvironment
11
+
12
+ if typing.TYPE_CHECKING:
13
+ from .comments.client import AsyncCommentsClient, CommentsClient
14
+ from .dashboard.client import AsyncDashboardClient, DashboardClient
15
+ from .me.client import AsyncMeClient, MeClient
16
+ from .project.client import AsyncProjectClient, ProjectClient
17
+ from .reactions.client import AsyncReactionsClient, ReactionsClient
18
+ from .resources.client import AsyncResourcesClient, ResourcesClient
19
+
20
+
21
+ class RecomsClient:
22
+ """
23
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
24
+
25
+ Parameters
26
+ ----------
27
+ base_url : typing.Optional[str]
28
+ The base url to use for requests from the client.
29
+
30
+ environment : RecomsClientEnvironment
31
+ The environment to use for requests from the client. from .environment import RecomsClientEnvironment
32
+
33
+
34
+
35
+ Defaults to RecomsClientEnvironment.DEFAULT
36
+
37
+
38
+
39
+ token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
40
+ headers : typing.Optional[typing.Dict[str, str]]
41
+ Additional headers to send with every request.
42
+
43
+ timeout : typing.Optional[float]
44
+ The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
45
+
46
+ max_retries : typing.Optional[int]
47
+ The default maximum number of retries for failed requests. Defaults to 0. Per-request `max_retries` in `request_options` takes precedence over this value.
48
+
49
+ stream_reconnection_enabled : typing.Optional[bool]
50
+ Whether to automatically reconnect on stream disconnection for resumable streaming endpoints. Defaults to True. Per-request `stream_reconnection_enabled` in `request_options` takes precedence over this value.
51
+
52
+ max_stream_reconnection_attempts : typing.Optional[int]
53
+ The maximum number of reconnection attempts for resumable streaming endpoints. Defaults to no limit. Per-request `max_stream_reconnection_attempts` in `request_options` takes precedence over this value.
54
+
55
+ follow_redirects : typing.Optional[bool]
56
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
57
+
58
+ httpx_client : typing.Optional[httpx.Client]
59
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
60
+
61
+ logging : typing.Optional[typing.Union[LogConfig, Logger]]
62
+ Configure logging for the SDK. Accepts a LogConfig dict with 'level' (debug/info/warn/error), 'logger' (custom logger implementation), and 'silent' (boolean, defaults to True) fields. You can also pass a pre-configured Logger instance.
63
+
64
+ Examples
65
+ --------
66
+ from recoms import RecomsClient
67
+
68
+ client = RecomsClient(
69
+ token="YOUR_TOKEN",
70
+ )
71
+ """
72
+
73
+ def __init__(
74
+ self,
75
+ *,
76
+ base_url: typing.Optional[str] = None,
77
+ environment: RecomsClientEnvironment = RecomsClientEnvironment.DEFAULT,
78
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
79
+ headers: typing.Optional[typing.Dict[str, str]] = None,
80
+ timeout: typing.Optional[float] = None,
81
+ max_retries: typing.Optional[int] = None,
82
+ stream_reconnection_enabled: typing.Optional[bool] = None,
83
+ max_stream_reconnection_attempts: typing.Optional[int] = None,
84
+ follow_redirects: typing.Optional[bool] = True,
85
+ httpx_client: typing.Optional[httpx.Client] = None,
86
+ logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
87
+ ):
88
+ _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
89
+ _defaulted_max_retries = max_retries if max_retries is not None else 0
90
+ self._client_wrapper = SyncClientWrapper(
91
+ base_url=_get_base_url(base_url=base_url, environment=environment),
92
+ token=token,
93
+ headers=headers,
94
+ httpx_client=httpx_client
95
+ if httpx_client is not None
96
+ else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
97
+ if follow_redirects is not None
98
+ else httpx.Client(timeout=_defaulted_timeout),
99
+ timeout=_defaulted_timeout,
100
+ max_retries=_defaulted_max_retries,
101
+ stream_reconnection_enabled=stream_reconnection_enabled,
102
+ max_stream_reconnection_attempts=max_stream_reconnection_attempts,
103
+ logging=logging,
104
+ )
105
+ self._resources: typing.Optional[ResourcesClient] = None
106
+ self._comments: typing.Optional[CommentsClient] = None
107
+ self._reactions: typing.Optional[ReactionsClient] = None
108
+ self._project: typing.Optional[ProjectClient] = None
109
+ self._dashboard: typing.Optional[DashboardClient] = None
110
+ self._me: typing.Optional[MeClient] = None
111
+
112
+ @property
113
+ def resources(self):
114
+ if self._resources is None:
115
+ from .resources.client import ResourcesClient # noqa: E402
116
+
117
+ self._resources = ResourcesClient(client_wrapper=self._client_wrapper)
118
+ return self._resources
119
+
120
+ @property
121
+ def comments(self):
122
+ if self._comments is None:
123
+ from .comments.client import CommentsClient # noqa: E402
124
+
125
+ self._comments = CommentsClient(client_wrapper=self._client_wrapper)
126
+ return self._comments
127
+
128
+ @property
129
+ def reactions(self):
130
+ if self._reactions is None:
131
+ from .reactions.client import ReactionsClient # noqa: E402
132
+
133
+ self._reactions = ReactionsClient(client_wrapper=self._client_wrapper)
134
+ return self._reactions
135
+
136
+ @property
137
+ def project(self):
138
+ if self._project is None:
139
+ from .project.client import ProjectClient # noqa: E402
140
+
141
+ self._project = ProjectClient(client_wrapper=self._client_wrapper)
142
+ return self._project
143
+
144
+ @property
145
+ def dashboard(self):
146
+ if self._dashboard is None:
147
+ from .dashboard.client import DashboardClient # noqa: E402
148
+
149
+ self._dashboard = DashboardClient(client_wrapper=self._client_wrapper)
150
+ return self._dashboard
151
+
152
+ @property
153
+ def me(self):
154
+ if self._me is None:
155
+ from .me.client import MeClient # noqa: E402
156
+
157
+ self._me = MeClient(client_wrapper=self._client_wrapper)
158
+ return self._me
159
+
160
+
161
+ def _make_default_async_client(
162
+ timeout: typing.Optional[float],
163
+ follow_redirects: typing.Optional[bool],
164
+ ) -> httpx.AsyncClient:
165
+ try:
166
+ import httpx_aiohttp # type: ignore[import-not-found]
167
+ except ImportError:
168
+ pass
169
+ else:
170
+ if follow_redirects is not None:
171
+ return httpx_aiohttp.HttpxAiohttpClient(timeout=timeout, follow_redirects=follow_redirects)
172
+ return httpx_aiohttp.HttpxAiohttpClient(timeout=timeout)
173
+
174
+ if follow_redirects is not None:
175
+ return httpx.AsyncClient(timeout=timeout, follow_redirects=follow_redirects)
176
+ return httpx.AsyncClient(timeout=timeout)
177
+
178
+
179
+ class AsyncRecomsClient:
180
+ """
181
+ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
182
+
183
+ Parameters
184
+ ----------
185
+ base_url : typing.Optional[str]
186
+ The base url to use for requests from the client.
187
+
188
+ environment : RecomsClientEnvironment
189
+ The environment to use for requests from the client. from .environment import RecomsClientEnvironment
190
+
191
+
192
+
193
+ Defaults to RecomsClientEnvironment.DEFAULT
194
+
195
+
196
+
197
+ token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
198
+ headers : typing.Optional[typing.Dict[str, str]]
199
+ Additional headers to send with every request.
200
+
201
+ async_token : typing.Optional[typing.Callable[[], typing.Awaitable[str]]]
202
+ An async callable that returns a bearer token. Use this when token acquisition involves async I/O (e.g., refreshing tokens via an async HTTP client). When provided, this is used instead of the synchronous token for async requests.
203
+
204
+ timeout : typing.Optional[float]
205
+ The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
206
+
207
+ max_retries : typing.Optional[int]
208
+ The default maximum number of retries for failed requests. Defaults to 0. Per-request `max_retries` in `request_options` takes precedence over this value.
209
+
210
+ stream_reconnection_enabled : typing.Optional[bool]
211
+ Whether to automatically reconnect on stream disconnection for resumable streaming endpoints. Defaults to True. Per-request `stream_reconnection_enabled` in `request_options` takes precedence over this value.
212
+
213
+ max_stream_reconnection_attempts : typing.Optional[int]
214
+ The maximum number of reconnection attempts for resumable streaming endpoints. Defaults to no limit. Per-request `max_stream_reconnection_attempts` in `request_options` takes precedence over this value.
215
+
216
+ follow_redirects : typing.Optional[bool]
217
+ Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
218
+
219
+ httpx_client : typing.Optional[httpx.AsyncClient]
220
+ The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
221
+
222
+ logging : typing.Optional[typing.Union[LogConfig, Logger]]
223
+ Configure logging for the SDK. Accepts a LogConfig dict with 'level' (debug/info/warn/error), 'logger' (custom logger implementation), and 'silent' (boolean, defaults to True) fields. You can also pass a pre-configured Logger instance.
224
+
225
+ Examples
226
+ --------
227
+ from recoms import AsyncRecomsClient
228
+
229
+ client = AsyncRecomsClient(
230
+ token="YOUR_TOKEN",
231
+ )
232
+ """
233
+
234
+ def __init__(
235
+ self,
236
+ *,
237
+ base_url: typing.Optional[str] = None,
238
+ environment: RecomsClientEnvironment = RecomsClientEnvironment.DEFAULT,
239
+ token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
240
+ headers: typing.Optional[typing.Dict[str, str]] = None,
241
+ async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None,
242
+ timeout: typing.Optional[float] = None,
243
+ max_retries: typing.Optional[int] = None,
244
+ stream_reconnection_enabled: typing.Optional[bool] = None,
245
+ max_stream_reconnection_attempts: typing.Optional[int] = None,
246
+ follow_redirects: typing.Optional[bool] = True,
247
+ httpx_client: typing.Optional[httpx.AsyncClient] = None,
248
+ logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
249
+ ):
250
+ _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
251
+ _defaulted_max_retries = max_retries if max_retries is not None else 0
252
+ self._client_wrapper = AsyncClientWrapper(
253
+ base_url=_get_base_url(base_url=base_url, environment=environment),
254
+ token=token,
255
+ headers=headers,
256
+ async_token=async_token,
257
+ httpx_client=httpx_client
258
+ if httpx_client is not None
259
+ else _make_default_async_client(timeout=_defaulted_timeout, follow_redirects=follow_redirects),
260
+ timeout=_defaulted_timeout,
261
+ max_retries=_defaulted_max_retries,
262
+ stream_reconnection_enabled=stream_reconnection_enabled,
263
+ max_stream_reconnection_attempts=max_stream_reconnection_attempts,
264
+ logging=logging,
265
+ )
266
+ self._resources: typing.Optional[AsyncResourcesClient] = None
267
+ self._comments: typing.Optional[AsyncCommentsClient] = None
268
+ self._reactions: typing.Optional[AsyncReactionsClient] = None
269
+ self._project: typing.Optional[AsyncProjectClient] = None
270
+ self._dashboard: typing.Optional[AsyncDashboardClient] = None
271
+ self._me: typing.Optional[AsyncMeClient] = None
272
+
273
+ @property
274
+ def resources(self):
275
+ if self._resources is None:
276
+ from .resources.client import AsyncResourcesClient # noqa: E402
277
+
278
+ self._resources = AsyncResourcesClient(client_wrapper=self._client_wrapper)
279
+ return self._resources
280
+
281
+ @property
282
+ def comments(self):
283
+ if self._comments is None:
284
+ from .comments.client import AsyncCommentsClient # noqa: E402
285
+
286
+ self._comments = AsyncCommentsClient(client_wrapper=self._client_wrapper)
287
+ return self._comments
288
+
289
+ @property
290
+ def reactions(self):
291
+ if self._reactions is None:
292
+ from .reactions.client import AsyncReactionsClient # noqa: E402
293
+
294
+ self._reactions = AsyncReactionsClient(client_wrapper=self._client_wrapper)
295
+ return self._reactions
296
+
297
+ @property
298
+ def project(self):
299
+ if self._project is None:
300
+ from .project.client import AsyncProjectClient # noqa: E402
301
+
302
+ self._project = AsyncProjectClient(client_wrapper=self._client_wrapper)
303
+ return self._project
304
+
305
+ @property
306
+ def dashboard(self):
307
+ if self._dashboard is None:
308
+ from .dashboard.client import AsyncDashboardClient # noqa: E402
309
+
310
+ self._dashboard = AsyncDashboardClient(client_wrapper=self._client_wrapper)
311
+ return self._dashboard
312
+
313
+ @property
314
+ def me(self):
315
+ if self._me is None:
316
+ from .me.client import AsyncMeClient # noqa: E402
317
+
318
+ self._me = AsyncMeClient(client_wrapper=self._client_wrapper)
319
+ return self._me
320
+
321
+
322
+ def _get_base_url(*, base_url: typing.Optional[str] = None, environment: RecomsClientEnvironment) -> str:
323
+ if base_url is not None:
324
+ return base_url
325
+ elif environment is not None:
326
+ return environment.value
327
+ else:
328
+ raise Exception("Please pass in either base_url or environment to construct the client")