bulkit 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.
bulkit/_version.py ADDED
@@ -0,0 +1,3 @@
1
+ from __future__ import annotations
2
+
3
+ __version__ = "0.1.0"
bulkit/client.py ADDED
@@ -0,0 +1,146 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+
5
+ import httpx
6
+
7
+ from bulkit._base_client import AsyncAPIClient, SyncAPIClient
8
+ from bulkit._constants import DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT
9
+ from bulkit._types import Timeout
10
+ from bulkit.resources.channels import (
11
+ AsyncChannels,
12
+ AsyncChannelsWithRawResponse,
13
+ Channels,
14
+ ChannelsWithRawResponse,
15
+ )
16
+ from bulkit.resources.media import (
17
+ AsyncMedia,
18
+ AsyncMediaWithRawResponse,
19
+ Media,
20
+ MediaWithRawResponse,
21
+ )
22
+ from bulkit.resources.platforms import (
23
+ AsyncPlatforms,
24
+ AsyncPlatformsWithRawResponse,
25
+ Platforms,
26
+ PlatformsWithRawResponse,
27
+ )
28
+ from bulkit.resources.posts import (
29
+ AsyncPosts,
30
+ AsyncPostsWithRawResponse,
31
+ Posts,
32
+ PostsWithRawResponse,
33
+ )
34
+ from bulkit.resources.stats import (
35
+ AsyncStatsResource,
36
+ AsyncStatsResourceWithRawResponse,
37
+ StatsResource,
38
+ StatsResourceWithRawResponse,
39
+ )
40
+ from bulkit.resources.tags import AsyncTags, AsyncTagsWithRawResponse, Tags, TagsWithRawResponse
41
+ from bulkit.resources.usage import (
42
+ AsyncUsageResource,
43
+ AsyncUsageResourceWithRawResponse,
44
+ UsageResource,
45
+ UsageResourceWithRawResponse,
46
+ )
47
+ from bulkit.resources.webhooks import (
48
+ AsyncWebhooks,
49
+ AsyncWebhooksWithRawResponse,
50
+ Webhooks,
51
+ WebhooksWithRawResponse,
52
+ )
53
+
54
+ __all__ = ["AsyncBulkit", "AsyncBulkitWithRawResponse", "Bulkit", "BulkitWithRawResponse"]
55
+
56
+
57
+ class Bulkit(SyncAPIClient):
58
+ """Client for the Bulkit public API."""
59
+
60
+ def __init__(
61
+ self,
62
+ *,
63
+ api_key: str | None = None,
64
+ base_url: str | None = None,
65
+ timeout: Timeout = DEFAULT_TIMEOUT,
66
+ max_retries: int = DEFAULT_MAX_RETRIES,
67
+ default_headers: Mapping[str, str] | None = None,
68
+ http_client: httpx.Client | None = None,
69
+ ) -> None:
70
+ super().__init__(
71
+ api_key=api_key,
72
+ base_url=base_url,
73
+ timeout=timeout,
74
+ max_retries=max_retries,
75
+ default_headers=default_headers,
76
+ http_client=http_client,
77
+ )
78
+ self.channels = Channels(self)
79
+ self.platforms = Platforms(self)
80
+ self.posts = Posts(self)
81
+ self.media = Media(self)
82
+ self.tags = Tags(self)
83
+ self.stats = StatsResource(self)
84
+ self.usage = UsageResource(self)
85
+ self.webhooks = Webhooks(self)
86
+ self.with_raw_response = BulkitWithRawResponse(self)
87
+
88
+
89
+ class BulkitWithRawResponse:
90
+ """Resource methods returning response metadata and lazily parsed data."""
91
+
92
+ def __init__(self, client: Bulkit) -> None:
93
+ self.channels = ChannelsWithRawResponse(client.channels)
94
+ self.platforms = PlatformsWithRawResponse(client.platforms)
95
+ self.posts = PostsWithRawResponse(client.posts)
96
+ self.media = MediaWithRawResponse(client.media)
97
+ self.tags = TagsWithRawResponse(client.tags)
98
+ self.stats = StatsResourceWithRawResponse(client.stats)
99
+ self.usage = UsageResourceWithRawResponse(client.usage)
100
+ self.webhooks = WebhooksWithRawResponse(client.webhooks)
101
+
102
+
103
+ class AsyncBulkit(AsyncAPIClient):
104
+ """Client for the Bulkit public API."""
105
+
106
+ def __init__(
107
+ self,
108
+ *,
109
+ api_key: str | None = None,
110
+ base_url: str | None = None,
111
+ timeout: Timeout = DEFAULT_TIMEOUT,
112
+ max_retries: int = DEFAULT_MAX_RETRIES,
113
+ default_headers: Mapping[str, str] | None = None,
114
+ http_client: httpx.AsyncClient | None = None,
115
+ ) -> None:
116
+ super().__init__(
117
+ api_key=api_key,
118
+ base_url=base_url,
119
+ timeout=timeout,
120
+ max_retries=max_retries,
121
+ default_headers=default_headers,
122
+ http_client=http_client,
123
+ )
124
+ self.channels = AsyncChannels(self)
125
+ self.platforms = AsyncPlatforms(self)
126
+ self.posts = AsyncPosts(self)
127
+ self.media = AsyncMedia(self)
128
+ self.tags = AsyncTags(self)
129
+ self.stats = AsyncStatsResource(self)
130
+ self.usage = AsyncUsageResource(self)
131
+ self.webhooks = AsyncWebhooks(self)
132
+ self.with_raw_response = AsyncBulkitWithRawResponse(self)
133
+
134
+
135
+ class AsyncBulkitWithRawResponse:
136
+ """Resource methods returning response metadata and lazily parsed data."""
137
+
138
+ def __init__(self, client: AsyncBulkit) -> None:
139
+ self.channels = AsyncChannelsWithRawResponse(client.channels)
140
+ self.platforms = AsyncPlatformsWithRawResponse(client.platforms)
141
+ self.posts = AsyncPostsWithRawResponse(client.posts)
142
+ self.media = AsyncMediaWithRawResponse(client.media)
143
+ self.tags = AsyncTagsWithRawResponse(client.tags)
144
+ self.stats = AsyncStatsResourceWithRawResponse(client.stats)
145
+ self.usage = AsyncUsageResourceWithRawResponse(client.usage)
146
+ self.webhooks = AsyncWebhooksWithRawResponse(client.webhooks)
bulkit/py.typed ADDED
File without changes
@@ -0,0 +1,85 @@
1
+ from __future__ import annotations
2
+
3
+ from .channels import AsyncChannels as AsyncChannels
4
+ from .channels import AsyncChannelsWithRawResponse as AsyncChannelsWithRawResponse
5
+ from .channels import Channels as Channels
6
+ from .channels import ChannelsWithRawResponse as ChannelsWithRawResponse
7
+ from .media import AsyncMedia as AsyncMedia
8
+ from .media import AsyncMediaUploads as AsyncMediaUploads
9
+ from .media import AsyncMediaUploadsWithRawResponse as AsyncMediaUploadsWithRawResponse
10
+ from .media import AsyncMediaWithRawResponse as AsyncMediaWithRawResponse
11
+ from .media import Media as Media
12
+ from .media import MediaUploads as MediaUploads
13
+ from .media import MediaUploadsWithRawResponse as MediaUploadsWithRawResponse
14
+ from .media import MediaWithRawResponse as MediaWithRawResponse
15
+ from .platforms import AsyncPlatforms as AsyncPlatforms
16
+ from .platforms import AsyncPlatformsWithRawResponse as AsyncPlatformsWithRawResponse
17
+ from .platforms import Platforms as Platforms
18
+ from .platforms import PlatformsWithRawResponse as PlatformsWithRawResponse
19
+ from .posts import AsyncComments as AsyncComments
20
+ from .posts import AsyncCommentsWithRawResponse as AsyncCommentsWithRawResponse
21
+ from .posts import AsyncPosts as AsyncPosts
22
+ from .posts import AsyncPostsWithRawResponse as AsyncPostsWithRawResponse
23
+ from .posts import Comments as Comments
24
+ from .posts import CommentsWithRawResponse as CommentsWithRawResponse
25
+ from .posts import Posts as Posts
26
+ from .posts import PostsWithRawResponse as PostsWithRawResponse
27
+ from .stats import AsyncStatsResource as AsyncStatsResource
28
+ from .stats import AsyncStatsResourceWithRawResponse as AsyncStatsResourceWithRawResponse
29
+ from .stats import StatsResource as StatsResource
30
+ from .stats import StatsResourceWithRawResponse as StatsResourceWithRawResponse
31
+ from .tags import AsyncTags as AsyncTags
32
+ from .tags import AsyncTagsWithRawResponse as AsyncTagsWithRawResponse
33
+ from .tags import Tags as Tags
34
+ from .tags import TagsWithRawResponse as TagsWithRawResponse
35
+ from .usage import AsyncUsageResource as AsyncUsageResource
36
+ from .usage import AsyncUsageResourceWithRawResponse as AsyncUsageResourceWithRawResponse
37
+ from .usage import UsageResource as UsageResource
38
+ from .usage import UsageResourceWithRawResponse as UsageResourceWithRawResponse
39
+ from .webhooks import AsyncWebhooks as AsyncWebhooks
40
+ from .webhooks import AsyncWebhooksWithRawResponse as AsyncWebhooksWithRawResponse
41
+ from .webhooks import Webhooks as Webhooks
42
+ from .webhooks import WebhooksWithRawResponse as WebhooksWithRawResponse
43
+
44
+ __all__ = [
45
+ "AsyncChannels",
46
+ "AsyncChannelsWithRawResponse",
47
+ "AsyncComments",
48
+ "AsyncCommentsWithRawResponse",
49
+ "AsyncMedia",
50
+ "AsyncMediaUploads",
51
+ "AsyncMediaUploadsWithRawResponse",
52
+ "AsyncMediaWithRawResponse",
53
+ "AsyncPlatforms",
54
+ "AsyncPlatformsWithRawResponse",
55
+ "AsyncPosts",
56
+ "AsyncPostsWithRawResponse",
57
+ "AsyncStatsResource",
58
+ "AsyncStatsResourceWithRawResponse",
59
+ "AsyncTags",
60
+ "AsyncTagsWithRawResponse",
61
+ "AsyncUsageResource",
62
+ "AsyncUsageResourceWithRawResponse",
63
+ "AsyncWebhooks",
64
+ "AsyncWebhooksWithRawResponse",
65
+ "Channels",
66
+ "ChannelsWithRawResponse",
67
+ "Comments",
68
+ "CommentsWithRawResponse",
69
+ "Media",
70
+ "MediaUploads",
71
+ "MediaUploadsWithRawResponse",
72
+ "MediaWithRawResponse",
73
+ "Platforms",
74
+ "PlatformsWithRawResponse",
75
+ "Posts",
76
+ "PostsWithRawResponse",
77
+ "StatsResource",
78
+ "StatsResourceWithRawResponse",
79
+ "Tags",
80
+ "TagsWithRawResponse",
81
+ "UsageResource",
82
+ "UsageResourceWithRawResponse",
83
+ "Webhooks",
84
+ "WebhooksWithRawResponse",
85
+ ]
@@ -0,0 +1,305 @@
1
+ from __future__ import annotations
2
+
3
+ # Resources intentionally share the SDK's internal transport contract.
4
+ # pyright: reportPrivateUsage=false
5
+ from pydantic import TypeAdapter
6
+
7
+ from bulkit._base_client import AsyncAPIClient, SyncAPIClient, encode_path_param
8
+ from bulkit._resource import AsyncAPIResource, SyncAPIResource
9
+ from bulkit._response import APIResponse
10
+ from bulkit._types import NOT_GIVEN, Headers, NotGiven, NotGivenOr, Query, RequestOptions, Timeout
11
+ from bulkit.types.channel import Channel, ChannelCapabilities, OptionChoices
12
+ from bulkit.types.shared import OptionChoice
13
+
14
+ __all__ = ["AsyncChannels", "AsyncChannelsWithRawResponse", "Channels", "ChannelsWithRawResponse"]
15
+
16
+ _CHANNELS_ADAPTER: TypeAdapter[list[Channel]] = TypeAdapter(list[Channel])
17
+ _OPTION_CHOICES_ADAPTER: TypeAdapter[OptionChoices] = TypeAdapter(list[OptionChoice])
18
+
19
+
20
+ class Channels(SyncAPIResource):
21
+ def __init__(self, client: SyncAPIClient) -> None:
22
+ super().__init__(client)
23
+ self._with_raw_response = ChannelsWithRawResponse(self)
24
+
25
+ def list(
26
+ self,
27
+ *,
28
+ extra_headers: Headers | None = None,
29
+ extra_query: Query | None = None,
30
+ timeout: Timeout | NotGiven = NOT_GIVEN,
31
+ max_retries: int | NotGiven = NOT_GIVEN,
32
+ ) -> list[Channel]:
33
+ return self._with_raw_response.list(
34
+ extra_headers=extra_headers,
35
+ extra_query=extra_query,
36
+ timeout=timeout,
37
+ max_retries=max_retries,
38
+ ).parse()
39
+
40
+ def capabilities(
41
+ self,
42
+ channel_id: str,
43
+ *,
44
+ extra_headers: Headers | None = None,
45
+ extra_query: Query | None = None,
46
+ timeout: Timeout | NotGiven = NOT_GIVEN,
47
+ max_retries: int | NotGiven = NOT_GIVEN,
48
+ ) -> ChannelCapabilities:
49
+ return self._with_raw_response.capabilities(
50
+ channel_id,
51
+ extra_headers=extra_headers,
52
+ extra_query=extra_query,
53
+ timeout=timeout,
54
+ max_retries=max_retries,
55
+ ).parse()
56
+
57
+ def option_choices(
58
+ self,
59
+ channel_id: str,
60
+ key: str,
61
+ *,
62
+ q: NotGivenOr[str] = NOT_GIVEN,
63
+ value: NotGivenOr[str] = NOT_GIVEN,
64
+ extra_headers: Headers | None = None,
65
+ extra_query: Query | None = None,
66
+ timeout: Timeout | NotGiven = NOT_GIVEN,
67
+ max_retries: int | NotGiven = NOT_GIVEN,
68
+ ) -> OptionChoices:
69
+ return self._with_raw_response.option_choices(
70
+ channel_id,
71
+ key,
72
+ q=q,
73
+ value=value,
74
+ extra_headers=extra_headers,
75
+ extra_query=extra_query,
76
+ timeout=timeout,
77
+ max_retries=max_retries,
78
+ ).parse()
79
+
80
+
81
+ class ChannelsWithRawResponse:
82
+ def __init__(self, resource: Channels) -> None:
83
+ self._resource = resource
84
+ self._client = resource._client
85
+
86
+ def list(
87
+ self,
88
+ *,
89
+ extra_headers: Headers | None = None,
90
+ extra_query: Query | None = None,
91
+ timeout: Timeout | NotGiven = NOT_GIVEN,
92
+ max_retries: int | NotGiven = NOT_GIVEN,
93
+ ) -> APIResponse[list[Channel]]:
94
+ options: RequestOptions = {
95
+ "extra_headers": extra_headers,
96
+ "extra_query": extra_query,
97
+ "timeout": timeout,
98
+ "max_retries": max_retries,
99
+ }
100
+ return self._client._request(
101
+ "GET",
102
+ "/channels",
103
+ cast_to=_CHANNELS_ADAPTER,
104
+ query=None,
105
+ json_body=None,
106
+ options=options,
107
+ )
108
+
109
+ def capabilities(
110
+ self,
111
+ channel_id: str,
112
+ *,
113
+ extra_headers: Headers | None = None,
114
+ extra_query: Query | None = None,
115
+ timeout: Timeout | NotGiven = NOT_GIVEN,
116
+ max_retries: int | NotGiven = NOT_GIVEN,
117
+ ) -> APIResponse[ChannelCapabilities]:
118
+ options: RequestOptions = {
119
+ "extra_headers": extra_headers,
120
+ "extra_query": extra_query,
121
+ "timeout": timeout,
122
+ "max_retries": max_retries,
123
+ }
124
+ return self._client._request(
125
+ "GET",
126
+ f"/channels/{encode_path_param(channel_id, 'channel_id')}/capabilities",
127
+ cast_to=ChannelCapabilities,
128
+ query=None,
129
+ json_body=None,
130
+ options=options,
131
+ )
132
+
133
+ def option_choices(
134
+ self,
135
+ channel_id: str,
136
+ key: str,
137
+ *,
138
+ q: NotGivenOr[str] = NOT_GIVEN,
139
+ value: NotGivenOr[str] = NOT_GIVEN,
140
+ extra_headers: Headers | None = None,
141
+ extra_query: Query | None = None,
142
+ timeout: Timeout | NotGiven = NOT_GIVEN,
143
+ max_retries: int | NotGiven = NOT_GIVEN,
144
+ ) -> APIResponse[OptionChoices]:
145
+ options: RequestOptions = {
146
+ "extra_headers": extra_headers,
147
+ "extra_query": extra_query,
148
+ "timeout": timeout,
149
+ "max_retries": max_retries,
150
+ }
151
+ return self._client._request(
152
+ "GET",
153
+ f"/channels/{encode_path_param(channel_id, 'channel_id')}/options/{encode_path_param(key, 'key')}/choices",
154
+ cast_to=_OPTION_CHOICES_ADAPTER,
155
+ query={"q": q, "value": value},
156
+ json_body=None,
157
+ options=options,
158
+ )
159
+
160
+
161
+ class AsyncChannels(AsyncAPIResource):
162
+ def __init__(self, client: AsyncAPIClient) -> None:
163
+ super().__init__(client)
164
+ self._with_raw_response = AsyncChannelsWithRawResponse(self)
165
+
166
+ async def list(
167
+ self,
168
+ *,
169
+ extra_headers: Headers | None = None,
170
+ extra_query: Query | None = None,
171
+ timeout: Timeout | NotGiven = NOT_GIVEN,
172
+ max_retries: int | NotGiven = NOT_GIVEN,
173
+ ) -> list[Channel]:
174
+ return (
175
+ await self._with_raw_response.list(
176
+ extra_headers=extra_headers,
177
+ extra_query=extra_query,
178
+ timeout=timeout,
179
+ max_retries=max_retries,
180
+ )
181
+ ).parse()
182
+
183
+ async def capabilities(
184
+ self,
185
+ channel_id: str,
186
+ *,
187
+ extra_headers: Headers | None = None,
188
+ extra_query: Query | None = None,
189
+ timeout: Timeout | NotGiven = NOT_GIVEN,
190
+ max_retries: int | NotGiven = NOT_GIVEN,
191
+ ) -> ChannelCapabilities:
192
+ return (
193
+ await self._with_raw_response.capabilities(
194
+ channel_id,
195
+ extra_headers=extra_headers,
196
+ extra_query=extra_query,
197
+ timeout=timeout,
198
+ max_retries=max_retries,
199
+ )
200
+ ).parse()
201
+
202
+ async def option_choices(
203
+ self,
204
+ channel_id: str,
205
+ key: str,
206
+ *,
207
+ q: NotGivenOr[str] = NOT_GIVEN,
208
+ value: NotGivenOr[str] = NOT_GIVEN,
209
+ extra_headers: Headers | None = None,
210
+ extra_query: Query | None = None,
211
+ timeout: Timeout | NotGiven = NOT_GIVEN,
212
+ max_retries: int | NotGiven = NOT_GIVEN,
213
+ ) -> OptionChoices:
214
+ return (
215
+ await self._with_raw_response.option_choices(
216
+ channel_id,
217
+ key,
218
+ q=q,
219
+ value=value,
220
+ extra_headers=extra_headers,
221
+ extra_query=extra_query,
222
+ timeout=timeout,
223
+ max_retries=max_retries,
224
+ )
225
+ ).parse()
226
+
227
+
228
+ class AsyncChannelsWithRawResponse:
229
+ def __init__(self, resource: AsyncChannels) -> None:
230
+ self._resource = resource
231
+ self._client = resource._client
232
+
233
+ async def list(
234
+ self,
235
+ *,
236
+ extra_headers: Headers | None = None,
237
+ extra_query: Query | None = None,
238
+ timeout: Timeout | NotGiven = NOT_GIVEN,
239
+ max_retries: int | NotGiven = NOT_GIVEN,
240
+ ) -> APIResponse[list[Channel]]:
241
+ options: RequestOptions = {
242
+ "extra_headers": extra_headers,
243
+ "extra_query": extra_query,
244
+ "timeout": timeout,
245
+ "max_retries": max_retries,
246
+ }
247
+ return await self._client._request(
248
+ "GET",
249
+ "/channels",
250
+ cast_to=_CHANNELS_ADAPTER,
251
+ query=None,
252
+ json_body=None,
253
+ options=options,
254
+ )
255
+
256
+ async def capabilities(
257
+ self,
258
+ channel_id: str,
259
+ *,
260
+ extra_headers: Headers | None = None,
261
+ extra_query: Query | None = None,
262
+ timeout: Timeout | NotGiven = NOT_GIVEN,
263
+ max_retries: int | NotGiven = NOT_GIVEN,
264
+ ) -> APIResponse[ChannelCapabilities]:
265
+ options: RequestOptions = {
266
+ "extra_headers": extra_headers,
267
+ "extra_query": extra_query,
268
+ "timeout": timeout,
269
+ "max_retries": max_retries,
270
+ }
271
+ return await self._client._request(
272
+ "GET",
273
+ f"/channels/{encode_path_param(channel_id, 'channel_id')}/capabilities",
274
+ cast_to=ChannelCapabilities,
275
+ query=None,
276
+ json_body=None,
277
+ options=options,
278
+ )
279
+
280
+ async def option_choices(
281
+ self,
282
+ channel_id: str,
283
+ key: str,
284
+ *,
285
+ q: NotGivenOr[str] = NOT_GIVEN,
286
+ value: NotGivenOr[str] = NOT_GIVEN,
287
+ extra_headers: Headers | None = None,
288
+ extra_query: Query | None = None,
289
+ timeout: Timeout | NotGiven = NOT_GIVEN,
290
+ max_retries: int | NotGiven = NOT_GIVEN,
291
+ ) -> APIResponse[OptionChoices]:
292
+ options: RequestOptions = {
293
+ "extra_headers": extra_headers,
294
+ "extra_query": extra_query,
295
+ "timeout": timeout,
296
+ "max_retries": max_retries,
297
+ }
298
+ return await self._client._request(
299
+ "GET",
300
+ f"/channels/{encode_path_param(channel_id, 'channel_id')}/options/{encode_path_param(key, 'key')}/choices",
301
+ cast_to=_OPTION_CHOICES_ADAPTER,
302
+ query={"q": q, "value": value},
303
+ json_body=None,
304
+ options=options,
305
+ )