def update_by_key( self, key: str, version: int, actions: List[types.CategoryUpdateAction] ) -> types.Category: update_action = types.CategoryUpdate(version=version, actions=actions) return self._client._post( f"categories/key={key}", {}, update_action, schemas.CategoryUpdateSchema, schemas.CategorySchema, )
def update_by_key( self, key: str, version: int, actions: List[types.CategoryUpdateAction], *, force_update: bool = False, ) -> types.Category: update_action = types.CategoryUpdate(version=version, actions=actions) return self._client._post( endpoint=f"categories/key={key}", params={}, data_object=update_action, request_schema_cls=schemas.CategoryUpdateSchema, response_schema_cls=schemas.CategorySchema, force_update=force_update, )
def update_by_key( self, key: str, version: int, actions: List[types.CategoryUpdateAction], expand: OptionalListStr = None, *, force_update: bool = False, ) -> types.Category: query_params = {} if expand: query_params["expand"] = expand update_action = types.CategoryUpdate(version=version, actions=actions) return self._client._post( endpoint=f"categories/key={key}", params=query_params, data_object=update_action, request_schema_cls=schemas.CategoryUpdateSchema, response_schema_cls=schemas.CategorySchema, force_update=force_update, )
def post_load(self, data, **kwargs): return types.CategoryUpdate(**data)