diff --git a/codegen/layouts/partials/method-docstring.hbs b/codegen/layouts/partials/method-docstring.hbs index 04c1f7eb..fca2ce7e 100644 --- a/codegen/layouts/partials/method-docstring.hbs +++ b/codegen/layouts/partials/method-docstring.hbs @@ -4,7 +4,7 @@ :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish.{{/if}}{{#unless (eq returnType "None")}} - :returns: {{{indent (pythonDoc responseDescription) 8}}}{{/unless}}{{#if hasRequiredParameters}} + :returns: {{{indent (pythonDoc responseDescription) 8}}}{{/unless}}{{#if requiresAtLeastOneParameter}} :raises ValueError: At least one parameter must be provided.{{/if}}{{#if isDeprecated}} diff --git a/codegen/layouts/partials/route-method.hbs b/codegen/layouts/partials/route-method.hbs index 31e54712..2ce36aa9 100644 --- a/codegen/layouts/partials/route-method.hbs +++ b/codegen/layouts/partials/route-method.hbs @@ -1,4 +1,4 @@ - @route_metadata(path="{{path}}", has_required_parameters={{#if hasRequiredParameters}}True{{else}}False{{/if}}, has_pagination={{#if hasPagination}}True{{else}}False{{/if}}) + @route_metadata(path="{{path}}", at_least_one_parameter_names=({{#each atLeastOneParameterNames}}"{{this}}",{{#unless @last}} {{/unless}}{{/each}}), has_pagination={{#if hasPagination}}True{{else}}False{{/if}}) {{#if isAsync}}async {{/if}}def {{> method-signature}}: """{{> method-docstring}}""" {{payloadVar}}: Dict[str, Any] = {} @@ -7,9 +7,12 @@ if {{name}} is not None: {{../payloadVar}}["{{name}}"] = {{name}} {{/each}} -{{#if hasRequiredParameters}} +{{#if requiresAtLeastOneParameter}} - if not {{payloadVar}}: + if all( + param is None + for param in ({{#each atLeastOneParameterNames}}{{this}},{{#unless @last}} {{/unless}}{{/each}}) + ): raise ValueError("At least one parameter is required for {{path}}") {{/if}} diff --git a/codegen/lib/layouts/route.ts b/codegen/lib/layouts/route.ts index edebac8c..af08fec6 100644 --- a/codegen/lib/layouts/route.ts +++ b/codegen/lib/layouts/route.ts @@ -14,7 +14,8 @@ export interface MethodLayoutContext { httpVerb: string payloadVar: string payloadArg: string - hasRequiredParameters: boolean + requiresAtLeastOneParameter: boolean + atLeastOneParameterNames: string[] hasPagination: boolean description: string responseDescription: string @@ -66,6 +67,16 @@ export interface RouteLayoutContext { methods: MethodLayoutContext[] } +const paginationParameterNames = new Set(['limit', 'page_cursor']) + +const getAtLeastOneParameterNames = (method: ClassMethod): string[] => + method.hasRequiredParameters && + method.parameters.every(({ required }) => !(required ?? false)) + ? method.parameters + .map(({ name }) => name) + .filter((name) => !paginationParameterNames.has(name)) + : [] + const getRequestLayoutContext = ( preferredMethod: string, ): Pick => { @@ -84,7 +95,8 @@ export const getMethodLayoutContext = ( name: method.methodName, path: method.path, ...getRequestLayoutContext(method.preferredMethod), - hasRequiredParameters: method.hasRequiredParameters, + requiresAtLeastOneParameter: getAtLeastOneParameterNames(method).length > 0, + atLeastOneParameterNames: getAtLeastOneParameterNames(method), hasPagination: method.hasPagination, description: method.description, responseDescription: method.responseDescription, diff --git a/seam/route.py b/seam/route.py index 59f71fb8..0f683e04 100644 --- a/seam/route.py +++ b/seam/route.py @@ -1,17 +1,22 @@ -from typing import Any, Callable, TypeVar, cast +from typing import Any, Callable, Tuple, TypeVar, cast F = TypeVar("F", bound=Callable) -def route_metadata(*, path: str, has_required_parameters: bool, has_pagination: bool): +def route_metadata( + *, + path: str, + has_pagination: bool, + at_least_one_parameter_names: Tuple[str, ...] = (), +): """Attach generated route metadata to a request callable.""" def decorate(request: F) -> F: # Functions do not declare these attributes, so set them through Any. route = cast(Any, request) route.__seam_path__ = path - route.__seam_has_required_parameters__ = has_required_parameters route.__seam_has_pagination__ = has_pagination + route.__seam_at_least_one_parameter_names__ = at_least_one_parameter_names return request return decorate diff --git a/seam/routes/access_codes.py b/seam/routes/access_codes.py index f53a0aa1..d262637f 100644 --- a/seam/routes/access_codes.py +++ b/seam/routes/access_codes.py @@ -93,9 +93,7 @@ def create( :param use_offline_access_code: Deprecated: Use ``is_offline_access_code`` instead. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -159,9 +157,7 @@ def create_multiple( :param use_backup_access_code_pool: Indicates whether to use a `backup access code pool `_ provided by Seam. If ``true``, you can use ```/access_codes/pull_backup_access_code`` `_. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -171,8 +167,7 @@ def delete(self, *, access_code_id: str, device_id: Optional[str] = None) -> Non :param access_code_id: ID of the access code that you want to delete. :param device_id: ID of the device for which you want to delete the access code. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -181,9 +176,7 @@ def generate_code(self, *, device_id: str) -> AccessCode: :param device_id: ID of the device for which you want to generate a code. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -267,9 +260,7 @@ def pull_backup_access_code(self, *, access_code_id: str) -> AccessCode: :param access_code_id: ID of the access code for which you want to pull a backup access code. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -292,8 +283,7 @@ def report_device_constraints( :param min_code_length: Minimum supported code length as an integer between 4 and 20, inclusive. You can specify either ``min_code_length``/``max_code_length`` or ``supported_code_lengths``. :param supported_code_lengths: Array of supported code lengths as integers between 4 and 20, inclusive. You can specify either ``supported_code_lengths`` or ``min_code_length``/``max_code_length``. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -343,8 +333,7 @@ def update( :param starts_at: Date and time at which the validity of the new access code starts, in `ISO 8601 `_ format. :param type: Type to which you want to convert the access code. To convert a time-bound access code to an ongoing access code, set ``type`` to ``ongoing``. See also `Changing a time-bound access code to permanent access `_. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -375,8 +364,7 @@ def update_multiple( To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called ``appearance``. This is an object with a ``name`` property and, optionally, ``first_name`` and ``last_name`` properties (for providers that break down a name into components). :param starts_at: Date and time at which the validity of the new access code starts, in `ISO 8601 `_ format. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -453,9 +441,7 @@ async def create( :param use_offline_access_code: Deprecated: Use ``is_offline_access_code`` instead. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -519,9 +505,7 @@ async def create_multiple( :param use_backup_access_code_pool: Indicates whether to use a `backup access code pool `_ provided by Seam. If ``true``, you can use ```/access_codes/pull_backup_access_code`` `_. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -533,8 +517,7 @@ async def delete( :param access_code_id: ID of the access code that you want to delete. :param device_id: ID of the device for which you want to delete the access code. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -543,9 +526,7 @@ async def generate_code(self, *, device_id: str) -> AccessCode: :param device_id: ID of the device for which you want to generate a code. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -629,9 +610,7 @@ async def pull_backup_access_code(self, *, access_code_id: str) -> AccessCode: :param access_code_id: ID of the access code for which you want to pull a backup access code. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -654,8 +633,7 @@ async def report_device_constraints( :param min_code_length: Minimum supported code length as an integer between 4 and 20, inclusive. You can specify either ``min_code_length``/``max_code_length`` or ``supported_code_lengths``. :param supported_code_lengths: Array of supported code lengths as integers between 4 and 20, inclusive. You can specify either ``supported_code_lengths`` or ``min_code_length``/``max_code_length``. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -705,8 +683,7 @@ async def update( :param starts_at: Date and time at which the validity of the new access code starts, in `ISO 8601 `_ format. :param type: Type to which you want to convert the access code. To convert a time-bound access code to an ongoing access code, set ``type`` to ``ongoing``. See also `Changing a time-bound access code to permanent access `_. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -737,8 +714,7 @@ async def update_multiple( To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called ``appearance``. This is an object with a ``name`` property and, optionally, ``first_name`` and ``last_name`` properties (for providers that break down a name into components). :param starts_at: Date and time at which the validity of the new access code starts, in `ISO 8601 `_ format. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -758,7 +734,9 @@ def unmanaged(self) -> AccessCodesUnmanaged: return self._unmanaged @route_metadata( - path="/access_codes/create", has_required_parameters=True, has_pagination=False + path="/access_codes/create", + at_least_one_parameter_names=(), + has_pagination=False, ) def create( self, @@ -820,9 +798,7 @@ def create( :param use_offline_access_code: Deprecated: Use ``is_offline_access_code`` instead. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -860,18 +836,13 @@ def create( if use_offline_access_code is not None: json_payload["use_offline_access_code"] = use_offline_access_code - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/create" - ) - res = self.client.post("/access_codes/create", json=json_payload) return AccessCode.from_dict(unwrap(res, "access_code", "/access_codes/create")) @route_metadata( path="/access_codes/create_multiple", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def create_multiple( @@ -934,9 +905,7 @@ def create_multiple( :param use_backup_access_code_pool: Indicates whether to use a `backup access code pool `_ provided by Seam. If ``true``, you can use ```/access_codes/pull_backup_access_code`` `_. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_ids is not None: @@ -968,11 +937,6 @@ def create_multiple( if use_backup_access_code_pool is not None: json_payload["use_backup_access_code_pool"] = use_backup_access_code_pool - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/create_multiple" - ) - res = self.client.put("/access_codes/create_multiple", json=json_payload) return [ @@ -983,7 +947,9 @@ def create_multiple( ] @route_metadata( - path="/access_codes/delete", has_required_parameters=True, has_pagination=False + path="/access_codes/delete", + at_least_one_parameter_names=(), + has_pagination=False, ) def delete(self, *, access_code_id: str, device_id: Optional[str] = None) -> None: """Deletes an `access code `_. @@ -991,8 +957,7 @@ def delete(self, *, access_code_id: str, device_id: Optional[str] = None) -> Non :param access_code_id: ID of the access code that you want to delete. :param device_id: ID of the device for which you want to delete the access code. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if access_code_id is not None: @@ -1000,18 +965,13 @@ def delete(self, *, access_code_id: str, device_id: Optional[str] = None) -> Non if device_id is not None: params["device_id"] = device_id - if not params: - raise ValueError( - "At least one parameter is required for /access_codes/delete" - ) - self.client.delete("/access_codes/delete", params=params) return None @route_metadata( path="/access_codes/generate_code", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def generate_code(self, *, device_id: str) -> AccessCode: @@ -1019,19 +979,12 @@ def generate_code(self, *, device_id: str) -> AccessCode: :param device_id: ID of the device for which you want to generate a code. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if device_id is not None: params["device_id"] = device_id - if not params: - raise ValueError( - "At least one parameter is required for /access_codes/generate_code" - ) - res = self.client.get("/access_codes/generate_code", params=params) return AccessCode.from_dict( @@ -1039,7 +992,13 @@ def generate_code(self, *, device_id: str) -> AccessCode: ) @route_metadata( - path="/access_codes/get", has_required_parameters=True, has_pagination=False + path="/access_codes/get", + at_least_one_parameter_names=( + "access_code_id", + "code", + "device_id", + ), + has_pagination=False, ) def get( self, @@ -1070,7 +1029,14 @@ def get( if device_id is not None: params["device_id"] = device_id - if not params: + if all( + param is None + for param in ( + access_code_id, + code, + device_id, + ) + ): raise ValueError("At least one parameter is required for /access_codes/get") res = self.client.get("/access_codes/get", params=params) @@ -1078,7 +1044,18 @@ def get( return AccessCode.from_dict(unwrap(res, "access_code", "/access_codes/get")) @route_metadata( - path="/access_codes/list", has_required_parameters=True, has_pagination=True + path="/access_codes/list", + at_least_one_parameter_names=( + "access_code_ids", + "access_grant_id", + "access_grant_key", + "access_method_id", + "customer_key", + "device_id", + "search", + "user_identifier_key", + ), + has_pagination=True, ) def list( self, @@ -1144,7 +1121,19 @@ def list( if user_identifier_key is not None: params["user_identifier_key"] = user_identifier_key - if not params: + if all( + param is None + for param in ( + access_code_ids, + access_grant_id, + access_grant_key, + access_method_id, + customer_key, + device_id, + search, + user_identifier_key, + ) + ): raise ValueError( "At least one parameter is required for /access_codes/list" ) @@ -1158,7 +1147,7 @@ def list( @route_metadata( path="/access_codes/pull_backup_access_code", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def pull_backup_access_code(self, *, access_code_id: str) -> AccessCode: @@ -1174,19 +1163,12 @@ def pull_backup_access_code(self, *, access_code_id: str) -> AccessCode: :param access_code_id: ID of the access code for which you want to pull a backup access code. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if access_code_id is not None: json_payload["access_code_id"] = access_code_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/pull_backup_access_code" - ) - res = self.client.post( "/access_codes/pull_backup_access_code", json=json_payload ) @@ -1197,7 +1179,7 @@ def pull_backup_access_code(self, *, access_code_id: str) -> AccessCode: @route_metadata( path="/access_codes/report_device_constraints", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def report_device_constraints( @@ -1219,8 +1201,7 @@ def report_device_constraints( :param min_code_length: Minimum supported code length as an integer between 4 and 20, inclusive. You can specify either ``min_code_length``/``max_code_length`` or ``supported_code_lengths``. :param supported_code_lengths: Array of supported code lengths as integers between 4 and 20, inclusive. You can specify either ``supported_code_lengths`` or ``min_code_length``/``max_code_length``. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1232,17 +1213,14 @@ def report_device_constraints( if supported_code_lengths is not None: json_payload["supported_code_lengths"] = supported_code_lengths - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/report_device_constraints" - ) - self.client.post("/access_codes/report_device_constraints", json=json_payload) return None @route_metadata( - path="/access_codes/update", has_required_parameters=True, has_pagination=False + path="/access_codes/update", + at_least_one_parameter_names=(), + has_pagination=False, ) def update( self, @@ -1290,8 +1268,7 @@ def update( :param starts_at: Date and time at which the validity of the new access code starts, in `ISO 8601 `_ format. :param type: Type to which you want to convert the access code. To convert a time-bound access code to an ongoing access code, set ``type`` to ``ongoing``. See also `Changing a time-bound access code to permanent access `_. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if access_code_id is not None: @@ -1319,18 +1296,13 @@ def update( if type is not None: json_payload["type"] = type - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/update" - ) - self.client.patch("/access_codes/update", json=json_payload) return None @route_metadata( path="/access_codes/update_multiple", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update_multiple( @@ -1360,8 +1332,7 @@ def update_multiple( To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called ``appearance``. This is an object with a ``name`` property and, optionally, ``first_name`` and ``last_name`` properties (for providers that break down a name into components). :param starts_at: Date and time at which the validity of the new access code starts, in `ISO 8601 `_ format. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if common_code_key is not None: @@ -1373,11 +1344,6 @@ def update_multiple( if starts_at is not None: json_payload["starts_at"] = starts_at - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/update_multiple" - ) - self.client.patch("/access_codes/update_multiple", json=json_payload) return None @@ -1399,7 +1365,9 @@ def unmanaged(self) -> AsyncAccessCodesUnmanaged: return self._unmanaged @route_metadata( - path="/access_codes/create", has_required_parameters=True, has_pagination=False + path="/access_codes/create", + at_least_one_parameter_names=(), + has_pagination=False, ) async def create( self, @@ -1461,9 +1429,7 @@ async def create( :param use_offline_access_code: Deprecated: Use ``is_offline_access_code`` instead. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1501,18 +1467,13 @@ async def create( if use_offline_access_code is not None: json_payload["use_offline_access_code"] = use_offline_access_code - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/create" - ) - res = await self.client.post("/access_codes/create", json=json_payload) return AccessCode.from_dict(unwrap(res, "access_code", "/access_codes/create")) @route_metadata( path="/access_codes/create_multiple", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def create_multiple( @@ -1575,9 +1536,7 @@ async def create_multiple( :param use_backup_access_code_pool: Indicates whether to use a `backup access code pool `_ provided by Seam. If ``true``, you can use ```/access_codes/pull_backup_access_code`` `_. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_ids is not None: @@ -1609,11 +1568,6 @@ async def create_multiple( if use_backup_access_code_pool is not None: json_payload["use_backup_access_code_pool"] = use_backup_access_code_pool - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/create_multiple" - ) - res = await self.client.put("/access_codes/create_multiple", json=json_payload) return [ @@ -1624,7 +1578,9 @@ async def create_multiple( ] @route_metadata( - path="/access_codes/delete", has_required_parameters=True, has_pagination=False + path="/access_codes/delete", + at_least_one_parameter_names=(), + has_pagination=False, ) async def delete( self, *, access_code_id: str, device_id: Optional[str] = None @@ -1634,8 +1590,7 @@ async def delete( :param access_code_id: ID of the access code that you want to delete. :param device_id: ID of the device for which you want to delete the access code. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if access_code_id is not None: @@ -1643,18 +1598,13 @@ async def delete( if device_id is not None: params["device_id"] = device_id - if not params: - raise ValueError( - "At least one parameter is required for /access_codes/delete" - ) - await self.client.delete("/access_codes/delete", params=params) return None @route_metadata( path="/access_codes/generate_code", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def generate_code(self, *, device_id: str) -> AccessCode: @@ -1662,19 +1612,12 @@ async def generate_code(self, *, device_id: str) -> AccessCode: :param device_id: ID of the device for which you want to generate a code. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if device_id is not None: params["device_id"] = device_id - if not params: - raise ValueError( - "At least one parameter is required for /access_codes/generate_code" - ) - res = await self.client.get("/access_codes/generate_code", params=params) return AccessCode.from_dict( @@ -1682,7 +1625,13 @@ async def generate_code(self, *, device_id: str) -> AccessCode: ) @route_metadata( - path="/access_codes/get", has_required_parameters=True, has_pagination=False + path="/access_codes/get", + at_least_one_parameter_names=( + "access_code_id", + "code", + "device_id", + ), + has_pagination=False, ) async def get( self, @@ -1713,7 +1662,14 @@ async def get( if device_id is not None: params["device_id"] = device_id - if not params: + if all( + param is None + for param in ( + access_code_id, + code, + device_id, + ) + ): raise ValueError("At least one parameter is required for /access_codes/get") res = await self.client.get("/access_codes/get", params=params) @@ -1721,7 +1677,18 @@ async def get( return AccessCode.from_dict(unwrap(res, "access_code", "/access_codes/get")) @route_metadata( - path="/access_codes/list", has_required_parameters=True, has_pagination=True + path="/access_codes/list", + at_least_one_parameter_names=( + "access_code_ids", + "access_grant_id", + "access_grant_key", + "access_method_id", + "customer_key", + "device_id", + "search", + "user_identifier_key", + ), + has_pagination=True, ) async def list( self, @@ -1787,7 +1754,19 @@ async def list( if user_identifier_key is not None: params["user_identifier_key"] = user_identifier_key - if not params: + if all( + param is None + for param in ( + access_code_ids, + access_grant_id, + access_grant_key, + access_method_id, + customer_key, + device_id, + search, + user_identifier_key, + ) + ): raise ValueError( "At least one parameter is required for /access_codes/list" ) @@ -1801,7 +1780,7 @@ async def list( @route_metadata( path="/access_codes/pull_backup_access_code", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def pull_backup_access_code(self, *, access_code_id: str) -> AccessCode: @@ -1817,19 +1796,12 @@ async def pull_backup_access_code(self, *, access_code_id: str) -> AccessCode: :param access_code_id: ID of the access code for which you want to pull a backup access code. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if access_code_id is not None: json_payload["access_code_id"] = access_code_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/pull_backup_access_code" - ) - res = await self.client.post( "/access_codes/pull_backup_access_code", json=json_payload ) @@ -1840,7 +1812,7 @@ async def pull_backup_access_code(self, *, access_code_id: str) -> AccessCode: @route_metadata( path="/access_codes/report_device_constraints", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def report_device_constraints( @@ -1862,8 +1834,7 @@ async def report_device_constraints( :param min_code_length: Minimum supported code length as an integer between 4 and 20, inclusive. You can specify either ``min_code_length``/``max_code_length`` or ``supported_code_lengths``. :param supported_code_lengths: Array of supported code lengths as integers between 4 and 20, inclusive. You can specify either ``supported_code_lengths`` or ``min_code_length``/``max_code_length``. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1875,11 +1846,6 @@ async def report_device_constraints( if supported_code_lengths is not None: json_payload["supported_code_lengths"] = supported_code_lengths - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/report_device_constraints" - ) - await self.client.post( "/access_codes/report_device_constraints", json=json_payload ) @@ -1887,7 +1853,9 @@ async def report_device_constraints( return None @route_metadata( - path="/access_codes/update", has_required_parameters=True, has_pagination=False + path="/access_codes/update", + at_least_one_parameter_names=(), + has_pagination=False, ) async def update( self, @@ -1935,8 +1903,7 @@ async def update( :param starts_at: Date and time at which the validity of the new access code starts, in `ISO 8601 `_ format. :param type: Type to which you want to convert the access code. To convert a time-bound access code to an ongoing access code, set ``type`` to ``ongoing``. See also `Changing a time-bound access code to permanent access `_. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if access_code_id is not None: @@ -1964,18 +1931,13 @@ async def update( if type is not None: json_payload["type"] = type - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/update" - ) - await self.client.patch("/access_codes/update", json=json_payload) return None @route_metadata( path="/access_codes/update_multiple", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update_multiple( @@ -2005,8 +1967,7 @@ async def update_multiple( To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called ``appearance``. This is an object with a ``name`` property and, optionally, ``first_name`` and ``last_name`` properties (for providers that break down a name into components). :param starts_at: Date and time at which the validity of the new access code starts, in `ISO 8601 `_ format. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if common_code_key is not None: @@ -2018,11 +1979,6 @@ async def update_multiple( if starts_at is not None: json_payload["starts_at"] = starts_at - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/update_multiple" - ) - await self.client.patch("/access_codes/update_multiple", json=json_payload) return None diff --git a/seam/routes/access_codes_simulate.py b/seam/routes/access_codes_simulate.py index 474db7ef..c883584c 100644 --- a/seam/routes/access_codes_simulate.py +++ b/seam/routes/access_codes_simulate.py @@ -20,9 +20,7 @@ def create_unmanaged_access_code( :param name: Name of the simulated unmanaged access code. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -40,9 +38,7 @@ async def create_unmanaged_access_code( :param name: Name of the simulated unmanaged access code. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -53,7 +49,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/access_codes/simulate/create_unmanaged_access_code", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def create_unmanaged_access_code( @@ -67,9 +63,7 @@ def create_unmanaged_access_code( :param name: Name of the simulated unmanaged access code. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if code is not None: @@ -79,11 +73,6 @@ def create_unmanaged_access_code( if name is not None: json_payload["name"] = name - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/simulate/create_unmanaged_access_code" - ) - res = self.client.post( "/access_codes/simulate/create_unmanaged_access_code", json=json_payload ) @@ -104,7 +93,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/access_codes/simulate/create_unmanaged_access_code", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def create_unmanaged_access_code( @@ -118,9 +107,7 @@ async def create_unmanaged_access_code( :param name: Name of the simulated unmanaged access code. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if code is not None: @@ -130,11 +117,6 @@ async def create_unmanaged_access_code( if name is not None: json_payload["name"] = name - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/simulate/create_unmanaged_access_code" - ) - res = await self.client.post( "/access_codes/simulate/create_unmanaged_access_code", json=json_payload ) diff --git a/seam/routes/access_codes_unmanaged.py b/seam/routes/access_codes_unmanaged.py index 29c6581a..e9000591 100644 --- a/seam/routes/access_codes_unmanaged.py +++ b/seam/routes/access_codes_unmanaged.py @@ -32,8 +32,7 @@ def convert_to_managed( :param force: Indicates whether to force the access code conversion. To switch management of an access code from one Seam workspace to another, set ``force`` to ``true``. :param is_external_modification_allowed: Indicates whether `external modification `_ of the access code is allowed. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -41,8 +40,7 @@ def delete(self, *, access_code_id: str) -> None: """Deletes an `unmanaged access code `_. :param access_code_id: ID of the unmanaged access code that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -90,9 +88,7 @@ def list( :param user_identifier_key: Your user ID for the user by which to filter unmanaged access codes. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -116,8 +112,7 @@ def update( :param force: Indicates whether to force the unmanaged access code update. :param is_external_modification_allowed: Indicates whether `external modification `_ of the code is allowed. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -145,8 +140,7 @@ async def convert_to_managed( :param force: Indicates whether to force the access code conversion. To switch management of an access code from one Seam workspace to another, set ``force`` to ``true``. :param is_external_modification_allowed: Indicates whether `external modification `_ of the access code is allowed. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -154,8 +148,7 @@ async def delete(self, *, access_code_id: str) -> None: """Deletes an `unmanaged access code `_. :param access_code_id: ID of the unmanaged access code that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -203,9 +196,7 @@ async def list( :param user_identifier_key: Your user ID for the user by which to filter unmanaged access codes. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -229,8 +220,7 @@ async def update( :param force: Indicates whether to force the unmanaged access code update. :param is_external_modification_allowed: Indicates whether `external modification `_ of the code is allowed. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -241,7 +231,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/access_codes/unmanaged/convert_to_managed", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def convert_to_managed( @@ -265,8 +255,7 @@ def convert_to_managed( :param force: Indicates whether to force the access code conversion. To switch management of an access code from one Seam workspace to another, set ``force`` to ``true``. :param is_external_modification_allowed: Indicates whether `external modification `_ of the access code is allowed. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if access_code_id is not None: @@ -280,11 +269,6 @@ def convert_to_managed( is_external_modification_allowed ) - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/unmanaged/convert_to_managed" - ) - self.client.patch( "/access_codes/unmanaged/convert_to_managed", json=json_payload ) @@ -293,32 +277,30 @@ def convert_to_managed( @route_metadata( path="/access_codes/unmanaged/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def delete(self, *, access_code_id: str) -> None: """Deletes an `unmanaged access code `_. :param access_code_id: ID of the unmanaged access code that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if access_code_id is not None: params["access_code_id"] = access_code_id - if not params: - raise ValueError( - "At least one parameter is required for /access_codes/unmanaged/delete" - ) - self.client.delete("/access_codes/unmanaged/delete", params=params) return None @route_metadata( path="/access_codes/unmanaged/get", - has_required_parameters=True, + at_least_one_parameter_names=( + "access_code_id", + "code", + "device_id", + ), has_pagination=False, ) def get( @@ -350,7 +332,14 @@ def get( if device_id is not None: params["device_id"] = device_id - if not params: + if all( + param is None + for param in ( + access_code_id, + code, + device_id, + ) + ): raise ValueError( "At least one parameter is required for /access_codes/unmanaged/get" ) @@ -363,7 +352,7 @@ def get( @route_metadata( path="/access_codes/unmanaged/list", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=True, ) def list( @@ -387,9 +376,7 @@ def list( :param user_identifier_key: Your user ID for the user by which to filter unmanaged access codes. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if device_id is not None: @@ -403,11 +390,6 @@ def list( if user_identifier_key is not None: params["user_identifier_key"] = user_identifier_key - if not params: - raise ValueError( - "At least one parameter is required for /access_codes/unmanaged/list" - ) - res = self.client.get("/access_codes/unmanaged/list", params=params) return [ @@ -417,7 +399,7 @@ def list( @route_metadata( path="/access_codes/unmanaged/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update( @@ -440,8 +422,7 @@ def update( :param force: Indicates whether to force the unmanaged access code update. :param is_external_modification_allowed: Indicates whether `external modification `_ of the code is allowed. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if access_code_id is not None: @@ -457,11 +438,6 @@ def update( is_external_modification_allowed ) - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/unmanaged/update" - ) - self.client.patch("/access_codes/unmanaged/update", json=json_payload) return None @@ -474,7 +450,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/access_codes/unmanaged/convert_to_managed", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def convert_to_managed( @@ -498,8 +474,7 @@ async def convert_to_managed( :param force: Indicates whether to force the access code conversion. To switch management of an access code from one Seam workspace to another, set ``force`` to ``true``. :param is_external_modification_allowed: Indicates whether `external modification `_ of the access code is allowed. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if access_code_id is not None: @@ -513,11 +488,6 @@ async def convert_to_managed( is_external_modification_allowed ) - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/unmanaged/convert_to_managed" - ) - await self.client.patch( "/access_codes/unmanaged/convert_to_managed", json=json_payload ) @@ -526,32 +496,30 @@ async def convert_to_managed( @route_metadata( path="/access_codes/unmanaged/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def delete(self, *, access_code_id: str) -> None: """Deletes an `unmanaged access code `_. :param access_code_id: ID of the unmanaged access code that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if access_code_id is not None: params["access_code_id"] = access_code_id - if not params: - raise ValueError( - "At least one parameter is required for /access_codes/unmanaged/delete" - ) - await self.client.delete("/access_codes/unmanaged/delete", params=params) return None @route_metadata( path="/access_codes/unmanaged/get", - has_required_parameters=True, + at_least_one_parameter_names=( + "access_code_id", + "code", + "device_id", + ), has_pagination=False, ) async def get( @@ -583,7 +551,14 @@ async def get( if device_id is not None: params["device_id"] = device_id - if not params: + if all( + param is None + for param in ( + access_code_id, + code, + device_id, + ) + ): raise ValueError( "At least one parameter is required for /access_codes/unmanaged/get" ) @@ -596,7 +571,7 @@ async def get( @route_metadata( path="/access_codes/unmanaged/list", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=True, ) async def list( @@ -620,9 +595,7 @@ async def list( :param user_identifier_key: Your user ID for the user by which to filter unmanaged access codes. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if device_id is not None: @@ -636,11 +609,6 @@ async def list( if user_identifier_key is not None: params["user_identifier_key"] = user_identifier_key - if not params: - raise ValueError( - "At least one parameter is required for /access_codes/unmanaged/list" - ) - res = await self.client.get("/access_codes/unmanaged/list", params=params) return [ @@ -650,7 +618,7 @@ async def list( @route_metadata( path="/access_codes/unmanaged/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update( @@ -673,8 +641,7 @@ async def update( :param force: Indicates whether to force the unmanaged access code update. :param is_external_modification_allowed: Indicates whether `external modification `_ of the code is allowed. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if access_code_id is not None: @@ -690,11 +657,6 @@ async def update( is_external_modification_allowed ) - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_codes/unmanaged/update" - ) - await self.client.patch("/access_codes/unmanaged/update", json=json_payload) return None diff --git a/seam/routes/access_grants.py b/seam/routes/access_grants.py index f7e16491..7ba565e7 100644 --- a/seam/routes/access_grants.py +++ b/seam/routes/access_grants.py @@ -73,18 +73,14 @@ def create( :param user_identity_id: ID of user identity for whom access is being granted. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod def delete(self, *, access_grant_id: str) -> None: """Delete an Access Grant. - :param access_grant_id: ID of Access Grant to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param access_grant_id: ID of Access Grant to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -214,9 +210,7 @@ def request_access_methods( :param requested_access_methods: Array of requested access methods to add to the access grant. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -304,18 +298,14 @@ async def create( :param user_identity_id: ID of user identity for whom access is being granted. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod async def delete(self, *, access_grant_id: str) -> None: """Delete an Access Grant. - :param access_grant_id: ID of Access Grant to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param access_grant_id: ID of Access Grant to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -445,9 +435,7 @@ async def request_access_methods( :param requested_access_methods: Array of requested access methods to add to the access grant. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -487,7 +475,9 @@ def unmanaged(self) -> AccessGrantsUnmanaged: return self._unmanaged @route_metadata( - path="/access_grants/create", has_required_parameters=True, has_pagination=False + path="/access_grants/create", + at_least_one_parameter_names=(), + has_pagination=False, ) def create( self, @@ -540,9 +530,7 @@ def create( :param user_identity_id: ID of user identity for whom access is being granted. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if requested_access_methods is not None: @@ -576,11 +564,6 @@ def create( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_grants/create" - ) - res = self.client.post("/access_grants/create", json=json_payload) return AccessGrant.from_dict( @@ -588,30 +571,30 @@ def create( ) @route_metadata( - path="/access_grants/delete", has_required_parameters=True, has_pagination=False + path="/access_grants/delete", + at_least_one_parameter_names=(), + has_pagination=False, ) def delete(self, *, access_grant_id: str) -> None: """Delete an Access Grant. - :param access_grant_id: ID of Access Grant to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param access_grant_id: ID of Access Grant to delete.""" params: Dict[str, Any] = {} if access_grant_id is not None: params["access_grant_id"] = access_grant_id - if not params: - raise ValueError( - "At least one parameter is required for /access_grants/delete" - ) - self.client.delete("/access_grants/delete", params=params) return None @route_metadata( - path="/access_grants/get", has_required_parameters=True, has_pagination=False + path="/access_grants/get", + at_least_one_parameter_names=( + "access_grant_id", + "access_grant_key", + ), + has_pagination=False, ) def get( self, @@ -635,7 +618,13 @@ def get( if access_grant_key is not None: params["access_grant_key"] = access_grant_key - if not params: + if all( + param is None + for param in ( + access_grant_id, + access_grant_key, + ) + ): raise ValueError( "At least one parameter is required for /access_grants/get" ) @@ -646,7 +635,12 @@ def get( @route_metadata( path="/access_grants/get_related", - has_required_parameters=True, + at_least_one_parameter_names=( + "access_grant_ids", + "access_grant_keys", + "exclude", + "include", + ), has_pagination=False, ) def get_related( @@ -707,7 +701,15 @@ def get_related( if include is not None: params["include"] = include - if not params: + if all( + param is None + for param in ( + access_grant_ids, + access_grant_keys, + exclude, + include, + ) + ): raise ValueError( "At least one parameter is required for /access_grants/get_related" ) @@ -717,7 +719,7 @@ def get_related( return Batch.from_dict(unwrap(res, "batch", "/access_grants/get_related")) @route_metadata( - path="/access_grants/list", has_required_parameters=False, has_pagination=True + path="/access_grants/list", at_least_one_parameter_names=(), has_pagination=True ) def list( self, @@ -803,7 +805,7 @@ def list( @route_metadata( path="/access_grants/request_access_methods", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def request_access_methods( @@ -815,9 +817,7 @@ def request_access_methods( :param requested_access_methods: Array of requested access methods to add to the access grant. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if access_grant_id is not None: @@ -825,11 +825,6 @@ def request_access_methods( if requested_access_methods is not None: json_payload["requested_access_methods"] = requested_access_methods - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_grants/request_access_methods" - ) - res = self.client.post( "/access_grants/request_access_methods", json=json_payload ) @@ -839,7 +834,15 @@ def request_access_methods( ) @route_metadata( - path="/access_grants/update", has_required_parameters=True, has_pagination=False + path="/access_grants/update", + at_least_one_parameter_names=( + "access_grant_id", + "access_grant_key", + "ends_at", + "name", + "starts_at", + ), + has_pagination=False, ) def update( self, @@ -876,7 +879,16 @@ def update( if starts_at is not None: json_payload["starts_at"] = starts_at - if not json_payload: + if all( + param is None + for param in ( + access_grant_id, + access_grant_key, + ends_at, + name, + starts_at, + ) + ): raise ValueError( "At least one parameter is required for /access_grants/update" ) @@ -897,7 +909,9 @@ def unmanaged(self) -> AsyncAccessGrantsUnmanaged: return self._unmanaged @route_metadata( - path="/access_grants/create", has_required_parameters=True, has_pagination=False + path="/access_grants/create", + at_least_one_parameter_names=(), + has_pagination=False, ) async def create( self, @@ -950,9 +964,7 @@ async def create( :param user_identity_id: ID of user identity for whom access is being granted. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if requested_access_methods is not None: @@ -986,11 +998,6 @@ async def create( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_grants/create" - ) - res = await self.client.post("/access_grants/create", json=json_payload) return AccessGrant.from_dict( @@ -998,30 +1005,30 @@ async def create( ) @route_metadata( - path="/access_grants/delete", has_required_parameters=True, has_pagination=False + path="/access_grants/delete", + at_least_one_parameter_names=(), + has_pagination=False, ) async def delete(self, *, access_grant_id: str) -> None: """Delete an Access Grant. - :param access_grant_id: ID of Access Grant to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param access_grant_id: ID of Access Grant to delete.""" params: Dict[str, Any] = {} if access_grant_id is not None: params["access_grant_id"] = access_grant_id - if not params: - raise ValueError( - "At least one parameter is required for /access_grants/delete" - ) - await self.client.delete("/access_grants/delete", params=params) return None @route_metadata( - path="/access_grants/get", has_required_parameters=True, has_pagination=False + path="/access_grants/get", + at_least_one_parameter_names=( + "access_grant_id", + "access_grant_key", + ), + has_pagination=False, ) async def get( self, @@ -1045,7 +1052,13 @@ async def get( if access_grant_key is not None: params["access_grant_key"] = access_grant_key - if not params: + if all( + param is None + for param in ( + access_grant_id, + access_grant_key, + ) + ): raise ValueError( "At least one parameter is required for /access_grants/get" ) @@ -1056,7 +1069,12 @@ async def get( @route_metadata( path="/access_grants/get_related", - has_required_parameters=True, + at_least_one_parameter_names=( + "access_grant_ids", + "access_grant_keys", + "exclude", + "include", + ), has_pagination=False, ) async def get_related( @@ -1117,7 +1135,15 @@ async def get_related( if include is not None: params["include"] = include - if not params: + if all( + param is None + for param in ( + access_grant_ids, + access_grant_keys, + exclude, + include, + ) + ): raise ValueError( "At least one parameter is required for /access_grants/get_related" ) @@ -1127,7 +1153,7 @@ async def get_related( return Batch.from_dict(unwrap(res, "batch", "/access_grants/get_related")) @route_metadata( - path="/access_grants/list", has_required_parameters=False, has_pagination=True + path="/access_grants/list", at_least_one_parameter_names=(), has_pagination=True ) async def list( self, @@ -1213,7 +1239,7 @@ async def list( @route_metadata( path="/access_grants/request_access_methods", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def request_access_methods( @@ -1225,9 +1251,7 @@ async def request_access_methods( :param requested_access_methods: Array of requested access methods to add to the access grant. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if access_grant_id is not None: @@ -1235,11 +1259,6 @@ async def request_access_methods( if requested_access_methods is not None: json_payload["requested_access_methods"] = requested_access_methods - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_grants/request_access_methods" - ) - res = await self.client.post( "/access_grants/request_access_methods", json=json_payload ) @@ -1249,7 +1268,15 @@ async def request_access_methods( ) @route_metadata( - path="/access_grants/update", has_required_parameters=True, has_pagination=False + path="/access_grants/update", + at_least_one_parameter_names=( + "access_grant_id", + "access_grant_key", + "ends_at", + "name", + "starts_at", + ), + has_pagination=False, ) async def update( self, @@ -1286,7 +1313,16 @@ async def update( if starts_at is not None: json_payload["starts_at"] = starts_at - if not json_payload: + if all( + param is None + for param in ( + access_grant_id, + access_grant_key, + ends_at, + name, + starts_at, + ) + ): raise ValueError( "At least one parameter is required for /access_grants/update" ) diff --git a/seam/routes/access_grants_unmanaged.py b/seam/routes/access_grants_unmanaged.py index 01ebfbe1..9621abe9 100644 --- a/seam/routes/access_grants_unmanaged.py +++ b/seam/routes/access_grants_unmanaged.py @@ -16,9 +16,7 @@ def get(self, *, access_grant_id: str) -> UnmanagedAccessGrant: :param access_grant_id: ID of unmanaged Access Grant to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -68,8 +66,7 @@ def update( :param is_managed: Must be set to true to convert the unmanaged access grant to managed. :param access_grant_key: Unique key for the access grant. If not provided, the existing key will be preserved. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -81,9 +78,7 @@ async def get(self, *, access_grant_id: str) -> UnmanagedAccessGrant: :param access_grant_id: ID of unmanaged Access Grant to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -133,8 +128,7 @@ async def update( :param is_managed: Must be set to true to convert the unmanaged access grant to managed. :param access_grant_key: Unique key for the access grant. If not provided, the existing key will be preserved. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -145,7 +139,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/access_grants/unmanaged/get", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def get(self, *, access_grant_id: str) -> UnmanagedAccessGrant: @@ -153,19 +147,12 @@ def get(self, *, access_grant_id: str) -> UnmanagedAccessGrant: :param access_grant_id: ID of unmanaged Access Grant to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if access_grant_id is not None: params["access_grant_id"] = access_grant_id - if not params: - raise ValueError( - "At least one parameter is required for /access_grants/unmanaged/get" - ) - res = self.client.get("/access_grants/unmanaged/get", params=params) return UnmanagedAccessGrant.from_dict( @@ -174,7 +161,7 @@ def get(self, *, access_grant_id: str) -> UnmanagedAccessGrant: @route_metadata( path="/access_grants/unmanaged/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=True, ) def list( @@ -228,7 +215,7 @@ def list( @route_metadata( path="/access_grants/unmanaged/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update( @@ -249,8 +236,7 @@ def update( :param is_managed: Must be set to true to convert the unmanaged access grant to managed. :param access_grant_key: Unique key for the access grant. If not provided, the existing key will be preserved. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if access_grant_id is not None: @@ -260,11 +246,6 @@ def update( if access_grant_key is not None: json_payload["access_grant_key"] = access_grant_key - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_grants/unmanaged/update" - ) - self.client.patch("/access_grants/unmanaged/update", json=json_payload) return None @@ -277,7 +258,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/access_grants/unmanaged/get", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def get(self, *, access_grant_id: str) -> UnmanagedAccessGrant: @@ -285,19 +266,12 @@ async def get(self, *, access_grant_id: str) -> UnmanagedAccessGrant: :param access_grant_id: ID of unmanaged Access Grant to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if access_grant_id is not None: params["access_grant_id"] = access_grant_id - if not params: - raise ValueError( - "At least one parameter is required for /access_grants/unmanaged/get" - ) - res = await self.client.get("/access_grants/unmanaged/get", params=params) return UnmanagedAccessGrant.from_dict( @@ -306,7 +280,7 @@ async def get(self, *, access_grant_id: str) -> UnmanagedAccessGrant: @route_metadata( path="/access_grants/unmanaged/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=True, ) async def list( @@ -360,7 +334,7 @@ async def list( @route_metadata( path="/access_grants/unmanaged/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update( @@ -381,8 +355,7 @@ async def update( :param is_managed: Must be set to true to convert the unmanaged access grant to managed. :param access_grant_key: Unique key for the access grant. If not provided, the existing key will be preserved. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if access_grant_id is not None: @@ -392,11 +365,6 @@ async def update( if access_grant_key is not None: json_payload["access_grant_key"] = access_grant_key - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_grants/unmanaged/update" - ) - await self.client.patch("/access_grants/unmanaged/update", json=json_payload) return None diff --git a/seam/routes/access_methods.py b/seam/routes/access_methods.py index db946621..78b5d2f1 100644 --- a/seam/routes/access_methods.py +++ b/seam/routes/access_methods.py @@ -41,9 +41,7 @@ def assign_card( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -81,9 +79,7 @@ def encode( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -92,9 +88,7 @@ def get(self, *, access_method_id: str) -> AccessMethod: :param access_method_id: ID of access method to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -139,9 +133,7 @@ def get_related( :param include: - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -196,9 +188,7 @@ def unlock_door( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -225,9 +215,7 @@ async def assign_card( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -265,9 +253,7 @@ async def encode( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -276,9 +262,7 @@ async def get(self, *, access_method_id: str) -> AccessMethod: :param access_method_id: ID of access method to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -323,9 +307,7 @@ async def get_related( :param include: - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -380,9 +362,7 @@ async def unlock_door( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -398,7 +378,7 @@ def unmanaged(self) -> AccessMethodsUnmanaged: @route_metadata( path="/access_methods/assign_card", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def assign_card( @@ -416,9 +396,7 @@ def assign_card( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if access_method_id is not None: @@ -426,11 +404,6 @@ def assign_card( if card_number is not None: json_payload["card_number"] = card_number - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_methods/assign_card" - ) - res = self.client.post("/access_methods/assign_card", json=json_payload) wait_for_action_attempt = ( @@ -449,7 +422,11 @@ def assign_card( @route_metadata( path="/access_methods/delete", - has_required_parameters=True, + at_least_one_parameter_names=( + "access_grant_id", + "access_method_id", + "reservation_key", + ), has_pagination=False, ) def delete( @@ -477,7 +454,14 @@ def delete( if reservation_key is not None: params["reservation_key"] = reservation_key - if not params: + if all( + param is None + for param in ( + access_grant_id, + access_method_id, + reservation_key, + ) + ): raise ValueError( "At least one parameter is required for /access_methods/delete" ) @@ -488,7 +472,7 @@ def delete( @route_metadata( path="/access_methods/encode", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def encode( @@ -506,9 +490,7 @@ def encode( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if access_method_id is not None: @@ -516,11 +498,6 @@ def encode( if acs_encoder_id is not None: json_payload["acs_encoder_id"] = acs_encoder_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_methods/encode" - ) - res = self.client.post("/access_methods/encode", json=json_payload) wait_for_action_attempt = ( @@ -538,26 +515,21 @@ def encode( ) @route_metadata( - path="/access_methods/get", has_required_parameters=True, has_pagination=False + path="/access_methods/get", + at_least_one_parameter_names=(), + has_pagination=False, ) def get(self, *, access_method_id: str) -> AccessMethod: """Gets an access method. :param access_method_id: ID of access method to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if access_method_id is not None: params["access_method_id"] = access_method_id - if not params: - raise ValueError( - "At least one parameter is required for /access_methods/get" - ) - res = self.client.get("/access_methods/get", params=params) return AccessMethod.from_dict( @@ -566,7 +538,7 @@ def get(self, *, access_method_id: str) -> AccessMethod: @route_metadata( path="/access_methods/get_related", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def get_related( @@ -610,9 +582,7 @@ def get_related( :param include: - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if access_method_ids is not None: @@ -622,17 +592,21 @@ def get_related( if include is not None: params["include"] = include - if not params: - raise ValueError( - "At least one parameter is required for /access_methods/get_related" - ) - res = self.client.get("/access_methods/get_related", params=params) return Batch.from_dict(unwrap(res, "batch", "/access_methods/get_related")) @route_metadata( - path="/access_methods/list", has_required_parameters=True, has_pagination=True + path="/access_methods/list", + at_least_one_parameter_names=( + "access_code_id", + "access_grant_id", + "access_grant_key", + "acs_entrance_id", + "device_id", + "space_id", + ), + has_pagination=True, ) def list( self, @@ -686,7 +660,17 @@ def list( if space_id is not None: params["space_id"] = space_id - if not params: + if all( + param is None + for param in ( + access_code_id, + access_grant_id, + access_grant_key, + acs_entrance_id, + device_id, + space_id, + ) + ): raise ValueError( "At least one parameter is required for /access_methods/list" ) @@ -700,7 +684,7 @@ def list( @route_metadata( path="/access_methods/unlock_door", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def unlock_door( @@ -718,9 +702,7 @@ def unlock_door( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if access_method_id is not None: @@ -728,11 +710,6 @@ def unlock_door( if acs_entrance_id is not None: json_payload["acs_entrance_id"] = acs_entrance_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_methods/unlock_door" - ) - res = self.client.post("/access_methods/unlock_door", json=json_payload) wait_for_action_attempt = ( @@ -762,7 +739,7 @@ def unmanaged(self) -> AsyncAccessMethodsUnmanaged: @route_metadata( path="/access_methods/assign_card", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def assign_card( @@ -780,9 +757,7 @@ async def assign_card( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if access_method_id is not None: @@ -790,11 +765,6 @@ async def assign_card( if card_number is not None: json_payload["card_number"] = card_number - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_methods/assign_card" - ) - res = await self.client.post("/access_methods/assign_card", json=json_payload) wait_for_action_attempt = ( @@ -813,7 +783,11 @@ async def assign_card( @route_metadata( path="/access_methods/delete", - has_required_parameters=True, + at_least_one_parameter_names=( + "access_grant_id", + "access_method_id", + "reservation_key", + ), has_pagination=False, ) async def delete( @@ -841,7 +815,14 @@ async def delete( if reservation_key is not None: params["reservation_key"] = reservation_key - if not params: + if all( + param is None + for param in ( + access_grant_id, + access_method_id, + reservation_key, + ) + ): raise ValueError( "At least one parameter is required for /access_methods/delete" ) @@ -852,7 +833,7 @@ async def delete( @route_metadata( path="/access_methods/encode", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def encode( @@ -870,9 +851,7 @@ async def encode( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if access_method_id is not None: @@ -880,11 +859,6 @@ async def encode( if acs_encoder_id is not None: json_payload["acs_encoder_id"] = acs_encoder_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_methods/encode" - ) - res = await self.client.post("/access_methods/encode", json=json_payload) wait_for_action_attempt = ( @@ -902,26 +876,21 @@ async def encode( ) @route_metadata( - path="/access_methods/get", has_required_parameters=True, has_pagination=False + path="/access_methods/get", + at_least_one_parameter_names=(), + has_pagination=False, ) async def get(self, *, access_method_id: str) -> AccessMethod: """Gets an access method. :param access_method_id: ID of access method to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if access_method_id is not None: params["access_method_id"] = access_method_id - if not params: - raise ValueError( - "At least one parameter is required for /access_methods/get" - ) - res = await self.client.get("/access_methods/get", params=params) return AccessMethod.from_dict( @@ -930,7 +899,7 @@ async def get(self, *, access_method_id: str) -> AccessMethod: @route_metadata( path="/access_methods/get_related", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def get_related( @@ -974,9 +943,7 @@ async def get_related( :param include: - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if access_method_ids is not None: @@ -986,17 +953,21 @@ async def get_related( if include is not None: params["include"] = include - if not params: - raise ValueError( - "At least one parameter is required for /access_methods/get_related" - ) - res = await self.client.get("/access_methods/get_related", params=params) return Batch.from_dict(unwrap(res, "batch", "/access_methods/get_related")) @route_metadata( - path="/access_methods/list", has_required_parameters=True, has_pagination=True + path="/access_methods/list", + at_least_one_parameter_names=( + "access_code_id", + "access_grant_id", + "access_grant_key", + "acs_entrance_id", + "device_id", + "space_id", + ), + has_pagination=True, ) async def list( self, @@ -1050,7 +1021,17 @@ async def list( if space_id is not None: params["space_id"] = space_id - if not params: + if all( + param is None + for param in ( + access_code_id, + access_grant_id, + access_grant_key, + acs_entrance_id, + device_id, + space_id, + ) + ): raise ValueError( "At least one parameter is required for /access_methods/list" ) @@ -1064,7 +1045,7 @@ async def list( @route_metadata( path="/access_methods/unlock_door", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def unlock_door( @@ -1082,9 +1063,7 @@ async def unlock_door( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if access_method_id is not None: @@ -1092,11 +1071,6 @@ async def unlock_door( if acs_entrance_id is not None: json_payload["acs_entrance_id"] = acs_entrance_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /access_methods/unlock_door" - ) - res = await self.client.post("/access_methods/unlock_door", json=json_payload) wait_for_action_attempt = ( diff --git a/seam/routes/access_methods_unmanaged.py b/seam/routes/access_methods_unmanaged.py index 5725a396..7b7d9b0f 100644 --- a/seam/routes/access_methods_unmanaged.py +++ b/seam/routes/access_methods_unmanaged.py @@ -15,9 +15,7 @@ def get(self, *, access_method_id: str) -> UnmanagedAccessMethod: :param access_method_id: ID of unmanaged access method to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -39,9 +37,7 @@ def list( :param space_id: ID of the space for which you want to retrieve all unmanaged access methods. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -53,9 +49,7 @@ async def get(self, *, access_method_id: str) -> UnmanagedAccessMethod: :param access_method_id: ID of unmanaged access method to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -77,9 +71,7 @@ async def list( :param space_id: ID of the space for which you want to retrieve all unmanaged access methods. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -90,7 +82,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/access_methods/unmanaged/get", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def get(self, *, access_method_id: str) -> UnmanagedAccessMethod: @@ -98,19 +90,12 @@ def get(self, *, access_method_id: str) -> UnmanagedAccessMethod: :param access_method_id: ID of unmanaged access method to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if access_method_id is not None: params["access_method_id"] = access_method_id - if not params: - raise ValueError( - "At least one parameter is required for /access_methods/unmanaged/get" - ) - res = self.client.get("/access_methods/unmanaged/get", params=params) return UnmanagedAccessMethod.from_dict( @@ -119,7 +104,7 @@ def get(self, *, access_method_id: str) -> UnmanagedAccessMethod: @route_metadata( path="/access_methods/unmanaged/list", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def list( @@ -140,9 +125,7 @@ def list( :param space_id: ID of the space for which you want to retrieve all unmanaged access methods. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if access_grant_id is not None: @@ -154,11 +137,6 @@ def list( if space_id is not None: params["space_id"] = space_id - if not params: - raise ValueError( - "At least one parameter is required for /access_methods/unmanaged/list" - ) - res = self.client.get("/access_methods/unmanaged/list", params=params) return [ @@ -176,7 +154,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/access_methods/unmanaged/get", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def get(self, *, access_method_id: str) -> UnmanagedAccessMethod: @@ -184,19 +162,12 @@ async def get(self, *, access_method_id: str) -> UnmanagedAccessMethod: :param access_method_id: ID of unmanaged access method to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if access_method_id is not None: params["access_method_id"] = access_method_id - if not params: - raise ValueError( - "At least one parameter is required for /access_methods/unmanaged/get" - ) - res = await self.client.get("/access_methods/unmanaged/get", params=params) return UnmanagedAccessMethod.from_dict( @@ -205,7 +176,7 @@ async def get(self, *, access_method_id: str) -> UnmanagedAccessMethod: @route_metadata( path="/access_methods/unmanaged/list", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def list( @@ -226,9 +197,7 @@ async def list( :param space_id: ID of the space for which you want to retrieve all unmanaged access methods. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if access_grant_id is not None: @@ -240,11 +209,6 @@ async def list( if space_id is not None: params["space_id"] = space_id - if not params: - raise ValueError( - "At least one parameter is required for /access_methods/unmanaged/list" - ) - res = await self.client.get("/access_methods/unmanaged/list", params=params) return [ diff --git a/seam/routes/acs_access_groups.py b/seam/routes/acs_access_groups.py index 4a7b2bf8..7cae400b 100644 --- a/seam/routes/acs_access_groups.py +++ b/seam/routes/acs_access_groups.py @@ -24,17 +24,14 @@ def add_user( :param acs_user_id: ID of the access system user that you want to add to an access group. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the desired user identity that you want to add to an access group. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same ``email_address`` or ``phone_number`` as the user identity that you specify, they are linked, and the access group membership belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod def delete(self, *, acs_access_group_id: str) -> None: """Deletes a specified `access group `_. - :param acs_access_group_id: ID of the access group that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param acs_access_group_id: ID of the access group that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -43,9 +40,7 @@ def get(self, *, acs_access_group_id: str) -> AcsAccessGroup: :param acs_access_group_id: ID of the access group that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -78,9 +73,7 @@ def list_accessible_entrances( :param acs_access_group_id: ID of the access group for which you want to retrieve all accessible entrances. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -89,9 +82,7 @@ def list_users(self, *, acs_access_group_id: str) -> List[AcsUser]: :param acs_access_group_id: ID of the access group for which you want to retrieve all access system users. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -109,8 +100,7 @@ def remove_user( :param acs_user_id: ID of the access system user that you want to remove from an access group. :param user_identity_id: ID of the user identity associated with the user that you want to remove from an access group. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -131,17 +121,14 @@ async def add_user( :param acs_user_id: ID of the access system user that you want to add to an access group. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the desired user identity that you want to add to an access group. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same ``email_address`` or ``phone_number`` as the user identity that you specify, they are linked, and the access group membership belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod async def delete(self, *, acs_access_group_id: str) -> None: """Deletes a specified `access group `_. - :param acs_access_group_id: ID of the access group that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param acs_access_group_id: ID of the access group that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -150,9 +137,7 @@ async def get(self, *, acs_access_group_id: str) -> AcsAccessGroup: :param acs_access_group_id: ID of the access group that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -185,9 +170,7 @@ async def list_accessible_entrances( :param acs_access_group_id: ID of the access group for which you want to retrieve all accessible entrances. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -196,9 +179,7 @@ async def list_users(self, *, acs_access_group_id: str) -> List[AcsUser]: :param acs_access_group_id: ID of the access group for which you want to retrieve all access system users. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -216,8 +197,7 @@ async def remove_user( :param acs_user_id: ID of the access system user that you want to remove from an access group. :param user_identity_id: ID of the user identity associated with the user that you want to remove from an access group. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -228,7 +208,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/acs/access_groups/add_user", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def add_user( @@ -245,8 +225,7 @@ def add_user( :param acs_user_id: ID of the access system user that you want to add to an access group. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the desired user identity that you want to add to an access group. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same ``email_address`` or ``phone_number`` as the user identity that you specify, they are linked, and the access group membership belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_access_group_id is not None: @@ -256,43 +235,31 @@ def add_user( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/access_groups/add_user" - ) - self.client.put("/acs/access_groups/add_user", json=json_payload) return None @route_metadata( path="/acs/access_groups/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def delete(self, *, acs_access_group_id: str) -> None: """Deletes a specified `access group `_. - :param acs_access_group_id: ID of the access group that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param acs_access_group_id: ID of the access group that you want to delete.""" params: Dict[str, Any] = {} if acs_access_group_id is not None: params["acs_access_group_id"] = acs_access_group_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/access_groups/delete" - ) - self.client.delete("/acs/access_groups/delete", params=params) return None @route_metadata( path="/acs/access_groups/get", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def get(self, *, acs_access_group_id: str) -> AcsAccessGroup: @@ -300,19 +267,12 @@ def get(self, *, acs_access_group_id: str) -> AcsAccessGroup: :param acs_access_group_id: ID of the access group that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_access_group_id is not None: params["acs_access_group_id"] = acs_access_group_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/access_groups/get" - ) - res = self.client.get("/acs/access_groups/get", params=params) return AcsAccessGroup.from_dict( @@ -321,7 +281,7 @@ def get(self, *, acs_access_group_id: str) -> AcsAccessGroup: @route_metadata( path="/acs/access_groups/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) def list( @@ -363,7 +323,7 @@ def list( @route_metadata( path="/acs/access_groups/list_accessible_entrances", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def list_accessible_entrances( @@ -373,19 +333,12 @@ def list_accessible_entrances( :param acs_access_group_id: ID of the access group for which you want to retrieve all accessible entrances. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_access_group_id is not None: params["acs_access_group_id"] = acs_access_group_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/access_groups/list_accessible_entrances" - ) - res = self.client.get( "/acs/access_groups/list_accessible_entrances", params=params ) @@ -399,7 +352,7 @@ def list_accessible_entrances( @route_metadata( path="/acs/access_groups/list_users", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def list_users(self, *, acs_access_group_id: str) -> List[AcsUser]: @@ -407,19 +360,12 @@ def list_users(self, *, acs_access_group_id: str) -> List[AcsUser]: :param acs_access_group_id: ID of the access group for which you want to retrieve all access system users. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_access_group_id is not None: params["acs_access_group_id"] = acs_access_group_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/access_groups/list_users" - ) - res = self.client.get("/acs/access_groups/list_users", params=params) return [ @@ -429,7 +375,7 @@ def list_users(self, *, acs_access_group_id: str) -> List[AcsUser]: @route_metadata( path="/acs/access_groups/remove_user", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def remove_user( @@ -446,8 +392,7 @@ def remove_user( :param acs_user_id: ID of the access system user that you want to remove from an access group. :param user_identity_id: ID of the user identity associated with the user that you want to remove from an access group. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if acs_access_group_id is not None: @@ -457,11 +402,6 @@ def remove_user( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/access_groups/remove_user" - ) - self.client.delete("/acs/access_groups/remove_user", params=params) return None @@ -474,7 +414,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/acs/access_groups/add_user", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def add_user( @@ -491,8 +431,7 @@ async def add_user( :param acs_user_id: ID of the access system user that you want to add to an access group. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the desired user identity that you want to add to an access group. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same ``email_address`` or ``phone_number`` as the user identity that you specify, they are linked, and the access group membership belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_access_group_id is not None: @@ -502,43 +441,31 @@ async def add_user( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/access_groups/add_user" - ) - await self.client.put("/acs/access_groups/add_user", json=json_payload) return None @route_metadata( path="/acs/access_groups/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def delete(self, *, acs_access_group_id: str) -> None: """Deletes a specified `access group `_. - :param acs_access_group_id: ID of the access group that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param acs_access_group_id: ID of the access group that you want to delete.""" params: Dict[str, Any] = {} if acs_access_group_id is not None: params["acs_access_group_id"] = acs_access_group_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/access_groups/delete" - ) - await self.client.delete("/acs/access_groups/delete", params=params) return None @route_metadata( path="/acs/access_groups/get", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def get(self, *, acs_access_group_id: str) -> AcsAccessGroup: @@ -546,19 +473,12 @@ async def get(self, *, acs_access_group_id: str) -> AcsAccessGroup: :param acs_access_group_id: ID of the access group that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_access_group_id is not None: params["acs_access_group_id"] = acs_access_group_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/access_groups/get" - ) - res = await self.client.get("/acs/access_groups/get", params=params) return AcsAccessGroup.from_dict( @@ -567,7 +487,7 @@ async def get(self, *, acs_access_group_id: str) -> AcsAccessGroup: @route_metadata( path="/acs/access_groups/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) async def list( @@ -609,7 +529,7 @@ async def list( @route_metadata( path="/acs/access_groups/list_accessible_entrances", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def list_accessible_entrances( @@ -619,19 +539,12 @@ async def list_accessible_entrances( :param acs_access_group_id: ID of the access group for which you want to retrieve all accessible entrances. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_access_group_id is not None: params["acs_access_group_id"] = acs_access_group_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/access_groups/list_accessible_entrances" - ) - res = await self.client.get( "/acs/access_groups/list_accessible_entrances", params=params ) @@ -645,7 +558,7 @@ async def list_accessible_entrances( @route_metadata( path="/acs/access_groups/list_users", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def list_users(self, *, acs_access_group_id: str) -> List[AcsUser]: @@ -653,19 +566,12 @@ async def list_users(self, *, acs_access_group_id: str) -> List[AcsUser]: :param acs_access_group_id: ID of the access group for which you want to retrieve all access system users. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_access_group_id is not None: params["acs_access_group_id"] = acs_access_group_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/access_groups/list_users" - ) - res = await self.client.get("/acs/access_groups/list_users", params=params) return [ @@ -675,7 +581,7 @@ async def list_users(self, *, acs_access_group_id: str) -> List[AcsUser]: @route_metadata( path="/acs/access_groups/remove_user", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def remove_user( @@ -692,8 +598,7 @@ async def remove_user( :param acs_user_id: ID of the access system user that you want to remove from an access group. :param user_identity_id: ID of the user identity associated with the user that you want to remove from an access group. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if acs_access_group_id is not None: @@ -703,11 +608,6 @@ async def remove_user( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/access_groups/remove_user" - ) - await self.client.delete("/acs/access_groups/remove_user", params=params) return None diff --git a/seam/routes/acs_credentials.py b/seam/routes/acs_credentials.py index 3acfbcc8..224bee62 100644 --- a/seam/routes/acs_credentials.py +++ b/seam/routes/acs_credentials.py @@ -25,8 +25,7 @@ def assign( :param acs_user_id: ID of the access system user to whom you want to assign a credential. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity to whom you want to assign a credential. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same ``email_address`` or ``phone_number`` as the user identity that you specify, they are linked, and the credential belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -75,18 +74,14 @@ def create( :param visionline_metadata: Visionline-specific metadata for the new credential. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod def delete(self, *, acs_credential_id: str) -> None: """Deletes a specified `credential `_. - :param acs_credential_id: ID of the credential that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param acs_credential_id: ID of the credential that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -95,9 +90,7 @@ def get(self, *, acs_credential_id: str) -> AcsCredential: :param acs_credential_id: ID of the credential that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -140,9 +133,7 @@ def list_accessible_entrances(self, *, acs_credential_id: str) -> List[AcsEntran :param acs_credential_id: ID of the credential for which you want to retrieve all entrances to which the credential grants access. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -160,8 +151,7 @@ def unassign( :param acs_user_id: ID of the access system user from which you want to unassign a credential. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity from which you want to unassign a credential. You can only provide one of acs_user_id or user_identity_id. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -179,8 +169,7 @@ def update( :param code: Replacement access (PIN) code for the credential that you want to update. :param ends_at: Replacement date and time at which the validity of the credential ends, in `ISO 8601 `_ format. Must be a time in the future and after the ``starts_at`` value that you set when creating the credential. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -201,8 +190,7 @@ async def assign( :param acs_user_id: ID of the access system user to whom you want to assign a credential. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity to whom you want to assign a credential. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same ``email_address`` or ``phone_number`` as the user identity that you specify, they are linked, and the credential belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -251,18 +239,14 @@ async def create( :param visionline_metadata: Visionline-specific metadata for the new credential. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod async def delete(self, *, acs_credential_id: str) -> None: """Deletes a specified `credential `_. - :param acs_credential_id: ID of the credential that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param acs_credential_id: ID of the credential that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -271,9 +255,7 @@ async def get(self, *, acs_credential_id: str) -> AcsCredential: :param acs_credential_id: ID of the credential that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -318,9 +300,7 @@ async def list_accessible_entrances( :param acs_credential_id: ID of the credential for which you want to retrieve all entrances to which the credential grants access. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -338,8 +318,7 @@ async def unassign( :param acs_user_id: ID of the access system user from which you want to unassign a credential. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity from which you want to unassign a credential. You can only provide one of acs_user_id or user_identity_id. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -357,8 +336,7 @@ async def update( :param code: Replacement access (PIN) code for the credential that you want to update. :param ends_at: Replacement date and time at which the validity of the credential ends, in `ISO 8601 `_ format. Must be a time in the future and after the ``starts_at`` value that you set when creating the credential. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -369,7 +347,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/acs/credentials/assign", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def assign( @@ -386,8 +364,7 @@ def assign( :param acs_user_id: ID of the access system user to whom you want to assign a credential. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity to whom you want to assign a credential. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same ``email_address`` or ``phone_number`` as the user identity that you specify, they are linked, and the credential belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_credential_id is not None: @@ -397,18 +374,13 @@ def assign( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/credentials/assign" - ) - self.client.patch("/acs/credentials/assign", json=json_payload) return None @route_metadata( path="/acs/credentials/create", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def create( @@ -456,9 +428,7 @@ def create( :param visionline_metadata: Visionline-specific metadata for the new credential. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if access_method is not None: @@ -492,11 +462,6 @@ def create( if visionline_metadata is not None: json_payload["visionline_metadata"] = visionline_metadata - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/credentials/create" - ) - res = self.client.post("/acs/credentials/create", json=json_payload) return AcsCredential.from_dict( @@ -505,50 +470,38 @@ def create( @route_metadata( path="/acs/credentials/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def delete(self, *, acs_credential_id: str) -> None: """Deletes a specified `credential `_. - :param acs_credential_id: ID of the credential that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param acs_credential_id: ID of the credential that you want to delete.""" params: Dict[str, Any] = {} if acs_credential_id is not None: params["acs_credential_id"] = acs_credential_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/credentials/delete" - ) - self.client.delete("/acs/credentials/delete", params=params) return None @route_metadata( - path="/acs/credentials/get", has_required_parameters=True, has_pagination=False + path="/acs/credentials/get", + at_least_one_parameter_names=(), + has_pagination=False, ) def get(self, *, acs_credential_id: str) -> AcsCredential: """Returns a specified `credential `_. :param acs_credential_id: ID of the credential that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_credential_id is not None: params["acs_credential_id"] = acs_credential_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/credentials/get" - ) - res = self.client.get("/acs/credentials/get", params=params) return AcsCredential.from_dict( @@ -556,7 +509,9 @@ def get(self, *, acs_credential_id: str) -> AcsCredential: ) @route_metadata( - path="/acs/credentials/list", has_required_parameters=False, has_pagination=True + path="/acs/credentials/list", + at_least_one_parameter_names=(), + has_pagination=True, ) def list( self, @@ -617,7 +572,7 @@ def list( @route_metadata( path="/acs/credentials/list_accessible_entrances", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def list_accessible_entrances(self, *, acs_credential_id: str) -> List[AcsEntrance]: @@ -625,19 +580,12 @@ def list_accessible_entrances(self, *, acs_credential_id: str) -> List[AcsEntran :param acs_credential_id: ID of the credential for which you want to retrieve all entrances to which the credential grants access. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_credential_id is not None: params["acs_credential_id"] = acs_credential_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/credentials/list_accessible_entrances" - ) - res = self.client.get( "/acs/credentials/list_accessible_entrances", params=params ) @@ -651,7 +599,7 @@ def list_accessible_entrances(self, *, acs_credential_id: str) -> List[AcsEntran @route_metadata( path="/acs/credentials/unassign", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def unassign( @@ -668,8 +616,7 @@ def unassign( :param acs_user_id: ID of the access system user from which you want to unassign a credential. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity from which you want to unassign a credential. You can only provide one of acs_user_id or user_identity_id. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_credential_id is not None: @@ -679,18 +626,13 @@ def unassign( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/credentials/unassign" - ) - self.client.patch("/acs/credentials/unassign", json=json_payload) return None @route_metadata( path="/acs/credentials/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update( @@ -707,8 +649,7 @@ def update( :param code: Replacement access (PIN) code for the credential that you want to update. :param ends_at: Replacement date and time at which the validity of the credential ends, in `ISO 8601 `_ format. Must be a time in the future and after the ``starts_at`` value that you set when creating the credential. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_credential_id is not None: @@ -718,11 +659,6 @@ def update( if ends_at is not None: json_payload["ends_at"] = ends_at - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/credentials/update" - ) - self.client.patch("/acs/credentials/update", json=json_payload) return None @@ -735,7 +671,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/acs/credentials/assign", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def assign( @@ -752,8 +688,7 @@ async def assign( :param acs_user_id: ID of the access system user to whom you want to assign a credential. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity to whom you want to assign a credential. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same ``email_address`` or ``phone_number`` as the user identity that you specify, they are linked, and the credential belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_credential_id is not None: @@ -763,18 +698,13 @@ async def assign( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/credentials/assign" - ) - await self.client.patch("/acs/credentials/assign", json=json_payload) return None @route_metadata( path="/acs/credentials/create", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def create( @@ -822,9 +752,7 @@ async def create( :param visionline_metadata: Visionline-specific metadata for the new credential. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if access_method is not None: @@ -858,11 +786,6 @@ async def create( if visionline_metadata is not None: json_payload["visionline_metadata"] = visionline_metadata - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/credentials/create" - ) - res = await self.client.post("/acs/credentials/create", json=json_payload) return AcsCredential.from_dict( @@ -871,50 +794,38 @@ async def create( @route_metadata( path="/acs/credentials/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def delete(self, *, acs_credential_id: str) -> None: """Deletes a specified `credential `_. - :param acs_credential_id: ID of the credential that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param acs_credential_id: ID of the credential that you want to delete.""" params: Dict[str, Any] = {} if acs_credential_id is not None: params["acs_credential_id"] = acs_credential_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/credentials/delete" - ) - await self.client.delete("/acs/credentials/delete", params=params) return None @route_metadata( - path="/acs/credentials/get", has_required_parameters=True, has_pagination=False + path="/acs/credentials/get", + at_least_one_parameter_names=(), + has_pagination=False, ) async def get(self, *, acs_credential_id: str) -> AcsCredential: """Returns a specified `credential `_. :param acs_credential_id: ID of the credential that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_credential_id is not None: params["acs_credential_id"] = acs_credential_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/credentials/get" - ) - res = await self.client.get("/acs/credentials/get", params=params) return AcsCredential.from_dict( @@ -922,7 +833,9 @@ async def get(self, *, acs_credential_id: str) -> AcsCredential: ) @route_metadata( - path="/acs/credentials/list", has_required_parameters=False, has_pagination=True + path="/acs/credentials/list", + at_least_one_parameter_names=(), + has_pagination=True, ) async def list( self, @@ -983,7 +896,7 @@ async def list( @route_metadata( path="/acs/credentials/list_accessible_entrances", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def list_accessible_entrances( @@ -993,19 +906,12 @@ async def list_accessible_entrances( :param acs_credential_id: ID of the credential for which you want to retrieve all entrances to which the credential grants access. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_credential_id is not None: params["acs_credential_id"] = acs_credential_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/credentials/list_accessible_entrances" - ) - res = await self.client.get( "/acs/credentials/list_accessible_entrances", params=params ) @@ -1019,7 +925,7 @@ async def list_accessible_entrances( @route_metadata( path="/acs/credentials/unassign", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def unassign( @@ -1036,8 +942,7 @@ async def unassign( :param acs_user_id: ID of the access system user from which you want to unassign a credential. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity from which you want to unassign a credential. You can only provide one of acs_user_id or user_identity_id. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_credential_id is not None: @@ -1047,18 +952,13 @@ async def unassign( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/credentials/unassign" - ) - await self.client.patch("/acs/credentials/unassign", json=json_payload) return None @route_metadata( path="/acs/credentials/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update( @@ -1075,8 +975,7 @@ async def update( :param code: Replacement access (PIN) code for the credential that you want to update. :param ends_at: Replacement date and time at which the validity of the credential ends, in `ISO 8601 `_ format. Must be a time in the future and after the ``starts_at`` value that you set when creating the credential. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_credential_id is not None: @@ -1086,11 +985,6 @@ async def update( if ends_at is not None: json_payload["ends_at"] = ends_at - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/credentials/update" - ) - await self.client.patch("/acs/credentials/update", json=json_payload) return None diff --git a/seam/routes/acs_encoders.py b/seam/routes/acs_encoders.py index 3482b2e1..d1227a77 100644 --- a/seam/routes/acs_encoders.py +++ b/seam/routes/acs_encoders.py @@ -44,9 +44,7 @@ def encode_credential( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -55,9 +53,7 @@ def get(self, *, acs_encoder_id: str) -> AcsEncoder: :param acs_encoder_id: ID of the encoder that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -101,9 +97,7 @@ def scan_credential( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -128,9 +122,7 @@ def scan_to_assign_credential( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -160,9 +152,7 @@ async def encode_credential( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -171,9 +161,7 @@ async def get(self, *, acs_encoder_id: str) -> AcsEncoder: :param acs_encoder_id: ID of the encoder that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -217,9 +205,7 @@ async def scan_credential( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -244,9 +230,7 @@ async def scan_to_assign_credential( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -262,7 +246,7 @@ def simulate(self) -> AcsEncodersSimulate: @route_metadata( path="/acs/encoders/encode_credential", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def encode_credential( @@ -283,9 +267,7 @@ def encode_credential( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -295,11 +277,6 @@ def encode_credential( if acs_credential_id is not None: json_payload["acs_credential_id"] = acs_credential_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/encode_credential" - ) - res = self.client.post("/acs/encoders/encode_credential", json=json_payload) wait_for_action_attempt = ( @@ -317,30 +294,25 @@ def encode_credential( ) @route_metadata( - path="/acs/encoders/get", has_required_parameters=True, has_pagination=False + path="/acs/encoders/get", at_least_one_parameter_names=(), has_pagination=False ) def get(self, *, acs_encoder_id: str) -> AcsEncoder: """Returns a specified `encoder `_. :param acs_encoder_id: ID of the encoder that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_encoder_id is not None: params["acs_encoder_id"] = acs_encoder_id - if not params: - raise ValueError("At least one parameter is required for /acs/encoders/get") - res = self.client.get("/acs/encoders/get", params=params) return AcsEncoder.from_dict(unwrap(res, "acs_encoder", "/acs/encoders/get")) @route_metadata( - path="/acs/encoders/list", has_required_parameters=False, has_pagination=True + path="/acs/encoders/list", at_least_one_parameter_names=(), has_pagination=True ) def list( self, @@ -386,7 +358,7 @@ def list( @route_metadata( path="/acs/encoders/scan_credential", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def scan_credential( @@ -404,9 +376,7 @@ def scan_credential( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -414,11 +384,6 @@ def scan_credential( if salto_ks_metadata is not None: json_payload["salto_ks_metadata"] = salto_ks_metadata - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/scan_credential" - ) - res = self.client.post("/acs/encoders/scan_credential", json=json_payload) wait_for_action_attempt = ( @@ -437,7 +402,7 @@ def scan_credential( @route_metadata( path="/acs/encoders/scan_to_assign_credential", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def scan_to_assign_credential( @@ -461,9 +426,7 @@ def scan_to_assign_credential( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -475,11 +438,6 @@ def scan_to_assign_credential( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/scan_to_assign_credential" - ) - res = self.client.post( "/acs/encoders/scan_to_assign_credential", json=json_payload ) @@ -511,7 +469,7 @@ def simulate(self) -> AsyncAcsEncodersSimulate: @route_metadata( path="/acs/encoders/encode_credential", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def encode_credential( @@ -532,9 +490,7 @@ async def encode_credential( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -544,11 +500,6 @@ async def encode_credential( if acs_credential_id is not None: json_payload["acs_credential_id"] = acs_credential_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/encode_credential" - ) - res = await self.client.post( "/acs/encoders/encode_credential", json=json_payload ) @@ -568,30 +519,25 @@ async def encode_credential( ) @route_metadata( - path="/acs/encoders/get", has_required_parameters=True, has_pagination=False + path="/acs/encoders/get", at_least_one_parameter_names=(), has_pagination=False ) async def get(self, *, acs_encoder_id: str) -> AcsEncoder: """Returns a specified `encoder `_. :param acs_encoder_id: ID of the encoder that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_encoder_id is not None: params["acs_encoder_id"] = acs_encoder_id - if not params: - raise ValueError("At least one parameter is required for /acs/encoders/get") - res = await self.client.get("/acs/encoders/get", params=params) return AcsEncoder.from_dict(unwrap(res, "acs_encoder", "/acs/encoders/get")) @route_metadata( - path="/acs/encoders/list", has_required_parameters=False, has_pagination=True + path="/acs/encoders/list", at_least_one_parameter_names=(), has_pagination=True ) async def list( self, @@ -637,7 +583,7 @@ async def list( @route_metadata( path="/acs/encoders/scan_credential", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def scan_credential( @@ -655,9 +601,7 @@ async def scan_credential( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -665,11 +609,6 @@ async def scan_credential( if salto_ks_metadata is not None: json_payload["salto_ks_metadata"] = salto_ks_metadata - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/scan_credential" - ) - res = await self.client.post("/acs/encoders/scan_credential", json=json_payload) wait_for_action_attempt = ( @@ -688,7 +627,7 @@ async def scan_credential( @route_metadata( path="/acs/encoders/scan_to_assign_credential", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def scan_to_assign_credential( @@ -712,9 +651,7 @@ async def scan_to_assign_credential( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -726,11 +663,6 @@ async def scan_to_assign_credential( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/scan_to_assign_credential" - ) - res = await self.client.post( "/acs/encoders/scan_to_assign_credential", json=json_payload ) diff --git a/seam/routes/acs_encoders_simulate.py b/seam/routes/acs_encoders_simulate.py index 29269de8..3be585cc 100644 --- a/seam/routes/acs_encoders_simulate.py +++ b/seam/routes/acs_encoders_simulate.py @@ -27,9 +27,7 @@ def next_credential_encode_will_fail( :param acs_credential_id: ID of the ``acs_credential`` that will fail to be encoded onto a card in the next request. - :param error_code: Code of the error to simulate. - - :raises ValueError: At least one parameter must be provided.""" + :param error_code: Code of the error to simulate.""" raise NotImplementedError() @abc.abstractmethod @@ -43,9 +41,7 @@ def next_credential_encode_will_succeed( :param acs_encoder_id: ID of the ``acs_encoder`` that will be used in the next request to encode the ``acs_credential``. - :param scenario: Scenario to simulate. - - :raises ValueError: At least one parameter must be provided.""" + :param scenario: Scenario to simulate.""" raise NotImplementedError() @abc.abstractmethod @@ -68,9 +64,7 @@ def next_credential_scan_will_fail( :param acs_credential_id_on_seam: - :param error_code: - - :raises ValueError: At least one parameter must be provided.""" + :param error_code:""" raise NotImplementedError() @abc.abstractmethod @@ -94,9 +88,7 @@ def next_credential_scan_will_succeed( :param acs_credential_id_on_seam: ID of the Seam ``acs_credential`` that matches the ``acs_credential`` on the encoder in this simulation. - :param scenario: Scenario to simulate. - - :raises ValueError: At least one parameter must be provided.""" + :param scenario: Scenario to simulate.""" raise NotImplementedError() @@ -123,9 +115,7 @@ async def next_credential_encode_will_fail( :param acs_credential_id: ID of the ``acs_credential`` that will fail to be encoded onto a card in the next request. - :param error_code: Code of the error to simulate. - - :raises ValueError: At least one parameter must be provided.""" + :param error_code: Code of the error to simulate.""" raise NotImplementedError() @abc.abstractmethod @@ -139,9 +129,7 @@ async def next_credential_encode_will_succeed( :param acs_encoder_id: ID of the ``acs_encoder`` that will be used in the next request to encode the ``acs_credential``. - :param scenario: Scenario to simulate. - - :raises ValueError: At least one parameter must be provided.""" + :param scenario: Scenario to simulate.""" raise NotImplementedError() @abc.abstractmethod @@ -164,9 +152,7 @@ async def next_credential_scan_will_fail( :param acs_credential_id_on_seam: - :param error_code: - - :raises ValueError: At least one parameter must be provided.""" + :param error_code:""" raise NotImplementedError() @abc.abstractmethod @@ -190,9 +176,7 @@ async def next_credential_scan_will_succeed( :param acs_credential_id_on_seam: ID of the Seam ``acs_credential`` that matches the ``acs_credential`` on the encoder in this simulation. - :param scenario: Scenario to simulate. - - :raises ValueError: At least one parameter must be provided.""" + :param scenario: Scenario to simulate.""" raise NotImplementedError() @@ -203,7 +187,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/acs/encoders/simulate/next_credential_encode_will_fail", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def next_credential_encode_will_fail( @@ -226,9 +210,7 @@ def next_credential_encode_will_fail( :param acs_credential_id: ID of the ``acs_credential`` that will fail to be encoded onto a card in the next request. - :param error_code: Code of the error to simulate. - - :raises ValueError: At least one parameter must be provided.""" + :param error_code: Code of the error to simulate.""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -238,11 +220,6 @@ def next_credential_encode_will_fail( if error_code is not None: json_payload["error_code"] = error_code - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/simulate/next_credential_encode_will_fail" - ) - self.client.post( "/acs/encoders/simulate/next_credential_encode_will_fail", json=json_payload ) @@ -251,7 +228,7 @@ def next_credential_encode_will_fail( @route_metadata( path="/acs/encoders/simulate/next_credential_encode_will_succeed", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def next_credential_encode_will_succeed( @@ -264,9 +241,7 @@ def next_credential_encode_will_succeed( :param acs_encoder_id: ID of the ``acs_encoder`` that will be used in the next request to encode the ``acs_credential``. - :param scenario: Scenario to simulate. - - :raises ValueError: At least one parameter must be provided.""" + :param scenario: Scenario to simulate.""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -274,11 +249,6 @@ def next_credential_encode_will_succeed( if scenario is not None: json_payload["scenario"] = scenario - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/simulate/next_credential_encode_will_succeed" - ) - self.client.post( "/acs/encoders/simulate/next_credential_encode_will_succeed", json=json_payload, @@ -288,7 +258,7 @@ def next_credential_encode_will_succeed( @route_metadata( path="/acs/encoders/simulate/next_credential_scan_will_fail", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def next_credential_scan_will_fail( @@ -310,9 +280,7 @@ def next_credential_scan_will_fail( :param acs_credential_id_on_seam: - :param error_code: - - :raises ValueError: At least one parameter must be provided.""" + :param error_code:""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -322,11 +290,6 @@ def next_credential_scan_will_fail( if error_code is not None: json_payload["error_code"] = error_code - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/simulate/next_credential_scan_will_fail" - ) - self.client.post( "/acs/encoders/simulate/next_credential_scan_will_fail", json=json_payload ) @@ -335,7 +298,7 @@ def next_credential_scan_will_fail( @route_metadata( path="/acs/encoders/simulate/next_credential_scan_will_succeed", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def next_credential_scan_will_succeed( @@ -358,9 +321,7 @@ def next_credential_scan_will_succeed( :param acs_credential_id_on_seam: ID of the Seam ``acs_credential`` that matches the ``acs_credential`` on the encoder in this simulation. - :param scenario: Scenario to simulate. - - :raises ValueError: At least one parameter must be provided.""" + :param scenario: Scenario to simulate.""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -370,11 +331,6 @@ def next_credential_scan_will_succeed( if scenario is not None: json_payload["scenario"] = scenario - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/simulate/next_credential_scan_will_succeed" - ) - self.client.post( "/acs/encoders/simulate/next_credential_scan_will_succeed", json=json_payload, @@ -390,7 +346,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/acs/encoders/simulate/next_credential_encode_will_fail", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def next_credential_encode_will_fail( @@ -413,9 +369,7 @@ async def next_credential_encode_will_fail( :param acs_credential_id: ID of the ``acs_credential`` that will fail to be encoded onto a card in the next request. - :param error_code: Code of the error to simulate. - - :raises ValueError: At least one parameter must be provided.""" + :param error_code: Code of the error to simulate.""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -425,11 +379,6 @@ async def next_credential_encode_will_fail( if error_code is not None: json_payload["error_code"] = error_code - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/simulate/next_credential_encode_will_fail" - ) - await self.client.post( "/acs/encoders/simulate/next_credential_encode_will_fail", json=json_payload ) @@ -438,7 +387,7 @@ async def next_credential_encode_will_fail( @route_metadata( path="/acs/encoders/simulate/next_credential_encode_will_succeed", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def next_credential_encode_will_succeed( @@ -451,9 +400,7 @@ async def next_credential_encode_will_succeed( :param acs_encoder_id: ID of the ``acs_encoder`` that will be used in the next request to encode the ``acs_credential``. - :param scenario: Scenario to simulate. - - :raises ValueError: At least one parameter must be provided.""" + :param scenario: Scenario to simulate.""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -461,11 +408,6 @@ async def next_credential_encode_will_succeed( if scenario is not None: json_payload["scenario"] = scenario - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/simulate/next_credential_encode_will_succeed" - ) - await self.client.post( "/acs/encoders/simulate/next_credential_encode_will_succeed", json=json_payload, @@ -475,7 +417,7 @@ async def next_credential_encode_will_succeed( @route_metadata( path="/acs/encoders/simulate/next_credential_scan_will_fail", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def next_credential_scan_will_fail( @@ -497,9 +439,7 @@ async def next_credential_scan_will_fail( :param acs_credential_id_on_seam: - :param error_code: - - :raises ValueError: At least one parameter must be provided.""" + :param error_code:""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -509,11 +449,6 @@ async def next_credential_scan_will_fail( if error_code is not None: json_payload["error_code"] = error_code - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/simulate/next_credential_scan_will_fail" - ) - await self.client.post( "/acs/encoders/simulate/next_credential_scan_will_fail", json=json_payload ) @@ -522,7 +457,7 @@ async def next_credential_scan_will_fail( @route_metadata( path="/acs/encoders/simulate/next_credential_scan_will_succeed", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def next_credential_scan_will_succeed( @@ -545,9 +480,7 @@ async def next_credential_scan_will_succeed( :param acs_credential_id_on_seam: ID of the Seam ``acs_credential`` that matches the ``acs_credential`` on the encoder in this simulation. - :param scenario: Scenario to simulate. - - :raises ValueError: At least one parameter must be provided.""" + :param scenario: Scenario to simulate.""" json_payload: Dict[str, Any] = {} if acs_encoder_id is not None: @@ -557,11 +490,6 @@ async def next_credential_scan_will_succeed( if scenario is not None: json_payload["scenario"] = scenario - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/encoders/simulate/next_credential_scan_will_succeed" - ) - await self.client.post( "/acs/encoders/simulate/next_credential_scan_will_succeed", json=json_payload, diff --git a/seam/routes/acs_entrances.py b/seam/routes/acs_entrances.py index 8f233493..6cf862e1 100644 --- a/seam/routes/acs_entrances.py +++ b/seam/routes/acs_entrances.py @@ -25,9 +25,7 @@ def get(self, *, acs_entrance_id: str) -> AcsEntrance: :param acs_entrance_id: ID of the entrance that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -45,8 +43,7 @@ def grant_access( :param acs_user_id: ID of the access system user to whom you want to grant access to an entrance. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity to whom you want to grant access to an entrance. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same ``email_address`` or ``phone_number`` as the user identity that you specify, they are linked, and the access group membership belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -105,9 +102,7 @@ def list_credentials_with_access( :param include_if: Conditions that credentials must meet to be included in the returned list. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -126,9 +121,7 @@ def unlock( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -140,9 +133,7 @@ async def get(self, *, acs_entrance_id: str) -> AcsEntrance: :param acs_entrance_id: ID of the entrance that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -160,8 +151,7 @@ async def grant_access( :param acs_user_id: ID of the access system user to whom you want to grant access to an entrance. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity to whom you want to grant access to an entrance. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same ``email_address`` or ``phone_number`` as the user identity that you specify, they are linked, and the access group membership belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -220,9 +210,7 @@ async def list_credentials_with_access( :param include_if: Conditions that credentials must meet to be included in the returned list. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -241,9 +229,7 @@ async def unlock( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -253,33 +239,26 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/acs/entrances/get", has_required_parameters=True, has_pagination=False + path="/acs/entrances/get", at_least_one_parameter_names=(), has_pagination=False ) def get(self, *, acs_entrance_id: str) -> AcsEntrance: """Returns a specified `access system entrance `_. :param acs_entrance_id: ID of the entrance that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_entrance_id is not None: params["acs_entrance_id"] = acs_entrance_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/entrances/get" - ) - res = self.client.get("/acs/entrances/get", params=params) return AcsEntrance.from_dict(unwrap(res, "acs_entrance", "/acs/entrances/get")) @route_metadata( path="/acs/entrances/grant_access", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def grant_access( @@ -296,8 +275,7 @@ def grant_access( :param acs_user_id: ID of the access system user to whom you want to grant access to an entrance. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity to whom you want to grant access to an entrance. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same ``email_address`` or ``phone_number`` as the user identity that you specify, they are linked, and the access group membership belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_entrance_id is not None: @@ -307,17 +285,12 @@ def grant_access( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/entrances/grant_access" - ) - self.client.post("/acs/entrances/grant_access", json=json_payload) return None @route_metadata( - path="/acs/entrances/list", has_required_parameters=False, has_pagination=True + path="/acs/entrances/list", at_least_one_parameter_names=(), has_pagination=True ) def list( self, @@ -393,7 +366,7 @@ def list( @route_metadata( path="/acs/entrances/list_credentials_with_access", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def list_credentials_with_access( @@ -408,9 +381,7 @@ def list_credentials_with_access( :param include_if: Conditions that credentials must meet to be included in the returned list. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_entrance_id is not None: @@ -418,11 +389,6 @@ def list_credentials_with_access( if include_if is not None: params["include_if"] = include_if - if not params: - raise ValueError( - "At least one parameter is required for /acs/entrances/list_credentials_with_access" - ) - res = self.client.get( "/acs/entrances/list_credentials_with_access", params=params ) @@ -435,7 +401,9 @@ def list_credentials_with_access( ] @route_metadata( - path="/acs/entrances/unlock", has_required_parameters=True, has_pagination=False + path="/acs/entrances/unlock", + at_least_one_parameter_names=(), + has_pagination=False, ) def unlock( self, @@ -452,9 +420,7 @@ def unlock( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if acs_credential_id is not None: @@ -462,11 +428,6 @@ def unlock( if acs_entrance_id is not None: json_payload["acs_entrance_id"] = acs_entrance_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/entrances/unlock" - ) - res = self.client.post("/acs/entrances/unlock", json=json_payload) wait_for_action_attempt = ( @@ -490,33 +451,26 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/acs/entrances/get", has_required_parameters=True, has_pagination=False + path="/acs/entrances/get", at_least_one_parameter_names=(), has_pagination=False ) async def get(self, *, acs_entrance_id: str) -> AcsEntrance: """Returns a specified `access system entrance `_. :param acs_entrance_id: ID of the entrance that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_entrance_id is not None: params["acs_entrance_id"] = acs_entrance_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/entrances/get" - ) - res = await self.client.get("/acs/entrances/get", params=params) return AcsEntrance.from_dict(unwrap(res, "acs_entrance", "/acs/entrances/get")) @route_metadata( path="/acs/entrances/grant_access", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def grant_access( @@ -533,8 +487,7 @@ async def grant_access( :param acs_user_id: ID of the access system user to whom you want to grant access to an entrance. You can only provide one of acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity to whom you want to grant access to an entrance. You can only provide one of acs_user_id or user_identity_id. If the ACS system contains an ACS user with the same ``email_address`` or ``phone_number`` as the user identity that you specify, they are linked, and the access group membership belongs to the ACS user. If the ACS system does not have a corresponding ACS user, one is created. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_entrance_id is not None: @@ -544,17 +497,12 @@ async def grant_access( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/entrances/grant_access" - ) - await self.client.post("/acs/entrances/grant_access", json=json_payload) return None @route_metadata( - path="/acs/entrances/list", has_required_parameters=False, has_pagination=True + path="/acs/entrances/list", at_least_one_parameter_names=(), has_pagination=True ) async def list( self, @@ -630,7 +578,7 @@ async def list( @route_metadata( path="/acs/entrances/list_credentials_with_access", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def list_credentials_with_access( @@ -645,9 +593,7 @@ async def list_credentials_with_access( :param include_if: Conditions that credentials must meet to be included in the returned list. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_entrance_id is not None: @@ -655,11 +601,6 @@ async def list_credentials_with_access( if include_if is not None: params["include_if"] = include_if - if not params: - raise ValueError( - "At least one parameter is required for /acs/entrances/list_credentials_with_access" - ) - res = await self.client.get( "/acs/entrances/list_credentials_with_access", params=params ) @@ -672,7 +613,9 @@ async def list_credentials_with_access( ] @route_metadata( - path="/acs/entrances/unlock", has_required_parameters=True, has_pagination=False + path="/acs/entrances/unlock", + at_least_one_parameter_names=(), + has_pagination=False, ) async def unlock( self, @@ -689,9 +632,7 @@ async def unlock( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if acs_credential_id is not None: @@ -699,11 +640,6 @@ async def unlock( if acs_entrance_id is not None: json_payload["acs_entrance_id"] = acs_entrance_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/entrances/unlock" - ) - res = await self.client.post("/acs/entrances/unlock", json=json_payload) wait_for_action_attempt = ( diff --git a/seam/routes/acs_systems.py b/seam/routes/acs_systems.py index fb102eb9..19bcb9ef 100644 --- a/seam/routes/acs_systems.py +++ b/seam/routes/acs_systems.py @@ -15,9 +15,7 @@ def get(self, *, acs_system_id: str) -> AcsSystem: :param acs_system_id: ID of the access system that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -51,9 +49,7 @@ def list_compatible_credential_manager_acs_systems( :param acs_system_id: ID of the access system for which you want to retrieve all compatible credential manager systems. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -70,9 +66,7 @@ def report_devices( :param acs_encoders: Array of ACS encoders to report - :param acs_entrances: Array of ACS entrances to report - - :raises ValueError: At least one parameter must be provided.""" + :param acs_entrances: Array of ACS entrances to report""" raise NotImplementedError() @@ -84,9 +78,7 @@ async def get(self, *, acs_system_id: str) -> AcsSystem: :param acs_system_id: ID of the access system that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -120,9 +112,7 @@ async def list_compatible_credential_manager_acs_systems( :param acs_system_id: ID of the access system for which you want to retrieve all compatible credential manager systems. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -139,9 +129,7 @@ async def report_devices( :param acs_encoders: Array of ACS encoders to report - :param acs_entrances: Array of ACS entrances to report - - :raises ValueError: At least one parameter must be provided.""" + :param acs_entrances: Array of ACS entrances to report""" raise NotImplementedError() @@ -151,30 +139,25 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/acs/systems/get", has_required_parameters=True, has_pagination=False + path="/acs/systems/get", at_least_one_parameter_names=(), has_pagination=False ) def get(self, *, acs_system_id: str) -> AcsSystem: """Returns a specified `access system `_. :param acs_system_id: ID of the access system that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_system_id is not None: params["acs_system_id"] = acs_system_id - if not params: - raise ValueError("At least one parameter is required for /acs/systems/get") - res = self.client.get("/acs/systems/get", params=params) return AcsSystem.from_dict(unwrap(res, "acs_system", "/acs/systems/get")) @route_metadata( - path="/acs/systems/list", has_required_parameters=False, has_pagination=False + path="/acs/systems/list", at_least_one_parameter_names=(), has_pagination=False ) def list( self, @@ -212,7 +195,7 @@ def list( @route_metadata( path="/acs/systems/list_compatible_credential_manager_acs_systems", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def list_compatible_credential_manager_acs_systems( @@ -224,19 +207,12 @@ def list_compatible_credential_manager_acs_systems( :param acs_system_id: ID of the access system for which you want to retrieve all compatible credential manager systems. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_system_id is not None: params["acs_system_id"] = acs_system_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/systems/list_compatible_credential_manager_acs_systems" - ) - res = self.client.get( "/acs/systems/list_compatible_credential_manager_acs_systems", params=params ) @@ -252,7 +228,7 @@ def list_compatible_credential_manager_acs_systems( @route_metadata( path="/acs/systems/report_devices", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def report_devices( @@ -268,9 +244,7 @@ def report_devices( :param acs_encoders: Array of ACS encoders to report - :param acs_entrances: Array of ACS entrances to report - - :raises ValueError: At least one parameter must be provided.""" + :param acs_entrances: Array of ACS entrances to report""" json_payload: Dict[str, Any] = {} if acs_system_id is not None: @@ -280,11 +254,6 @@ def report_devices( if acs_entrances is not None: json_payload["acs_entrances"] = acs_entrances - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/systems/report_devices" - ) - self.client.post("/acs/systems/report_devices", json=json_payload) return None @@ -296,30 +265,25 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/acs/systems/get", has_required_parameters=True, has_pagination=False + path="/acs/systems/get", at_least_one_parameter_names=(), has_pagination=False ) async def get(self, *, acs_system_id: str) -> AcsSystem: """Returns a specified `access system `_. :param acs_system_id: ID of the access system that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_system_id is not None: params["acs_system_id"] = acs_system_id - if not params: - raise ValueError("At least one parameter is required for /acs/systems/get") - res = await self.client.get("/acs/systems/get", params=params) return AcsSystem.from_dict(unwrap(res, "acs_system", "/acs/systems/get")) @route_metadata( - path="/acs/systems/list", has_required_parameters=False, has_pagination=False + path="/acs/systems/list", at_least_one_parameter_names=(), has_pagination=False ) async def list( self, @@ -357,7 +321,7 @@ async def list( @route_metadata( path="/acs/systems/list_compatible_credential_manager_acs_systems", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def list_compatible_credential_manager_acs_systems( @@ -369,19 +333,12 @@ async def list_compatible_credential_manager_acs_systems( :param acs_system_id: ID of the access system for which you want to retrieve all compatible credential manager systems. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if acs_system_id is not None: params["acs_system_id"] = acs_system_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/systems/list_compatible_credential_manager_acs_systems" - ) - res = await self.client.get( "/acs/systems/list_compatible_credential_manager_acs_systems", params=params ) @@ -397,7 +354,7 @@ async def list_compatible_credential_manager_acs_systems( @route_metadata( path="/acs/systems/report_devices", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def report_devices( @@ -413,9 +370,7 @@ async def report_devices( :param acs_encoders: Array of ACS encoders to report - :param acs_entrances: Array of ACS entrances to report - - :raises ValueError: At least one parameter must be provided.""" + :param acs_entrances: Array of ACS entrances to report""" json_payload: Dict[str, Any] = {} if acs_system_id is not None: @@ -425,11 +380,6 @@ async def report_devices( if acs_entrances is not None: json_payload["acs_entrances"] = acs_entrances - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/systems/report_devices" - ) - await self.client.post("/acs/systems/report_devices", json=json_payload) return None diff --git a/seam/routes/acs_users.py b/seam/routes/acs_users.py index 6ef67c5f..3cb1ced0 100644 --- a/seam/routes/acs_users.py +++ b/seam/routes/acs_users.py @@ -19,8 +19,7 @@ def add_to_access_group( :param acs_access_group_id: ID of the access group to which you want to add an access system user. :param acs_user_id: ID of the access system user that you want to add to an access group. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -54,9 +53,7 @@ def create( :param user_identity_id: ID of the user identity with which you want to associate the new access system user. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -169,8 +166,7 @@ def remove_from_access_group( :param acs_user_id: ID of the access system user that you want to remove from an access group. You can only provide acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity that you want to remove from an access group. You can only provide acs_user_id or user_identity_id. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -279,8 +275,7 @@ async def add_to_access_group( :param acs_access_group_id: ID of the access group to which you want to add an access system user. :param acs_user_id: ID of the access system user that you want to add to an access group. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -314,9 +309,7 @@ async def create( :param user_identity_id: ID of the user identity with which you want to associate the new access system user. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -429,8 +422,7 @@ async def remove_from_access_group( :param acs_user_id: ID of the access system user that you want to remove from an access group. You can only provide acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity that you want to remove from an access group. You can only provide acs_user_id or user_identity_id. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -535,7 +527,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/acs/users/add_to_access_group", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def add_to_access_group( @@ -546,8 +538,7 @@ def add_to_access_group( :param acs_access_group_id: ID of the access group to which you want to add an access system user. :param acs_user_id: ID of the access system user that you want to add to an access group. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_access_group_id is not None: @@ -555,17 +546,12 @@ def add_to_access_group( if acs_user_id is not None: json_payload["acs_user_id"] = acs_user_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/users/add_to_access_group" - ) - self.client.put("/acs/users/add_to_access_group", json=json_payload) return None @route_metadata( - path="/acs/users/create", has_required_parameters=True, has_pagination=False + path="/acs/users/create", at_least_one_parameter_names=(), has_pagination=False ) def create( self, @@ -597,9 +583,7 @@ def create( :param user_identity_id: ID of the user identity with which you want to associate the new access system user. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if acs_system_id is not None: @@ -619,15 +603,18 @@ def create( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError("At least one parameter is required for /acs/users/create") - res = self.client.post("/acs/users/create", json=json_payload) return AcsUser.from_dict(unwrap(res, "acs_user", "/acs/users/create")) @route_metadata( - path="/acs/users/delete", has_required_parameters=True, has_pagination=False + path="/acs/users/delete", + at_least_one_parameter_names=( + "acs_system_id", + "acs_user_id", + "user_identity_id", + ), + has_pagination=False, ) def delete( self, @@ -654,7 +641,14 @@ def delete( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: + if all( + param is None + for param in ( + acs_system_id, + acs_user_id, + user_identity_id, + ) + ): raise ValueError("At least one parameter is required for /acs/users/delete") self.client.delete("/acs/users/delete", params=params) @@ -662,7 +656,13 @@ def delete( return None @route_metadata( - path="/acs/users/get", has_required_parameters=True, has_pagination=False + path="/acs/users/get", + at_least_one_parameter_names=( + "acs_system_id", + "acs_user_id", + "user_identity_id", + ), + has_pagination=False, ) def get( self, @@ -691,7 +691,14 @@ def get( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: + if all( + param is None + for param in ( + acs_system_id, + acs_user_id, + user_identity_id, + ) + ): raise ValueError("At least one parameter is required for /acs/users/get") res = self.client.get("/acs/users/get", params=params) @@ -699,7 +706,7 @@ def get( return AcsUser.from_dict(unwrap(res, "acs_user", "/acs/users/get")) @route_metadata( - path="/acs/users/list", has_required_parameters=False, has_pagination=True + path="/acs/users/list", at_least_one_parameter_names=(), has_pagination=True ) def list( self, @@ -760,7 +767,11 @@ def list( @route_metadata( path="/acs/users/list_accessible_entrances", - has_required_parameters=True, + at_least_one_parameter_names=( + "acs_system_id", + "acs_user_id", + "user_identity_id", + ), has_pagination=False, ) def list_accessible_entrances( @@ -790,7 +801,14 @@ def list_accessible_entrances( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: + if all( + param is None + for param in ( + acs_system_id, + acs_user_id, + user_identity_id, + ) + ): raise ValueError( "At least one parameter is required for /acs/users/list_accessible_entrances" ) @@ -806,7 +824,7 @@ def list_accessible_entrances( @route_metadata( path="/acs/users/remove_from_access_group", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def remove_from_access_group( @@ -823,8 +841,7 @@ def remove_from_access_group( :param acs_user_id: ID of the access system user that you want to remove from an access group. You can only provide acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity that you want to remove from an access group. You can only provide acs_user_id or user_identity_id. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if acs_access_group_id is not None: @@ -834,18 +851,17 @@ def remove_from_access_group( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/users/remove_from_access_group" - ) - self.client.delete("/acs/users/remove_from_access_group", params=params) return None @route_metadata( path="/acs/users/revoke_access_to_all_entrances", - has_required_parameters=True, + at_least_one_parameter_names=( + "acs_system_id", + "acs_user_id", + "user_identity_id", + ), has_pagination=False, ) def revoke_access_to_all_entrances( @@ -873,7 +889,14 @@ def revoke_access_to_all_entrances( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: + if all( + param is None + for param in ( + acs_system_id, + acs_user_id, + user_identity_id, + ) + ): raise ValueError( "At least one parameter is required for /acs/users/revoke_access_to_all_entrances" ) @@ -883,7 +906,13 @@ def revoke_access_to_all_entrances( return None @route_metadata( - path="/acs/users/suspend", has_required_parameters=True, has_pagination=False + path="/acs/users/suspend", + at_least_one_parameter_names=( + "acs_system_id", + "acs_user_id", + "user_identity_id", + ), + has_pagination=False, ) def suspend( self, @@ -910,7 +939,14 @@ def suspend( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: + if all( + param is None + for param in ( + acs_system_id, + acs_user_id, + user_identity_id, + ) + ): raise ValueError( "At least one parameter is required for /acs/users/suspend" ) @@ -920,7 +956,13 @@ def suspend( return None @route_metadata( - path="/acs/users/unsuspend", has_required_parameters=True, has_pagination=False + path="/acs/users/unsuspend", + at_least_one_parameter_names=( + "acs_system_id", + "acs_user_id", + "user_identity_id", + ), + has_pagination=False, ) def unsuspend( self, @@ -947,7 +989,14 @@ def unsuspend( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: + if all( + param is None + for param in ( + acs_system_id, + acs_user_id, + user_identity_id, + ) + ): raise ValueError( "At least one parameter is required for /acs/users/unsuspend" ) @@ -957,7 +1006,19 @@ def unsuspend( return None @route_metadata( - path="/acs/users/update", has_required_parameters=True, has_pagination=False + path="/acs/users/update", + at_least_one_parameter_names=( + "access_schedule", + "acs_system_id", + "acs_user_id", + "email", + "email_address", + "full_name", + "hid_acs_system_id", + "phone_number", + "user_identity_id", + ), + has_pagination=False, ) def update( self, @@ -1014,7 +1075,20 @@ def update( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: + if all( + param is None + for param in ( + access_schedule, + acs_system_id, + acs_user_id, + email, + email_address, + full_name, + hid_acs_system_id, + phone_number, + user_identity_id, + ) + ): raise ValueError("At least one parameter is required for /acs/users/update") self.client.patch("/acs/users/update", json=json_payload) @@ -1029,7 +1103,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/acs/users/add_to_access_group", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def add_to_access_group( @@ -1040,8 +1114,7 @@ async def add_to_access_group( :param acs_access_group_id: ID of the access group to which you want to add an access system user. :param acs_user_id: ID of the access system user that you want to add to an access group. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_access_group_id is not None: @@ -1049,17 +1122,12 @@ async def add_to_access_group( if acs_user_id is not None: json_payload["acs_user_id"] = acs_user_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /acs/users/add_to_access_group" - ) - await self.client.put("/acs/users/add_to_access_group", json=json_payload) return None @route_metadata( - path="/acs/users/create", has_required_parameters=True, has_pagination=False + path="/acs/users/create", at_least_one_parameter_names=(), has_pagination=False ) async def create( self, @@ -1091,9 +1159,7 @@ async def create( :param user_identity_id: ID of the user identity with which you want to associate the new access system user. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if acs_system_id is not None: @@ -1113,15 +1179,18 @@ async def create( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError("At least one parameter is required for /acs/users/create") - res = await self.client.post("/acs/users/create", json=json_payload) return AcsUser.from_dict(unwrap(res, "acs_user", "/acs/users/create")) @route_metadata( - path="/acs/users/delete", has_required_parameters=True, has_pagination=False + path="/acs/users/delete", + at_least_one_parameter_names=( + "acs_system_id", + "acs_user_id", + "user_identity_id", + ), + has_pagination=False, ) async def delete( self, @@ -1148,7 +1217,14 @@ async def delete( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: + if all( + param is None + for param in ( + acs_system_id, + acs_user_id, + user_identity_id, + ) + ): raise ValueError("At least one parameter is required for /acs/users/delete") await self.client.delete("/acs/users/delete", params=params) @@ -1156,7 +1232,13 @@ async def delete( return None @route_metadata( - path="/acs/users/get", has_required_parameters=True, has_pagination=False + path="/acs/users/get", + at_least_one_parameter_names=( + "acs_system_id", + "acs_user_id", + "user_identity_id", + ), + has_pagination=False, ) async def get( self, @@ -1185,7 +1267,14 @@ async def get( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: + if all( + param is None + for param in ( + acs_system_id, + acs_user_id, + user_identity_id, + ) + ): raise ValueError("At least one parameter is required for /acs/users/get") res = await self.client.get("/acs/users/get", params=params) @@ -1193,7 +1282,7 @@ async def get( return AcsUser.from_dict(unwrap(res, "acs_user", "/acs/users/get")) @route_metadata( - path="/acs/users/list", has_required_parameters=False, has_pagination=True + path="/acs/users/list", at_least_one_parameter_names=(), has_pagination=True ) async def list( self, @@ -1254,7 +1343,11 @@ async def list( @route_metadata( path="/acs/users/list_accessible_entrances", - has_required_parameters=True, + at_least_one_parameter_names=( + "acs_system_id", + "acs_user_id", + "user_identity_id", + ), has_pagination=False, ) async def list_accessible_entrances( @@ -1284,7 +1377,14 @@ async def list_accessible_entrances( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: + if all( + param is None + for param in ( + acs_system_id, + acs_user_id, + user_identity_id, + ) + ): raise ValueError( "At least one parameter is required for /acs/users/list_accessible_entrances" ) @@ -1302,7 +1402,7 @@ async def list_accessible_entrances( @route_metadata( path="/acs/users/remove_from_access_group", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def remove_from_access_group( @@ -1319,8 +1419,7 @@ async def remove_from_access_group( :param acs_user_id: ID of the access system user that you want to remove from an access group. You can only provide acs_user_id or user_identity_id. :param user_identity_id: ID of the user identity that you want to remove from an access group. You can only provide acs_user_id or user_identity_id. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if acs_access_group_id is not None: @@ -1330,18 +1429,17 @@ async def remove_from_access_group( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /acs/users/remove_from_access_group" - ) - await self.client.delete("/acs/users/remove_from_access_group", params=params) return None @route_metadata( path="/acs/users/revoke_access_to_all_entrances", - has_required_parameters=True, + at_least_one_parameter_names=( + "acs_system_id", + "acs_user_id", + "user_identity_id", + ), has_pagination=False, ) async def revoke_access_to_all_entrances( @@ -1369,7 +1467,14 @@ async def revoke_access_to_all_entrances( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: + if all( + param is None + for param in ( + acs_system_id, + acs_user_id, + user_identity_id, + ) + ): raise ValueError( "At least one parameter is required for /acs/users/revoke_access_to_all_entrances" ) @@ -1381,7 +1486,13 @@ async def revoke_access_to_all_entrances( return None @route_metadata( - path="/acs/users/suspend", has_required_parameters=True, has_pagination=False + path="/acs/users/suspend", + at_least_one_parameter_names=( + "acs_system_id", + "acs_user_id", + "user_identity_id", + ), + has_pagination=False, ) async def suspend( self, @@ -1408,7 +1519,14 @@ async def suspend( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: + if all( + param is None + for param in ( + acs_system_id, + acs_user_id, + user_identity_id, + ) + ): raise ValueError( "At least one parameter is required for /acs/users/suspend" ) @@ -1418,7 +1536,13 @@ async def suspend( return None @route_metadata( - path="/acs/users/unsuspend", has_required_parameters=True, has_pagination=False + path="/acs/users/unsuspend", + at_least_one_parameter_names=( + "acs_system_id", + "acs_user_id", + "user_identity_id", + ), + has_pagination=False, ) async def unsuspend( self, @@ -1445,7 +1569,14 @@ async def unsuspend( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: + if all( + param is None + for param in ( + acs_system_id, + acs_user_id, + user_identity_id, + ) + ): raise ValueError( "At least one parameter is required for /acs/users/unsuspend" ) @@ -1455,7 +1586,19 @@ async def unsuspend( return None @route_metadata( - path="/acs/users/update", has_required_parameters=True, has_pagination=False + path="/acs/users/update", + at_least_one_parameter_names=( + "access_schedule", + "acs_system_id", + "acs_user_id", + "email", + "email_address", + "full_name", + "hid_acs_system_id", + "phone_number", + "user_identity_id", + ), + has_pagination=False, ) async def update( self, @@ -1512,7 +1655,20 @@ async def update( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: + if all( + param is None + for param in ( + access_schedule, + acs_system_id, + acs_user_id, + email, + email_address, + full_name, + hid_acs_system_id, + phone_number, + user_identity_id, + ) + ): raise ValueError("At least one parameter is required for /acs/users/update") await self.client.patch("/acs/users/update", json=json_payload) diff --git a/seam/routes/action_attempts.py b/seam/routes/action_attempts.py index aace2c14..4e909852 100644 --- a/seam/routes/action_attempts.py +++ b/seam/routes/action_attempts.py @@ -27,9 +27,7 @@ def get( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -70,9 +68,7 @@ async def get( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -104,7 +100,9 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/action_attempts/get", has_required_parameters=True, has_pagination=False + path="/action_attempts/get", + at_least_one_parameter_names=(), + has_pagination=False, ) def get( self, @@ -118,19 +116,12 @@ def get( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if action_attempt_id is not None: params["action_attempt_id"] = action_attempt_id - if not params: - raise ValueError( - "At least one parameter is required for /action_attempts/get" - ) - res = self.client.get("/action_attempts/get", params=params) wait_for_action_attempt = ( @@ -148,7 +139,9 @@ def get( ) @route_metadata( - path="/action_attempts/list", has_required_parameters=False, has_pagination=True + path="/action_attempts/list", + at_least_one_parameter_names=(), + has_pagination=True, ) def list( self, @@ -194,7 +187,9 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/action_attempts/get", has_required_parameters=True, has_pagination=False + path="/action_attempts/get", + at_least_one_parameter_names=(), + has_pagination=False, ) async def get( self, @@ -208,19 +203,12 @@ async def get( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if action_attempt_id is not None: params["action_attempt_id"] = action_attempt_id - if not params: - raise ValueError( - "At least one parameter is required for /action_attempts/get" - ) - res = await self.client.get("/action_attempts/get", params=params) wait_for_action_attempt = ( @@ -238,7 +226,9 @@ async def get( ) @route_metadata( - path="/action_attempts/list", has_required_parameters=False, has_pagination=True + path="/action_attempts/list", + at_least_one_parameter_names=(), + has_pagination=True, ) async def list( self, diff --git a/seam/routes/client_sessions.py b/seam/routes/client_sessions.py index 70ecf5cb..d070edee 100644 --- a/seam/routes/client_sessions.py +++ b/seam/routes/client_sessions.py @@ -48,9 +48,7 @@ def create( def delete(self, *, client_session_id: str) -> None: """Deletes a `client session `_. - :param client_session_id: ID of the client session that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param client_session_id: ID of the client session that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -156,9 +154,7 @@ def revoke(self, *, client_session_id: str) -> None: Note that `deleting a client session `_ is a separate action. - :param client_session_id: ID of the client session that you want to revoke. - - :raises ValueError: At least one parameter must be provided.""" + :param client_session_id: ID of the client session that you want to revoke.""" raise NotImplementedError() @@ -202,9 +198,7 @@ async def create( async def delete(self, *, client_session_id: str) -> None: """Deletes a `client session `_. - :param client_session_id: ID of the client session that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param client_session_id: ID of the client session that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -310,9 +304,7 @@ async def revoke(self, *, client_session_id: str) -> None: Note that `deleting a client session `_ is a separate action. - :param client_session_id: ID of the client session that you want to revoke. - - :raises ValueError: At least one parameter must be provided.""" + :param client_session_id: ID of the client session that you want to revoke.""" raise NotImplementedError() @@ -323,7 +315,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/client_sessions/create", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) def create( @@ -384,31 +376,26 @@ def create( @route_metadata( path="/client_sessions/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def delete(self, *, client_session_id: str) -> None: """Deletes a `client session `_. - :param client_session_id: ID of the client session that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param client_session_id: ID of the client session that you want to delete.""" params: Dict[str, Any] = {} if client_session_id is not None: params["client_session_id"] = client_session_id - if not params: - raise ValueError( - "At least one parameter is required for /client_sessions/delete" - ) - self.client.delete("/client_sessions/delete", params=params) return None @route_metadata( - path="/client_sessions/get", has_required_parameters=False, has_pagination=False + path="/client_sessions/get", + at_least_one_parameter_names=(), + has_pagination=False, ) def get( self, @@ -438,7 +425,7 @@ def get( @route_metadata( path="/client_sessions/get_or_create", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) def get_or_create( @@ -489,7 +476,14 @@ def get_or_create( @route_metadata( path="/client_sessions/grant_access", - has_required_parameters=True, + at_least_one_parameter_names=( + "client_session_id", + "connect_webview_ids", + "connected_account_ids", + "user_identifier_key", + "user_identity_id", + "user_identity_ids", + ), has_pagination=False, ) def grant_access( @@ -532,7 +526,17 @@ def grant_access( if user_identity_ids is not None: json_payload["user_identity_ids"] = user_identity_ids - if not json_payload: + if all( + param is None + for param in ( + client_session_id, + connect_webview_ids, + connected_account_ids, + user_identifier_key, + user_identity_id, + user_identity_ids, + ) + ): raise ValueError( "At least one parameter is required for /client_sessions/grant_access" ) @@ -543,7 +547,7 @@ def grant_access( @route_metadata( path="/client_sessions/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) def list( @@ -590,7 +594,7 @@ def list( @route_metadata( path="/client_sessions/revoke", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def revoke(self, *, client_session_id: str) -> None: @@ -598,19 +602,12 @@ def revoke(self, *, client_session_id: str) -> None: Note that `deleting a client session `_ is a separate action. - :param client_session_id: ID of the client session that you want to revoke. - - :raises ValueError: At least one parameter must be provided.""" + :param client_session_id: ID of the client session that you want to revoke.""" json_payload: Dict[str, Any] = {} if client_session_id is not None: json_payload["client_session_id"] = client_session_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /client_sessions/revoke" - ) - self.client.post("/client_sessions/revoke", json=json_payload) return None @@ -623,7 +620,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/client_sessions/create", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) async def create( @@ -684,31 +681,26 @@ async def create( @route_metadata( path="/client_sessions/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def delete(self, *, client_session_id: str) -> None: """Deletes a `client session `_. - :param client_session_id: ID of the client session that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param client_session_id: ID of the client session that you want to delete.""" params: Dict[str, Any] = {} if client_session_id is not None: params["client_session_id"] = client_session_id - if not params: - raise ValueError( - "At least one parameter is required for /client_sessions/delete" - ) - await self.client.delete("/client_sessions/delete", params=params) return None @route_metadata( - path="/client_sessions/get", has_required_parameters=False, has_pagination=False + path="/client_sessions/get", + at_least_one_parameter_names=(), + has_pagination=False, ) async def get( self, @@ -738,7 +730,7 @@ async def get( @route_metadata( path="/client_sessions/get_or_create", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) async def get_or_create( @@ -791,7 +783,14 @@ async def get_or_create( @route_metadata( path="/client_sessions/grant_access", - has_required_parameters=True, + at_least_one_parameter_names=( + "client_session_id", + "connect_webview_ids", + "connected_account_ids", + "user_identifier_key", + "user_identity_id", + "user_identity_ids", + ), has_pagination=False, ) async def grant_access( @@ -834,7 +833,17 @@ async def grant_access( if user_identity_ids is not None: json_payload["user_identity_ids"] = user_identity_ids - if not json_payload: + if all( + param is None + for param in ( + client_session_id, + connect_webview_ids, + connected_account_ids, + user_identifier_key, + user_identity_id, + user_identity_ids, + ) + ): raise ValueError( "At least one parameter is required for /client_sessions/grant_access" ) @@ -845,7 +854,7 @@ async def grant_access( @route_metadata( path="/client_sessions/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) async def list( @@ -892,7 +901,7 @@ async def list( @route_metadata( path="/client_sessions/revoke", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def revoke(self, *, client_session_id: str) -> None: @@ -900,19 +909,12 @@ async def revoke(self, *, client_session_id: str) -> None: Note that `deleting a client session `_ is a separate action. - :param client_session_id: ID of the client session that you want to revoke. - - :raises ValueError: At least one parameter must be provided.""" + :param client_session_id: ID of the client session that you want to revoke.""" json_payload: Dict[str, Any] = {} if client_session_id is not None: json_payload["client_session_id"] = client_session_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /client_sessions/revoke" - ) - await self.client.post("/client_sessions/revoke", json=json_payload) return None diff --git a/seam/routes/connect_webviews.py b/seam/routes/connect_webviews.py index 6ff45877..b7705df1 100644 --- a/seam/routes/connect_webviews.py +++ b/seam/routes/connect_webviews.py @@ -153,9 +153,7 @@ def delete(self, *, connect_webview_id: str) -> None: You do not need to delete a Connect Webview once a user completes it. Instead, you can simply ignore completed Connect Webviews. - :param connect_webview_id: ID of the Connect Webview that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param connect_webview_id: ID of the Connect Webview that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -166,9 +164,7 @@ def get(self, *, connect_webview_id: str) -> ConnectWebview: :param connect_webview_id: ID of the Connect Webview that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -345,9 +341,7 @@ async def delete(self, *, connect_webview_id: str) -> None: You do not need to delete a Connect Webview once a user completes it. Instead, you can simply ignore completed Connect Webviews. - :param connect_webview_id: ID of the Connect Webview that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param connect_webview_id: ID of the Connect Webview that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -358,9 +352,7 @@ async def get(self, *, connect_webview_id: str) -> ConnectWebview: :param connect_webview_id: ID of the Connect Webview that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -399,7 +391,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/connect_webviews/create", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) def create( @@ -569,7 +561,7 @@ def create( @route_metadata( path="/connect_webviews/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def delete(self, *, connect_webview_id: str) -> None: @@ -577,25 +569,20 @@ def delete(self, *, connect_webview_id: str) -> None: You do not need to delete a Connect Webview once a user completes it. Instead, you can simply ignore completed Connect Webviews. - :param connect_webview_id: ID of the Connect Webview that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param connect_webview_id: ID of the Connect Webview that you want to delete.""" params: Dict[str, Any] = {} if connect_webview_id is not None: params["connect_webview_id"] = connect_webview_id - if not params: - raise ValueError( - "At least one parameter is required for /connect_webviews/delete" - ) - self.client.delete("/connect_webviews/delete", params=params) return None @route_metadata( - path="/connect_webviews/get", has_required_parameters=True, has_pagination=False + path="/connect_webviews/get", + at_least_one_parameter_names=(), + has_pagination=False, ) def get(self, *, connect_webview_id: str) -> ConnectWebview: """Returns a specified `Connect Webview `_. @@ -604,19 +591,12 @@ def get(self, *, connect_webview_id: str) -> ConnectWebview: :param connect_webview_id: ID of the Connect Webview that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if connect_webview_id is not None: params["connect_webview_id"] = connect_webview_id - if not params: - raise ValueError( - "At least one parameter is required for /connect_webviews/get" - ) - res = self.client.get("/connect_webviews/get", params=params) return ConnectWebview.from_dict( @@ -625,7 +605,7 @@ def get(self, *, connect_webview_id: str) -> ConnectWebview: @route_metadata( path="/connect_webviews/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=True, ) def list( @@ -683,7 +663,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/connect_webviews/create", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) async def create( @@ -853,7 +833,7 @@ async def create( @route_metadata( path="/connect_webviews/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def delete(self, *, connect_webview_id: str) -> None: @@ -861,25 +841,20 @@ async def delete(self, *, connect_webview_id: str) -> None: You do not need to delete a Connect Webview once a user completes it. Instead, you can simply ignore completed Connect Webviews. - :param connect_webview_id: ID of the Connect Webview that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param connect_webview_id: ID of the Connect Webview that you want to delete.""" params: Dict[str, Any] = {} if connect_webview_id is not None: params["connect_webview_id"] = connect_webview_id - if not params: - raise ValueError( - "At least one parameter is required for /connect_webviews/delete" - ) - await self.client.delete("/connect_webviews/delete", params=params) return None @route_metadata( - path="/connect_webviews/get", has_required_parameters=True, has_pagination=False + path="/connect_webviews/get", + at_least_one_parameter_names=(), + has_pagination=False, ) async def get(self, *, connect_webview_id: str) -> ConnectWebview: """Returns a specified `Connect Webview `_. @@ -888,19 +863,12 @@ async def get(self, *, connect_webview_id: str) -> ConnectWebview: :param connect_webview_id: ID of the Connect Webview that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if connect_webview_id is not None: params["connect_webview_id"] = connect_webview_id - if not params: - raise ValueError( - "At least one parameter is required for /connect_webviews/get" - ) - res = await self.client.get("/connect_webviews/get", params=params) return ConnectWebview.from_dict( @@ -909,7 +877,7 @@ async def get(self, *, connect_webview_id: str) -> ConnectWebview: @route_metadata( path="/connect_webviews/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=True, ) async def list( diff --git a/seam/routes/connected_accounts.py b/seam/routes/connected_accounts.py index 1921ff14..ce299918 100644 --- a/seam/routes/connected_accounts.py +++ b/seam/routes/connected_accounts.py @@ -30,8 +30,7 @@ def delete(self, *, connected_account_id: str) -> None: For example, if you delete a connected account with a device that has an access code, Seam sends a ``connected_account.deleted`` event, a ``device.deleted`` event, and an ``access_code.deleted`` event, but Seam does not remove the access code from the device. :param connected_account_id: ID of the connected account that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -85,8 +84,7 @@ def sync(self, *, connected_account_id: str) -> None: """Request a `connected account `_ sync attempt for the specified ``connected_account_id``. :param connected_account_id: ID of the connected account that you want to sync. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -119,8 +117,7 @@ def update( :param customer_key: The customer key to associate with this connected account. If provided, the connected account and all resources under the connected account will be moved to this customer. May only be provided if the connected account is not already associated with a customer. :param display_name: Human-readable name for the connected account, shown in the dashboard. For example, ``Booking from Airbnb House 1``. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -140,8 +137,7 @@ async def delete(self, *, connected_account_id: str) -> None: For example, if you delete a connected account with a device that has an access code, Seam sends a ``connected_account.deleted`` event, a ``device.deleted`` event, and an ``access_code.deleted`` event, but Seam does not remove the access code from the device. :param connected_account_id: ID of the connected account that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -195,8 +191,7 @@ async def sync(self, *, connected_account_id: str) -> None: """Request a `connected account `_ sync attempt for the specified ``connected_account_id``. :param connected_account_id: ID of the connected account that you want to sync. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -229,8 +224,7 @@ async def update( :param customer_key: The customer key to associate with this connected account. If provided, the connected account and all resources under the connected account will be moved to this customer. May only be provided if the connected account is not already associated with a customer. :param display_name: Human-readable name for the connected account, shown in the dashboard. For example, ``Booking from Airbnb House 1``. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -246,7 +240,7 @@ def simulate(self) -> ConnectedAccountsSimulate: @route_metadata( path="/connected_accounts/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def delete(self, *, connected_account_id: str) -> None: @@ -257,25 +251,22 @@ def delete(self, *, connected_account_id: str) -> None: For example, if you delete a connected account with a device that has an access code, Seam sends a ``connected_account.deleted`` event, a ``device.deleted`` event, and an ``access_code.deleted`` event, but Seam does not remove the access code from the device. :param connected_account_id: ID of the connected account that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if connected_account_id is not None: params["connected_account_id"] = connected_account_id - if not params: - raise ValueError( - "At least one parameter is required for /connected_accounts/delete" - ) - self.client.delete("/connected_accounts/delete", params=params) return None @route_metadata( path="/connected_accounts/get", - has_required_parameters=True, + at_least_one_parameter_names=( + "connected_account_id", + "email", + ), has_pagination=False, ) def get( @@ -297,7 +288,13 @@ def get( if email is not None: params["email"] = email - if not params: + if all( + param is None + for param in ( + connected_account_id, + email, + ) + ): raise ValueError( "At least one parameter is required for /connected_accounts/get" ) @@ -310,7 +307,7 @@ def get( @route_metadata( path="/connected_accounts/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=True, ) def list( @@ -369,32 +366,26 @@ def list( @route_metadata( path="/connected_accounts/sync", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def sync(self, *, connected_account_id: str) -> None: """Request a `connected account `_ sync attempt for the specified ``connected_account_id``. :param connected_account_id: ID of the connected account that you want to sync. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if connected_account_id is not None: json_payload["connected_account_id"] = connected_account_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /connected_accounts/sync" - ) - self.client.post("/connected_accounts/sync", json=json_payload) return None @route_metadata( path="/connected_accounts/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update( @@ -426,8 +417,7 @@ def update( :param customer_key: The customer key to associate with this connected account. If provided, the connected account and all resources under the connected account will be moved to this customer. May only be provided if the connected account is not already associated with a customer. :param display_name: Human-readable name for the connected account, shown in the dashboard. For example, ``Booking from Airbnb House 1``. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if connected_account_id is not None: @@ -445,11 +435,6 @@ def update( if display_name is not None: json_payload["display_name"] = display_name - if not json_payload: - raise ValueError( - "At least one parameter is required for /connected_accounts/update" - ) - self.client.patch("/connected_accounts/update", json=json_payload) return None @@ -469,7 +454,7 @@ def simulate(self) -> AsyncConnectedAccountsSimulate: @route_metadata( path="/connected_accounts/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def delete(self, *, connected_account_id: str) -> None: @@ -480,25 +465,22 @@ async def delete(self, *, connected_account_id: str) -> None: For example, if you delete a connected account with a device that has an access code, Seam sends a ``connected_account.deleted`` event, a ``device.deleted`` event, and an ``access_code.deleted`` event, but Seam does not remove the access code from the device. :param connected_account_id: ID of the connected account that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if connected_account_id is not None: params["connected_account_id"] = connected_account_id - if not params: - raise ValueError( - "At least one parameter is required for /connected_accounts/delete" - ) - await self.client.delete("/connected_accounts/delete", params=params) return None @route_metadata( path="/connected_accounts/get", - has_required_parameters=True, + at_least_one_parameter_names=( + "connected_account_id", + "email", + ), has_pagination=False, ) async def get( @@ -520,7 +502,13 @@ async def get( if email is not None: params["email"] = email - if not params: + if all( + param is None + for param in ( + connected_account_id, + email, + ) + ): raise ValueError( "At least one parameter is required for /connected_accounts/get" ) @@ -533,7 +521,7 @@ async def get( @route_metadata( path="/connected_accounts/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=True, ) async def list( @@ -592,32 +580,26 @@ async def list( @route_metadata( path="/connected_accounts/sync", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def sync(self, *, connected_account_id: str) -> None: """Request a `connected account `_ sync attempt for the specified ``connected_account_id``. :param connected_account_id: ID of the connected account that you want to sync. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if connected_account_id is not None: json_payload["connected_account_id"] = connected_account_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /connected_accounts/sync" - ) - await self.client.post("/connected_accounts/sync", json=json_payload) return None @route_metadata( path="/connected_accounts/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update( @@ -649,8 +631,7 @@ async def update( :param customer_key: The customer key to associate with this connected account. If provided, the connected account and all resources under the connected account will be moved to this customer. May only be provided if the connected account is not already associated with a customer. :param display_name: Human-readable name for the connected account, shown in the dashboard. For example, ``Booking from Airbnb House 1``. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if connected_account_id is not None: @@ -668,11 +649,6 @@ async def update( if display_name is not None: json_payload["display_name"] = display_name - if not json_payload: - raise ValueError( - "At least one parameter is required for /connected_accounts/update" - ) - await self.client.patch("/connected_accounts/update", json=json_payload) return None diff --git a/seam/routes/connected_accounts_simulate.py b/seam/routes/connected_accounts_simulate.py index e846d971..2e17d693 100644 --- a/seam/routes/connected_accounts_simulate.py +++ b/seam/routes/connected_accounts_simulate.py @@ -11,8 +11,7 @@ def disconnect(self, *, connected_account_id: str) -> None: """Simulates a connected account becoming disconnected from Seam. Only applicable for `sandbox workspaces `_. :param connected_account_id: ID of the connected account you want to simulate as disconnected. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -23,8 +22,7 @@ async def disconnect(self, *, connected_account_id: str) -> None: """Simulates a connected account becoming disconnected from Seam. Only applicable for `sandbox workspaces `_. :param connected_account_id: ID of the connected account you want to simulate as disconnected. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -35,25 +33,19 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/connected_accounts/simulate/disconnect", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def disconnect(self, *, connected_account_id: str) -> None: """Simulates a connected account becoming disconnected from Seam. Only applicable for `sandbox workspaces `_. :param connected_account_id: ID of the connected account you want to simulate as disconnected. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if connected_account_id is not None: json_payload["connected_account_id"] = connected_account_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /connected_accounts/simulate/disconnect" - ) - self.client.post("/connected_accounts/simulate/disconnect", json=json_payload) return None @@ -66,25 +58,19 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/connected_accounts/simulate/disconnect", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def disconnect(self, *, connected_account_id: str) -> None: """Simulates a connected account becoming disconnected from Seam. Only applicable for `sandbox workspaces `_. :param connected_account_id: ID of the connected account you want to simulate as disconnected. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if connected_account_id is not None: json_payload["connected_account_id"] = connected_account_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /connected_accounts/simulate/disconnect" - ) - await self.client.post( "/connected_accounts/simulate/disconnect", json=json_payload ) diff --git a/seam/routes/customers.py b/seam/routes/customers.py index 8cf79c34..09046ae3 100644 --- a/seam/routes/customers.py +++ b/seam/routes/customers.py @@ -195,9 +195,7 @@ def push_data( :param user_identities: List of user identities. - :param users: List of users. - - :raises ValueError: At least one parameter must be provided.""" + :param users: List of users.""" raise NotImplementedError() @@ -390,9 +388,7 @@ async def push_data( :param user_identities: List of user identities. - :param users: List of users. - - :raises ValueError: At least one parameter must be provided.""" + :param users: List of users.""" raise NotImplementedError() @@ -403,7 +399,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/customers/create_portal", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) def create_portal( @@ -492,7 +488,7 @@ def create_portal( @route_metadata( path="/customers/delete_data", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) def delete_data( @@ -604,7 +600,9 @@ def delete_data( return None @route_metadata( - path="/customers/push_data", has_required_parameters=True, has_pagination=False + path="/customers/push_data", + at_least_one_parameter_names=(), + has_pagination=False, ) def push_data( self, @@ -670,9 +668,7 @@ def push_data( :param user_identities: List of user identities. - :param users: List of users. - - :raises ValueError: At least one parameter must be provided.""" + :param users: List of users.""" json_payload: Dict[str, Any] = {} if customer_key is not None: @@ -716,11 +712,6 @@ def push_data( if users is not None: json_payload["users"] = users - if not json_payload: - raise ValueError( - "At least one parameter is required for /customers/push_data" - ) - self.client.post("/customers/push_data", json=json_payload) return None @@ -733,7 +724,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/customers/create_portal", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) async def create_portal( @@ -822,7 +813,7 @@ async def create_portal( @route_metadata( path="/customers/delete_data", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) async def delete_data( @@ -934,7 +925,9 @@ async def delete_data( return None @route_metadata( - path="/customers/push_data", has_required_parameters=True, has_pagination=False + path="/customers/push_data", + at_least_one_parameter_names=(), + has_pagination=False, ) async def push_data( self, @@ -1000,9 +993,7 @@ async def push_data( :param user_identities: List of user identities. - :param users: List of users. - - :raises ValueError: At least one parameter must be provided.""" + :param users: List of users.""" json_payload: Dict[str, Any] = {} if customer_key is not None: @@ -1046,11 +1037,6 @@ async def push_data( if users is not None: json_payload["users"] = users - if not json_payload: - raise ValueError( - "At least one parameter is required for /customers/push_data" - ) - await self.client.post("/customers/push_data", json=json_payload) return None diff --git a/seam/routes/devices.py b/seam/routes/devices.py index 150b3540..bef5beaa 100644 --- a/seam/routes/devices.py +++ b/seam/routes/devices.py @@ -288,9 +288,7 @@ def list_device_providers( def report_provider_metadata(self, *, devices: List[Dict[str, Any]]) -> None: """Updates provider-specific metadata for devices. - :param devices: Array of devices with provider metadata to update - - :raises ValueError: At least one parameter must be provided.""" + :param devices: Array of devices with provider metadata to update""" raise NotImplementedError() @abc.abstractmethod @@ -318,9 +316,7 @@ def update( :param name: Name for the device. - :param properties: - - :raises ValueError: At least one parameter must be provided.""" + :param properties:""" raise NotImplementedError() @@ -592,9 +588,7 @@ async def list_device_providers( async def report_provider_metadata(self, *, devices: List[Dict[str, Any]]) -> None: """Updates provider-specific metadata for devices. - :param devices: Array of devices with provider metadata to update - - :raises ValueError: At least one parameter must be provided.""" + :param devices: Array of devices with provider metadata to update""" raise NotImplementedError() @abc.abstractmethod @@ -622,9 +616,7 @@ async def update( :param name: Name for the device. - :param properties: - - :raises ValueError: At least one parameter must be provided.""" + :param properties:""" raise NotImplementedError() @@ -644,7 +636,12 @@ def unmanaged(self) -> DevicesUnmanaged: return self._unmanaged @route_metadata( - path="/devices/get", has_required_parameters=True, has_pagination=False + path="/devices/get", + at_least_one_parameter_names=( + "device_id", + "name", + ), + has_pagination=False, ) def get( self, *, device_id: Optional[str] = None, name: Optional[str] = None @@ -667,7 +664,13 @@ def get( if name is not None: params["name"] = name - if not params: + if all( + param is None + for param in ( + device_id, + name, + ) + ): raise ValueError("At least one parameter is required for /devices/get") res = self.client.get("/devices/get", params=params) @@ -675,7 +678,7 @@ def get( return Device.from_dict(unwrap(res, "device", "/devices/get")) @route_metadata( - path="/devices/list", has_required_parameters=False, has_pagination=True + path="/devices/list", at_least_one_parameter_names=(), has_pagination=True ) def list( self, @@ -925,7 +928,7 @@ def list( @route_metadata( path="/devices/list_device_providers", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) def list_device_providers( @@ -969,31 +972,24 @@ def list_device_providers( @route_metadata( path="/devices/report_provider_metadata", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def report_provider_metadata(self, *, devices: List[Dict[str, Any]]) -> None: """Updates provider-specific metadata for devices. - :param devices: Array of devices with provider metadata to update - - :raises ValueError: At least one parameter must be provided.""" + :param devices: Array of devices with provider metadata to update""" json_payload: Dict[str, Any] = {} if devices is not None: json_payload["devices"] = devices - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/report_provider_metadata" - ) - self.client.post("/devices/report_provider_metadata", json=json_payload) return None @route_metadata( - path="/devices/update", has_required_parameters=True, has_pagination=False + path="/devices/update", at_least_one_parameter_names=(), has_pagination=False ) def update( self, @@ -1019,9 +1015,7 @@ def update( :param name: Name for the device. - :param properties: - - :raises ValueError: At least one parameter must be provided.""" + :param properties:""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1039,9 +1033,6 @@ def update( if properties is not None: json_payload["properties"] = properties - if not json_payload: - raise ValueError("At least one parameter is required for /devices/update") - self.client.patch("/devices/update", json=json_payload) return None @@ -1063,7 +1054,12 @@ def unmanaged(self) -> AsyncDevicesUnmanaged: return self._unmanaged @route_metadata( - path="/devices/get", has_required_parameters=True, has_pagination=False + path="/devices/get", + at_least_one_parameter_names=( + "device_id", + "name", + ), + has_pagination=False, ) async def get( self, *, device_id: Optional[str] = None, name: Optional[str] = None @@ -1086,7 +1082,13 @@ async def get( if name is not None: params["name"] = name - if not params: + if all( + param is None + for param in ( + device_id, + name, + ) + ): raise ValueError("At least one parameter is required for /devices/get") res = await self.client.get("/devices/get", params=params) @@ -1094,7 +1096,7 @@ async def get( return Device.from_dict(unwrap(res, "device", "/devices/get")) @route_metadata( - path="/devices/list", has_required_parameters=False, has_pagination=True + path="/devices/list", at_least_one_parameter_names=(), has_pagination=True ) async def list( self, @@ -1344,7 +1346,7 @@ async def list( @route_metadata( path="/devices/list_device_providers", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) async def list_device_providers( @@ -1388,31 +1390,24 @@ async def list_device_providers( @route_metadata( path="/devices/report_provider_metadata", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def report_provider_metadata(self, *, devices: List[Dict[str, Any]]) -> None: """Updates provider-specific metadata for devices. - :param devices: Array of devices with provider metadata to update - - :raises ValueError: At least one parameter must be provided.""" + :param devices: Array of devices with provider metadata to update""" json_payload: Dict[str, Any] = {} if devices is not None: json_payload["devices"] = devices - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/report_provider_metadata" - ) - await self.client.post("/devices/report_provider_metadata", json=json_payload) return None @route_metadata( - path="/devices/update", has_required_parameters=True, has_pagination=False + path="/devices/update", at_least_one_parameter_names=(), has_pagination=False ) async def update( self, @@ -1438,9 +1433,7 @@ async def update( :param name: Name for the device. - :param properties: - - :raises ValueError: At least one parameter must be provided.""" + :param properties:""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1458,9 +1451,6 @@ async def update( if properties is not None: json_payload["properties"] = properties - if not json_payload: - raise ValueError("At least one parameter is required for /devices/update") - await self.client.patch("/devices/update", json=json_payload) return None diff --git a/seam/routes/devices_simulate.py b/seam/routes/devices_simulate.py index 406ea98b..5649922c 100644 --- a/seam/routes/devices_simulate.py +++ b/seam/routes/devices_simulate.py @@ -11,8 +11,7 @@ def connect(self, *, device_id: str) -> None: """Simulates connecting a device to Seam. Only applicable for `sandbox devices `_. See also `Testing Your App Against Device Disconnection and Removal `_. :param device_id: ID of the device that you want to simulate connecting to Seam. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -22,9 +21,7 @@ def connect_to_hub(self, *, device_id: str) -> None: implemented for August and TTLock locks. This will clear the ``hub_disconnected`` error on the device. - :param device_id: ID of the device whose hub you want to reconnect. - - :raises ValueError: At least one parameter must be provided.""" + :param device_id: ID of the device whose hub you want to reconnect.""" raise NotImplementedError() @abc.abstractmethod @@ -32,8 +29,7 @@ def disconnect(self, *, device_id: str) -> None: """Simulates disconnecting a device from Seam. Only applicable for `sandbox devices `_. See also `Testing Your App Against Device Disconnection and Removal `_. :param device_id: ID of the device that you want to simulate disconnecting from Seam. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -44,9 +40,7 @@ def disconnect_from_hub(self, *, device_id: str) -> None: This will set the ``hub_disconnected`` error on the device, or mark the IglooHome bridge offline in sandbox. - :param device_id: ID of the device whose hub you want to disconnect. - - :raises ValueError: At least one parameter must be provided.""" + :param device_id: ID of the device whose hub you want to disconnect.""" raise NotImplementedError() @abc.abstractmethod @@ -57,9 +51,7 @@ def paid_subscription(self, *, device_id: str, is_expired: bool) -> None: :param device_id: - :param is_expired: - - :raises ValueError: At least one parameter must be provided.""" + :param is_expired:""" raise NotImplementedError() @abc.abstractmethod @@ -67,8 +59,7 @@ def remove(self, *, device_id: str) -> None: """Simulates removing a device from Seam. Only applicable for `sandbox devices `_. See also `Testing Your App Against Device Disconnection and Removal `_. :param device_id: ID of the device that you want to simulate removing from Seam. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -79,8 +70,7 @@ async def connect(self, *, device_id: str) -> None: """Simulates connecting a device to Seam. Only applicable for `sandbox devices `_. See also `Testing Your App Against Device Disconnection and Removal `_. :param device_id: ID of the device that you want to simulate connecting to Seam. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -90,9 +80,7 @@ async def connect_to_hub(self, *, device_id: str) -> None: implemented for August and TTLock locks. This will clear the ``hub_disconnected`` error on the device. - :param device_id: ID of the device whose hub you want to reconnect. - - :raises ValueError: At least one parameter must be provided.""" + :param device_id: ID of the device whose hub you want to reconnect.""" raise NotImplementedError() @abc.abstractmethod @@ -100,8 +88,7 @@ async def disconnect(self, *, device_id: str) -> None: """Simulates disconnecting a device from Seam. Only applicable for `sandbox devices `_. See also `Testing Your App Against Device Disconnection and Removal `_. :param device_id: ID of the device that you want to simulate disconnecting from Seam. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -112,9 +99,7 @@ async def disconnect_from_hub(self, *, device_id: str) -> None: This will set the ``hub_disconnected`` error on the device, or mark the IglooHome bridge offline in sandbox. - :param device_id: ID of the device whose hub you want to disconnect. - - :raises ValueError: At least one parameter must be provided.""" + :param device_id: ID of the device whose hub you want to disconnect.""" raise NotImplementedError() @abc.abstractmethod @@ -125,9 +110,7 @@ async def paid_subscription(self, *, device_id: str, is_expired: bool) -> None: :param device_id: - :param is_expired: - - :raises ValueError: At least one parameter must be provided.""" + :param is_expired:""" raise NotImplementedError() @abc.abstractmethod @@ -135,8 +118,7 @@ async def remove(self, *, device_id: str) -> None: """Simulates removing a device from Seam. Only applicable for `sandbox devices `_. See also `Testing Your App Against Device Disconnection and Removal `_. :param device_id: ID of the device that you want to simulate removing from Seam. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -147,32 +129,26 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/devices/simulate/connect", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def connect(self, *, device_id: str) -> None: """Simulates connecting a device to Seam. Only applicable for `sandbox devices `_. See also `Testing Your App Against Device Disconnection and Removal `_. :param device_id: ID of the device that you want to simulate connecting to Seam. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/simulate/connect" - ) - self.client.post("/devices/simulate/connect", json=json_payload) return None @route_metadata( path="/devices/simulate/connect_to_hub", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def connect_to_hub(self, *, device_id: str) -> None: @@ -181,51 +157,38 @@ def connect_to_hub(self, *, device_id: str) -> None: implemented for August and TTLock locks. This will clear the ``hub_disconnected`` error on the device. - :param device_id: ID of the device whose hub you want to reconnect. - - :raises ValueError: At least one parameter must be provided.""" + :param device_id: ID of the device whose hub you want to reconnect.""" json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/simulate/connect_to_hub" - ) - self.client.post("/devices/simulate/connect_to_hub", json=json_payload) return None @route_metadata( path="/devices/simulate/disconnect", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def disconnect(self, *, device_id: str) -> None: """Simulates disconnecting a device from Seam. Only applicable for `sandbox devices `_. See also `Testing Your App Against Device Disconnection and Removal `_. :param device_id: ID of the device that you want to simulate disconnecting from Seam. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/simulate/disconnect" - ) - self.client.post("/devices/simulate/disconnect", json=json_payload) return None @route_metadata( path="/devices/simulate/disconnect_from_hub", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def disconnect_from_hub(self, *, device_id: str) -> None: @@ -235,26 +198,19 @@ def disconnect_from_hub(self, *, device_id: str) -> None: This will set the ``hub_disconnected`` error on the device, or mark the IglooHome bridge offline in sandbox. - :param device_id: ID of the device whose hub you want to disconnect. - - :raises ValueError: At least one parameter must be provided.""" + :param device_id: ID of the device whose hub you want to disconnect.""" json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/simulate/disconnect_from_hub" - ) - self.client.post("/devices/simulate/disconnect_from_hub", json=json_payload) return None @route_metadata( path="/devices/simulate/paid_subscription", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def paid_subscription(self, *, device_id: str, is_expired: bool) -> None: @@ -264,9 +220,7 @@ def paid_subscription(self, *, device_id: str, is_expired: bool) -> None: :param device_id: - :param is_expired: - - :raises ValueError: At least one parameter must be provided.""" + :param is_expired:""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -274,36 +228,25 @@ def paid_subscription(self, *, device_id: str, is_expired: bool) -> None: if is_expired is not None: json_payload["is_expired"] = is_expired - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/simulate/paid_subscription" - ) - self.client.post("/devices/simulate/paid_subscription", json=json_payload) return None @route_metadata( path="/devices/simulate/remove", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def remove(self, *, device_id: str) -> None: """Simulates removing a device from Seam. Only applicable for `sandbox devices `_. See also `Testing Your App Against Device Disconnection and Removal `_. :param device_id: ID of the device that you want to simulate removing from Seam. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/simulate/remove" - ) - self.client.post("/devices/simulate/remove", json=json_payload) return None @@ -316,32 +259,26 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/devices/simulate/connect", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def connect(self, *, device_id: str) -> None: """Simulates connecting a device to Seam. Only applicable for `sandbox devices `_. See also `Testing Your App Against Device Disconnection and Removal `_. :param device_id: ID of the device that you want to simulate connecting to Seam. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/simulate/connect" - ) - await self.client.post("/devices/simulate/connect", json=json_payload) return None @route_metadata( path="/devices/simulate/connect_to_hub", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def connect_to_hub(self, *, device_id: str) -> None: @@ -350,51 +287,38 @@ async def connect_to_hub(self, *, device_id: str) -> None: implemented for August and TTLock locks. This will clear the ``hub_disconnected`` error on the device. - :param device_id: ID of the device whose hub you want to reconnect. - - :raises ValueError: At least one parameter must be provided.""" + :param device_id: ID of the device whose hub you want to reconnect.""" json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/simulate/connect_to_hub" - ) - await self.client.post("/devices/simulate/connect_to_hub", json=json_payload) return None @route_metadata( path="/devices/simulate/disconnect", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def disconnect(self, *, device_id: str) -> None: """Simulates disconnecting a device from Seam. Only applicable for `sandbox devices `_. See also `Testing Your App Against Device Disconnection and Removal `_. :param device_id: ID of the device that you want to simulate disconnecting from Seam. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/simulate/disconnect" - ) - await self.client.post("/devices/simulate/disconnect", json=json_payload) return None @route_metadata( path="/devices/simulate/disconnect_from_hub", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def disconnect_from_hub(self, *, device_id: str) -> None: @@ -404,19 +328,12 @@ async def disconnect_from_hub(self, *, device_id: str) -> None: This will set the ``hub_disconnected`` error on the device, or mark the IglooHome bridge offline in sandbox. - :param device_id: ID of the device whose hub you want to disconnect. - - :raises ValueError: At least one parameter must be provided.""" + :param device_id: ID of the device whose hub you want to disconnect.""" json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/simulate/disconnect_from_hub" - ) - await self.client.post( "/devices/simulate/disconnect_from_hub", json=json_payload ) @@ -425,7 +342,7 @@ async def disconnect_from_hub(self, *, device_id: str) -> None: @route_metadata( path="/devices/simulate/paid_subscription", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def paid_subscription(self, *, device_id: str, is_expired: bool) -> None: @@ -435,9 +352,7 @@ async def paid_subscription(self, *, device_id: str, is_expired: bool) -> None: :param device_id: - :param is_expired: - - :raises ValueError: At least one parameter must be provided.""" + :param is_expired:""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -445,36 +360,25 @@ async def paid_subscription(self, *, device_id: str, is_expired: bool) -> None: if is_expired is not None: json_payload["is_expired"] = is_expired - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/simulate/paid_subscription" - ) - await self.client.post("/devices/simulate/paid_subscription", json=json_payload) return None @route_metadata( path="/devices/simulate/remove", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def remove(self, *, device_id: str) -> None: """Simulates removing a device from Seam. Only applicable for `sandbox devices `_. See also `Testing Your App Against Device Disconnection and Removal `_. :param device_id: ID of the device that you want to simulate removing from Seam. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/simulate/remove" - ) - await self.client.post("/devices/simulate/remove", json=json_payload) return None diff --git a/seam/routes/devices_unmanaged.py b/seam/routes/devices_unmanaged.py index c8bf106d..4e02ff54 100644 --- a/seam/routes/devices_unmanaged.py +++ b/seam/routes/devices_unmanaged.py @@ -243,8 +243,7 @@ def update( :param custom_metadata: Custom metadata that you want to associate with the device. Supports up to 50 JSON key:value pairs, with key names up to 40 characters long that cannot contain a period (.). Set a key to ``null`` or to an empty string to remove that key from the custom metadata. :param is_managed: Indicates whether the device is managed. Set this parameter to ``true`` to convert an unmanaged device to managed. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -483,8 +482,7 @@ async def update( :param custom_metadata: Custom metadata that you want to associate with the device. Supports up to 50 JSON key:value pairs, with key names up to 40 characters long that cannot contain a period (.). Set a key to ``null`` or to an empty string to remove that key from the custom metadata. :param is_managed: Indicates whether the device is managed. Set this parameter to ``true`` to convert an unmanaged device to managed. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -495,7 +493,10 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/devices/unmanaged/get", - has_required_parameters=True, + at_least_one_parameter_names=( + "device_id", + "name", + ), has_pagination=False, ) def get( @@ -521,7 +522,13 @@ def get( if name is not None: params["name"] = name - if not params: + if all( + param is None + for param in ( + device_id, + name, + ) + ): raise ValueError( "At least one parameter is required for /devices/unmanaged/get" ) @@ -534,7 +541,7 @@ def get( @route_metadata( path="/devices/unmanaged/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=True, ) def list( @@ -767,7 +774,7 @@ def list( @route_metadata( path="/devices/unmanaged/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update( @@ -786,8 +793,7 @@ def update( :param custom_metadata: Custom metadata that you want to associate with the device. Supports up to 50 JSON key:value pairs, with key names up to 40 characters long that cannot contain a period (.). Set a key to ``null`` or to an empty string to remove that key from the custom metadata. :param is_managed: Indicates whether the device is managed. Set this parameter to ``true`` to convert an unmanaged device to managed. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -797,11 +803,6 @@ def update( if is_managed is not None: json_payload["is_managed"] = is_managed - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/unmanaged/update" - ) - self.client.patch("/devices/unmanaged/update", json=json_payload) return None @@ -814,7 +815,10 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/devices/unmanaged/get", - has_required_parameters=True, + at_least_one_parameter_names=( + "device_id", + "name", + ), has_pagination=False, ) async def get( @@ -840,7 +844,13 @@ async def get( if name is not None: params["name"] = name - if not params: + if all( + param is None + for param in ( + device_id, + name, + ) + ): raise ValueError( "At least one parameter is required for /devices/unmanaged/get" ) @@ -853,7 +863,7 @@ async def get( @route_metadata( path="/devices/unmanaged/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=True, ) async def list( @@ -1086,7 +1096,7 @@ async def list( @route_metadata( path="/devices/unmanaged/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update( @@ -1105,8 +1115,7 @@ async def update( :param custom_metadata: Custom metadata that you want to associate with the device. Supports up to 50 JSON key:value pairs, with key names up to 40 characters long that cannot contain a period (.). Set a key to ``null`` or to an empty string to remove that key from the custom metadata. :param is_managed: Indicates whether the device is managed. Set this parameter to ``true`` to convert an unmanaged device to managed. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1116,11 +1125,6 @@ async def update( if is_managed is not None: json_payload["is_managed"] = is_managed - if not json_payload: - raise ValueError( - "At least one parameter is required for /devices/unmanaged/update" - ) - await self.client.patch("/devices/unmanaged/update", json=json_payload) return None diff --git a/seam/routes/events.py b/seam/routes/events.py index 1374d36d..6f8a21ad 100644 --- a/seam/routes/events.py +++ b/seam/routes/events.py @@ -725,7 +725,13 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/events/get", has_required_parameters=True, has_pagination=False + path="/events/get", + at_least_one_parameter_names=( + "device_id", + "event_id", + "event_type", + ), + has_pagination=False, ) def get( self, @@ -754,7 +760,14 @@ def get( if event_type is not None: params["event_type"] = event_type - if not params: + if all( + param is None + for param in ( + device_id, + event_id, + event_type, + ) + ): raise ValueError("At least one parameter is required for /events/get") res = self.client.get("/events/get", params=params) @@ -762,7 +775,37 @@ def get( return seam_event_from_dict(unwrap(res, "event", "/events/get")) @route_metadata( - path="/events/list", has_required_parameters=True, has_pagination=False + path="/events/list", + at_least_one_parameter_names=( + "access_code_id", + "access_code_ids", + "access_grant_id", + "access_grant_ids", + "access_method_id", + "access_method_ids", + "acs_access_group_id", + "acs_credential_id", + "acs_encoder_id", + "acs_entrance_id", + "acs_system_id", + "acs_system_ids", + "acs_user_id", + "between", + "connect_webview_id", + "connected_account_id", + "customer_key", + "device_id", + "device_ids", + "event_ids", + "event_type", + "event_types", + "since", + "space_id", + "space_ids", + "unstable_offset", + "user_identity_id", + ), + has_pagination=False, ) def list( self, @@ -1152,7 +1195,38 @@ def list( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: + if all( + param is None + for param in ( + access_code_id, + access_code_ids, + access_grant_id, + access_grant_ids, + access_method_id, + access_method_ids, + acs_access_group_id, + acs_credential_id, + acs_encoder_id, + acs_entrance_id, + acs_system_id, + acs_system_ids, + acs_user_id, + between, + connect_webview_id, + connected_account_id, + customer_key, + device_id, + device_ids, + event_ids, + event_type, + event_types, + since, + space_id, + space_ids, + unstable_offset, + user_identity_id, + ) + ): raise ValueError("At least one parameter is required for /events/list") res = self.client.get("/events/list", params=params) @@ -1169,7 +1243,13 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/events/get", has_required_parameters=True, has_pagination=False + path="/events/get", + at_least_one_parameter_names=( + "device_id", + "event_id", + "event_type", + ), + has_pagination=False, ) async def get( self, @@ -1198,7 +1278,14 @@ async def get( if event_type is not None: params["event_type"] = event_type - if not params: + if all( + param is None + for param in ( + device_id, + event_id, + event_type, + ) + ): raise ValueError("At least one parameter is required for /events/get") res = await self.client.get("/events/get", params=params) @@ -1206,7 +1293,37 @@ async def get( return seam_event_from_dict(unwrap(res, "event", "/events/get")) @route_metadata( - path="/events/list", has_required_parameters=True, has_pagination=False + path="/events/list", + at_least_one_parameter_names=( + "access_code_id", + "access_code_ids", + "access_grant_id", + "access_grant_ids", + "access_method_id", + "access_method_ids", + "acs_access_group_id", + "acs_credential_id", + "acs_encoder_id", + "acs_entrance_id", + "acs_system_id", + "acs_system_ids", + "acs_user_id", + "between", + "connect_webview_id", + "connected_account_id", + "customer_key", + "device_id", + "device_ids", + "event_ids", + "event_type", + "event_types", + "since", + "space_id", + "space_ids", + "unstable_offset", + "user_identity_id", + ), + has_pagination=False, ) async def list( self, @@ -1596,7 +1713,38 @@ async def list( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: + if all( + param is None + for param in ( + access_code_id, + access_code_ids, + access_grant_id, + access_grant_ids, + access_method_id, + access_method_ids, + acs_access_group_id, + acs_credential_id, + acs_encoder_id, + acs_entrance_id, + acs_system_id, + acs_system_ids, + acs_user_id, + between, + connect_webview_id, + connected_account_id, + customer_key, + device_id, + device_ids, + event_ids, + event_type, + event_types, + since, + space_id, + space_ids, + unstable_offset, + user_identity_id, + ) + ): raise ValueError("At least one parameter is required for /events/list") res = await self.client.get("/events/list", params=params) diff --git a/seam/routes/instant_keys.py b/seam/routes/instant_keys.py index ed8eb43e..417b0bd0 100644 --- a/seam/routes/instant_keys.py +++ b/seam/routes/instant_keys.py @@ -13,9 +13,7 @@ class AbstractInstantKeys(abc.ABC): def delete(self, *, instant_key_id: str) -> None: """Deletes a specified `Instant Key `_. - :param instant_key_id: ID of the Instant Key that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param instant_key_id: ID of the Instant Key that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -52,9 +50,7 @@ class AbstractAsyncInstantKeys(abc.ABC): async def delete(self, *, instant_key_id: str) -> None: """Deletes a specified `Instant Key `_. - :param instant_key_id: ID of the Instant Key that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param instant_key_id: ID of the Instant Key that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -91,30 +87,30 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/instant_keys/delete", has_required_parameters=True, has_pagination=False + path="/instant_keys/delete", + at_least_one_parameter_names=(), + has_pagination=False, ) def delete(self, *, instant_key_id: str) -> None: """Deletes a specified `Instant Key `_. - :param instant_key_id: ID of the Instant Key that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param instant_key_id: ID of the Instant Key that you want to delete.""" params: Dict[str, Any] = {} if instant_key_id is not None: params["instant_key_id"] = instant_key_id - if not params: - raise ValueError( - "At least one parameter is required for /instant_keys/delete" - ) - self.client.delete("/instant_keys/delete", params=params) return None @route_metadata( - path="/instant_keys/get", has_required_parameters=True, has_pagination=False + path="/instant_keys/get", + at_least_one_parameter_names=( + "instant_key_id", + "instant_key_url", + ), + has_pagination=False, ) def get( self, @@ -138,7 +134,13 @@ def get( if instant_key_url is not None: params["instant_key_url"] = instant_key_url - if not params: + if all( + param is None + for param in ( + instant_key_id, + instant_key_url, + ) + ): raise ValueError("At least one parameter is required for /instant_keys/get") res = self.client.get("/instant_keys/get", params=params) @@ -146,7 +148,7 @@ def get( return InstantKey.from_dict(unwrap(res, "instant_key", "/instant_keys/get")) @route_metadata( - path="/instant_keys/list", has_required_parameters=False, has_pagination=False + path="/instant_keys/list", at_least_one_parameter_names=(), has_pagination=False ) def list(self, *, user_identity_id: Optional[str] = None) -> List[InstantKey]: """Returns a list of all `instant keys `_. @@ -173,30 +175,30 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/instant_keys/delete", has_required_parameters=True, has_pagination=False + path="/instant_keys/delete", + at_least_one_parameter_names=(), + has_pagination=False, ) async def delete(self, *, instant_key_id: str) -> None: """Deletes a specified `Instant Key `_. - :param instant_key_id: ID of the Instant Key that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param instant_key_id: ID of the Instant Key that you want to delete.""" params: Dict[str, Any] = {} if instant_key_id is not None: params["instant_key_id"] = instant_key_id - if not params: - raise ValueError( - "At least one parameter is required for /instant_keys/delete" - ) - await self.client.delete("/instant_keys/delete", params=params) return None @route_metadata( - path="/instant_keys/get", has_required_parameters=True, has_pagination=False + path="/instant_keys/get", + at_least_one_parameter_names=( + "instant_key_id", + "instant_key_url", + ), + has_pagination=False, ) async def get( self, @@ -220,7 +222,13 @@ async def get( if instant_key_url is not None: params["instant_key_url"] = instant_key_url - if not params: + if all( + param is None + for param in ( + instant_key_id, + instant_key_url, + ) + ): raise ValueError("At least one parameter is required for /instant_keys/get") res = await self.client.get("/instant_keys/get", params=params) @@ -228,7 +236,7 @@ async def get( return InstantKey.from_dict(unwrap(res, "instant_key", "/instant_keys/get")) @route_metadata( - path="/instant_keys/list", has_required_parameters=False, has_pagination=False + path="/instant_keys/list", at_least_one_parameter_names=(), has_pagination=False ) async def list(self, *, user_identity_id: Optional[str] = None) -> List[InstantKey]: """Returns a list of all `instant keys `_. diff --git a/seam/routes/locks.py b/seam/routes/locks.py index a3a95464..3e99fe9e 100644 --- a/seam/routes/locks.py +++ b/seam/routes/locks.py @@ -43,9 +43,7 @@ def configure_auto_lock( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -213,9 +211,7 @@ def lock_door( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -231,9 +227,7 @@ def unlock_door( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -263,9 +257,7 @@ async def configure_auto_lock( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -433,9 +425,7 @@ async def lock_door( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -451,9 +441,7 @@ async def unlock_door( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -469,7 +457,7 @@ def simulate(self) -> LocksSimulate: @route_metadata( path="/locks/configure_auto_lock", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def configure_auto_lock( @@ -490,9 +478,7 @@ def configure_auto_lock( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if auto_lock_enabled is not None: @@ -502,11 +488,6 @@ def configure_auto_lock( if auto_lock_delay_seconds is not None: json_payload["auto_lock_delay_seconds"] = auto_lock_delay_seconds - if not json_payload: - raise ValueError( - "At least one parameter is required for /locks/configure_auto_lock" - ) - res = self.client.post("/locks/configure_auto_lock", json=json_payload) wait_for_action_attempt = ( @@ -524,7 +505,12 @@ def configure_auto_lock( ) @route_metadata( - path="/locks/get", has_required_parameters=True, has_pagination=False + path="/locks/get", + at_least_one_parameter_names=( + "device_id", + "name", + ), + has_pagination=False, ) def get( self, *, device_id: Optional[str] = None, name: Optional[str] = None @@ -548,7 +534,13 @@ def get( if name is not None: params["name"] = name - if not params: + if all( + param is None + for param in ( + device_id, + name, + ) + ): raise ValueError("At least one parameter is required for /locks/get") res = self.client.get("/locks/get", params=params) @@ -556,7 +548,7 @@ def get( return Device.from_dict(unwrap(res, "device", "/locks/get")) @route_metadata( - path="/locks/list", has_required_parameters=False, has_pagination=False + path="/locks/list", at_least_one_parameter_names=(), has_pagination=False ) def list( self, @@ -712,7 +704,7 @@ def list( ] @route_metadata( - path="/locks/lock_door", has_required_parameters=True, has_pagination=False + path="/locks/lock_door", at_least_one_parameter_names=(), has_pagination=False ) def lock_door( self, @@ -726,17 +718,12 @@ def lock_door( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError("At least one parameter is required for /locks/lock_door") - res = self.client.post("/locks/lock_door", json=json_payload) wait_for_action_attempt = ( @@ -754,7 +741,7 @@ def lock_door( ) @route_metadata( - path="/locks/unlock_door", has_required_parameters=True, has_pagination=False + path="/locks/unlock_door", at_least_one_parameter_names=(), has_pagination=False ) def unlock_door( self, @@ -768,19 +755,12 @@ def unlock_door( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /locks/unlock_door" - ) - res = self.client.post("/locks/unlock_door", json=json_payload) wait_for_action_attempt = ( @@ -810,7 +790,7 @@ def simulate(self) -> AsyncLocksSimulate: @route_metadata( path="/locks/configure_auto_lock", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def configure_auto_lock( @@ -831,9 +811,7 @@ async def configure_auto_lock( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if auto_lock_enabled is not None: @@ -843,11 +821,6 @@ async def configure_auto_lock( if auto_lock_delay_seconds is not None: json_payload["auto_lock_delay_seconds"] = auto_lock_delay_seconds - if not json_payload: - raise ValueError( - "At least one parameter is required for /locks/configure_auto_lock" - ) - res = await self.client.post("/locks/configure_auto_lock", json=json_payload) wait_for_action_attempt = ( @@ -865,7 +838,12 @@ async def configure_auto_lock( ) @route_metadata( - path="/locks/get", has_required_parameters=True, has_pagination=False + path="/locks/get", + at_least_one_parameter_names=( + "device_id", + "name", + ), + has_pagination=False, ) async def get( self, *, device_id: Optional[str] = None, name: Optional[str] = None @@ -889,7 +867,13 @@ async def get( if name is not None: params["name"] = name - if not params: + if all( + param is None + for param in ( + device_id, + name, + ) + ): raise ValueError("At least one parameter is required for /locks/get") res = await self.client.get("/locks/get", params=params) @@ -897,7 +881,7 @@ async def get( return Device.from_dict(unwrap(res, "device", "/locks/get")) @route_metadata( - path="/locks/list", has_required_parameters=False, has_pagination=False + path="/locks/list", at_least_one_parameter_names=(), has_pagination=False ) async def list( self, @@ -1053,7 +1037,7 @@ async def list( ] @route_metadata( - path="/locks/lock_door", has_required_parameters=True, has_pagination=False + path="/locks/lock_door", at_least_one_parameter_names=(), has_pagination=False ) async def lock_door( self, @@ -1067,17 +1051,12 @@ async def lock_door( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError("At least one parameter is required for /locks/lock_door") - res = await self.client.post("/locks/lock_door", json=json_payload) wait_for_action_attempt = ( @@ -1095,7 +1074,7 @@ async def lock_door( ) @route_metadata( - path="/locks/unlock_door", has_required_parameters=True, has_pagination=False + path="/locks/unlock_door", at_least_one_parameter_names=(), has_pagination=False ) async def unlock_door( self, @@ -1109,19 +1088,12 @@ async def unlock_door( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /locks/unlock_door" - ) - res = await self.client.post("/locks/unlock_door", json=json_payload) wait_for_action_attempt = ( diff --git a/seam/routes/locks_simulate.py b/seam/routes/locks_simulate.py index 4e9c00f4..46955583 100644 --- a/seam/routes/locks_simulate.py +++ b/seam/routes/locks_simulate.py @@ -28,9 +28,7 @@ def keypad_code_entry( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -46,9 +44,7 @@ def manual_lock_via_keypad( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -70,9 +66,7 @@ async def keypad_code_entry( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -88,9 +82,7 @@ async def manual_lock_via_keypad( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -101,7 +93,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/locks/simulate/keypad_code_entry", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def keypad_code_entry( @@ -119,9 +111,7 @@ def keypad_code_entry( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if code is not None: @@ -129,11 +119,6 @@ def keypad_code_entry( if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /locks/simulate/keypad_code_entry" - ) - res = self.client.post("/locks/simulate/keypad_code_entry", json=json_payload) wait_for_action_attempt = ( @@ -152,7 +137,7 @@ def keypad_code_entry( @route_metadata( path="/locks/simulate/manual_lock_via_keypad", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def manual_lock_via_keypad( @@ -167,19 +152,12 @@ def manual_lock_via_keypad( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /locks/simulate/manual_lock_via_keypad" - ) - res = self.client.post( "/locks/simulate/manual_lock_via_keypad", json=json_payload ) @@ -206,7 +184,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/locks/simulate/keypad_code_entry", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def keypad_code_entry( @@ -224,9 +202,7 @@ async def keypad_code_entry( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if code is not None: @@ -234,11 +210,6 @@ async def keypad_code_entry( if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /locks/simulate/keypad_code_entry" - ) - res = await self.client.post( "/locks/simulate/keypad_code_entry", json=json_payload ) @@ -259,7 +230,7 @@ async def keypad_code_entry( @route_metadata( path="/locks/simulate/manual_lock_via_keypad", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def manual_lock_via_keypad( @@ -274,19 +245,12 @@ async def manual_lock_via_keypad( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /locks/simulate/manual_lock_via_keypad" - ) - res = await self.client.post( "/locks/simulate/manual_lock_via_keypad", json=json_payload ) diff --git a/seam/routes/noise_sensors.py b/seam/routes/noise_sensors.py index 480cb2be..976399b4 100644 --- a/seam/routes/noise_sensors.py +++ b/seam/routes/noise_sensors.py @@ -126,7 +126,9 @@ def simulate(self) -> NoiseSensorsSimulate: return self._simulate @route_metadata( - path="/noise_sensors/list", has_required_parameters=False, has_pagination=False + path="/noise_sensors/list", + at_least_one_parameter_names=(), + has_pagination=False, ) def list( self, @@ -198,7 +200,9 @@ def simulate(self) -> AsyncNoiseSensorsSimulate: return self._simulate @route_metadata( - path="/noise_sensors/list", has_required_parameters=False, has_pagination=False + path="/noise_sensors/list", + at_least_one_parameter_names=(), + has_pagination=False, ) async def list( self, diff --git a/seam/routes/noise_sensors_noise_thresholds.py b/seam/routes/noise_sensors_noise_thresholds.py index 1cf94d82..942607de 100644 --- a/seam/routes/noise_sensors_noise_thresholds.py +++ b/seam/routes/noise_sensors_noise_thresholds.py @@ -34,9 +34,7 @@ def create( :param noise_threshold_nrs: Noise level in Noiseaware Noise Risk Score (NRS) for the new noise threshold. This parameter is only relevant for `Noiseaware sensors `_. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -45,9 +43,7 @@ def delete(self, *, device_id: str, noise_threshold_id: str) -> None: :param device_id: ID of the device that contains the noise threshold that you want to delete. - :param noise_threshold_id: ID of the noise threshold that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param noise_threshold_id: ID of the noise threshold that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -56,9 +52,7 @@ def get(self, *, noise_threshold_id: str) -> NoiseThreshold: :param noise_threshold_id: ID of the noise threshold that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -67,9 +61,7 @@ def list(self, *, device_id: str) -> List[NoiseThreshold]: :param device_id: ID of the device for which you want to list noise thresholds. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -99,8 +91,7 @@ def update( :param noise_threshold_nrs: Noise level in Noiseaware Noise Risk Score (NRS) for the noise threshold. This parameter is only relevant for `Noiseaware sensors `_. :param starts_daily_at: Time at which the noise threshold should become active daily. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -131,9 +122,7 @@ async def create( :param noise_threshold_nrs: Noise level in Noiseaware Noise Risk Score (NRS) for the new noise threshold. This parameter is only relevant for `Noiseaware sensors `_. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -142,9 +131,7 @@ async def delete(self, *, device_id: str, noise_threshold_id: str) -> None: :param device_id: ID of the device that contains the noise threshold that you want to delete. - :param noise_threshold_id: ID of the noise threshold that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param noise_threshold_id: ID of the noise threshold that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -153,9 +140,7 @@ async def get(self, *, noise_threshold_id: str) -> NoiseThreshold: :param noise_threshold_id: ID of the noise threshold that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -164,9 +149,7 @@ async def list(self, *, device_id: str) -> List[NoiseThreshold]: :param device_id: ID of the device for which you want to list noise thresholds. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -196,8 +179,7 @@ async def update( :param noise_threshold_nrs: Noise level in Noiseaware Noise Risk Score (NRS) for the noise threshold. This parameter is only relevant for `Noiseaware sensors `_. :param starts_daily_at: Time at which the noise threshold should become active daily. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -208,7 +190,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/noise_sensors/noise_thresholds/create", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def create( @@ -235,9 +217,7 @@ def create( :param noise_threshold_nrs: Noise level in Noiseaware Noise Risk Score (NRS) for the new noise threshold. This parameter is only relevant for `Noiseaware sensors `_. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -253,11 +233,6 @@ def create( if noise_threshold_nrs is not None: json_payload["noise_threshold_nrs"] = noise_threshold_nrs - if not json_payload: - raise ValueError( - "At least one parameter is required for /noise_sensors/noise_thresholds/create" - ) - res = self.client.post( "/noise_sensors/noise_thresholds/create", json=json_payload ) @@ -268,7 +243,7 @@ def create( @route_metadata( path="/noise_sensors/noise_thresholds/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def delete(self, *, device_id: str, noise_threshold_id: str) -> None: @@ -276,9 +251,7 @@ def delete(self, *, device_id: str, noise_threshold_id: str) -> None: :param device_id: ID of the device that contains the noise threshold that you want to delete. - :param noise_threshold_id: ID of the noise threshold that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param noise_threshold_id: ID of the noise threshold that you want to delete.""" params: Dict[str, Any] = {} if device_id is not None: @@ -286,18 +259,13 @@ def delete(self, *, device_id: str, noise_threshold_id: str) -> None: if noise_threshold_id is not None: params["noise_threshold_id"] = noise_threshold_id - if not params: - raise ValueError( - "At least one parameter is required for /noise_sensors/noise_thresholds/delete" - ) - self.client.delete("/noise_sensors/noise_thresholds/delete", params=params) return None @route_metadata( path="/noise_sensors/noise_thresholds/get", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def get(self, *, noise_threshold_id: str) -> NoiseThreshold: @@ -305,19 +273,12 @@ def get(self, *, noise_threshold_id: str) -> NoiseThreshold: :param noise_threshold_id: ID of the noise threshold that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if noise_threshold_id is not None: params["noise_threshold_id"] = noise_threshold_id - if not params: - raise ValueError( - "At least one parameter is required for /noise_sensors/noise_thresholds/get" - ) - res = self.client.get("/noise_sensors/noise_thresholds/get", params=params) return NoiseThreshold.from_dict( @@ -326,7 +287,7 @@ def get(self, *, noise_threshold_id: str) -> NoiseThreshold: @route_metadata( path="/noise_sensors/noise_thresholds/list", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def list(self, *, device_id: str) -> List[NoiseThreshold]: @@ -334,19 +295,12 @@ def list(self, *, device_id: str) -> List[NoiseThreshold]: :param device_id: ID of the device for which you want to list noise thresholds. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if device_id is not None: params["device_id"] = device_id - if not params: - raise ValueError( - "At least one parameter is required for /noise_sensors/noise_thresholds/list" - ) - res = self.client.get("/noise_sensors/noise_thresholds/list", params=params) return [ @@ -358,7 +312,7 @@ def list(self, *, device_id: str) -> List[NoiseThreshold]: @route_metadata( path="/noise_sensors/noise_thresholds/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update( @@ -387,8 +341,7 @@ def update( :param noise_threshold_nrs: Noise level in Noiseaware Noise Risk Score (NRS) for the noise threshold. This parameter is only relevant for `Noiseaware sensors `_. :param starts_daily_at: Time at which the noise threshold should become active daily. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -406,11 +359,6 @@ def update( if starts_daily_at is not None: json_payload["starts_daily_at"] = starts_daily_at - if not json_payload: - raise ValueError( - "At least one parameter is required for /noise_sensors/noise_thresholds/update" - ) - self.client.patch("/noise_sensors/noise_thresholds/update", json=json_payload) return None @@ -423,7 +371,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/noise_sensors/noise_thresholds/create", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def create( @@ -450,9 +398,7 @@ async def create( :param noise_threshold_nrs: Noise level in Noiseaware Noise Risk Score (NRS) for the new noise threshold. This parameter is only relevant for `Noiseaware sensors `_. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -468,11 +414,6 @@ async def create( if noise_threshold_nrs is not None: json_payload["noise_threshold_nrs"] = noise_threshold_nrs - if not json_payload: - raise ValueError( - "At least one parameter is required for /noise_sensors/noise_thresholds/create" - ) - res = await self.client.post( "/noise_sensors/noise_thresholds/create", json=json_payload ) @@ -483,7 +424,7 @@ async def create( @route_metadata( path="/noise_sensors/noise_thresholds/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def delete(self, *, device_id: str, noise_threshold_id: str) -> None: @@ -491,9 +432,7 @@ async def delete(self, *, device_id: str, noise_threshold_id: str) -> None: :param device_id: ID of the device that contains the noise threshold that you want to delete. - :param noise_threshold_id: ID of the noise threshold that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param noise_threshold_id: ID of the noise threshold that you want to delete.""" params: Dict[str, Any] = {} if device_id is not None: @@ -501,11 +440,6 @@ async def delete(self, *, device_id: str, noise_threshold_id: str) -> None: if noise_threshold_id is not None: params["noise_threshold_id"] = noise_threshold_id - if not params: - raise ValueError( - "At least one parameter is required for /noise_sensors/noise_thresholds/delete" - ) - await self.client.delete( "/noise_sensors/noise_thresholds/delete", params=params ) @@ -514,7 +448,7 @@ async def delete(self, *, device_id: str, noise_threshold_id: str) -> None: @route_metadata( path="/noise_sensors/noise_thresholds/get", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def get(self, *, noise_threshold_id: str) -> NoiseThreshold: @@ -522,19 +456,12 @@ async def get(self, *, noise_threshold_id: str) -> NoiseThreshold: :param noise_threshold_id: ID of the noise threshold that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if noise_threshold_id is not None: params["noise_threshold_id"] = noise_threshold_id - if not params: - raise ValueError( - "At least one parameter is required for /noise_sensors/noise_thresholds/get" - ) - res = await self.client.get( "/noise_sensors/noise_thresholds/get", params=params ) @@ -545,7 +472,7 @@ async def get(self, *, noise_threshold_id: str) -> NoiseThreshold: @route_metadata( path="/noise_sensors/noise_thresholds/list", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def list(self, *, device_id: str) -> List[NoiseThreshold]: @@ -553,19 +480,12 @@ async def list(self, *, device_id: str) -> List[NoiseThreshold]: :param device_id: ID of the device for which you want to list noise thresholds. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if device_id is not None: params["device_id"] = device_id - if not params: - raise ValueError( - "At least one parameter is required for /noise_sensors/noise_thresholds/list" - ) - res = await self.client.get( "/noise_sensors/noise_thresholds/list", params=params ) @@ -579,7 +499,7 @@ async def list(self, *, device_id: str) -> List[NoiseThreshold]: @route_metadata( path="/noise_sensors/noise_thresholds/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update( @@ -608,8 +528,7 @@ async def update( :param noise_threshold_nrs: Noise level in Noiseaware Noise Risk Score (NRS) for the noise threshold. This parameter is only relevant for `Noiseaware sensors `_. :param starts_daily_at: Time at which the noise threshold should become active daily. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -627,11 +546,6 @@ async def update( if starts_daily_at is not None: json_payload["starts_daily_at"] = starts_daily_at - if not json_payload: - raise ValueError( - "At least one parameter is required for /noise_sensors/noise_thresholds/update" - ) - await self.client.patch( "/noise_sensors/noise_thresholds/update", json=json_payload ) diff --git a/seam/routes/noise_sensors_simulate.py b/seam/routes/noise_sensors_simulate.py index 21a7a917..ef6de81e 100644 --- a/seam/routes/noise_sensors_simulate.py +++ b/seam/routes/noise_sensors_simulate.py @@ -11,8 +11,7 @@ def trigger_noise_threshold(self, *, device_id: str) -> None: """Simulates the triggering of a `noise threshold `_ for a `noise sensor `_ in a `sandbox workspace `_. :param device_id: ID of the device for which you want to simulate the triggering of a noise threshold. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -23,8 +22,7 @@ async def trigger_noise_threshold(self, *, device_id: str) -> None: """Simulates the triggering of a `noise threshold `_ for a `noise sensor `_ in a `sandbox workspace `_. :param device_id: ID of the device for which you want to simulate the triggering of a noise threshold. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -35,25 +33,19 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/noise_sensors/simulate/trigger_noise_threshold", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def trigger_noise_threshold(self, *, device_id: str) -> None: """Simulates the triggering of a `noise threshold `_ for a `noise sensor `_ in a `sandbox workspace `_. :param device_id: ID of the device for which you want to simulate the triggering of a noise threshold. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /noise_sensors/simulate/trigger_noise_threshold" - ) - self.client.post( "/noise_sensors/simulate/trigger_noise_threshold", json=json_payload ) @@ -68,25 +60,19 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/noise_sensors/simulate/trigger_noise_threshold", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def trigger_noise_threshold(self, *, device_id: str) -> None: """Simulates the triggering of a `noise threshold `_ for a `noise sensor `_ in a `sandbox workspace `_. :param device_id: ID of the device for which you want to simulate the triggering of a noise threshold. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /noise_sensors/simulate/trigger_noise_threshold" - ) - await self.client.post( "/noise_sensors/simulate/trigger_noise_threshold", json=json_payload ) diff --git a/seam/routes/phones.py b/seam/routes/phones.py index 1eece7da..8ae6151f 100644 --- a/seam/routes/phones.py +++ b/seam/routes/phones.py @@ -24,9 +24,7 @@ def simulate(self) -> AbstractPhonesSimulate: def deactivate(self, *, device_id: str) -> None: """Deactivates a phone, which is useful, for example, if a user has lost their phone. For more information, see `App User Lost Phone Process `_. - :param device_id: Device ID of the phone that you want to deactivate. - - :raises ValueError: At least one parameter must be provided.""" + :param device_id: Device ID of the phone that you want to deactivate.""" raise NotImplementedError() @abc.abstractmethod @@ -35,9 +33,7 @@ def get(self, *, device_id: str) -> Phone: :param device_id: Device ID of the phone that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -68,9 +64,7 @@ def simulate(self) -> AbstractAsyncPhonesSimulate: async def deactivate(self, *, device_id: str) -> None: """Deactivates a phone, which is useful, for example, if a user has lost their phone. For more information, see `App User Lost Phone Process `_. - :param device_id: Device ID of the phone that you want to deactivate. - - :raises ValueError: At least one parameter must be provided.""" + :param device_id: Device ID of the phone that you want to deactivate.""" raise NotImplementedError() @abc.abstractmethod @@ -79,9 +73,7 @@ async def get(self, *, device_id: str) -> Phone: :param device_id: Device ID of the phone that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -112,53 +104,41 @@ def simulate(self) -> PhonesSimulate: return self._simulate @route_metadata( - path="/phones/deactivate", has_required_parameters=True, has_pagination=False + path="/phones/deactivate", at_least_one_parameter_names=(), has_pagination=False ) def deactivate(self, *, device_id: str) -> None: """Deactivates a phone, which is useful, for example, if a user has lost their phone. For more information, see `App User Lost Phone Process `_. - :param device_id: Device ID of the phone that you want to deactivate. - - :raises ValueError: At least one parameter must be provided.""" + :param device_id: Device ID of the phone that you want to deactivate.""" params: Dict[str, Any] = {} if device_id is not None: params["device_id"] = device_id - if not params: - raise ValueError( - "At least one parameter is required for /phones/deactivate" - ) - self.client.delete("/phones/deactivate", params=params) return None @route_metadata( - path="/phones/get", has_required_parameters=True, has_pagination=False + path="/phones/get", at_least_one_parameter_names=(), has_pagination=False ) def get(self, *, device_id: str) -> Phone: """Returns a specified `phone `_. :param device_id: Device ID of the phone that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if device_id is not None: params["device_id"] = device_id - if not params: - raise ValueError("At least one parameter is required for /phones/get") - res = self.client.get("/phones/get", params=params) return Phone.from_dict(unwrap(res, "phone", "/phones/get")) @route_metadata( - path="/phones/list", has_required_parameters=False, has_pagination=False + path="/phones/list", at_least_one_parameter_names=(), has_pagination=False ) def list( self, @@ -198,53 +178,41 @@ def simulate(self) -> AsyncPhonesSimulate: return self._simulate @route_metadata( - path="/phones/deactivate", has_required_parameters=True, has_pagination=False + path="/phones/deactivate", at_least_one_parameter_names=(), has_pagination=False ) async def deactivate(self, *, device_id: str) -> None: """Deactivates a phone, which is useful, for example, if a user has lost their phone. For more information, see `App User Lost Phone Process `_. - :param device_id: Device ID of the phone that you want to deactivate. - - :raises ValueError: At least one parameter must be provided.""" + :param device_id: Device ID of the phone that you want to deactivate.""" params: Dict[str, Any] = {} if device_id is not None: params["device_id"] = device_id - if not params: - raise ValueError( - "At least one parameter is required for /phones/deactivate" - ) - await self.client.delete("/phones/deactivate", params=params) return None @route_metadata( - path="/phones/get", has_required_parameters=True, has_pagination=False + path="/phones/get", at_least_one_parameter_names=(), has_pagination=False ) async def get(self, *, device_id: str) -> Phone: """Returns a specified `phone `_. :param device_id: Device ID of the phone that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if device_id is not None: params["device_id"] = device_id - if not params: - raise ValueError("At least one parameter is required for /phones/get") - res = await self.client.get("/phones/get", params=params) return Phone.from_dict(unwrap(res, "phone", "/phones/get")) @route_metadata( - path="/phones/list", has_required_parameters=False, has_pagination=False + path="/phones/list", at_least_one_parameter_names=(), has_pagination=False ) async def list( self, diff --git a/seam/routes/phones_simulate.py b/seam/routes/phones_simulate.py index 45f8c3a4..8471e75b 100644 --- a/seam/routes/phones_simulate.py +++ b/seam/routes/phones_simulate.py @@ -27,9 +27,7 @@ def create_sandbox_phone( :param phone_metadata: Metadata that you want to associate with the simulated phone. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -54,9 +52,7 @@ async def create_sandbox_phone( :param phone_metadata: Metadata that you want to associate with the simulated phone. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -67,7 +63,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/phones/simulate/create_sandbox_phone", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def create_sandbox_phone( @@ -88,9 +84,7 @@ def create_sandbox_phone( :param phone_metadata: Metadata that you want to associate with the simulated phone. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if user_identity_id is not None: @@ -102,11 +96,6 @@ def create_sandbox_phone( if phone_metadata is not None: json_payload["phone_metadata"] = phone_metadata - if not json_payload: - raise ValueError( - "At least one parameter is required for /phones/simulate/create_sandbox_phone" - ) - res = self.client.post( "/phones/simulate/create_sandbox_phone", json=json_payload ) @@ -123,7 +112,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/phones/simulate/create_sandbox_phone", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def create_sandbox_phone( @@ -144,9 +133,7 @@ async def create_sandbox_phone( :param phone_metadata: Metadata that you want to associate with the simulated phone. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if user_identity_id is not None: @@ -158,11 +145,6 @@ async def create_sandbox_phone( if phone_metadata is not None: json_payload["phone_metadata"] = phone_metadata - if not json_payload: - raise ValueError( - "At least one parameter is required for /phones/simulate/create_sandbox_phone" - ) - res = await self.client.post( "/phones/simulate/create_sandbox_phone", json=json_payload ) diff --git a/seam/routes/spaces.py b/seam/routes/spaces.py index f0d9ad8b..17da7bca 100644 --- a/seam/routes/spaces.py +++ b/seam/routes/spaces.py @@ -16,9 +16,7 @@ def add_acs_entrances(self, *, acs_entrance_ids: List[str], space_id: str) -> No :param acs_entrance_ids: IDs of the entrances that you want to add to the space. - :param space_id: ID of the space to which you want to add entrances. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space to which you want to add entrances.""" raise NotImplementedError() @abc.abstractmethod @@ -30,8 +28,7 @@ def add_connected_account( :param connected_account_id: ID of the connected account that you want to add to the space. :param space_id: ID of the space to which you want to add the connected account. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -40,9 +37,7 @@ def add_devices(self, *, device_ids: List[str], space_id: str) -> None: :param device_ids: IDs of the devices that you want to add to the space. - :param space_id: ID of the space to which you want to add devices. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space to which you want to add devices.""" raise NotImplementedError() @abc.abstractmethod @@ -73,18 +68,14 @@ def create( :param space_key: Unique key for the space within the workspace. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod def delete(self, *, space_id: str) -> None: """Deletes a space. - :param space_id: ID of the space that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -181,9 +172,7 @@ def remove_acs_entrances( :param acs_entrance_ids: IDs of the entrances that you want to remove from the space. - :param space_id: ID of the space from which you want to remove entrances. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space from which you want to remove entrances.""" raise NotImplementedError() @abc.abstractmethod @@ -195,8 +184,7 @@ def remove_connected_account( :param connected_account_id: ID of the connected account that you want to remove from the space. :param space_id: ID of the space from which you want to remove the connected account. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -205,9 +193,7 @@ def remove_devices(self, *, device_ids: List[str], space_id: str) -> None: :param device_ids: IDs of the devices that you want to remove from the space. - :param space_id: ID of the space from which you want to remove devices. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space from which you want to remove devices.""" raise NotImplementedError() @abc.abstractmethod @@ -249,9 +235,7 @@ async def add_acs_entrances( :param acs_entrance_ids: IDs of the entrances that you want to add to the space. - :param space_id: ID of the space to which you want to add entrances. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space to which you want to add entrances.""" raise NotImplementedError() @abc.abstractmethod @@ -263,8 +247,7 @@ async def add_connected_account( :param connected_account_id: ID of the connected account that you want to add to the space. :param space_id: ID of the space to which you want to add the connected account. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -273,9 +256,7 @@ async def add_devices(self, *, device_ids: List[str], space_id: str) -> None: :param device_ids: IDs of the devices that you want to add to the space. - :param space_id: ID of the space to which you want to add devices. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space to which you want to add devices.""" raise NotImplementedError() @abc.abstractmethod @@ -306,18 +287,14 @@ async def create( :param space_key: Unique key for the space within the workspace. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod async def delete(self, *, space_id: str) -> None: """Deletes a space. - :param space_id: ID of the space that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -414,9 +391,7 @@ async def remove_acs_entrances( :param acs_entrance_ids: IDs of the entrances that you want to remove from the space. - :param space_id: ID of the space from which you want to remove entrances. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space from which you want to remove entrances.""" raise NotImplementedError() @abc.abstractmethod @@ -428,8 +403,7 @@ async def remove_connected_account( :param connected_account_id: ID of the connected account that you want to remove from the space. :param space_id: ID of the space from which you want to remove the connected account. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -438,9 +412,7 @@ async def remove_devices(self, *, device_ids: List[str], space_id: str) -> None: :param device_ids: IDs of the devices that you want to remove from the space. - :param space_id: ID of the space from which you want to remove devices. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space from which you want to remove devices.""" raise NotImplementedError() @abc.abstractmethod @@ -479,7 +451,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/spaces/add_acs_entrances", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def add_acs_entrances(self, *, acs_entrance_ids: List[str], space_id: str) -> None: @@ -487,9 +459,7 @@ def add_acs_entrances(self, *, acs_entrance_ids: List[str], space_id: str) -> No :param acs_entrance_ids: IDs of the entrances that you want to add to the space. - :param space_id: ID of the space to which you want to add entrances. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space to which you want to add entrances.""" json_payload: Dict[str, Any] = {} if acs_entrance_ids is not None: @@ -497,18 +467,13 @@ def add_acs_entrances(self, *, acs_entrance_ids: List[str], space_id: str) -> No if space_id is not None: json_payload["space_id"] = space_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /spaces/add_acs_entrances" - ) - self.client.put("/spaces/add_acs_entrances", json=json_payload) return None @route_metadata( path="/spaces/add_connected_account", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def add_connected_account( @@ -519,8 +484,7 @@ def add_connected_account( :param connected_account_id: ID of the connected account that you want to add to the space. :param space_id: ID of the space to which you want to add the connected account. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if connected_account_id is not None: @@ -528,26 +492,21 @@ def add_connected_account( if space_id is not None: json_payload["space_id"] = space_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /spaces/add_connected_account" - ) - self.client.put("/spaces/add_connected_account", json=json_payload) return None @route_metadata( - path="/spaces/add_devices", has_required_parameters=True, has_pagination=False + path="/spaces/add_devices", + at_least_one_parameter_names=(), + has_pagination=False, ) def add_devices(self, *, device_ids: List[str], space_id: str) -> None: """Adds devices to a specific space. :param device_ids: IDs of the devices that you want to add to the space. - :param space_id: ID of the space to which you want to add devices. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space to which you want to add devices.""" json_payload: Dict[str, Any] = {} if device_ids is not None: @@ -555,17 +514,12 @@ def add_devices(self, *, device_ids: List[str], space_id: str) -> None: if space_id is not None: json_payload["space_id"] = space_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /spaces/add_devices" - ) - self.client.put("/spaces/add_devices", json=json_payload) return None @route_metadata( - path="/spaces/create", has_required_parameters=True, has_pagination=False + path="/spaces/create", at_least_one_parameter_names=(), has_pagination=False ) def create( self, @@ -594,9 +548,7 @@ def create( :param space_key: Unique key for the space within the workspace. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if name is not None: @@ -614,36 +566,33 @@ def create( if space_key is not None: json_payload["space_key"] = space_key - if not json_payload: - raise ValueError("At least one parameter is required for /spaces/create") - res = self.client.post("/spaces/create", json=json_payload) return Space.from_dict(unwrap(res, "space", "/spaces/create")) @route_metadata( - path="/spaces/delete", has_required_parameters=True, has_pagination=False + path="/spaces/delete", at_least_one_parameter_names=(), has_pagination=False ) def delete(self, *, space_id: str) -> None: """Deletes a space. - :param space_id: ID of the space that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space that you want to delete.""" params: Dict[str, Any] = {} if space_id is not None: params["space_id"] = space_id - if not params: - raise ValueError("At least one parameter is required for /spaces/delete") - self.client.delete("/spaces/delete", params=params) return None @route_metadata( - path="/spaces/get", has_required_parameters=True, has_pagination=False + path="/spaces/get", + at_least_one_parameter_names=( + "space_id", + "space_key", + ), + has_pagination=False, ) def get( self, *, space_id: Optional[str] = None, space_key: Optional[str] = None @@ -664,7 +613,13 @@ def get( if space_key is not None: params["space_key"] = space_key - if not params: + if all( + param is None + for param in ( + space_id, + space_key, + ) + ): raise ValueError("At least one parameter is required for /spaces/get") res = self.client.get("/spaces/get", params=params) @@ -672,7 +627,14 @@ def get( return Space.from_dict(unwrap(res, "space", "/spaces/get")) @route_metadata( - path="/spaces/get_related", has_required_parameters=True, has_pagination=False + path="/spaces/get_related", + at_least_one_parameter_names=( + "exclude", + "include", + "space_ids", + "space_keys", + ), + has_pagination=False, ) def get_related( self, @@ -728,7 +690,15 @@ def get_related( if space_keys is not None: params["space_keys"] = space_keys - if not params: + if all( + param is None + for param in ( + exclude, + include, + space_ids, + space_keys, + ) + ): raise ValueError( "At least one parameter is required for /spaces/get_related" ) @@ -738,7 +708,7 @@ def get_related( return Batch.from_dict(unwrap(res, "batch", "/spaces/get_related")) @route_metadata( - path="/spaces/list", has_required_parameters=False, has_pagination=True + path="/spaces/list", at_least_one_parameter_names=(), has_pagination=True ) def list( self, @@ -783,7 +753,7 @@ def list( @route_metadata( path="/spaces/remove_acs_entrances", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def remove_acs_entrances( @@ -793,9 +763,7 @@ def remove_acs_entrances( :param acs_entrance_ids: IDs of the entrances that you want to remove from the space. - :param space_id: ID of the space from which you want to remove entrances. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space from which you want to remove entrances.""" params: Dict[str, Any] = {} if acs_entrance_ids is not None: @@ -803,18 +771,13 @@ def remove_acs_entrances( if space_id is not None: params["space_id"] = space_id - if not params: - raise ValueError( - "At least one parameter is required for /spaces/remove_acs_entrances" - ) - self.client.delete("/spaces/remove_acs_entrances", params=params) return None @route_metadata( path="/spaces/remove_connected_account", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def remove_connected_account( @@ -825,8 +788,7 @@ def remove_connected_account( :param connected_account_id: ID of the connected account that you want to remove from the space. :param space_id: ID of the space from which you want to remove the connected account. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if connected_account_id is not None: @@ -834,18 +796,13 @@ def remove_connected_account( if space_id is not None: params["space_id"] = space_id - if not params: - raise ValueError( - "At least one parameter is required for /spaces/remove_connected_account" - ) - self.client.delete("/spaces/remove_connected_account", params=params) return None @route_metadata( path="/spaces/remove_devices", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def remove_devices(self, *, device_ids: List[str], space_id: str) -> None: @@ -853,9 +810,7 @@ def remove_devices(self, *, device_ids: List[str], space_id: str) -> None: :param device_ids: IDs of the devices that you want to remove from the space. - :param space_id: ID of the space from which you want to remove devices. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space from which you want to remove devices.""" params: Dict[str, Any] = {} if device_ids is not None: @@ -863,17 +818,12 @@ def remove_devices(self, *, device_ids: List[str], space_id: str) -> None: if space_id is not None: params["space_id"] = space_id - if not params: - raise ValueError( - "At least one parameter is required for /spaces/remove_devices" - ) - self.client.delete("/spaces/remove_devices", params=params) return None @route_metadata( - path="/spaces/update", has_required_parameters=False, has_pagination=False + path="/spaces/update", at_least_one_parameter_names=(), has_pagination=False ) def update( self, @@ -927,7 +877,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/spaces/add_acs_entrances", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def add_acs_entrances( @@ -937,9 +887,7 @@ async def add_acs_entrances( :param acs_entrance_ids: IDs of the entrances that you want to add to the space. - :param space_id: ID of the space to which you want to add entrances. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space to which you want to add entrances.""" json_payload: Dict[str, Any] = {} if acs_entrance_ids is not None: @@ -947,18 +895,13 @@ async def add_acs_entrances( if space_id is not None: json_payload["space_id"] = space_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /spaces/add_acs_entrances" - ) - await self.client.put("/spaces/add_acs_entrances", json=json_payload) return None @route_metadata( path="/spaces/add_connected_account", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def add_connected_account( @@ -969,8 +912,7 @@ async def add_connected_account( :param connected_account_id: ID of the connected account that you want to add to the space. :param space_id: ID of the space to which you want to add the connected account. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if connected_account_id is not None: @@ -978,26 +920,21 @@ async def add_connected_account( if space_id is not None: json_payload["space_id"] = space_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /spaces/add_connected_account" - ) - await self.client.put("/spaces/add_connected_account", json=json_payload) return None @route_metadata( - path="/spaces/add_devices", has_required_parameters=True, has_pagination=False + path="/spaces/add_devices", + at_least_one_parameter_names=(), + has_pagination=False, ) async def add_devices(self, *, device_ids: List[str], space_id: str) -> None: """Adds devices to a specific space. :param device_ids: IDs of the devices that you want to add to the space. - :param space_id: ID of the space to which you want to add devices. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space to which you want to add devices.""" json_payload: Dict[str, Any] = {} if device_ids is not None: @@ -1005,17 +942,12 @@ async def add_devices(self, *, device_ids: List[str], space_id: str) -> None: if space_id is not None: json_payload["space_id"] = space_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /spaces/add_devices" - ) - await self.client.put("/spaces/add_devices", json=json_payload) return None @route_metadata( - path="/spaces/create", has_required_parameters=True, has_pagination=False + path="/spaces/create", at_least_one_parameter_names=(), has_pagination=False ) async def create( self, @@ -1044,9 +976,7 @@ async def create( :param space_key: Unique key for the space within the workspace. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if name is not None: @@ -1064,36 +994,33 @@ async def create( if space_key is not None: json_payload["space_key"] = space_key - if not json_payload: - raise ValueError("At least one parameter is required for /spaces/create") - res = await self.client.post("/spaces/create", json=json_payload) return Space.from_dict(unwrap(res, "space", "/spaces/create")) @route_metadata( - path="/spaces/delete", has_required_parameters=True, has_pagination=False + path="/spaces/delete", at_least_one_parameter_names=(), has_pagination=False ) async def delete(self, *, space_id: str) -> None: """Deletes a space. - :param space_id: ID of the space that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space that you want to delete.""" params: Dict[str, Any] = {} if space_id is not None: params["space_id"] = space_id - if not params: - raise ValueError("At least one parameter is required for /spaces/delete") - await self.client.delete("/spaces/delete", params=params) return None @route_metadata( - path="/spaces/get", has_required_parameters=True, has_pagination=False + path="/spaces/get", + at_least_one_parameter_names=( + "space_id", + "space_key", + ), + has_pagination=False, ) async def get( self, *, space_id: Optional[str] = None, space_key: Optional[str] = None @@ -1114,7 +1041,13 @@ async def get( if space_key is not None: params["space_key"] = space_key - if not params: + if all( + param is None + for param in ( + space_id, + space_key, + ) + ): raise ValueError("At least one parameter is required for /spaces/get") res = await self.client.get("/spaces/get", params=params) @@ -1122,7 +1055,14 @@ async def get( return Space.from_dict(unwrap(res, "space", "/spaces/get")) @route_metadata( - path="/spaces/get_related", has_required_parameters=True, has_pagination=False + path="/spaces/get_related", + at_least_one_parameter_names=( + "exclude", + "include", + "space_ids", + "space_keys", + ), + has_pagination=False, ) async def get_related( self, @@ -1178,7 +1118,15 @@ async def get_related( if space_keys is not None: params["space_keys"] = space_keys - if not params: + if all( + param is None + for param in ( + exclude, + include, + space_ids, + space_keys, + ) + ): raise ValueError( "At least one parameter is required for /spaces/get_related" ) @@ -1188,7 +1136,7 @@ async def get_related( return Batch.from_dict(unwrap(res, "batch", "/spaces/get_related")) @route_metadata( - path="/spaces/list", has_required_parameters=False, has_pagination=True + path="/spaces/list", at_least_one_parameter_names=(), has_pagination=True ) async def list( self, @@ -1233,7 +1181,7 @@ async def list( @route_metadata( path="/spaces/remove_acs_entrances", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def remove_acs_entrances( @@ -1243,9 +1191,7 @@ async def remove_acs_entrances( :param acs_entrance_ids: IDs of the entrances that you want to remove from the space. - :param space_id: ID of the space from which you want to remove entrances. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space from which you want to remove entrances.""" params: Dict[str, Any] = {} if acs_entrance_ids is not None: @@ -1253,18 +1199,13 @@ async def remove_acs_entrances( if space_id is not None: params["space_id"] = space_id - if not params: - raise ValueError( - "At least one parameter is required for /spaces/remove_acs_entrances" - ) - await self.client.delete("/spaces/remove_acs_entrances", params=params) return None @route_metadata( path="/spaces/remove_connected_account", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def remove_connected_account( @@ -1275,8 +1216,7 @@ async def remove_connected_account( :param connected_account_id: ID of the connected account that you want to remove from the space. :param space_id: ID of the space from which you want to remove the connected account. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if connected_account_id is not None: @@ -1284,18 +1224,13 @@ async def remove_connected_account( if space_id is not None: params["space_id"] = space_id - if not params: - raise ValueError( - "At least one parameter is required for /spaces/remove_connected_account" - ) - await self.client.delete("/spaces/remove_connected_account", params=params) return None @route_metadata( path="/spaces/remove_devices", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def remove_devices(self, *, device_ids: List[str], space_id: str) -> None: @@ -1303,9 +1238,7 @@ async def remove_devices(self, *, device_ids: List[str], space_id: str) -> None: :param device_ids: IDs of the devices that you want to remove from the space. - :param space_id: ID of the space from which you want to remove devices. - - :raises ValueError: At least one parameter must be provided.""" + :param space_id: ID of the space from which you want to remove devices.""" params: Dict[str, Any] = {} if device_ids is not None: @@ -1313,17 +1246,12 @@ async def remove_devices(self, *, device_ids: List[str], space_id: str) -> None: if space_id is not None: params["space_id"] = space_id - if not params: - raise ValueError( - "At least one parameter is required for /spaces/remove_devices" - ) - await self.client.delete("/spaces/remove_devices", params=params) return None @route_metadata( - path="/spaces/update", has_required_parameters=False, has_pagination=False + path="/spaces/update", at_least_one_parameter_names=(), has_pagination=False ) async def update( self, diff --git a/seam/routes/thermostats.py b/seam/routes/thermostats.py index b2e21b5f..aa91d92e 100644 --- a/seam/routes/thermostats.py +++ b/seam/routes/thermostats.py @@ -63,9 +63,7 @@ def activate_climate_preset( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -87,9 +85,7 @@ def cool( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -138,8 +134,7 @@ def create_climate_preset( :param manual_override_allowed: Deprecated: Use 'thermostat_schedule.is_override_allowed' Indicates whether a person at the thermostat or using the API can change the thermostat's settings. :param name: User-friendly name to identify the `climate preset `_. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -149,8 +144,7 @@ def delete_climate_preset(self, *, climate_preset_key: str, device_id: str) -> N :param climate_preset_key: Climate preset key of the climate preset that you want to delete. :param device_id: ID of the thermostat device for which you want to delete a climate preset. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -172,9 +166,7 @@ def heat( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -202,9 +194,7 @@ def heat_cool( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -272,9 +262,7 @@ def off( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -286,8 +274,7 @@ def set_fallback_climate_preset( :param climate_preset_key: Climate preset key of the climate preset that you want to set as the fallback climate preset. :param device_id: ID of the thermostat device for which you want to set the fallback climate preset. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -309,9 +296,7 @@ def set_fan_mode( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -342,9 +327,7 @@ def set_hvac_mode( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -368,8 +351,7 @@ def set_temperature_threshold( :param upper_limit_celsius: Upper temperature limit in in °C. Seam alerts you if the reported temperature is higher than this value. You can specify either ``upper_limit`` but not both. :param upper_limit_fahrenheit: Upper temperature limit in in °C. Seam alerts you if the reported temperature is higher than this value. You can specify either ``upper_limit`` but not both. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -418,8 +400,7 @@ def update_climate_preset( :param manual_override_allowed: Deprecated: Use 'thermostat_schedule.is_override_allowed' Indicates whether a person at the thermostat can change the thermostat's settings. See `Specifying Manual Override Permissions `_. :param name: User-friendly name to identify the `climate preset `_. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -456,9 +437,7 @@ def update_weekly_program( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -495,9 +474,7 @@ async def activate_climate_preset( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -519,9 +496,7 @@ async def cool( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -570,8 +545,7 @@ async def create_climate_preset( :param manual_override_allowed: Deprecated: Use 'thermostat_schedule.is_override_allowed' Indicates whether a person at the thermostat or using the API can change the thermostat's settings. :param name: User-friendly name to identify the `climate preset `_. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -583,8 +557,7 @@ async def delete_climate_preset( :param climate_preset_key: Climate preset key of the climate preset that you want to delete. :param device_id: ID of the thermostat device for which you want to delete a climate preset. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -606,9 +579,7 @@ async def heat( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -636,9 +607,7 @@ async def heat_cool( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -706,9 +675,7 @@ async def off( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -720,8 +687,7 @@ async def set_fallback_climate_preset( :param climate_preset_key: Climate preset key of the climate preset that you want to set as the fallback climate preset. :param device_id: ID of the thermostat device for which you want to set the fallback climate preset. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -743,9 +709,7 @@ async def set_fan_mode( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -776,9 +740,7 @@ async def set_hvac_mode( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -802,8 +764,7 @@ async def set_temperature_threshold( :param upper_limit_celsius: Upper temperature limit in in °C. Seam alerts you if the reported temperature is higher than this value. You can specify either ``upper_limit`` but not both. :param upper_limit_fahrenheit: Upper temperature limit in in °C. Seam alerts you if the reported temperature is higher than this value. You can specify either ``upper_limit`` but not both. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -852,8 +813,7 @@ async def update_climate_preset( :param manual_override_allowed: Deprecated: Use 'thermostat_schedule.is_override_allowed' Indicates whether a person at the thermostat can change the thermostat's settings. See `Specifying Manual Override Permissions `_. :param name: User-friendly name to identify the `climate preset `_. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -890,9 +850,7 @@ async def update_weekly_program( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -920,7 +878,7 @@ def simulate(self) -> ThermostatsSimulate: @route_metadata( path="/thermostats/activate_climate_preset", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def activate_climate_preset( @@ -938,9 +896,7 @@ def activate_climate_preset( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if climate_preset_key is not None: @@ -948,11 +904,6 @@ def activate_climate_preset( if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/activate_climate_preset" - ) - res = self.client.post( "/thermostats/activate_climate_preset", json=json_payload ) @@ -972,7 +923,7 @@ def activate_climate_preset( ) @route_metadata( - path="/thermostats/cool", has_required_parameters=True, has_pagination=False + path="/thermostats/cool", at_least_one_parameter_names=(), has_pagination=False ) def cool( self, @@ -992,9 +943,7 @@ def cool( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1004,9 +953,6 @@ def cool( if cooling_set_point_fahrenheit is not None: json_payload["cooling_set_point_fahrenheit"] = cooling_set_point_fahrenheit - if not json_payload: - raise ValueError("At least one parameter is required for /thermostats/cool") - res = self.client.post("/thermostats/cool", json=json_payload) wait_for_action_attempt = ( @@ -1025,7 +971,7 @@ def cool( @route_metadata( path="/thermostats/create_climate_preset", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def create_climate_preset( @@ -1073,8 +1019,7 @@ def create_climate_preset( :param manual_override_allowed: Deprecated: Use 'thermostat_schedule.is_override_allowed' Indicates whether a person at the thermostat or using the API can change the thermostat's settings. :param name: User-friendly name to identify the `climate preset `_. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if climate_preset_key is not None: @@ -1102,18 +1047,13 @@ def create_climate_preset( if name is not None: json_payload["name"] = name - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/create_climate_preset" - ) - self.client.post("/thermostats/create_climate_preset", json=json_payload) return None @route_metadata( path="/thermostats/delete_climate_preset", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def delete_climate_preset(self, *, climate_preset_key: str, device_id: str) -> None: @@ -1122,8 +1062,7 @@ def delete_climate_preset(self, *, climate_preset_key: str, device_id: str) -> N :param climate_preset_key: Climate preset key of the climate preset that you want to delete. :param device_id: ID of the thermostat device for which you want to delete a climate preset. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if climate_preset_key is not None: @@ -1131,17 +1070,12 @@ def delete_climate_preset(self, *, climate_preset_key: str, device_id: str) -> N if device_id is not None: params["device_id"] = device_id - if not params: - raise ValueError( - "At least one parameter is required for /thermostats/delete_climate_preset" - ) - self.client.delete("/thermostats/delete_climate_preset", params=params) return None @route_metadata( - path="/thermostats/heat", has_required_parameters=True, has_pagination=False + path="/thermostats/heat", at_least_one_parameter_names=(), has_pagination=False ) def heat( self, @@ -1161,9 +1095,7 @@ def heat( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1173,9 +1105,6 @@ def heat( if heating_set_point_fahrenheit is not None: json_payload["heating_set_point_fahrenheit"] = heating_set_point_fahrenheit - if not json_payload: - raise ValueError("At least one parameter is required for /thermostats/heat") - res = self.client.post("/thermostats/heat", json=json_payload) wait_for_action_attempt = ( @@ -1194,7 +1123,7 @@ def heat( @route_metadata( path="/thermostats/heat_cool", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def heat_cool( @@ -1221,9 +1150,7 @@ def heat_cool( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1237,11 +1164,6 @@ def heat_cool( if heating_set_point_fahrenheit is not None: json_payload["heating_set_point_fahrenheit"] = heating_set_point_fahrenheit - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/heat_cool" - ) - res = self.client.post("/thermostats/heat_cool", json=json_payload) wait_for_action_attempt = ( @@ -1259,7 +1181,7 @@ def heat_cool( ) @route_metadata( - path="/thermostats/list", has_required_parameters=False, has_pagination=False + path="/thermostats/list", at_least_one_parameter_names=(), has_pagination=False ) def list( self, @@ -1333,7 +1255,7 @@ def list( ] @route_metadata( - path="/thermostats/off", has_required_parameters=True, has_pagination=False + path="/thermostats/off", at_least_one_parameter_names=(), has_pagination=False ) def off( self, @@ -1347,17 +1269,12 @@ def off( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError("At least one parameter is required for /thermostats/off") - res = self.client.post("/thermostats/off", json=json_payload) wait_for_action_attempt = ( @@ -1376,7 +1293,7 @@ def off( @route_metadata( path="/thermostats/set_fallback_climate_preset", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def set_fallback_climate_preset( @@ -1387,8 +1304,7 @@ def set_fallback_climate_preset( :param climate_preset_key: Climate preset key of the climate preset that you want to set as the fallback climate preset. :param device_id: ID of the thermostat device for which you want to set the fallback climate preset. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if climate_preset_key is not None: @@ -1396,18 +1312,13 @@ def set_fallback_climate_preset( if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/set_fallback_climate_preset" - ) - self.client.post("/thermostats/set_fallback_climate_preset", json=json_payload) return None @route_metadata( path="/thermostats/set_fan_mode", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def set_fan_mode( @@ -1428,9 +1339,7 @@ def set_fan_mode( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1440,11 +1349,6 @@ def set_fan_mode( if fan_mode_setting is not None: json_payload["fan_mode_setting"] = fan_mode_setting - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/set_fan_mode" - ) - res = self.client.post("/thermostats/set_fan_mode", json=json_payload) wait_for_action_attempt = ( @@ -1463,7 +1367,7 @@ def set_fan_mode( @route_metadata( path="/thermostats/set_hvac_mode", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def set_hvac_mode( @@ -1493,9 +1397,7 @@ def set_hvac_mode( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1511,11 +1413,6 @@ def set_hvac_mode( if heating_set_point_fahrenheit is not None: json_payload["heating_set_point_fahrenheit"] = heating_set_point_fahrenheit - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/set_hvac_mode" - ) - res = self.client.post("/thermostats/set_hvac_mode", json=json_payload) wait_for_action_attempt = ( @@ -1534,7 +1431,7 @@ def set_hvac_mode( @route_metadata( path="/thermostats/set_temperature_threshold", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def set_temperature_threshold( @@ -1557,8 +1454,7 @@ def set_temperature_threshold( :param upper_limit_celsius: Upper temperature limit in in °C. Seam alerts you if the reported temperature is higher than this value. You can specify either ``upper_limit`` but not both. :param upper_limit_fahrenheit: Upper temperature limit in in °C. Seam alerts you if the reported temperature is higher than this value. You can specify either ``upper_limit`` but not both. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1572,18 +1468,13 @@ def set_temperature_threshold( if upper_limit_fahrenheit is not None: json_payload["upper_limit_fahrenheit"] = upper_limit_fahrenheit - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/set_temperature_threshold" - ) - self.client.patch("/thermostats/set_temperature_threshold", json=json_payload) return None @route_metadata( path="/thermostats/update_climate_preset", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update_climate_preset( @@ -1631,8 +1522,7 @@ def update_climate_preset( :param manual_override_allowed: Deprecated: Use 'thermostat_schedule.is_override_allowed' Indicates whether a person at the thermostat can change the thermostat's settings. See `Specifying Manual Override Permissions `_. :param name: User-friendly name to identify the `climate preset `_. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if climate_preset_key is not None: @@ -1660,18 +1550,13 @@ def update_climate_preset( if name is not None: json_payload["name"] = name - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/update_climate_preset" - ) - self.client.patch("/thermostats/update_climate_preset", json=json_payload) return None @route_metadata( path="/thermostats/update_weekly_program", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update_weekly_program( @@ -1707,9 +1592,7 @@ def update_weekly_program( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1729,11 +1612,6 @@ def update_weekly_program( if wednesday_program_id is not None: json_payload["wednesday_program_id"] = wednesday_program_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/update_weekly_program" - ) - res = self.client.post("/thermostats/update_weekly_program", json=json_payload) wait_for_action_attempt = ( @@ -1775,7 +1653,7 @@ def simulate(self) -> AsyncThermostatsSimulate: @route_metadata( path="/thermostats/activate_climate_preset", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def activate_climate_preset( @@ -1793,9 +1671,7 @@ async def activate_climate_preset( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if climate_preset_key is not None: @@ -1803,11 +1679,6 @@ async def activate_climate_preset( if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/activate_climate_preset" - ) - res = await self.client.post( "/thermostats/activate_climate_preset", json=json_payload ) @@ -1827,7 +1698,7 @@ async def activate_climate_preset( ) @route_metadata( - path="/thermostats/cool", has_required_parameters=True, has_pagination=False + path="/thermostats/cool", at_least_one_parameter_names=(), has_pagination=False ) async def cool( self, @@ -1847,9 +1718,7 @@ async def cool( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1859,9 +1728,6 @@ async def cool( if cooling_set_point_fahrenheit is not None: json_payload["cooling_set_point_fahrenheit"] = cooling_set_point_fahrenheit - if not json_payload: - raise ValueError("At least one parameter is required for /thermostats/cool") - res = await self.client.post("/thermostats/cool", json=json_payload) wait_for_action_attempt = ( @@ -1880,7 +1746,7 @@ async def cool( @route_metadata( path="/thermostats/create_climate_preset", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def create_climate_preset( @@ -1928,8 +1794,7 @@ async def create_climate_preset( :param manual_override_allowed: Deprecated: Use 'thermostat_schedule.is_override_allowed' Indicates whether a person at the thermostat or using the API can change the thermostat's settings. :param name: User-friendly name to identify the `climate preset `_. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if climate_preset_key is not None: @@ -1957,18 +1822,13 @@ async def create_climate_preset( if name is not None: json_payload["name"] = name - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/create_climate_preset" - ) - await self.client.post("/thermostats/create_climate_preset", json=json_payload) return None @route_metadata( path="/thermostats/delete_climate_preset", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def delete_climate_preset( @@ -1979,8 +1839,7 @@ async def delete_climate_preset( :param climate_preset_key: Climate preset key of the climate preset that you want to delete. :param device_id: ID of the thermostat device for which you want to delete a climate preset. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if climate_preset_key is not None: @@ -1988,17 +1847,12 @@ async def delete_climate_preset( if device_id is not None: params["device_id"] = device_id - if not params: - raise ValueError( - "At least one parameter is required for /thermostats/delete_climate_preset" - ) - await self.client.delete("/thermostats/delete_climate_preset", params=params) return None @route_metadata( - path="/thermostats/heat", has_required_parameters=True, has_pagination=False + path="/thermostats/heat", at_least_one_parameter_names=(), has_pagination=False ) async def heat( self, @@ -2018,9 +1872,7 @@ async def heat( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -2030,9 +1882,6 @@ async def heat( if heating_set_point_fahrenheit is not None: json_payload["heating_set_point_fahrenheit"] = heating_set_point_fahrenheit - if not json_payload: - raise ValueError("At least one parameter is required for /thermostats/heat") - res = await self.client.post("/thermostats/heat", json=json_payload) wait_for_action_attempt = ( @@ -2051,7 +1900,7 @@ async def heat( @route_metadata( path="/thermostats/heat_cool", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def heat_cool( @@ -2078,9 +1927,7 @@ async def heat_cool( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -2094,11 +1941,6 @@ async def heat_cool( if heating_set_point_fahrenheit is not None: json_payload["heating_set_point_fahrenheit"] = heating_set_point_fahrenheit - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/heat_cool" - ) - res = await self.client.post("/thermostats/heat_cool", json=json_payload) wait_for_action_attempt = ( @@ -2116,7 +1958,7 @@ async def heat_cool( ) @route_metadata( - path="/thermostats/list", has_required_parameters=False, has_pagination=False + path="/thermostats/list", at_least_one_parameter_names=(), has_pagination=False ) async def list( self, @@ -2190,7 +2032,7 @@ async def list( ] @route_metadata( - path="/thermostats/off", has_required_parameters=True, has_pagination=False + path="/thermostats/off", at_least_one_parameter_names=(), has_pagination=False ) async def off( self, @@ -2204,17 +2046,12 @@ async def off( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError("At least one parameter is required for /thermostats/off") - res = await self.client.post("/thermostats/off", json=json_payload) wait_for_action_attempt = ( @@ -2233,7 +2070,7 @@ async def off( @route_metadata( path="/thermostats/set_fallback_climate_preset", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def set_fallback_climate_preset( @@ -2244,8 +2081,7 @@ async def set_fallback_climate_preset( :param climate_preset_key: Climate preset key of the climate preset that you want to set as the fallback climate preset. :param device_id: ID of the thermostat device for which you want to set the fallback climate preset. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if climate_preset_key is not None: @@ -2253,11 +2089,6 @@ async def set_fallback_climate_preset( if device_id is not None: json_payload["device_id"] = device_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/set_fallback_climate_preset" - ) - await self.client.post( "/thermostats/set_fallback_climate_preset", json=json_payload ) @@ -2266,7 +2097,7 @@ async def set_fallback_climate_preset( @route_metadata( path="/thermostats/set_fan_mode", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def set_fan_mode( @@ -2287,9 +2118,7 @@ async def set_fan_mode( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -2299,11 +2128,6 @@ async def set_fan_mode( if fan_mode_setting is not None: json_payload["fan_mode_setting"] = fan_mode_setting - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/set_fan_mode" - ) - res = await self.client.post("/thermostats/set_fan_mode", json=json_payload) wait_for_action_attempt = ( @@ -2322,7 +2146,7 @@ async def set_fan_mode( @route_metadata( path="/thermostats/set_hvac_mode", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def set_hvac_mode( @@ -2352,9 +2176,7 @@ async def set_hvac_mode( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -2370,11 +2192,6 @@ async def set_hvac_mode( if heating_set_point_fahrenheit is not None: json_payload["heating_set_point_fahrenheit"] = heating_set_point_fahrenheit - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/set_hvac_mode" - ) - res = await self.client.post("/thermostats/set_hvac_mode", json=json_payload) wait_for_action_attempt = ( @@ -2393,7 +2210,7 @@ async def set_hvac_mode( @route_metadata( path="/thermostats/set_temperature_threshold", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def set_temperature_threshold( @@ -2416,8 +2233,7 @@ async def set_temperature_threshold( :param upper_limit_celsius: Upper temperature limit in in °C. Seam alerts you if the reported temperature is higher than this value. You can specify either ``upper_limit`` but not both. :param upper_limit_fahrenheit: Upper temperature limit in in °C. Seam alerts you if the reported temperature is higher than this value. You can specify either ``upper_limit`` but not both. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -2431,11 +2247,6 @@ async def set_temperature_threshold( if upper_limit_fahrenheit is not None: json_payload["upper_limit_fahrenheit"] = upper_limit_fahrenheit - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/set_temperature_threshold" - ) - await self.client.patch( "/thermostats/set_temperature_threshold", json=json_payload ) @@ -2444,7 +2255,7 @@ async def set_temperature_threshold( @route_metadata( path="/thermostats/update_climate_preset", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update_climate_preset( @@ -2492,8 +2303,7 @@ async def update_climate_preset( :param manual_override_allowed: Deprecated: Use 'thermostat_schedule.is_override_allowed' Indicates whether a person at the thermostat can change the thermostat's settings. See `Specifying Manual Override Permissions `_. :param name: User-friendly name to identify the `climate preset `_. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if climate_preset_key is not None: @@ -2521,18 +2331,13 @@ async def update_climate_preset( if name is not None: json_payload["name"] = name - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/update_climate_preset" - ) - await self.client.patch("/thermostats/update_climate_preset", json=json_payload) return None @route_metadata( path="/thermostats/update_weekly_program", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update_weekly_program( @@ -2568,9 +2373,7 @@ async def update_weekly_program( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -2590,11 +2393,6 @@ async def update_weekly_program( if wednesday_program_id is not None: json_payload["wednesday_program_id"] = wednesday_program_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/update_weekly_program" - ) - res = await self.client.post( "/thermostats/update_weekly_program", json=json_payload ) diff --git a/seam/routes/thermostats_daily_programs.py b/seam/routes/thermostats_daily_programs.py index 7dacc537..c177b315 100644 --- a/seam/routes/thermostats_daily_programs.py +++ b/seam/routes/thermostats_daily_programs.py @@ -24,9 +24,7 @@ def create( :param periods: Array of thermostat daily program periods. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -34,8 +32,7 @@ def delete(self, *, thermostat_daily_program_id: str) -> None: """Deletes a thermostat daily program. :param thermostat_daily_program_id: ID of the thermostat daily program that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -57,9 +54,7 @@ def update( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -77,9 +72,7 @@ async def create( :param periods: Array of thermostat daily program periods. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -87,8 +80,7 @@ async def delete(self, *, thermostat_daily_program_id: str) -> None: """Deletes a thermostat daily program. :param thermostat_daily_program_id: ID of the thermostat daily program that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -110,9 +102,7 @@ async def update( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @@ -123,7 +113,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/thermostats/daily_programs/create", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def create( @@ -137,9 +127,7 @@ def create( :param periods: Array of thermostat daily program periods. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -149,11 +137,6 @@ def create( if periods is not None: json_payload["periods"] = periods - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/daily_programs/create" - ) - res = self.client.post("/thermostats/daily_programs/create", json=json_payload) return ThermostatDailyProgram.from_dict( @@ -164,32 +147,26 @@ def create( @route_metadata( path="/thermostats/daily_programs/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def delete(self, *, thermostat_daily_program_id: str) -> None: """Deletes a thermostat daily program. :param thermostat_daily_program_id: ID of the thermostat daily program that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if thermostat_daily_program_id is not None: params["thermostat_daily_program_id"] = thermostat_daily_program_id - if not params: - raise ValueError( - "At least one parameter is required for /thermostats/daily_programs/delete" - ) - self.client.delete("/thermostats/daily_programs/delete", params=params) return None @route_metadata( path="/thermostats/daily_programs/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update( @@ -210,9 +187,7 @@ def update( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if name is not None: @@ -222,11 +197,6 @@ def update( if thermostat_daily_program_id is not None: json_payload["thermostat_daily_program_id"] = thermostat_daily_program_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/daily_programs/update" - ) - res = self.client.patch("/thermostats/daily_programs/update", json=json_payload) wait_for_action_attempt = ( @@ -251,7 +221,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/thermostats/daily_programs/create", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def create( @@ -265,9 +235,7 @@ async def create( :param periods: Array of thermostat daily program periods. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if device_id is not None: @@ -277,11 +245,6 @@ async def create( if periods is not None: json_payload["periods"] = periods - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/daily_programs/create" - ) - res = await self.client.post( "/thermostats/daily_programs/create", json=json_payload ) @@ -294,32 +257,26 @@ async def create( @route_metadata( path="/thermostats/daily_programs/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def delete(self, *, thermostat_daily_program_id: str) -> None: """Deletes a thermostat daily program. :param thermostat_daily_program_id: ID of the thermostat daily program that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if thermostat_daily_program_id is not None: params["thermostat_daily_program_id"] = thermostat_daily_program_id - if not params: - raise ValueError( - "At least one parameter is required for /thermostats/daily_programs/delete" - ) - await self.client.delete("/thermostats/daily_programs/delete", params=params) return None @route_metadata( path="/thermostats/daily_programs/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update( @@ -340,9 +297,7 @@ async def update( :param wait_for_action_attempt: Whether, and for how long, to wait for the action attempt to finish. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if name is not None: @@ -352,11 +307,6 @@ async def update( if thermostat_daily_program_id is not None: json_payload["thermostat_daily_program_id"] = thermostat_daily_program_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/daily_programs/update" - ) - res = await self.client.patch( "/thermostats/daily_programs/update", json=json_payload ) diff --git a/seam/routes/thermostats_schedules.py b/seam/routes/thermostats_schedules.py index eb1a269f..68f3f38e 100644 --- a/seam/routes/thermostats_schedules.py +++ b/seam/routes/thermostats_schedules.py @@ -38,9 +38,7 @@ def create( :param name: Name of the thermostat schedule. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -48,8 +46,7 @@ def delete(self, *, thermostat_schedule_id: str) -> None: """Deletes a `thermostat schedule `_ for a specified `thermostat `_. :param thermostat_schedule_id: ID of the thermostat schedule that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -58,9 +55,7 @@ def get(self, *, thermostat_schedule_id: str) -> ThermostatSchedule: :param thermostat_schedule_id: ID of the thermostat schedule that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -73,9 +68,7 @@ def list( :param user_identifier_key: User identifier key by which to filter the list of returned thermostat schedules. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -105,8 +98,7 @@ def update( :param name: Name of the thermostat schedule. :param starts_at: Date and time at which the thermostat schedule starts, in `ISO 8601 `_ format. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -140,9 +132,7 @@ async def create( :param name: Name of the thermostat schedule. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -150,8 +140,7 @@ async def delete(self, *, thermostat_schedule_id: str) -> None: """Deletes a `thermostat schedule `_ for a specified `thermostat `_. :param thermostat_schedule_id: ID of the thermostat schedule that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -160,9 +149,7 @@ async def get(self, *, thermostat_schedule_id: str) -> ThermostatSchedule: :param thermostat_schedule_id: ID of the thermostat schedule that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -175,9 +162,7 @@ async def list( :param user_identifier_key: User identifier key by which to filter the list of returned thermostat schedules. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -207,8 +192,7 @@ async def update( :param name: Name of the thermostat schedule. :param starts_at: Date and time at which the thermostat schedule starts, in `ISO 8601 `_ format. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -219,7 +203,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/thermostats/schedules/create", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def create( @@ -249,9 +233,7 @@ def create( :param name: Name of the thermostat schedule. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if climate_preset_key is not None: @@ -269,11 +251,6 @@ def create( if name is not None: json_payload["name"] = name - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/schedules/create" - ) - res = self.client.post("/thermostats/schedules/create", json=json_payload) return ThermostatSchedule.from_dict( @@ -282,32 +259,26 @@ def create( @route_metadata( path="/thermostats/schedules/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def delete(self, *, thermostat_schedule_id: str) -> None: """Deletes a `thermostat schedule `_ for a specified `thermostat `_. :param thermostat_schedule_id: ID of the thermostat schedule that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if thermostat_schedule_id is not None: params["thermostat_schedule_id"] = thermostat_schedule_id - if not params: - raise ValueError( - "At least one parameter is required for /thermostats/schedules/delete" - ) - self.client.delete("/thermostats/schedules/delete", params=params) return None @route_metadata( path="/thermostats/schedules/get", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def get(self, *, thermostat_schedule_id: str) -> ThermostatSchedule: @@ -315,19 +286,12 @@ def get(self, *, thermostat_schedule_id: str) -> ThermostatSchedule: :param thermostat_schedule_id: ID of the thermostat schedule that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if thermostat_schedule_id is not None: params["thermostat_schedule_id"] = thermostat_schedule_id - if not params: - raise ValueError( - "At least one parameter is required for /thermostats/schedules/get" - ) - res = self.client.get("/thermostats/schedules/get", params=params) return ThermostatSchedule.from_dict( @@ -336,7 +300,7 @@ def get(self, *, thermostat_schedule_id: str) -> ThermostatSchedule: @route_metadata( path="/thermostats/schedules/list", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def list( @@ -348,9 +312,7 @@ def list( :param user_identifier_key: User identifier key by which to filter the list of returned thermostat schedules. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if device_id is not None: @@ -358,11 +320,6 @@ def list( if user_identifier_key is not None: params["user_identifier_key"] = user_identifier_key - if not params: - raise ValueError( - "At least one parameter is required for /thermostats/schedules/list" - ) - res = self.client.get("/thermostats/schedules/list", params=params) return [ @@ -374,7 +331,7 @@ def list( @route_metadata( path="/thermostats/schedules/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update( @@ -403,8 +360,7 @@ def update( :param name: Name of the thermostat schedule. :param starts_at: Date and time at which the thermostat schedule starts, in `ISO 8601 `_ format. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if thermostat_schedule_id is not None: @@ -422,11 +378,6 @@ def update( if starts_at is not None: json_payload["starts_at"] = starts_at - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/schedules/update" - ) - self.client.patch("/thermostats/schedules/update", json=json_payload) return None @@ -439,7 +390,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/thermostats/schedules/create", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def create( @@ -469,9 +420,7 @@ async def create( :param name: Name of the thermostat schedule. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if climate_preset_key is not None: @@ -489,11 +438,6 @@ async def create( if name is not None: json_payload["name"] = name - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/schedules/create" - ) - res = await self.client.post("/thermostats/schedules/create", json=json_payload) return ThermostatSchedule.from_dict( @@ -502,32 +446,26 @@ async def create( @route_metadata( path="/thermostats/schedules/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def delete(self, *, thermostat_schedule_id: str) -> None: """Deletes a `thermostat schedule `_ for a specified `thermostat `_. :param thermostat_schedule_id: ID of the thermostat schedule that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if thermostat_schedule_id is not None: params["thermostat_schedule_id"] = thermostat_schedule_id - if not params: - raise ValueError( - "At least one parameter is required for /thermostats/schedules/delete" - ) - await self.client.delete("/thermostats/schedules/delete", params=params) return None @route_metadata( path="/thermostats/schedules/get", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def get(self, *, thermostat_schedule_id: str) -> ThermostatSchedule: @@ -535,19 +473,12 @@ async def get(self, *, thermostat_schedule_id: str) -> ThermostatSchedule: :param thermostat_schedule_id: ID of the thermostat schedule that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if thermostat_schedule_id is not None: params["thermostat_schedule_id"] = thermostat_schedule_id - if not params: - raise ValueError( - "At least one parameter is required for /thermostats/schedules/get" - ) - res = await self.client.get("/thermostats/schedules/get", params=params) return ThermostatSchedule.from_dict( @@ -556,7 +487,7 @@ async def get(self, *, thermostat_schedule_id: str) -> ThermostatSchedule: @route_metadata( path="/thermostats/schedules/list", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def list( @@ -568,9 +499,7 @@ async def list( :param user_identifier_key: User identifier key by which to filter the list of returned thermostat schedules. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if device_id is not None: @@ -578,11 +507,6 @@ async def list( if user_identifier_key is not None: params["user_identifier_key"] = user_identifier_key - if not params: - raise ValueError( - "At least one parameter is required for /thermostats/schedules/list" - ) - res = await self.client.get("/thermostats/schedules/list", params=params) return [ @@ -594,7 +518,7 @@ async def list( @route_metadata( path="/thermostats/schedules/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update( @@ -623,8 +547,7 @@ async def update( :param name: Name of the thermostat schedule. :param starts_at: Date and time at which the thermostat schedule starts, in `ISO 8601 `_ format. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if thermostat_schedule_id is not None: @@ -642,11 +565,6 @@ async def update( if starts_at is not None: json_payload["starts_at"] = starts_at - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/schedules/update" - ) - await self.client.patch("/thermostats/schedules/update", json=json_payload) return None diff --git a/seam/routes/thermostats_simulate.py b/seam/routes/thermostats_simulate.py index b7487f8d..bfe4f160 100644 --- a/seam/routes/thermostats_simulate.py +++ b/seam/routes/thermostats_simulate.py @@ -30,8 +30,7 @@ def hvac_mode_adjusted( :param heating_set_point_celsius: Heating `set point `_ in °C that you want to simulate. You must set ``heating_set_point_celsius`` or ``heating_set_point_fahrenheit``. :param heating_set_point_fahrenheit: Heating `set point `_ in °F that you want to simulate. You must set ``heating_set_point_fahrenheit`` or ``heating_set_point_celsius``. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -49,8 +48,7 @@ def temperature_reached( :param temperature_celsius: Temperature in °C that you want simulate the thermostat reaching. You must set ``temperature_celsius`` or ``temperature_fahrenheit``. :param temperature_fahrenheit: Temperature in °F that you want simulate the thermostat reaching. You must set ``temperature_fahrenheit`` or ``temperature_celsius``. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -80,8 +78,7 @@ async def hvac_mode_adjusted( :param heating_set_point_celsius: Heating `set point `_ in °C that you want to simulate. You must set ``heating_set_point_celsius`` or ``heating_set_point_fahrenheit``. :param heating_set_point_fahrenheit: Heating `set point `_ in °F that you want to simulate. You must set ``heating_set_point_fahrenheit`` or ``heating_set_point_celsius``. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -99,8 +96,7 @@ async def temperature_reached( :param temperature_celsius: Temperature in °C that you want simulate the thermostat reaching. You must set ``temperature_celsius`` or ``temperature_fahrenheit``. :param temperature_fahrenheit: Temperature in °F that you want simulate the thermostat reaching. You must set ``temperature_fahrenheit`` or ``temperature_celsius``. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -111,7 +107,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/thermostats/simulate/hvac_mode_adjusted", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def hvac_mode_adjusted( @@ -137,8 +133,7 @@ def hvac_mode_adjusted( :param heating_set_point_celsius: Heating `set point `_ in °C that you want to simulate. You must set ``heating_set_point_celsius`` or ``heating_set_point_fahrenheit``. :param heating_set_point_fahrenheit: Heating `set point `_ in °F that you want to simulate. You must set ``heating_set_point_fahrenheit`` or ``heating_set_point_celsius``. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -154,18 +149,13 @@ def hvac_mode_adjusted( if heating_set_point_fahrenheit is not None: json_payload["heating_set_point_fahrenheit"] = heating_set_point_fahrenheit - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/simulate/hvac_mode_adjusted" - ) - self.client.post("/thermostats/simulate/hvac_mode_adjusted", json=json_payload) return None @route_metadata( path="/thermostats/simulate/temperature_reached", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def temperature_reached( @@ -182,8 +172,7 @@ def temperature_reached( :param temperature_celsius: Temperature in °C that you want simulate the thermostat reaching. You must set ``temperature_celsius`` or ``temperature_fahrenheit``. :param temperature_fahrenheit: Temperature in °F that you want simulate the thermostat reaching. You must set ``temperature_fahrenheit`` or ``temperature_celsius``. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -193,11 +182,6 @@ def temperature_reached( if temperature_fahrenheit is not None: json_payload["temperature_fahrenheit"] = temperature_fahrenheit - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/simulate/temperature_reached" - ) - self.client.post("/thermostats/simulate/temperature_reached", json=json_payload) return None @@ -210,7 +194,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/thermostats/simulate/hvac_mode_adjusted", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def hvac_mode_adjusted( @@ -236,8 +220,7 @@ async def hvac_mode_adjusted( :param heating_set_point_celsius: Heating `set point `_ in °C that you want to simulate. You must set ``heating_set_point_celsius`` or ``heating_set_point_fahrenheit``. :param heating_set_point_fahrenheit: Heating `set point `_ in °F that you want to simulate. You must set ``heating_set_point_fahrenheit`` or ``heating_set_point_celsius``. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -253,11 +236,6 @@ async def hvac_mode_adjusted( if heating_set_point_fahrenheit is not None: json_payload["heating_set_point_fahrenheit"] = heating_set_point_fahrenheit - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/simulate/hvac_mode_adjusted" - ) - await self.client.post( "/thermostats/simulate/hvac_mode_adjusted", json=json_payload ) @@ -266,7 +244,7 @@ async def hvac_mode_adjusted( @route_metadata( path="/thermostats/simulate/temperature_reached", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def temperature_reached( @@ -283,8 +261,7 @@ async def temperature_reached( :param temperature_celsius: Temperature in °C that you want simulate the thermostat reaching. You must set ``temperature_celsius`` or ``temperature_fahrenheit``. :param temperature_fahrenheit: Temperature in °F that you want simulate the thermostat reaching. You must set ``temperature_fahrenheit`` or ``temperature_celsius``. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -294,11 +271,6 @@ async def temperature_reached( if temperature_fahrenheit is not None: json_payload["temperature_fahrenheit"] = temperature_fahrenheit - if not json_payload: - raise ValueError( - "At least one parameter is required for /thermostats/simulate/temperature_reached" - ) - await self.client.post( "/thermostats/simulate/temperature_reached", json=json_payload ) diff --git a/seam/routes/user_identities.py b/seam/routes/user_identities.py index 69ef5921..272f2d50 100644 --- a/seam/routes/user_identities.py +++ b/seam/routes/user_identities.py @@ -47,8 +47,7 @@ def add_acs_user( :param user_identity_id: ID of the user identity to which you want to add an access system user. :param user_identity_key: Key of the user identity to which you want to add an access system user. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -80,9 +79,7 @@ def create( def delete(self, *, user_identity_id: str) -> None: """Deletes a specified `user identity `_. This deletes the user identity and all associated resources, including any `credentials `_, `acs users `_ and `client sessions `_. - :param user_identity_id: ID of the user identity that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param user_identity_id: ID of the user identity that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -101,9 +98,7 @@ def generate_instant_key( :param max_use_count: Maximum number of times the instant key can be used. Default: 1. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -131,8 +126,7 @@ def grant_access_to_device(self, *, device_id: str, user_identity_id: str) -> No :param device_id: ID of the managed device to which you want to grant access to the user identity. :param user_identity_id: ID of the user identity that you want to grant access to a device. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -169,9 +163,7 @@ def list_accessible_devices(self, *, user_identity_id: str) -> List[Device]: :param user_identity_id: ID of the user identity for which you want to retrieve all accessible devices. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -180,9 +172,7 @@ def list_accessible_entrances(self, *, user_identity_id: str) -> List[AcsEntranc :param user_identity_id: ID of the user identity for which you want to retrieve all accessible entrances. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -191,9 +181,7 @@ def list_acs_systems(self, *, user_identity_id: str) -> List[AcsSystem]: :param user_identity_id: ID of the user identity for which you want to retrieve all access systems. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -202,9 +190,7 @@ def list_acs_users(self, *, user_identity_id: str) -> List[AcsUser]: :param user_identity_id: ID of the user identity for which you want to retrieve all access system users. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -242,8 +228,7 @@ def remove_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> None: :param acs_user_id: ID of the access system user that you want to remove from the user identity.. :param user_identity_id: ID of the user identity from which you want to remove an access system user. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -253,8 +238,7 @@ def revoke_access_to_device(self, *, device_id: str, user_identity_id: str) -> N :param device_id: ID of the managed device to which you want to revoke access from the user identity. :param user_identity_id: ID of the user identity from which you want to revoke access to a device. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -277,9 +261,7 @@ def update( :param phone_number: Unique phone number for the user identity. - :param user_identity_key: Unique key for the user identity. - - :raises ValueError: At least one parameter must be provided.""" + :param user_identity_key: Unique key for the user identity.""" raise NotImplementedError() @@ -309,8 +291,7 @@ async def add_acs_user( :param user_identity_id: ID of the user identity to which you want to add an access system user. :param user_identity_key: Key of the user identity to which you want to add an access system user. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -342,9 +323,7 @@ async def create( async def delete(self, *, user_identity_id: str) -> None: """Deletes a specified `user identity `_. This deletes the user identity and all associated resources, including any `credentials `_, `acs users `_ and `client sessions `_. - :param user_identity_id: ID of the user identity that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param user_identity_id: ID of the user identity that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -363,9 +342,7 @@ async def generate_instant_key( :param max_use_count: Maximum number of times the instant key can be used. Default: 1. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -395,8 +372,7 @@ async def grant_access_to_device( :param device_id: ID of the managed device to which you want to grant access to the user identity. :param user_identity_id: ID of the user identity that you want to grant access to a device. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -433,9 +409,7 @@ async def list_accessible_devices(self, *, user_identity_id: str) -> List[Device :param user_identity_id: ID of the user identity for which you want to retrieve all accessible devices. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -446,9 +420,7 @@ async def list_accessible_entrances( :param user_identity_id: ID of the user identity for which you want to retrieve all accessible entrances. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -457,9 +429,7 @@ async def list_acs_systems(self, *, user_identity_id: str) -> List[AcsSystem]: :param user_identity_id: ID of the user identity for which you want to retrieve all access systems. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -468,9 +438,7 @@ async def list_acs_users(self, *, user_identity_id: str) -> List[AcsUser]: :param user_identity_id: ID of the user identity for which you want to retrieve all access system users. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -508,8 +476,7 @@ async def remove_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> N :param acs_user_id: ID of the access system user that you want to remove from the user identity.. :param user_identity_id: ID of the user identity from which you want to remove an access system user. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -521,8 +488,7 @@ async def revoke_access_to_device( :param device_id: ID of the managed device to which you want to revoke access from the user identity. :param user_identity_id: ID of the user identity from which you want to revoke access to a device. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @abc.abstractmethod @@ -545,9 +511,7 @@ async def update( :param phone_number: Unique phone number for the user identity. - :param user_identity_key: Unique key for the user identity. - - :raises ValueError: At least one parameter must be provided.""" + :param user_identity_key: Unique key for the user identity.""" raise NotImplementedError() @@ -563,7 +527,7 @@ def unmanaged(self) -> UserIdentitiesUnmanaged: @route_metadata( path="/user_identities/add_acs_user", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def add_acs_user( @@ -584,8 +548,7 @@ def add_acs_user( :param user_identity_id: ID of the user identity to which you want to add an access system user. :param user_identity_key: Key of the user identity to which you want to add an access system user. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_user_id is not None: @@ -595,18 +558,13 @@ def add_acs_user( if user_identity_key is not None: json_payload["user_identity_key"] = user_identity_key - if not json_payload: - raise ValueError( - "At least one parameter is required for /user_identities/add_acs_user" - ) - self.client.put("/user_identities/add_acs_user", json=json_payload) return None @route_metadata( path="/user_identities/create", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) def create( @@ -652,32 +610,25 @@ def create( @route_metadata( path="/user_identities/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def delete(self, *, user_identity_id: str) -> None: """Deletes a specified `user identity `_. This deletes the user identity and all associated resources, including any `credentials `_, `acs users `_ and `client sessions `_. - :param user_identity_id: ID of the user identity that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param user_identity_id: ID of the user identity that you want to delete.""" params: Dict[str, Any] = {} if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/delete" - ) - self.client.delete("/user_identities/delete", params=params) return None @route_metadata( path="/user_identities/generate_instant_key", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def generate_instant_key( @@ -695,9 +646,7 @@ def generate_instant_key( :param max_use_count: Maximum number of times the instant key can be used. Default: 1. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if user_identity_id is not None: @@ -707,11 +656,6 @@ def generate_instant_key( if max_use_count is not None: json_payload["max_use_count"] = max_use_count - if not json_payload: - raise ValueError( - "At least one parameter is required for /user_identities/generate_instant_key" - ) - res = self.client.post( "/user_identities/generate_instant_key", json=json_payload ) @@ -721,7 +665,12 @@ def generate_instant_key( ) @route_metadata( - path="/user_identities/get", has_required_parameters=True, has_pagination=False + path="/user_identities/get", + at_least_one_parameter_names=( + "user_identity_id", + "user_identity_key", + ), + has_pagination=False, ) def get( self, @@ -745,7 +694,13 @@ def get( if user_identity_key is not None: params["user_identity_key"] = user_identity_key - if not params: + if all( + param is None + for param in ( + user_identity_id, + user_identity_key, + ) + ): raise ValueError( "At least one parameter is required for /user_identities/get" ) @@ -758,7 +713,7 @@ def get( @route_metadata( path="/user_identities/grant_access_to_device", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def grant_access_to_device(self, *, device_id: str, user_identity_id: str) -> None: @@ -767,8 +722,7 @@ def grant_access_to_device(self, *, device_id: str, user_identity_id: str) -> No :param device_id: ID of the managed device to which you want to grant access to the user identity. :param user_identity_id: ID of the user identity that you want to grant access to a device. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -776,17 +730,14 @@ def grant_access_to_device(self, *, device_id: str, user_identity_id: str) -> No if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /user_identities/grant_access_to_device" - ) - self.client.put("/user_identities/grant_access_to_device", json=json_payload) return None @route_metadata( - path="/user_identities/list", has_required_parameters=False, has_pagination=True + path="/user_identities/list", + at_least_one_parameter_names=(), + has_pagination=True, ) def list( self, @@ -839,7 +790,7 @@ def list( @route_metadata( path="/user_identities/list_accessible_devices", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def list_accessible_devices(self, *, user_identity_id: str) -> List[Device]: @@ -847,19 +798,12 @@ def list_accessible_devices(self, *, user_identity_id: str) -> List[Device]: :param user_identity_id: ID of the user identity for which you want to retrieve all accessible devices. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/list_accessible_devices" - ) - res = self.client.get("/user_identities/list_accessible_devices", params=params) return [ @@ -871,7 +815,7 @@ def list_accessible_devices(self, *, user_identity_id: str) -> List[Device]: @route_metadata( path="/user_identities/list_accessible_entrances", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def list_accessible_entrances(self, *, user_identity_id: str) -> List[AcsEntrance]: @@ -879,19 +823,12 @@ def list_accessible_entrances(self, *, user_identity_id: str) -> List[AcsEntranc :param user_identity_id: ID of the user identity for which you want to retrieve all accessible entrances. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/list_accessible_entrances" - ) - res = self.client.get( "/user_identities/list_accessible_entrances", params=params ) @@ -905,7 +842,7 @@ def list_accessible_entrances(self, *, user_identity_id: str) -> List[AcsEntranc @route_metadata( path="/user_identities/list_acs_systems", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def list_acs_systems(self, *, user_identity_id: str) -> List[AcsSystem]: @@ -913,19 +850,12 @@ def list_acs_systems(self, *, user_identity_id: str) -> List[AcsSystem]: :param user_identity_id: ID of the user identity for which you want to retrieve all access systems. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/list_acs_systems" - ) - res = self.client.get("/user_identities/list_acs_systems", params=params) return [ @@ -937,7 +867,7 @@ def list_acs_systems(self, *, user_identity_id: str) -> List[AcsSystem]: @route_metadata( path="/user_identities/list_acs_users", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def list_acs_users(self, *, user_identity_id: str) -> List[AcsUser]: @@ -945,19 +875,12 @@ def list_acs_users(self, *, user_identity_id: str) -> List[AcsUser]: :param user_identity_id: ID of the user identity for which you want to retrieve all access system users. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/list_acs_users" - ) - res = self.client.get("/user_identities/list_acs_users", params=params) return [ @@ -967,7 +890,12 @@ def list_acs_users(self, *, user_identity_id: str) -> List[AcsUser]: @route_metadata( path="/user_identities/merge", - has_required_parameters=True, + at_least_one_parameter_names=( + "merged_user_identity_ids", + "merged_user_identity_keys", + "user_identity_id", + "user_identity_key", + ), has_pagination=False, ) def merge( @@ -1006,7 +934,15 @@ def merge( if user_identity_key is not None: json_payload["user_identity_key"] = user_identity_key - if not json_payload: + if all( + param is None + for param in ( + merged_user_identity_ids, + merged_user_identity_keys, + user_identity_id, + user_identity_key, + ) + ): raise ValueError( "At least one parameter is required for /user_identities/merge" ) @@ -1017,7 +953,7 @@ def merge( @route_metadata( path="/user_identities/remove_acs_user", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def remove_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> None: @@ -1026,8 +962,7 @@ def remove_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> None: :param acs_user_id: ID of the access system user that you want to remove from the user identity.. :param user_identity_id: ID of the user identity from which you want to remove an access system user. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if acs_user_id is not None: @@ -1035,18 +970,13 @@ def remove_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> None: if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/remove_acs_user" - ) - self.client.delete("/user_identities/remove_acs_user", params=params) return None @route_metadata( path="/user_identities/revoke_access_to_device", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def revoke_access_to_device(self, *, device_id: str, user_identity_id: str) -> None: @@ -1055,8 +985,7 @@ def revoke_access_to_device(self, *, device_id: str, user_identity_id: str) -> N :param device_id: ID of the managed device to which you want to revoke access from the user identity. :param user_identity_id: ID of the user identity from which you want to revoke access to a device. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if device_id is not None: @@ -1064,18 +993,13 @@ def revoke_access_to_device(self, *, device_id: str, user_identity_id: str) -> N if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/revoke_access_to_device" - ) - self.client.delete("/user_identities/revoke_access_to_device", params=params) return None @route_metadata( path="/user_identities/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update( @@ -1097,9 +1021,7 @@ def update( :param phone_number: Unique phone number for the user identity. - :param user_identity_key: Unique key for the user identity. - - :raises ValueError: At least one parameter must be provided.""" + :param user_identity_key: Unique key for the user identity.""" json_payload: Dict[str, Any] = {} if user_identity_id is not None: @@ -1113,11 +1035,6 @@ def update( if user_identity_key is not None: json_payload["user_identity_key"] = user_identity_key - if not json_payload: - raise ValueError( - "At least one parameter is required for /user_identities/update" - ) - self.client.patch("/user_identities/update", json=json_payload) return None @@ -1135,7 +1052,7 @@ def unmanaged(self) -> AsyncUserIdentitiesUnmanaged: @route_metadata( path="/user_identities/add_acs_user", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def add_acs_user( @@ -1156,8 +1073,7 @@ async def add_acs_user( :param user_identity_id: ID of the user identity to which you want to add an access system user. :param user_identity_key: Key of the user identity to which you want to add an access system user. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if acs_user_id is not None: @@ -1167,18 +1083,13 @@ async def add_acs_user( if user_identity_key is not None: json_payload["user_identity_key"] = user_identity_key - if not json_payload: - raise ValueError( - "At least one parameter is required for /user_identities/add_acs_user" - ) - await self.client.put("/user_identities/add_acs_user", json=json_payload) return None @route_metadata( path="/user_identities/create", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) async def create( @@ -1224,32 +1135,25 @@ async def create( @route_metadata( path="/user_identities/delete", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def delete(self, *, user_identity_id: str) -> None: """Deletes a specified `user identity `_. This deletes the user identity and all associated resources, including any `credentials `_, `acs users `_ and `client sessions `_. - :param user_identity_id: ID of the user identity that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param user_identity_id: ID of the user identity that you want to delete.""" params: Dict[str, Any] = {} if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/delete" - ) - await self.client.delete("/user_identities/delete", params=params) return None @route_metadata( path="/user_identities/generate_instant_key", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def generate_instant_key( @@ -1267,9 +1171,7 @@ async def generate_instant_key( :param max_use_count: Maximum number of times the instant key can be used. Default: 1. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if user_identity_id is not None: @@ -1279,11 +1181,6 @@ async def generate_instant_key( if max_use_count is not None: json_payload["max_use_count"] = max_use_count - if not json_payload: - raise ValueError( - "At least one parameter is required for /user_identities/generate_instant_key" - ) - res = await self.client.post( "/user_identities/generate_instant_key", json=json_payload ) @@ -1293,7 +1190,12 @@ async def generate_instant_key( ) @route_metadata( - path="/user_identities/get", has_required_parameters=True, has_pagination=False + path="/user_identities/get", + at_least_one_parameter_names=( + "user_identity_id", + "user_identity_key", + ), + has_pagination=False, ) async def get( self, @@ -1317,7 +1219,13 @@ async def get( if user_identity_key is not None: params["user_identity_key"] = user_identity_key - if not params: + if all( + param is None + for param in ( + user_identity_id, + user_identity_key, + ) + ): raise ValueError( "At least one parameter is required for /user_identities/get" ) @@ -1330,7 +1238,7 @@ async def get( @route_metadata( path="/user_identities/grant_access_to_device", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def grant_access_to_device( @@ -1341,8 +1249,7 @@ async def grant_access_to_device( :param device_id: ID of the managed device to which you want to grant access to the user identity. :param user_identity_id: ID of the user identity that you want to grant access to a device. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if device_id is not None: @@ -1350,11 +1257,6 @@ async def grant_access_to_device( if user_identity_id is not None: json_payload["user_identity_id"] = user_identity_id - if not json_payload: - raise ValueError( - "At least one parameter is required for /user_identities/grant_access_to_device" - ) - await self.client.put( "/user_identities/grant_access_to_device", json=json_payload ) @@ -1362,7 +1264,9 @@ async def grant_access_to_device( return None @route_metadata( - path="/user_identities/list", has_required_parameters=False, has_pagination=True + path="/user_identities/list", + at_least_one_parameter_names=(), + has_pagination=True, ) async def list( self, @@ -1415,7 +1319,7 @@ async def list( @route_metadata( path="/user_identities/list_accessible_devices", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def list_accessible_devices(self, *, user_identity_id: str) -> List[Device]: @@ -1423,19 +1327,12 @@ async def list_accessible_devices(self, *, user_identity_id: str) -> List[Device :param user_identity_id: ID of the user identity for which you want to retrieve all accessible devices. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/list_accessible_devices" - ) - res = await self.client.get( "/user_identities/list_accessible_devices", params=params ) @@ -1449,7 +1346,7 @@ async def list_accessible_devices(self, *, user_identity_id: str) -> List[Device @route_metadata( path="/user_identities/list_accessible_entrances", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def list_accessible_entrances( @@ -1459,19 +1356,12 @@ async def list_accessible_entrances( :param user_identity_id: ID of the user identity for which you want to retrieve all accessible entrances. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/list_accessible_entrances" - ) - res = await self.client.get( "/user_identities/list_accessible_entrances", params=params ) @@ -1485,7 +1375,7 @@ async def list_accessible_entrances( @route_metadata( path="/user_identities/list_acs_systems", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def list_acs_systems(self, *, user_identity_id: str) -> List[AcsSystem]: @@ -1493,19 +1383,12 @@ async def list_acs_systems(self, *, user_identity_id: str) -> List[AcsSystem]: :param user_identity_id: ID of the user identity for which you want to retrieve all access systems. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/list_acs_systems" - ) - res = await self.client.get("/user_identities/list_acs_systems", params=params) return [ @@ -1517,7 +1400,7 @@ async def list_acs_systems(self, *, user_identity_id: str) -> List[AcsSystem]: @route_metadata( path="/user_identities/list_acs_users", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def list_acs_users(self, *, user_identity_id: str) -> List[AcsUser]: @@ -1525,19 +1408,12 @@ async def list_acs_users(self, *, user_identity_id: str) -> List[AcsUser]: :param user_identity_id: ID of the user identity for which you want to retrieve all access system users. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/list_acs_users" - ) - res = await self.client.get("/user_identities/list_acs_users", params=params) return [ @@ -1547,7 +1423,12 @@ async def list_acs_users(self, *, user_identity_id: str) -> List[AcsUser]: @route_metadata( path="/user_identities/merge", - has_required_parameters=True, + at_least_one_parameter_names=( + "merged_user_identity_ids", + "merged_user_identity_keys", + "user_identity_id", + "user_identity_key", + ), has_pagination=False, ) async def merge( @@ -1586,7 +1467,15 @@ async def merge( if user_identity_key is not None: json_payload["user_identity_key"] = user_identity_key - if not json_payload: + if all( + param is None + for param in ( + merged_user_identity_ids, + merged_user_identity_keys, + user_identity_id, + user_identity_key, + ) + ): raise ValueError( "At least one parameter is required for /user_identities/merge" ) @@ -1597,7 +1486,7 @@ async def merge( @route_metadata( path="/user_identities/remove_acs_user", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def remove_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> None: @@ -1606,8 +1495,7 @@ async def remove_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> N :param acs_user_id: ID of the access system user that you want to remove from the user identity.. :param user_identity_id: ID of the user identity from which you want to remove an access system user. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if acs_user_id is not None: @@ -1615,18 +1503,13 @@ async def remove_acs_user(self, *, acs_user_id: str, user_identity_id: str) -> N if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/remove_acs_user" - ) - await self.client.delete("/user_identities/remove_acs_user", params=params) return None @route_metadata( path="/user_identities/revoke_access_to_device", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def revoke_access_to_device( @@ -1637,8 +1520,7 @@ async def revoke_access_to_device( :param device_id: ID of the managed device to which you want to revoke access from the user identity. :param user_identity_id: ID of the user identity from which you want to revoke access to a device. - - :raises ValueError: At least one parameter must be provided.""" + """ params: Dict[str, Any] = {} if device_id is not None: @@ -1646,11 +1528,6 @@ async def revoke_access_to_device( if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/revoke_access_to_device" - ) - await self.client.delete( "/user_identities/revoke_access_to_device", params=params ) @@ -1659,7 +1536,7 @@ async def revoke_access_to_device( @route_metadata( path="/user_identities/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update( @@ -1681,9 +1558,7 @@ async def update( :param phone_number: Unique phone number for the user identity. - :param user_identity_key: Unique key for the user identity. - - :raises ValueError: At least one parameter must be provided.""" + :param user_identity_key: Unique key for the user identity.""" json_payload: Dict[str, Any] = {} if user_identity_id is not None: @@ -1697,11 +1572,6 @@ async def update( if user_identity_key is not None: json_payload["user_identity_key"] = user_identity_key - if not json_payload: - raise ValueError( - "At least one parameter is required for /user_identities/update" - ) - await self.client.patch("/user_identities/update", json=json_payload) return None diff --git a/seam/routes/user_identities_unmanaged.py b/seam/routes/user_identities_unmanaged.py index d92f51c3..3bd414c3 100644 --- a/seam/routes/user_identities_unmanaged.py +++ b/seam/routes/user_identities_unmanaged.py @@ -16,9 +16,7 @@ def get(self, *, user_identity_id: str) -> UnmanagedUserIdentity: :param user_identity_id: ID of the unmanaged user identity that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -60,8 +58,7 @@ def update( :param user_identity_id: ID of the unmanaged user identity that you want to update. :param user_identity_key: Unique key for the user identity. If not provided, the existing key will be preserved. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -73,9 +70,7 @@ async def get(self, *, user_identity_id: str) -> UnmanagedUserIdentity: :param user_identity_id: ID of the unmanaged user identity that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -117,8 +112,7 @@ async def update( :param user_identity_id: ID of the unmanaged user identity that you want to update. :param user_identity_key: Unique key for the user identity. If not provided, the existing key will be preserved. - - :raises ValueError: At least one parameter must be provided.""" + """ raise NotImplementedError() @@ -129,7 +123,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/user_identities/unmanaged/get", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def get(self, *, user_identity_id: str) -> UnmanagedUserIdentity: @@ -137,19 +131,12 @@ def get(self, *, user_identity_id: str) -> UnmanagedUserIdentity: :param user_identity_id: ID of the unmanaged user identity that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/unmanaged/get" - ) - res = self.client.get("/user_identities/unmanaged/get", params=params) return UnmanagedUserIdentity.from_dict( @@ -158,7 +145,7 @@ def get(self, *, user_identity_id: str) -> UnmanagedUserIdentity: @route_metadata( path="/user_identities/unmanaged/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=True, ) def list( @@ -202,7 +189,7 @@ def list( @route_metadata( path="/user_identities/unmanaged/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) def update( @@ -221,8 +208,7 @@ def update( :param user_identity_id: ID of the unmanaged user identity that you want to update. :param user_identity_key: Unique key for the user identity. If not provided, the existing key will be preserved. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if is_managed is not None: @@ -232,11 +218,6 @@ def update( if user_identity_key is not None: json_payload["user_identity_key"] = user_identity_key - if not json_payload: - raise ValueError( - "At least one parameter is required for /user_identities/unmanaged/update" - ) - self.client.patch("/user_identities/unmanaged/update", json=json_payload) return None @@ -249,7 +230,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): @route_metadata( path="/user_identities/unmanaged/get", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def get(self, *, user_identity_id: str) -> UnmanagedUserIdentity: @@ -257,19 +238,12 @@ async def get(self, *, user_identity_id: str) -> UnmanagedUserIdentity: :param user_identity_id: ID of the unmanaged user identity that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if user_identity_id is not None: params["user_identity_id"] = user_identity_id - if not params: - raise ValueError( - "At least one parameter is required for /user_identities/unmanaged/get" - ) - res = await self.client.get("/user_identities/unmanaged/get", params=params) return UnmanagedUserIdentity.from_dict( @@ -278,7 +252,7 @@ async def get(self, *, user_identity_id: str) -> UnmanagedUserIdentity: @route_metadata( path="/user_identities/unmanaged/list", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=True, ) async def list( @@ -322,7 +296,7 @@ async def list( @route_metadata( path="/user_identities/unmanaged/update", - has_required_parameters=True, + at_least_one_parameter_names=(), has_pagination=False, ) async def update( @@ -341,8 +315,7 @@ async def update( :param user_identity_id: ID of the unmanaged user identity that you want to update. :param user_identity_key: Unique key for the user identity. If not provided, the existing key will be preserved. - - :raises ValueError: At least one parameter must be provided.""" + """ json_payload: Dict[str, Any] = {} if is_managed is not None: @@ -352,11 +325,6 @@ async def update( if user_identity_key is not None: json_payload["user_identity_key"] = user_identity_key - if not json_payload: - raise ValueError( - "At least one parameter is required for /user_identities/unmanaged/update" - ) - await self.client.patch("/user_identities/unmanaged/update", json=json_payload) return None diff --git a/seam/routes/webhooks.py b/seam/routes/webhooks.py index 7742cb70..95784617 100644 --- a/seam/routes/webhooks.py +++ b/seam/routes/webhooks.py @@ -17,18 +17,14 @@ def create(self, *, url: str, event_types: Optional[List[str]] = None) -> Webhoo :param event_types: Types of events that you want the new webhook to receive. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod def delete(self, *, webhook_id: str) -> None: """Deletes a specified `webhook `_. - :param webhook_id: ID of the webhook that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param webhook_id: ID of the webhook that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -37,9 +33,7 @@ def get(self, *, webhook_id: str) -> Webhook: :param webhook_id: ID of the webhook that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -55,9 +49,7 @@ def update(self, *, event_types: List[str], webhook_id: str) -> None: :param event_types: Types of events that you want the webhook to receive. - :param webhook_id: ID of the webhook that you want to update. - - :raises ValueError: At least one parameter must be provided.""" + :param webhook_id: ID of the webhook that you want to update.""" raise NotImplementedError() @@ -73,18 +65,14 @@ async def create( :param event_types: Types of events that you want the new webhook to receive. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod async def delete(self, *, webhook_id: str) -> None: """Deletes a specified `webhook `_. - :param webhook_id: ID of the webhook that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param webhook_id: ID of the webhook that you want to delete.""" raise NotImplementedError() @abc.abstractmethod @@ -93,9 +81,7 @@ async def get(self, *, webhook_id: str) -> Webhook: :param webhook_id: ID of the webhook that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -111,9 +97,7 @@ async def update(self, *, event_types: List[str], webhook_id: str) -> None: :param event_types: Types of events that you want the webhook to receive. - :param webhook_id: ID of the webhook that you want to update. - - :raises ValueError: At least one parameter must be provided.""" + :param webhook_id: ID of the webhook that you want to update.""" raise NotImplementedError() @@ -123,7 +107,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/webhooks/create", has_required_parameters=True, has_pagination=False + path="/webhooks/create", at_least_one_parameter_names=(), has_pagination=False ) def create(self, *, url: str, event_types: Optional[List[str]] = None) -> Webhook: """Creates a new `webhook `_. @@ -132,9 +116,7 @@ def create(self, *, url: str, event_types: Optional[List[str]] = None) -> Webhoo :param event_types: Types of events that you want the new webhook to receive. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if url is not None: @@ -142,59 +124,46 @@ def create(self, *, url: str, event_types: Optional[List[str]] = None) -> Webhoo if event_types is not None: json_payload["event_types"] = event_types - if not json_payload: - raise ValueError("At least one parameter is required for /webhooks/create") - res = self.client.post("/webhooks/create", json=json_payload) return Webhook.from_dict(unwrap(res, "webhook", "/webhooks/create")) @route_metadata( - path="/webhooks/delete", has_required_parameters=True, has_pagination=False + path="/webhooks/delete", at_least_one_parameter_names=(), has_pagination=False ) def delete(self, *, webhook_id: str) -> None: """Deletes a specified `webhook `_. - :param webhook_id: ID of the webhook that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param webhook_id: ID of the webhook that you want to delete.""" params: Dict[str, Any] = {} if webhook_id is not None: params["webhook_id"] = webhook_id - if not params: - raise ValueError("At least one parameter is required for /webhooks/delete") - self.client.delete("/webhooks/delete", params=params) return None @route_metadata( - path="/webhooks/get", has_required_parameters=True, has_pagination=False + path="/webhooks/get", at_least_one_parameter_names=(), has_pagination=False ) def get(self, *, webhook_id: str) -> Webhook: """Gets a specified `webhook `_. :param webhook_id: ID of the webhook that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if webhook_id is not None: params["webhook_id"] = webhook_id - if not params: - raise ValueError("At least one parameter is required for /webhooks/get") - res = self.client.get("/webhooks/get", params=params) return Webhook.from_dict(unwrap(res, "webhook", "/webhooks/get")) @route_metadata( - path="/webhooks/list", has_required_parameters=False, has_pagination=False + path="/webhooks/list", at_least_one_parameter_names=(), has_pagination=False ) def list(self) -> List[Webhook]: """Returns a list of all `webhooks `_. @@ -210,16 +179,14 @@ def list(self) -> List[Webhook]: ] @route_metadata( - path="/webhooks/update", has_required_parameters=True, has_pagination=False + path="/webhooks/update", at_least_one_parameter_names=(), has_pagination=False ) def update(self, *, event_types: List[str], webhook_id: str) -> None: """Updates a specified `webhook `_. :param event_types: Types of events that you want the webhook to receive. - :param webhook_id: ID of the webhook that you want to update. - - :raises ValueError: At least one parameter must be provided.""" + :param webhook_id: ID of the webhook that you want to update.""" json_payload: Dict[str, Any] = {} if event_types is not None: @@ -227,9 +194,6 @@ def update(self, *, event_types: List[str], webhook_id: str) -> None: if webhook_id is not None: json_payload["webhook_id"] = webhook_id - if not json_payload: - raise ValueError("At least one parameter is required for /webhooks/update") - self.client.put("/webhooks/update", json=json_payload) return None @@ -241,7 +205,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/webhooks/create", has_required_parameters=True, has_pagination=False + path="/webhooks/create", at_least_one_parameter_names=(), has_pagination=False ) async def create( self, *, url: str, event_types: Optional[List[str]] = None @@ -252,9 +216,7 @@ async def create( :param event_types: Types of events that you want the new webhook to receive. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if url is not None: @@ -262,59 +224,46 @@ async def create( if event_types is not None: json_payload["event_types"] = event_types - if not json_payload: - raise ValueError("At least one parameter is required for /webhooks/create") - res = await self.client.post("/webhooks/create", json=json_payload) return Webhook.from_dict(unwrap(res, "webhook", "/webhooks/create")) @route_metadata( - path="/webhooks/delete", has_required_parameters=True, has_pagination=False + path="/webhooks/delete", at_least_one_parameter_names=(), has_pagination=False ) async def delete(self, *, webhook_id: str) -> None: """Deletes a specified `webhook `_. - :param webhook_id: ID of the webhook that you want to delete. - - :raises ValueError: At least one parameter must be provided.""" + :param webhook_id: ID of the webhook that you want to delete.""" params: Dict[str, Any] = {} if webhook_id is not None: params["webhook_id"] = webhook_id - if not params: - raise ValueError("At least one parameter is required for /webhooks/delete") - await self.client.delete("/webhooks/delete", params=params) return None @route_metadata( - path="/webhooks/get", has_required_parameters=True, has_pagination=False + path="/webhooks/get", at_least_one_parameter_names=(), has_pagination=False ) async def get(self, *, webhook_id: str) -> Webhook: """Gets a specified `webhook `_. :param webhook_id: ID of the webhook that you want to get. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" params: Dict[str, Any] = {} if webhook_id is not None: params["webhook_id"] = webhook_id - if not params: - raise ValueError("At least one parameter is required for /webhooks/get") - res = await self.client.get("/webhooks/get", params=params) return Webhook.from_dict(unwrap(res, "webhook", "/webhooks/get")) @route_metadata( - path="/webhooks/list", has_required_parameters=False, has_pagination=False + path="/webhooks/list", at_least_one_parameter_names=(), has_pagination=False ) async def list(self) -> List[Webhook]: """Returns a list of all `webhooks `_. @@ -330,16 +279,14 @@ async def list(self) -> List[Webhook]: ] @route_metadata( - path="/webhooks/update", has_required_parameters=True, has_pagination=False + path="/webhooks/update", at_least_one_parameter_names=(), has_pagination=False ) async def update(self, *, event_types: List[str], webhook_id: str) -> None: """Updates a specified `webhook `_. :param event_types: Types of events that you want the webhook to receive. - :param webhook_id: ID of the webhook that you want to update. - - :raises ValueError: At least one parameter must be provided.""" + :param webhook_id: ID of the webhook that you want to update.""" json_payload: Dict[str, Any] = {} if event_types is not None: @@ -347,9 +294,6 @@ async def update(self, *, event_types: List[str], webhook_id: str) -> None: if webhook_id is not None: json_payload["webhook_id"] = webhook_id - if not json_payload: - raise ValueError("At least one parameter is required for /webhooks/update") - await self.client.put("/webhooks/update", json=json_payload) return None diff --git a/seam/routes/workspaces.py b/seam/routes/workspaces.py index 2068c668..9c14fd88 100644 --- a/seam/routes/workspaces.py +++ b/seam/routes/workspaces.py @@ -51,9 +51,7 @@ def create( :param webview_success_message: Deprecated: Use ``connect_webview_customization.webview_success_message`` instead. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -148,9 +146,7 @@ async def create( :param webview_success_message: Deprecated: Use ``connect_webview_customization.webview_success_message`` instead. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" raise NotImplementedError() @abc.abstractmethod @@ -212,7 +208,7 @@ def __init__(self, client: SeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/workspaces/create", has_required_parameters=True, has_pagination=False + path="/workspaces/create", at_least_one_parameter_names=(), has_pagination=False ) def create( self, @@ -250,9 +246,7 @@ def create( :param webview_success_message: Deprecated: Use ``connect_webview_customization.webview_success_message`` instead. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if name is not None: @@ -280,17 +274,12 @@ def create( if webview_success_message is not None: json_payload["webview_success_message"] = webview_success_message - if not json_payload: - raise ValueError( - "At least one parameter is required for /workspaces/create" - ) - res = self.client.post("/workspaces/create", json=json_payload) return Workspace.from_dict(unwrap(res, "workspace", "/workspaces/create")) @route_metadata( - path="/workspaces/get", has_required_parameters=False, has_pagination=False + path="/workspaces/get", at_least_one_parameter_names=(), has_pagination=False ) def get(self) -> Workspace: """Returns the `workspace `_ associated with the authentication value. @@ -303,7 +292,7 @@ def get(self) -> Workspace: return Workspace.from_dict(unwrap(res, "workspace", "/workspaces/get")) @route_metadata( - path="/workspaces/list", has_required_parameters=False, has_pagination=False + path="/workspaces/list", at_least_one_parameter_names=(), has_pagination=False ) def list(self) -> List[Workspace]: """Returns a list of `workspaces `_ associated with the authentication value. @@ -320,7 +309,7 @@ def list(self) -> List[Workspace]: @route_metadata( path="/workspaces/reset_sandbox", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) def reset_sandbox( @@ -350,7 +339,7 @@ def reset_sandbox( ) @route_metadata( - path="/workspaces/update", has_required_parameters=False, has_pagination=False + path="/workspaces/update", at_least_one_parameter_names=(), has_pagination=False ) def update( self, @@ -406,7 +395,7 @@ def __init__(self, client: AsyncSeamHttpClient, defaults: Dict[str, Any]): self.defaults = defaults @route_metadata( - path="/workspaces/create", has_required_parameters=True, has_pagination=False + path="/workspaces/create", at_least_one_parameter_names=(), has_pagination=False ) async def create( self, @@ -444,9 +433,7 @@ async def create( :param webview_success_message: Deprecated: Use ``connect_webview_customization.webview_success_message`` instead. - :returns: OK - - :raises ValueError: At least one parameter must be provided.""" + :returns: OK""" json_payload: Dict[str, Any] = {} if name is not None: @@ -474,17 +461,12 @@ async def create( if webview_success_message is not None: json_payload["webview_success_message"] = webview_success_message - if not json_payload: - raise ValueError( - "At least one parameter is required for /workspaces/create" - ) - res = await self.client.post("/workspaces/create", json=json_payload) return Workspace.from_dict(unwrap(res, "workspace", "/workspaces/create")) @route_metadata( - path="/workspaces/get", has_required_parameters=False, has_pagination=False + path="/workspaces/get", at_least_one_parameter_names=(), has_pagination=False ) async def get(self) -> Workspace: """Returns the `workspace `_ associated with the authentication value. @@ -497,7 +479,7 @@ async def get(self) -> Workspace: return Workspace.from_dict(unwrap(res, "workspace", "/workspaces/get")) @route_metadata( - path="/workspaces/list", has_required_parameters=False, has_pagination=False + path="/workspaces/list", at_least_one_parameter_names=(), has_pagination=False ) async def list(self) -> List[Workspace]: """Returns a list of `workspaces `_ associated with the authentication value. @@ -514,7 +496,7 @@ async def list(self) -> List[Workspace]: @route_metadata( path="/workspaces/reset_sandbox", - has_required_parameters=False, + at_least_one_parameter_names=(), has_pagination=False, ) async def reset_sandbox( @@ -544,7 +526,7 @@ async def reset_sandbox( ) @route_metadata( - path="/workspaces/update", has_required_parameters=False, has_pagination=False + path="/workspaces/update", at_least_one_parameter_names=(), has_pagination=False ) async def update( self, diff --git a/seam/seam.py b/seam/seam.py index 16b2f4d5..56b301e7 100644 --- a/seam/seam.py +++ b/seam/seam.py @@ -146,11 +146,12 @@ def create_paginator( if not getattr(request, "__seam_has_pagination__", False): raise ValueError("Cannot create a paginator for a non-paginated endpoint") - has_required_parameters = getattr( - request, "__seam_has_required_parameters__", False + at_least_one_parameter_names = getattr( + request, "__seam_at_least_one_parameter_names__", () ) - if has_required_parameters and ( - not params or not any(value is not None for value in params.values()) + if at_least_one_parameter_names and ( + not params + or all(params.get(name) is None for name in at_least_one_parameter_names) ): path = getattr(request, "__seam_path__", "this endpoint") raise ValueError(f"At least one parameter is required for {path}") @@ -394,11 +395,12 @@ def create_paginator( if not getattr(request, "__seam_has_pagination__", False): raise ValueError("Cannot create a paginator for a non-paginated endpoint") - has_required_parameters = getattr( - request, "__seam_has_required_parameters__", False + at_least_one_parameter_names = getattr( + request, "__seam_at_least_one_parameter_names__", () ) - if has_required_parameters and ( - not params or not any(value is not None for value in params.values()) + if at_least_one_parameter_names and ( + not params + or all(params.get(name) is None for name in at_least_one_parameter_names) ): path = getattr(request, "__seam_path__", "this endpoint") raise ValueError(f"At least one parameter is required for {path}") diff --git a/test/required_parameters_test.py b/test/required_parameters_test.py new file mode 100644 index 00000000..6ef6df45 --- /dev/null +++ b/test/required_parameters_test.py @@ -0,0 +1,70 @@ +import pytest + +from seam import Seam + + +def test_a_pagination_knob_does_not_satisfy_the_guard(seam: Seam): + with pytest.raises( + ValueError, match="At least one parameter is required for /access_codes/list" + ): + seam.access_codes.list(limit=20) + + +def test_a_page_cursor_does_not_satisfy_the_guard(seam: Seam): + with pytest.raises( + ValueError, match="At least one parameter is required for /access_codes/list" + ): + seam.access_codes.list(page_cursor="some-cursor") + + +def test_a_filter_parameter_satisfies_the_guard(seam: Seam, server): + _, seed = server + + access_codes = seam.access_codes.list(device_id=seed["august_device_1"]) + + assert isinstance(access_codes, list) + + +def test_an_unpaginated_endpoint_still_guards_its_filters(seam: Seam): + with pytest.raises( + ValueError, match="At least one parameter is required for /events/list" + ): + seam.events.list(limit=5) + + +def test_create_paginator_rejects_pagination_only_params(seam: Seam): + with pytest.raises( + ValueError, match="At least one parameter is required for /access_codes/list" + ): + seam.create_paginator(seam.access_codes.list, {"limit": 20}) + + +def test_create_paginator_rejects_a_page_cursor_alone(seam: Seam): + with pytest.raises( + ValueError, match="At least one parameter is required for /access_codes/list" + ): + seam.create_paginator(seam.access_codes.list, {"page_cursor": "some-cursor"}) + + +def test_create_paginator_accepts_a_filter_parameter(seam: Seam, server): + _, seed = server + + paginator = seam.create_paginator( + seam.access_codes.list, {"device_id": seed["august_device_1"]} + ) + + assert isinstance(paginator.flatten_to_list(), list) + + +async def test_a_pagination_knob_does_not_satisfy_the_guard_async(async_seam): + with pytest.raises( + ValueError, match="At least one parameter is required for /access_codes/list" + ): + await async_seam.access_codes.list(limit=20) + + +async def test_create_paginator_rejects_pagination_only_params_async(async_seam): + with pytest.raises( + ValueError, match="At least one parameter is required for /access_codes/list" + ): + async_seam.create_paginator(async_seam.access_codes.list, {"limit": 20})