bannerify 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. bannerify-0.2.0/PKG-INFO +520 -0
  2. bannerify-0.2.0/README-PYPI.md +497 -0
  3. bannerify-0.2.0/py.typed +1 -0
  4. bannerify-0.2.0/pyproject.toml +56 -0
  5. bannerify-0.2.0/src/bannerify/__init__.py +5 -0
  6. bannerify-0.2.0/src/bannerify/_hooks/__init__.py +4 -0
  7. bannerify-0.2.0/src/bannerify/_hooks/sdkhooks.py +55 -0
  8. bannerify-0.2.0/src/bannerify/_hooks/types.py +76 -0
  9. bannerify-0.2.0/src/bannerify/basesdk.py +253 -0
  10. bannerify-0.2.0/src/bannerify/httpclient.py +78 -0
  11. bannerify-0.2.0/src/bannerify/models/__init__.py +19 -0
  12. bannerify-0.2.0/src/bannerify/models/errbadrequest.py +50 -0
  13. bannerify-0.2.0/src/bannerify/models/errconflict.py +51 -0
  14. bannerify-0.2.0/src/bannerify/models/errfetchimageerror.py +50 -0
  15. bannerify-0.2.0/src/bannerify/models/errforbidden.py +51 -0
  16. bannerify-0.2.0/src/bannerify/models/errinternalservererror.py +51 -0
  17. bannerify-0.2.0/src/bannerify/models/errnotfound.py +51 -0
  18. bannerify-0.2.0/src/bannerify/models/errtoomanyrequests.py +51 -0
  19. bannerify-0.2.0/src/bannerify/models/errunauthorized.py +51 -0
  20. bannerify-0.2.0/src/bannerify/models/get_v1_infoop.py +51 -0
  21. bannerify-0.2.0/src/bannerify/models/get_v1_templates_signedurlop.py +54 -0
  22. bannerify-0.2.0/src/bannerify/models/modification.py +53 -0
  23. bannerify-0.2.0/src/bannerify/models/post_v1_templates_createimageop.py +59 -0
  24. bannerify-0.2.0/src/bannerify/models/post_v1_templates_createpdfop.py +41 -0
  25. bannerify-0.2.0/src/bannerify/models/sdkerror.py +22 -0
  26. bannerify-0.2.0/src/bannerify/models/security.py +16 -0
  27. bannerify-0.2.0/src/bannerify/py.typed +1 -0
  28. bannerify-0.2.0/src/bannerify/sdk.py +856 -0
  29. bannerify-0.2.0/src/bannerify/sdkconfiguration.py +49 -0
  30. bannerify-0.2.0/src/bannerify/types/__init__.py +21 -0
  31. bannerify-0.2.0/src/bannerify/types/basemodel.py +39 -0
  32. bannerify-0.2.0/src/bannerify/utils/__init__.py +84 -0
  33. bannerify-0.2.0/src/bannerify/utils/annotations.py +19 -0
  34. bannerify-0.2.0/src/bannerify/utils/enums.py +34 -0
  35. bannerify-0.2.0/src/bannerify/utils/eventstreaming.py +178 -0
  36. bannerify-0.2.0/src/bannerify/utils/forms.py +208 -0
  37. bannerify-0.2.0/src/bannerify/utils/headers.py +136 -0
  38. bannerify-0.2.0/src/bannerify/utils/logger.py +19 -0
  39. bannerify-0.2.0/src/bannerify/utils/metadata.py +118 -0
  40. bannerify-0.2.0/src/bannerify/utils/queryparams.py +205 -0
  41. bannerify-0.2.0/src/bannerify/utils/requestbodies.py +66 -0
  42. bannerify-0.2.0/src/bannerify/utils/retries.py +216 -0
  43. bannerify-0.2.0/src/bannerify/utils/security.py +168 -0
  44. bannerify-0.2.0/src/bannerify/utils/serializers.py +190 -0
  45. bannerify-0.2.0/src/bannerify/utils/url.py +155 -0
  46. bannerify-0.2.0/src/bannerify/utils/values.py +134 -0
@@ -0,0 +1,520 @@
1
+ Metadata-Version: 2.1
2
+ Name: bannerify
3
+ Version: 0.2.0
4
+ Summary: Python Client SDK Generated by Speakeasy.
5
+ Home-page: https://github.com/bannerify/bannerify-python.git
6
+ Author: Speakeasy
7
+ Requires-Python: >=3.8,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.8
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Dist: eval-type-backport (>=0.2.0,<0.3.0)
15
+ Requires-Dist: httpx (>=0.27.0,<0.28.0)
16
+ Requires-Dist: jsonpath-python (>=1.0.6,<2.0.0)
17
+ Requires-Dist: pydantic (>=2.8.2,<2.9.0)
18
+ Requires-Dist: python-dateutil (==2.8.2)
19
+ Requires-Dist: typing-inspect (>=0.9.0,<0.10.0)
20
+ Project-URL: Repository, https://github.com/bannerify/bannerify-python.git
21
+ Description-Content-Type: text/markdown
22
+
23
+ # bannerify
24
+
25
+ <!-- Start SDK Installation [installation] -->
26
+ ## SDK Installation
27
+
28
+ PIP
29
+ ```bash
30
+ pip install bannerify
31
+ ```
32
+
33
+ Poetry
34
+ ```bash
35
+ poetry add bannerify
36
+ ```
37
+ <!-- End SDK Installation [installation] -->
38
+
39
+ <!-- Start SDK Example Usage [usage] -->
40
+ ## SDK Example Usage
41
+
42
+ ### Example
43
+
44
+ ```python
45
+ # Synchronous Example
46
+ from bannerify import Bannerify
47
+
48
+ s = Bannerify(
49
+ token="BANNERIFY_API_KEY",
50
+ )
51
+
52
+
53
+ res = s.post_v1_templates_create_image(request={
54
+ "api_key": "<value>",
55
+ "template_id": "tpl_xxxxxxxxx",
56
+ "modifications": [
57
+ {
58
+ "name": "Text 1",
59
+ "color": "#FF0000",
60
+ "src": "https://example.com/image.jpg",
61
+ "text": "Hello World",
62
+ "barcode": "1234567890",
63
+ "qrcode": "Some text",
64
+ "visible": True,
65
+ "star": 5,
66
+ },
67
+ ],
68
+ })
69
+
70
+ if res is not None:
71
+ # handle response
72
+ pass
73
+ ```
74
+
75
+ </br>
76
+
77
+ The same SDK client can also be used to make asychronous requests by importing asyncio.
78
+ ```python
79
+ # Asynchronous Example
80
+ import asyncio
81
+ from bannerify import Bannerify
82
+
83
+ async def main():
84
+ s = Bannerify(
85
+ token="BANNERIFY_API_KEY",
86
+ )
87
+ res = await s.post_v1_templates_create_image_async(request={
88
+ "api_key": "<value>",
89
+ "template_id": "tpl_xxxxxxxxx",
90
+ "modifications": [
91
+ {
92
+ "name": "Text 1",
93
+ "color": "#FF0000",
94
+ "src": "https://example.com/image.jpg",
95
+ "text": "Hello World",
96
+ "barcode": "1234567890",
97
+ "qrcode": "Some text",
98
+ "visible": True,
99
+ "star": 5,
100
+ },
101
+ ],
102
+ })
103
+ if res is not None:
104
+ # handle response
105
+ pass
106
+
107
+ asyncio.run(main())
108
+ ```
109
+ <!-- End SDK Example Usage [usage] -->
110
+
111
+ <!-- Start Available Resources and Operations [operations] -->
112
+ ## Available Resources and Operations
113
+
114
+ ### [Bannerify SDK](https://github.com/bannerify/bannerify-python/blob/master/docs/sdks/bannerify/README.md)
115
+
116
+ * [post_v1_templates_create_image](https://github.com/bannerify/bannerify-python/blob/master/docs/sdks/bannerify/README.md#post_v1_templates_create_image) - Create an image from a template
117
+ * [post_v1_templates_create_pdf](https://github.com/bannerify/bannerify-python/blob/master/docs/sdks/bannerify/README.md#post_v1_templates_create_pdf)
118
+ * [get_v1_templates_signedurl](https://github.com/bannerify/bannerify-python/blob/master/docs/sdks/bannerify/README.md#get_v1_templates_signedurl) - Generate a signed URL for a template
119
+ * [get_v1_info](https://github.com/bannerify/bannerify-python/blob/master/docs/sdks/bannerify/README.md#get_v1_info) - Get project info
120
+ <!-- End Available Resources and Operations [operations] -->
121
+
122
+ <!-- Start Retries [retries] -->
123
+ ## Retries
124
+
125
+ Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
126
+
127
+ To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
128
+ ```python
129
+ from bannerify import Bannerify
130
+ from bannerify.utils import BackoffStrategy, RetryConfig
131
+
132
+ s = Bannerify(
133
+ token="BANNERIFY_API_KEY",
134
+ )
135
+
136
+
137
+ res = s.post_v1_templates_create_image(request={
138
+ "api_key": "<value>",
139
+ "template_id": "tpl_xxxxxxxxx",
140
+ "modifications": [
141
+ {
142
+ "name": "Text 1",
143
+ "color": "#FF0000",
144
+ "src": "https://example.com/image.jpg",
145
+ "text": "Hello World",
146
+ "barcode": "1234567890",
147
+ "qrcode": "Some text",
148
+ "visible": True,
149
+ "star": 5,
150
+ },
151
+ ],
152
+ },
153
+ RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
154
+
155
+ if res is not None:
156
+ # handle response
157
+ pass
158
+
159
+ ```
160
+
161
+ If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
162
+ ```python
163
+ from bannerify import Bannerify
164
+ from bannerify.utils import BackoffStrategy, RetryConfig
165
+
166
+ s = Bannerify(
167
+ retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
168
+ token="BANNERIFY_API_KEY",
169
+ )
170
+
171
+
172
+ res = s.post_v1_templates_create_image(request={
173
+ "api_key": "<value>",
174
+ "template_id": "tpl_xxxxxxxxx",
175
+ "modifications": [
176
+ {
177
+ "name": "Text 1",
178
+ "color": "#FF0000",
179
+ "src": "https://example.com/image.jpg",
180
+ "text": "Hello World",
181
+ "barcode": "1234567890",
182
+ "qrcode": "Some text",
183
+ "visible": True,
184
+ "star": 5,
185
+ },
186
+ ],
187
+ })
188
+
189
+ if res is not None:
190
+ # handle response
191
+ pass
192
+
193
+ ```
194
+ <!-- End Retries [retries] -->
195
+
196
+ <!-- Start Error Handling [errors] -->
197
+ ## Error Handling
198
+
199
+ Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.
200
+
201
+ | Error Object | Status Code | Content Type |
202
+ | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- |
203
+ | models.PostV1TemplatesCreateImageResponseBody | 400 | application/json |
204
+ | models.ErrUnauthorized | 401 | application/json |
205
+ | models.ErrForbidden | 403 | application/json |
206
+ | models.ErrNotFound | 404 | application/json |
207
+ | models.ErrConflict | 409 | application/json |
208
+ | models.ErrTooManyRequests | 429 | application/json |
209
+ | models.ErrInternalServerError | 500 | application/json |
210
+ | models.SDKError | 4xx-5xx | */* |
211
+
212
+ ### Example
213
+
214
+ ```python
215
+ from bannerify import Bannerify, models
216
+
217
+ s = Bannerify(
218
+ token="BANNERIFY_API_KEY",
219
+ )
220
+
221
+ res = None
222
+ try:
223
+ res = s.post_v1_templates_create_image(request={
224
+ "api_key": "<value>",
225
+ "template_id": "tpl_xxxxxxxxx",
226
+ "modifications": [
227
+ {
228
+ "name": "Text 1",
229
+ "color": "#FF0000",
230
+ "src": "https://example.com/image.jpg",
231
+ "text": "Hello World",
232
+ "barcode": "1234567890",
233
+ "qrcode": "Some text",
234
+ "visible": True,
235
+ "star": 5,
236
+ },
237
+ ],
238
+ })
239
+
240
+ except models.PostV1TemplatesCreateImageResponseBody as e:
241
+ # handle exception
242
+ raise(e)
243
+ except models.ErrUnauthorized as e:
244
+ # handle exception
245
+ raise(e)
246
+ except models.ErrForbidden as e:
247
+ # handle exception
248
+ raise(e)
249
+ except models.ErrNotFound as e:
250
+ # handle exception
251
+ raise(e)
252
+ except models.ErrConflict as e:
253
+ # handle exception
254
+ raise(e)
255
+ except models.ErrTooManyRequests as e:
256
+ # handle exception
257
+ raise(e)
258
+ except models.ErrInternalServerError as e:
259
+ # handle exception
260
+ raise(e)
261
+ except models.SDKError as e:
262
+ # handle exception
263
+ raise(e)
264
+
265
+ if res is not None:
266
+ # handle response
267
+ pass
268
+
269
+ ```
270
+ <!-- End Error Handling [errors] -->
271
+
272
+ <!-- Start Server Selection [server] -->
273
+ ## Server Selection
274
+
275
+ ### Select Server by Index
276
+
277
+ You can override the default server globally by passing a server index to the `server_idx: int` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
278
+
279
+ | # | Server | Variables |
280
+ | - | ------ | --------- |
281
+ | 0 | `https://api.bannerify.co` | None |
282
+
283
+ #### Example
284
+
285
+ ```python
286
+ from bannerify import Bannerify
287
+
288
+ s = Bannerify(
289
+ server_idx=0,
290
+ token="BANNERIFY_API_KEY",
291
+ )
292
+
293
+
294
+ res = s.post_v1_templates_create_image(request={
295
+ "api_key": "<value>",
296
+ "template_id": "tpl_xxxxxxxxx",
297
+ "modifications": [
298
+ {
299
+ "name": "Text 1",
300
+ "color": "#FF0000",
301
+ "src": "https://example.com/image.jpg",
302
+ "text": "Hello World",
303
+ "barcode": "1234567890",
304
+ "qrcode": "Some text",
305
+ "visible": True,
306
+ "star": 5,
307
+ },
308
+ ],
309
+ })
310
+
311
+ if res is not None:
312
+ # handle response
313
+ pass
314
+
315
+ ```
316
+
317
+
318
+ ### Override Server URL Per-Client
319
+
320
+ The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
321
+ ```python
322
+ from bannerify import Bannerify
323
+
324
+ s = Bannerify(
325
+ server_url="https://api.bannerify.co",
326
+ token="BANNERIFY_API_KEY",
327
+ )
328
+
329
+
330
+ res = s.post_v1_templates_create_image(request={
331
+ "api_key": "<value>",
332
+ "template_id": "tpl_xxxxxxxxx",
333
+ "modifications": [
334
+ {
335
+ "name": "Text 1",
336
+ "color": "#FF0000",
337
+ "src": "https://example.com/image.jpg",
338
+ "text": "Hello World",
339
+ "barcode": "1234567890",
340
+ "qrcode": "Some text",
341
+ "visible": True,
342
+ "star": 5,
343
+ },
344
+ ],
345
+ })
346
+
347
+ if res is not None:
348
+ # handle response
349
+ pass
350
+
351
+ ```
352
+ <!-- End Server Selection [server] -->
353
+
354
+ <!-- Start Custom HTTP Client [http-client] -->
355
+ ## Custom HTTP Client
356
+
357
+ The Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
358
+ Depending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
359
+ This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly.
360
+
361
+ For example, you could specify a header for every request that this sdk makes as follows:
362
+ ```python
363
+ from bannerify import Bannerify
364
+ import httpx
365
+
366
+ http_client = httpx.Client(headers={"x-custom-header": "someValue"})
367
+ s = Bannerify(client=http_client)
368
+ ```
369
+
370
+ or you could wrap the client with your own custom logic:
371
+ ```python
372
+ from bannerify import Bannerify
373
+ from bannerify.httpclient import AsyncHttpClient
374
+ import httpx
375
+
376
+ class CustomClient(AsyncHttpClient):
377
+ client: AsyncHttpClient
378
+
379
+ def __init__(self, client: AsyncHttpClient):
380
+ self.client = client
381
+
382
+ async def send(
383
+ self,
384
+ request: httpx.Request,
385
+ *,
386
+ stream: bool = False,
387
+ auth: Union[
388
+ httpx._types.AuthTypes, httpx._client.UseClientDefault, None
389
+ ] = httpx.USE_CLIENT_DEFAULT,
390
+ follow_redirects: Union[
391
+ bool, httpx._client.UseClientDefault
392
+ ] = httpx.USE_CLIENT_DEFAULT,
393
+ ) -> httpx.Response:
394
+ request.headers["Client-Level-Header"] = "added by client"
395
+
396
+ return await self.client.send(
397
+ request, stream=stream, auth=auth, follow_redirects=follow_redirects
398
+ )
399
+
400
+ def build_request(
401
+ self,
402
+ method: str,
403
+ url: httpx._types.URLTypes,
404
+ *,
405
+ content: Optional[httpx._types.RequestContent] = None,
406
+ data: Optional[httpx._types.RequestData] = None,
407
+ files: Optional[httpx._types.RequestFiles] = None,
408
+ json: Optional[Any] = None,
409
+ params: Optional[httpx._types.QueryParamTypes] = None,
410
+ headers: Optional[httpx._types.HeaderTypes] = None,
411
+ cookies: Optional[httpx._types.CookieTypes] = None,
412
+ timeout: Union[
413
+ httpx._types.TimeoutTypes, httpx._client.UseClientDefault
414
+ ] = httpx.USE_CLIENT_DEFAULT,
415
+ extensions: Optional[httpx._types.RequestExtensions] = None,
416
+ ) -> httpx.Request:
417
+ return self.client.build_request(
418
+ method,
419
+ url,
420
+ content=content,
421
+ data=data,
422
+ files=files,
423
+ json=json,
424
+ params=params,
425
+ headers=headers,
426
+ cookies=cookies,
427
+ timeout=timeout,
428
+ extensions=extensions,
429
+ )
430
+
431
+ s = Bannerify(async_client=CustomClient(httpx.AsyncClient()))
432
+ ```
433
+ <!-- End Custom HTTP Client [http-client] -->
434
+
435
+ <!-- Start Authentication [security] -->
436
+ ## Authentication
437
+
438
+ ### Per-Client Security Schemes
439
+
440
+ This SDK supports the following security scheme globally:
441
+
442
+ | Name | Type | Scheme |
443
+ | ------- | ------- | ------- |
444
+ | `token` | apiKey | API key |
445
+
446
+ To authenticate with the API the `token` parameter must be set when initializing the SDK client instance. For example:
447
+ ```python
448
+ from bannerify import Bannerify
449
+
450
+ s = Bannerify(
451
+ token="BANNERIFY_API_KEY",
452
+ )
453
+
454
+
455
+ res = s.post_v1_templates_create_image(request={
456
+ "api_key": "<value>",
457
+ "template_id": "tpl_xxxxxxxxx",
458
+ "modifications": [
459
+ {
460
+ "name": "Text 1",
461
+ "color": "#FF0000",
462
+ "src": "https://example.com/image.jpg",
463
+ "text": "Hello World",
464
+ "barcode": "1234567890",
465
+ "qrcode": "Some text",
466
+ "visible": True,
467
+ "star": 5,
468
+ },
469
+ ],
470
+ })
471
+
472
+ if res is not None:
473
+ # handle response
474
+ pass
475
+
476
+ ```
477
+ <!-- End Authentication [security] -->
478
+
479
+ <!-- Start IDE Support [idesupport] -->
480
+ ## IDE Support
481
+
482
+ ### PyCharm
483
+
484
+ Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
485
+
486
+ - [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
487
+ <!-- End IDE Support [idesupport] -->
488
+
489
+ <!-- Start Debugging [debug] -->
490
+ ## Debugging
491
+
492
+ You can setup your SDK to emit debug logs for SDK requests and responses.
493
+
494
+ You can pass your own logger class directly into your SDK.
495
+ ```python
496
+ from bannerify import Bannerify
497
+ import logging
498
+
499
+ logging.basicConfig(level=logging.DEBUG)
500
+ s = Bannerify(debug_logger=logging.getLogger("bannerify"))
501
+ ```
502
+ <!-- End Debugging [debug] -->
503
+
504
+ <!-- Placeholder for Future Speakeasy SDK Sections -->
505
+
506
+ # Development
507
+
508
+ ## Maturity
509
+
510
+ This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
511
+ to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
512
+ looking for the latest version.
513
+
514
+ ## Contributions
515
+
516
+ While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
517
+ We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
518
+
519
+ ### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=<no value>&utm_campaign=python)
520
+