From da31ee33fe04c5546badd2452d4e20da73f8e349 Mon Sep 17 00:00:00 2001 From: Michiel Rensen Date: Mon, 3 Nov 2014 15:31:35 +0100 Subject: [PATCH] Updating client to v1.4 including some new endpoints --- README.md | 2 +- src/WebshopappApiClient.php | 3075 +++++++++++++++++++++++------------ 2 files changed, 2002 insertions(+), 1075 deletions(-) diff --git a/README.md b/README.md index 852ee4f..70d9bd0 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Include the package in your `composer.json` file ``` json { "require": { - "seoshop/seoshop-php": "~1.3" + "seoshop/seoshop-php": "~1.4" } } ``` diff --git a/src/WebshopappApiClient.php b/src/WebshopappApiClient.php index b91407d..ad738dc 100755 --- a/src/WebshopappApiClient.php +++ b/src/WebshopappApiClient.php @@ -3,14 +3,14 @@ /** * The Webshopapp Api Client Class * - * Generated at: Wed, 24 Jul 2013 16:42:03 +0200 + * Generated at: Fri, 31 Oct 2014 17:58:30 +0100 */ class WebshopappApiClient { /** * The Api Client version (do not change!) */ - const CLIENT_VERSION = '1.3.1'; + const CLIENT_VERSION = '1.4.0'; /** * The Api Hosts (do not change!) */ @@ -59,6 +59,10 @@ class WebshopappApiClient * @var WebshopappApiResourceAccountRequests */ public $accountRequests; + /** + * @var WebshopappApiResourceAttributes + */ + public $attributes; /** * @var WebshopappApiResourceBlogs */ @@ -107,6 +111,30 @@ class WebshopappApiClient * @var WebshopappApiResourceCategoriesProducts */ public $categoriesProducts; + /** + * @var WebshopappApiResourceCheckouts + */ + public $checkouts; + /** + * @var WebshopappApiResourceCheckoutsOrder + */ + public $checkoutsOrder; + /** + * @var WebshopappApiResourceCheckoutsPayment_methods + */ + public $checkoutsPayment_methods; + /** + * @var WebshopappApiResourceCheckoutsProducts + */ + public $checkoutsProducts; + /** + * @var WebshopappApiResourceCheckoutsShipment_methods + */ + public $checkoutsShipment_methods; + /** + * @var WebshopappApiResourceCheckoutsValidate + */ + public $checkoutsValidate; /** * @var WebshopappApiResourceContacts */ @@ -119,6 +147,10 @@ class WebshopappApiClient * @var WebshopappApiResourceCustomers */ public $customers; + /** + * @var WebshopappApiResourceCustomersLogin + */ + public $customersLogin; /** * @var WebshopappApiResourceCustomersMetafields */ @@ -175,6 +207,10 @@ class WebshopappApiClient * @var WebshopappApiResourceOrders */ public $orders; + /** + * @var WebshopappApiResourceOrdersCredit + */ + public $ordersCredit; /** * @var WebshopappApiResourceOrdersMetafields */ @@ -195,6 +231,10 @@ class WebshopappApiClient * @var WebshopappApiResourceProducts */ public $products; + /** + * @var WebshopappApiResourceProductsAttributes + */ + public $productsAttributes; /** * @var WebshopappApiResourceProductsImages */ @@ -211,6 +251,10 @@ class WebshopappApiClient * @var WebshopappApiResourceQuotes */ public $quotes; + /** + * @var WebshopappApiResourceQuotesConvert + */ + public $quotesConvert; /** * @var WebshopappApiResourceQuotesPaymentmethods */ @@ -227,6 +271,10 @@ class WebshopappApiClient * @var WebshopappApiResourceRedirects */ public $redirects; + /** + * @var WebshopappApiResourceReturns + */ + public $returns; /** * @var WebshopappApiResourceReviews */ @@ -279,6 +327,10 @@ class WebshopappApiClient * @var WebshopappApiResourceShopScripts */ public $shopScripts; + /** + * @var WebshopappApiResourceShopTracking + */ + public $shopTracking; /** * @var WebshopappApiResourceShopWebsite */ @@ -319,6 +371,14 @@ class WebshopappApiClient * @var WebshopappApiResourceTime */ public $time; + /** + * @var WebshopappApiResourceTypes + */ + public $types; + /** + * @var WebshopappApiResourceTypesAttributes + */ + public $typesAttributes; /** * @var WebshopappApiResourceVariants */ @@ -327,6 +387,10 @@ class WebshopappApiClient * @var WebshopappApiResourceVariantsMetafields */ public $variantsMetafields; + /** + * @var WebshopappApiResourceVariantsBulk + */ + public $variantsBulk; /** * @var WebshopappApiResourceVariantsMovements */ @@ -344,19 +408,19 @@ class WebshopappApiClient * * @throws WebshopappApiException */ - public function __construct($apiServer, $apiKey, $apiSecret, $apiLanguage) + public function __construct( $apiServer, $apiKey, $apiSecret, $apiLanguage ) { - if (!function_exists('curl_init')) { - throw new WebshopAppApiException('WebshopappApiClient needs the CURL PHP extension.'); + if ( ! function_exists( 'curl_init' )) { + throw new WebshopAppApiException( 'WebshopappApiClient needs the CURL PHP extension.' ); } - if (!function_exists('json_decode')) { - throw new WebshopAppApiException('WebshopappApiClient needs the JSON PHP extension.'); + if ( ! function_exists( 'json_decode' )) { + throw new WebshopAppApiException( 'WebshopappApiClient needs the JSON PHP extension.' ); } - $this->setApiServer($apiServer); - $this->setApiKey($apiKey); - $this->setApiSecret($apiSecret); - $this->setApiLanguage($apiLanguage); + $this->setApiServer( $apiServer ); + $this->setApiKey( $apiKey ); + $this->setApiSecret( $apiSecret ); + $this->setApiLanguage( $apiLanguage ); $this->registerResources(); } @@ -372,7 +436,7 @@ public function getApiLanguage() /** * @param $apiServer */ - public function setApiServer($apiServer) + public function setApiServer( $apiServer ) { $this->apiServer = $apiServer; } @@ -380,7 +444,7 @@ public function setApiServer($apiServer) /** * @param $apiKey */ - public function setApiKey($apiKey) + public function setApiKey( $apiKey ) { $this->apiKey = $apiKey; } @@ -396,7 +460,7 @@ public function getApiKey() /** * @param $apiSecret */ - public function setApiSecret($apiSecret) + public function setApiSecret( $apiSecret ) { $this->apiSecret = $apiSecret; } @@ -412,7 +476,7 @@ public function getApiSecret() /** * @param $apiLanguage */ - public function setApiLanguage($apiLanguage) + public function setApiLanguage( $apiLanguage ) { $this->apiLanguage = $apiLanguage; } @@ -438,90 +502,106 @@ public function getApiCallsMade() */ private function checkLoginCredentials() { - if (strlen($this->getApiKey()) !== 32 || strlen($this->getApiSecret()) !== 32) { - throw new WebshopappApiException('Invalid login credentials.'); + if (strlen( $this->getApiKey() ) !== 32 || strlen( $this->getApiSecret() ) !== 32) { + throw new WebshopappApiException( 'Invalid login credentials.' ); } - if (strlen($this->getApiLanguage()) !== 2) { - throw new WebshopappApiException('Invalid API language.'); + if (strlen( $this->getApiLanguage() ) !== 2) { + throw new WebshopappApiException( 'Invalid API language.' ); } } private function registerResources() { - $this->account = new WebshopappApiResourceAccount($this); - $this->accountMetafields = new WebshopappApiResourceAccountMetafields($this); - $this->accountPermissions = new WebshopappApiResourceAccountPermissions($this); - $this->accountRatelimit = new WebshopappApiResourceAccountRatelimit($this); - $this->accountRequests = new WebshopappApiResourceAccountRequests($this); - $this->blogs = new WebshopappApiResourceBlogs($this); - $this->blogsArticles = new WebshopappApiResourceBlogsArticles($this); - $this->blogsArticlesImage = new WebshopappApiResourceBlogsArticlesImage($this); - $this->blogsArticlesTags = new WebshopappApiResourceBlogsArticlesTags($this); - $this->blogsComments = new WebshopappApiResourceBlogsComments($this); - $this->blogsTags = new WebshopappApiResourceBlogsTags($this); - $this->brands = new WebshopappApiResourceBrands($this); - $this->brandsImage = new WebshopappApiResourceBrandsImage($this); - $this->catalog = new WebshopappApiResourceCatalog($this); - $this->categories = new WebshopappApiResourceCategories($this); - $this->categoriesImage = new WebshopappApiResourceCategoriesImage($this); - $this->categoriesProducts = new WebshopappApiResourceCategoriesProducts($this); - $this->contacts = new WebshopappApiResourceContacts($this); - $this->countries = new WebshopappApiResourceCountries($this); - $this->customers = new WebshopappApiResourceCustomers($this); - $this->customersMetafields = new WebshopappApiResourceCustomersMetafields($this); - $this->dashboard = new WebshopappApiResourceDashboard($this); - $this->deliverydates = new WebshopappApiResourceDeliverydates($this); - $this->discounts = new WebshopappApiResourceDiscounts($this); - $this->events = new WebshopappApiResourceEvents($this); - $this->files = new WebshopappApiResourceFiles($this); - $this->groups = new WebshopappApiResourceGroups($this); - $this->groupsCustomers = new WebshopappApiResourceGroupsCustomers($this); - $this->invoices = new WebshopappApiResourceInvoices($this); - $this->invoicesItems = new WebshopappApiResourceInvoicesItems($this); - $this->invoicesMetafields = new WebshopappApiResourceInvoicesMetafields($this); - $this->languages = new WebshopappApiResourceLanguages($this); - $this->metafields = new WebshopappApiResourceMetafields($this); - $this->orders = new WebshopappApiResourceOrders($this); - $this->ordersMetafields = new WebshopappApiResourceOrdersMetafields($this); - $this->ordersProducts = new WebshopappApiResourceOrdersProducts($this); - $this->ordersEvents = new WebshopappApiResourceOrdersEvents($this); - $this->paymentmethods = new WebshopappApiResourcePaymentmethods($this); - $this->products = new WebshopappApiResourceProducts($this); - $this->productsImages = new WebshopappApiResourceProductsImages($this); - $this->productsMetafields = new WebshopappApiResourceProductsMetafields($this); - $this->productsRelations = new WebshopappApiResourceProductsRelations($this); - $this->quotes = new WebshopappApiResourceQuotes($this); - $this->quotesPaymentmethods = new WebshopappApiResourceQuotesPaymentmethods($this); - $this->quotesProducts = new WebshopappApiResourceQuotesProducts($this); - $this->quotesShippingmethods = new WebshopappApiResourceQuotesShippingmethods($this); - $this->redirects = new WebshopappApiResourceRedirects($this); - $this->reviews = new WebshopappApiResourceReviews($this); - $this->shipments = new WebshopappApiResourceShipments($this); - $this->shipmentsMetafields = new WebshopappApiResourceShipmentsMetafields($this); - $this->shipmentsProducts = new WebshopappApiResourceShipmentsProducts($this); - $this->shippingmethods = new WebshopappApiResourceShippingmethods($this); - $this->shippingmethodsCountries = new WebshopappApiResourceShippingmethodsCountries($this); - $this->shippingmethodsValues = new WebshopappApiResourceShippingmethodsValues($this); - $this->shop = new WebshopappApiResourceShop($this); - $this->shopCompany = new WebshopappApiResourceShopCompany($this); - $this->shopJavascript = new WebshopappApiResourceShopJavascript($this); - $this->shopLimits = new WebshopappApiResourceShopLimits($this); - $this->shopMetafields = new WebshopappApiResourceShopMetafields($this); - $this->shopScripts = new WebshopappApiResourceShopScripts($this); - $this->shopWebsite = new WebshopappApiResourceShopWebsite($this); - $this->subscriptions = new WebshopappApiResourceSubscriptions($this); - $this->suppliers = new WebshopappApiResourceSuppliers($this); - $this->tags = new WebshopappApiResourceTags($this); - $this->tagsProducts = new WebshopappApiResourceTagsProducts($this); - $this->taxes = new WebshopappApiResourceTaxes($this); - $this->textpages = new WebshopappApiResourceTextpages($this); - $this->tickets = new WebshopappApiResourceTickets($this); - $this->ticketsMessages = new WebshopappApiResourceTicketsMessages($this); - $this->time = new WebshopappApiResourceTime($this); - $this->variants = new WebshopappApiResourceVariants($this); - $this->variantsMetafields = new WebshopappApiResourceVariantsMetafields($this); - $this->variantsMovements = new WebshopappApiResourceVariantsMovements($this); - $this->webhooks = new WebshopappApiResourceWebhooks($this); + $this->account = new WebshopappApiResourceAccount( $this ); + $this->accountMetafields = new WebshopappApiResourceAccountMetafields( $this ); + $this->accountPermissions = new WebshopappApiResourceAccountPermissions( $this ); + $this->accountRatelimit = new WebshopappApiResourceAccountRatelimit( $this ); + $this->accountRequests = new WebshopappApiResourceAccountRequests( $this ); + $this->attributes = new WebshopappApiResourceAttributes( $this ); + $this->blogs = new WebshopappApiResourceBlogs( $this ); + $this->blogsArticles = new WebshopappApiResourceBlogsArticles( $this ); + $this->blogsArticlesImage = new WebshopappApiResourceBlogsArticlesImage( $this ); + $this->blogsArticlesTags = new WebshopappApiResourceBlogsArticlesTags( $this ); + $this->blogsComments = new WebshopappApiResourceBlogsComments( $this ); + $this->blogsTags = new WebshopappApiResourceBlogsTags( $this ); + $this->brands = new WebshopappApiResourceBrands( $this ); + $this->brandsImage = new WebshopappApiResourceBrandsImage( $this ); + $this->catalog = new WebshopappApiResourceCatalog( $this ); + $this->categories = new WebshopappApiResourceCategories( $this ); + $this->categoriesImage = new WebshopappApiResourceCategoriesImage( $this ); + $this->categoriesProducts = new WebshopappApiResourceCategoriesProducts( $this ); + $this->checkouts = new WebshopappApiResourceCheckouts( $this ); + $this->checkoutsOrder = new WebshopappApiResourceCheckoutsOrder( $this ); + $this->checkoutsPayment_methods = new WebshopappApiResourceCheckoutsPayment_methods( $this ); + $this->checkoutsProducts = new WebshopappApiResourceCheckoutsProducts( $this ); + $this->checkoutsShipment_methods = new WebshopappApiResourceCheckoutsShipment_methods( $this ); + $this->checkoutsValidate = new WebshopappApiResourceCheckoutsValidate( $this ); + $this->contacts = new WebshopappApiResourceContacts( $this ); + $this->countries = new WebshopappApiResourceCountries( $this ); + $this->customers = new WebshopappApiResourceCustomers( $this ); + $this->customersLogin = new WebshopappApiResourceCustomersLogin( $this ); + $this->customersMetafields = new WebshopappApiResourceCustomersMetafields( $this ); + $this->dashboard = new WebshopappApiResourceDashboard( $this ); + $this->deliverydates = new WebshopappApiResourceDeliverydates( $this ); + $this->discounts = new WebshopappApiResourceDiscounts( $this ); + $this->events = new WebshopappApiResourceEvents( $this ); + $this->files = new WebshopappApiResourceFiles( $this ); + $this->groups = new WebshopappApiResourceGroups( $this ); + $this->groupsCustomers = new WebshopappApiResourceGroupsCustomers( $this ); + $this->invoices = new WebshopappApiResourceInvoices( $this ); + $this->invoicesItems = new WebshopappApiResourceInvoicesItems( $this ); + $this->invoicesMetafields = new WebshopappApiResourceInvoicesMetafields( $this ); + $this->languages = new WebshopappApiResourceLanguages( $this ); + $this->metafields = new WebshopappApiResourceMetafields( $this ); + $this->orders = new WebshopappApiResourceOrders( $this ); + $this->ordersCredit = new WebshopappApiResourceOrdersCredit( $this ); + $this->ordersMetafields = new WebshopappApiResourceOrdersMetafields( $this ); + $this->ordersProducts = new WebshopappApiResourceOrdersProducts( $this ); + $this->ordersEvents = new WebshopappApiResourceOrdersEvents( $this ); + $this->paymentmethods = new WebshopappApiResourcePaymentmethods( $this ); + $this->products = new WebshopappApiResourceProducts( $this ); + $this->productsAttributes = new WebshopappApiResourceProductsAttributes( $this ); + $this->productsImages = new WebshopappApiResourceProductsImages( $this ); + $this->productsMetafields = new WebshopappApiResourceProductsMetafields( $this ); + $this->productsRelations = new WebshopappApiResourceProductsRelations( $this ); + $this->quotes = new WebshopappApiResourceQuotes( $this ); + $this->quotesConvert = new WebshopappApiResourceQuotesConvert( $this ); + $this->quotesPaymentmethods = new WebshopappApiResourceQuotesPaymentmethods( $this ); + $this->quotesProducts = new WebshopappApiResourceQuotesProducts( $this ); + $this->quotesShippingmethods = new WebshopappApiResourceQuotesShippingmethods( $this ); + $this->redirects = new WebshopappApiResourceRedirects( $this ); + $this->returns = new WebshopappApiResourceReturns( $this ); + $this->reviews = new WebshopappApiResourceReviews( $this ); + $this->shipments = new WebshopappApiResourceShipments( $this ); + $this->shipmentsMetafields = new WebshopappApiResourceShipmentsMetafields( $this ); + $this->shipmentsProducts = new WebshopappApiResourceShipmentsProducts( $this ); + $this->shippingmethods = new WebshopappApiResourceShippingmethods( $this ); + $this->shippingmethodsCountries = new WebshopappApiResourceShippingmethodsCountries( $this ); + $this->shippingmethodsValues = new WebshopappApiResourceShippingmethodsValues( $this ); + $this->shop = new WebshopappApiResourceShop( $this ); + $this->shopCompany = new WebshopappApiResourceShopCompany( $this ); + $this->shopJavascript = new WebshopappApiResourceShopJavascript( $this ); + $this->shopLimits = new WebshopappApiResourceShopLimits( $this ); + $this->shopMetafields = new WebshopappApiResourceShopMetafields( $this ); + $this->shopScripts = new WebshopappApiResourceShopScripts( $this ); + $this->shopTracking = new WebshopappApiResourceShopTracking( $this ); + $this->shopWebsite = new WebshopappApiResourceShopWebsite( $this ); + $this->subscriptions = new WebshopappApiResourceSubscriptions( $this ); + $this->suppliers = new WebshopappApiResourceSuppliers( $this ); + $this->tags = new WebshopappApiResourceTags( $this ); + $this->tagsProducts = new WebshopappApiResourceTagsProducts( $this ); + $this->taxes = new WebshopappApiResourceTaxes( $this ); + $this->textpages = new WebshopappApiResourceTextpages( $this ); + $this->tickets = new WebshopappApiResourceTickets( $this ); + $this->ticketsMessages = new WebshopappApiResourceTicketsMessages( $this ); + $this->time = new WebshopappApiResourceTime( $this ); + $this->types = new WebshopappApiResourceTypes( $this ); + $this->typesAttributes = new WebshopappApiResourceTypesAttributes( $this ); + $this->variants = new WebshopappApiResourceVariants( $this ); + $this->variantsMetafields = new WebshopappApiResourceVariantsMetafields( $this ); + $this->variantsBulk = new WebshopappApiResourceVariantsBulk( $this ); + $this->variantsMovements = new WebshopappApiResourceVariantsMovements( $this ); + $this->webhooks = new WebshopappApiResourceWebhooks( $this ); } /** @@ -530,7 +610,7 @@ private function registerResources() * * @return string */ - private function getUrl($resourceUrl, $params = null) + private function getUrl( $resourceUrl, $params = null ) { if ($this->apiServer == 'live') { $apiHost = self::SERVER_HOST_LIVE; @@ -540,29 +620,29 @@ private function getUrl($resourceUrl, $params = null) $apiHost = self::SERVER_HOST_TEST; } - $apiHostParts = parse_url($apiHost); - $resourceUrlParts = parse_url($resourceUrl); + $apiHostParts = parse_url( $apiHost ); + $resourceUrlParts = parse_url( $resourceUrl ); $apiUrl = $apiHostParts['scheme'] . '://' . $this->getApiKey() . ':' . $this->getApiSecret() . '@' . $apiHostParts['host'] . '/'; - if (isset($apiHostParts['path']) && strlen(trim($apiHostParts['path'], '/'))) { - $apiUrl .= trim($apiHostParts['path'], '/') . '/'; + if (isset( $apiHostParts['path'] ) && strlen( trim( $apiHostParts['path'], '/' ) )) { + $apiUrl .= trim( $apiHostParts['path'], '/' ) . '/'; } $apiUrl .= $this->getApiLanguage() . '/' . $resourceUrlParts['path'] . '.json'; - if (isset($resourceUrlParts['query'])) { + if (isset( $resourceUrlParts['query'] )) { $apiUrl .= '?' . $resourceUrlParts['query']; - } elseif ($params && is_array($params)) { + } elseif ($params && is_array( $params )) { $queryParameters = array(); foreach ($params as $key => $value) { - if (!is_array($value)) { - $queryParameters[] = $key . '=' . urlencode($value); + if ( ! is_array( $value )) { + $queryParameters[] = $key . '=' . urlencode( $value ); } } - $queryParameters = implode('&', $queryParameters); + $queryParameters = implode( '&', $queryParameters ); - if (!empty($queryParameters)) { + if ( ! empty( $queryParameters )) { $apiUrl .= '?' . $queryParameters; } } @@ -580,29 +660,29 @@ private function getUrl($resourceUrl, $params = null) * @return mixed The decoded response object * @throws WebshopappApiException */ - private function sendRequest($url, $method, $payload = null) + private function sendRequest( $url, $method, $payload = null ) { $this->checkLoginCredentials(); if ($method == 'post' || $method == 'put') { - if (!$payload || !is_array($payload)) { - throw new WebshopAppApiException(100, 'Invalid payload'); + if ( ! $payload || ! is_array( $payload )) { + throw new WebshopAppApiException( 100, 'Invalid payload' ); } $curlOptions = array( - CURLOPT_URL => $this->getUrl($url), - CURLOPT_CUSTOMREQUEST => strtoupper($method), - CURLOPT_HTTPHEADER => array('Content-Type: application/json'), - CURLOPT_POSTFIELDS => json_encode($payload), + CURLOPT_URL => $this->getUrl( $url ), + CURLOPT_CUSTOMREQUEST => strtoupper( $method ), + CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), + CURLOPT_POSTFIELDS => json_encode( $payload ), ); } elseif ($method == 'delete') { $curlOptions = array( - CURLOPT_URL => $this->getUrl($url), + CURLOPT_URL => $this->getUrl( $url ), CURLOPT_CUSTOMREQUEST => 'DELETE', ); } else { $curlOptions = array( - CURLOPT_URL => $this->getUrl($url, $payload), + CURLOPT_URL => $this->getUrl( $url, $payload ), ); } @@ -615,27 +695,29 @@ private function sendRequest($url, $method, $payload = null) $curlHandle = curl_init(); - curl_setopt_array($curlHandle, $curlOptions); + curl_setopt_array( $curlHandle, $curlOptions ); - $responseBody = curl_exec($curlHandle); + $responseBody = curl_exec( $curlHandle ); - if (curl_errno($curlHandle)) { - $this->handleCurlError($curlHandle); + if (curl_errno( $curlHandle )) { + $this->handleCurlError( $curlHandle ); } - $responseBody = json_decode($responseBody, true); - $responseCode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE); + $responseBody = json_decode( $responseBody, true ); + $responseCode = curl_getinfo( $curlHandle, CURLINFO_HTTP_CODE ); - curl_close($curlHandle); + curl_close( $curlHandle ); - $this->apiCallsMade++; + $this->apiCallsMade ++; - if ($responseCode < 200 || $responseCode > 299 || ($responseBody && array_key_exists('error', $responseBody))) { - $this->handleResponseError($responseCode, $responseBody); + if ($responseCode < 200 || $responseCode > 299 || ( $responseBody && array_key_exists( 'error', + $responseBody ) ) + ) { + $this->handleResponseError( $responseCode, $responseBody ); } if ($responseBody) { - $responseBody = array_shift($responseBody); + $responseBody = array_shift( $responseBody ); } return $responseBody; @@ -647,15 +729,15 @@ private function sendRequest($url, $method, $payload = null) * * @throws WebshopappApiException */ - private function handleResponseError($responseCode, $responseBody) + private function handleResponseError( $responseCode, $responseBody ) { $errorMessage = 'Unknown error: ' . $responseCode; - if ($responseBody && array_key_exists('error', $responseBody)) { + if ($responseBody && array_key_exists( 'error', $responseBody )) { $errorMessage = $responseBody['error']['message']; } - throw new WebshopappApiException($errorMessage, $responseCode); + throw new WebshopappApiException( $errorMessage, $responseCode ); } /** @@ -663,11 +745,11 @@ private function handleResponseError($responseCode, $responseBody) * * @throws WebshopappApiException */ - private function handleCurlError($curlHandle) + private function handleCurlError( $curlHandle ) { - $errorMessage = 'Curl error: ' . curl_error($curlHandle); + $errorMessage = 'Curl error: ' . curl_error( $curlHandle ); - throw new WebshopappApiException($errorMessage, curl_errno($curlHandle)); + throw new WebshopappApiException( $errorMessage, curl_errno( $curlHandle ) ); } /** @@ -677,9 +759,9 @@ private function handleCurlError($curlHandle) * @return array * @throws WebshopappApiException */ - public function create($url, $payload) + public function create( $url, $payload ) { - return $this->sendRequest($url, 'post', $payload); + return $this->sendRequest( $url, 'post', $payload ); } /** @@ -689,9 +771,9 @@ public function create($url, $payload) * @return array * @throws WebshopappApiException */ - public function read($url, $params = array()) + public function read( $url, $params = array() ) { - return $this->sendRequest($url, 'get', $params); + return $this->sendRequest( $url, 'get', $params ); } /** @@ -701,9 +783,9 @@ public function read($url, $params = array()) * @return array * @throws WebshopappApiException */ - public function update($url, $payload) + public function update( $url, $payload ) { - return $this->sendRequest($url, 'put', $payload); + return $this->sendRequest( $url, 'put', $payload ); } /** @@ -712,9 +794,9 @@ public function update($url, $payload) * @return array * @throws WebshopappApiException */ - public function delete($url) + public function delete( $url ) { - return $this->sendRequest($url, 'delete'); + return $this->sendRequest( $url, 'delete' ); } } @@ -730,7 +812,7 @@ class WebshopappApiResourceAccount */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -741,7 +823,7 @@ public function __construct(WebshopappApiClient $client) */ public function get() { - return $this->client->read('account'); + return $this->client->read( 'account' ); } } @@ -752,7 +834,7 @@ class WebshopappApiResourceAccountMetafields */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -764,12 +846,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($metafieldId = null, $params = array()) + public function get( $metafieldId = null, $params = array() ) { - if (!$metafieldId) { - return $this->client->read('account/metafields', $params); + if ( ! $metafieldId) { + return $this->client->read( 'account/metafields', $params ); } else { - return $this->client->read('account/metafields/' . $metafieldId, $params); + return $this->client->read( 'account/metafields/' . $metafieldId, $params ); } } @@ -779,9 +861,9 @@ public function get($metafieldId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('account/metafields/count', $params); + return $this->client->read( 'account/metafields/count', $params ); } } @@ -792,7 +874,7 @@ class WebshopappApiResourceAccountPermissions */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -803,7 +885,7 @@ public function __construct(WebshopappApiClient $client) */ public function get() { - return $this->client->read('account/permissions'); + return $this->client->read( 'account/permissions' ); } } @@ -814,7 +896,7 @@ class WebshopappApiResourceAccountRatelimit */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -825,7 +907,7 @@ public function __construct(WebshopappApiClient $client) */ public function get() { - return $this->client->read('account/ratelimit'); + return $this->client->read( 'account/ratelimit' ); } } @@ -836,7 +918,7 @@ class WebshopappApiResourceAccountRequests */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -848,12 +930,65 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($requestId = null, $params = array()) + public function get( $requestId = null, $params = array() ) + { + if ( ! $requestId) { + return $this->client->read( 'account/requests', $params ); + } else { + return $this->client->read( 'account/requests/' . $requestId, $params ); + } + } + + /** + * @param array $params + * + * @return int + * @throws WebshopappApiException + */ + public function count( $params = array() ) + { + return $this->client->read( 'account/requests/count', $params ); + } +} + +class WebshopappApiResourceAttributes +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function create( $fields ) + { + $fields = array( 'attribute' => $fields ); + + return $this->client->create( 'attributes', $fields ); + } + + /** + * @param int $attributeId + * @param array $params + * + * @return array + * @throws WebshopappApiException + */ + public function get( $attributeId = null, $params = array() ) { - if (!$requestId) { - return $this->client->read('account/requests', $params); + if ( ! $attributeId) { + return $this->client->read( 'attributes', $params ); } else { - return $this->client->read('account/requests/' . $requestId, $params); + return $this->client->read( 'attributes/' . $attributeId, $params ); } } @@ -863,9 +998,34 @@ public function get($requestId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) + { + return $this->client->read( 'attributes/count', $params ); + } + + /** + * @param int $attributeId + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function update( $attributeId, $fields ) + { + $fields = array( 'attribute' => $fields ); + + return $this->client->update( 'attributes/' . $attributeId, $fields ); + } + + /** + * @param int $attributeId + * + * @return array + * @throws WebshopappApiException + */ + public function delete( $attributeId ) { - return $this->client->read('account/requests/count', $params); + return $this->client->delete( 'attributes/' . $attributeId ); } } @@ -876,7 +1036,7 @@ class WebshopappApiResourceBlogs */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -887,11 +1047,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('blog' => $fields); + $fields = array( 'blog' => $fields ); - return $this->client->create('blogs', $fields); + return $this->client->create( 'blogs', $fields ); } /** @@ -901,12 +1061,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($blogId = null, $params = array()) + public function get( $blogId = null, $params = array() ) { - if (!$blogId) { - return $this->client->read('blogs', $params); + if ( ! $blogId) { + return $this->client->read( 'blogs', $params ); } else { - return $this->client->read('blogs/' . $blogId, $params); + return $this->client->read( 'blogs/' . $blogId, $params ); } } @@ -916,9 +1076,9 @@ public function get($blogId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('blogs/count', $params); + return $this->client->read( 'blogs/count', $params ); } /** @@ -928,11 +1088,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($blogId, $fields) + public function update( $blogId, $fields ) { - $fields = array('blog' => $fields); + $fields = array( 'blog' => $fields ); - return $this->client->update('blogs/' . $blogId, $fields); + return $this->client->update( 'blogs/' . $blogId, $fields ); } /** @@ -941,9 +1101,9 @@ public function update($blogId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($blogId) + public function delete( $blogId ) { - return $this->client->delete('blogs/' . $blogId); + return $this->client->delete( 'blogs/' . $blogId ); } } @@ -954,7 +1114,7 @@ class WebshopappApiResourceBlogsArticles */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -965,11 +1125,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('blogArticle' => $fields); + $fields = array( 'blogArticle' => $fields ); - return $this->client->create('blogs/articles', $fields); + return $this->client->create( 'blogs/articles', $fields ); } /** @@ -979,12 +1139,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($articleId = null, $params = array()) + public function get( $articleId = null, $params = array() ) { - if (!$articleId) { - return $this->client->read('blogs/articles', $params); + if ( ! $articleId) { + return $this->client->read( 'blogs/articles', $params ); } else { - return $this->client->read('blogs/articles/' . $articleId, $params); + return $this->client->read( 'blogs/articles/' . $articleId, $params ); } } @@ -994,9 +1154,9 @@ public function get($articleId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('blogs/articles/count', $params); + return $this->client->read( 'blogs/articles/count', $params ); } /** @@ -1006,11 +1166,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($articleId, $fields) + public function update( $articleId, $fields ) { - $fields = array('blogArticle' => $fields); + $fields = array( 'blogArticle' => $fields ); - return $this->client->update('blogs/articles/' . $articleId, $fields); + return $this->client->update( 'blogs/articles/' . $articleId, $fields ); } /** @@ -1019,9 +1179,9 @@ public function update($articleId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($articleId) + public function delete( $articleId ) { - return $this->client->delete('blogs/articles/' . $articleId); + return $this->client->delete( 'blogs/articles/' . $articleId ); } } @@ -1032,7 +1192,7 @@ class WebshopappApiResourceBlogsArticlesImage */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -1044,11 +1204,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($articleId, $fields) + public function create( $articleId, $fields ) { - $fields = array('blogArticleImage' => $fields); + $fields = array( 'blogArticleImage' => $fields ); - return $this->client->create('blogs/articles/' . $articleId . '/image', $fields); + return $this->client->create( 'blogs/articles/' . $articleId . '/image', $fields ); } /** @@ -1057,9 +1217,9 @@ public function create($articleId, $fields) * @return array * @throws WebshopappApiException */ - public function get($articleId) + public function get( $articleId ) { - return $this->client->read('blogs/articles/' . $articleId . '/image'); + return $this->client->read( 'blogs/articles/' . $articleId . '/image' ); } /** @@ -1068,9 +1228,9 @@ public function get($articleId) * @return array * @throws WebshopappApiException */ - public function delete($articleId) + public function delete( $articleId ) { - return $this->client->delete('blogs/articles/' . $articleId . '/image'); + return $this->client->delete( 'blogs/articles/' . $articleId . '/image' ); } } @@ -1081,7 +1241,7 @@ class WebshopappApiResourceBlogsArticlesTags */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -1092,11 +1252,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('blogArticleTag' => $fields); + $fields = array( 'blogArticleTag' => $fields ); - return $this->client->create('blogs/articles/tags', $fields); + return $this->client->create( 'blogs/articles/tags', $fields ); } /** @@ -1106,12 +1266,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($relationId = null, $params = array()) + public function get( $relationId = null, $params = array() ) { - if (!$relationId) { - return $this->client->read('blogs/articles/tags', $params); + if ( ! $relationId) { + return $this->client->read( 'blogs/articles/tags', $params ); } else { - return $this->client->read('blogs/articles/tags/' . $relationId, $params); + return $this->client->read( 'blogs/articles/tags/' . $relationId, $params ); } } @@ -1121,9 +1281,9 @@ public function get($relationId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('blogs/articles/tags/count', $params); + return $this->client->read( 'blogs/articles/tags/count', $params ); } /** @@ -1132,9 +1292,9 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function delete($relationId) + public function delete( $relationId ) { - return $this->client->delete('blogs/articles/tags/' . $relationId); + return $this->client->delete( 'blogs/articles/tags/' . $relationId ); } } @@ -1145,7 +1305,7 @@ class WebshopappApiResourceBlogsComments */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -1156,11 +1316,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('blogComment' => $fields); + $fields = array( 'blogComment' => $fields ); - return $this->client->create('blogs/comments', $fields); + return $this->client->create( 'blogs/comments', $fields ); } /** @@ -1170,12 +1330,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($commentId = null, $params = array()) + public function get( $commentId = null, $params = array() ) { - if (!$commentId) { - return $this->client->read('blogs/comments', $params); + if ( ! $commentId) { + return $this->client->read( 'blogs/comments', $params ); } else { - return $this->client->read('blogs/comments/' . $commentId, $params); + return $this->client->read( 'blogs/comments/' . $commentId, $params ); } } @@ -1185,9 +1345,9 @@ public function get($commentId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('blogs/comments/count', $params); + return $this->client->read( 'blogs/comments/count', $params ); } /** @@ -1197,11 +1357,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($commentId, $fields) + public function update( $commentId, $fields ) { - $fields = array('blogComment' => $fields); + $fields = array( 'blogComment' => $fields ); - return $this->client->update('blogs/comments/' . $commentId, $fields); + return $this->client->update( 'blogs/comments/' . $commentId, $fields ); } /** @@ -1210,9 +1370,9 @@ public function update($commentId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($commentId) + public function delete( $commentId ) { - return $this->client->delete('blogs/comments/' . $commentId); + return $this->client->delete( 'blogs/comments/' . $commentId ); } } @@ -1223,7 +1383,7 @@ class WebshopappApiResourceBlogsTags */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -1234,11 +1394,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('blogTag' => $fields); + $fields = array( 'blogTag' => $fields ); - return $this->client->create('blogs/tags', $fields); + return $this->client->create( 'blogs/tags', $fields ); } /** @@ -1248,12 +1408,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($tagId = null, $params = array()) + public function get( $tagId = null, $params = array() ) { - if (!$tagId) { - return $this->client->read('blogs/tags', $params); + if ( ! $tagId) { + return $this->client->read( 'blogs/tags', $params ); } else { - return $this->client->read('blogs/tags/' . $tagId, $params); + return $this->client->read( 'blogs/tags/' . $tagId, $params ); } } @@ -1263,9 +1423,9 @@ public function get($tagId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('blogs/tags/count', $params); + return $this->client->read( 'blogs/tags/count', $params ); } /** @@ -1275,11 +1435,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($tagId, $fields) + public function update( $tagId, $fields ) { - $fields = array('blogTag' => $fields); + $fields = array( 'blogTag' => $fields ); - return $this->client->update('blogs/tags/' . $tagId, $fields); + return $this->client->update( 'blogs/tags/' . $tagId, $fields ); } /** @@ -1288,9 +1448,9 @@ public function update($tagId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($tagId) + public function delete( $tagId ) { - return $this->client->delete('blogs/tags/' . $tagId); + return $this->client->delete( 'blogs/tags/' . $tagId ); } } @@ -1301,7 +1461,7 @@ class WebshopappApiResourceBrands */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -1312,11 +1472,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('brand' => $fields); + $fields = array( 'brand' => $fields ); - return $this->client->create('brands', $fields); + return $this->client->create( 'brands', $fields ); } /** @@ -1326,12 +1486,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($brandId = null, $params = array()) + public function get( $brandId = null, $params = array() ) { - if (!$brandId) { - return $this->client->read('brands', $params); + if ( ! $brandId) { + return $this->client->read( 'brands', $params ); } else { - return $this->client->read('brands/' . $brandId, $params); + return $this->client->read( 'brands/' . $brandId, $params ); } } @@ -1341,9 +1501,9 @@ public function get($brandId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('brands/count', $params); + return $this->client->read( 'brands/count', $params ); } /** @@ -1353,11 +1513,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($brandId, $fields) + public function update( $brandId, $fields ) { - $fields = array('brand' => $fields); + $fields = array( 'brand' => $fields ); - return $this->client->update('brands/' . $brandId, $fields); + return $this->client->update( 'brands/' . $brandId, $fields ); } /** @@ -1366,9 +1526,9 @@ public function update($brandId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($brandId) + public function delete( $brandId ) { - return $this->client->delete('brands/' . $brandId); + return $this->client->delete( 'brands/' . $brandId ); } } @@ -1379,7 +1539,7 @@ class WebshopappApiResourceBrandsImage */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -1391,11 +1551,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($brandId, $fields) + public function create( $brandId, $fields ) { - $fields = array('brandImage' => $fields); + $fields = array( 'brandImage' => $fields ); - return $this->client->create('brands/' . $brandId . '/image', $fields); + return $this->client->create( 'brands/' . $brandId . '/image', $fields ); } /** @@ -1404,9 +1564,9 @@ public function create($brandId, $fields) * @return array * @throws WebshopappApiException */ - public function get($brandId) + public function get( $brandId ) { - return $this->client->read('brands/' . $brandId . '/image'); + return $this->client->read( 'brands/' . $brandId . '/image' ); } /** @@ -1415,9 +1575,9 @@ public function get($brandId) * @return array * @throws WebshopappApiException */ - public function delete($brandId) + public function delete( $brandId ) { - return $this->client->delete('brands/' . $brandId . '/image'); + return $this->client->delete( 'brands/' . $brandId . '/image' ); } } @@ -1428,18 +1588,25 @@ class WebshopappApiResourceCatalog */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** + * @param int $productId + * @param array $params + * * @return array * @throws WebshopappApiException */ - public function get($params = array()) + public function get( $productId = null, $params = array() ) { - return $this->client->read('catalog', $params); + if ( ! $productId) { + return $this->client->read( 'catalog', $params ); + } else { + return $this->client->read( 'catalog/' . $productId, $params ); + } } /** @@ -1448,9 +1615,9 @@ public function get($params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('catalog/count', $params); + return $this->client->read( 'catalog/count', $params ); } } @@ -1461,7 +1628,7 @@ class WebshopappApiResourceCategories */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -1472,11 +1639,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('category' => $fields); + $fields = array( 'category' => $fields ); - return $this->client->create('categories', $fields); + return $this->client->create( 'categories', $fields ); } /** @@ -1486,12 +1653,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($categoryId = null, $params = array()) + public function get( $categoryId = null, $params = array() ) { - if (!$categoryId) { - return $this->client->read('categories', $params); + if ( ! $categoryId) { + return $this->client->read( 'categories', $params ); } else { - return $this->client->read('categories/' . $categoryId, $params); + return $this->client->read( 'categories/' . $categoryId, $params ); } } @@ -1501,9 +1668,9 @@ public function get($categoryId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('categories/count', $params); + return $this->client->read( 'categories/count', $params ); } /** @@ -1513,11 +1680,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($categoryId, $fields) + public function update( $categoryId, $fields ) { - $fields = array('category' => $fields); + $fields = array( 'category' => $fields ); - return $this->client->update('categories/' . $categoryId, $fields); + return $this->client->update( 'categories/' . $categoryId, $fields ); } /** @@ -1526,9 +1693,9 @@ public function update($categoryId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($categoryId) + public function delete( $categoryId ) { - return $this->client->delete('categories/' . $categoryId); + return $this->client->delete( 'categories/' . $categoryId ); } } @@ -1539,7 +1706,7 @@ class WebshopappApiResourceCategoriesImage */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -1551,11 +1718,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($categoryId, $fields) + public function create( $categoryId, $fields ) { - $fields = array('categoryImage' => $fields); + $fields = array( 'categoryImage' => $fields ); - return $this->client->create('categories/' . $categoryId . '/image', $fields); + return $this->client->create( 'categories/' . $categoryId . '/image', $fields ); } /** @@ -1564,9 +1731,9 @@ public function create($categoryId, $fields) * @return array * @throws WebshopappApiException */ - public function get($categoryId) + public function get( $categoryId ) { - return $this->client->read('categories/' . $categoryId . '/image'); + return $this->client->read( 'categories/' . $categoryId . '/image' ); } /** @@ -1575,9 +1742,9 @@ public function get($categoryId) * @return array * @throws WebshopappApiException */ - public function delete($categoryId) + public function delete( $categoryId ) { - return $this->client->delete('categories/' . $categoryId . '/image'); + return $this->client->delete( 'categories/' . $categoryId . '/image' ); } } @@ -1588,7 +1755,7 @@ class WebshopappApiResourceCategoriesProducts */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -1599,11 +1766,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('categoriesProduct' => $fields); + $fields = array( 'categoriesProduct' => $fields ); - return $this->client->create('categories/products', $fields); + return $this->client->create( 'categories/products', $fields ); } /** @@ -1613,12 +1780,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($relationId = null, $params = array()) + public function get( $relationId = null, $params = array() ) { - if (!$relationId) { - return $this->client->read('categories/products', $params); + if ( ! $relationId) { + return $this->client->read( 'categories/products', $params ); } else { - return $this->client->read('categories/products/' . $relationId, $params); + return $this->client->read( 'categories/products/' . $relationId, $params ); } } @@ -1628,9 +1795,9 @@ public function get($relationId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('categories/products/count', $params); + return $this->client->read( 'categories/products/count', $params ); } /** @@ -1639,378 +1806,297 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function delete($relationId) + public function delete( $relationId ) { - return $this->client->delete('categories/products/' . $relationId); + return $this->client->delete( 'categories/products/' . $relationId ); } } -class WebshopappApiResourceContacts +class WebshopappApiResourceCheckouts { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** - * @param int $contactId - * @param array $params + * @param array $fields * * @return array * @throws WebshopappApiException */ - public function get($contactId = null, $params = array()) + public function create( $fields ) { - if (!$contactId) { - return $this->client->read('contacts', $params); - } else { - return $this->client->read('contacts/' . $contactId, $params); - } + $fields = array( 'checkout' => $fields ); + + return $this->client->create( 'checkouts', $fields ); } /** + * @param int $checkoutId * @param array $params * - * @return int + * @return array * @throws WebshopappApiException */ - public function count($params = array()) + public function get( $checkoutId = null, $params = array() ) { - return $this->client->read('contacts/count', $params); + if ( ! $checkoutId) { + return $this->client->read( 'checkouts', $params ); + } else { + return $this->client->read( 'checkouts/' . $checkoutId, $params ); + } } -} -class WebshopappApiResourceCountries -{ /** - * @var WebshopappApiClient + * @param array $params + * + * @return int + * @throws WebshopappApiException */ - private $client; - - public function __construct(WebshopappApiClient $client) + public function count( $params = array() ) { - $this->client = $client; + return $this->client->read( 'checkouts/count', $params ); } /** - * @param int $countryId - * @param array $params + * @param int $checkoutId + * @param array $fields * * @return array * @throws WebshopappApiException */ - public function get($countryId = null, $params = array()) + public function update( $checkoutId, $fields ) { - if (!$countryId) { - return $this->client->read('countries', $params); - } else { - return $this->client->read('countries/' . $countryId, $params); - } + $fields = array( 'checkout' => $fields ); + + return $this->client->update( 'checkouts/' . $checkoutId, $fields ); } /** - * @param array $params + * @param int $checkoutId * - * @return int + * @return array * @throws WebshopappApiException */ - public function count($params = array()) + public function delete( $checkoutId ) { - return $this->client->read('countries/count', $params); + return $this->client->delete( 'checkouts/' . $checkoutId ); } } -class WebshopappApiResourceCustomers +class WebshopappApiResourceCheckoutsOrder { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** + * @param int $checkoutId * @param array $fields * * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $checkoutId, $fields ) { - $fields = array('customer' => $fields); + $fields = array( 'checkout' => $fields ); - return $this->client->create('customers', $fields); - } - - /** - * @param int $customerId - * @param array $params - * - * @return array - * @throws WebshopappApiException - */ - public function get($customerId = null, $params = array()) - { - if (!$customerId) { - return $this->client->read('customers', $params); - } else { - return $this->client->read('customers/' . $customerId, $params); - } + return $this->client->create( 'checkouts/' . $checkoutId . '/order', $fields ); } +} +class WebshopappApiResourceCheckoutsPayment_methods +{ /** - * @param array $params - * - * @return int - * @throws WebshopappApiException + * @var WebshopappApiClient */ - public function count($params = array()) - { - return $this->client->read('customers/count', $params); - } + private $client; - /** - * @param int $customerId - * @param array $fields - * - * @return array - * @throws WebshopappApiException - */ - public function update($customerId, $fields) + public function __construct( WebshopappApiClient $client ) { - $fields = array('customer' => $fields); - - return $this->client->update('customers/' . $customerId, $fields); + $this->client = $client; } /** - * @param int $customerId + * @param int $checkoutId * * @return array * @throws WebshopappApiException */ - public function delete($customerId) + public function get( $checkoutId ) { - return $this->client->delete('customers/' . $customerId); + return $this->client->read( 'checkouts/' . $checkoutId . '/payment_methods' ); } } -class WebshopappApiResourceCustomersMetafields +class WebshopappApiResourceCheckoutsProducts { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** - * @param int $customerId + * @param int $checkoutId * @param array $fields * * @return array * @throws WebshopappApiException */ - public function create($customerId, $fields) + public function create( $checkoutId, $fields ) { - $fields = array('customerMetafield' => $fields); + $fields = array( 'checkoutProduct' => $fields ); - return $this->client->create('customers/' . $customerId . '/metafields', $fields); + return $this->client->create( 'checkouts/' . $checkoutId . '/products', $fields ); } /** - * @param int $customerId - * @param int $metafieldId + * @param int $checkoutId + * @param int $productId * @param array $params * * @return array * @throws WebshopappApiException */ - public function get($customerId, $metafieldId = null, $params = array()) + public function get( $checkoutId, $productId = null, $params = array() ) { - if (!$metafieldId) { - return $this->client->read('customers/' . $customerId . '/metafields', $params); + if ( ! $productId) { + return $this->client->read( 'checkouts/' . $checkoutId . '/products', $params ); } else { - return $this->client->read('customers/' . $customerId . '/metafields/' . $metafieldId, $params); + return $this->client->read( 'checkouts/' . $checkoutId . '/products/' . $productId, $params ); } } /** - * @param int $customerId + * @param int $checkoutId * @param array $params * * @return int * @throws WebshopappApiException */ - public function count($customerId, $params = array()) + public function count( $checkoutId, $params = array() ) { - return $this->client->read('customers/' . $customerId . '/metafields/count', $params); + return $this->client->read( 'checkouts/' . $checkoutId . '/products/count', $params ); } /** - * @param int $customerId - * @param int $metafieldId + * @param int $checkoutId + * @param int $productId * @param array $fields * * @return array * @throws WebshopappApiException */ - public function update($customerId, $metafieldId, $fields) + public function update( $checkoutId, $productId, $fields ) { - $fields = array('customerMetafield' => $fields); + $fields = array( 'checkoutProduct' => $fields ); - return $this->client->update('customers/' . $customerId . '/metafields/' . $metafieldId, $fields); + return $this->client->update( 'checkouts/' . $checkoutId . '/products/' . $productId, $fields ); } /** - * @param int $customerId - * @param int $metafieldId + * @param int $checkoutId + * @param int $productId * * @return array * @throws WebshopappApiException */ - public function delete($customerId, $metafieldId) + public function delete( $checkoutId, $productId ) { - return $this->client->delete('customers/' . $customerId . '/metafields/' . $metafieldId); + return $this->client->delete( 'checkouts/' . $checkoutId . '/products/' . $productId ); } } -class WebshopappApiResourceDashboard +class WebshopappApiResourceCheckoutsShipment_methods { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** + * @param int $checkoutId + * * @return array * @throws WebshopappApiException */ - public function get($params = array()) + public function get( $checkoutId ) { - return $this->client->read('dashboard', $params); + return $this->client->read( 'checkouts/' . $checkoutId . '/shipment_methods' ); } } -class WebshopappApiResourceDeliverydates +class WebshopappApiResourceCheckoutsValidate { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** - * @param array $fields - * - * @return array - * @throws WebshopappApiException - */ - public function create($fields) - { - $fields = array('deliverydate' => $fields); - - return $this->client->create('deliverydates', $fields); - } - - /** - * @param int $deliverydateId - * @param array $params - * - * @return array - * @throws WebshopappApiException - */ - public function get($deliverydateId = null, $params = array()) - { - if (!$deliverydateId) { - return $this->client->read('deliverydates', $params); - } else { - return $this->client->read('deliverydates/' . $deliverydateId, $params); - } - } - - /** - * @param array $params - * - * @return int - * @throws WebshopappApiException - */ - public function count($params = array()) - { - return $this->client->read('deliverydates/count', $params); - } - - /** - * @param int $deliverydateId - * @param array $fields - * - * @return array - * @throws WebshopappApiException - */ - public function update($deliverydateId, $fields) - { - $fields = array('deliverydate' => $fields); - - return $this->client->update('deliverydates/' . $deliverydateId, $fields); - } - - /** - * @param int $deliverydateId + * @param int $checkoutId * * @return array * @throws WebshopappApiException */ - public function delete($deliverydateId) + public function get( $checkoutId ) { - return $this->client->delete('deliverydates/' . $deliverydateId); + return $this->client->read( 'checkouts/' . $checkoutId . '/validate' ); } } -class WebshopappApiResourceDiscounts +class WebshopappApiResourceContacts { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** - * @param int $discountId + * @param int $contactId * @param array $params * * @return array * @throws WebshopappApiException */ - public function get($discountId = null, $params = array()) + public function get( $contactId = null, $params = array() ) { - if (!$discountId) { - return $this->client->read('discounts', $params); + if ( ! $contactId) { + return $this->client->read( 'contacts', $params ); } else { - return $this->client->read('discounts/' . $discountId, $params); + return $this->client->read( 'contacts/' . $contactId, $params ); } } @@ -2020,37 +2106,37 @@ public function get($discountId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('discounts/count', $params); + return $this->client->read( 'contacts/count', $params ); } } -class WebshopappApiResourceEvents +class WebshopappApiResourceCountries { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** - * @param int $eventId + * @param int $countryId * @param array $params * * @return array * @throws WebshopappApiException */ - public function get($eventId = null, $params = array()) + public function get( $countryId = null, $params = array() ) { - if (!$eventId) { - return $this->client->read('events', $params); + if ( ! $countryId) { + return $this->client->read( 'countries', $params ); } else { - return $this->client->read('events/' . $eventId, $params); + return $this->client->read( 'countries/' . $countryId, $params ); } } @@ -2060,31 +2146,20 @@ public function get($eventId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) - { - return $this->client->read('events/count', $params); - } - - /** - * @param int $eventId - * - * @return array - * @throws WebshopappApiException - */ - public function delete($eventId) + public function count( $params = array() ) { - return $this->client->delete('events/' . $eventId); + return $this->client->read( 'countries/count', $params ); } } -class WebshopappApiResourceFiles +class WebshopappApiResourceCustomers { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2095,26 +2170,26 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('file' => $fields); + $fields = array( 'customer' => $fields ); - return $this->client->create('files', $fields); + return $this->client->create( 'customers', $fields ); } /** - * @param int $fileId + * @param int $customerId * @param array $params * * @return array * @throws WebshopappApiException */ - public function get($fileId = null, $params = array()) + public function get( $customerId = null, $params = array() ) { - if (!$fileId) { - return $this->client->read('files', $params); + if ( ! $customerId) { + return $this->client->read( 'customers', $params ); } else { - return $this->client->read('files/' . $fileId, $params); + return $this->client->read( 'customers/' . $customerId, $params ); } } @@ -2124,75 +2199,492 @@ public function get($fileId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('files/count', $params); + return $this->client->read( 'customers/count', $params ); } /** - * @param int $fileId + * @param int $customerId * @param array $fields * * @return array * @throws WebshopappApiException */ - public function update($fileId, $fields) + public function update( $customerId, $fields ) { - $fields = array('file' => $fields); + $fields = array( 'customer' => $fields ); - return $this->client->update('files/' . $fileId, $fields); + return $this->client->update( 'customers/' . $customerId, $fields ); } /** - * @param int $fileId + * @param int $customerId * * @return array * @throws WebshopappApiException */ - public function delete($fileId) + public function delete( $customerId ) { - return $this->client->delete('files/' . $fileId); + return $this->client->delete( 'customers/' . $customerId ); } } -class WebshopappApiResourceGroups +class WebshopappApiResourceCustomersLogin { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** + * @param int $customerId * @param array $fields * * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $customerId, $fields ) { - $fields = array('group' => $fields); + $fields = array( 'customerLogin' => $fields ); - return $this->client->create('groups', $fields); + return $this->client->create( 'customers/' . $customerId . '/login', $fields ); } +} +class WebshopappApiResourceCustomersMetafields +{ /** - * @param int $groupId - * @param array $params - * - * @return array - * @throws WebshopappApiException + * @var WebshopappApiClient */ - public function get($groupId = null, $params = array()) + private $client; + + public function __construct( WebshopappApiClient $client ) { - if (!$groupId) { - return $this->client->read('groups', $params); + $this->client = $client; + } + + /** + * @param int $customerId + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function create( $customerId, $fields ) + { + $fields = array( 'customerMetafield' => $fields ); + + return $this->client->create( 'customers/' . $customerId . '/metafields', $fields ); + } + + /** + * @param int $customerId + * @param int $metafieldId + * @param array $params + * + * @return array + * @throws WebshopappApiException + */ + public function get( $customerId, $metafieldId = null, $params = array() ) + { + if ( ! $metafieldId) { + return $this->client->read( 'customers/' . $customerId . '/metafields', $params ); + } else { + return $this->client->read( 'customers/' . $customerId . '/metafields/' . $metafieldId, $params ); + } + } + + /** + * @param int $customerId + * @param array $params + * + * @return int + * @throws WebshopappApiException + */ + public function count( $customerId, $params = array() ) + { + return $this->client->read( 'customers/' . $customerId . '/metafields/count', $params ); + } + + /** + * @param int $customerId + * @param int $metafieldId + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function update( $customerId, $metafieldId, $fields ) + { + $fields = array( 'customerMetafield' => $fields ); + + return $this->client->update( 'customers/' . $customerId . '/metafields/' . $metafieldId, $fields ); + } + + /** + * @param int $customerId + * @param int $metafieldId + * + * @return array + * @throws WebshopappApiException + */ + public function delete( $customerId, $metafieldId ) + { + return $this->client->delete( 'customers/' . $customerId . '/metafields/' . $metafieldId ); + } +} + +class WebshopappApiResourceDashboard +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @return array + * @throws WebshopappApiException + */ + public function get( $params = array() ) + { + return $this->client->read( 'dashboard', $params ); + } +} + +class WebshopappApiResourceDeliverydates +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function create( $fields ) + { + $fields = array( 'deliverydate' => $fields ); + + return $this->client->create( 'deliverydates', $fields ); + } + + /** + * @param int $deliverydateId + * @param array $params + * + * @return array + * @throws WebshopappApiException + */ + public function get( $deliverydateId = null, $params = array() ) + { + if ( ! $deliverydateId) { + return $this->client->read( 'deliverydates', $params ); + } else { + return $this->client->read( 'deliverydates/' . $deliverydateId, $params ); + } + } + + /** + * @param array $params + * + * @return int + * @throws WebshopappApiException + */ + public function count( $params = array() ) + { + return $this->client->read( 'deliverydates/count', $params ); + } + + /** + * @param int $deliverydateId + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function update( $deliverydateId, $fields ) + { + $fields = array( 'deliverydate' => $fields ); + + return $this->client->update( 'deliverydates/' . $deliverydateId, $fields ); + } + + /** + * @param int $deliverydateId + * + * @return array + * @throws WebshopappApiException + */ + public function delete( $deliverydateId ) + { + return $this->client->delete( 'deliverydates/' . $deliverydateId ); + } +} + +class WebshopappApiResourceDiscounts +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function create( $fields ) + { + $fields = array( 'discount' => $fields ); + + return $this->client->create( 'discounts', $fields ); + } + + /** + * @param int $discountId + * @param array $params + * + * @return array + * @throws WebshopappApiException + */ + public function get( $discountId = null, $params = array() ) + { + if ( ! $discountId) { + return $this->client->read( 'discounts', $params ); + } else { + return $this->client->read( 'discounts/' . $discountId, $params ); + } + } + + /** + * @param array $params + * + * @return int + * @throws WebshopappApiException + */ + public function count( $params = array() ) + { + return $this->client->read( 'discounts/count', $params ); + } + + /** + * @param int $discountId + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function update( $discountId, $fields ) + { + $fields = array( 'discount' => $fields ); + + return $this->client->update( 'discounts/' . $discountId, $fields ); + } + + /** + * @param int $discountId + * + * @return array + * @throws WebshopappApiException + */ + public function delete( $discountId ) + { + return $this->client->delete( 'discounts/' . $discountId ); + } +} + +class WebshopappApiResourceEvents +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @param int $eventId + * @param array $params + * + * @return array + * @throws WebshopappApiException + */ + public function get( $eventId = null, $params = array() ) + { + if ( ! $eventId) { + return $this->client->read( 'events', $params ); + } else { + return $this->client->read( 'events/' . $eventId, $params ); + } + } + + /** + * @param array $params + * + * @return int + * @throws WebshopappApiException + */ + public function count( $params = array() ) + { + return $this->client->read( 'events/count', $params ); + } + + /** + * @param int $eventId + * + * @return array + * @throws WebshopappApiException + */ + public function delete( $eventId ) + { + return $this->client->delete( 'events/' . $eventId ); + } +} + +class WebshopappApiResourceFiles +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function create( $fields ) + { + $fields = array( 'file' => $fields ); + + return $this->client->create( 'files', $fields ); + } + + /** + * @param int $fileId + * @param array $params + * + * @return array + * @throws WebshopappApiException + */ + public function get( $fileId = null, $params = array() ) + { + if ( ! $fileId) { + return $this->client->read( 'files', $params ); + } else { + return $this->client->read( 'files/' . $fileId, $params ); + } + } + + /** + * @param array $params + * + * @return int + * @throws WebshopappApiException + */ + public function count( $params = array() ) + { + return $this->client->read( 'files/count', $params ); + } + + /** + * @param int $fileId + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function update( $fileId, $fields ) + { + $fields = array( 'file' => $fields ); + + return $this->client->update( 'files/' . $fileId, $fields ); + } + + /** + * @param int $fileId + * + * @return array + * @throws WebshopappApiException + */ + public function delete( $fileId ) + { + return $this->client->delete( 'files/' . $fileId ); + } +} + +class WebshopappApiResourceGroups +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function create( $fields ) + { + $fields = array( 'group' => $fields ); + + return $this->client->create( 'groups', $fields ); + } + + /** + * @param int $groupId + * @param array $params + * + * @return array + * @throws WebshopappApiException + */ + public function get( $groupId = null, $params = array() ) + { + if ( ! $groupId) { + return $this->client->read( 'groups', $params ); } else { - return $this->client->read('groups/' . $groupId, $params); + return $this->client->read( 'groups/' . $groupId, $params ); } } @@ -2202,9 +2694,9 @@ public function get($groupId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('groups/count', $params); + return $this->client->read( 'groups/count', $params ); } /** @@ -2214,11 +2706,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($groupId, $fields) + public function update( $groupId, $fields ) { - $fields = array('group' => $fields); + $fields = array( 'group' => $fields ); - return $this->client->update('groups/' . $groupId, $fields); + return $this->client->update( 'groups/' . $groupId, $fields ); } /** @@ -2227,9 +2719,9 @@ public function update($groupId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($groupId) + public function delete( $groupId ) { - return $this->client->delete('groups/' . $groupId); + return $this->client->delete( 'groups/' . $groupId ); } } @@ -2240,7 +2732,7 @@ class WebshopappApiResourceGroupsCustomers */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2251,11 +2743,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('groupsCustomer' => $fields); + $fields = array( 'groupsCustomer' => $fields ); - return $this->client->create('groups/customers', $fields); + return $this->client->create( 'groups/customers', $fields ); } /** @@ -2265,12 +2757,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($relationId = null, $params = array()) + public function get( $relationId = null, $params = array() ) { - if (!$relationId) { - return $this->client->read('groups/customers', $params); + if ( ! $relationId) { + return $this->client->read( 'groups/customers', $params ); } else { - return $this->client->read('groups/customers/' . $relationId, $params); + return $this->client->read( 'groups/customers/' . $relationId, $params ); } } @@ -2280,9 +2772,9 @@ public function get($relationId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('groups/customers/count', $params); + return $this->client->read( 'groups/customers/count', $params ); } /** @@ -2291,9 +2783,9 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function delete($relationId) + public function delete( $relationId ) { - return $this->client->delete('groups/customers/' . $relationId); + return $this->client->delete( 'groups/customers/' . $relationId ); } } @@ -2304,7 +2796,7 @@ class WebshopappApiResourceInvoices */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2316,12 +2808,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($invoiceId = null, $params = array()) + public function get( $invoiceId = null, $params = array() ) { - if (!$invoiceId) { - return $this->client->read('invoices', $params); + if ( ! $invoiceId) { + return $this->client->read( 'invoices', $params ); } else { - return $this->client->read('invoices/' . $invoiceId, $params); + return $this->client->read( 'invoices/' . $invoiceId, $params ); } } @@ -2331,9 +2823,9 @@ public function get($invoiceId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('invoices/count', $params); + return $this->client->read( 'invoices/count', $params ); } /** @@ -2343,11 +2835,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($invoiceId, $fields) + public function update( $invoiceId, $fields ) { - $fields = array('invoice' => $fields); + $fields = array( 'invoice' => $fields ); - return $this->client->update('invoices/' . $invoiceId, $fields); + return $this->client->update( 'invoices/' . $invoiceId, $fields ); } } @@ -2358,7 +2850,7 @@ class WebshopappApiResourceInvoicesItems */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2371,12 +2863,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($invoiceId, $itemId = null, $params = array()) + public function get( $invoiceId, $itemId = null, $params = array() ) { - if (!$itemId) { - return $this->client->read('invoices/' . $invoiceId . '/items', $params); + if ( ! $itemId) { + return $this->client->read( 'invoices/' . $invoiceId . '/items', $params ); } else { - return $this->client->read('invoices/' . $invoiceId . '/items/' . $itemId, $params); + return $this->client->read( 'invoices/' . $invoiceId . '/items/' . $itemId, $params ); } } @@ -2387,9 +2879,9 @@ public function get($invoiceId, $itemId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($invoiceId, $params = array()) + public function count( $invoiceId, $params = array() ) { - return $this->client->read('invoices/' . $invoiceId . '/items/count', $params); + return $this->client->read( 'invoices/' . $invoiceId . '/items/count', $params ); } } @@ -2400,7 +2892,7 @@ class WebshopappApiResourceInvoicesMetafields */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2412,11 +2904,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($invoiceId, $fields) + public function create( $invoiceId, $fields ) { - $fields = array('invoiceMetafield' => $fields); + $fields = array( 'invoiceMetafield' => $fields ); - return $this->client->create('invoices/' . $invoiceId . '/metafields', $fields); + return $this->client->create( 'invoices/' . $invoiceId . '/metafields', $fields ); } /** @@ -2427,12 +2919,12 @@ public function create($invoiceId, $fields) * @return array * @throws WebshopappApiException */ - public function get($invoiceId, $metafieldId = null, $params = array()) + public function get( $invoiceId, $metafieldId = null, $params = array() ) { - if (!$metafieldId) { - return $this->client->read('invoices/' . $invoiceId . '/metafields', $params); + if ( ! $metafieldId) { + return $this->client->read( 'invoices/' . $invoiceId . '/metafields', $params ); } else { - return $this->client->read('invoices/' . $invoiceId . '/metafields/' . $metafieldId, $params); + return $this->client->read( 'invoices/' . $invoiceId . '/metafields/' . $metafieldId, $params ); } } @@ -2443,9 +2935,9 @@ public function get($invoiceId, $metafieldId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($invoiceId, $params = array()) + public function count( $invoiceId, $params = array() ) { - return $this->client->read('invoices/' . $invoiceId . '/metafields/count', $params); + return $this->client->read( 'invoices/' . $invoiceId . '/metafields/count', $params ); } /** @@ -2456,11 +2948,11 @@ public function count($invoiceId, $params = array()) * @return array * @throws WebshopappApiException */ - public function update($invoiceId, $metafieldId, $fields) + public function update( $invoiceId, $metafieldId, $fields ) { - $fields = array('invoiceMetafield' => $fields); + $fields = array( 'invoiceMetafield' => $fields ); - return $this->client->update('invoices/' . $invoiceId . '/metafields/' . $metafieldId, $fields); + return $this->client->update( 'invoices/' . $invoiceId . '/metafields/' . $metafieldId, $fields ); } /** @@ -2470,9 +2962,9 @@ public function update($invoiceId, $metafieldId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($invoiceId, $metafieldId) + public function delete( $invoiceId, $metafieldId ) { - return $this->client->delete('invoices/' . $invoiceId . '/metafields/' . $metafieldId); + return $this->client->delete( 'invoices/' . $invoiceId . '/metafields/' . $metafieldId ); } } @@ -2483,7 +2975,7 @@ class WebshopappApiResourceLanguages */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2495,12 +2987,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($languageId = null, $params = array()) + public function get( $languageId = null, $params = array() ) { - if (!$languageId) { - return $this->client->read('languages', $params); + if ( ! $languageId) { + return $this->client->read( 'languages', $params ); } else { - return $this->client->read('languages/' . $languageId, $params); + return $this->client->read( 'languages/' . $languageId, $params ); } } @@ -2510,9 +3002,9 @@ public function get($languageId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('languages/count', $params); + return $this->client->read( 'languages/count', $params ); } } @@ -2523,7 +3015,7 @@ class WebshopappApiResourceMetafields */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2534,11 +3026,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('metafield' => $fields); + $fields = array( 'metafield' => $fields ); - return $this->client->create('metafields', $fields); + return $this->client->create( 'metafields', $fields ); } /** @@ -2548,12 +3040,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($metafieldId = null, $params = array()) + public function get( $metafieldId = null, $params = array() ) { - if (!$metafieldId) { - return $this->client->read('metafields', $params); + if ( ! $metafieldId) { + return $this->client->read( 'metafields', $params ); } else { - return $this->client->read('metafields/' . $metafieldId, $params); + return $this->client->read( 'metafields/' . $metafieldId, $params ); } } @@ -2563,9 +3055,9 @@ public function get($metafieldId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('metafields/count', $params); + return $this->client->read( 'metafields/count', $params ); } /** @@ -2575,11 +3067,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($metafieldId, $fields) + public function update( $metafieldId, $fields ) { - $fields = array('metafield' => $fields); + $fields = array( 'metafield' => $fields ); - return $this->client->update('metafields/' . $metafieldId, $fields); + return $this->client->update( 'metafields/' . $metafieldId, $fields ); } /** @@ -2588,9 +3080,9 @@ public function update($metafieldId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($metafieldId) + public function delete( $metafieldId ) { - return $this->client->delete('metafields/' . $metafieldId); + return $this->client->delete( 'metafields/' . $metafieldId ); } } @@ -2601,7 +3093,7 @@ class WebshopappApiResourceOrders */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2613,12 +3105,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($orderId = null, $params = array()) + public function get( $orderId = null, $params = array() ) { - if (!$orderId) { - return $this->client->read('orders', $params); + if ( ! $orderId) { + return $this->client->read( 'orders', $params ); } else { - return $this->client->read('orders/' . $orderId, $params); + return $this->client->read( 'orders/' . $orderId, $params ); } } @@ -2628,9 +3120,9 @@ public function get($orderId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('orders/count', $params); + return $this->client->read( 'orders/count', $params ); } /** @@ -2640,11 +3132,49 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($orderId, $fields) + public function update( $orderId, $fields ) { - $fields = array('order' => $fields); + $fields = array( 'order' => $fields ); - return $this->client->update('orders/' . $orderId, $fields); + return $this->client->update( 'orders/' . $orderId, $fields ); + } +} + +class WebshopappApiResourceOrdersCredit +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @param int $orderId + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function create( $orderId, $fields ) + { + $fields = array( 'creditInvoice' => $fields ); + + return $this->client->create( 'orders/' . $orderId . '/credit', $fields ); + } + + /** + * @param array $params + * + * @return int + * @throws WebshopappApiException + */ + public function count( $params = array() ) + { + return $this->client->read( 'orders/' . $orderId . '/credit/count', $params ); } } @@ -2655,7 +3185,7 @@ class WebshopappApiResourceOrdersMetafields */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2667,11 +3197,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($orderId, $fields) + public function create( $orderId, $fields ) { - $fields = array('orderMetafield' => $fields); + $fields = array( 'orderMetafield' => $fields ); - return $this->client->create('orders/' . $orderId . '/metafields', $fields); + return $this->client->create( 'orders/' . $orderId . '/metafields', $fields ); } /** @@ -2682,12 +3212,12 @@ public function create($orderId, $fields) * @return array * @throws WebshopappApiException */ - public function get($orderId, $metafieldId = null, $params = array()) + public function get( $orderId, $metafieldId = null, $params = array() ) { - if (!$metafieldId) { - return $this->client->read('orders/' . $orderId . '/metafields', $params); + if ( ! $metafieldId) { + return $this->client->read( 'orders/' . $orderId . '/metafields', $params ); } else { - return $this->client->read('orders/' . $orderId . '/metafields/' . $metafieldId, $params); + return $this->client->read( 'orders/' . $orderId . '/metafields/' . $metafieldId, $params ); } } @@ -2698,9 +3228,9 @@ public function get($orderId, $metafieldId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($orderId, $params = array()) + public function count( $orderId, $params = array() ) { - return $this->client->read('orders/' . $orderId . '/metafields/count', $params); + return $this->client->read( 'orders/' . $orderId . '/metafields/count', $params ); } /** @@ -2711,11 +3241,11 @@ public function count($orderId, $params = array()) * @return array * @throws WebshopappApiException */ - public function update($orderId, $metafieldId, $fields) + public function update( $orderId, $metafieldId, $fields ) { - $fields = array('orderMetafield' => $fields); + $fields = array( 'orderMetafield' => $fields ); - return $this->client->update('orders/' . $orderId . '/metafields/' . $metafieldId, $fields); + return $this->client->update( 'orders/' . $orderId . '/metafields/' . $metafieldId, $fields ); } /** @@ -2725,9 +3255,9 @@ public function update($orderId, $metafieldId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($orderId, $metafieldId) + public function delete( $orderId, $metafieldId ) { - return $this->client->delete('orders/' . $orderId . '/metafields/' . $metafieldId); + return $this->client->delete( 'orders/' . $orderId . '/metafields/' . $metafieldId ); } } @@ -2738,7 +3268,7 @@ class WebshopappApiResourceOrdersProducts */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2751,12 +3281,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($orderId, $productId = null, $params = array()) + public function get( $orderId, $productId = null, $params = array() ) { - if (!$productId) { - return $this->client->read('orders/' . $orderId . '/products', $params); + if ( ! $productId) { + return $this->client->read( 'orders/' . $orderId . '/products', $params ); } else { - return $this->client->read('orders/' . $orderId . '/products/' . $productId, $params); + return $this->client->read( 'orders/' . $orderId . '/products/' . $productId, $params ); } } @@ -2767,9 +3297,9 @@ public function get($orderId, $productId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($orderId, $params = array()) + public function count( $orderId, $params = array() ) { - return $this->client->read('orders/' . $orderId . '/products/count', $params); + return $this->client->read( 'orders/' . $orderId . '/products/count', $params ); } } @@ -2780,7 +3310,7 @@ class WebshopappApiResourceOrdersEvents */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2792,12 +3322,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($eventId = null, $params = array()) + public function get( $eventId = null, $params = array() ) { - if (!$eventId) { - return $this->client->read('orders/events', $params); + if ( ! $eventId) { + return $this->client->read( 'orders/events', $params ); } else { - return $this->client->read('orders/events/' . $eventId, $params); + return $this->client->read( 'orders/events/' . $eventId, $params ); } } @@ -2807,9 +3337,9 @@ public function get($eventId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('orders/events/count', $params); + return $this->client->read( 'orders/events/count', $params ); } } @@ -2820,7 +3350,7 @@ class WebshopappApiResourcePaymentmethods */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2832,12 +3362,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($paymentmethodId = null, $params = array()) + public function get( $paymentmethodId = null, $params = array() ) { - if (!$paymentmethodId) { - return $this->client->read('paymentmethods', $params); + if ( ! $paymentmethodId) { + return $this->client->read( 'paymentmethods', $params ); } else { - return $this->client->read('paymentmethods/' . $paymentmethodId, $params); + return $this->client->read( 'paymentmethods/' . $paymentmethodId, $params ); } } @@ -2847,9 +3377,9 @@ public function get($paymentmethodId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('paymentmethods/count', $params); + return $this->client->read( 'paymentmethods/count', $params ); } } @@ -2860,7 +3390,7 @@ class WebshopappApiResourceProducts */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2871,11 +3401,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('product' => $fields); + $fields = array( 'product' => $fields ); - return $this->client->create('products', $fields); + return $this->client->create( 'products', $fields ); } /** @@ -2885,12 +3415,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($productId = null, $params = array()) + public function get( $productId = null, $params = array() ) { - if (!$productId) { - return $this->client->read('products', $params); + if ( ! $productId) { + return $this->client->read( 'products', $params ); } else { - return $this->client->read('products/' . $productId, $params); + return $this->client->read( 'products/' . $productId, $params ); } } @@ -2900,9 +3430,47 @@ public function get($productId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) + { + return $this->client->read( 'products/count', $params ); + } + + /** + * @param int $productId + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function update( $productId, $fields ) + { + $fields = array( 'product' => $fields ); + + return $this->client->update( 'products/' . $productId, $fields ); + } + + /** + * @param int $productId + * + * @return array + * @throws WebshopappApiException + */ + public function delete( $productId ) + { + return $this->client->delete( 'products/' . $productId ); + } +} + +class WebshopappApiResourceProductsAttributes +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) { - return $this->client->read('products/count', $params); + $this->client = $client; } /** @@ -2912,22 +3480,52 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($productId, $fields) + public function create( $productId, $fields ) { - $fields = array('product' => $fields); + $fields = array( 'productAttribute' => $fields ); - return $this->client->update('products/' . $productId, $fields); + return $this->client->create( 'products/' . $productId . '/attributes', $fields ); + } + + /** + * @param int $productId + * @param int $attributeId + * @param array $params + * + * @return array + * @throws WebshopappApiException + */ + public function get( $productId, $attributeId = null, $params = array() ) + { + if ( ! $attributeId) { + return $this->client->read( 'products/' . $productId . '/attributes', $params ); + } else { + return $this->client->read( 'products/' . $productId . '/attributes/' . $attributeId, $params ); + } + } + + /** + * @param int $productId + * @param array $params + * + * @return int + * @throws WebshopappApiException + */ + public function count( $productId, $params = array() ) + { + return $this->client->read( 'products/' . $productId . '/attributes/count', $params ); } /** * @param int $productId + * @param int $attributeId * * @return array * @throws WebshopappApiException */ - public function delete($productId) + public function delete( $productId, $attributeId ) { - return $this->client->delete('products/' . $productId); + return $this->client->delete( 'products/' . $productId . '/attributes/' . $attributeId ); } } @@ -2938,7 +3536,7 @@ class WebshopappApiResourceProductsImages */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -2950,11 +3548,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($productId, $fields) + public function create( $productId, $fields ) { - $fields = array('productImage' => $fields); + $fields = array( 'productImage' => $fields ); - return $this->client->create('products/' . $productId . '/images', $fields); + return $this->client->create( 'products/' . $productId . '/images', $fields ); } /** @@ -2965,12 +3563,12 @@ public function create($productId, $fields) * @return array * @throws WebshopappApiException */ - public function get($productId, $imageId = null, $params = array()) + public function get( $productId, $imageId = null, $params = array() ) { - if (!$imageId) { - return $this->client->read('products/' . $productId . '/images', $params); + if ( ! $imageId) { + return $this->client->read( 'products/' . $productId . '/images', $params ); } else { - return $this->client->read('products/' . $productId . '/images/' . $imageId, $params); + return $this->client->read( 'products/' . $productId . '/images/' . $imageId, $params ); } } @@ -2981,9 +3579,9 @@ public function get($productId, $imageId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($productId, $params = array()) + public function count( $productId, $params = array() ) { - return $this->client->read('products/' . $productId . '/images/count', $params); + return $this->client->read( 'products/' . $productId . '/images/count', $params ); } /** @@ -2994,11 +3592,11 @@ public function count($productId, $params = array()) * @return array * @throws WebshopappApiException */ - public function update($productId, $imageId, $fields) + public function update( $productId, $imageId, $fields ) { - $fields = array('productImage' => $fields); + $fields = array( 'productImage' => $fields ); - return $this->client->update('products/' . $productId . '/images/' . $imageId, $fields); + return $this->client->update( 'products/' . $productId . '/images/' . $imageId, $fields ); } /** @@ -3008,9 +3606,9 @@ public function update($productId, $imageId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($productId, $imageId) + public function delete( $productId, $imageId ) { - return $this->client->delete('products/' . $productId . '/images/' . $imageId); + return $this->client->delete( 'products/' . $productId . '/images/' . $imageId ); } } @@ -3021,7 +3619,7 @@ class WebshopappApiResourceProductsMetafields */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3033,11 +3631,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($productId, $fields) + public function create( $productId, $fields ) { - $fields = array('productMetafield' => $fields); + $fields = array( 'productMetafield' => $fields ); - return $this->client->create('products/' . $productId . '/metafields', $fields); + return $this->client->create( 'products/' . $productId . '/metafields', $fields ); } /** @@ -3048,12 +3646,12 @@ public function create($productId, $fields) * @return array * @throws WebshopappApiException */ - public function get($productId, $metafieldId = null, $params = array()) + public function get( $productId, $metafieldId = null, $params = array() ) { - if (!$metafieldId) { - return $this->client->read('products/' . $productId . '/metafields', $params); + if ( ! $metafieldId) { + return $this->client->read( 'products/' . $productId . '/metafields', $params ); } else { - return $this->client->read('products/' . $productId . '/metafields/' . $metafieldId, $params); + return $this->client->read( 'products/' . $productId . '/metafields/' . $metafieldId, $params ); } } @@ -3064,9 +3662,9 @@ public function get($productId, $metafieldId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($productId, $params = array()) + public function count( $productId, $params = array() ) { - return $this->client->read('products/' . $productId . '/metafields/count', $params); + return $this->client->read( 'products/' . $productId . '/metafields/count', $params ); } /** @@ -3077,11 +3675,11 @@ public function count($productId, $params = array()) * @return array * @throws WebshopappApiException */ - public function update($productId, $metafieldId, $fields) + public function update( $productId, $metafieldId, $fields ) { - $fields = array('productMetafield' => $fields); + $fields = array( 'productMetafield' => $fields ); - return $this->client->update('products/' . $productId . '/metafields/' . $metafieldId, $fields); + return $this->client->update( 'products/' . $productId . '/metafields/' . $metafieldId, $fields ); } /** @@ -3091,9 +3689,9 @@ public function update($productId, $metafieldId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($productId, $metafieldId) + public function delete( $productId, $metafieldId ) { - return $this->client->delete('products/' . $productId . '/metafields/' . $metafieldId); + return $this->client->delete( 'products/' . $productId . '/metafields/' . $metafieldId ); } } @@ -3104,7 +3702,7 @@ class WebshopappApiResourceProductsRelations */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3116,11 +3714,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($productId, $fields) + public function create( $productId, $fields ) { - $fields = array('productRelation' => $fields); + $fields = array( 'productRelation' => $fields ); - return $this->client->create('products/' . $productId . '/relations', $fields); + return $this->client->create( 'products/' . $productId . '/relations', $fields ); } /** @@ -3131,12 +3729,12 @@ public function create($productId, $fields) * @return array * @throws WebshopappApiException */ - public function get($productId, $relationId = null, $params = array()) + public function get( $productId, $relationId = null, $params = array() ) { - if (!$relationId) { - return $this->client->read('products/' . $productId . '/relations', $params); + if ( ! $relationId) { + return $this->client->read( 'products/' . $productId . '/relations', $params ); } else { - return $this->client->read('products/' . $productId . '/relations/' . $relationId, $params); + return $this->client->read( 'products/' . $productId . '/relations/' . $relationId, $params ); } } @@ -3147,9 +3745,9 @@ public function get($productId, $relationId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($productId, $params = array()) + public function count( $productId, $params = array() ) { - return $this->client->read('products/' . $productId . '/relations/count', $params); + return $this->client->read( 'products/' . $productId . '/relations/count', $params ); } /** @@ -3160,11 +3758,11 @@ public function count($productId, $params = array()) * @return array * @throws WebshopappApiException */ - public function update($productId, $relationId, $fields) + public function update( $productId, $relationId, $fields ) { - $fields = array('productRelation' => $fields); + $fields = array( 'productRelation' => $fields ); - return $this->client->update('products/' . $productId . '/relations/' . $relationId, $fields); + return $this->client->update( 'products/' . $productId . '/relations/' . $relationId, $fields ); } /** @@ -3174,9 +3772,9 @@ public function update($productId, $relationId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($productId, $relationId) + public function delete( $productId, $relationId ) { - return $this->client->delete('products/' . $productId . '/relations/' . $relationId); + return $this->client->delete( 'products/' . $productId . '/relations/' . $relationId ); } } @@ -3187,7 +3785,7 @@ class WebshopappApiResourceQuotes */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3198,11 +3796,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('quote' => $fields); + $fields = array( 'quote' => $fields ); - return $this->client->create('quotes', $fields); + return $this->client->create( 'quotes', $fields ); } /** @@ -3212,12 +3810,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($quoteId = null, $params = array()) + public function get( $quoteId = null, $params = array() ) { - if (!$quoteId) { - return $this->client->read('quotes', $params); + if ( ! $quoteId) { + return $this->client->read( 'quotes', $params ); } else { - return $this->client->read('quotes/' . $quoteId, $params); + return $this->client->read( 'quotes/' . $quoteId, $params ); } } @@ -3227,9 +3825,36 @@ public function get($quoteId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) + { + return $this->client->read( 'quotes/count', $params ); + } + + /** + * @param int $quoteId + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function update( $quoteId, $fields ) + { + $fields = array( 'quote' => $fields ); + + return $this->client->update( 'quotes/' . $quoteId, $fields ); + } +} + +class WebshopappApiResourceQuotesConvert +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) { - return $this->client->read('quotes/count', $params); + $this->client = $client; } /** @@ -3239,11 +3864,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($quoteId, $fields) + public function create( $quoteId, $fields ) { - $fields = array('quote' => $fields); + $fields = array( 'order' => $fields ); - return $this->client->update('quotes/' . $quoteId, $fields); + return $this->client->create( 'quotes/' . $quoteId . '/convert', $fields ); } } @@ -3254,7 +3879,7 @@ class WebshopappApiResourceQuotesPaymentmethods */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3265,9 +3890,9 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($quoteId) + public function get( $quoteId ) { - return $this->client->read('quotes/' . $quoteId . '/paymentmethods'); + return $this->client->read( 'quotes/' . $quoteId . '/paymentmethods' ); } /** @@ -3276,9 +3901,9 @@ public function get($quoteId) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('quotes/' . $quoteId . '/paymentmethods/count', $params); + return $this->client->read( 'quotes/' . $quoteId . '/paymentmethods/count', $params ); } } @@ -3289,7 +3914,7 @@ class WebshopappApiResourceQuotesProducts */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3301,11 +3926,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($quoteId, $fields) + public function create( $quoteId, $fields ) { - $fields = array('quoteProduct' => $fields); + $fields = array( 'quoteProduct' => $fields ); - return $this->client->create('quotes/' . $quoteId . '/products', $fields); + return $this->client->create( 'quotes/' . $quoteId . '/products', $fields ); } /** @@ -3316,12 +3941,12 @@ public function create($quoteId, $fields) * @return array * @throws WebshopappApiException */ - public function get($quoteId, $productId = null, $params = array()) + public function get( $quoteId, $productId = null, $params = array() ) { - if (!$productId) { - return $this->client->read('quotes/' . $quoteId . '/products', $params); + if ( ! $productId) { + return $this->client->read( 'quotes/' . $quoteId . '/products', $params ); } else { - return $this->client->read('quotes/' . $quoteId . '/products/' . $productId, $params); + return $this->client->read( 'quotes/' . $quoteId . '/products/' . $productId, $params ); } } @@ -3332,9 +3957,9 @@ public function get($quoteId, $productId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($quoteId, $params = array()) + public function count( $quoteId, $params = array() ) { - return $this->client->read('quotes/' . $quoteId . '/products/count', $params); + return $this->client->read( 'quotes/' . $quoteId . '/products/count', $params ); } /** @@ -3345,11 +3970,11 @@ public function count($quoteId, $params = array()) * @return array * @throws WebshopappApiException */ - public function update($quoteId, $productId, $fields) + public function update( $quoteId, $productId, $fields ) { - $fields = array('quoteProduct' => $fields); + $fields = array( 'quoteProduct' => $fields ); - return $this->client->update('quotes/' . $quoteId . '/products/' . $productId, $fields); + return $this->client->update( 'quotes/' . $quoteId . '/products/' . $productId, $fields ); } /** @@ -3359,86 +3984,151 @@ public function update($quoteId, $productId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($quoteId, $productId) + public function delete( $quoteId, $productId ) + { + return $this->client->delete( 'quotes/' . $quoteId . '/products/' . $productId ); + } +} + +class WebshopappApiResourceQuotesShippingmethods +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @param int $quoteId + * + * @return array + * @throws WebshopappApiException + */ + public function get( $quoteId ) + { + return $this->client->read( 'quotes/' . $quoteId . '/shippingmethods' ); + } + + /** + * @param int $quoteId + * @param array $params + * + * @return int + * @throws WebshopappApiException + */ + public function count( $quoteId, $params = array() ) + { + return $this->client->read( 'quotes/' . $quoteId . '/shippingmethods/count', $params ); + } +} + +class WebshopappApiResourceRedirects +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function create( $fields ) + { + $fields = array( 'redirect' => $fields ); + + return $this->client->create( 'redirects', $fields ); + } + + /** + * @param int $redirectId + * @param array $params + * + * @return array + * @throws WebshopappApiException + */ + public function get( $redirectId = null, $params = array() ) { - return $this->client->delete('quotes/' . $quoteId . '/products/' . $productId); + if ( ! $redirectId) { + return $this->client->read( 'redirects', $params ); + } else { + return $this->client->read( 'redirects/' . $redirectId, $params ); + } } -} -class WebshopappApiResourceQuotesShippingmethods -{ /** - * @var WebshopappApiClient + * @param array $params + * + * @return int + * @throws WebshopappApiException */ - private $client; - - public function __construct(WebshopappApiClient $client) + public function count( $params = array() ) { - $this->client = $client; + return $this->client->read( 'redirects/count', $params ); } /** - * @param int $quoteId + * @param int $redirectId + * @param array $fields * * @return array * @throws WebshopappApiException */ - public function get($quoteId) + public function update( $redirectId, $fields ) { - return $this->client->read('quotes/' . $quoteId . '/shippingmethods'); + $fields = array( 'redirect' => $fields ); + + return $this->client->update( 'redirects/' . $redirectId, $fields ); } /** - * @param int $quoteId - * @param array $params + * @param int $redirectId * - * @return int + * @return array * @throws WebshopappApiException */ - public function count($quoteId, $params = array()) + public function delete( $redirectId ) { - return $this->client->read('quotes/' . $quoteId . '/shippingmethods/count', $params); + return $this->client->delete( 'redirects/' . $redirectId ); } } -class WebshopappApiResourceRedirects +class WebshopappApiResourceReturns { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** - * @param array $fields - * - * @return array - * @throws WebshopappApiException - */ - public function create($fields) - { - $fields = array('redirect' => $fields); - - return $this->client->create('redirects', $fields); - } - - /** - * @param int $redirectId + * @param int $returnId * @param array $params * * @return array * @throws WebshopappApiException */ - public function get($redirectId = null, $params = array()) + public function get( $returnId = null, $params = array() ) { - if (!$redirectId) { - return $this->client->read('redirects', $params); + if ( ! $returnId) { + return $this->client->read( 'returns', $params ); } else { - return $this->client->read('redirects/' . $redirectId, $params); + return $this->client->read( 'returns/' . $returnId, $params ); } } @@ -3448,34 +4138,34 @@ public function get($redirectId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('redirects/count', $params); + return $this->client->read( 'returns/count', $params ); } /** - * @param int $redirectId + * @param int $returnId * @param array $fields * * @return array * @throws WebshopappApiException */ - public function update($redirectId, $fields) + public function update( $returnId, $fields ) { - $fields = array('redirect' => $fields); + $fields = array( 'return' => $fields ); - return $this->client->update('redirects/' . $redirectId, $fields); + return $this->client->update( 'returns/' . $returnId, $fields ); } /** - * @param int $redirectId + * @param int $returnId * * @return array * @throws WebshopappApiException */ - public function delete($redirectId) + public function delete( $returnId ) { - return $this->client->delete('redirects/' . $redirectId); + return $this->client->delete( 'returns/' . $returnId ); } } @@ -3486,7 +4176,7 @@ class WebshopappApiResourceReviews */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3497,11 +4187,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('review' => $fields); + $fields = array( 'review' => $fields ); - return $this->client->create('reviews', $fields); + return $this->client->create( 'reviews', $fields ); } /** @@ -3511,12 +4201,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($reviewId = null, $params = array()) + public function get( $reviewId = null, $params = array() ) { - if (!$reviewId) { - return $this->client->read('reviews', $params); + if ( ! $reviewId) { + return $this->client->read( 'reviews', $params ); } else { - return $this->client->read('reviews/' . $reviewId, $params); + return $this->client->read( 'reviews/' . $reviewId, $params ); } } @@ -3526,9 +4216,9 @@ public function get($reviewId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('reviews/count', $params); + return $this->client->read( 'reviews/count', $params ); } /** @@ -3538,11 +4228,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($reviewId, $fields) + public function update( $reviewId, $fields ) { - $fields = array('review' => $fields); + $fields = array( 'review' => $fields ); - return $this->client->update('reviews/' . $reviewId, $fields); + return $this->client->update( 'reviews/' . $reviewId, $fields ); } /** @@ -3551,9 +4241,9 @@ public function update($reviewId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($reviewId) + public function delete( $reviewId ) { - return $this->client->delete('reviews/' . $reviewId); + return $this->client->delete( 'reviews/' . $reviewId ); } } @@ -3564,7 +4254,7 @@ class WebshopappApiResourceShipments */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3576,12 +4266,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($shipmentId = null, $params = array()) + public function get( $shipmentId = null, $params = array() ) { - if (!$shipmentId) { - return $this->client->read('shipments', $params); + if ( ! $shipmentId) { + return $this->client->read( 'shipments', $params ); } else { - return $this->client->read('shipments/' . $shipmentId, $params); + return $this->client->read( 'shipments/' . $shipmentId, $params ); } } @@ -3591,9 +4281,9 @@ public function get($shipmentId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('shipments/count', $params); + return $this->client->read( 'shipments/count', $params ); } /** @@ -3603,11 +4293,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($shipmentId, $fields) + public function update( $shipmentId, $fields ) { - $fields = array('shipment' => $fields); + $fields = array( 'shipment' => $fields ); - return $this->client->update('shipments/' . $shipmentId, $fields); + return $this->client->update( 'shipments/' . $shipmentId, $fields ); } } @@ -3618,7 +4308,7 @@ class WebshopappApiResourceShipmentsMetafields */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3630,11 +4320,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($shipmentId, $fields) + public function create( $shipmentId, $fields ) { - $fields = array('shipmentMetafield' => $fields); + $fields = array( 'shipmentMetafield' => $fields ); - return $this->client->create('shipments/' . $shipmentId . '/metafields', $fields); + return $this->client->create( 'shipments/' . $shipmentId . '/metafields', $fields ); } /** @@ -3645,12 +4335,12 @@ public function create($shipmentId, $fields) * @return array * @throws WebshopappApiException */ - public function get($shipmentId, $metafieldId = null, $params = array()) + public function get( $shipmentId, $metafieldId = null, $params = array() ) { - if (!$metafieldId) { - return $this->client->read('shipments/' . $shipmentId . '/metafields', $params); + if ( ! $metafieldId) { + return $this->client->read( 'shipments/' . $shipmentId . '/metafields', $params ); } else { - return $this->client->read('shipments/' . $shipmentId . '/metafields/' . $metafieldId, $params); + return $this->client->read( 'shipments/' . $shipmentId . '/metafields/' . $metafieldId, $params ); } } @@ -3661,9 +4351,9 @@ public function get($shipmentId, $metafieldId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($shipmentId, $params = array()) + public function count( $shipmentId, $params = array() ) { - return $this->client->read('shipments/' . $shipmentId . '/metafields/count', $params); + return $this->client->read( 'shipments/' . $shipmentId . '/metafields/count', $params ); } /** @@ -3674,11 +4364,11 @@ public function count($shipmentId, $params = array()) * @return array * @throws WebshopappApiException */ - public function update($shipmentId, $metafieldId, $fields) + public function update( $shipmentId, $metafieldId, $fields ) { - $fields = array('shipmentMetafield' => $fields); + $fields = array( 'shipmentMetafield' => $fields ); - return $this->client->update('shipments/' . $shipmentId . '/metafields/' . $metafieldId, $fields); + return $this->client->update( 'shipments/' . $shipmentId . '/metafields/' . $metafieldId, $fields ); } /** @@ -3688,9 +4378,9 @@ public function update($shipmentId, $metafieldId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($shipmentId, $metafieldId) + public function delete( $shipmentId, $metafieldId ) { - return $this->client->delete('shipments/' . $shipmentId . '/metafields/' . $metafieldId); + return $this->client->delete( 'shipments/' . $shipmentId . '/metafields/' . $metafieldId ); } } @@ -3701,7 +4391,7 @@ class WebshopappApiResourceShipmentsProducts */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3714,12 +4404,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($shipmentId, $productId = null, $params = array()) + public function get( $shipmentId, $productId = null, $params = array() ) { - if (!$productId) { - return $this->client->read('shipments/' . $shipmentId . '/products', $params); + if ( ! $productId) { + return $this->client->read( 'shipments/' . $shipmentId . '/products', $params ); } else { - return $this->client->read('shipments/' . $shipmentId . '/products/' . $productId, $params); + return $this->client->read( 'shipments/' . $shipmentId . '/products/' . $productId, $params ); } } @@ -3730,9 +4420,9 @@ public function get($shipmentId, $productId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($shipmentId, $params = array()) + public function count( $shipmentId, $params = array() ) { - return $this->client->read('shipments/' . $shipmentId . '/products/count', $params); + return $this->client->read( 'shipments/' . $shipmentId . '/products/count', $params ); } } @@ -3743,7 +4433,7 @@ class WebshopappApiResourceShippingmethods */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3755,12 +4445,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($shippingmethodId = null, $params = array()) + public function get( $shippingmethodId = null, $params = array() ) { - if (!$shippingmethodId) { - return $this->client->read('shippingmethods', $params); + if ( ! $shippingmethodId) { + return $this->client->read( 'shippingmethods', $params ); } else { - return $this->client->read('shippingmethods/' . $shippingmethodId, $params); + return $this->client->read( 'shippingmethods/' . $shippingmethodId, $params ); } } @@ -3770,9 +4460,9 @@ public function get($shippingmethodId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('shippingmethods/count', $params); + return $this->client->read( 'shippingmethods/count', $params ); } } @@ -3783,7 +4473,7 @@ class WebshopappApiResourceShippingmethodsCountries */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3796,12 +4486,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($shippingmethodId, $countryId = null, $params = array()) + public function get( $shippingmethodId, $countryId = null, $params = array() ) { - if (!$countryId) { - return $this->client->read('shippingmethods/' . $shippingmethodId . '/countries', $params); + if ( ! $countryId) { + return $this->client->read( 'shippingmethods/' . $shippingmethodId . '/countries', $params ); } else { - return $this->client->read('shippingmethods/' . $shippingmethodId . '/countries/' . $countryId, $params); + return $this->client->read( 'shippingmethods/' . $shippingmethodId . '/countries/' . $countryId, $params ); } } @@ -3812,9 +4502,9 @@ public function get($shippingmethodId, $countryId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($shippingmethodId, $params = array()) + public function count( $shippingmethodId, $params = array() ) { - return $this->client->read('shippingmethods/' . $shippingmethodId . '/countries/count', $params); + return $this->client->read( 'shippingmethods/' . $shippingmethodId . '/countries/count', $params ); } } @@ -3825,7 +4515,7 @@ class WebshopappApiResourceShippingmethodsValues */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3838,12 +4528,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($shippingmethodId, $valueId = null, $params = array()) + public function get( $shippingmethodId, $valueId = null, $params = array() ) { - if (!$valueId) { - return $this->client->read('shippingmethods/' . $shippingmethodId . '/values', $params); + if ( ! $valueId) { + return $this->client->read( 'shippingmethods/' . $shippingmethodId . '/values', $params ); } else { - return $this->client->read('shippingmethods/' . $shippingmethodId . '/values/' . $valueId, $params); + return $this->client->read( 'shippingmethods/' . $shippingmethodId . '/values/' . $valueId, $params ); } } @@ -3854,9 +4544,9 @@ public function get($shippingmethodId, $valueId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($shippingmethodId, $params = array()) + public function count( $shippingmethodId, $params = array() ) { - return $this->client->read('shippingmethods/' . $shippingmethodId . '/values/count', $params); + return $this->client->read( 'shippingmethods/' . $shippingmethodId . '/values/count', $params ); } } @@ -3867,7 +4557,7 @@ class WebshopappApiResourceShop */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3878,7 +4568,7 @@ public function __construct(WebshopappApiClient $client) */ public function get() { - return $this->client->read('shop'); + return $this->client->read( 'shop' ); } } @@ -3889,7 +4579,7 @@ class WebshopappApiResourceShopCompany */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3900,7 +4590,7 @@ public function __construct(WebshopappApiClient $client) */ public function get() { - return $this->client->read('shop/company'); + return $this->client->read( 'shop/company' ); } } @@ -3911,7 +4601,7 @@ class WebshopappApiResourceShopJavascript */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3922,7 +4612,20 @@ public function __construct(WebshopappApiClient $client) */ public function get() { - return $this->client->read('shop/javascript'); + return $this->client->read( 'shop/javascript' ); + } + + /** + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function update( $fields ) + { + $fields = array( 'shopJavascript' => $fields ); + + return $this->client->update( 'shop/javascript', $fields ); } } @@ -3933,7 +4636,7 @@ class WebshopappApiResourceShopLimits */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3944,7 +4647,7 @@ public function __construct(WebshopappApiClient $client) */ public function get() { - return $this->client->read('shop/limits'); + return $this->client->read( 'shop/limits' ); } } @@ -3955,7 +4658,7 @@ class WebshopappApiResourceShopMetafields */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -3966,11 +4669,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('shopMetafield' => $fields); + $fields = array( 'shopMetafield' => $fields ); - return $this->client->create('shop/metafields', $fields); + return $this->client->create( 'shop/metafields', $fields ); } /** @@ -3980,12 +4683,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($metafieldId = null, $params = array()) + public function get( $metafieldId = null, $params = array() ) { - if (!$metafieldId) { - return $this->client->read('shop/metafields', $params); + if ( ! $metafieldId) { + return $this->client->read( 'shop/metafields', $params ); } else { - return $this->client->read('shop/metafields/' . $metafieldId, $params); + return $this->client->read( 'shop/metafields/' . $metafieldId, $params ); } } @@ -3995,9 +4698,9 @@ public function get($metafieldId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('shop/metafields/count', $params); + return $this->client->read( 'shop/metafields/count', $params ); } /** @@ -4007,11 +4710,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($metafieldId, $fields) + public function update( $metafieldId, $fields ) { - $fields = array('shopMetafield' => $fields); + $fields = array( 'shopMetafield' => $fields ); - return $this->client->update('shop/metafields/' . $metafieldId, $fields); + return $this->client->update( 'shop/metafields/' . $metafieldId, $fields ); } /** @@ -4020,9 +4723,9 @@ public function update($metafieldId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($metafieldId) + public function delete( $metafieldId ) { - return $this->client->delete('shop/metafields/' . $metafieldId); + return $this->client->delete( 'shop/metafields/' . $metafieldId ); } } @@ -4033,7 +4736,7 @@ class WebshopappApiResourceShopScripts */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -4044,11 +4747,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('shopScript' => $fields); + $fields = array( 'shopScript' => $fields ); - return $this->client->create('shop/scripts', $fields); + return $this->client->create( 'shop/scripts', $fields ); } /** @@ -4058,12 +4761,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($scriptId = null, $params = array()) + public function get( $scriptId = null, $params = array() ) { - if (!$scriptId) { - return $this->client->read('shop/scripts', $params); + if ( ! $scriptId) { + return $this->client->read( 'shop/scripts', $params ); } else { - return $this->client->read('shop/scripts/' . $scriptId, $params); + return $this->client->read( 'shop/scripts/' . $scriptId, $params ); } } @@ -4073,9 +4776,9 @@ public function get($scriptId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('shop/scripts/count', $params); + return $this->client->read( 'shop/scripts/count', $params ); } /** @@ -4085,11 +4788,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($scriptId, $fields) + public function update( $scriptId, $fields ) { - $fields = array('shopScript' => $fields); + $fields = array( 'shopScript' => $fields ); - return $this->client->update('shop/scripts/' . $scriptId, $fields); + return $this->client->update( 'shop/scripts/' . $scriptId, $fields ); } /** @@ -4098,9 +4801,87 @@ public function update($scriptId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($scriptId) + public function delete( $scriptId ) + { + return $this->client->delete( 'shop/scripts/' . $scriptId ); + } +} + +class WebshopappApiResourceShopTracking +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function create( $fields ) + { + $fields = array( 'shopTracking' => $fields ); + + return $this->client->create( 'shop/tracking', $fields ); + } + + /** + * @param int $trackingId + * @param array $params + * + * @return array + * @throws WebshopappApiException + */ + public function get( $trackingId = null, $params = array() ) + { + if ( ! $trackingId) { + return $this->client->read( 'shop/tracking', $params ); + } else { + return $this->client->read( 'shop/tracking/' . $trackingId, $params ); + } + } + + /** + * @param array $params + * + * @return int + * @throws WebshopappApiException + */ + public function count( $params = array() ) + { + return $this->client->read( 'shop/tracking/count', $params ); + } + + /** + * @param int $trackingId + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function update( $trackingId, $fields ) + { + $fields = array( 'shopTracking' => $fields ); + + return $this->client->update( 'shop/tracking/' . $trackingId, $fields ); + } + + /** + * @param int $trackingId + * + * @return array + * @throws WebshopappApiException + */ + public function delete( $trackingId ) { - return $this->client->delete('shop/scripts/' . $scriptId); + return $this->client->delete( 'shop/tracking/' . $trackingId ); } } @@ -4111,7 +4892,7 @@ class WebshopappApiResourceShopWebsite */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -4122,7 +4903,7 @@ public function __construct(WebshopappApiClient $client) */ public function get() { - return $this->client->read('shop/website'); + return $this->client->read( 'shop/website' ); } } @@ -4133,7 +4914,7 @@ class WebshopappApiResourceSubscriptions */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -4144,11 +4925,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('subscription' => $fields); + $fields = array( 'subscription' => $fields ); - return $this->client->create('subscriptions', $fields); + return $this->client->create( 'subscriptions', $fields ); } /** @@ -4158,12 +4939,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($subscriptionId = null, $params = array()) + public function get( $subscriptionId = null, $params = array() ) { - if (!$subscriptionId) { - return $this->client->read('subscriptions', $params); + if ( ! $subscriptionId) { + return $this->client->read( 'subscriptions', $params ); } else { - return $this->client->read('subscriptions/' . $subscriptionId, $params); + return $this->client->read( 'subscriptions/' . $subscriptionId, $params ); } } @@ -4173,9 +4954,9 @@ public function get($subscriptionId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('subscriptions/count', $params); + return $this->client->read( 'subscriptions/count', $params ); } /** @@ -4185,11 +4966,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($subscriptionId, $fields) + public function update( $subscriptionId, $fields ) { - $fields = array('subscription' => $fields); + $fields = array( 'subscription' => $fields ); - return $this->client->update('subscriptions/' . $subscriptionId, $fields); + return $this->client->update( 'subscriptions/' . $subscriptionId, $fields ); } /** @@ -4198,9 +4979,9 @@ public function update($subscriptionId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($subscriptionId) + public function delete( $subscriptionId ) { - return $this->client->delete('subscriptions/' . $subscriptionId); + return $this->client->delete( 'subscriptions/' . $subscriptionId ); } } @@ -4211,7 +4992,7 @@ class WebshopappApiResourceSuppliers */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -4222,11 +5003,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('supplier' => $fields); + $fields = array( 'supplier' => $fields ); - return $this->client->create('suppliers', $fields); + return $this->client->create( 'suppliers', $fields ); } /** @@ -4236,12 +5017,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($supplierId = null, $params = array()) + public function get( $supplierId = null, $params = array() ) { - if (!$supplierId) { - return $this->client->read('suppliers', $params); + if ( ! $supplierId) { + return $this->client->read( 'suppliers', $params ); } else { - return $this->client->read('suppliers/' . $supplierId, $params); + return $this->client->read( 'suppliers/' . $supplierId, $params ); } } @@ -4251,9 +5032,9 @@ public function get($supplierId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('suppliers/count', $params); + return $this->client->read( 'suppliers/count', $params ); } /** @@ -4263,11 +5044,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($supplierId, $fields) + public function update( $supplierId, $fields ) { - $fields = array('supplier' => $fields); + $fields = array( 'supplier' => $fields ); - return $this->client->update('suppliers/' . $supplierId, $fields); + return $this->client->update( 'suppliers/' . $supplierId, $fields ); } /** @@ -4276,9 +5057,9 @@ public function update($supplierId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($supplierId) + public function delete( $supplierId ) { - return $this->client->delete('suppliers/' . $supplierId); + return $this->client->delete( 'suppliers/' . $supplierId ); } } @@ -4289,7 +5070,7 @@ class WebshopappApiResourceTags */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -4300,11 +5081,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('tag' => $fields); + $fields = array( 'tag' => $fields ); - return $this->client->create('tags', $fields); + return $this->client->create( 'tags', $fields ); } /** @@ -4314,12 +5095,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($tagId = null, $params = array()) + public function get( $tagId = null, $params = array() ) { - if (!$tagId) { - return $this->client->read('tags', $params); + if ( ! $tagId) { + return $this->client->read( 'tags', $params ); } else { - return $this->client->read('tags/' . $tagId, $params); + return $this->client->read( 'tags/' . $tagId, $params ); } } @@ -4329,9 +5110,9 @@ public function get($tagId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('tags/count', $params); + return $this->client->read( 'tags/count', $params ); } /** @@ -4341,11 +5122,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($tagId, $fields) + public function update( $tagId, $fields ) { - $fields = array('tag' => $fields); + $fields = array( 'tag' => $fields ); - return $this->client->update('tags/' . $tagId, $fields); + return $this->client->update( 'tags/' . $tagId, $fields ); } /** @@ -4354,9 +5135,9 @@ public function update($tagId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($tagId) + public function delete( $tagId ) { - return $this->client->delete('tags/' . $tagId); + return $this->client->delete( 'tags/' . $tagId ); } } @@ -4367,7 +5148,7 @@ class WebshopappApiResourceTagsProducts */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -4378,11 +5159,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('tagsProduct' => $fields); + $fields = array( 'tagsProduct' => $fields ); - return $this->client->create('tags/products', $fields); + return $this->client->create( 'tags/products', $fields ); } /** @@ -4392,12 +5173,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($relationId = null, $params = array()) + public function get( $relationId = null, $params = array() ) { - if (!$relationId) { - return $this->client->read('tags/products', $params); + if ( ! $relationId) { + return $this->client->read( 'tags/products', $params ); } else { - return $this->client->read('tags/products/' . $relationId, $params); + return $this->client->read( 'tags/products/' . $relationId, $params ); } } @@ -4407,9 +5188,9 @@ public function get($relationId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('tags/products/count', $params); + return $this->client->read( 'tags/products/count', $params ); } /** @@ -4418,9 +5199,9 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function delete($relationId) + public function delete( $relationId ) { - return $this->client->delete('tags/products/' . $relationId); + return $this->client->delete( 'tags/products/' . $relationId ); } } @@ -4431,7 +5212,47 @@ class WebshopappApiResourceTaxes */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @param int $taxId + * @param array $params + * + * @return array + * @throws WebshopappApiException + */ + public function get( $taxId = null, $params = array() ) + { + if ( ! $taxId) { + return $this->client->read( 'taxes', $params ); + } else { + return $this->client->read( 'taxes/' . $taxId, $params ); + } + } + + /** + * @param array $params + * + * @return int + * @throws WebshopappApiException + */ + public function count( $params = array() ) + { + return $this->client->read( 'taxes/count', $params ); + } +} + +class WebshopappApiResourceTextpages +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -4442,26 +5263,26 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('tax' => $fields); + $fields = array( 'textpage' => $fields ); - return $this->client->create('taxes', $fields); + return $this->client->create( 'textpages', $fields ); } /** - * @param int $taxId + * @param int $textpageId * @param array $params * * @return array * @throws WebshopappApiException */ - public function get($taxId = null, $params = array()) + public function get( $textpageId = null, $params = array() ) { - if (!$taxId) { - return $this->client->read('taxes', $params); + if ( ! $textpageId) { + return $this->client->read( 'textpages', $params ); } else { - return $this->client->read('taxes/' . $taxId, $params); + return $this->client->read( 'textpages/' . $textpageId, $params ); } } @@ -4471,31 +5292,45 @@ public function get($taxId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) + { + return $this->client->read( 'textpages/count', $params ); + } + + /** + * @param int $textpageId + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function update( $textpageId, $fields ) { - return $this->client->read('taxes/count', $params); + $fields = array( 'textpage' => $fields ); + + return $this->client->update( 'textpages/' . $textpageId, $fields ); } /** - * @param int $taxId + * @param int $textpageId * * @return array * @throws WebshopappApiException */ - public function delete($taxId) + public function delete( $textpageId ) { - return $this->client->delete('taxes/' . $taxId); + return $this->client->delete( 'textpages/' . $textpageId ); } } -class WebshopappApiResourceTextpages +class WebshopappApiResourceTickets { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -4506,26 +5341,26 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('textpage' => $fields); + $fields = array( 'ticket' => $fields ); - return $this->client->create('textpages', $fields); + return $this->client->create( 'tickets', $fields ); } /** - * @param int $textpageId + * @param int $ticketId * @param array $params * * @return array * @throws WebshopappApiException */ - public function get($textpageId = null, $params = array()) + public function get( $ticketId = null, $params = array() ) { - if (!$textpageId) { - return $this->client->read('textpages', $params); + if ( ! $ticketId) { + return $this->client->read( 'tickets', $params ); } else { - return $this->client->read('textpages/' . $textpageId, $params); + return $this->client->read( 'tickets/' . $ticketId, $params ); } } @@ -4535,217 +5370,281 @@ public function get($textpageId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('textpages/count', $params); + return $this->client->read( 'tickets/count', $params ); } /** - * @param int $textpageId + * @param int $ticketId * @param array $fields * * @return array * @throws WebshopappApiException */ - public function update($textpageId, $fields) + public function update( $ticketId, $fields ) { - $fields = array('textpage' => $fields); + $fields = array( 'ticket' => $fields ); - return $this->client->update('textpages/' . $textpageId, $fields); + return $this->client->update( 'tickets/' . $ticketId, $fields ); } /** - * @param int $textpageId + * @param int $ticketId * * @return array * @throws WebshopappApiException */ - public function delete($textpageId) + public function delete( $ticketId ) { - return $this->client->delete('textpages/' . $textpageId); + return $this->client->delete( 'tickets/' . $ticketId ); } } -class WebshopappApiResourceTickets +class WebshopappApiResourceTicketsMessages { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** + * @param int $ticketId * @param array $fields * * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $ticketId, $fields ) { - $fields = array('ticket' => $fields); + $fields = array( 'ticketMessage' => $fields ); - return $this->client->create('tickets', $fields); + return $this->client->create( 'tickets/' . $ticketId . '/messages', $fields ); } /** * @param int $ticketId + * @param int $messageId * @param array $params * * @return array * @throws WebshopappApiException */ - public function get($ticketId = null, $params = array()) + public function get( $ticketId, $messageId = null, $params = array() ) { - if (!$ticketId) { - return $this->client->read('tickets', $params); + if ( ! $messageId) { + return $this->client->read( 'tickets/' . $ticketId . '/messages', $params ); } else { - return $this->client->read('tickets/' . $ticketId, $params); + return $this->client->read( 'tickets/' . $ticketId . '/messages/' . $messageId, $params ); } } /** + * @param int $ticketId * @param array $params * * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $ticketId, $params = array() ) { - return $this->client->read('tickets/count', $params); + return $this->client->read( 'tickets/' . $ticketId . '/messages/count', $params ); } /** * @param int $ticketId + * @param int $messageId * @param array $fields * * @return array * @throws WebshopappApiException */ - public function update($ticketId, $fields) + public function update( $ticketId, $messageId, $fields ) { - $fields = array('ticket' => $fields); + $fields = array( 'ticketMessage' => $fields ); - return $this->client->update('tickets/' . $ticketId, $fields); + return $this->client->update( 'tickets/' . $ticketId . '/messages/' . $messageId, $fields ); } /** * @param int $ticketId + * @param int $messageId * * @return array * @throws WebshopappApiException */ - public function delete($ticketId) + public function delete( $ticketId, $messageId ) { - return $this->client->delete('tickets/' . $ticketId); + return $this->client->delete( 'tickets/' . $ticketId . '/messages/' . $messageId ); } } -class WebshopappApiResourceTicketsMessages +class WebshopappApiResourceTime { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @return array + * @throws WebshopappApiException + */ + public function get() + { + return $this->client->read( 'time' ); + } +} + +class WebshopappApiResourceTypes +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** - * @param int $ticketId * @param array $fields * * @return array * @throws WebshopappApiException */ - public function create($ticketId, $fields) + public function create( $fields ) { - $fields = array('ticketMessage' => $fields); + $fields = array( 'type' => $fields ); - return $this->client->create('tickets/' . $ticketId . '/messages', $fields); + return $this->client->create( 'types', $fields ); } /** - * @param int $ticketId - * @param int $messageId + * @param int $typeId * @param array $params * * @return array * @throws WebshopappApiException */ - public function get($ticketId, $messageId = null, $params = array()) + public function get( $typeId = null, $params = array() ) { - if (!$messageId) { - return $this->client->read('tickets/' . $ticketId . '/messages', $params); + if ( ! $typeId) { + return $this->client->read( 'types', $params ); } else { - return $this->client->read('tickets/' . $ticketId . '/messages/' . $messageId, $params); + return $this->client->read( 'types/' . $typeId, $params ); } } /** - * @param int $ticketId * @param array $params * * @return int * @throws WebshopappApiException */ - public function count($ticketId, $params = array()) + public function count( $params = array() ) { - return $this->client->read('tickets/' . $ticketId . '/messages/count', $params); + return $this->client->read( 'types/count', $params ); } /** - * @param int $ticketId - * @param int $messageId + * @param int $typeId * @param array $fields * * @return array * @throws WebshopappApiException */ - public function update($ticketId, $messageId, $fields) + public function update( $typeId, $fields ) { - $fields = array('ticketMessage' => $fields); + $fields = array( 'type' => $fields ); - return $this->client->update('tickets/' . $ticketId . '/messages/' . $messageId, $fields); + return $this->client->update( 'types/' . $typeId, $fields ); } /** - * @param int $ticketId - * @param int $messageId + * @param int $typeId * * @return array * @throws WebshopappApiException */ - public function delete($ticketId, $messageId) + public function delete( $typeId ) { - return $this->client->delete('tickets/' . $ticketId . '/messages/' . $messageId); + return $this->client->delete( 'types/' . $typeId ); } } -class WebshopappApiResourceTime +class WebshopappApiResourceTypesAttributes { /** * @var WebshopappApiClient */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } /** + * @param array $fields + * * @return array * @throws WebshopappApiException */ - public function get() + public function create( $fields ) + { + $fields = array( 'typesAttribute' => $fields ); + + return $this->client->create( 'types/attributes', $fields ); + } + + /** + * @param int $relationId + * @param array $params + * + * @return array + * @throws WebshopappApiException + */ + public function get( $relationId = null, $params = array() ) + { + if ( ! $relationId) { + return $this->client->read( 'types/attributes', $params ); + } else { + return $this->client->read( 'types/attributes/' . $relationId, $params ); + } + } + + /** + * @param array $params + * + * @return int + * @throws WebshopappApiException + */ + public function count( $params = array() ) + { + return $this->client->read( 'types/attributes/count', $params ); + } + + /** + * @param int $relationId + * + * @return array + * @throws WebshopappApiException + */ + public function delete( $relationId ) { - return $this->client->read('time'); + return $this->client->delete( 'types/attributes/' . $relationId ); } } @@ -4756,7 +5655,7 @@ class WebshopappApiResourceVariants */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -4767,11 +5666,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('variant' => $fields); + $fields = array( 'variant' => $fields ); - return $this->client->create('variants', $fields); + return $this->client->create( 'variants', $fields ); } /** @@ -4781,12 +5680,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($variantId = null, $params = array()) + public function get( $variantId = null, $params = array() ) { - if (!$variantId) { - return $this->client->read('variants', $params); + if ( ! $variantId) { + return $this->client->read( 'variants', $params ); } else { - return $this->client->read('variants/' . $variantId, $params); + return $this->client->read( 'variants/' . $variantId, $params ); } } @@ -4796,9 +5695,9 @@ public function get($variantId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('variants/count', $params); + return $this->client->read( 'variants/count', $params ); } /** @@ -4808,11 +5707,11 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function update($variantId, $fields) + public function update( $variantId, $fields ) { - $fields = array('variant' => $fields); + $fields = array( 'variant' => $fields ); - return $this->client->update('variants/' . $variantId, $fields); + return $this->client->update( 'variants/' . $variantId, $fields ); } /** @@ -4821,9 +5720,9 @@ public function update($variantId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($variantId) + public function delete( $variantId ) { - return $this->client->delete('variants/' . $variantId); + return $this->client->delete( 'variants/' . $variantId ); } } @@ -4834,7 +5733,7 @@ class WebshopappApiResourceVariantsMetafields */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -4846,11 +5745,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($variantId, $fields) + public function create( $variantId, $fields ) { - $fields = array('variantMetafield' => $fields); + $fields = array( 'variantMetafield' => $fields ); - return $this->client->create('variants/' . $variantId . '/metafields', $fields); + return $this->client->create( 'variants/' . $variantId . '/metafields', $fields ); } /** @@ -4861,12 +5760,12 @@ public function create($variantId, $fields) * @return array * @throws WebshopappApiException */ - public function get($variantId, $metafieldId = null, $params = array()) + public function get( $variantId, $metafieldId = null, $params = array() ) { - if (!$metafieldId) { - return $this->client->read('variants/' . $variantId . '/metafields', $params); + if ( ! $metafieldId) { + return $this->client->read( 'variants/' . $variantId . '/metafields', $params ); } else { - return $this->client->read('variants/' . $variantId . '/metafields/' . $metafieldId, $params); + return $this->client->read( 'variants/' . $variantId . '/metafields/' . $metafieldId, $params ); } } @@ -4877,9 +5776,9 @@ public function get($variantId, $metafieldId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($variantId, $params = array()) + public function count( $variantId, $params = array() ) { - return $this->client->read('variants/' . $variantId . '/metafields/count', $params); + return $this->client->read( 'variants/' . $variantId . '/metafields/count', $params ); } /** @@ -4890,11 +5789,11 @@ public function count($variantId, $params = array()) * @return array * @throws WebshopappApiException */ - public function update($variantId, $metafieldId, $fields) + public function update( $variantId, $metafieldId, $fields ) { - $fields = array('variantMetafield' => $fields); + $fields = array( 'variantMetafield' => $fields ); - return $this->client->update('variants/' . $variantId . '/metafields/' . $metafieldId, $fields); + return $this->client->update( 'variants/' . $variantId . '/metafields/' . $metafieldId, $fields ); } /** @@ -4904,9 +5803,35 @@ public function update($variantId, $metafieldId, $fields) * @return array * @throws WebshopappApiException */ - public function delete($variantId, $metafieldId) + public function delete( $variantId, $metafieldId ) + { + return $this->client->delete( 'variants/' . $variantId . '/metafields/' . $metafieldId ); + } +} + +class WebshopappApiResourceVariantsBulk +{ + /** + * @var WebshopappApiClient + */ + private $client; + + public function __construct( WebshopappApiClient $client ) + { + $this->client = $client; + } + + /** + * @param array $fields + * + * @return array + * @throws WebshopappApiException + */ + public function update( $fields ) { - return $this->client->delete('variants/' . $variantId . '/metafields/' . $metafieldId); + $fields = array( 'variant' => $fields ); + + return $this->client->update( 'variants/bulk', $fields ); } } @@ -4917,7 +5842,7 @@ class WebshopappApiResourceVariantsMovements */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -4929,12 +5854,12 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function get($movementId = null, $params = array()) + public function get( $movementId = null, $params = array() ) { - if (!$movementId) { - return $this->client->read('variants/movements', $params); + if ( ! $movementId) { + return $this->client->read( 'variants/movements', $params ); } else { - return $this->client->read('variants/movements/' . $movementId, $params); + return $this->client->read( 'variants/movements/' . $movementId, $params ); } } @@ -4944,9 +5869,9 @@ public function get($movementId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('variants/movements/count', $params); + return $this->client->read( 'variants/movements/count', $params ); } } @@ -4957,7 +5882,7 @@ class WebshopappApiResourceWebhooks */ private $client; - public function __construct(WebshopappApiClient $client) + public function __construct( WebshopappApiClient $client ) { $this->client = $client; } @@ -4968,11 +5893,11 @@ public function __construct(WebshopappApiClient $client) * @return array * @throws WebshopappApiException */ - public function create($fields) + public function create( $fields ) { - $fields = array('webhook' => $fields); + $fields = array( 'webhook' => $fields ); - return $this->client->create('webhooks', $fields); + return $this->client->create( 'webhooks', $fields ); } /** @@ -4982,12 +5907,12 @@ public function create($fields) * @return array * @throws WebshopappApiException */ - public function get($webhookId = null, $params = array()) + public function get( $webhookId = null, $params = array() ) { - if (!$webhookId) { - return $this->client->read('webhooks', $params); + if ( ! $webhookId) { + return $this->client->read( 'webhooks', $params ); } else { - return $this->client->read('webhooks/' . $webhookId, $params); + return $this->client->read( 'webhooks/' . $webhookId, $params ); } } @@ -4997,9 +5922,9 @@ public function get($webhookId = null, $params = array()) * @return int * @throws WebshopappApiException */ - public function count($params = array()) + public function count( $params = array() ) { - return $this->client->read('webhooks/count', $params); + return $this->client->read( 'webhooks/count', $params ); } /** @@ -5008,8 +5933,10 @@ public function count($params = array()) * @return array * @throws WebshopappApiException */ - public function delete($webhookId) + public function delete( $webhookId ) { - return $this->client->delete('webhooks/' . $webhookId); + return $this->client->delete( 'webhooks/' . $webhookId ); } } + +?> \ No newline at end of file