bannerify 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.
- bannerify/__init__.py +5 -0
- bannerify/_hooks/__init__.py +4 -0
- bannerify/_hooks/sdkhooks.py +55 -0
- bannerify/_hooks/types.py +76 -0
- bannerify/basesdk.py +253 -0
- bannerify/httpclient.py +78 -0
- bannerify/models/__init__.py +19 -0
- bannerify/models/errbadrequest.py +50 -0
- bannerify/models/errconflict.py +51 -0
- bannerify/models/errfetchimageerror.py +50 -0
- bannerify/models/errforbidden.py +51 -0
- bannerify/models/errinternalservererror.py +51 -0
- bannerify/models/errnotfound.py +51 -0
- bannerify/models/errtoomanyrequests.py +51 -0
- bannerify/models/errunauthorized.py +51 -0
- bannerify/models/get_v1_infoop.py +51 -0
- bannerify/models/get_v1_templates_signedurlop.py +54 -0
- bannerify/models/modification.py +53 -0
- bannerify/models/post_v1_templates_createimageop.py +59 -0
- bannerify/models/post_v1_templates_createpdfop.py +41 -0
- bannerify/models/sdkerror.py +22 -0
- bannerify/models/security.py +16 -0
- bannerify/py.typed +1 -0
- bannerify/sdk.py +856 -0
- bannerify/sdkconfiguration.py +49 -0
- bannerify/types/__init__.py +21 -0
- bannerify/types/basemodel.py +39 -0
- bannerify/utils/__init__.py +84 -0
- bannerify/utils/annotations.py +19 -0
- bannerify/utils/enums.py +34 -0
- bannerify/utils/eventstreaming.py +178 -0
- bannerify/utils/forms.py +208 -0
- bannerify/utils/headers.py +136 -0
- bannerify/utils/logger.py +19 -0
- bannerify/utils/metadata.py +118 -0
- bannerify/utils/queryparams.py +205 -0
- bannerify/utils/requestbodies.py +66 -0
- bannerify/utils/retries.py +216 -0
- bannerify/utils/security.py +168 -0
- bannerify/utils/serializers.py +190 -0
- bannerify/utils/url.py +155 -0
- bannerify/utils/values.py +134 -0
- bannerify-0.2.0.dist-info/METADATA +520 -0
- bannerify-0.2.0.dist-info/RECORD +46 -0
- bannerify-0.2.0.dist-info/WHEEL +4 -0
- py.typed +1 -0
bannerify/__init__.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
from .types import SDKInitHook, BeforeRequestContext, BeforeRequestHook, AfterSuccessContext, AfterSuccessHook, AfterErrorContext, AfterErrorHook, Hooks
|
|
5
|
+
from typing import List, Optional, Tuple
|
|
6
|
+
from bannerify.httpclient import HttpClient
|
|
7
|
+
|
|
8
|
+
class SDKHooks(Hooks):
|
|
9
|
+
def __init__(self) -> None:
|
|
10
|
+
self.sdk_init_hooks: List[SDKInitHook] = []
|
|
11
|
+
self.before_request_hooks: List[BeforeRequestHook] = []
|
|
12
|
+
self.after_success_hooks: List[AfterSuccessHook] = []
|
|
13
|
+
self.after_error_hooks: List[AfterErrorHook] = []
|
|
14
|
+
|
|
15
|
+
def register_sdk_init_hook(self, hook: SDKInitHook) -> None:
|
|
16
|
+
self.sdk_init_hooks.append(hook)
|
|
17
|
+
|
|
18
|
+
def register_before_request_hook(self, hook: BeforeRequestHook) -> None:
|
|
19
|
+
self.before_request_hooks.append(hook)
|
|
20
|
+
|
|
21
|
+
def register_after_success_hook(self, hook: AfterSuccessHook) -> None:
|
|
22
|
+
self.after_success_hooks.append(hook)
|
|
23
|
+
|
|
24
|
+
def register_after_error_hook(self, hook: AfterErrorHook) -> None:
|
|
25
|
+
self.after_error_hooks.append(hook)
|
|
26
|
+
|
|
27
|
+
def sdk_init(self, base_url: str, client: HttpClient) -> Tuple[str, HttpClient]:
|
|
28
|
+
for hook in self.sdk_init_hooks:
|
|
29
|
+
base_url, client = hook.sdk_init(base_url, client)
|
|
30
|
+
return base_url, client
|
|
31
|
+
|
|
32
|
+
def before_request(self, hook_ctx: BeforeRequestContext, request: httpx.Request) -> httpx.Request:
|
|
33
|
+
for hook in self.before_request_hooks:
|
|
34
|
+
out = hook.before_request(hook_ctx, request)
|
|
35
|
+
if isinstance(out, Exception):
|
|
36
|
+
raise out
|
|
37
|
+
request = out
|
|
38
|
+
|
|
39
|
+
return request
|
|
40
|
+
|
|
41
|
+
def after_success(self, hook_ctx: AfterSuccessContext, response: httpx.Response) -> httpx.Response:
|
|
42
|
+
for hook in self.after_success_hooks:
|
|
43
|
+
out = hook.after_success(hook_ctx, response)
|
|
44
|
+
if isinstance(out, Exception):
|
|
45
|
+
raise out
|
|
46
|
+
response = out
|
|
47
|
+
return response
|
|
48
|
+
|
|
49
|
+
def after_error(self, hook_ctx: AfterErrorContext, response: Optional[httpx.Response], error: Optional[Exception]) -> Tuple[Optional[httpx.Response], Optional[Exception]]:
|
|
50
|
+
for hook in self.after_error_hooks:
|
|
51
|
+
result = hook.after_error(hook_ctx, response, error)
|
|
52
|
+
if isinstance(result, Exception):
|
|
53
|
+
raise result
|
|
54
|
+
response, error = result
|
|
55
|
+
return response, error
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from abc import ABC, abstractmethod
|
|
5
|
+
from bannerify.httpclient import HttpClient
|
|
6
|
+
import httpx
|
|
7
|
+
from typing import Any, Callable, List, Optional, Tuple, Union
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class HookContext:
|
|
11
|
+
operation_id: str
|
|
12
|
+
oauth2_scopes: Optional[List[str]] = None
|
|
13
|
+
security_source: Optional[Union[Any, Callable[[], Any]]] = None
|
|
14
|
+
|
|
15
|
+
def __init__(self, operation_id: str, oauth2_scopes: Optional[List[str]], security_source: Optional[Union[Any, Callable[[], Any]]]):
|
|
16
|
+
self.operation_id = operation_id
|
|
17
|
+
self.oauth2_scopes = oauth2_scopes
|
|
18
|
+
self.security_source = security_source
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class BeforeRequestContext(HookContext):
|
|
22
|
+
def __init__(self, hook_ctx: HookContext):
|
|
23
|
+
super().__init__(hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class AfterSuccessContext(HookContext):
|
|
27
|
+
def __init__(self, hook_ctx: HookContext):
|
|
28
|
+
super().__init__(hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class AfterErrorContext(HookContext):
|
|
33
|
+
def __init__(self, hook_ctx: HookContext):
|
|
34
|
+
super().__init__(hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class SDKInitHook(ABC):
|
|
38
|
+
@abstractmethod
|
|
39
|
+
def sdk_init(self, base_url: str, client: HttpClient) -> Tuple[str, HttpClient]:
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class BeforeRequestHook(ABC):
|
|
44
|
+
@abstractmethod
|
|
45
|
+
def before_request(self, hook_ctx: BeforeRequestContext, request: httpx.Request) -> Union[httpx.Request, Exception]:
|
|
46
|
+
pass
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class AfterSuccessHook(ABC):
|
|
50
|
+
@abstractmethod
|
|
51
|
+
def after_success(self, hook_ctx: AfterSuccessContext, response: httpx.Response) -> Union[httpx.Response, Exception]:
|
|
52
|
+
pass
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class AfterErrorHook(ABC):
|
|
56
|
+
@abstractmethod
|
|
57
|
+
def after_error(self, hook_ctx: AfterErrorContext, response: Optional[httpx.Response], error: Optional[Exception]) -> Union[Tuple[Optional[httpx.Response], Optional[Exception]], Exception]:
|
|
58
|
+
pass
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class Hooks(ABC):
|
|
62
|
+
@abstractmethod
|
|
63
|
+
def register_sdk_init_hook(self, hook: SDKInitHook):
|
|
64
|
+
pass
|
|
65
|
+
|
|
66
|
+
@abstractmethod
|
|
67
|
+
def register_before_request_hook(self, hook: BeforeRequestHook):
|
|
68
|
+
pass
|
|
69
|
+
|
|
70
|
+
@abstractmethod
|
|
71
|
+
def register_after_success_hook(self, hook: AfterSuccessHook):
|
|
72
|
+
pass
|
|
73
|
+
|
|
74
|
+
@abstractmethod
|
|
75
|
+
def register_after_error_hook(self, hook: AfterErrorHook):
|
|
76
|
+
pass
|
bannerify/basesdk.py
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .sdkconfiguration import SDKConfiguration
|
|
4
|
+
from bannerify import models, utils
|
|
5
|
+
from bannerify._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext
|
|
6
|
+
from bannerify.utils import RetryConfig, SerializedRequestBody, get_body_content
|
|
7
|
+
import httpx
|
|
8
|
+
from typing import Callable, List, Optional, Tuple
|
|
9
|
+
|
|
10
|
+
class BaseSDK:
|
|
11
|
+
sdk_configuration: SDKConfiguration
|
|
12
|
+
|
|
13
|
+
def __init__(self, sdk_config: SDKConfiguration) -> None:
|
|
14
|
+
self.sdk_configuration = sdk_config
|
|
15
|
+
|
|
16
|
+
def get_url(self, base_url, url_variables):
|
|
17
|
+
sdk_url, sdk_variables = self.sdk_configuration.get_server_details()
|
|
18
|
+
|
|
19
|
+
if base_url is None:
|
|
20
|
+
base_url = sdk_url
|
|
21
|
+
|
|
22
|
+
if url_variables is None:
|
|
23
|
+
url_variables = sdk_variables
|
|
24
|
+
|
|
25
|
+
return utils.template_url(base_url, url_variables)
|
|
26
|
+
|
|
27
|
+
def build_request(
|
|
28
|
+
self,
|
|
29
|
+
method,
|
|
30
|
+
path,
|
|
31
|
+
base_url,
|
|
32
|
+
url_variables,
|
|
33
|
+
request,
|
|
34
|
+
request_body_required,
|
|
35
|
+
request_has_path_params,
|
|
36
|
+
request_has_query_params,
|
|
37
|
+
user_agent_header,
|
|
38
|
+
accept_header_value,
|
|
39
|
+
_globals=None,
|
|
40
|
+
security=None,
|
|
41
|
+
timeout_ms: Optional[int] = None,
|
|
42
|
+
get_serialized_body: Optional[
|
|
43
|
+
Callable[[], Optional[SerializedRequestBody]]
|
|
44
|
+
] = None,
|
|
45
|
+
url_override: Optional[str] = None,
|
|
46
|
+
) -> httpx.Request:
|
|
47
|
+
client = self.sdk_configuration.client
|
|
48
|
+
|
|
49
|
+
query_params = {}
|
|
50
|
+
|
|
51
|
+
url = url_override
|
|
52
|
+
if url is None:
|
|
53
|
+
url = utils.generate_url(
|
|
54
|
+
self.get_url(base_url, url_variables),
|
|
55
|
+
path,
|
|
56
|
+
request if request_has_path_params else None,
|
|
57
|
+
_globals if request_has_path_params else None,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
query_params = utils.get_query_params(
|
|
61
|
+
request if request_has_query_params else None,
|
|
62
|
+
_globals if request_has_query_params else None,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
headers = utils.get_headers(request, _globals)
|
|
66
|
+
headers["Accept"] = accept_header_value
|
|
67
|
+
headers[user_agent_header] = self.sdk_configuration.user_agent
|
|
68
|
+
|
|
69
|
+
if security is not None:
|
|
70
|
+
if callable(security):
|
|
71
|
+
security = security()
|
|
72
|
+
|
|
73
|
+
if security is not None:
|
|
74
|
+
security_headers, security_query_params = utils.get_security(security)
|
|
75
|
+
headers = {**headers, **security_headers}
|
|
76
|
+
query_params = {**query_params, **security_query_params}
|
|
77
|
+
|
|
78
|
+
serialized_request_body = SerializedRequestBody("application/octet-stream")
|
|
79
|
+
if get_serialized_body is not None:
|
|
80
|
+
rb = get_serialized_body()
|
|
81
|
+
if request_body_required and rb is None:
|
|
82
|
+
raise ValueError("request body is required")
|
|
83
|
+
|
|
84
|
+
if rb is not None:
|
|
85
|
+
serialized_request_body = rb
|
|
86
|
+
|
|
87
|
+
if (
|
|
88
|
+
serialized_request_body.media_type is not None
|
|
89
|
+
and serialized_request_body.media_type
|
|
90
|
+
not in (
|
|
91
|
+
"multipart/form-data",
|
|
92
|
+
"multipart/mixed",
|
|
93
|
+
)
|
|
94
|
+
):
|
|
95
|
+
headers["content-type"] = serialized_request_body.media_type
|
|
96
|
+
|
|
97
|
+
timeout = timeout_ms / 1000 if timeout_ms is not None else None
|
|
98
|
+
|
|
99
|
+
return client.build_request(
|
|
100
|
+
method,
|
|
101
|
+
url,
|
|
102
|
+
params=query_params,
|
|
103
|
+
content=serialized_request_body.content,
|
|
104
|
+
data=serialized_request_body.data,
|
|
105
|
+
files=serialized_request_body.files,
|
|
106
|
+
headers=headers,
|
|
107
|
+
timeout=timeout,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
def do_request(
|
|
111
|
+
self,
|
|
112
|
+
hook_ctx,
|
|
113
|
+
request,
|
|
114
|
+
error_status_codes,
|
|
115
|
+
stream=False,
|
|
116
|
+
retry_config: Optional[Tuple[RetryConfig, List[str]]] = None,
|
|
117
|
+
) -> httpx.Response:
|
|
118
|
+
client = self.sdk_configuration.client
|
|
119
|
+
logger = self.sdk_configuration.debug_logger
|
|
120
|
+
|
|
121
|
+
def do():
|
|
122
|
+
http_res = None
|
|
123
|
+
try:
|
|
124
|
+
req = self.sdk_configuration.get_hooks().before_request(
|
|
125
|
+
BeforeRequestContext(hook_ctx), request
|
|
126
|
+
)
|
|
127
|
+
logger.debug(
|
|
128
|
+
"Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s",
|
|
129
|
+
req.method,
|
|
130
|
+
req.url,
|
|
131
|
+
req.headers,
|
|
132
|
+
get_body_content(req)
|
|
133
|
+
)
|
|
134
|
+
http_res = client.send(req, stream=stream)
|
|
135
|
+
except Exception as e:
|
|
136
|
+
_, e = self.sdk_configuration.get_hooks().after_error(
|
|
137
|
+
AfterErrorContext(hook_ctx), None, e
|
|
138
|
+
)
|
|
139
|
+
if e is not None:
|
|
140
|
+
logger.debug("Request Exception", exc_info=True)
|
|
141
|
+
raise e
|
|
142
|
+
|
|
143
|
+
if http_res is None:
|
|
144
|
+
logger.debug("Raising no response SDK error")
|
|
145
|
+
raise models.SDKError("No response received")
|
|
146
|
+
|
|
147
|
+
logger.debug(
|
|
148
|
+
"Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
|
|
149
|
+
http_res.status_code,
|
|
150
|
+
http_res.url,
|
|
151
|
+
http_res.headers,
|
|
152
|
+
"<streaming response>" if stream else http_res.text
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
if utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
156
|
+
result, err = self.sdk_configuration.get_hooks().after_error(
|
|
157
|
+
AfterErrorContext(hook_ctx), http_res, None
|
|
158
|
+
)
|
|
159
|
+
if err is not None:
|
|
160
|
+
logger.debug("Request Exception", exc_info=True)
|
|
161
|
+
raise err
|
|
162
|
+
if result is not None:
|
|
163
|
+
http_res = result
|
|
164
|
+
else:
|
|
165
|
+
logger.debug("Raising unexpected SDK error")
|
|
166
|
+
raise models.SDKError("Unexpected error occurred")
|
|
167
|
+
|
|
168
|
+
return http_res
|
|
169
|
+
|
|
170
|
+
if retry_config is not None:
|
|
171
|
+
http_res = utils.retry(do, utils.Retries(retry_config[0], retry_config[1]))
|
|
172
|
+
else:
|
|
173
|
+
http_res = do()
|
|
174
|
+
|
|
175
|
+
if not utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
176
|
+
http_res = self.sdk_configuration.get_hooks().after_success(
|
|
177
|
+
AfterSuccessContext(hook_ctx), http_res
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
return http_res
|
|
181
|
+
|
|
182
|
+
async def do_request_async(
|
|
183
|
+
self,
|
|
184
|
+
hook_ctx,
|
|
185
|
+
request,
|
|
186
|
+
error_status_codes,
|
|
187
|
+
stream=False,
|
|
188
|
+
retry_config: Optional[Tuple[RetryConfig, List[str]]] = None,
|
|
189
|
+
) -> httpx.Response:
|
|
190
|
+
client = self.sdk_configuration.async_client
|
|
191
|
+
logger = self.sdk_configuration.debug_logger
|
|
192
|
+
async def do():
|
|
193
|
+
http_res = None
|
|
194
|
+
try:
|
|
195
|
+
req = self.sdk_configuration.get_hooks().before_request(
|
|
196
|
+
BeforeRequestContext(hook_ctx), request
|
|
197
|
+
)
|
|
198
|
+
logger.debug(
|
|
199
|
+
"Request:\nMethod: %s\nURL: %s\nHeaders: %s\nBody: %s",
|
|
200
|
+
req.method,
|
|
201
|
+
req.url,
|
|
202
|
+
req.headers,
|
|
203
|
+
get_body_content(req)
|
|
204
|
+
)
|
|
205
|
+
http_res = await client.send(req, stream=stream)
|
|
206
|
+
except Exception as e:
|
|
207
|
+
_, e = self.sdk_configuration.get_hooks().after_error(
|
|
208
|
+
AfterErrorContext(hook_ctx), None, e
|
|
209
|
+
)
|
|
210
|
+
if e is not None:
|
|
211
|
+
logger.debug("Request Exception", exc_info=True)
|
|
212
|
+
raise e
|
|
213
|
+
|
|
214
|
+
if http_res is None:
|
|
215
|
+
logger.debug("Raising no response SDK error")
|
|
216
|
+
raise models.SDKError("No response received")
|
|
217
|
+
|
|
218
|
+
logger.debug(
|
|
219
|
+
"Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
|
|
220
|
+
http_res.status_code,
|
|
221
|
+
http_res.url,
|
|
222
|
+
http_res.headers,
|
|
223
|
+
"<streaming response>" if stream else http_res.text
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
if utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
227
|
+
result, err = self.sdk_configuration.get_hooks().after_error(
|
|
228
|
+
AfterErrorContext(hook_ctx), http_res, None
|
|
229
|
+
)
|
|
230
|
+
if err is not None:
|
|
231
|
+
logger.debug("Request Exception", exc_info=True)
|
|
232
|
+
raise err
|
|
233
|
+
if result is not None:
|
|
234
|
+
http_res = result
|
|
235
|
+
else:
|
|
236
|
+
logger.debug("Raising unexpected SDK error")
|
|
237
|
+
raise models.SDKError("Unexpected error occurred")
|
|
238
|
+
|
|
239
|
+
return http_res
|
|
240
|
+
|
|
241
|
+
if retry_config is not None:
|
|
242
|
+
http_res = await utils.retry_async(
|
|
243
|
+
do, utils.Retries(retry_config[0], retry_config[1])
|
|
244
|
+
)
|
|
245
|
+
else:
|
|
246
|
+
http_res = await do()
|
|
247
|
+
|
|
248
|
+
if not utils.match_status_codes(error_status_codes, http_res.status_code):
|
|
249
|
+
http_res = self.sdk_configuration.get_hooks().after_success(
|
|
250
|
+
AfterSuccessContext(hook_ctx), http_res
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
return http_res
|
bannerify/httpclient.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
# pyright: reportReturnType = false
|
|
4
|
+
from typing_extensions import Protocol, runtime_checkable
|
|
5
|
+
import httpx
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@runtime_checkable
|
|
10
|
+
class HttpClient(Protocol):
|
|
11
|
+
def send(
|
|
12
|
+
self,
|
|
13
|
+
request: httpx.Request,
|
|
14
|
+
*,
|
|
15
|
+
stream: bool = False,
|
|
16
|
+
auth: Union[
|
|
17
|
+
httpx._types.AuthTypes, httpx._client.UseClientDefault, None
|
|
18
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
19
|
+
follow_redirects: Union[
|
|
20
|
+
bool, httpx._client.UseClientDefault
|
|
21
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
22
|
+
) -> httpx.Response:
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
def build_request(
|
|
26
|
+
self,
|
|
27
|
+
method: str,
|
|
28
|
+
url: httpx._types.URLTypes,
|
|
29
|
+
*,
|
|
30
|
+
content: Optional[httpx._types.RequestContent] = None,
|
|
31
|
+
data: Optional[httpx._types.RequestData] = None,
|
|
32
|
+
files: Optional[httpx._types.RequestFiles] = None,
|
|
33
|
+
json: Optional[Any] = None,
|
|
34
|
+
params: Optional[httpx._types.QueryParamTypes] = None,
|
|
35
|
+
headers: Optional[httpx._types.HeaderTypes] = None,
|
|
36
|
+
cookies: Optional[httpx._types.CookieTypes] = None,
|
|
37
|
+
timeout: Union[
|
|
38
|
+
httpx._types.TimeoutTypes, httpx._client.UseClientDefault
|
|
39
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
40
|
+
extensions: Optional[httpx._types.RequestExtensions] = None,
|
|
41
|
+
) -> httpx.Request:
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@runtime_checkable
|
|
46
|
+
class AsyncHttpClient(Protocol):
|
|
47
|
+
async def send(
|
|
48
|
+
self,
|
|
49
|
+
request: httpx.Request,
|
|
50
|
+
*,
|
|
51
|
+
stream: bool = False,
|
|
52
|
+
auth: Union[
|
|
53
|
+
httpx._types.AuthTypes, httpx._client.UseClientDefault, None
|
|
54
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
55
|
+
follow_redirects: Union[
|
|
56
|
+
bool, httpx._client.UseClientDefault
|
|
57
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
58
|
+
) -> httpx.Response:
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
def build_request(
|
|
62
|
+
self,
|
|
63
|
+
method: str,
|
|
64
|
+
url: httpx._types.URLTypes,
|
|
65
|
+
*,
|
|
66
|
+
content: Optional[httpx._types.RequestContent] = None,
|
|
67
|
+
data: Optional[httpx._types.RequestData] = None,
|
|
68
|
+
files: Optional[httpx._types.RequestFiles] = None,
|
|
69
|
+
json: Optional[Any] = None,
|
|
70
|
+
params: Optional[httpx._types.QueryParamTypes] = None,
|
|
71
|
+
headers: Optional[httpx._types.HeaderTypes] = None,
|
|
72
|
+
cookies: Optional[httpx._types.CookieTypes] = None,
|
|
73
|
+
timeout: Union[
|
|
74
|
+
httpx._types.TimeoutTypes, httpx._client.UseClientDefault
|
|
75
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
76
|
+
extensions: Optional[httpx._types.RequestExtensions] = None,
|
|
77
|
+
) -> httpx.Request:
|
|
78
|
+
pass
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .errbadrequest import Code, ErrBadRequest, ErrBadRequestData, Error, ErrorTypedDict
|
|
4
|
+
from .errconflict import ErrConflict, ErrConflictCode, ErrConflictData, ErrConflictError, ErrConflictErrorTypedDict
|
|
5
|
+
from .errfetchimageerror import ErrFetchImageError, ErrFetchImageErrorCode, ErrFetchImageErrorData, ErrFetchImageErrorError, ErrFetchImageErrorErrorTypedDict
|
|
6
|
+
from .errforbidden import ErrForbidden, ErrForbiddenCode, ErrForbiddenData, ErrForbiddenError, ErrForbiddenErrorTypedDict
|
|
7
|
+
from .errinternalservererror import ErrInternalServerError, ErrInternalServerErrorCode, ErrInternalServerErrorData, ErrInternalServerErrorError, ErrInternalServerErrorErrorTypedDict
|
|
8
|
+
from .errnotfound import ErrNotFound, ErrNotFoundCode, ErrNotFoundData, ErrNotFoundError, ErrNotFoundErrorTypedDict
|
|
9
|
+
from .errtoomanyrequests import ErrTooManyRequests, ErrTooManyRequestsCode, ErrTooManyRequestsData, ErrTooManyRequestsError, ErrTooManyRequestsErrorTypedDict
|
|
10
|
+
from .errunauthorized import ErrUnauthorized, ErrUnauthorizedCode, ErrUnauthorizedData, ErrUnauthorizedError, ErrUnauthorizedErrorTypedDict
|
|
11
|
+
from .get_v1_infoop import GetV1InfoRequest, GetV1InfoRequestTypedDict, GetV1InfoResponseBody, GetV1InfoResponseBodyTypedDict, GetV1InfoResponseResponseBody, GetV1InfoResponseResponseBodyUnion
|
|
12
|
+
from .get_v1_templates_signedurlop import GetV1TemplatesSignedurlRequest, GetV1TemplatesSignedurlRequestTypedDict, GetV1TemplatesSignedurlResponseBody, GetV1TemplatesSignedurlResponseBodyUnion, QueryParamFormat
|
|
13
|
+
from .modification import Modification, ModificationTypedDict
|
|
14
|
+
from .post_v1_templates_createimageop import Format, PostV1TemplatesCreateImageRequestBody, PostV1TemplatesCreateImageRequestBodyTypedDict, PostV1TemplatesCreateImageResponse, PostV1TemplatesCreateImageResponseBody, PostV1TemplatesCreateImageResponseBodyUnion, PostV1TemplatesCreateImageResponseTypedDict
|
|
15
|
+
from .post_v1_templates_createpdfop import PostV1TemplatesCreatePdfRequestBody, PostV1TemplatesCreatePdfRequestBodyTypedDict, PostV1TemplatesCreatePdfResponseBody, PostV1TemplatesCreatePdfResponseBodyUnion
|
|
16
|
+
from .sdkerror import SDKError
|
|
17
|
+
from .security import Security, SecurityTypedDict
|
|
18
|
+
|
|
19
|
+
__all__ = ["Code", "ErrBadRequest", "ErrBadRequestData", "ErrConflict", "ErrConflictCode", "ErrConflictData", "ErrConflictError", "ErrConflictErrorTypedDict", "ErrFetchImageError", "ErrFetchImageErrorCode", "ErrFetchImageErrorData", "ErrFetchImageErrorError", "ErrFetchImageErrorErrorTypedDict", "ErrForbidden", "ErrForbiddenCode", "ErrForbiddenData", "ErrForbiddenError", "ErrForbiddenErrorTypedDict", "ErrInternalServerError", "ErrInternalServerErrorCode", "ErrInternalServerErrorData", "ErrInternalServerErrorError", "ErrInternalServerErrorErrorTypedDict", "ErrNotFound", "ErrNotFoundCode", "ErrNotFoundData", "ErrNotFoundError", "ErrNotFoundErrorTypedDict", "ErrTooManyRequests", "ErrTooManyRequestsCode", "ErrTooManyRequestsData", "ErrTooManyRequestsError", "ErrTooManyRequestsErrorTypedDict", "ErrUnauthorized", "ErrUnauthorizedCode", "ErrUnauthorizedData", "ErrUnauthorizedError", "ErrUnauthorizedErrorTypedDict", "Error", "ErrorTypedDict", "Format", "GetV1InfoRequest", "GetV1InfoRequestTypedDict", "GetV1InfoResponseBody", "GetV1InfoResponseBodyTypedDict", "GetV1InfoResponseResponseBody", "GetV1InfoResponseResponseBodyUnion", "GetV1TemplatesSignedurlRequest", "GetV1TemplatesSignedurlRequestTypedDict", "GetV1TemplatesSignedurlResponseBody", "GetV1TemplatesSignedurlResponseBodyUnion", "Modification", "ModificationTypedDict", "PostV1TemplatesCreateImageRequestBody", "PostV1TemplatesCreateImageRequestBodyTypedDict", "PostV1TemplatesCreateImageResponse", "PostV1TemplatesCreateImageResponseBody", "PostV1TemplatesCreateImageResponseBodyUnion", "PostV1TemplatesCreateImageResponseTypedDict", "PostV1TemplatesCreatePdfRequestBody", "PostV1TemplatesCreatePdfRequestBodyTypedDict", "PostV1TemplatesCreatePdfResponseBody", "PostV1TemplatesCreatePdfResponseBodyUnion", "QueryParamFormat", "SDKError", "Security", "SecurityTypedDict"]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from bannerify import utils
|
|
5
|
+
from bannerify.types import BaseModel
|
|
6
|
+
from enum import Enum
|
|
7
|
+
import pydantic
|
|
8
|
+
from typing import TypedDict
|
|
9
|
+
from typing_extensions import Annotated
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Code(str, Enum):
|
|
13
|
+
r"""A machine readable error code."""
|
|
14
|
+
BAD_REQUEST = "BAD_REQUEST"
|
|
15
|
+
|
|
16
|
+
class ErrorTypedDict(TypedDict):
|
|
17
|
+
code: Code
|
|
18
|
+
r"""A machine readable error code."""
|
|
19
|
+
docs: str
|
|
20
|
+
r"""A link to our documentation with more details about this error code"""
|
|
21
|
+
message: str
|
|
22
|
+
r"""A human readable explanation of what went wrong"""
|
|
23
|
+
request_id: str
|
|
24
|
+
r"""Please always include the requestId in your error report"""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class Error(BaseModel):
|
|
28
|
+
code: Code
|
|
29
|
+
r"""A machine readable error code."""
|
|
30
|
+
docs: str
|
|
31
|
+
r"""A link to our documentation with more details about this error code"""
|
|
32
|
+
message: str
|
|
33
|
+
r"""A human readable explanation of what went wrong"""
|
|
34
|
+
request_id: Annotated[str, pydantic.Field(alias="requestId")]
|
|
35
|
+
r"""Please always include the requestId in your error report"""
|
|
36
|
+
|
|
37
|
+
class ErrBadRequestData(BaseModel):
|
|
38
|
+
error: Error
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class ErrBadRequest(Exception):
|
|
43
|
+
data: ErrBadRequestData
|
|
44
|
+
|
|
45
|
+
def __init__(self, data: ErrBadRequestData):
|
|
46
|
+
self.data = data
|
|
47
|
+
|
|
48
|
+
def __str__(self) -> str:
|
|
49
|
+
return utils.marshal_json(self.data, ErrBadRequestData)
|
|
50
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from bannerify import utils
|
|
5
|
+
from bannerify.types import BaseModel
|
|
6
|
+
from enum import Enum
|
|
7
|
+
import pydantic
|
|
8
|
+
from typing import TypedDict
|
|
9
|
+
from typing_extensions import Annotated
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ErrConflictCode(str, Enum):
|
|
13
|
+
r"""A machine readable error code."""
|
|
14
|
+
CONFLICT = "CONFLICT"
|
|
15
|
+
|
|
16
|
+
class ErrConflictErrorTypedDict(TypedDict):
|
|
17
|
+
code: ErrConflictCode
|
|
18
|
+
r"""A machine readable error code."""
|
|
19
|
+
docs: str
|
|
20
|
+
r"""A link to our documentation with more details about this error code"""
|
|
21
|
+
message: str
|
|
22
|
+
r"""A human readable explanation of what went wrong"""
|
|
23
|
+
request_id: str
|
|
24
|
+
r"""Please always include the requestId in your error report"""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ErrConflictError(BaseModel):
|
|
28
|
+
code: ErrConflictCode
|
|
29
|
+
r"""A machine readable error code."""
|
|
30
|
+
docs: str
|
|
31
|
+
r"""A link to our documentation with more details about this error code"""
|
|
32
|
+
message: str
|
|
33
|
+
r"""A human readable explanation of what went wrong"""
|
|
34
|
+
request_id: Annotated[str, pydantic.Field(alias="requestId")]
|
|
35
|
+
r"""Please always include the requestId in your error report"""
|
|
36
|
+
|
|
37
|
+
class ErrConflictData(BaseModel):
|
|
38
|
+
error: ErrConflictError
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class ErrConflict(Exception):
|
|
43
|
+
r"""This response is sent when a request conflicts with the current state of the server."""
|
|
44
|
+
data: ErrConflictData
|
|
45
|
+
|
|
46
|
+
def __init__(self, data: ErrConflictData):
|
|
47
|
+
self.data = data
|
|
48
|
+
|
|
49
|
+
def __str__(self) -> str:
|
|
50
|
+
return utils.marshal_json(self.data, ErrConflictData)
|
|
51
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from bannerify import utils
|
|
5
|
+
from bannerify.types import BaseModel
|
|
6
|
+
from enum import Enum
|
|
7
|
+
import pydantic
|
|
8
|
+
from typing import TypedDict
|
|
9
|
+
from typing_extensions import Annotated
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ErrFetchImageErrorCode(str, Enum):
|
|
13
|
+
r"""A machine readable error code."""
|
|
14
|
+
FETCH_IMAGE_ERROR = "FETCH_IMAGE_ERROR"
|
|
15
|
+
|
|
16
|
+
class ErrFetchImageErrorErrorTypedDict(TypedDict):
|
|
17
|
+
code: ErrFetchImageErrorCode
|
|
18
|
+
r"""A machine readable error code."""
|
|
19
|
+
docs: str
|
|
20
|
+
r"""A link to our documentation with more details about this error code"""
|
|
21
|
+
message: str
|
|
22
|
+
r"""A human readable explanation of what went wrong"""
|
|
23
|
+
request_id: str
|
|
24
|
+
r"""Please always include the requestId in your error report"""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ErrFetchImageErrorError(BaseModel):
|
|
28
|
+
code: ErrFetchImageErrorCode
|
|
29
|
+
r"""A machine readable error code."""
|
|
30
|
+
docs: str
|
|
31
|
+
r"""A link to our documentation with more details about this error code"""
|
|
32
|
+
message: str
|
|
33
|
+
r"""A human readable explanation of what went wrong"""
|
|
34
|
+
request_id: Annotated[str, pydantic.Field(alias="requestId")]
|
|
35
|
+
r"""Please always include the requestId in your error report"""
|
|
36
|
+
|
|
37
|
+
class ErrFetchImageErrorData(BaseModel):
|
|
38
|
+
error: ErrFetchImageErrorError
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class ErrFetchImageError(Exception):
|
|
43
|
+
data: ErrFetchImageErrorData
|
|
44
|
+
|
|
45
|
+
def __init__(self, data: ErrFetchImageErrorData):
|
|
46
|
+
self.data = data
|
|
47
|
+
|
|
48
|
+
def __str__(self) -> str:
|
|
49
|
+
return utils.marshal_json(self.data, ErrFetchImageErrorData)
|
|
50
|
+
|