/** * @param CustomCollection $collection * * @return CustomCollection */ public function export(CustomCollection $collection) { if (null !== $collection->getId()) { $request = new PutJson($this->updateUrl($collection), new CustomCollectionWrapper($collection), $this->serializer); } else { $request = new PostJson($this->exportUrl(), new CustomCollectionWrapper($collection), $this->serializer); } /** @var CustomCollectionWrapper $collectionWrapper */ $collectionWrapper = $request->makeRequest(); return $collectionWrapper->getCustomCollection(); }
/** * @param Product $product * * @return Product */ public function export(Product $product) { if (null !== $product->getId()) { $request = new PutJson($this->updateUrl($product), new ProductWrapper($product), $this->serializer); } else { $request = new PostJson($this->exportUrl(), new ProductWrapper($product), $this->serializer); } /** @var ProductWrapper $productWrapper */ $productWrapper = $request->makeRequest(); return $productWrapper->getProduct(); }
/** * @param Collect $collect * * @return Collect */ public function export(Collect $collect) { if (null !== $collect->getId()) { throw new \ErrorException('You can not update a Collect object'); } else { $request = new PostJson($this->exportUrl(), new CollectWrapper($collect), $this->serializer); } /** @var CollectWrapper $collectWrapper */ $collectWrapper = $request->makeRequest(); return $collectWrapper->getCollect(); }