-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: regenerated with OpenAPI Doc 1.0.0, Speakeasy CLI 1.198.1
- Loading branch information
1 parent
cb3d2a3
commit 2454337
Showing
11 changed files
with
705 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" | ||
|
||
from .sdkhooks import * | ||
from .types import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" | ||
|
||
import requests | ||
from .types import SDKInitHook, BeforeRequestContext, BeforeRequestHook, AfterSuccessContext, AfterSuccessHook, AfterErrorContext, AfterErrorHook, Hooks | ||
from typing import List, Optional, Tuple, Union | ||
|
||
|
||
class SDKHooks(Hooks): | ||
sdk_init_hooks: List[SDKInitHook] = [] | ||
before_request_hooks: List[BeforeRequestHook] = [] | ||
after_success_hooks: List[AfterSuccessHook] = [] | ||
after_error_hooks: List[AfterErrorHook] = [] | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def register_sdk_init_hook(self, hook: SDKInitHook) -> None: | ||
self.sdk_init_hooks.append(hook) | ||
|
||
def register_before_request_hook(self, hook: BeforeRequestHook) -> None: | ||
self.before_request_hooks.append(hook) | ||
|
||
def register_after_success_hook(self, hook: AfterSuccessHook) -> None: | ||
self.after_success_hooks.append(hook) | ||
|
||
def register_after_error_hook(self, hook: AfterErrorHook) -> None: | ||
self.after_error_hooks.append(hook) | ||
|
||
def sdk_init(self, base_url: str, client: requests.Session) -> Tuple[str, requests.Session]: | ||
for hook in self.sdk_init_hooks: | ||
base_url, client = hook.sdk_init(base_url, client) | ||
return base_url, client | ||
|
||
def before_request(self, hook_ctx: BeforeRequestContext, request: requests.PreparedRequest) -> Union[requests.PreparedRequest, Exception]: | ||
for hook in self.before_request_hooks: | ||
request = hook.before_request(hook_ctx, request) | ||
if isinstance(request, Exception): | ||
raise request | ||
|
||
return request | ||
|
||
def after_success(self, hook_ctx: AfterSuccessContext, response: requests.Response) -> requests.Response: | ||
for hook in self.after_success_hooks: | ||
response = hook.after_success(hook_ctx, response) | ||
if isinstance(response, Exception): | ||
raise response | ||
return response | ||
|
||
def after_error(self, hook_ctx: AfterErrorContext, response: Optional[requests.Response], error: Optional[Exception]) -> Tuple[Optional[requests.Response], Optional[Exception]]: | ||
for hook in self.after_error_hooks: | ||
result = hook.after_error(hook_ctx, response, error) | ||
if isinstance(result, Exception): | ||
raise result | ||
response, error = result | ||
return response, error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.""" | ||
|
||
import requests as requests_http | ||
from abc import ABC, abstractmethod | ||
from typing import Any, Callable, List, Optional, Tuple, Union | ||
|
||
|
||
class HookContext: | ||
operation_id: str | ||
oauth2_scopes: Optional[List[str]] = None | ||
security_source: Optional[Union[Any, Callable[[], Any]]] = None | ||
|
||
def __init__(self, operation_id: str, oauth2_scopes: Optional[List[str]], security_source: Optional[Union[Any, Callable[[], Any]]]): | ||
self.operation_id = operation_id | ||
self.oauth2_scopes = oauth2_scopes | ||
self.security_source = security_source | ||
|
||
|
||
class BeforeRequestContext(HookContext): | ||
pass | ||
|
||
|
||
class AfterSuccessContext(HookContext): | ||
pass | ||
|
||
|
||
class AfterErrorContext(HookContext): | ||
pass | ||
|
||
|
||
class SDKInitHook(ABC): | ||
@abstractmethod | ||
def sdk_init(self, base_url: str, client: requests_http.Session) -> Tuple[str, requests_http.Session]: | ||
pass | ||
|
||
|
||
class BeforeRequestHook(ABC): | ||
@abstractmethod | ||
def before_request(self, hook_ctx: BeforeRequestContext, request: requests_http.PreparedRequest) -> Union[requests_http.PreparedRequest, Exception]: | ||
pass | ||
|
||
|
||
class AfterSuccessHook(ABC): | ||
@abstractmethod | ||
def after_success(self, hook_ctx: AfterSuccessContext, response: requests_http.Response) -> Union[requests_http.PreparedRequest, Exception]: | ||
pass | ||
|
||
|
||
class AfterErrorHook(ABC): | ||
@abstractmethod | ||
def after_error(self, hook_ctx: AfterErrorContext, response: Optional[requests_http.Response], error: Optional[Exception]) -> Union[Tuple[Optional[requests_http.PreparedRequest], Optional[Exception]], Exception]: | ||
pass | ||
|
||
|
||
class Hooks(ABC): | ||
@abstractmethod | ||
def register_sdk_init_hook(self, hook: SDKInitHook): | ||
pass | ||
|
||
@abstractmethod | ||
def register_before_request_hook(self, hook: BeforeRequestHook): | ||
pass | ||
|
||
@abstractmethod | ||
def register_after_success_hook(self, hook: AfterSuccessHook): | ||
pass | ||
|
||
@abstractmethod | ||
def register_after_error_hook(self, hook: AfterErrorHook): | ||
pass |
Oops, something went wrong.