diff --git a/webhooks/README.md b/webhooks/README.md index 3fecec27e..2bbeffb41 100755 --- a/webhooks/README.md +++ b/webhooks/README.md @@ -24,36 +24,36 @@ s = epilot.Epilot( req = shared.WebhookConfig( auth=shared.Auth( api_key_config=shared.APIKeyConfig( - key_name="unde", - key_value="deserunt", + key_name="corrupti", + key_value="provident", ), auth_type="API_KEY", basic_auth_config=shared.BasicAuthConfig( - password="nulla", - username="Leatha_Stiedemann", + password="quibusdam", + username="Leda_Stiedemann", ), oauth_config=shared.OAuthConfig( - client_id="nihil", - client_secret="fuga", - endpoint="facilis", + client_id="vel", + client_secret="error", + endpoint="deserunt", http_method="PUT", ), ), creation_time="2021-04-27T12:01:13.000Z", enabled=False, - event_name="iusto", + event_name="iure", filter=shared.Filter( - key_to_filter="ullam", + key_to_filter="magnam", supported_values=[ - "inventore", - "sapiente", - "enim", - "eum", + "ipsa", + "delectus", + "tempora", + "suscipit", ], ), http_method="PATCH", - id="autem", - url="vel", + id="cc8796ed-151a-405d-bc2d-df7cc78ca1ba", + url="occaecati", ) res = s.webhooks.create_config(req) @@ -64,7 +64,7 @@ if res.webhook_config is not None: -## SDK Available Operations +## Available Resources and Operations ### webhooks diff --git a/webhooks/RELEASES.md b/webhooks/RELEASES.md index b06e9fed9..729a16bf2 100644 --- a/webhooks/RELEASES.md +++ b/webhooks/RELEASES.md @@ -34,4 +34,46 @@ Based on: ### Changes Based on: - OpenAPI Doc 1.0.0 https://docs.api.epilot.io/webhooks-howto.yaml -- Speakeasy CLI 1.19.2 (2.16.5) https://github.com/speakeasy-api/speakeasy \ No newline at end of file +- Speakeasy CLI 1.19.2 (2.16.5) https://github.com/speakeasy-api/speakeasy + +## 2023-04-01 01:01:11 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/webhooks-howto.yaml +- Speakeasy CLI 1.19.3 (2.16.7) https://github.com/speakeasy-api/speakeasy + +## 2023-04-06 00:56:39 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/webhooks-howto.yaml +- Speakeasy CLI 1.19.6 (2.17.8) https://github.com/speakeasy-api/speakeasy + +## 2023-04-12 00:58:51 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/webhooks-howto.yaml +- Speakeasy CLI 1.19.7 (2.17.9) https://github.com/speakeasy-api/speakeasy + +## 2023-04-14 00:57:42 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/webhooks-howto.yaml +- Speakeasy CLI 1.20.0 (2.18.0) https://github.com/speakeasy-api/speakeasy + +## 2023-04-18 00:57:43 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/webhooks-howto.yaml +- Speakeasy CLI 1.20.1 (2.18.1) https://github.com/speakeasy-api/speakeasy + +## 2023-04-19 01:00:51 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/webhooks-howto.yaml +- Speakeasy CLI 1.20.2 (2.18.2) https://github.com/speakeasy-api/speakeasy + +## 2023-04-21 00:58:24 +### Changes +Based on: +- OpenAPI Doc 1.0.0 https://docs.api.epilot.io/webhooks-howto.yaml +- Speakeasy CLI 1.21.4 (2.19.1) https://github.com/speakeasy-api/speakeasy \ No newline at end of file diff --git a/webhooks/USAGE.md b/webhooks/USAGE.md index 3347350ca..18996ebe6 100755 --- a/webhooks/USAGE.md +++ b/webhooks/USAGE.md @@ -13,36 +13,36 @@ s = epilot.Epilot( req = shared.WebhookConfig( auth=shared.Auth( api_key_config=shared.APIKeyConfig( - key_name="unde", - key_value="deserunt", + key_name="corrupti", + key_value="provident", ), auth_type="API_KEY", basic_auth_config=shared.BasicAuthConfig( - password="nulla", - username="Leatha_Stiedemann", + password="quibusdam", + username="Leda_Stiedemann", ), oauth_config=shared.OAuthConfig( - client_id="nihil", - client_secret="fuga", - endpoint="facilis", + client_id="vel", + client_secret="error", + endpoint="deserunt", http_method="PUT", ), ), creation_time="2021-04-27T12:01:13.000Z", enabled=False, - event_name="iusto", + event_name="iure", filter=shared.Filter( - key_to_filter="ullam", + key_to_filter="magnam", supported_values=[ - "inventore", - "sapiente", - "enim", - "eum", + "ipsa", + "delectus", + "tempora", + "suscipit", ], ), http_method="PATCH", - id="autem", - url="vel", + id="cc8796ed-151a-405d-bc2d-df7cc78ca1ba", + url="occaecati", ) res = s.webhooks.create_config(req) diff --git a/webhooks/gen.yaml b/webhooks/gen.yaml index c87df6149..3cc628e96 100644 --- a/webhooks/gen.yaml +++ b/webhooks/gen.yaml @@ -2,15 +2,14 @@ configVersion: 1.0.0 management: docChecksum: ec0e473c4984d2b4894ce5f50dd5abeb docVersion: 1.0.0 - speakeasyVersion: 1.19.2 - generationVersion: 2.16.5 + speakeasyVersion: 1.21.4 + generationVersion: 2.19.1 generation: telemetryEnabled: false sdkClassName: epilot - sdkFlattening: true singleTagPerOp: false python: - version: 1.2.2 + version: 1.5.0 author: epilot description: Python Client SDK for Epilot packageName: epilot-webhooks diff --git a/webhooks/pylintrc b/webhooks/pylintrc index 79b8008d0..1ce47d88d 100755 --- a/webhooks/pylintrc +++ b/webhooks/pylintrc @@ -124,12 +124,7 @@ attr-naming-style=snake_case #attr-rgx= # Bad variable names which should always be refused, separated by a comma. -bad-names=foo, - bar, - baz, - toto, - tutu, - tata +bad-names= # Bad variable names regexes, separated by a comma. If names match any regex, # they will always be refused @@ -439,7 +434,11 @@ disable=raw-checker-failed, trailing-newlines, too-many-public-methods, too-many-locals, - too-many-lines + too-many-lines, + using-constant-test, + too-many-statements, + cyclic-import, + too-many-nested-blocks # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option diff --git a/webhooks/setup.py b/webhooks/setup.py index 39d4602af..7d493d285 100755 --- a/webhooks/setup.py +++ b/webhooks/setup.py @@ -10,7 +10,7 @@ setuptools.setup( name="epilot-webhooks", - version="1.2.2", + version="1.5.0", author="epilot", description="Python Client SDK for Epilot", long_description=long_description, diff --git a/webhooks/src/epilot/models/shared/authtype_enum.py b/webhooks/src/epilot/models/shared/authtype_enum.py index d06a72c3c..103b7dc3d 100755 --- a/webhooks/src/epilot/models/shared/authtype_enum.py +++ b/webhooks/src/epilot/models/shared/authtype_enum.py @@ -4,6 +4,6 @@ from enum import Enum class AuthTypeEnum(str, Enum): - BASIC = "BASIC" - OAUTH_CLIENT_CREDENTIALS = "OAUTH_CLIENT_CREDENTIALS" - API_KEY = "API_KEY" + BASIC = 'BASIC' + OAUTH_CLIENT_CREDENTIALS = 'OAUTH_CLIENT_CREDENTIALS' + API_KEY = 'API_KEY' diff --git a/webhooks/src/epilot/models/shared/httpmethod_enum.py b/webhooks/src/epilot/models/shared/httpmethod_enum.py index 4ca400122..a696f3d70 100755 --- a/webhooks/src/epilot/models/shared/httpmethod_enum.py +++ b/webhooks/src/epilot/models/shared/httpmethod_enum.py @@ -4,10 +4,10 @@ from enum import Enum class HTTPMethodEnum(str, Enum): - GET = "GET" - POST = "POST" - PUT = "PUT" - PATCH = "PATCH" - DELETE = "DELETE" - OPTIONS = "OPTIONS" - HEAD = "HEAD" + GET = 'GET' + POST = 'POST' + PUT = 'PUT' + PATCH = 'PATCH' + DELETE = 'DELETE' + OPTIONS = 'OPTIONS' + HEAD = 'HEAD' diff --git a/webhooks/src/epilot/sdk.py b/webhooks/src/epilot/sdk.py index 682efec7d..13f6af5c5 100755 --- a/webhooks/src/epilot/sdk.py +++ b/webhooks/src/epilot/sdk.py @@ -176,7 +176,6 @@ class Epilot: Additional to this path parameters, the payload to update the webhook configuration is the same we use for creating new webhooks. You can also refer to [Which events are available](#section/Create-Webhook) for more details. To deactivate or reactivate a webhook configuration, you can make use of this endpoint, providing the organization id and webhook id as path parameter, and your payload should contain same configuration saved except the field `enabled` should either `false` if you want to deactivate the webhook otherwise `true` if the webhook should be active. - """ webhooks: Webhooks @@ -184,8 +183,8 @@ class Epilot: _security_client: requests_http.Session _server_url: str = SERVERS[0] _language: str = "python" - _sdk_version: str = "1.2.2" - _gen_version: str = "2.16.5" + _sdk_version: str = "1.5.0" + _gen_version: str = "2.19.1" def __init__(self, security: shared.Security = None, diff --git a/webhooks/src/epilot/utils/utils.py b/webhooks/src/epilot/utils/utils.py index 9d4fba324..986a86937 100755 --- a/webhooks/src/epilot/utils/utils.py +++ b/webhooks/src/epilot/utils/utils.py @@ -152,62 +152,71 @@ def generate_url(clazz: type, server_url: str, path: str, path_params: dataclass if param_metadata is None: continue - if param_metadata.get('style', 'simple') == 'simple': - param = getattr( - path_params, field.name) if path_params is not None else None - param = _populate_from_globals( - field.name, param, 'pathParam', gbls) + param = getattr( + path_params, field.name) if path_params is not None else None + param = _populate_from_globals( + field.name, param, 'pathParam', gbls) - if param is None: - continue - - if isinstance(param, list): - pp_vals: list[str] = [] - for pp_val in param: - if pp_val is None: - continue - pp_vals.append(_val_to_string(pp_val)) - path = path.replace( - '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1) - elif isinstance(param, dict): - pp_vals: list[str] = [] - for pp_key in param: - if param[pp_key] is None: - continue - if param_metadata.get('explode'): - pp_vals.append( - f"{pp_key}={_val_to_string(param[pp_key])}") - else: - pp_vals.append( - f"{pp_key},{_val_to_string(param[pp_key])}") - path = path.replace( - '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1) - elif not isinstance(param, (str, int, float, complex, bool)): - pp_vals: list[str] = [] - param_fields: Tuple[Field, ...] = fields(param) - for param_field in param_fields: - param_value_metadata = param_field.metadata.get( - 'path_param') - if not param_value_metadata: - continue - - parm_name = param_value_metadata.get( - 'field_name', field.name) + if param is None: + continue - param_field_val = getattr(param, param_field.name) - if param_field_val is None: - continue - if param_metadata.get('explode'): - pp_vals.append( - f"{parm_name}={_val_to_string(param_field_val)}") - else: - pp_vals.append( - f"{parm_name},{_val_to_string(param_field_val)}") - path = path.replace( - '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1) - else: + f_name = param_metadata.get("field_name", field.name) + serialization = param_metadata.get('serialization', '') + if serialization != '': + serialized_params = _get_serialized_params( + param_metadata, f_name, param) + for key, value in serialized_params.items(): path = path.replace( - '{' + param_metadata.get('field_name', field.name) + '}', _val_to_string(param), 1) + '{' + key + '}', value, 1) + else: + if param_metadata.get('style', 'simple') == 'simple': + if isinstance(param, list): + pp_vals: list[str] = [] + for pp_val in param: + if pp_val is None: + continue + pp_vals.append(_val_to_string(pp_val)) + path = path.replace( + '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1) + elif isinstance(param, dict): + pp_vals: list[str] = [] + for pp_key in param: + if param[pp_key] is None: + continue + if param_metadata.get('explode'): + pp_vals.append( + f"{pp_key}={_val_to_string(param[pp_key])}") + else: + pp_vals.append( + f"{pp_key},{_val_to_string(param[pp_key])}") + path = path.replace( + '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1) + elif not isinstance(param, (str, int, float, complex, bool)): + pp_vals: list[str] = [] + param_fields: Tuple[Field, ...] = fields(param) + for param_field in param_fields: + param_value_metadata = param_field.metadata.get( + 'path_param') + if not param_value_metadata: + continue + + parm_name = param_value_metadata.get( + 'field_name', field.name) + + param_field_val = getattr(param, param_field.name) + if param_field_val is None: + continue + if param_metadata.get('explode'): + pp_vals.append( + f"{parm_name}={_val_to_string(param_field_val)}") + else: + pp_vals.append( + f"{parm_name},{_val_to_string(param_field_val)}") + path = path.replace( + '{' + param_metadata.get('field_name', field.name) + '}', ",".join(pp_vals), 1) + else: + path = path.replace( + '{' + param_metadata.get('field_name', field.name) + '}', _val_to_string(param), 1) return server_url.removesuffix("/") + path @@ -246,8 +255,12 @@ def get_query_params(clazz: type, query_params: dataclass, gbls: dict[str, dict[ f_name = metadata.get("field_name") serialization = metadata.get('serialization', '') if serialization != '': - params = params | _get_serialized_query_params( - metadata, f_name, value) + serialized_parms = _get_serialized_params(metadata, f_name, value) + for key, value in serialized_parms.items(): + if key in params: + params[key].extend(value) + else: + params[key] = [value] else: style = metadata.get('style', 'form') if style == 'deepObject': @@ -282,8 +295,8 @@ def get_headers(headers_params: dataclass) -> dict[str, str]: return headers -def _get_serialized_query_params(metadata: dict, field_name: str, obj: any) -> dict[str, list[str]]: - params: dict[str, list[str]] = {} +def _get_serialized_params(metadata: dict, field_name: str, obj: any) -> dict[str, str]: + params: dict[str, str] = {} serialization = metadata.get('serialization', '') if serialization == 'json':