Exemplo n.º 1
0
 def update_by_key(
     self, key: str, version: int,
     actions: List[types.ShippingMethodUpdateAction]
 ) -> types.ShippingMethod:
     update_action = types.ShippingMethodUpdate(version=version,
                                                actions=actions)
     return self._client._post(
         f"shipping-methods/key={key}",
         {},
         update_action,
         schemas.ShippingMethodUpdateSchema,
         schemas.ShippingMethodSchema,
     )
Exemplo n.º 2
0
 def update_by_key(
     self,
     key: str,
     version: int,
     actions: List[types.ShippingMethodUpdateAction],
     *,
     force_update: bool = False,
 ) -> types.ShippingMethod:
     update_action = types.ShippingMethodUpdate(version=version,
                                                actions=actions)
     return self._client._post(
         endpoint=f"shipping-methods/key={key}",
         params={},
         data_object=update_action,
         request_schema_cls=schemas.ShippingMethodUpdateSchema,
         response_schema_cls=schemas.ShippingMethodSchema,
         force_update=force_update,
     )
Exemplo n.º 3
0
 def update_by_id(
     self,
     id: str,
     version: int,
     actions: List[types.ShippingMethodUpdateAction],
     expand: OptionalListStr = None,
     *,
     force_update: bool = False,
 ) -> types.ShippingMethod:
     query_params = {}
     if expand:
         query_params["expand"] = expand
     update_action = types.ShippingMethodUpdate(version=version,
                                                actions=actions)
     return self._client._post(
         endpoint=f"shipping-methods/{id}",
         params=query_params,
         data_object=update_action,
         request_schema_cls=schemas.ShippingMethodUpdateSchema,
         response_schema_cls=schemas.ShippingMethodSchema,
         force_update=force_update,
     )
Exemplo n.º 4
0
 def post_load(self, data, **kwargs):
     return types.ShippingMethodUpdate(**data)