├── .github └── workflows │ └── code-security-analysis-psalm.yml ├── .gitignore ├── README.md ├── composer.json └── src └── WebshopappApiClient.php /.github/workflows/code-security-analysis-psalm.yml: -------------------------------------------------------------------------------- 1 | name: Static Code Security Analysis (Psalm) 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | psalm: 11 | name: Psalm 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout repository 15 | uses: actions/checkout@v4 16 | - name: Psalm 17 | uses: docker://ghcr.io/psalm/psalm-github-actions:6.10.3 18 | with: 19 | security_analysis: true 20 | report_file: results.sarif 21 | - name: Upload Security Analysis results to GitHub 22 | uses: github/codeql-action/upload-sarif@v3 23 | with: 24 | sarif_file: results.sarif 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | vendor 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Lightspeed eCom](http://developers.seoshop.com/assets/gfx/logo.png) 2 | 3 | [![Latest Stable Version](http://img.shields.io/packagist/v/seoshop/seoshop-php.svg)](https://packagist.org/packages/seoshop/seoshop-php) 4 | [![Latest Unstable Version](http://img.shields.io/packagist/vpre/seoshop/seoshop-php.svg)](https://packagist.org/packages/seoshop/seoshop-php) 5 | ![License](http://img.shields.io/badge/license-MIT-green.svg) 6 | 7 | # Lightspeed eCom PHP API client 8 | This package is a convenience wrapper to communicate with the Lightspeed eCom REST-API. 9 | 10 | ## Installation 11 | For the installation of the client, there are 2 ways. The composer way is preferable, but not always possible. 12 | 13 | ### Composer 14 | **Note: From client version 1.9.0 and upward, we will only support PHP 5.4 and above.** 15 | 16 | Include the package in your `composer.json` file 17 | ``` json 18 | { 19 | "require": { 20 | "seoshop/seoshop-php": "^1.9" 21 | } 22 | } 23 | ``` 24 | 25 | ...then run `composer update` and load the composer autoloader: 26 | 27 | ``` php 28 | shop->get(); 55 | ``` 56 | 57 | __Explanation__ 58 | 59 | [api-server] 60 | Available server(-clusters): live, eu1, us1 61 | 62 | [api-key] 63 | The API key you've received or created 64 | 65 | [api-secret] 66 | The API secret you've received or created 67 | 68 | [language] 69 | Language shortcode that's available in the shop you're connecting to 70 | 71 | ## Fetching response headers 72 | After making a call, you can fetch the response headers from our API server and use it to check important data such as rate limiting. 73 | 74 | ``` php 75 | $shopInfo = $client->shop->get(); 76 | $response = $shopInfo->getResponseHeaders(); 77 | ``` 78 | 79 | ## Getting started 80 | Lightspeed eCom offers a powerful set of API’s for developers to create awesome apps. The API provides developers the interface to connect with third party software such as accounting-, feedback-, e-mailmarketing- and inventory management-software, or extend with new features that interact with our core platform, such as loyalty programs, social-sharing programs or reporting tools. 81 | 82 | Getting started with Lightspeed eCom is easy. Not a partner yet? [Please sign up as a partner](https://www.lightspeedhq.com/partners/) and claim your account details and API keys. 83 | 84 | Read our tutorials on how to [build](http://developers.lightspeedhq.com/ecom/tutorials/build-an-app/) and [publish](http://developers.lightspeedhq.com/ecom/tutorials/publish-an-app/) your first app. Check our [introduction](http://developers.lightspeedhq.com/ecom/introduction/introduction/) to find out how to use the API 85 | 86 | ## Documentation 87 | More documentation can be found at [developers.lightspeedhq.com/ecom](http://developers.lightspeedhq.com/ecom) 88 | 89 | ## Contributing 90 | We love contributions, but please note that the API client is generated. If you have suggested changes, you may still create a PR, but your PR will not be merged. We will however adapt the generator to reflect your changes. You can also create a GitHub issue if there's something you miss. 91 | 92 | ## Unofficial clients for other languages 93 | - **PHP** 94 | - [laravel-lightspeed-api](https://github.com/gunharth/laravel-lightspeed-api) by [Gunharth Randolf @gunharth](https://github.com/gunharth) 95 | - **Ruby** 96 | - [seoshop-api](https://github.com/YotpoLtd/seoshop-api) by [Yotpo Ltd @YotpoLtd](https://github.com/YotpoLtd) 97 | - **Java** 98 | - [lightspeedecom-api](https://github.com/Falkplan/lightspeedecom-api) by [Falkplan](https://github.com/Falkplan) 99 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "seoshop/seoshop-php", 3 | "description": "PHP client for the Lightspeed eCom API", 4 | "keywords": ["api", "client", "php", "ecom", "lightspeed"], 5 | "homepage": "http://developers.lightspeedhq.com/ecom", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "Lightspeed and contributors", 10 | "homepage": "https://github.com/SEOshop/API-PHP-Client/contributors" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.4.0", 15 | "ext-curl": "*", 16 | "ext-json": "*", 17 | "ext-mbstring": "*", 18 | "ext-fileinfo": "*" 19 | }, 20 | "autoload": { 21 | "files": ["src/WebshopappApiClient.php"] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/WebshopappApiClient.php: -------------------------------------------------------------------------------- 1 | setApiServer($apiServer); 486 | $this->setApiKey($apiKey); 487 | $this->setApiSecret($apiSecret); 488 | $this->setApiLanguage($apiLanguage); 489 | 490 | $this->registerResources(); 491 | } 492 | 493 | /** 494 | * @return string 495 | */ 496 | public function getApiLanguage() 497 | { 498 | return $this->apiLanguage; 499 | } 500 | 501 | /** 502 | * @param $apiServer 503 | */ 504 | public function setApiServer($apiServer) 505 | { 506 | $this->apiServer = $apiServer; 507 | } 508 | 509 | /** 510 | * @param $apiKey 511 | */ 512 | public function setApiKey($apiKey) 513 | { 514 | $this->apiKey = $apiKey; 515 | } 516 | 517 | /** 518 | * @return string 519 | */ 520 | public function getApiKey() 521 | { 522 | return $this->apiKey; 523 | } 524 | 525 | /** 526 | * @param $apiSecret 527 | */ 528 | public function setApiSecret($apiSecret) 529 | { 530 | $this->apiSecret = $apiSecret; 531 | } 532 | 533 | /** 534 | * @return string 535 | */ 536 | public function getApiSecret() 537 | { 538 | return $this->apiSecret; 539 | } 540 | 541 | /** 542 | * @param $apiLanguage 543 | */ 544 | public function setApiLanguage($apiLanguage) 545 | { 546 | $this->apiLanguage = $apiLanguage; 547 | } 548 | 549 | /** 550 | * @return string 551 | */ 552 | public function getApiServer() 553 | { 554 | return $this->apiServer; 555 | } 556 | 557 | /** 558 | * @return int 559 | */ 560 | public function getApiCallsMade() 561 | { 562 | return $this->apiCallsMade; 563 | } 564 | 565 | /** 566 | * @param array $responseHeaders 567 | * 568 | * @return void 569 | */ 570 | public function setResponseHeaders($responseHeaders) 571 | { 572 | $this->responseHeaders = $responseHeaders; 573 | } 574 | 575 | /** 576 | * @return array 577 | */ 578 | public function getResponseHeaders() 579 | { 580 | return $this->responseHeaders; 581 | } 582 | 583 | /** 584 | * @throws WebshopappApiException 585 | */ 586 | private function checkLoginCredentials() 587 | { 588 | if (strlen($this->getApiKey()) !== 32 || strlen($this->getApiSecret()) !== 32) 589 | { 590 | throw new WebshopappApiException('Invalid login credentials.'); 591 | } 592 | if (strlen($this->getApiLanguage()) !== 2) 593 | { 594 | throw new WebshopappApiException('Invalid API language.'); 595 | } 596 | } 597 | 598 | private function registerResources() 599 | { 600 | $this->account = new WebshopappApiResourceAccount($this); 601 | $this->accountMetafields = new WebshopappApiResourceAccountMetafields($this); 602 | $this->accountPermissions = new WebshopappApiResourceAccountPermissions($this); 603 | $this->accountRatelimit = new WebshopappApiResourceAccountRatelimit($this); 604 | $this->additionalcosts = new WebshopappApiResourceAdditionalcosts($this); 605 | $this->attributes = new WebshopappApiResourceAttributes($this); 606 | $this->blogs = new WebshopappApiResourceBlogs($this); 607 | $this->blogsArticles = new WebshopappApiResourceBlogsArticles($this); 608 | $this->blogsArticlesImage = new WebshopappApiResourceBlogsArticlesImage($this); 609 | $this->blogsArticlesTags = new WebshopappApiResourceBlogsArticlesTags($this); 610 | $this->blogsComments = new WebshopappApiResourceBlogsComments($this); 611 | $this->blogsTags = new WebshopappApiResourceBlogsTags($this); 612 | $this->brands = new WebshopappApiResourceBrands($this); 613 | $this->brandsImage = new WebshopappApiResourceBrandsImage($this); 614 | $this->catalog = new WebshopappApiResourceCatalog($this); 615 | $this->categories = new WebshopappApiResourceCategories($this); 616 | $this->categoriesImage = new WebshopappApiResourceCategoriesImage($this); 617 | $this->categoriesProducts = new WebshopappApiResourceCategoriesProducts($this); 618 | $this->categoriesProductsBulk = new WebshopappApiResourceCategoriesProductsBulk($this); 619 | $this->checkouts = new WebshopappApiResourceCheckouts($this); 620 | $this->checkoutsOrder = new WebshopappApiResourceCheckoutsOrder($this); 621 | $this->checkoutsPayment_methods = new WebshopappApiResourceCheckoutsPayment_methods($this); 622 | $this->checkoutsProducts = new WebshopappApiResourceCheckoutsProducts($this); 623 | $this->checkoutsShipment_methods = new WebshopappApiResourceCheckoutsShipment_methods($this); 624 | $this->checkoutsValidate = new WebshopappApiResourceCheckoutsValidate($this); 625 | $this->contacts = new WebshopappApiResourceContacts($this); 626 | $this->countries = new WebshopappApiResourceCountries($this); 627 | $this->customers = new WebshopappApiResourceCustomers($this); 628 | $this->customersLogin = new WebshopappApiResourceCustomersLogin($this); 629 | $this->customersMetafields = new WebshopappApiResourceCustomersMetafields($this); 630 | $this->customersTokens = new WebshopappApiResourceCustomersTokens($this); 631 | $this->dashboard = new WebshopappApiResourceDashboard($this); 632 | $this->deliverydates = new WebshopappApiResourceDeliverydates($this); 633 | $this->discountrules = new WebshopappApiResourceDiscountrules($this); 634 | $this->discounts = new WebshopappApiResourceDiscounts($this); 635 | $this->events = new WebshopappApiResourceEvents($this); 636 | $this->external_services = new WebshopappApiResourceExternal_services($this); 637 | $this->files = new WebshopappApiResourceFiles($this); 638 | $this->filters = new WebshopappApiResourceFilters($this); 639 | $this->filtersValues = new WebshopappApiResourceFiltersValues($this); 640 | $this->groups = new WebshopappApiResourceGroups($this); 641 | $this->groupsCustomers = new WebshopappApiResourceGroupsCustomers($this); 642 | $this->invoices = new WebshopappApiResourceInvoices($this); 643 | $this->invoicesItems = new WebshopappApiResourceInvoicesItems($this); 644 | $this->invoicesMetafields = new WebshopappApiResourceInvoicesMetafields($this); 645 | $this->languages = new WebshopappApiResourceLanguages($this); 646 | $this->locations = new WebshopappApiResourceLocations($this); 647 | $this->metafields = new WebshopappApiResourceMetafields($this); 648 | $this->orders = new WebshopappApiResourceOrders($this); 649 | $this->ordersCredit = new WebshopappApiResourceOrdersCredit($this); 650 | $this->ordersMetafields = new WebshopappApiResourceOrdersMetafields($this); 651 | $this->ordersProducts = new WebshopappApiResourceOrdersProducts($this); 652 | $this->ordersCustomstatuses = new WebshopappApiResourceOrdersCustomstatuses($this); 653 | $this->ordersEvents = new WebshopappApiResourceOrdersEvents($this); 654 | $this->paymentmethods = new WebshopappApiResourcePaymentmethods($this); 655 | $this->products = new WebshopappApiResourceProducts($this); 656 | $this->productsAttributes = new WebshopappApiResourceProductsAttributes($this); 657 | $this->productsFiltervalues = new WebshopappApiResourceProductsFiltervalues($this); 658 | $this->productsImages = new WebshopappApiResourceProductsImages($this); 659 | $this->productsMetafields = new WebshopappApiResourceProductsMetafields($this); 660 | $this->productsRelations = new WebshopappApiResourceProductsRelations($this); 661 | $this->quotes = new WebshopappApiResourceQuotes($this); 662 | $this->quotesConvert = new WebshopappApiResourceQuotesConvert($this); 663 | $this->quotesPaymentmethods = new WebshopappApiResourceQuotesPaymentmethods($this); 664 | $this->quotesProducts = new WebshopappApiResourceQuotesProducts($this); 665 | $this->quotesShippingmethods = new WebshopappApiResourceQuotesShippingmethods($this); 666 | $this->redirects = new WebshopappApiResourceRedirects($this); 667 | $this->returns = new WebshopappApiResourceReturns($this); 668 | $this->reviews = new WebshopappApiResourceReviews($this); 669 | $this->sets = new WebshopappApiResourceSets($this); 670 | $this->shipments = new WebshopappApiResourceShipments($this); 671 | $this->shipmentsMetafields = new WebshopappApiResourceShipmentsMetafields($this); 672 | $this->shipmentsProducts = new WebshopappApiResourceShipmentsProducts($this); 673 | $this->shippingmethods = new WebshopappApiResourceShippingmethods($this); 674 | $this->shippingmethodsCountries = new WebshopappApiResourceShippingmethodsCountries($this); 675 | $this->shippingmethodsValues = new WebshopappApiResourceShippingmethodsValues($this); 676 | $this->shop = new WebshopappApiResourceShop($this); 677 | $this->shopCompany = new WebshopappApiResourceShopCompany($this); 678 | $this->shopJavascript = new WebshopappApiResourceShopJavascript($this); 679 | $this->shopLimits = new WebshopappApiResourceShopLimits($this); 680 | $this->shopMetafields = new WebshopappApiResourceShopMetafields($this); 681 | $this->shopScripts = new WebshopappApiResourceShopScripts($this); 682 | $this->shopSettings = new WebshopappApiResourceShopSettings($this); 683 | $this->shopTracking = new WebshopappApiResourceShopTracking($this); 684 | $this->shopWebsite = new WebshopappApiResourceShopWebsite($this); 685 | $this->subscriptions = new WebshopappApiResourceSubscriptions($this); 686 | $this->suppliers = new WebshopappApiResourceSuppliers($this); 687 | $this->tags = new WebshopappApiResourceTags($this); 688 | $this->tagsProducts = new WebshopappApiResourceTagsProducts($this); 689 | $this->taxes = new WebshopappApiResourceTaxes($this); 690 | $this->taxesOverrides = new WebshopappApiResourceTaxesOverrides($this); 691 | $this->textpages = new WebshopappApiResourceTextpages($this); 692 | $this->themeCategories = new WebshopappApiResourceThemeCategories($this); 693 | $this->themeProducts = new WebshopappApiResourceThemeProducts($this); 694 | $this->tickets = new WebshopappApiResourceTickets($this); 695 | $this->ticketsMessages = new WebshopappApiResourceTicketsMessages($this); 696 | $this->time = new WebshopappApiResourceTime($this); 697 | $this->types = new WebshopappApiResourceTypes($this); 698 | $this->typesAttributes = new WebshopappApiResourceTypesAttributes($this); 699 | $this->variants = new WebshopappApiResourceVariants($this); 700 | $this->variantsImage = new WebshopappApiResourceVariantsImage($this); 701 | $this->variantsMetafields = new WebshopappApiResourceVariantsMetafields($this); 702 | $this->variantsBulk = new WebshopappApiResourceVariantsBulk($this); 703 | $this->variantsMovements = new WebshopappApiResourceVariantsMovements($this); 704 | $this->webhooks = new WebshopappApiResourceWebhooks($this); 705 | } 706 | 707 | /** 708 | * @param string $resourceUrl 709 | * @param array $params 710 | * 711 | * @return string 712 | */ 713 | private function getUrl($resourceUrl, $params = null) 714 | { 715 | if ($this->apiServer == 'live') 716 | { 717 | $apiHost = self::SERVER_HOST_LIVE; 718 | } 719 | elseif ($this->apiServer == 'local') 720 | { 721 | $apiHost = self::SERVER_HOST_LOCAL; 722 | } 723 | elseif ($this->apiServer == 'eu1') 724 | { 725 | $apiHost = self::SERVER_EU1_LIVE; 726 | } 727 | elseif ($this->apiServer == 'us1') 728 | { 729 | $apiHost = self::SERVER_US1_LIVE; 730 | } 731 | 732 | $apiHostParts = parse_url($apiHost); 733 | $resourceUrlParts = parse_url($resourceUrl); 734 | 735 | $apiUrl = $apiHostParts['scheme'] . '://' . $this->getApiKey() . ':' . $this->getApiSecret() . '@' . $apiHostParts['host'] . '/'; 736 | if (isset($apiHostParts['path']) && strlen(trim($apiHostParts['path'], '/'))) 737 | { 738 | $apiUrl .= trim($apiHostParts['path'], '/') . '/'; 739 | } 740 | $apiUrl .= $this->getApiLanguage() . '/' . $resourceUrlParts['path'] . '.json'; 741 | 742 | if (isset($resourceUrlParts['query'])) 743 | { 744 | $apiUrl .= '?' . $resourceUrlParts['query']; 745 | } 746 | elseif ($params && is_array($params)) 747 | { 748 | $queryParameters = array(); 749 | 750 | foreach ($params as $key => $value) 751 | { 752 | if (!is_array($value)) 753 | { 754 | $queryParameters[] = $key . '=' . urlencode($value); 755 | } 756 | } 757 | 758 | $queryParameters = implode('&', $queryParameters); 759 | 760 | if (!empty($queryParameters)) 761 | { 762 | $apiUrl .= '?' . $queryParameters; 763 | } 764 | } 765 | 766 | return $apiUrl; 767 | } 768 | 769 | /** 770 | * Invoke the Webshopapp API. 771 | * 772 | * @param string $url The resource url (required) 773 | * @param string $method The http method (default 'get') 774 | * @param array $payload The query/post data 775 | * 776 | * @return mixed The decoded response object 777 | * @throws WebshopappApiException 778 | */ 779 | private function sendRequest($url, $method, $payload = null, $options = []) 780 | { 781 | $this->checkLoginCredentials(); 782 | 783 | if ($method == 'post' || $method == 'put') 784 | { 785 | if (!$payload || !is_array($payload)) 786 | { 787 | throw new WebshopAppApiException(100, 'Invalid payload'); 788 | } 789 | 790 | $multipart = array_key_exists('header', $options); 791 | 792 | $header = $multipart ? $options['header'] : 'application/json'; 793 | 794 | $curlOptions = array( 795 | CURLOPT_URL => $this->getUrl($url), 796 | CURLOPT_CUSTOMREQUEST => strtoupper($method), 797 | CURLOPT_HTTPHEADER => array('Content-Type: ' . $header), 798 | CURLOPT_POST => true, 799 | CURLOPT_POSTFIELDS => $multipart ? $payload : json_encode($payload), 800 | ); 801 | } 802 | elseif ($method == 'delete') 803 | { 804 | $curlOptions = array( 805 | CURLOPT_URL => $this->getUrl($url), 806 | CURLOPT_CUSTOMREQUEST => 'DELETE', 807 | ); 808 | } 809 | else 810 | { 811 | $curlOptions = array( 812 | CURLOPT_URL => $this->getUrl($url, $payload), 813 | ); 814 | } 815 | 816 | $curlOptions += array( 817 | CURLOPT_HEADER => false, 818 | CURLOPT_RETURNTRANSFER => true, 819 | CURLOPT_SSL_VERIFYPEER => false, 820 | CURLOPT_USERAGENT => 'WebshopappApiClient/' . self::CLIENT_VERSION . ' (PHP/' . phpversion() . ')', 821 | CURLOPT_SSLVERSION => 6, 822 | ); 823 | 824 | $curlHandle = curl_init(); 825 | 826 | curl_setopt_array($curlHandle, $curlOptions); 827 | 828 | $headers = []; 829 | 830 | curl_setopt($curlHandle, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$headers) { 831 | $length = strlen($header); 832 | $header = explode(':', $header, 2); 833 | 834 | if (count($header) <= 1) { 835 | return $length; 836 | } 837 | 838 | $header = array_map('trim', $header); 839 | $headers[$header[0]] = $header[1]; 840 | 841 | return $length; 842 | }); 843 | 844 | $responseBody = curl_exec($curlHandle); 845 | 846 | if ($headers) { 847 | $this->setResponseHeaders($headers); 848 | } 849 | 850 | if (curl_errno($curlHandle)) 851 | { 852 | $this->handleCurlError($curlHandle); 853 | } 854 | 855 | $responseBody = json_decode($responseBody, true); 856 | $responseCode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE); 857 | 858 | curl_close($curlHandle); 859 | 860 | $this->apiCallsMade ++; 861 | 862 | if ($responseCode < 200 || $responseCode > 299 || ($responseBody && array_key_exists('error', $responseBody))) 863 | { 864 | $this->handleResponseError($responseCode, $responseBody); 865 | } 866 | 867 | if ($responseBody && preg_match('/^checkout/i', $url) !== 1) 868 | { 869 | $responseBody = array_shift($responseBody); 870 | } 871 | 872 | return $responseBody; 873 | } 874 | 875 | /** 876 | * @param int $responseCode 877 | * @param array $responseBody 878 | * 879 | * @throws WebshopappApiException 880 | */ 881 | private function handleResponseError($responseCode, $responseBody) 882 | { 883 | $errorMessage = 'Unknown error: ' . $responseCode; 884 | 885 | if ($responseBody && array_key_exists('error', $responseBody)) 886 | { 887 | $errorMessage = $responseBody['error']['message']; 888 | } 889 | 890 | throw new WebshopappApiException($errorMessage, $responseCode); 891 | } 892 | 893 | /** 894 | * @param resource $curlHandle 895 | * 896 | * @throws WebshopappApiException 897 | */ 898 | private function handleCurlError($curlHandle) 899 | { 900 | $errorMessage = 'Curl error: ' . curl_error($curlHandle); 901 | 902 | throw new WebshopappApiException($errorMessage, curl_errno($curlHandle)); 903 | } 904 | 905 | /** 906 | * @param string $url 907 | * @param array $payload 908 | * @param array $options 909 | * 910 | * @return array 911 | * @throws WebshopappApiException 912 | */ 913 | public function create($url, $payload, $options = []) 914 | { 915 | return $this->sendRequest($url, 'post', $payload, $options); 916 | } 917 | 918 | /** 919 | * @param string $url 920 | * @param array $params 921 | * 922 | * @return array 923 | * @throws WebshopappApiException 924 | */ 925 | public function read($url, $params = array()) 926 | { 927 | return $this->sendRequest($url, 'get', $params); 928 | } 929 | 930 | /** 931 | * @param string $url 932 | * @param array $payload 933 | * @param array $options 934 | * 935 | * @return array 936 | * @throws WebshopappApiException 937 | */ 938 | public function update($url, $payload, $options = []) 939 | { 940 | return $this->sendRequest($url, 'put', $payload, $options); 941 | } 942 | 943 | /** 944 | * @param string $url 945 | * 946 | * @return array 947 | * @throws WebshopappApiException 948 | */ 949 | public function delete($url) 950 | { 951 | return $this->sendRequest($url, 'delete'); 952 | } 953 | } 954 | 955 | class WebshopappApiException extends Exception 956 | { 957 | } 958 | 959 | class WebshopappApiResourceAccount 960 | { 961 | /** 962 | * @var WebshopappApiClient 963 | */ 964 | private $client; 965 | 966 | public function __construct(WebshopappApiClient $client) 967 | { 968 | $this->client = $client; 969 | } 970 | 971 | /** 972 | * @return array 973 | * @throws WebshopappApiException 974 | */ 975 | public function get() 976 | { 977 | return $this->client->read('account'); 978 | } 979 | } 980 | 981 | class WebshopappApiResourceAccountMetafields 982 | { 983 | /** 984 | * @var WebshopappApiClient 985 | */ 986 | private $client; 987 | 988 | public function __construct(WebshopappApiClient $client) 989 | { 990 | $this->client = $client; 991 | } 992 | 993 | /** 994 | * @param int $metafieldId 995 | * @param array $params 996 | * 997 | * @return array 998 | * @throws WebshopappApiException 999 | */ 1000 | public function get($metafieldId = null, $params = array()) 1001 | { 1002 | if (!$metafieldId) 1003 | { 1004 | return $this->client->read('account/metafields', $params); 1005 | } 1006 | else 1007 | { 1008 | return $this->client->read('account/metafields/' . $metafieldId, $params); 1009 | } 1010 | } 1011 | 1012 | /** 1013 | * @param array $params 1014 | * 1015 | * @return int 1016 | * @throws WebshopappApiException 1017 | */ 1018 | public function count($params = array()) 1019 | { 1020 | return $this->client->read('account/metafields/count', $params); 1021 | } 1022 | } 1023 | 1024 | class WebshopappApiResourceAccountPermissions 1025 | { 1026 | /** 1027 | * @var WebshopappApiClient 1028 | */ 1029 | private $client; 1030 | 1031 | public function __construct(WebshopappApiClient $client) 1032 | { 1033 | $this->client = $client; 1034 | } 1035 | 1036 | /** 1037 | * @return array 1038 | * @throws WebshopappApiException 1039 | */ 1040 | public function get() 1041 | { 1042 | return $this->client->read('account/permissions'); 1043 | } 1044 | } 1045 | 1046 | class WebshopappApiResourceAccountRatelimit 1047 | { 1048 | /** 1049 | * @var WebshopappApiClient 1050 | */ 1051 | private $client; 1052 | 1053 | public function __construct(WebshopappApiClient $client) 1054 | { 1055 | $this->client = $client; 1056 | } 1057 | 1058 | /** 1059 | * @return array 1060 | * @throws WebshopappApiException 1061 | */ 1062 | public function get() 1063 | { 1064 | return $this->client->read('account/ratelimit'); 1065 | } 1066 | } 1067 | 1068 | class WebshopappApiResourceAdditionalcosts 1069 | { 1070 | /** 1071 | * @var WebshopappApiClient 1072 | */ 1073 | private $client; 1074 | 1075 | public function __construct(WebshopappApiClient $client) 1076 | { 1077 | $this->client = $client; 1078 | } 1079 | 1080 | /** 1081 | * @param int $additionalcostId 1082 | * @param array $params 1083 | * 1084 | * @return array 1085 | * @throws WebshopappApiException 1086 | */ 1087 | public function get($additionalcostId = null, $params = array()) 1088 | { 1089 | if (!$additionalcostId) 1090 | { 1091 | return $this->client->read('additionalcosts', $params); 1092 | } 1093 | else 1094 | { 1095 | return $this->client->read('additionalcosts/' . $additionalcostId, $params); 1096 | } 1097 | } 1098 | 1099 | /** 1100 | * @param array $params 1101 | * 1102 | * @return int 1103 | * @throws WebshopappApiException 1104 | */ 1105 | public function count($params = array()) 1106 | { 1107 | return $this->client->read('additionalcosts/count', $params); 1108 | } 1109 | 1110 | /** 1111 | * @param int $additionalcostId 1112 | * @param array $fields 1113 | * 1114 | * @return array 1115 | * @throws WebshopappApiException 1116 | */ 1117 | public function update($additionalcostId, $fields) 1118 | { 1119 | $fields = array('additionalCost' => $fields); 1120 | 1121 | return $this->client->update('additionalcosts/' . $additionalcostId, $fields); 1122 | } 1123 | 1124 | /** 1125 | * @param int $additionalcostId 1126 | * 1127 | * @return array 1128 | * @throws WebshopappApiException 1129 | */ 1130 | public function delete($additionalcostId) 1131 | { 1132 | return $this->client->delete('additionalcosts/' . $additionalcostId); 1133 | } 1134 | } 1135 | 1136 | class WebshopappApiResourceAttributes 1137 | { 1138 | /** 1139 | * @var WebshopappApiClient 1140 | */ 1141 | private $client; 1142 | 1143 | public function __construct(WebshopappApiClient $client) 1144 | { 1145 | $this->client = $client; 1146 | } 1147 | 1148 | /** 1149 | * @param array $fields 1150 | * 1151 | * @return array 1152 | * @throws WebshopappApiException 1153 | */ 1154 | public function create($fields) 1155 | { 1156 | $fields = array('attribute' => $fields); 1157 | 1158 | return $this->client->create('attributes', $fields); 1159 | } 1160 | 1161 | /** 1162 | * @param int $attributeId 1163 | * @param array $params 1164 | * 1165 | * @return array 1166 | * @throws WebshopappApiException 1167 | */ 1168 | public function get($attributeId = null, $params = array()) 1169 | { 1170 | if (!$attributeId) 1171 | { 1172 | return $this->client->read('attributes', $params); 1173 | } 1174 | else 1175 | { 1176 | return $this->client->read('attributes/' . $attributeId, $params); 1177 | } 1178 | } 1179 | 1180 | /** 1181 | * @param array $params 1182 | * 1183 | * @return int 1184 | * @throws WebshopappApiException 1185 | */ 1186 | public function count($params = array()) 1187 | { 1188 | return $this->client->read('attributes/count', $params); 1189 | } 1190 | 1191 | /** 1192 | * @param int $attributeId 1193 | * @param array $fields 1194 | * 1195 | * @return array 1196 | * @throws WebshopappApiException 1197 | */ 1198 | public function update($attributeId, $fields) 1199 | { 1200 | $fields = array('attribute' => $fields); 1201 | 1202 | return $this->client->update('attributes/' . $attributeId, $fields); 1203 | } 1204 | 1205 | /** 1206 | * @param int $attributeId 1207 | * 1208 | * @return array 1209 | * @throws WebshopappApiException 1210 | */ 1211 | public function delete($attributeId) 1212 | { 1213 | return $this->client->delete('attributes/' . $attributeId); 1214 | } 1215 | } 1216 | 1217 | class WebshopappApiResourceBlogs 1218 | { 1219 | /** 1220 | * @var WebshopappApiClient 1221 | */ 1222 | private $client; 1223 | 1224 | public function __construct(WebshopappApiClient $client) 1225 | { 1226 | $this->client = $client; 1227 | } 1228 | 1229 | /** 1230 | * @param array $fields 1231 | * 1232 | * @return array 1233 | * @throws WebshopappApiException 1234 | */ 1235 | public function create($fields) 1236 | { 1237 | $fields = array('blog' => $fields); 1238 | 1239 | return $this->client->create('blogs', $fields); 1240 | } 1241 | 1242 | /** 1243 | * @param int $blogId 1244 | * @param array $params 1245 | * 1246 | * @return array 1247 | * @throws WebshopappApiException 1248 | */ 1249 | public function get($blogId = null, $params = array()) 1250 | { 1251 | if (!$blogId) 1252 | { 1253 | return $this->client->read('blogs', $params); 1254 | } 1255 | else 1256 | { 1257 | return $this->client->read('blogs/' . $blogId, $params); 1258 | } 1259 | } 1260 | 1261 | /** 1262 | * @param array $params 1263 | * 1264 | * @return int 1265 | * @throws WebshopappApiException 1266 | */ 1267 | public function count($params = array()) 1268 | { 1269 | return $this->client->read('blogs/count', $params); 1270 | } 1271 | 1272 | /** 1273 | * @param int $blogId 1274 | * @param array $fields 1275 | * 1276 | * @return array 1277 | * @throws WebshopappApiException 1278 | */ 1279 | public function update($blogId, $fields) 1280 | { 1281 | $fields = array('blog' => $fields); 1282 | 1283 | return $this->client->update('blogs/' . $blogId, $fields); 1284 | } 1285 | 1286 | /** 1287 | * @param int $blogId 1288 | * 1289 | * @return array 1290 | * @throws WebshopappApiException 1291 | */ 1292 | public function delete($blogId) 1293 | { 1294 | return $this->client->delete('blogs/' . $blogId); 1295 | } 1296 | } 1297 | 1298 | class WebshopappApiResourceBlogsArticles 1299 | { 1300 | /** 1301 | * @var WebshopappApiClient 1302 | */ 1303 | private $client; 1304 | 1305 | public function __construct(WebshopappApiClient $client) 1306 | { 1307 | $this->client = $client; 1308 | } 1309 | 1310 | /** 1311 | * @param array $fields 1312 | * 1313 | * @return array 1314 | * @throws WebshopappApiException 1315 | */ 1316 | public function create($fields) 1317 | { 1318 | $fields = array('blogArticle' => $fields); 1319 | 1320 | return $this->client->create('blogs/articles', $fields); 1321 | } 1322 | 1323 | /** 1324 | * @param int $articleId 1325 | * @param array $params 1326 | * 1327 | * @return array 1328 | * @throws WebshopappApiException 1329 | */ 1330 | public function get($articleId = null, $params = array()) 1331 | { 1332 | if (!$articleId) 1333 | { 1334 | return $this->client->read('blogs/articles', $params); 1335 | } 1336 | else 1337 | { 1338 | return $this->client->read('blogs/articles/' . $articleId, $params); 1339 | } 1340 | } 1341 | 1342 | /** 1343 | * @param array $params 1344 | * 1345 | * @return int 1346 | * @throws WebshopappApiException 1347 | */ 1348 | public function count($params = array()) 1349 | { 1350 | return $this->client->read('blogs/articles/count', $params); 1351 | } 1352 | 1353 | /** 1354 | * @param int $articleId 1355 | * @param array $fields 1356 | * 1357 | * @return array 1358 | * @throws WebshopappApiException 1359 | */ 1360 | public function update($articleId, $fields) 1361 | { 1362 | $fields = array('blogArticle' => $fields); 1363 | 1364 | return $this->client->update('blogs/articles/' . $articleId, $fields); 1365 | } 1366 | 1367 | /** 1368 | * @param int $articleId 1369 | * 1370 | * @return array 1371 | * @throws WebshopappApiException 1372 | */ 1373 | public function delete($articleId) 1374 | { 1375 | return $this->client->delete('blogs/articles/' . $articleId); 1376 | } 1377 | } 1378 | 1379 | class WebshopappApiResourceBlogsArticlesImage 1380 | { 1381 | /** 1382 | * @var WebshopappApiClient 1383 | */ 1384 | private $client; 1385 | 1386 | public function __construct(WebshopappApiClient $client) 1387 | { 1388 | $this->client = $client; 1389 | } 1390 | 1391 | /** 1392 | * @param int $articleId 1393 | * @param array $fields 1394 | * 1395 | * @return array 1396 | * @throws WebshopappApiException 1397 | */ 1398 | public function create($articleId, $fields) 1399 | { 1400 | if (strpos($fields['attachment'], 'http') === false) { 1401 | try { 1402 | $attachment = $fields['attachment']; 1403 | 1404 | new SplFileObject($attachment); 1405 | 1406 | $mimetype = mime_content_type($attachment); 1407 | $fields['attachment'] = new CURLFile($attachment, $mimetype); 1408 | 1409 | $options = [ 1410 | 'header' => 'multipart/form-data' 1411 | ]; 1412 | 1413 | return $this->client->create('blogs/articles/' . $articleId . '/image', $fields, $options); 1414 | } catch (RuntimeException $exception) { 1415 | // 1416 | } 1417 | } 1418 | 1419 | $fields = array('blogArticleImage' => $fields); 1420 | 1421 | return $this->client->create('blogs/articles/' . $articleId . '/image', $fields); 1422 | } 1423 | 1424 | /** 1425 | * @param int $articleId 1426 | * 1427 | * @return array 1428 | * @throws WebshopappApiException 1429 | */ 1430 | public function get($articleId) 1431 | { 1432 | return $this->client->read('blogs/articles/' . $articleId . '/image'); 1433 | } 1434 | 1435 | /** 1436 | * @param int $articleId 1437 | * 1438 | * @return array 1439 | * @throws WebshopappApiException 1440 | */ 1441 | public function delete($articleId) 1442 | { 1443 | return $this->client->delete('blogs/articles/' . $articleId . '/image'); 1444 | } 1445 | } 1446 | 1447 | class WebshopappApiResourceBlogsArticlesTags 1448 | { 1449 | /** 1450 | * @var WebshopappApiClient 1451 | */ 1452 | private $client; 1453 | 1454 | public function __construct(WebshopappApiClient $client) 1455 | { 1456 | $this->client = $client; 1457 | } 1458 | 1459 | /** 1460 | * @param array $fields 1461 | * 1462 | * @return array 1463 | * @throws WebshopappApiException 1464 | */ 1465 | public function create($fields) 1466 | { 1467 | $fields = array('blogArticleTag' => $fields); 1468 | 1469 | return $this->client->create('blogs/articles/tags', $fields); 1470 | } 1471 | 1472 | /** 1473 | * @param int $relationId 1474 | * @param array $params 1475 | * 1476 | * @return array 1477 | * @throws WebshopappApiException 1478 | */ 1479 | public function get($relationId = null, $params = array()) 1480 | { 1481 | if (!$relationId) 1482 | { 1483 | return $this->client->read('blogs/articles/tags', $params); 1484 | } 1485 | else 1486 | { 1487 | return $this->client->read('blogs/articles/tags/' . $relationId, $params); 1488 | } 1489 | } 1490 | 1491 | /** 1492 | * @param array $params 1493 | * 1494 | * @return int 1495 | * @throws WebshopappApiException 1496 | */ 1497 | public function count($params = array()) 1498 | { 1499 | return $this->client->read('blogs/articles/tags/count', $params); 1500 | } 1501 | 1502 | /** 1503 | * @param int $relationId 1504 | * 1505 | * @return array 1506 | * @throws WebshopappApiException 1507 | */ 1508 | public function delete($relationId) 1509 | { 1510 | return $this->client->delete('blogs/articles/tags/' . $relationId); 1511 | } 1512 | } 1513 | 1514 | class WebshopappApiResourceBlogsComments 1515 | { 1516 | /** 1517 | * @var WebshopappApiClient 1518 | */ 1519 | private $client; 1520 | 1521 | public function __construct(WebshopappApiClient $client) 1522 | { 1523 | $this->client = $client; 1524 | } 1525 | 1526 | /** 1527 | * @param array $fields 1528 | * 1529 | * @return array 1530 | * @throws WebshopappApiException 1531 | */ 1532 | public function create($fields) 1533 | { 1534 | $fields = array('blogComment' => $fields); 1535 | 1536 | return $this->client->create('blogs/comments', $fields); 1537 | } 1538 | 1539 | /** 1540 | * @param int $commentId 1541 | * @param array $params 1542 | * 1543 | * @return array 1544 | * @throws WebshopappApiException 1545 | */ 1546 | public function get($commentId = null, $params = array()) 1547 | { 1548 | if (!$commentId) 1549 | { 1550 | return $this->client->read('blogs/comments', $params); 1551 | } 1552 | else 1553 | { 1554 | return $this->client->read('blogs/comments/' . $commentId, $params); 1555 | } 1556 | } 1557 | 1558 | /** 1559 | * @param array $params 1560 | * 1561 | * @return int 1562 | * @throws WebshopappApiException 1563 | */ 1564 | public function count($params = array()) 1565 | { 1566 | return $this->client->read('blogs/comments/count', $params); 1567 | } 1568 | 1569 | /** 1570 | * @param int $commentId 1571 | * @param array $fields 1572 | * 1573 | * @return array 1574 | * @throws WebshopappApiException 1575 | */ 1576 | public function update($commentId, $fields) 1577 | { 1578 | $fields = array('blogComment' => $fields); 1579 | 1580 | return $this->client->update('blogs/comments/' . $commentId, $fields); 1581 | } 1582 | 1583 | /** 1584 | * @param int $commentId 1585 | * 1586 | * @return array 1587 | * @throws WebshopappApiException 1588 | */ 1589 | public function delete($commentId) 1590 | { 1591 | return $this->client->delete('blogs/comments/' . $commentId); 1592 | } 1593 | } 1594 | 1595 | class WebshopappApiResourceBlogsTags 1596 | { 1597 | /** 1598 | * @var WebshopappApiClient 1599 | */ 1600 | private $client; 1601 | 1602 | public function __construct(WebshopappApiClient $client) 1603 | { 1604 | $this->client = $client; 1605 | } 1606 | 1607 | /** 1608 | * @param array $fields 1609 | * 1610 | * @return array 1611 | * @throws WebshopappApiException 1612 | */ 1613 | public function create($fields) 1614 | { 1615 | $fields = array('blogTag' => $fields); 1616 | 1617 | return $this->client->create('blogs/tags', $fields); 1618 | } 1619 | 1620 | /** 1621 | * @param int $tagId 1622 | * @param array $params 1623 | * 1624 | * @return array 1625 | * @throws WebshopappApiException 1626 | */ 1627 | public function get($tagId = null, $params = array()) 1628 | { 1629 | if (!$tagId) 1630 | { 1631 | return $this->client->read('blogs/tags', $params); 1632 | } 1633 | else 1634 | { 1635 | return $this->client->read('blogs/tags/' . $tagId, $params); 1636 | } 1637 | } 1638 | 1639 | /** 1640 | * @param array $params 1641 | * 1642 | * @return int 1643 | * @throws WebshopappApiException 1644 | */ 1645 | public function count($params = array()) 1646 | { 1647 | return $this->client->read('blogs/tags/count', $params); 1648 | } 1649 | 1650 | /** 1651 | * @param int $tagId 1652 | * @param array $fields 1653 | * 1654 | * @return array 1655 | * @throws WebshopappApiException 1656 | */ 1657 | public function update($tagId, $fields) 1658 | { 1659 | $fields = array('blogTag' => $fields); 1660 | 1661 | return $this->client->update('blogs/tags/' . $tagId, $fields); 1662 | } 1663 | 1664 | /** 1665 | * @param int $tagId 1666 | * 1667 | * @return array 1668 | * @throws WebshopappApiException 1669 | */ 1670 | public function delete($tagId) 1671 | { 1672 | return $this->client->delete('blogs/tags/' . $tagId); 1673 | } 1674 | } 1675 | 1676 | class WebshopappApiResourceBrands 1677 | { 1678 | /** 1679 | * @var WebshopappApiClient 1680 | */ 1681 | private $client; 1682 | 1683 | public function __construct(WebshopappApiClient $client) 1684 | { 1685 | $this->client = $client; 1686 | } 1687 | 1688 | /** 1689 | * @param array $fields 1690 | * 1691 | * @return array 1692 | * @throws WebshopappApiException 1693 | */ 1694 | public function create($fields) 1695 | { 1696 | $fields = array('brand' => $fields); 1697 | 1698 | return $this->client->create('brands', $fields); 1699 | } 1700 | 1701 | /** 1702 | * @param int $brandId 1703 | * @param array $params 1704 | * 1705 | * @return array 1706 | * @throws WebshopappApiException 1707 | */ 1708 | public function get($brandId = null, $params = array()) 1709 | { 1710 | if (!$brandId) 1711 | { 1712 | return $this->client->read('brands', $params); 1713 | } 1714 | else 1715 | { 1716 | return $this->client->read('brands/' . $brandId, $params); 1717 | } 1718 | } 1719 | 1720 | /** 1721 | * @param array $params 1722 | * 1723 | * @return int 1724 | * @throws WebshopappApiException 1725 | */ 1726 | public function count($params = array()) 1727 | { 1728 | return $this->client->read('brands/count', $params); 1729 | } 1730 | 1731 | /** 1732 | * @param int $brandId 1733 | * @param array $fields 1734 | * 1735 | * @return array 1736 | * @throws WebshopappApiException 1737 | */ 1738 | public function update($brandId, $fields) 1739 | { 1740 | $fields = array('brand' => $fields); 1741 | 1742 | return $this->client->update('brands/' . $brandId, $fields); 1743 | } 1744 | 1745 | /** 1746 | * @param int $brandId 1747 | * 1748 | * @return array 1749 | * @throws WebshopappApiException 1750 | */ 1751 | public function delete($brandId) 1752 | { 1753 | return $this->client->delete('brands/' . $brandId); 1754 | } 1755 | } 1756 | 1757 | class WebshopappApiResourceBrandsImage 1758 | { 1759 | /** 1760 | * @var WebshopappApiClient 1761 | */ 1762 | private $client; 1763 | 1764 | public function __construct(WebshopappApiClient $client) 1765 | { 1766 | $this->client = $client; 1767 | } 1768 | 1769 | /** 1770 | * @param int $brandId 1771 | * @param array $fields 1772 | * 1773 | * @return array 1774 | * @throws WebshopappApiException 1775 | */ 1776 | public function create($brandId, $fields) 1777 | { 1778 | if (strpos($fields['attachment'], 'http') === false) { 1779 | try { 1780 | $attachment = $fields['attachment']; 1781 | 1782 | new SplFileObject($attachment); 1783 | 1784 | $mimetype = mime_content_type($attachment); 1785 | $fields['attachment'] = new CURLFile($attachment, $mimetype); 1786 | 1787 | $options = [ 1788 | 'header' => 'multipart/form-data' 1789 | ]; 1790 | 1791 | return $this->client->create('brands/' . $brandId . '/image', $fields, $options); 1792 | } catch (RuntimeException $exception) { 1793 | // 1794 | } 1795 | } 1796 | 1797 | $fields = array('brandImage' => $fields); 1798 | 1799 | return $this->client->create('brands/' . $brandId . '/image', $fields); 1800 | } 1801 | 1802 | /** 1803 | * @param int $brandId 1804 | * 1805 | * @return array 1806 | * @throws WebshopappApiException 1807 | */ 1808 | public function get($brandId) 1809 | { 1810 | return $this->client->read('brands/' . $brandId . '/image'); 1811 | } 1812 | 1813 | /** 1814 | * @param int $brandId 1815 | * 1816 | * @return array 1817 | * @throws WebshopappApiException 1818 | */ 1819 | public function delete($brandId) 1820 | { 1821 | return $this->client->delete('brands/' . $brandId . '/image'); 1822 | } 1823 | } 1824 | 1825 | class WebshopappApiResourceCatalog 1826 | { 1827 | /** 1828 | * @var WebshopappApiClient 1829 | */ 1830 | private $client; 1831 | 1832 | public function __construct(WebshopappApiClient $client) 1833 | { 1834 | $this->client = $client; 1835 | } 1836 | 1837 | /** 1838 | * @param int $productId 1839 | * @param array $params 1840 | * 1841 | * @return array 1842 | * @throws WebshopappApiException 1843 | */ 1844 | public function get($productId = null, $params = array()) 1845 | { 1846 | if (!$productId) 1847 | { 1848 | return $this->client->read('catalog', $params); 1849 | } 1850 | else 1851 | { 1852 | return $this->client->read('catalog/' . $productId, $params); 1853 | } 1854 | } 1855 | 1856 | /** 1857 | * @param array $params 1858 | * 1859 | * @return int 1860 | * @throws WebshopappApiException 1861 | */ 1862 | public function count($params = array()) 1863 | { 1864 | return $this->client->read('catalog/count', $params); 1865 | } 1866 | } 1867 | 1868 | class WebshopappApiResourceCategories 1869 | { 1870 | /** 1871 | * @var WebshopappApiClient 1872 | */ 1873 | private $client; 1874 | 1875 | public function __construct(WebshopappApiClient $client) 1876 | { 1877 | $this->client = $client; 1878 | } 1879 | 1880 | /** 1881 | * @param array $fields 1882 | * 1883 | * @return array 1884 | * @throws WebshopappApiException 1885 | */ 1886 | public function create($fields) 1887 | { 1888 | $fields = array('category' => $fields); 1889 | 1890 | return $this->client->create('categories', $fields); 1891 | } 1892 | 1893 | /** 1894 | * @param int $categoryId 1895 | * @param array $params 1896 | * 1897 | * @return array 1898 | * @throws WebshopappApiException 1899 | */ 1900 | public function get($categoryId = null, $params = array()) 1901 | { 1902 | if (!$categoryId) 1903 | { 1904 | return $this->client->read('categories', $params); 1905 | } 1906 | else 1907 | { 1908 | return $this->client->read('categories/' . $categoryId, $params); 1909 | } 1910 | } 1911 | 1912 | /** 1913 | * @param array $params 1914 | * 1915 | * @return int 1916 | * @throws WebshopappApiException 1917 | */ 1918 | public function count($params = array()) 1919 | { 1920 | return $this->client->read('categories/count', $params); 1921 | } 1922 | 1923 | /** 1924 | * @param int $categoryId 1925 | * @param array $fields 1926 | * 1927 | * @return array 1928 | * @throws WebshopappApiException 1929 | */ 1930 | public function update($categoryId, $fields) 1931 | { 1932 | $fields = array('category' => $fields); 1933 | 1934 | return $this->client->update('categories/' . $categoryId, $fields); 1935 | } 1936 | 1937 | /** 1938 | * @param int $categoryId 1939 | * 1940 | * @return array 1941 | * @throws WebshopappApiException 1942 | */ 1943 | public function delete($categoryId) 1944 | { 1945 | return $this->client->delete('categories/' . $categoryId); 1946 | } 1947 | } 1948 | 1949 | class WebshopappApiResourceCategoriesImage 1950 | { 1951 | /** 1952 | * @var WebshopappApiClient 1953 | */ 1954 | private $client; 1955 | 1956 | public function __construct(WebshopappApiClient $client) 1957 | { 1958 | $this->client = $client; 1959 | } 1960 | 1961 | /** 1962 | * @param int $categoryId 1963 | * @param array $fields 1964 | * 1965 | * @return array 1966 | * @throws WebshopappApiException 1967 | */ 1968 | public function create($categoryId, $fields) 1969 | { 1970 | if (strpos($fields['attachment'], 'http') === false) { 1971 | try { 1972 | $attachment = $fields['attachment']; 1973 | 1974 | new SplFileObject($attachment); 1975 | 1976 | $mimetype = mime_content_type($attachment); 1977 | $fields['attachment'] = new CURLFile($attachment, $mimetype); 1978 | 1979 | $options = [ 1980 | 'header' => 'multipart/form-data' 1981 | ]; 1982 | 1983 | return $this->client->create('categories/' . $categoryId . '/image', $fields, $options); 1984 | } catch (RuntimeException $exception) { 1985 | // 1986 | } 1987 | } 1988 | 1989 | $fields = array('categoryImage' => $fields); 1990 | 1991 | return $this->client->create('categories/' . $categoryId . '/image', $fields); 1992 | } 1993 | 1994 | /** 1995 | * @param int $categoryId 1996 | * 1997 | * @return array 1998 | * @throws WebshopappApiException 1999 | */ 2000 | public function get($categoryId) 2001 | { 2002 | return $this->client->read('categories/' . $categoryId . '/image'); 2003 | } 2004 | 2005 | /** 2006 | * @param int $categoryId 2007 | * 2008 | * @return array 2009 | * @throws WebshopappApiException 2010 | */ 2011 | public function delete($categoryId) 2012 | { 2013 | return $this->client->delete('categories/' . $categoryId . '/image'); 2014 | } 2015 | } 2016 | 2017 | class WebshopappApiResourceCategoriesProducts 2018 | { 2019 | /** 2020 | * @var WebshopappApiClient 2021 | */ 2022 | private $client; 2023 | 2024 | public function __construct(WebshopappApiClient $client) 2025 | { 2026 | $this->client = $client; 2027 | } 2028 | 2029 | /** 2030 | * @param array $fields 2031 | * 2032 | * @return array 2033 | * @throws WebshopappApiException 2034 | */ 2035 | public function create($fields) 2036 | { 2037 | $fields = array('categoriesProduct' => $fields); 2038 | 2039 | return $this->client->create('categories/products', $fields); 2040 | } 2041 | 2042 | /** 2043 | * @param int $relationId 2044 | * @param array $params 2045 | * 2046 | * @return array 2047 | * @throws WebshopappApiException 2048 | */ 2049 | public function get($relationId = null, $params = array()) 2050 | { 2051 | if (!$relationId) 2052 | { 2053 | return $this->client->read('categories/products', $params); 2054 | } 2055 | else 2056 | { 2057 | return $this->client->read('categories/products/' . $relationId, $params); 2058 | } 2059 | } 2060 | 2061 | /** 2062 | * @param array $params 2063 | * 2064 | * @return int 2065 | * @throws WebshopappApiException 2066 | */ 2067 | public function count($params = array()) 2068 | { 2069 | return $this->client->read('categories/products/count', $params); 2070 | } 2071 | 2072 | /** 2073 | * @param int $relationId 2074 | * 2075 | * @return array 2076 | * @throws WebshopappApiException 2077 | */ 2078 | public function delete($relationId) 2079 | { 2080 | return $this->client->delete('categories/products/' . $relationId); 2081 | } 2082 | } 2083 | 2084 | class WebshopappApiResourceCategoriesProductsBulk 2085 | { 2086 | /** 2087 | * @var WebshopappApiClient 2088 | */ 2089 | private $client; 2090 | 2091 | public function __construct(WebshopappApiClient $client) 2092 | { 2093 | $this->client = $client; 2094 | } 2095 | 2096 | /** 2097 | * @param array $fields 2098 | * 2099 | * @return array 2100 | * @throws WebshopappApiException 2101 | */ 2102 | public function create($fields) 2103 | { 2104 | $fields = array('categoriesProduct' => $fields); 2105 | 2106 | return $this->client->create('categories/products/bulk', $fields); 2107 | } 2108 | } 2109 | 2110 | class WebshopappApiResourceCheckouts 2111 | { 2112 | /** 2113 | * @var WebshopappApiClient 2114 | */ 2115 | private $client; 2116 | 2117 | public function __construct(WebshopappApiClient $client) 2118 | { 2119 | $this->client = $client; 2120 | } 2121 | 2122 | /** 2123 | * @param array $fields 2124 | * 2125 | * @return array 2126 | * @throws WebshopappApiException 2127 | */ 2128 | public function create($fields) 2129 | { 2130 | return $this->client->create('checkouts', $fields); 2131 | } 2132 | 2133 | /** 2134 | * @param int $checkoutId 2135 | * @param array $params 2136 | * 2137 | * @return array 2138 | * @throws WebshopappApiException 2139 | */ 2140 | public function get($checkoutId = null, $params = array()) 2141 | { 2142 | if (!$checkoutId) 2143 | { 2144 | return $this->client->read('checkouts', $params); 2145 | } 2146 | else 2147 | { 2148 | return $this->client->read('checkouts/' . $checkoutId, $params); 2149 | } 2150 | } 2151 | 2152 | /** 2153 | * @param array $params 2154 | * 2155 | * @return int 2156 | * @throws WebshopappApiException 2157 | */ 2158 | public function count($params = array()) 2159 | { 2160 | return $this->client->read('checkouts/count', $params); 2161 | } 2162 | 2163 | /** 2164 | * @param int $checkoutId 2165 | * @param array $fields 2166 | * 2167 | * @return array 2168 | * @throws WebshopappApiException 2169 | */ 2170 | public function update($checkoutId, $fields) 2171 | { 2172 | return $this->client->update('checkouts/' . $checkoutId, $fields); 2173 | } 2174 | 2175 | /** 2176 | * @param int $checkoutId 2177 | * 2178 | * @return array 2179 | * @throws WebshopappApiException 2180 | */ 2181 | public function delete($checkoutId) 2182 | { 2183 | return $this->client->delete('checkouts/' . $checkoutId); 2184 | } 2185 | } 2186 | 2187 | class WebshopappApiResourceCheckoutsOrder 2188 | { 2189 | /** 2190 | * @var WebshopappApiClient 2191 | */ 2192 | private $client; 2193 | 2194 | public function __construct(WebshopappApiClient $client) 2195 | { 2196 | $this->client = $client; 2197 | } 2198 | 2199 | /** 2200 | * @param int $checkoutId 2201 | * @param array $fields 2202 | * 2203 | * @return array 2204 | * @throws WebshopappApiException 2205 | */ 2206 | public function create($checkoutId, $fields) 2207 | { 2208 | return $this->client->create('checkouts/' . $checkoutId . '/order', $fields); 2209 | } 2210 | } 2211 | 2212 | class WebshopappApiResourceCheckoutsPayment_methods 2213 | { 2214 | /** 2215 | * @var WebshopappApiClient 2216 | */ 2217 | private $client; 2218 | 2219 | public function __construct(WebshopappApiClient $client) 2220 | { 2221 | $this->client = $client; 2222 | } 2223 | 2224 | /** 2225 | * @param int $checkoutId 2226 | * 2227 | * @return array 2228 | * @throws WebshopappApiException 2229 | */ 2230 | public function get($checkoutId) 2231 | { 2232 | return $this->client->read('checkouts/' . $checkoutId . '/payment_methods'); 2233 | } 2234 | } 2235 | 2236 | class WebshopappApiResourceCheckoutsProducts 2237 | { 2238 | /** 2239 | * @var WebshopappApiClient 2240 | */ 2241 | private $client; 2242 | 2243 | public function __construct(WebshopappApiClient $client) 2244 | { 2245 | $this->client = $client; 2246 | } 2247 | 2248 | /** 2249 | * @param int $checkoutId 2250 | * @param array $fields 2251 | * 2252 | * @return array 2253 | * @throws WebshopappApiException 2254 | */ 2255 | public function create($checkoutId, $fields) 2256 | { 2257 | return $this->client->create('checkouts/' . $checkoutId . '/products', $fields); 2258 | } 2259 | 2260 | /** 2261 | * @param int $checkoutId 2262 | * @param int $productId 2263 | * @param array $params 2264 | * 2265 | * @return array 2266 | * @throws WebshopappApiException 2267 | */ 2268 | public function get($checkoutId, $productId = null, $params = array()) 2269 | { 2270 | if (!$productId) 2271 | { 2272 | return $this->client->read('checkouts/' . $checkoutId . '/products', $params); 2273 | } 2274 | else 2275 | { 2276 | return $this->client->read('checkouts/' . $checkoutId . '/products/' . $productId, $params); 2277 | } 2278 | } 2279 | 2280 | /** 2281 | * @param int $checkoutId 2282 | * @param array $params 2283 | * 2284 | * @return int 2285 | * @throws WebshopappApiException 2286 | */ 2287 | public function count($checkoutId, $params = array()) 2288 | { 2289 | return $this->client->read('checkouts/' . $checkoutId . '/products/count', $params); 2290 | } 2291 | 2292 | /** 2293 | * @param int $checkoutId 2294 | * @param int $productId 2295 | * @param array $fields 2296 | * 2297 | * @return array 2298 | * @throws WebshopappApiException 2299 | */ 2300 | public function update($checkoutId, $productId, $fields) 2301 | { 2302 | return $this->client->update('checkouts/' . $checkoutId . '/products/' . $productId, $fields); 2303 | } 2304 | 2305 | /** 2306 | * @param int $checkoutId 2307 | * @param int $productId 2308 | * 2309 | * @return array 2310 | * @throws WebshopappApiException 2311 | */ 2312 | public function delete($checkoutId, $productId) 2313 | { 2314 | return $this->client->delete('checkouts/' . $checkoutId . '/products/' . $productId); 2315 | } 2316 | } 2317 | 2318 | class WebshopappApiResourceCheckoutsShipment_methods 2319 | { 2320 | /** 2321 | * @var WebshopappApiClient 2322 | */ 2323 | private $client; 2324 | 2325 | public function __construct(WebshopappApiClient $client) 2326 | { 2327 | $this->client = $client; 2328 | } 2329 | 2330 | /** 2331 | * @param int $checkoutId 2332 | * 2333 | * @return array 2334 | * @throws WebshopappApiException 2335 | */ 2336 | public function get($checkoutId) 2337 | { 2338 | return $this->client->read('checkouts/' . $checkoutId . '/shipment_methods'); 2339 | } 2340 | } 2341 | 2342 | class WebshopappApiResourceCheckoutsValidate 2343 | { 2344 | /** 2345 | * @var WebshopappApiClient 2346 | */ 2347 | private $client; 2348 | 2349 | public function __construct(WebshopappApiClient $client) 2350 | { 2351 | $this->client = $client; 2352 | } 2353 | 2354 | /** 2355 | * @param int $checkoutId 2356 | * 2357 | * @return array 2358 | * @throws WebshopappApiException 2359 | */ 2360 | public function get($checkoutId) 2361 | { 2362 | return $this->client->read('checkouts/' . $checkoutId . '/validate'); 2363 | } 2364 | } 2365 | 2366 | class WebshopappApiResourceContacts 2367 | { 2368 | /** 2369 | * @var WebshopappApiClient 2370 | */ 2371 | private $client; 2372 | 2373 | public function __construct(WebshopappApiClient $client) 2374 | { 2375 | $this->client = $client; 2376 | } 2377 | 2378 | /** 2379 | * @param int $contactId 2380 | * @param array $params 2381 | * 2382 | * @return array 2383 | * @throws WebshopappApiException 2384 | */ 2385 | public function get($contactId = null, $params = array()) 2386 | { 2387 | if (!$contactId) 2388 | { 2389 | return $this->client->read('contacts', $params); 2390 | } 2391 | else 2392 | { 2393 | return $this->client->read('contacts/' . $contactId, $params); 2394 | } 2395 | } 2396 | 2397 | /** 2398 | * @param array $params 2399 | * 2400 | * @return int 2401 | * @throws WebshopappApiException 2402 | */ 2403 | public function count($params = array()) 2404 | { 2405 | return $this->client->read('contacts/count', $params); 2406 | } 2407 | } 2408 | 2409 | class WebshopappApiResourceCountries 2410 | { 2411 | /** 2412 | * @var WebshopappApiClient 2413 | */ 2414 | private $client; 2415 | 2416 | public function __construct(WebshopappApiClient $client) 2417 | { 2418 | $this->client = $client; 2419 | } 2420 | 2421 | /** 2422 | * @param int $countryId 2423 | * @param array $params 2424 | * 2425 | * @return array 2426 | * @throws WebshopappApiException 2427 | */ 2428 | public function get($countryId = null, $params = array()) 2429 | { 2430 | if (!$countryId) 2431 | { 2432 | return $this->client->read('countries', $params); 2433 | } 2434 | else 2435 | { 2436 | return $this->client->read('countries/' . $countryId, $params); 2437 | } 2438 | } 2439 | 2440 | /** 2441 | * @param array $params 2442 | * 2443 | * @return int 2444 | * @throws WebshopappApiException 2445 | */ 2446 | public function count($params = array()) 2447 | { 2448 | return $this->client->read('countries/count', $params); 2449 | } 2450 | } 2451 | 2452 | class WebshopappApiResourceCustomers 2453 | { 2454 | /** 2455 | * @var WebshopappApiClient 2456 | */ 2457 | private $client; 2458 | 2459 | public function __construct(WebshopappApiClient $client) 2460 | { 2461 | $this->client = $client; 2462 | } 2463 | 2464 | /** 2465 | * @param array $fields 2466 | * 2467 | * @return array 2468 | * @throws WebshopappApiException 2469 | */ 2470 | public function create($fields) 2471 | { 2472 | $fields = array('customer' => $fields); 2473 | 2474 | return $this->client->create('customers', $fields); 2475 | } 2476 | 2477 | /** 2478 | * @param int $customerId 2479 | * @param array $params 2480 | * 2481 | * @return array 2482 | * @throws WebshopappApiException 2483 | */ 2484 | public function get($customerId = null, $params = array()) 2485 | { 2486 | if (!$customerId) 2487 | { 2488 | return $this->client->read('customers', $params); 2489 | } 2490 | else 2491 | { 2492 | return $this->client->read('customers/' . $customerId, $params); 2493 | } 2494 | } 2495 | 2496 | /** 2497 | * @param array $params 2498 | * 2499 | * @return int 2500 | * @throws WebshopappApiException 2501 | */ 2502 | public function count($params = array()) 2503 | { 2504 | return $this->client->read('customers/count', $params); 2505 | } 2506 | 2507 | /** 2508 | * @param int $customerId 2509 | * @param array $fields 2510 | * 2511 | * @return array 2512 | * @throws WebshopappApiException 2513 | */ 2514 | public function update($customerId, $fields) 2515 | { 2516 | $fields = array('customer' => $fields); 2517 | 2518 | return $this->client->update('customers/' . $customerId, $fields); 2519 | } 2520 | 2521 | /** 2522 | * @param int $customerId 2523 | * 2524 | * @return array 2525 | * @throws WebshopappApiException 2526 | */ 2527 | public function delete($customerId) 2528 | { 2529 | return $this->client->delete('customers/' . $customerId); 2530 | } 2531 | } 2532 | 2533 | class WebshopappApiResourceCustomersLogin 2534 | { 2535 | /** 2536 | * @var WebshopappApiClient 2537 | */ 2538 | private $client; 2539 | 2540 | public function __construct(WebshopappApiClient $client) 2541 | { 2542 | $this->client = $client; 2543 | } 2544 | 2545 | /** 2546 | * @param int $customerId 2547 | * @param array $fields 2548 | * 2549 | * @return array 2550 | * @throws WebshopappApiException 2551 | */ 2552 | public function create($customerId, $fields) 2553 | { 2554 | $fields = array('customerLogin' => $fields); 2555 | 2556 | return $this->client->create('customers/' . $customerId . '/login', $fields); 2557 | } 2558 | } 2559 | 2560 | class WebshopappApiResourceCustomersMetafields 2561 | { 2562 | /** 2563 | * @var WebshopappApiClient 2564 | */ 2565 | private $client; 2566 | 2567 | public function __construct(WebshopappApiClient $client) 2568 | { 2569 | $this->client = $client; 2570 | } 2571 | 2572 | /** 2573 | * @param int $customerId 2574 | * @param array $fields 2575 | * 2576 | * @return array 2577 | * @throws WebshopappApiException 2578 | */ 2579 | public function create($customerId, $fields) 2580 | { 2581 | $fields = array('customerMetafield' => $fields); 2582 | 2583 | return $this->client->create('customers/' . $customerId . '/metafields', $fields); 2584 | } 2585 | 2586 | /** 2587 | * @param int $customerId 2588 | * @param int $metafieldId 2589 | * @param array $params 2590 | * 2591 | * @return array 2592 | * @throws WebshopappApiException 2593 | */ 2594 | public function get($customerId, $metafieldId = null, $params = array()) 2595 | { 2596 | if (!$metafieldId) 2597 | { 2598 | return $this->client->read('customers/' . $customerId . '/metafields', $params); 2599 | } 2600 | else 2601 | { 2602 | return $this->client->read('customers/' . $customerId . '/metafields/' . $metafieldId, $params); 2603 | } 2604 | } 2605 | 2606 | /** 2607 | * @param int $customerId 2608 | * @param array $params 2609 | * 2610 | * @return int 2611 | * @throws WebshopappApiException 2612 | */ 2613 | public function count($customerId, $params = array()) 2614 | { 2615 | return $this->client->read('customers/' . $customerId . '/metafields/count', $params); 2616 | } 2617 | 2618 | /** 2619 | * @param int $customerId 2620 | * @param int $metafieldId 2621 | * @param array $fields 2622 | * 2623 | * @return array 2624 | * @throws WebshopappApiException 2625 | */ 2626 | public function update($customerId, $metafieldId, $fields) 2627 | { 2628 | $fields = array('customerMetafield' => $fields); 2629 | 2630 | return $this->client->update('customers/' . $customerId . '/metafields/' . $metafieldId, $fields); 2631 | } 2632 | 2633 | /** 2634 | * @param int $customerId 2635 | * @param int $metafieldId 2636 | * 2637 | * @return array 2638 | * @throws WebshopappApiException 2639 | */ 2640 | public function delete($customerId, $metafieldId) 2641 | { 2642 | return $this->client->delete('customers/' . $customerId . '/metafields/' . $metafieldId); 2643 | } 2644 | } 2645 | 2646 | class WebshopappApiResourceCustomersTokens 2647 | { 2648 | /** 2649 | * @var WebshopappApiClient 2650 | */ 2651 | private $client; 2652 | 2653 | public function __construct(WebshopappApiClient $client) 2654 | { 2655 | $this->client = $client; 2656 | } 2657 | 2658 | /** 2659 | * @param int $customerId 2660 | * @param array $fields 2661 | * 2662 | * @return array 2663 | * @throws WebshopappApiException 2664 | */ 2665 | public function create($customerId, $fields) 2666 | { 2667 | $fields = array('customerToken' => $fields); 2668 | 2669 | return $this->client->create('customers/' . $customerId . '/tokens', $fields); 2670 | } 2671 | } 2672 | 2673 | class WebshopappApiResourceDashboard 2674 | { 2675 | /** 2676 | * @var WebshopappApiClient 2677 | */ 2678 | private $client; 2679 | 2680 | public function __construct(WebshopappApiClient $client) 2681 | { 2682 | $this->client = $client; 2683 | } 2684 | 2685 | /** 2686 | * @param array $params 2687 | * 2688 | * @return array 2689 | * @throws WebshopappApiException 2690 | */ 2691 | public function get($params = array()) 2692 | { 2693 | return $this->client->read('dashboard', $params); 2694 | } 2695 | } 2696 | 2697 | class WebshopappApiResourceDeliverydates 2698 | { 2699 | /** 2700 | * @var WebshopappApiClient 2701 | */ 2702 | private $client; 2703 | 2704 | public function __construct(WebshopappApiClient $client) 2705 | { 2706 | $this->client = $client; 2707 | } 2708 | 2709 | /** 2710 | * @param array $fields 2711 | * 2712 | * @return array 2713 | * @throws WebshopappApiException 2714 | */ 2715 | public function create($fields) 2716 | { 2717 | $fields = array('deliverydate' => $fields); 2718 | 2719 | return $this->client->create('deliverydates', $fields); 2720 | } 2721 | 2722 | /** 2723 | * @param int $deliverydateId 2724 | * @param array $params 2725 | * 2726 | * @return array 2727 | * @throws WebshopappApiException 2728 | */ 2729 | public function get($deliverydateId = null, $params = array()) 2730 | { 2731 | if (!$deliverydateId) 2732 | { 2733 | return $this->client->read('deliverydates', $params); 2734 | } 2735 | else 2736 | { 2737 | return $this->client->read('deliverydates/' . $deliverydateId, $params); 2738 | } 2739 | } 2740 | 2741 | /** 2742 | * @param array $params 2743 | * 2744 | * @return int 2745 | * @throws WebshopappApiException 2746 | */ 2747 | public function count($params = array()) 2748 | { 2749 | return $this->client->read('deliverydates/count', $params); 2750 | } 2751 | 2752 | /** 2753 | * @param int $deliverydateId 2754 | * @param array $fields 2755 | * 2756 | * @return array 2757 | * @throws WebshopappApiException 2758 | */ 2759 | public function update($deliverydateId, $fields) 2760 | { 2761 | $fields = array('deliverydate' => $fields); 2762 | 2763 | return $this->client->update('deliverydates/' . $deliverydateId, $fields); 2764 | } 2765 | 2766 | /** 2767 | * @param int $deliverydateId 2768 | * 2769 | * @return array 2770 | * @throws WebshopappApiException 2771 | */ 2772 | public function delete($deliverydateId) 2773 | { 2774 | return $this->client->delete('deliverydates/' . $deliverydateId); 2775 | } 2776 | } 2777 | 2778 | class WebshopappApiResourceDiscountrules 2779 | { 2780 | /** 2781 | * @var WebshopappApiClient 2782 | */ 2783 | private $client; 2784 | 2785 | public function __construct(WebshopappApiClient $client) 2786 | { 2787 | $this->client = $client; 2788 | } 2789 | 2790 | /** 2791 | * @param array $fields 2792 | * 2793 | * @return array 2794 | * @throws WebshopappApiException 2795 | */ 2796 | public function create($fields) 2797 | { 2798 | $fields = array('discountRule' => $fields); 2799 | 2800 | return $this->client->create('discountrules', $fields); 2801 | } 2802 | 2803 | /** 2804 | * @param int $discountruleId 2805 | * @param array $params 2806 | * 2807 | * @return array 2808 | * @throws WebshopappApiException 2809 | */ 2810 | public function get($discountruleId = null, $params = array()) 2811 | { 2812 | if (!$discountruleId) 2813 | { 2814 | return $this->client->read('discountrules', $params); 2815 | } 2816 | else 2817 | { 2818 | return $this->client->read('discountrules/' . $discountruleId, $params); 2819 | } 2820 | } 2821 | 2822 | /** 2823 | * @param array $params 2824 | * 2825 | * @return int 2826 | * @throws WebshopappApiException 2827 | */ 2828 | public function count($params = array()) 2829 | { 2830 | return $this->client->read('discountrules/count', $params); 2831 | } 2832 | 2833 | /** 2834 | * @param int $discountruleId 2835 | * @param array $fields 2836 | * 2837 | * @return array 2838 | * @throws WebshopappApiException 2839 | */ 2840 | public function update($discountruleId, $fields) 2841 | { 2842 | $fields = array('discountRule' => $fields); 2843 | 2844 | return $this->client->update('discountrules/' . $discountruleId, $fields); 2845 | } 2846 | 2847 | /** 2848 | * @param int $discountruleId 2849 | * 2850 | * @return array 2851 | * @throws WebshopappApiException 2852 | */ 2853 | public function delete($discountruleId) 2854 | { 2855 | return $this->client->delete('discountrules/' . $discountruleId); 2856 | } 2857 | } 2858 | 2859 | class WebshopappApiResourceDiscounts 2860 | { 2861 | /** 2862 | * @var WebshopappApiClient 2863 | */ 2864 | private $client; 2865 | 2866 | public function __construct(WebshopappApiClient $client) 2867 | { 2868 | $this->client = $client; 2869 | } 2870 | 2871 | /** 2872 | * @param array $fields 2873 | * 2874 | * @return array 2875 | * @throws WebshopappApiException 2876 | */ 2877 | public function create($fields) 2878 | { 2879 | $fields = array('discount' => $fields); 2880 | 2881 | return $this->client->create('discounts', $fields); 2882 | } 2883 | 2884 | /** 2885 | * @param int $discountId 2886 | * @param array $params 2887 | * 2888 | * @return array 2889 | * @throws WebshopappApiException 2890 | */ 2891 | public function get($discountId = null, $params = array()) 2892 | { 2893 | if (!$discountId) 2894 | { 2895 | return $this->client->read('discounts', $params); 2896 | } 2897 | else 2898 | { 2899 | return $this->client->read('discounts/' . $discountId, $params); 2900 | } 2901 | } 2902 | 2903 | /** 2904 | * @param array $params 2905 | * 2906 | * @return int 2907 | * @throws WebshopappApiException 2908 | */ 2909 | public function count($params = array()) 2910 | { 2911 | return $this->client->read('discounts/count', $params); 2912 | } 2913 | 2914 | /** 2915 | * @param int $discountId 2916 | * @param array $fields 2917 | * 2918 | * @return array 2919 | * @throws WebshopappApiException 2920 | */ 2921 | public function update($discountId, $fields) 2922 | { 2923 | $fields = array('discount' => $fields); 2924 | 2925 | return $this->client->update('discounts/' . $discountId, $fields); 2926 | } 2927 | 2928 | /** 2929 | * @param int $discountId 2930 | * 2931 | * @return array 2932 | * @throws WebshopappApiException 2933 | */ 2934 | public function delete($discountId) 2935 | { 2936 | return $this->client->delete('discounts/' . $discountId); 2937 | } 2938 | } 2939 | 2940 | class WebshopappApiResourceEvents 2941 | { 2942 | /** 2943 | * @var WebshopappApiClient 2944 | */ 2945 | private $client; 2946 | 2947 | public function __construct(WebshopappApiClient $client) 2948 | { 2949 | $this->client = $client; 2950 | } 2951 | 2952 | /** 2953 | * @param int $eventId 2954 | * @param array $params 2955 | * 2956 | * @return array 2957 | * @throws WebshopappApiException 2958 | */ 2959 | public function get($eventId = null, $params = array()) 2960 | { 2961 | if (!$eventId) 2962 | { 2963 | return $this->client->read('events', $params); 2964 | } 2965 | else 2966 | { 2967 | return $this->client->read('events/' . $eventId, $params); 2968 | } 2969 | } 2970 | 2971 | /** 2972 | * @param array $params 2973 | * 2974 | * @return int 2975 | * @throws WebshopappApiException 2976 | */ 2977 | public function count($params = array()) 2978 | { 2979 | return $this->client->read('events/count', $params); 2980 | } 2981 | 2982 | /** 2983 | * @param int $eventId 2984 | * 2985 | * @return array 2986 | * @throws WebshopappApiException 2987 | */ 2988 | public function delete($eventId) 2989 | { 2990 | return $this->client->delete('events/' . $eventId); 2991 | } 2992 | } 2993 | 2994 | class WebshopappApiResourceExternal_services 2995 | { 2996 | /** 2997 | * @var WebshopappApiClient 2998 | */ 2999 | private $client; 3000 | 3001 | public function __construct(WebshopappApiClient $client) 3002 | { 3003 | $this->client = $client; 3004 | } 3005 | 3006 | /** 3007 | * @param array $fields 3008 | * 3009 | * @return array 3010 | * @throws WebshopappApiException 3011 | */ 3012 | public function create($fields) 3013 | { 3014 | $fields = array('externalService' => $fields); 3015 | 3016 | return $this->client->create('external_services', $fields); 3017 | } 3018 | 3019 | /** 3020 | * @param int $externalserviceId 3021 | * @param array $params 3022 | * 3023 | * @return array 3024 | * @throws WebshopappApiException 3025 | */ 3026 | public function get($externalserviceId = null, $params = array()) 3027 | { 3028 | if (!$externalserviceId) 3029 | { 3030 | return $this->client->read('external_services', $params); 3031 | } 3032 | else 3033 | { 3034 | return $this->client->read('external_services/' . $externalserviceId, $params); 3035 | } 3036 | } 3037 | 3038 | /** 3039 | * @param array $params 3040 | * 3041 | * @return int 3042 | * @throws WebshopappApiException 3043 | */ 3044 | public function count($params = array()) 3045 | { 3046 | return $this->client->read('external_services/count', $params); 3047 | } 3048 | 3049 | /** 3050 | * @param int $externalserviceId 3051 | * 3052 | * @return array 3053 | * @throws WebshopappApiException 3054 | */ 3055 | public function delete($externalserviceId) 3056 | { 3057 | return $this->client->delete('external_services/' . $externalserviceId); 3058 | } 3059 | } 3060 | 3061 | class WebshopappApiResourceFiles 3062 | { 3063 | /** 3064 | * @var WebshopappApiClient 3065 | */ 3066 | private $client; 3067 | 3068 | public function __construct(WebshopappApiClient $client) 3069 | { 3070 | $this->client = $client; 3071 | } 3072 | 3073 | /** 3074 | * @param array $fields 3075 | * 3076 | * @return array 3077 | * @throws WebshopappApiException 3078 | */ 3079 | public function create($fields) 3080 | { 3081 | if (strpos($fields['attachment'], 'http') === false) { 3082 | try { 3083 | $attachment = $fields['attachment']; 3084 | 3085 | new SplFileObject($attachment); 3086 | 3087 | $mimetype = mime_content_type($attachment); 3088 | $fields['attachment'] = new CURLFile($attachment, $mimetype); 3089 | 3090 | $options = [ 3091 | 'header' => 'multipart/form-data' 3092 | ]; 3093 | 3094 | return $this->client->create('files', $fields, $options); 3095 | } catch (RuntimeException $exception) { 3096 | // 3097 | } 3098 | } 3099 | 3100 | $fields = array('file' => $fields); 3101 | 3102 | return $this->client->create('files', $fields); 3103 | } 3104 | 3105 | /** 3106 | * @param int $fileId 3107 | * @param array $params 3108 | * 3109 | * @return array 3110 | * @throws WebshopappApiException 3111 | */ 3112 | public function get($fileId = null, $params = array()) 3113 | { 3114 | if (!$fileId) 3115 | { 3116 | return $this->client->read('files', $params); 3117 | } 3118 | else 3119 | { 3120 | return $this->client->read('files/' . $fileId, $params); 3121 | } 3122 | } 3123 | 3124 | /** 3125 | * @param array $params 3126 | * 3127 | * @return int 3128 | * @throws WebshopappApiException 3129 | */ 3130 | public function count($params = array()) 3131 | { 3132 | return $this->client->read('files/count', $params); 3133 | } 3134 | 3135 | /** 3136 | * @param int $fileId 3137 | * @param array $fields 3138 | * 3139 | * @return array 3140 | * @throws WebshopappApiException 3141 | */ 3142 | public function update($fileId, $fields) 3143 | { 3144 | $fields = array('file' => $fields); 3145 | 3146 | return $this->client->update('files/' . $fileId, $fields); 3147 | } 3148 | 3149 | /** 3150 | * @param int $fileId 3151 | * 3152 | * @return array 3153 | * @throws WebshopappApiException 3154 | */ 3155 | public function delete($fileId) 3156 | { 3157 | return $this->client->delete('files/' . $fileId); 3158 | } 3159 | } 3160 | 3161 | class WebshopappApiResourceFilters 3162 | { 3163 | /** 3164 | * @var WebshopappApiClient 3165 | */ 3166 | private $client; 3167 | 3168 | public function __construct(WebshopappApiClient $client) 3169 | { 3170 | $this->client = $client; 3171 | } 3172 | 3173 | /** 3174 | * @param array $fields 3175 | * 3176 | * @return array 3177 | * @throws WebshopappApiException 3178 | */ 3179 | public function create($fields) 3180 | { 3181 | $fields = array('filter' => $fields); 3182 | 3183 | return $this->client->create('filters', $fields); 3184 | } 3185 | 3186 | /** 3187 | * @param int $filterId 3188 | * @param array $params 3189 | * 3190 | * @return array 3191 | * @throws WebshopappApiException 3192 | */ 3193 | public function get($filterId = null, $params = array()) 3194 | { 3195 | if (!$filterId) 3196 | { 3197 | return $this->client->read('filters', $params); 3198 | } 3199 | else 3200 | { 3201 | return $this->client->read('filters/' . $filterId, $params); 3202 | } 3203 | } 3204 | 3205 | /** 3206 | * @param array $params 3207 | * 3208 | * @return int 3209 | * @throws WebshopappApiException 3210 | */ 3211 | public function count($params = array()) 3212 | { 3213 | return $this->client->read('filters/count', $params); 3214 | } 3215 | 3216 | /** 3217 | * @param int $filterId 3218 | * @param array $fields 3219 | * 3220 | * @return array 3221 | * @throws WebshopappApiException 3222 | */ 3223 | public function update($filterId, $fields) 3224 | { 3225 | $fields = array('filter' => $fields); 3226 | 3227 | return $this->client->update('filters/' . $filterId, $fields); 3228 | } 3229 | 3230 | /** 3231 | * @param int $filterId 3232 | * 3233 | * @return array 3234 | * @throws WebshopappApiException 3235 | */ 3236 | public function delete($filterId) 3237 | { 3238 | return $this->client->delete('filters/' . $filterId); 3239 | } 3240 | } 3241 | 3242 | class WebshopappApiResourceFiltersValues 3243 | { 3244 | /** 3245 | * @var WebshopappApiClient 3246 | */ 3247 | private $client; 3248 | 3249 | public function __construct(WebshopappApiClient $client) 3250 | { 3251 | $this->client = $client; 3252 | } 3253 | 3254 | /** 3255 | * @param int $filterId 3256 | * @param int $filterValueId 3257 | * @param array $params 3258 | * 3259 | * @return array 3260 | * @throws WebshopappApiException 3261 | */ 3262 | public function get($filterId, $filterValueId = null, $params = array()) 3263 | { 3264 | if (!$filterValueId) 3265 | { 3266 | return $this->client->read('filters/' . $filterId . '/values', $params); 3267 | } 3268 | else 3269 | { 3270 | return $this->client->read('filters/' . $filterId . '/values/' . $filterValueId, $params); 3271 | } 3272 | } 3273 | 3274 | /** 3275 | * @param int $filterId 3276 | * @param array $params 3277 | * 3278 | * @return int 3279 | * @throws WebshopappApiException 3280 | */ 3281 | public function count($filterId, $params = array()) 3282 | { 3283 | return $this->client->read('filters/' . $filterId . '/values/count', $params); 3284 | } 3285 | 3286 | /** 3287 | * @param int $filterId 3288 | * @param array $fields 3289 | * 3290 | * @return array 3291 | * @throws WebshopappApiException 3292 | */ 3293 | public function create($filterId, $fields) 3294 | { 3295 | $fields = array('filterValue' => $fields); 3296 | 3297 | return $this->client->create('filters/' . $filterId . '/values', $fields); 3298 | } 3299 | 3300 | /** 3301 | * @param int $filterId 3302 | * @param int $filterValueId 3303 | * @param array $fields 3304 | * 3305 | * @return array 3306 | * @throws WebshopappApiException 3307 | */ 3308 | public function update($filterId, $filterValueId, $fields) 3309 | { 3310 | $fields = array('filterValue' => $fields); 3311 | 3312 | return $this->client->update('filters/' . $filterId . '/values/' . $filterValueId, $fields); 3313 | } 3314 | 3315 | /** 3316 | * @param int $filterId 3317 | * @param int $filterValueId 3318 | * 3319 | * @return array 3320 | * @throws WebshopappApiException 3321 | */ 3322 | public function delete($filterId, $filterValueId) 3323 | { 3324 | return $this->client->delete('filters/' . $filterId . '/values/' . $filterValueId); 3325 | } 3326 | } 3327 | 3328 | class WebshopappApiResourceGroups 3329 | { 3330 | /** 3331 | * @var WebshopappApiClient 3332 | */ 3333 | private $client; 3334 | 3335 | public function __construct(WebshopappApiClient $client) 3336 | { 3337 | $this->client = $client; 3338 | } 3339 | 3340 | /** 3341 | * @param array $fields 3342 | * 3343 | * @return array 3344 | * @throws WebshopappApiException 3345 | */ 3346 | public function create($fields) 3347 | { 3348 | $fields = array('group' => $fields); 3349 | 3350 | return $this->client->create('groups', $fields); 3351 | } 3352 | 3353 | /** 3354 | * @param int $groupId 3355 | * @param array $params 3356 | * 3357 | * @return array 3358 | * @throws WebshopappApiException 3359 | */ 3360 | public function get($groupId = null, $params = array()) 3361 | { 3362 | if (!$groupId) 3363 | { 3364 | return $this->client->read('groups', $params); 3365 | } 3366 | else 3367 | { 3368 | return $this->client->read('groups/' . $groupId, $params); 3369 | } 3370 | } 3371 | 3372 | /** 3373 | * @param array $params 3374 | * 3375 | * @return int 3376 | * @throws WebshopappApiException 3377 | */ 3378 | public function count($params = array()) 3379 | { 3380 | return $this->client->read('groups/count', $params); 3381 | } 3382 | 3383 | /** 3384 | * @param int $groupId 3385 | * @param array $fields 3386 | * 3387 | * @return array 3388 | * @throws WebshopappApiException 3389 | */ 3390 | public function update($groupId, $fields) 3391 | { 3392 | $fields = array('group' => $fields); 3393 | 3394 | return $this->client->update('groups/' . $groupId, $fields); 3395 | } 3396 | 3397 | /** 3398 | * @param int $groupId 3399 | * 3400 | * @return array 3401 | * @throws WebshopappApiException 3402 | */ 3403 | public function delete($groupId) 3404 | { 3405 | return $this->client->delete('groups/' . $groupId); 3406 | } 3407 | } 3408 | 3409 | class WebshopappApiResourceGroupsCustomers 3410 | { 3411 | /** 3412 | * @var WebshopappApiClient 3413 | */ 3414 | private $client; 3415 | 3416 | public function __construct(WebshopappApiClient $client) 3417 | { 3418 | $this->client = $client; 3419 | } 3420 | 3421 | /** 3422 | * @param array $fields 3423 | * 3424 | * @return array 3425 | * @throws WebshopappApiException 3426 | */ 3427 | public function create($fields) 3428 | { 3429 | $fields = array('groupsCustomer' => $fields); 3430 | 3431 | return $this->client->create('groups/customers', $fields); 3432 | } 3433 | 3434 | /** 3435 | * @param int $relationId 3436 | * @param array $params 3437 | * 3438 | * @return array 3439 | * @throws WebshopappApiException 3440 | */ 3441 | public function get($relationId = null, $params = array()) 3442 | { 3443 | if (!$relationId) 3444 | { 3445 | return $this->client->read('groups/customers', $params); 3446 | } 3447 | else 3448 | { 3449 | return $this->client->read('groups/customers/' . $relationId, $params); 3450 | } 3451 | } 3452 | 3453 | /** 3454 | * @param array $params 3455 | * 3456 | * @return int 3457 | * @throws WebshopappApiException 3458 | */ 3459 | public function count($params = array()) 3460 | { 3461 | return $this->client->read('groups/customers/count', $params); 3462 | } 3463 | 3464 | /** 3465 | * @param int $relationId 3466 | * 3467 | * @return array 3468 | * @throws WebshopappApiException 3469 | */ 3470 | public function delete($relationId) 3471 | { 3472 | return $this->client->delete('groups/customers/' . $relationId); 3473 | } 3474 | } 3475 | 3476 | class WebshopappApiResourceInvoices 3477 | { 3478 | /** 3479 | * @var WebshopappApiClient 3480 | */ 3481 | private $client; 3482 | 3483 | public function __construct(WebshopappApiClient $client) 3484 | { 3485 | $this->client = $client; 3486 | } 3487 | 3488 | /** 3489 | * @param int $invoiceId 3490 | * @param array $params 3491 | * 3492 | * @return array 3493 | * @throws WebshopappApiException 3494 | */ 3495 | public function get($invoiceId = null, $params = array()) 3496 | { 3497 | if (!$invoiceId) 3498 | { 3499 | return $this->client->read('invoices', $params); 3500 | } 3501 | else 3502 | { 3503 | return $this->client->read('invoices/' . $invoiceId, $params); 3504 | } 3505 | } 3506 | 3507 | /** 3508 | * @param array $params 3509 | * 3510 | * @return int 3511 | * @throws WebshopappApiException 3512 | */ 3513 | public function count($params = array()) 3514 | { 3515 | return $this->client->read('invoices/count', $params); 3516 | } 3517 | 3518 | /** 3519 | * @param int $invoiceId 3520 | * @param array $fields 3521 | * 3522 | * @return array 3523 | * @throws WebshopappApiException 3524 | */ 3525 | public function update($invoiceId, $fields) 3526 | { 3527 | $fields = array('invoice' => $fields); 3528 | 3529 | return $this->client->update('invoices/' . $invoiceId, $fields); 3530 | } 3531 | } 3532 | 3533 | class WebshopappApiResourceInvoicesItems 3534 | { 3535 | /** 3536 | * @var WebshopappApiClient 3537 | */ 3538 | private $client; 3539 | 3540 | public function __construct(WebshopappApiClient $client) 3541 | { 3542 | $this->client = $client; 3543 | } 3544 | 3545 | /** 3546 | * @param int $invoiceId 3547 | * @param int $itemId 3548 | * @param array $params 3549 | * 3550 | * @return array 3551 | * @throws WebshopappApiException 3552 | */ 3553 | public function get($invoiceId, $itemId = null, $params = array()) 3554 | { 3555 | if (!$itemId) 3556 | { 3557 | return $this->client->read('invoices/' . $invoiceId . '/items', $params); 3558 | } 3559 | else 3560 | { 3561 | return $this->client->read('invoices/' . $invoiceId . '/items/' . $itemId, $params); 3562 | } 3563 | } 3564 | 3565 | /** 3566 | * @param int $invoiceId 3567 | * @param array $params 3568 | * 3569 | * @return int 3570 | * @throws WebshopappApiException 3571 | */ 3572 | public function count($invoiceId, $params = array()) 3573 | { 3574 | return $this->client->read('invoices/' . $invoiceId . '/items/count', $params); 3575 | } 3576 | } 3577 | 3578 | class WebshopappApiResourceInvoicesMetafields 3579 | { 3580 | /** 3581 | * @var WebshopappApiClient 3582 | */ 3583 | private $client; 3584 | 3585 | public function __construct(WebshopappApiClient $client) 3586 | { 3587 | $this->client = $client; 3588 | } 3589 | 3590 | /** 3591 | * @param int $invoiceId 3592 | * @param array $fields 3593 | * 3594 | * @return array 3595 | * @throws WebshopappApiException 3596 | */ 3597 | public function create($invoiceId, $fields) 3598 | { 3599 | $fields = array('invoiceMetafield' => $fields); 3600 | 3601 | return $this->client->create('invoices/' . $invoiceId . '/metafields', $fields); 3602 | } 3603 | 3604 | /** 3605 | * @param int $invoiceId 3606 | * @param int $metafieldId 3607 | * @param array $params 3608 | * 3609 | * @return array 3610 | * @throws WebshopappApiException 3611 | */ 3612 | public function get($invoiceId, $metafieldId = null, $params = array()) 3613 | { 3614 | if (!$metafieldId) 3615 | { 3616 | return $this->client->read('invoices/' . $invoiceId . '/metafields', $params); 3617 | } 3618 | else 3619 | { 3620 | return $this->client->read('invoices/' . $invoiceId . '/metafields/' . $metafieldId, $params); 3621 | } 3622 | } 3623 | 3624 | /** 3625 | * @param int $invoiceId 3626 | * @param array $params 3627 | * 3628 | * @return int 3629 | * @throws WebshopappApiException 3630 | */ 3631 | public function count($invoiceId, $params = array()) 3632 | { 3633 | return $this->client->read('invoices/' . $invoiceId . '/metafields/count', $params); 3634 | } 3635 | 3636 | /** 3637 | * @param int $invoiceId 3638 | * @param int $metafieldId 3639 | * @param array $fields 3640 | * 3641 | * @return array 3642 | * @throws WebshopappApiException 3643 | */ 3644 | public function update($invoiceId, $metafieldId, $fields) 3645 | { 3646 | $fields = array('invoiceMetafield' => $fields); 3647 | 3648 | return $this->client->update('invoices/' . $invoiceId . '/metafields/' . $metafieldId, $fields); 3649 | } 3650 | 3651 | /** 3652 | * @param int $invoiceId 3653 | * @param int $metafieldId 3654 | * 3655 | * @return array 3656 | * @throws WebshopappApiException 3657 | */ 3658 | public function delete($invoiceId, $metafieldId) 3659 | { 3660 | return $this->client->delete('invoices/' . $invoiceId . '/metafields/' . $metafieldId); 3661 | } 3662 | } 3663 | 3664 | class WebshopappApiResourceLanguages 3665 | { 3666 | /** 3667 | * @var WebshopappApiClient 3668 | */ 3669 | private $client; 3670 | 3671 | public function __construct(WebshopappApiClient $client) 3672 | { 3673 | $this->client = $client; 3674 | } 3675 | 3676 | /** 3677 | * @param int $languageId 3678 | * @param array $params 3679 | * 3680 | * @return array 3681 | * @throws WebshopappApiException 3682 | */ 3683 | public function get($languageId = null, $params = array()) 3684 | { 3685 | if (!$languageId) 3686 | { 3687 | return $this->client->read('languages', $params); 3688 | } 3689 | else 3690 | { 3691 | return $this->client->read('languages/' . $languageId, $params); 3692 | } 3693 | } 3694 | 3695 | /** 3696 | * @param array $params 3697 | * 3698 | * @return int 3699 | * @throws WebshopappApiException 3700 | */ 3701 | public function count($params = array()) 3702 | { 3703 | return $this->client->read('languages/count', $params); 3704 | } 3705 | } 3706 | 3707 | class WebshopappApiResourceLocations 3708 | { 3709 | /** 3710 | * @var WebshopappApiClient 3711 | */ 3712 | private $client; 3713 | 3714 | public function __construct(WebshopappApiClient $client) 3715 | { 3716 | $this->client = $client; 3717 | } 3718 | 3719 | /** 3720 | * @param int $locationId 3721 | * @param array $params 3722 | * 3723 | * @return array 3724 | * @throws WebshopappApiException 3725 | */ 3726 | public function get($locationId = null, $params = array()) 3727 | { 3728 | if (!$locationId) 3729 | { 3730 | return $this->client->read('locations', $params); 3731 | } 3732 | else 3733 | { 3734 | return $this->client->read('locations/' . $locationId, $params); 3735 | } 3736 | } 3737 | 3738 | /** 3739 | * @param array $params 3740 | * 3741 | * @return int 3742 | * @throws WebshopappApiException 3743 | */ 3744 | public function count($params = array()) 3745 | { 3746 | return $this->client->read('locations/count', $params); 3747 | } 3748 | 3749 | /** 3750 | * @param array $fields 3751 | * 3752 | * @return array 3753 | * @throws WebshopappApiException 3754 | */ 3755 | public function create($fields) 3756 | { 3757 | $fields = array('locations' => $fields); 3758 | 3759 | return $this->client->create('locations', $fields); 3760 | } 3761 | 3762 | /** 3763 | * @param int $locationId 3764 | * @param array $fields 3765 | * 3766 | * @return array 3767 | * @throws WebshopappApiException 3768 | */ 3769 | public function update($locationId, $fields) 3770 | { 3771 | $fields = array('location' => $fields); 3772 | 3773 | return $this->client->update('locations/' . $locationId, $fields); 3774 | } 3775 | 3776 | /** 3777 | * @param int $locationId 3778 | * 3779 | * @return array 3780 | * @throws WebshopappApiException 3781 | */ 3782 | public function delete($locationId) 3783 | { 3784 | return $this->client->delete('locations/' . $locationId); 3785 | } 3786 | } 3787 | 3788 | class WebshopappApiResourceMetafields 3789 | { 3790 | /** 3791 | * @var WebshopappApiClient 3792 | */ 3793 | private $client; 3794 | 3795 | public function __construct(WebshopappApiClient $client) 3796 | { 3797 | $this->client = $client; 3798 | } 3799 | 3800 | /** 3801 | * @param array $fields 3802 | * 3803 | * @return array 3804 | * @throws WebshopappApiException 3805 | */ 3806 | public function create($fields) 3807 | { 3808 | $fields = array('metafield' => $fields); 3809 | 3810 | return $this->client->create('metafields', $fields); 3811 | } 3812 | 3813 | /** 3814 | * @param int $metafieldId 3815 | * @param array $params 3816 | * 3817 | * @return array 3818 | * @throws WebshopappApiException 3819 | */ 3820 | public function get($metafieldId = null, $params = array()) 3821 | { 3822 | if (!$metafieldId) 3823 | { 3824 | return $this->client->read('metafields', $params); 3825 | } 3826 | else 3827 | { 3828 | return $this->client->read('metafields/' . $metafieldId, $params); 3829 | } 3830 | } 3831 | 3832 | /** 3833 | * @param array $params 3834 | * 3835 | * @return int 3836 | * @throws WebshopappApiException 3837 | */ 3838 | public function count($params = array()) 3839 | { 3840 | return $this->client->read('metafields/count', $params); 3841 | } 3842 | 3843 | /** 3844 | * @param int $metafieldId 3845 | * @param array $fields 3846 | * 3847 | * @return array 3848 | * @throws WebshopappApiException 3849 | */ 3850 | public function update($metafieldId, $fields) 3851 | { 3852 | $fields = array('metafield' => $fields); 3853 | 3854 | return $this->client->update('metafields/' . $metafieldId, $fields); 3855 | } 3856 | 3857 | /** 3858 | * @param int $metafieldId 3859 | * 3860 | * @return array 3861 | * @throws WebshopappApiException 3862 | */ 3863 | public function delete($metafieldId) 3864 | { 3865 | return $this->client->delete('metafields/' . $metafieldId); 3866 | } 3867 | } 3868 | 3869 | class WebshopappApiResourceOrders 3870 | { 3871 | /** 3872 | * @var WebshopappApiClient 3873 | */ 3874 | private $client; 3875 | 3876 | public function __construct(WebshopappApiClient $client) 3877 | { 3878 | $this->client = $client; 3879 | } 3880 | 3881 | /** 3882 | * @param int $orderId 3883 | * @param array $params 3884 | * 3885 | * @return array 3886 | * @throws WebshopappApiException 3887 | */ 3888 | public function get($orderId = null, $params = array()) 3889 | { 3890 | if (!$orderId) 3891 | { 3892 | return $this->client->read('orders', $params); 3893 | } 3894 | else 3895 | { 3896 | return $this->client->read('orders/' . $orderId, $params); 3897 | } 3898 | } 3899 | 3900 | /** 3901 | * @param array $params 3902 | * 3903 | * @return int 3904 | * @throws WebshopappApiException 3905 | */ 3906 | public function count($params = array()) 3907 | { 3908 | return $this->client->read('orders/count', $params); 3909 | } 3910 | 3911 | /** 3912 | * @param int $orderId 3913 | * @param array $fields 3914 | * 3915 | * @return array 3916 | * @throws WebshopappApiException 3917 | */ 3918 | public function update($orderId, $fields) 3919 | { 3920 | $fields = array('order' => $fields); 3921 | 3922 | return $this->client->update('orders/' . $orderId, $fields); 3923 | } 3924 | } 3925 | 3926 | class WebshopappApiResourceOrdersCredit 3927 | { 3928 | /** 3929 | * @var WebshopappApiClient 3930 | */ 3931 | private $client; 3932 | 3933 | public function __construct(WebshopappApiClient $client) 3934 | { 3935 | $this->client = $client; 3936 | } 3937 | 3938 | /** 3939 | * @param int $orderId 3940 | * @param array $fields 3941 | * 3942 | * @return array 3943 | * @throws WebshopappApiException 3944 | */ 3945 | public function create($orderId, $fields) 3946 | { 3947 | $fields = array('credit' => $fields); 3948 | 3949 | return $this->client->create('orders/' . $orderId . '/credit', $fields); 3950 | } 3951 | } 3952 | 3953 | class WebshopappApiResourceOrdersMetafields 3954 | { 3955 | /** 3956 | * @var WebshopappApiClient 3957 | */ 3958 | private $client; 3959 | 3960 | public function __construct(WebshopappApiClient $client) 3961 | { 3962 | $this->client = $client; 3963 | } 3964 | 3965 | /** 3966 | * @param int $orderId 3967 | * @param array $fields 3968 | * 3969 | * @return array 3970 | * @throws WebshopappApiException 3971 | */ 3972 | public function create($orderId, $fields) 3973 | { 3974 | $fields = array('orderMetafield' => $fields); 3975 | 3976 | return $this->client->create('orders/' . $orderId . '/metafields', $fields); 3977 | } 3978 | 3979 | /** 3980 | * @param int $orderId 3981 | * @param int $metafieldId 3982 | * @param array $params 3983 | * 3984 | * @return array 3985 | * @throws WebshopappApiException 3986 | */ 3987 | public function get($orderId, $metafieldId = null, $params = array()) 3988 | { 3989 | if (!$metafieldId) 3990 | { 3991 | return $this->client->read('orders/' . $orderId . '/metafields', $params); 3992 | } 3993 | else 3994 | { 3995 | return $this->client->read('orders/' . $orderId . '/metafields/' . $metafieldId, $params); 3996 | } 3997 | } 3998 | 3999 | /** 4000 | * @param int $orderId 4001 | * @param array $params 4002 | * 4003 | * @return int 4004 | * @throws WebshopappApiException 4005 | */ 4006 | public function count($orderId, $params = array()) 4007 | { 4008 | return $this->client->read('orders/' . $orderId . '/metafields/count', $params); 4009 | } 4010 | 4011 | /** 4012 | * @param int $orderId 4013 | * @param int $metafieldId 4014 | * @param array $fields 4015 | * 4016 | * @return array 4017 | * @throws WebshopappApiException 4018 | */ 4019 | public function update($orderId, $metafieldId, $fields) 4020 | { 4021 | $fields = array('orderMetafield' => $fields); 4022 | 4023 | return $this->client->update('orders/' . $orderId . '/metafields/' . $metafieldId, $fields); 4024 | } 4025 | 4026 | /** 4027 | * @param int $orderId 4028 | * @param int $metafieldId 4029 | * 4030 | * @return array 4031 | * @throws WebshopappApiException 4032 | */ 4033 | public function delete($orderId, $metafieldId) 4034 | { 4035 | return $this->client->delete('orders/' . $orderId . '/metafields/' . $metafieldId); 4036 | } 4037 | } 4038 | 4039 | class WebshopappApiResourceOrdersProducts 4040 | { 4041 | /** 4042 | * @var WebshopappApiClient 4043 | */ 4044 | private $client; 4045 | 4046 | public function __construct(WebshopappApiClient $client) 4047 | { 4048 | $this->client = $client; 4049 | } 4050 | 4051 | /** 4052 | * @param int $orderId 4053 | * @param int $productId 4054 | * @param array $params 4055 | * 4056 | * @return array 4057 | * @throws WebshopappApiException 4058 | */ 4059 | public function get($orderId, $productId = null, $params = array()) 4060 | { 4061 | if (!$productId) 4062 | { 4063 | return $this->client->read('orders/' . $orderId . '/products', $params); 4064 | } 4065 | else 4066 | { 4067 | return $this->client->read('orders/' . $orderId . '/products/' . $productId, $params); 4068 | } 4069 | } 4070 | 4071 | /** 4072 | * @param int $orderId 4073 | * @param array $params 4074 | * 4075 | * @return int 4076 | * @throws WebshopappApiException 4077 | */ 4078 | public function count($orderId, $params = array()) 4079 | { 4080 | return $this->client->read('orders/' . $orderId . '/products/count', $params); 4081 | } 4082 | } 4083 | 4084 | class WebshopappApiResourceOrdersCustomstatuses 4085 | { 4086 | /** 4087 | * @var WebshopappApiClient 4088 | */ 4089 | private $client; 4090 | 4091 | public function __construct(WebshopappApiClient $client) 4092 | { 4093 | $this->client = $client; 4094 | } 4095 | 4096 | /** 4097 | * @param array $fields 4098 | * 4099 | * @return array 4100 | * @throws WebshopappApiException 4101 | */ 4102 | public function create($fields) 4103 | { 4104 | $fields = array('customStatus' => $fields); 4105 | 4106 | return $this->client->create('orders/customstatuses', $fields); 4107 | } 4108 | 4109 | /** 4110 | * @param int $customstatusId 4111 | * @param array $params 4112 | * 4113 | * @return array 4114 | * @throws WebshopappApiException 4115 | */ 4116 | public function get($customstatusId = null, $params = array()) 4117 | { 4118 | if (!$customstatusId) 4119 | { 4120 | return $this->client->read('orders/customstatuses', $params); 4121 | } 4122 | else 4123 | { 4124 | return $this->client->read('orders/customstatuses/' . $customstatusId, $params); 4125 | } 4126 | } 4127 | 4128 | /** 4129 | * @param array $params 4130 | * 4131 | * @return int 4132 | * @throws WebshopappApiException 4133 | */ 4134 | public function count($params = array()) 4135 | { 4136 | return $this->client->read('orders/customstatuses/count', $params); 4137 | } 4138 | 4139 | /** 4140 | * @param int $customstatusId 4141 | * @param array $fields 4142 | * 4143 | * @return array 4144 | * @throws WebshopappApiException 4145 | */ 4146 | public function update($customstatusId, $fields) 4147 | { 4148 | $fields = array('customStatus' => $fields); 4149 | 4150 | return $this->client->update('orders/customstatuses/' . $customstatusId, $fields); 4151 | } 4152 | 4153 | /** 4154 | * @param int $customstatusId 4155 | * 4156 | * @return array 4157 | * @throws WebshopappApiException 4158 | */ 4159 | public function delete($customstatusId) 4160 | { 4161 | return $this->client->delete('orders/customstatuses/' . $customstatusId); 4162 | } 4163 | } 4164 | 4165 | class WebshopappApiResourceOrdersEvents 4166 | { 4167 | /** 4168 | * @var WebshopappApiClient 4169 | */ 4170 | private $client; 4171 | 4172 | public function __construct(WebshopappApiClient $client) 4173 | { 4174 | $this->client = $client; 4175 | } 4176 | 4177 | /** 4178 | * @param int $eventId 4179 | * @param array $params 4180 | * 4181 | * @return array 4182 | * @throws WebshopappApiException 4183 | */ 4184 | public function get($eventId = null, $params = array()) 4185 | { 4186 | if (!$eventId) 4187 | { 4188 | return $this->client->read('orders/events', $params); 4189 | } 4190 | else 4191 | { 4192 | return $this->client->read('orders/events/' . $eventId, $params); 4193 | } 4194 | } 4195 | 4196 | /** 4197 | * @param array $params 4198 | * 4199 | * @return int 4200 | * @throws WebshopappApiException 4201 | */ 4202 | public function count($params = array()) 4203 | { 4204 | return $this->client->read('orders/events/count', $params); 4205 | } 4206 | } 4207 | 4208 | class WebshopappApiResourcePaymentmethods 4209 | { 4210 | /** 4211 | * @var WebshopappApiClient 4212 | */ 4213 | private $client; 4214 | 4215 | public function __construct(WebshopappApiClient $client) 4216 | { 4217 | $this->client = $client; 4218 | } 4219 | 4220 | /** 4221 | * @param int $paymentmethodId 4222 | * @param array $params 4223 | * 4224 | * @return array 4225 | * @throws WebshopappApiException 4226 | */ 4227 | public function get($paymentmethodId = null, $params = array()) 4228 | { 4229 | if (!$paymentmethodId) 4230 | { 4231 | return $this->client->read('paymentmethods', $params); 4232 | } 4233 | else 4234 | { 4235 | return $this->client->read('paymentmethods/' . $paymentmethodId, $params); 4236 | } 4237 | } 4238 | 4239 | /** 4240 | * @param array $params 4241 | * 4242 | * @return int 4243 | * @throws WebshopappApiException 4244 | */ 4245 | public function count($params = array()) 4246 | { 4247 | return $this->client->read('paymentmethods/count', $params); 4248 | } 4249 | } 4250 | 4251 | class WebshopappApiResourceProducts 4252 | { 4253 | /** 4254 | * @var WebshopappApiClient 4255 | */ 4256 | private $client; 4257 | 4258 | public function __construct(WebshopappApiClient $client) 4259 | { 4260 | $this->client = $client; 4261 | } 4262 | 4263 | /** 4264 | * @param array $fields 4265 | * 4266 | * @return array 4267 | * @throws WebshopappApiException 4268 | */ 4269 | public function create($fields) 4270 | { 4271 | $fields = array('product' => $fields); 4272 | 4273 | return $this->client->create('products', $fields); 4274 | } 4275 | 4276 | /** 4277 | * @param int $productId 4278 | * @param array $params 4279 | * 4280 | * @return array 4281 | * @throws WebshopappApiException 4282 | */ 4283 | public function get($productId = null, $params = array()) 4284 | { 4285 | if (!$productId) 4286 | { 4287 | return $this->client->read('products', $params); 4288 | } 4289 | else 4290 | { 4291 | return $this->client->read('products/' . $productId, $params); 4292 | } 4293 | } 4294 | 4295 | /** 4296 | * @param array $params 4297 | * 4298 | * @return int 4299 | * @throws WebshopappApiException 4300 | */ 4301 | public function count($params = array()) 4302 | { 4303 | return $this->client->read('products/count', $params); 4304 | } 4305 | 4306 | /** 4307 | * @param int $productId 4308 | * @param array $fields 4309 | * 4310 | * @return array 4311 | * @throws WebshopappApiException 4312 | */ 4313 | public function update($productId, $fields) 4314 | { 4315 | $fields = array('product' => $fields); 4316 | 4317 | return $this->client->update('products/' . $productId, $fields); 4318 | } 4319 | 4320 | /** 4321 | * @param int $productId 4322 | * 4323 | * @return array 4324 | * @throws WebshopappApiException 4325 | */ 4326 | public function delete($productId) 4327 | { 4328 | return $this->client->delete('products/' . $productId); 4329 | } 4330 | } 4331 | 4332 | class WebshopappApiResourceProductsAttributes 4333 | { 4334 | /** 4335 | * @var WebshopappApiClient 4336 | */ 4337 | private $client; 4338 | 4339 | public function __construct(WebshopappApiClient $client) 4340 | { 4341 | $this->client = $client; 4342 | } 4343 | 4344 | /** 4345 | * @param int $productId 4346 | * @param int $attributeId Set to null for bulk update. 4347 | * @param array $fields 4348 | * 4349 | * @return array 4350 | * @throws WebshopappApiException 4351 | */ 4352 | public function update($productId, $attributeId, $fields) 4353 | { 4354 | if (!$attributeId) 4355 | { 4356 | $fields = array('productAttributes' => $fields); 4357 | 4358 | return $this->client->update('products/' . $productId . '/attributes', $fields); 4359 | } 4360 | else 4361 | { 4362 | $fields = array('productAttribute' => $fields); 4363 | 4364 | return $this->client->update('products/' . $productId . '/attributes/' . $attributeId, $fields); 4365 | } 4366 | } 4367 | 4368 | /** 4369 | * @param int $productId 4370 | * @param int $attributeId 4371 | * @param array $params 4372 | * 4373 | * @return array 4374 | * @throws WebshopappApiException 4375 | */ 4376 | public function get($productId, $attributeId = null, $params = array()) 4377 | { 4378 | if (!$attributeId) 4379 | { 4380 | return $this->client->read('products/' . $productId . '/attributes', $params); 4381 | } 4382 | else 4383 | { 4384 | return $this->client->read('products/' . $productId . '/attributes/' . $attributeId, $params); 4385 | } 4386 | } 4387 | 4388 | /** 4389 | * @param int $productId 4390 | * @param array $params 4391 | * 4392 | * @return int 4393 | * @throws WebshopappApiException 4394 | */ 4395 | public function count($productId, $params = array()) 4396 | { 4397 | return $this->client->read('products/' . $productId . '/attributes/count', $params); 4398 | } 4399 | 4400 | /** 4401 | * @param int $productId 4402 | * @param int $attributeId 4403 | * 4404 | * @return array 4405 | * @throws WebshopappApiException 4406 | */ 4407 | public function delete($productId, $attributeId) 4408 | { 4409 | return $this->client->delete('products/' . $productId . '/attributes/' . $attributeId); 4410 | } 4411 | } 4412 | 4413 | class WebshopappApiResourceProductsFiltervalues 4414 | { 4415 | /** 4416 | * @var WebshopappApiClient 4417 | */ 4418 | private $client; 4419 | 4420 | public function __construct(WebshopappApiClient $client) 4421 | { 4422 | $this->client = $client; 4423 | } 4424 | 4425 | /** 4426 | * @param int $productId 4427 | * 4428 | * @return array 4429 | * @throws WebshopappApiException 4430 | */ 4431 | public function get($productId) 4432 | { 4433 | return $this->client->read('products/' . $productId . '/filtervalues'); 4434 | } 4435 | 4436 | /** 4437 | * @param int $productId 4438 | * @param array $params 4439 | * 4440 | * @return int 4441 | * @throws WebshopappApiException 4442 | */ 4443 | public function count($productId, $params = array()) 4444 | { 4445 | return $this->client->read('products/' . $productId . '/filtervalues/count', $params); 4446 | } 4447 | 4448 | /** 4449 | * @param int $productId 4450 | * @param array $fields 4451 | * 4452 | * @return array 4453 | * @throws WebshopappApiException 4454 | */ 4455 | public function create($productId, $fields) 4456 | { 4457 | $fields = array('productFiltervalue' => $fields); 4458 | 4459 | return $this->client->create('products/' . $productId . '/filtervalues', $fields); 4460 | } 4461 | 4462 | /** 4463 | * @param int $productId 4464 | * @param int $filterValueId 4465 | * 4466 | * @return array 4467 | * @throws WebshopappApiException 4468 | */ 4469 | public function delete($productId, $filterValueId) 4470 | { 4471 | return $this->client->delete('products/' . $productId . '/filtervalues/' . $filterValueId); 4472 | } 4473 | } 4474 | 4475 | class WebshopappApiResourceProductsImages 4476 | { 4477 | /** 4478 | * @var WebshopappApiClient 4479 | */ 4480 | private $client; 4481 | 4482 | public function __construct(WebshopappApiClient $client) 4483 | { 4484 | $this->client = $client; 4485 | } 4486 | 4487 | /** 4488 | * @param int $productId 4489 | * @param array $fields 4490 | * 4491 | * @return array 4492 | * @throws WebshopappApiException 4493 | */ 4494 | public function create($productId, $fields) 4495 | { 4496 | if (strpos($fields['attachment'], 'http') === false) { 4497 | try { 4498 | $attachment = $fields['attachment']; 4499 | 4500 | new SplFileObject($attachment); 4501 | 4502 | $mimetype = mime_content_type($attachment); 4503 | $fields['attachment'] = new CURLFile($attachment, $mimetype); 4504 | 4505 | $options = [ 4506 | 'header' => 'multipart/form-data' 4507 | ]; 4508 | 4509 | return $this->client->create('products/' . $productId . '/images', $fields, $options); 4510 | } catch (RuntimeException $exception) { 4511 | // 4512 | } 4513 | } 4514 | 4515 | $fields = array('productImage' => $fields); 4516 | 4517 | return $this->client->create('products/' . $productId . '/images', $fields); 4518 | } 4519 | 4520 | /** 4521 | * @param int $productId 4522 | * @param int $imageId 4523 | * @param array $params 4524 | * 4525 | * @return array 4526 | * @throws WebshopappApiException 4527 | */ 4528 | public function get($productId, $imageId = null, $params = array()) 4529 | { 4530 | if (!$imageId) 4531 | { 4532 | return $this->client->read('products/' . $productId . '/images', $params); 4533 | } 4534 | else 4535 | { 4536 | return $this->client->read('products/' . $productId . '/images/' . $imageId, $params); 4537 | } 4538 | } 4539 | 4540 | /** 4541 | * @param int $productId 4542 | * @param array $params 4543 | * 4544 | * @return int 4545 | * @throws WebshopappApiException 4546 | */ 4547 | public function count($productId, $params = array()) 4548 | { 4549 | return $this->client->read('products/' . $productId . '/images/count', $params); 4550 | } 4551 | 4552 | /** 4553 | * @param int $productId 4554 | * @param int $imageId 4555 | * @param array $fields 4556 | * 4557 | * @return array 4558 | * @throws WebshopappApiException 4559 | */ 4560 | public function update($productId, $imageId, $fields) 4561 | { 4562 | $fields = array('productImage' => $fields); 4563 | 4564 | return $this->client->update('products/' . $productId . '/images/' . $imageId, $fields); 4565 | } 4566 | 4567 | /** 4568 | * @param int $productId 4569 | * @param int $imageId 4570 | * 4571 | * @return array 4572 | * @throws WebshopappApiException 4573 | */ 4574 | public function delete($productId, $imageId) 4575 | { 4576 | return $this->client->delete('products/' . $productId . '/images/' . $imageId); 4577 | } 4578 | } 4579 | 4580 | class WebshopappApiResourceProductsMetafields 4581 | { 4582 | /** 4583 | * @var WebshopappApiClient 4584 | */ 4585 | private $client; 4586 | 4587 | public function __construct(WebshopappApiClient $client) 4588 | { 4589 | $this->client = $client; 4590 | } 4591 | 4592 | /** 4593 | * @param int $productId 4594 | * @param array $fields 4595 | * 4596 | * @return array 4597 | * @throws WebshopappApiException 4598 | */ 4599 | public function create($productId, $fields) 4600 | { 4601 | $fields = array('productMetafield' => $fields); 4602 | 4603 | return $this->client->create('products/' . $productId . '/metafields', $fields); 4604 | } 4605 | 4606 | /** 4607 | * @param int $productId 4608 | * @param int $metafieldId 4609 | * @param array $params 4610 | * 4611 | * @return array 4612 | * @throws WebshopappApiException 4613 | */ 4614 | public function get($productId, $metafieldId = null, $params = array()) 4615 | { 4616 | if (!$metafieldId) 4617 | { 4618 | return $this->client->read('products/' . $productId . '/metafields', $params); 4619 | } 4620 | else 4621 | { 4622 | return $this->client->read('products/' . $productId . '/metafields/' . $metafieldId, $params); 4623 | } 4624 | } 4625 | 4626 | /** 4627 | * @param int $productId 4628 | * @param array $params 4629 | * 4630 | * @return int 4631 | * @throws WebshopappApiException 4632 | */ 4633 | public function count($productId, $params = array()) 4634 | { 4635 | return $this->client->read('products/' . $productId . '/metafields/count', $params); 4636 | } 4637 | 4638 | /** 4639 | * @param int $productId 4640 | * @param int $metafieldId 4641 | * @param array $fields 4642 | * 4643 | * @return array 4644 | * @throws WebshopappApiException 4645 | */ 4646 | public function update($productId, $metafieldId, $fields) 4647 | { 4648 | $fields = array('productMetafield' => $fields); 4649 | 4650 | return $this->client->update('products/' . $productId . '/metafields/' . $metafieldId, $fields); 4651 | } 4652 | 4653 | /** 4654 | * @param int $productId 4655 | * @param int $metafieldId 4656 | * 4657 | * @return array 4658 | * @throws WebshopappApiException 4659 | */ 4660 | public function delete($productId, $metafieldId) 4661 | { 4662 | return $this->client->delete('products/' . $productId . '/metafields/' . $metafieldId); 4663 | } 4664 | } 4665 | 4666 | class WebshopappApiResourceProductsRelations 4667 | { 4668 | /** 4669 | * @var WebshopappApiClient 4670 | */ 4671 | private $client; 4672 | 4673 | public function __construct(WebshopappApiClient $client) 4674 | { 4675 | $this->client = $client; 4676 | } 4677 | 4678 | /** 4679 | * @param int $productId 4680 | * @param array $fields 4681 | * 4682 | * @return array 4683 | * @throws WebshopappApiException 4684 | */ 4685 | public function create($productId, $fields) 4686 | { 4687 | $fields = array('productRelation' => $fields); 4688 | 4689 | return $this->client->create('products/' . $productId . '/relations', $fields); 4690 | } 4691 | 4692 | /** 4693 | * @param int $productId 4694 | * @param int $relationId 4695 | * @param array $params 4696 | * 4697 | * @return array 4698 | * @throws WebshopappApiException 4699 | */ 4700 | public function get($productId, $relationId = null, $params = array()) 4701 | { 4702 | if (!$relationId) 4703 | { 4704 | return $this->client->read('products/' . $productId . '/relations', $params); 4705 | } 4706 | else 4707 | { 4708 | return $this->client->read('products/' . $productId . '/relations/' . $relationId, $params); 4709 | } 4710 | } 4711 | 4712 | /** 4713 | * @param int $productId 4714 | * @param array $params 4715 | * 4716 | * @return int 4717 | * @throws WebshopappApiException 4718 | */ 4719 | public function count($productId, $params = array()) 4720 | { 4721 | return $this->client->read('products/' . $productId . '/relations/count', $params); 4722 | } 4723 | 4724 | /** 4725 | * @param int $productId 4726 | * @param int $relationId 4727 | * @param array $fields 4728 | * 4729 | * @return array 4730 | * @throws WebshopappApiException 4731 | */ 4732 | public function update($productId, $relationId, $fields) 4733 | { 4734 | $fields = array('productRelation' => $fields); 4735 | 4736 | return $this->client->update('products/' . $productId . '/relations/' . $relationId, $fields); 4737 | } 4738 | 4739 | /** 4740 | * @param int $productId 4741 | * @param int $relationId 4742 | * 4743 | * @return array 4744 | * @throws WebshopappApiException 4745 | */ 4746 | public function delete($productId, $relationId) 4747 | { 4748 | return $this->client->delete('products/' . $productId . '/relations/' . $relationId); 4749 | } 4750 | } 4751 | 4752 | class WebshopappApiResourceQuotes 4753 | { 4754 | /** 4755 | * @var WebshopappApiClient 4756 | */ 4757 | private $client; 4758 | 4759 | public function __construct(WebshopappApiClient $client) 4760 | { 4761 | $this->client = $client; 4762 | } 4763 | 4764 | /** 4765 | * @param array $fields 4766 | * 4767 | * @return array 4768 | * @throws WebshopappApiException 4769 | */ 4770 | public function create($fields) 4771 | { 4772 | $fields = array('quote' => $fields); 4773 | 4774 | return $this->client->create('quotes', $fields); 4775 | } 4776 | 4777 | /** 4778 | * @param int $quoteId 4779 | * @param array $params 4780 | * 4781 | * @return array 4782 | * @throws WebshopappApiException 4783 | */ 4784 | public function get($quoteId = null, $params = array()) 4785 | { 4786 | if (!$quoteId) 4787 | { 4788 | return $this->client->read('quotes', $params); 4789 | } 4790 | else 4791 | { 4792 | return $this->client->read('quotes/' . $quoteId, $params); 4793 | } 4794 | } 4795 | 4796 | /** 4797 | * @param array $params 4798 | * 4799 | * @return int 4800 | * @throws WebshopappApiException 4801 | */ 4802 | public function count($params = array()) 4803 | { 4804 | return $this->client->read('quotes/count', $params); 4805 | } 4806 | 4807 | /** 4808 | * @param int $quoteId 4809 | * @param array $fields 4810 | * 4811 | * @return array 4812 | * @throws WebshopappApiException 4813 | */ 4814 | public function update($quoteId, $fields) 4815 | { 4816 | $fields = array('quote' => $fields); 4817 | 4818 | return $this->client->update('quotes/' . $quoteId, $fields); 4819 | } 4820 | } 4821 | 4822 | class WebshopappApiResourceQuotesConvert 4823 | { 4824 | /** 4825 | * @var WebshopappApiClient 4826 | */ 4827 | private $client; 4828 | 4829 | public function __construct(WebshopappApiClient $client) 4830 | { 4831 | $this->client = $client; 4832 | } 4833 | 4834 | /** 4835 | * @param int $quoteId 4836 | * @param array $fields 4837 | * 4838 | * @return array 4839 | * @throws WebshopappApiException 4840 | */ 4841 | public function create($quoteId, $fields) 4842 | { 4843 | $fields = array('order' => $fields); 4844 | 4845 | return $this->client->create('quotes/' . $quoteId . '/convert', $fields); 4846 | } 4847 | } 4848 | 4849 | class WebshopappApiResourceQuotesPaymentmethods 4850 | { 4851 | /** 4852 | * @var WebshopappApiClient 4853 | */ 4854 | private $client; 4855 | 4856 | public function __construct(WebshopappApiClient $client) 4857 | { 4858 | $this->client = $client; 4859 | } 4860 | 4861 | /** 4862 | * @param int $quoteId 4863 | * 4864 | * @return array 4865 | * @throws WebshopappApiException 4866 | */ 4867 | public function get($quoteId) 4868 | { 4869 | return $this->client->read('quotes/' . $quoteId . '/paymentmethods'); 4870 | } 4871 | 4872 | /** 4873 | * @param array $params 4874 | * 4875 | * @return int 4876 | * @throws WebshopappApiException 4877 | */ 4878 | public function count($params = array()) 4879 | { 4880 | return $this->client->read('quotes/' . $quoteId . '/paymentmethods/count', $params); 4881 | } 4882 | } 4883 | 4884 | class WebshopappApiResourceQuotesProducts 4885 | { 4886 | /** 4887 | * @var WebshopappApiClient 4888 | */ 4889 | private $client; 4890 | 4891 | public function __construct(WebshopappApiClient $client) 4892 | { 4893 | $this->client = $client; 4894 | } 4895 | 4896 | /** 4897 | * @param int $quoteId 4898 | * @param array $fields 4899 | * 4900 | * @return array 4901 | * @throws WebshopappApiException 4902 | */ 4903 | public function create($quoteId, $fields) 4904 | { 4905 | $fields = array('quoteProduct' => $fields); 4906 | 4907 | return $this->client->create('quotes/' . $quoteId . '/products', $fields); 4908 | } 4909 | 4910 | /** 4911 | * @param int $quoteId 4912 | * @param int $productId 4913 | * @param array $params 4914 | * 4915 | * @return array 4916 | * @throws WebshopappApiException 4917 | */ 4918 | public function get($quoteId, $productId = null, $params = array()) 4919 | { 4920 | if (!$productId) 4921 | { 4922 | return $this->client->read('quotes/' . $quoteId . '/products', $params); 4923 | } 4924 | else 4925 | { 4926 | return $this->client->read('quotes/' . $quoteId . '/products/' . $productId, $params); 4927 | } 4928 | } 4929 | 4930 | /** 4931 | * @param int $quoteId 4932 | * @param array $params 4933 | * 4934 | * @return int 4935 | * @throws WebshopappApiException 4936 | */ 4937 | public function count($quoteId, $params = array()) 4938 | { 4939 | return $this->client->read('quotes/' . $quoteId . '/products/count', $params); 4940 | } 4941 | 4942 | /** 4943 | * @param int $quoteId 4944 | * @param int $productId 4945 | * @param array $fields 4946 | * 4947 | * @return array 4948 | * @throws WebshopappApiException 4949 | */ 4950 | public function update($quoteId, $productId, $fields) 4951 | { 4952 | $fields = array('quoteProduct' => $fields); 4953 | 4954 | return $this->client->update('quotes/' . $quoteId . '/products/' . $productId, $fields); 4955 | } 4956 | 4957 | /** 4958 | * @param int $quoteId 4959 | * @param int $productId 4960 | * 4961 | * @return array 4962 | * @throws WebshopappApiException 4963 | */ 4964 | public function delete($quoteId, $productId) 4965 | { 4966 | return $this->client->delete('quotes/' . $quoteId . '/products/' . $productId); 4967 | } 4968 | } 4969 | 4970 | class WebshopappApiResourceQuotesShippingmethods 4971 | { 4972 | /** 4973 | * @var WebshopappApiClient 4974 | */ 4975 | private $client; 4976 | 4977 | public function __construct(WebshopappApiClient $client) 4978 | { 4979 | $this->client = $client; 4980 | } 4981 | 4982 | /** 4983 | * @param int $quoteId 4984 | * 4985 | * @return array 4986 | * @throws WebshopappApiException 4987 | */ 4988 | public function get($quoteId) 4989 | { 4990 | return $this->client->read('quotes/' . $quoteId . '/shippingmethods'); 4991 | } 4992 | 4993 | /** 4994 | * @param int $quoteId 4995 | * @param array $params 4996 | * 4997 | * @return int 4998 | * @throws WebshopappApiException 4999 | */ 5000 | public function count($quoteId, $params = array()) 5001 | { 5002 | return $this->client->read('quotes/' . $quoteId . '/shippingmethods/count', $params); 5003 | } 5004 | } 5005 | 5006 | class WebshopappApiResourceRedirects 5007 | { 5008 | /** 5009 | * @var WebshopappApiClient 5010 | */ 5011 | private $client; 5012 | 5013 | public function __construct(WebshopappApiClient $client) 5014 | { 5015 | $this->client = $client; 5016 | } 5017 | 5018 | /** 5019 | * @param array $fields 5020 | * 5021 | * @return array 5022 | * @throws WebshopappApiException 5023 | */ 5024 | public function create($fields) 5025 | { 5026 | $fields = array('redirect' => $fields); 5027 | 5028 | return $this->client->create('redirects', $fields); 5029 | } 5030 | 5031 | /** 5032 | * @param int $redirectId 5033 | * @param array $params 5034 | * 5035 | * @return array 5036 | * @throws WebshopappApiException 5037 | */ 5038 | public function get($redirectId = null, $params = array()) 5039 | { 5040 | if (!$redirectId) 5041 | { 5042 | return $this->client->read('redirects', $params); 5043 | } 5044 | else 5045 | { 5046 | return $this->client->read('redirects/' . $redirectId, $params); 5047 | } 5048 | } 5049 | 5050 | /** 5051 | * @param array $params 5052 | * 5053 | * @return int 5054 | * @throws WebshopappApiException 5055 | */ 5056 | public function count($params = array()) 5057 | { 5058 | return $this->client->read('redirects/count', $params); 5059 | } 5060 | 5061 | /** 5062 | * @param int $redirectId 5063 | * @param array $fields 5064 | * 5065 | * @return array 5066 | * @throws WebshopappApiException 5067 | */ 5068 | public function update($redirectId, $fields) 5069 | { 5070 | $fields = array('redirect' => $fields); 5071 | 5072 | return $this->client->update('redirects/' . $redirectId, $fields); 5073 | } 5074 | 5075 | /** 5076 | * @param int $redirectId 5077 | * 5078 | * @return array 5079 | * @throws WebshopappApiException 5080 | */ 5081 | public function delete($redirectId) 5082 | { 5083 | return $this->client->delete('redirects/' . $redirectId); 5084 | } 5085 | } 5086 | 5087 | class WebshopappApiResourceReturns 5088 | { 5089 | /** 5090 | * @var WebshopappApiClient 5091 | */ 5092 | private $client; 5093 | 5094 | public function __construct(WebshopappApiClient $client) 5095 | { 5096 | $this->client = $client; 5097 | } 5098 | 5099 | /** 5100 | * @param int $returnId 5101 | * @param array $params 5102 | * 5103 | * @return array 5104 | * @throws WebshopappApiException 5105 | */ 5106 | public function get($returnId = null, $params = array()) 5107 | { 5108 | if (!$returnId) 5109 | { 5110 | return $this->client->read('returns', $params); 5111 | } 5112 | else 5113 | { 5114 | return $this->client->read('returns/' . $returnId, $params); 5115 | } 5116 | } 5117 | 5118 | /** 5119 | * @param array $params 5120 | * 5121 | * @return int 5122 | * @throws WebshopappApiException 5123 | */ 5124 | public function count($params = array()) 5125 | { 5126 | return $this->client->read('returns/count', $params); 5127 | } 5128 | 5129 | /** 5130 | * @param int $returnId 5131 | * @param array $fields 5132 | * 5133 | * @return array 5134 | * @throws WebshopappApiException 5135 | */ 5136 | public function update($returnId, $fields) 5137 | { 5138 | $fields = array('return' => $fields); 5139 | 5140 | return $this->client->update('returns/' . $returnId, $fields); 5141 | } 5142 | 5143 | /** 5144 | * @param int $returnId 5145 | * 5146 | * @return array 5147 | * @throws WebshopappApiException 5148 | */ 5149 | public function delete($returnId) 5150 | { 5151 | return $this->client->delete('returns/' . $returnId); 5152 | } 5153 | } 5154 | 5155 | class WebshopappApiResourceReviews 5156 | { 5157 | /** 5158 | * @var WebshopappApiClient 5159 | */ 5160 | private $client; 5161 | 5162 | public function __construct(WebshopappApiClient $client) 5163 | { 5164 | $this->client = $client; 5165 | } 5166 | 5167 | /** 5168 | * @param array $fields 5169 | * 5170 | * @return array 5171 | * @throws WebshopappApiException 5172 | */ 5173 | public function create($fields) 5174 | { 5175 | $fields = array('review' => $fields); 5176 | 5177 | return $this->client->create('reviews', $fields); 5178 | } 5179 | 5180 | /** 5181 | * @param int $reviewId 5182 | * @param array $params 5183 | * 5184 | * @return array 5185 | * @throws WebshopappApiException 5186 | */ 5187 | public function get($reviewId = null, $params = array()) 5188 | { 5189 | if (!$reviewId) 5190 | { 5191 | return $this->client->read('reviews', $params); 5192 | } 5193 | else 5194 | { 5195 | return $this->client->read('reviews/' . $reviewId, $params); 5196 | } 5197 | } 5198 | 5199 | /** 5200 | * @param array $params 5201 | * 5202 | * @return int 5203 | * @throws WebshopappApiException 5204 | */ 5205 | public function count($params = array()) 5206 | { 5207 | return $this->client->read('reviews/count', $params); 5208 | } 5209 | 5210 | /** 5211 | * @param int $reviewId 5212 | * @param array $fields 5213 | * 5214 | * @return array 5215 | * @throws WebshopappApiException 5216 | */ 5217 | public function update($reviewId, $fields) 5218 | { 5219 | $fields = array('review' => $fields); 5220 | 5221 | return $this->client->update('reviews/' . $reviewId, $fields); 5222 | } 5223 | 5224 | /** 5225 | * @param int $reviewId 5226 | * 5227 | * @return array 5228 | * @throws WebshopappApiException 5229 | */ 5230 | public function delete($reviewId) 5231 | { 5232 | return $this->client->delete('reviews/' . $reviewId); 5233 | } 5234 | } 5235 | 5236 | class WebshopappApiResourceSets 5237 | { 5238 | /** 5239 | * @var WebshopappApiClient 5240 | */ 5241 | private $client; 5242 | 5243 | public function __construct(WebshopappApiClient $client) 5244 | { 5245 | $this->client = $client; 5246 | } 5247 | 5248 | /** 5249 | * @param array $fields 5250 | * 5251 | * @return array 5252 | * @throws WebshopappApiException 5253 | */ 5254 | public function create($fields) 5255 | { 5256 | $fields = array('set' => $fields); 5257 | 5258 | return $this->client->create('sets', $fields); 5259 | } 5260 | 5261 | /** 5262 | * @param int $setId 5263 | * @param array $params 5264 | * 5265 | * @return array 5266 | * @throws WebshopappApiException 5267 | */ 5268 | public function get($setId = null, $params = array()) 5269 | { 5270 | if (!$setId) 5271 | { 5272 | return $this->client->read('sets', $params); 5273 | } 5274 | else 5275 | { 5276 | return $this->client->read('sets/' . $setId, $params); 5277 | } 5278 | } 5279 | 5280 | /** 5281 | * @param array $params 5282 | * 5283 | * @return int 5284 | * @throws WebshopappApiException 5285 | */ 5286 | public function count($params = array()) 5287 | { 5288 | return $this->client->read('sets/count', $params); 5289 | } 5290 | 5291 | /** 5292 | * @param int $setId 5293 | * @param array $fields 5294 | * 5295 | * @return array 5296 | * @throws WebshopappApiException 5297 | */ 5298 | public function update($setId, $fields) 5299 | { 5300 | $fields = array('set' => $fields); 5301 | 5302 | return $this->client->update('sets/' . $setId, $fields); 5303 | } 5304 | 5305 | /** 5306 | * @param int $setId 5307 | * 5308 | * @return array 5309 | * @throws WebshopappApiException 5310 | */ 5311 | public function delete($setId) 5312 | { 5313 | return $this->client->delete('sets/' . $setId); 5314 | } 5315 | } 5316 | 5317 | class WebshopappApiResourceShipments 5318 | { 5319 | /** 5320 | * @var WebshopappApiClient 5321 | */ 5322 | private $client; 5323 | 5324 | public function __construct(WebshopappApiClient $client) 5325 | { 5326 | $this->client = $client; 5327 | } 5328 | 5329 | /** 5330 | * @param int $shipmentId 5331 | * @param array $params 5332 | * 5333 | * @return array 5334 | * @throws WebshopappApiException 5335 | */ 5336 | public function get($shipmentId = null, $params = array()) 5337 | { 5338 | if (!$shipmentId) 5339 | { 5340 | return $this->client->read('shipments', $params); 5341 | } 5342 | else 5343 | { 5344 | return $this->client->read('shipments/' . $shipmentId, $params); 5345 | } 5346 | } 5347 | 5348 | /** 5349 | * @param array $params 5350 | * 5351 | * @return int 5352 | * @throws WebshopappApiException 5353 | */ 5354 | public function count($params = array()) 5355 | { 5356 | return $this->client->read('shipments/count', $params); 5357 | } 5358 | 5359 | /** 5360 | * @param int $shipmentId 5361 | * @param array $fields 5362 | * 5363 | * @return array 5364 | * @throws WebshopappApiException 5365 | */ 5366 | public function update($shipmentId, $fields) 5367 | { 5368 | $fields = array('shipment' => $fields); 5369 | 5370 | return $this->client->update('shipments/' . $shipmentId, $fields); 5371 | } 5372 | } 5373 | 5374 | class WebshopappApiResourceShipmentsMetafields 5375 | { 5376 | /** 5377 | * @var WebshopappApiClient 5378 | */ 5379 | private $client; 5380 | 5381 | public function __construct(WebshopappApiClient $client) 5382 | { 5383 | $this->client = $client; 5384 | } 5385 | 5386 | /** 5387 | * @param int $shipmentId 5388 | * @param array $fields 5389 | * 5390 | * @return array 5391 | * @throws WebshopappApiException 5392 | */ 5393 | public function create($shipmentId, $fields) 5394 | { 5395 | $fields = array('shipmentMetafield' => $fields); 5396 | 5397 | return $this->client->create('shipments/' . $shipmentId . '/metafields', $fields); 5398 | } 5399 | 5400 | /** 5401 | * @param int $shipmentId 5402 | * @param int $metafieldId 5403 | * @param array $params 5404 | * 5405 | * @return array 5406 | * @throws WebshopappApiException 5407 | */ 5408 | public function get($shipmentId, $metafieldId = null, $params = array()) 5409 | { 5410 | if (!$metafieldId) 5411 | { 5412 | return $this->client->read('shipments/' . $shipmentId . '/metafields', $params); 5413 | } 5414 | else 5415 | { 5416 | return $this->client->read('shipments/' . $shipmentId . '/metafields/' . $metafieldId, $params); 5417 | } 5418 | } 5419 | 5420 | /** 5421 | * @param int $shipmentId 5422 | * @param array $params 5423 | * 5424 | * @return int 5425 | * @throws WebshopappApiException 5426 | */ 5427 | public function count($shipmentId, $params = array()) 5428 | { 5429 | return $this->client->read('shipments/' . $shipmentId . '/metafields/count', $params); 5430 | } 5431 | 5432 | /** 5433 | * @param int $shipmentId 5434 | * @param int $metafieldId 5435 | * @param array $fields 5436 | * 5437 | * @return array 5438 | * @throws WebshopappApiException 5439 | */ 5440 | public function update($shipmentId, $metafieldId, $fields) 5441 | { 5442 | $fields = array('shipmentMetafield' => $fields); 5443 | 5444 | return $this->client->update('shipments/' . $shipmentId . '/metafields/' . $metafieldId, $fields); 5445 | } 5446 | 5447 | /** 5448 | * @param int $shipmentId 5449 | * @param int $metafieldId 5450 | * 5451 | * @return array 5452 | * @throws WebshopappApiException 5453 | */ 5454 | public function delete($shipmentId, $metafieldId) 5455 | { 5456 | return $this->client->delete('shipments/' . $shipmentId . '/metafields/' . $metafieldId); 5457 | } 5458 | } 5459 | 5460 | class WebshopappApiResourceShipmentsProducts 5461 | { 5462 | /** 5463 | * @var WebshopappApiClient 5464 | */ 5465 | private $client; 5466 | 5467 | public function __construct(WebshopappApiClient $client) 5468 | { 5469 | $this->client = $client; 5470 | } 5471 | 5472 | /** 5473 | * @param int $shipmentId 5474 | * @param int $productId 5475 | * @param array $params 5476 | * 5477 | * @return array 5478 | * @throws WebshopappApiException 5479 | */ 5480 | public function get($shipmentId, $productId = null, $params = array()) 5481 | { 5482 | if (!$productId) 5483 | { 5484 | return $this->client->read('shipments/' . $shipmentId . '/products', $params); 5485 | } 5486 | else 5487 | { 5488 | return $this->client->read('shipments/' . $shipmentId . '/products/' . $productId, $params); 5489 | } 5490 | } 5491 | 5492 | /** 5493 | * @param int $shipmentId 5494 | * @param array $params 5495 | * 5496 | * @return int 5497 | * @throws WebshopappApiException 5498 | */ 5499 | public function count($shipmentId, $params = array()) 5500 | { 5501 | return $this->client->read('shipments/' . $shipmentId . '/products/count', $params); 5502 | } 5503 | } 5504 | 5505 | class WebshopappApiResourceShippingmethods 5506 | { 5507 | /** 5508 | * @var WebshopappApiClient 5509 | */ 5510 | private $client; 5511 | 5512 | public function __construct(WebshopappApiClient $client) 5513 | { 5514 | $this->client = $client; 5515 | } 5516 | 5517 | /** 5518 | * @param int $shippingmethodId 5519 | * @param array $params 5520 | * 5521 | * @return array 5522 | * @throws WebshopappApiException 5523 | */ 5524 | public function get($shippingmethodId = null, $params = array()) 5525 | { 5526 | if (!$shippingmethodId) 5527 | { 5528 | return $this->client->read('shippingmethods', $params); 5529 | } 5530 | else 5531 | { 5532 | return $this->client->read('shippingmethods/' . $shippingmethodId, $params); 5533 | } 5534 | } 5535 | 5536 | /** 5537 | * @param array $params 5538 | * 5539 | * @return int 5540 | * @throws WebshopappApiException 5541 | */ 5542 | public function count($params = array()) 5543 | { 5544 | return $this->client->read('shippingmethods/count', $params); 5545 | } 5546 | } 5547 | 5548 | class WebshopappApiResourceShippingmethodsCountries 5549 | { 5550 | /** 5551 | * @var WebshopappApiClient 5552 | */ 5553 | private $client; 5554 | 5555 | public function __construct(WebshopappApiClient $client) 5556 | { 5557 | $this->client = $client; 5558 | } 5559 | 5560 | /** 5561 | * @param int $shippingmethodId 5562 | * @param int $countryId 5563 | * @param array $params 5564 | * 5565 | * @return array 5566 | * @throws WebshopappApiException 5567 | */ 5568 | public function get($shippingmethodId, $countryId = null, $params = array()) 5569 | { 5570 | if (!$countryId) 5571 | { 5572 | return $this->client->read('shippingmethods/' . $shippingmethodId . '/countries', $params); 5573 | } 5574 | else 5575 | { 5576 | return $this->client->read('shippingmethods/' . $shippingmethodId . '/countries/' . $countryId, $params); 5577 | } 5578 | } 5579 | 5580 | /** 5581 | * @param int $shippingmethodId 5582 | * @param array $params 5583 | * 5584 | * @return int 5585 | * @throws WebshopappApiException 5586 | */ 5587 | public function count($shippingmethodId, $params = array()) 5588 | { 5589 | return $this->client->read('shippingmethods/' . $shippingmethodId . '/countries/count', $params); 5590 | } 5591 | } 5592 | 5593 | class WebshopappApiResourceShippingmethodsValues 5594 | { 5595 | /** 5596 | * @var WebshopappApiClient 5597 | */ 5598 | private $client; 5599 | 5600 | public function __construct(WebshopappApiClient $client) 5601 | { 5602 | $this->client = $client; 5603 | } 5604 | 5605 | /** 5606 | * @param int $shippingmethodId 5607 | * @param int $valueId 5608 | * @param array $params 5609 | * 5610 | * @return array 5611 | * @throws WebshopappApiException 5612 | */ 5613 | public function get($shippingmethodId, $valueId = null, $params = array()) 5614 | { 5615 | if (!$valueId) 5616 | { 5617 | return $this->client->read('shippingmethods/' . $shippingmethodId . '/values', $params); 5618 | } 5619 | else 5620 | { 5621 | return $this->client->read('shippingmethods/' . $shippingmethodId . '/values/' . $valueId, $params); 5622 | } 5623 | } 5624 | 5625 | /** 5626 | * @param int $shippingmethodId 5627 | * @param array $params 5628 | * 5629 | * @return int 5630 | * @throws WebshopappApiException 5631 | */ 5632 | public function count($shippingmethodId, $params = array()) 5633 | { 5634 | return $this->client->read('shippingmethods/' . $shippingmethodId . '/values/count', $params); 5635 | } 5636 | } 5637 | 5638 | class WebshopappApiResourceShop 5639 | { 5640 | /** 5641 | * @var WebshopappApiClient 5642 | */ 5643 | private $client; 5644 | 5645 | public function __construct(WebshopappApiClient $client) 5646 | { 5647 | $this->client = $client; 5648 | } 5649 | 5650 | /** 5651 | * @return array 5652 | * @throws WebshopappApiException 5653 | */ 5654 | public function get() 5655 | { 5656 | return $this->client->read('shop'); 5657 | } 5658 | 5659 | /** 5660 | * @param array $fields 5661 | * 5662 | * @return array 5663 | * @throws WebshopappApiException 5664 | */ 5665 | public function update($fields) 5666 | { 5667 | $fields = array('shop' => $fields); 5668 | 5669 | return $this->client->update('shop', $fields); 5670 | } 5671 | } 5672 | 5673 | class WebshopappApiResourceShopCompany 5674 | { 5675 | /** 5676 | * @var WebshopappApiClient 5677 | */ 5678 | private $client; 5679 | 5680 | public function __construct(WebshopappApiClient $client) 5681 | { 5682 | $this->client = $client; 5683 | } 5684 | 5685 | /** 5686 | * @return array 5687 | * @throws WebshopappApiException 5688 | */ 5689 | public function get() 5690 | { 5691 | return $this->client->read('shop/company'); 5692 | } 5693 | } 5694 | 5695 | class WebshopappApiResourceShopJavascript 5696 | { 5697 | /** 5698 | * @var WebshopappApiClient 5699 | */ 5700 | private $client; 5701 | 5702 | public function __construct(WebshopappApiClient $client) 5703 | { 5704 | $this->client = $client; 5705 | } 5706 | 5707 | /** 5708 | * @return array 5709 | * @throws WebshopappApiException 5710 | */ 5711 | public function get() 5712 | { 5713 | return $this->client->read('shop/javascript'); 5714 | } 5715 | 5716 | /** 5717 | * @param array $fields 5718 | * 5719 | * @return array 5720 | * @throws WebshopappApiException 5721 | */ 5722 | public function update($fields) 5723 | { 5724 | $fields = array('shopJavascript' => $fields); 5725 | 5726 | return $this->client->update('shop/javascript', $fields); 5727 | } 5728 | } 5729 | 5730 | class WebshopappApiResourceShopLimits 5731 | { 5732 | /** 5733 | * @var WebshopappApiClient 5734 | */ 5735 | private $client; 5736 | 5737 | public function __construct(WebshopappApiClient $client) 5738 | { 5739 | $this->client = $client; 5740 | } 5741 | 5742 | /** 5743 | * @return array 5744 | * @throws WebshopappApiException 5745 | */ 5746 | public function get() 5747 | { 5748 | return $this->client->read('shop/limits'); 5749 | } 5750 | } 5751 | 5752 | class WebshopappApiResourceShopMetafields 5753 | { 5754 | /** 5755 | * @var WebshopappApiClient 5756 | */ 5757 | private $client; 5758 | 5759 | public function __construct(WebshopappApiClient $client) 5760 | { 5761 | $this->client = $client; 5762 | } 5763 | 5764 | /** 5765 | * @param array $fields 5766 | * 5767 | * @return array 5768 | * @throws WebshopappApiException 5769 | */ 5770 | public function create($fields) 5771 | { 5772 | $fields = array('shopMetafield' => $fields); 5773 | 5774 | return $this->client->create('shop/metafields', $fields); 5775 | } 5776 | 5777 | /** 5778 | * @param int $metafieldId 5779 | * @param array $params 5780 | * 5781 | * @return array 5782 | * @throws WebshopappApiException 5783 | */ 5784 | public function get($metafieldId = null, $params = array()) 5785 | { 5786 | if (!$metafieldId) 5787 | { 5788 | return $this->client->read('shop/metafields', $params); 5789 | } 5790 | else 5791 | { 5792 | return $this->client->read('shop/metafields/' . $metafieldId, $params); 5793 | } 5794 | } 5795 | 5796 | /** 5797 | * @param array $params 5798 | * 5799 | * @return int 5800 | * @throws WebshopappApiException 5801 | */ 5802 | public function count($params = array()) 5803 | { 5804 | return $this->client->read('shop/metafields/count', $params); 5805 | } 5806 | 5807 | /** 5808 | * @param int $metafieldId 5809 | * @param array $fields 5810 | * 5811 | * @return array 5812 | * @throws WebshopappApiException 5813 | */ 5814 | public function update($metafieldId, $fields) 5815 | { 5816 | $fields = array('shopMetafield' => $fields); 5817 | 5818 | return $this->client->update('shop/metafields/' . $metafieldId, $fields); 5819 | } 5820 | 5821 | /** 5822 | * @param int $metafieldId 5823 | * 5824 | * @return array 5825 | * @throws WebshopappApiException 5826 | */ 5827 | public function delete($metafieldId) 5828 | { 5829 | return $this->client->delete('shop/metafields/' . $metafieldId); 5830 | } 5831 | } 5832 | 5833 | class WebshopappApiResourceShopScripts 5834 | { 5835 | /** 5836 | * @var WebshopappApiClient 5837 | */ 5838 | private $client; 5839 | 5840 | public function __construct(WebshopappApiClient $client) 5841 | { 5842 | $this->client = $client; 5843 | } 5844 | 5845 | /** 5846 | * @param array $fields 5847 | * 5848 | * @return array 5849 | * @throws WebshopappApiException 5850 | */ 5851 | public function create($fields) 5852 | { 5853 | $fields = array('shopScript' => $fields); 5854 | 5855 | return $this->client->create('shop/scripts', $fields); 5856 | } 5857 | 5858 | /** 5859 | * @param int $scriptId 5860 | * @param array $params 5861 | * 5862 | * @return array 5863 | * @throws WebshopappApiException 5864 | */ 5865 | public function get($scriptId = null, $params = array()) 5866 | { 5867 | if (!$scriptId) 5868 | { 5869 | return $this->client->read('shop/scripts', $params); 5870 | } 5871 | else 5872 | { 5873 | return $this->client->read('shop/scripts/' . $scriptId, $params); 5874 | } 5875 | } 5876 | 5877 | /** 5878 | * @param array $params 5879 | * 5880 | * @return int 5881 | * @throws WebshopappApiException 5882 | */ 5883 | public function count($params = array()) 5884 | { 5885 | return $this->client->read('shop/scripts/count', $params); 5886 | } 5887 | 5888 | /** 5889 | * @param int $scriptId 5890 | * @param array $fields 5891 | * 5892 | * @return array 5893 | * @throws WebshopappApiException 5894 | */ 5895 | public function update($scriptId, $fields) 5896 | { 5897 | $fields = array('shopScript' => $fields); 5898 | 5899 | return $this->client->update('shop/scripts/' . $scriptId, $fields); 5900 | } 5901 | 5902 | /** 5903 | * @param int $scriptId 5904 | * 5905 | * @return array 5906 | * @throws WebshopappApiException 5907 | */ 5908 | public function delete($scriptId) 5909 | { 5910 | return $this->client->delete('shop/scripts/' . $scriptId); 5911 | } 5912 | } 5913 | 5914 | class WebshopappApiResourceShopSettings 5915 | { 5916 | /** 5917 | * @var WebshopappApiClient 5918 | */ 5919 | private $client; 5920 | 5921 | public function __construct(WebshopappApiClient $client) 5922 | { 5923 | $this->client = $client; 5924 | } 5925 | 5926 | /** 5927 | * @return array 5928 | * @throws WebshopappApiException 5929 | */ 5930 | public function get() 5931 | { 5932 | return $this->client->read('shop/settings'); 5933 | } 5934 | } 5935 | 5936 | class WebshopappApiResourceShopTracking 5937 | { 5938 | /** 5939 | * @var WebshopappApiClient 5940 | */ 5941 | private $client; 5942 | 5943 | public function __construct(WebshopappApiClient $client) 5944 | { 5945 | $this->client = $client; 5946 | } 5947 | 5948 | /** 5949 | * @param array $fields 5950 | * 5951 | * @return array 5952 | * @throws WebshopappApiException 5953 | */ 5954 | public function create($fields) 5955 | { 5956 | $fields = array('shopTracking' => $fields); 5957 | 5958 | return $this->client->create('shop/tracking', $fields); 5959 | } 5960 | 5961 | /** 5962 | * @param int $trackingId 5963 | * @param array $params 5964 | * 5965 | * @return array 5966 | * @throws WebshopappApiException 5967 | */ 5968 | public function get($trackingId = null, $params = array()) 5969 | { 5970 | if (!$trackingId) 5971 | { 5972 | return $this->client->read('shop/tracking', $params); 5973 | } 5974 | else 5975 | { 5976 | return $this->client->read('shop/tracking/' . $trackingId, $params); 5977 | } 5978 | } 5979 | 5980 | /** 5981 | * @param array $params 5982 | * 5983 | * @return int 5984 | * @throws WebshopappApiException 5985 | */ 5986 | public function count($params = array()) 5987 | { 5988 | return $this->client->read('shop/tracking/count', $params); 5989 | } 5990 | 5991 | /** 5992 | * @param int $trackingId 5993 | * @param array $fields 5994 | * 5995 | * @return array 5996 | * @throws WebshopappApiException 5997 | */ 5998 | public function update($trackingId, $fields) 5999 | { 6000 | $fields = array('shopTracking' => $fields); 6001 | 6002 | return $this->client->update('shop/tracking/' . $trackingId, $fields); 6003 | } 6004 | 6005 | /** 6006 | * @param int $trackingId 6007 | * 6008 | * @return array 6009 | * @throws WebshopappApiException 6010 | */ 6011 | public function delete($trackingId) 6012 | { 6013 | return $this->client->delete('shop/tracking/' . $trackingId); 6014 | } 6015 | } 6016 | 6017 | class WebshopappApiResourceShopWebsite 6018 | { 6019 | /** 6020 | * @var WebshopappApiClient 6021 | */ 6022 | private $client; 6023 | 6024 | public function __construct(WebshopappApiClient $client) 6025 | { 6026 | $this->client = $client; 6027 | } 6028 | 6029 | /** 6030 | * @return array 6031 | * @throws WebshopappApiException 6032 | */ 6033 | public function get() 6034 | { 6035 | return $this->client->read('shop/website'); 6036 | } 6037 | } 6038 | 6039 | class WebshopappApiResourceSubscriptions 6040 | { 6041 | /** 6042 | * @var WebshopappApiClient 6043 | */ 6044 | private $client; 6045 | 6046 | public function __construct(WebshopappApiClient $client) 6047 | { 6048 | $this->client = $client; 6049 | } 6050 | 6051 | /** 6052 | * @param array $fields 6053 | * 6054 | * @return array 6055 | * @throws WebshopappApiException 6056 | */ 6057 | public function create($fields) 6058 | { 6059 | $fields = array('subscription' => $fields); 6060 | 6061 | return $this->client->create('subscriptions', $fields); 6062 | } 6063 | 6064 | /** 6065 | * @param int $subscriptionId 6066 | * @param array $params 6067 | * 6068 | * @return array 6069 | * @throws WebshopappApiException 6070 | */ 6071 | public function get($subscriptionId = null, $params = array()) 6072 | { 6073 | if (!$subscriptionId) 6074 | { 6075 | return $this->client->read('subscriptions', $params); 6076 | } 6077 | else 6078 | { 6079 | return $this->client->read('subscriptions/' . $subscriptionId, $params); 6080 | } 6081 | } 6082 | 6083 | /** 6084 | * @param array $params 6085 | * 6086 | * @return int 6087 | * @throws WebshopappApiException 6088 | */ 6089 | public function count($params = array()) 6090 | { 6091 | return $this->client->read('subscriptions/count', $params); 6092 | } 6093 | 6094 | /** 6095 | * @param int $subscriptionId 6096 | * @param array $fields 6097 | * 6098 | * @return array 6099 | * @throws WebshopappApiException 6100 | */ 6101 | public function update($subscriptionId, $fields) 6102 | { 6103 | $fields = array('subscription' => $fields); 6104 | 6105 | return $this->client->update('subscriptions/' . $subscriptionId, $fields); 6106 | } 6107 | 6108 | /** 6109 | * @param int $subscriptionId 6110 | * 6111 | * @return array 6112 | * @throws WebshopappApiException 6113 | */ 6114 | public function delete($subscriptionId) 6115 | { 6116 | return $this->client->delete('subscriptions/' . $subscriptionId); 6117 | } 6118 | } 6119 | 6120 | class WebshopappApiResourceSuppliers 6121 | { 6122 | /** 6123 | * @var WebshopappApiClient 6124 | */ 6125 | private $client; 6126 | 6127 | public function __construct(WebshopappApiClient $client) 6128 | { 6129 | $this->client = $client; 6130 | } 6131 | 6132 | /** 6133 | * @param array $fields 6134 | * 6135 | * @return array 6136 | * @throws WebshopappApiException 6137 | */ 6138 | public function create($fields) 6139 | { 6140 | $fields = array('supplier' => $fields); 6141 | 6142 | return $this->client->create('suppliers', $fields); 6143 | } 6144 | 6145 | /** 6146 | * @param int $supplierId 6147 | * @param array $params 6148 | * 6149 | * @return array 6150 | * @throws WebshopappApiException 6151 | */ 6152 | public function get($supplierId = null, $params = array()) 6153 | { 6154 | if (!$supplierId) 6155 | { 6156 | return $this->client->read('suppliers', $params); 6157 | } 6158 | else 6159 | { 6160 | return $this->client->read('suppliers/' . $supplierId, $params); 6161 | } 6162 | } 6163 | 6164 | /** 6165 | * @param array $params 6166 | * 6167 | * @return int 6168 | * @throws WebshopappApiException 6169 | */ 6170 | public function count($params = array()) 6171 | { 6172 | return $this->client->read('suppliers/count', $params); 6173 | } 6174 | 6175 | /** 6176 | * @param int $supplierId 6177 | * @param array $fields 6178 | * 6179 | * @return array 6180 | * @throws WebshopappApiException 6181 | */ 6182 | public function update($supplierId, $fields) 6183 | { 6184 | $fields = array('supplier' => $fields); 6185 | 6186 | return $this->client->update('suppliers/' . $supplierId, $fields); 6187 | } 6188 | 6189 | /** 6190 | * @param int $supplierId 6191 | * 6192 | * @return array 6193 | * @throws WebshopappApiException 6194 | */ 6195 | public function delete($supplierId) 6196 | { 6197 | return $this->client->delete('suppliers/' . $supplierId); 6198 | } 6199 | } 6200 | 6201 | class WebshopappApiResourceTags 6202 | { 6203 | /** 6204 | * @var WebshopappApiClient 6205 | */ 6206 | private $client; 6207 | 6208 | public function __construct(WebshopappApiClient $client) 6209 | { 6210 | $this->client = $client; 6211 | } 6212 | 6213 | /** 6214 | * @param array $fields 6215 | * 6216 | * @return array 6217 | * @throws WebshopappApiException 6218 | */ 6219 | public function create($fields) 6220 | { 6221 | $fields = array('tag' => $fields); 6222 | 6223 | return $this->client->create('tags', $fields); 6224 | } 6225 | 6226 | /** 6227 | * @param int $tagId 6228 | * @param array $params 6229 | * 6230 | * @return array 6231 | * @throws WebshopappApiException 6232 | */ 6233 | public function get($tagId = null, $params = array()) 6234 | { 6235 | if (!$tagId) 6236 | { 6237 | return $this->client->read('tags', $params); 6238 | } 6239 | else 6240 | { 6241 | return $this->client->read('tags/' . $tagId, $params); 6242 | } 6243 | } 6244 | 6245 | /** 6246 | * @param array $params 6247 | * 6248 | * @return int 6249 | * @throws WebshopappApiException 6250 | */ 6251 | public function count($params = array()) 6252 | { 6253 | return $this->client->read('tags/count', $params); 6254 | } 6255 | 6256 | /** 6257 | * @param int $tagId 6258 | * @param array $fields 6259 | * 6260 | * @return array 6261 | * @throws WebshopappApiException 6262 | */ 6263 | public function update($tagId, $fields) 6264 | { 6265 | $fields = array('tag' => $fields); 6266 | 6267 | return $this->client->update('tags/' . $tagId, $fields); 6268 | } 6269 | 6270 | /** 6271 | * @param int $tagId 6272 | * 6273 | * @return array 6274 | * @throws WebshopappApiException 6275 | */ 6276 | public function delete($tagId) 6277 | { 6278 | return $this->client->delete('tags/' . $tagId); 6279 | } 6280 | } 6281 | 6282 | class WebshopappApiResourceTagsProducts 6283 | { 6284 | /** 6285 | * @var WebshopappApiClient 6286 | */ 6287 | private $client; 6288 | 6289 | public function __construct(WebshopappApiClient $client) 6290 | { 6291 | $this->client = $client; 6292 | } 6293 | 6294 | /** 6295 | * @param array $fields 6296 | * 6297 | * @return array 6298 | * @throws WebshopappApiException 6299 | */ 6300 | public function create($fields) 6301 | { 6302 | $fields = array('tagsProduct' => $fields); 6303 | 6304 | return $this->client->create('tags/products', $fields); 6305 | } 6306 | 6307 | /** 6308 | * @param int $relationId 6309 | * @param array $params 6310 | * 6311 | * @return array 6312 | * @throws WebshopappApiException 6313 | */ 6314 | public function get($relationId = null, $params = array()) 6315 | { 6316 | if (!$relationId) 6317 | { 6318 | return $this->client->read('tags/products', $params); 6319 | } 6320 | else 6321 | { 6322 | return $this->client->read('tags/products/' . $relationId, $params); 6323 | } 6324 | } 6325 | 6326 | /** 6327 | * @param array $params 6328 | * 6329 | * @return int 6330 | * @throws WebshopappApiException 6331 | */ 6332 | public function count($params = array()) 6333 | { 6334 | return $this->client->read('tags/products/count', $params); 6335 | } 6336 | 6337 | /** 6338 | * @param int $relationId 6339 | * 6340 | * @return array 6341 | * @throws WebshopappApiException 6342 | */ 6343 | public function delete($relationId) 6344 | { 6345 | return $this->client->delete('tags/products/' . $relationId); 6346 | } 6347 | } 6348 | 6349 | class WebshopappApiResourceTaxes 6350 | { 6351 | /** 6352 | * @var WebshopappApiClient 6353 | */ 6354 | private $client; 6355 | 6356 | public function __construct(WebshopappApiClient $client) 6357 | { 6358 | $this->client = $client; 6359 | } 6360 | 6361 | /** 6362 | * @param array $fields 6363 | * 6364 | * @return array 6365 | * @throws WebshopappApiException 6366 | */ 6367 | public function create($fields) 6368 | { 6369 | $fields = array('tax' => $fields); 6370 | 6371 | return $this->client->create('taxes', $fields); 6372 | } 6373 | 6374 | /** 6375 | * @param int $taxId 6376 | * @param array $params 6377 | * 6378 | * @return array 6379 | * @throws WebshopappApiException 6380 | */ 6381 | public function get($taxId = null, $params = array()) 6382 | { 6383 | if (!$taxId) 6384 | { 6385 | return $this->client->read('taxes', $params); 6386 | } 6387 | else 6388 | { 6389 | return $this->client->read('taxes/' . $taxId, $params); 6390 | } 6391 | } 6392 | 6393 | /** 6394 | * @param array $params 6395 | * 6396 | * @return int 6397 | * @throws WebshopappApiException 6398 | */ 6399 | public function count($params = array()) 6400 | { 6401 | return $this->client->read('taxes/count', $params); 6402 | } 6403 | 6404 | /** 6405 | * @param int $taxId 6406 | * @param array $fields 6407 | * 6408 | * @return array 6409 | * @throws WebshopappApiException 6410 | */ 6411 | public function update($taxId, $fields) 6412 | { 6413 | $fields = array('tax' => $fields); 6414 | 6415 | return $this->client->update('taxes/' . $taxId, $fields); 6416 | } 6417 | 6418 | /** 6419 | * @param int $taxId 6420 | * 6421 | * @return array 6422 | * @throws WebshopappApiException 6423 | */ 6424 | public function delete($taxId) 6425 | { 6426 | return $this->client->delete('taxes/' . $taxId); 6427 | } 6428 | } 6429 | 6430 | class WebshopappApiResourceTaxesOverrides 6431 | { 6432 | /** 6433 | * @var WebshopappApiClient 6434 | */ 6435 | private $client; 6436 | 6437 | public function __construct(WebshopappApiClient $client) 6438 | { 6439 | $this->client = $client; 6440 | } 6441 | 6442 | /** 6443 | * @param int $taxId 6444 | * @param array $fields 6445 | * 6446 | * @return array 6447 | * @throws WebshopappApiException 6448 | */ 6449 | public function create($taxId, $fields) 6450 | { 6451 | $fields = array('taxOverride' => $fields); 6452 | 6453 | return $this->client->create('taxes/' . $taxId . '/overrides', $fields); 6454 | } 6455 | 6456 | /** 6457 | * @param int $taxId 6458 | * @param int $taxOverrideId 6459 | * @param array $params 6460 | * 6461 | * @return array 6462 | * @throws WebshopappApiException 6463 | */ 6464 | public function get($taxId, $taxOverrideId = null, $params = array()) 6465 | { 6466 | if (!$taxOverrideId) 6467 | { 6468 | return $this->client->read('taxes/' . $taxId . '/overrides', $params); 6469 | } 6470 | else 6471 | { 6472 | return $this->client->read('taxes/' . $taxId . '/overrides/' . $taxOverrideId, $params); 6473 | } 6474 | } 6475 | 6476 | /** 6477 | * @param int $taxId 6478 | * @param array $params 6479 | * 6480 | * @return int 6481 | * @throws WebshopappApiException 6482 | */ 6483 | public function count($taxId, $params = array()) 6484 | { 6485 | return $this->client->read('taxes/' . $taxId . '/overrides/count', $params); 6486 | } 6487 | 6488 | /** 6489 | * @param int $taxId 6490 | * @param int $taxOverrideId 6491 | * @param array $fields 6492 | * 6493 | * @return array 6494 | * @throws WebshopappApiException 6495 | */ 6496 | public function update($taxId, $taxOverrideId, $fields) 6497 | { 6498 | $fields = array('taxOverride' => $fields); 6499 | 6500 | return $this->client->update('taxes/' . $taxId . '/overrides/' . $taxOverrideId, $fields); 6501 | } 6502 | 6503 | /** 6504 | * @param int $taxId 6505 | * @param int $taxOverrideId 6506 | * 6507 | * @return array 6508 | * @throws WebshopappApiException 6509 | */ 6510 | public function delete($taxId, $taxOverrideId) 6511 | { 6512 | return $this->client->delete('taxes/' . $taxId . '/overrides/' . $taxOverrideId); 6513 | } 6514 | } 6515 | 6516 | class WebshopappApiResourceTextpages 6517 | { 6518 | /** 6519 | * @var WebshopappApiClient 6520 | */ 6521 | private $client; 6522 | 6523 | public function __construct(WebshopappApiClient $client) 6524 | { 6525 | $this->client = $client; 6526 | } 6527 | 6528 | /** 6529 | * @param array $fields 6530 | * 6531 | * @return array 6532 | * @throws WebshopappApiException 6533 | */ 6534 | public function create($fields) 6535 | { 6536 | $fields = array('textpage' => $fields); 6537 | 6538 | return $this->client->create('textpages', $fields); 6539 | } 6540 | 6541 | /** 6542 | * @param int $textpageId 6543 | * @param array $params 6544 | * 6545 | * @return array 6546 | * @throws WebshopappApiException 6547 | */ 6548 | public function get($textpageId = null, $params = array()) 6549 | { 6550 | if (!$textpageId) 6551 | { 6552 | return $this->client->read('textpages', $params); 6553 | } 6554 | else 6555 | { 6556 | return $this->client->read('textpages/' . $textpageId, $params); 6557 | } 6558 | } 6559 | 6560 | /** 6561 | * @param array $params 6562 | * 6563 | * @return int 6564 | * @throws WebshopappApiException 6565 | */ 6566 | public function count($params = array()) 6567 | { 6568 | return $this->client->read('textpages/count', $params); 6569 | } 6570 | 6571 | /** 6572 | * @param int $textpageId 6573 | * @param array $fields 6574 | * 6575 | * @return array 6576 | * @throws WebshopappApiException 6577 | */ 6578 | public function update($textpageId, $fields) 6579 | { 6580 | $fields = array('textpage' => $fields); 6581 | 6582 | return $this->client->update('textpages/' . $textpageId, $fields); 6583 | } 6584 | 6585 | /** 6586 | * @param int $textpageId 6587 | * 6588 | * @return array 6589 | * @throws WebshopappApiException 6590 | */ 6591 | public function delete($textpageId) 6592 | { 6593 | return $this->client->delete('textpages/' . $textpageId); 6594 | } 6595 | } 6596 | 6597 | class WebshopappApiResourceThemeCategories 6598 | { 6599 | /** 6600 | * @var WebshopappApiClient 6601 | */ 6602 | private $client; 6603 | 6604 | public function __construct(WebshopappApiClient $client) 6605 | { 6606 | $this->client = $client; 6607 | } 6608 | 6609 | /** 6610 | * @param array $fields 6611 | * 6612 | * @return array 6613 | * @throws WebshopappApiException 6614 | */ 6615 | public function create($fields) 6616 | { 6617 | $fields = array('themeCategory' => $fields); 6618 | 6619 | return $this->client->create('theme/categories', $fields); 6620 | } 6621 | 6622 | /** 6623 | * @param int $categoryId 6624 | * @param array $params 6625 | * 6626 | * @return array 6627 | * @throws WebshopappApiException 6628 | */ 6629 | public function get($categoryId = null, $params = array()) 6630 | { 6631 | if (!$categoryId) 6632 | { 6633 | return $this->client->read('theme/categories', $params); 6634 | } 6635 | else 6636 | { 6637 | return $this->client->read('theme/categories/' . $categoryId, $params); 6638 | } 6639 | } 6640 | 6641 | /** 6642 | * @param array $params 6643 | * 6644 | * @return int 6645 | * @throws WebshopappApiException 6646 | */ 6647 | public function count($params = array()) 6648 | { 6649 | return $this->client->read('theme/categories/count', $params); 6650 | } 6651 | 6652 | /** 6653 | * @param int $categoryId 6654 | * @param array $fields 6655 | * 6656 | * @return array 6657 | * @throws WebshopappApiException 6658 | */ 6659 | public function update($categoryId, $fields) 6660 | { 6661 | $fields = array('themeCategory' => $fields); 6662 | 6663 | return $this->client->update('theme/categories/' . $categoryId, $fields); 6664 | } 6665 | 6666 | /** 6667 | * @param int $categoryId 6668 | * 6669 | * @return array 6670 | * @throws WebshopappApiException 6671 | */ 6672 | public function delete($categoryId) 6673 | { 6674 | return $this->client->delete('theme/categories/' . $categoryId); 6675 | } 6676 | } 6677 | 6678 | class WebshopappApiResourceThemeProducts 6679 | { 6680 | /** 6681 | * @var WebshopappApiClient 6682 | */ 6683 | private $client; 6684 | 6685 | public function __construct(WebshopappApiClient $client) 6686 | { 6687 | $this->client = $client; 6688 | } 6689 | 6690 | /** 6691 | * @param array $fields 6692 | * 6693 | * @return array 6694 | * @throws WebshopappApiException 6695 | */ 6696 | public function create($fields) 6697 | { 6698 | $fields = array('themeProduct' => $fields); 6699 | 6700 | return $this->client->create('theme/products', $fields); 6701 | } 6702 | 6703 | /** 6704 | * @param int $productId 6705 | * @param array $params 6706 | * 6707 | * @return array 6708 | * @throws WebshopappApiException 6709 | */ 6710 | public function get($productId = null, $params = array()) 6711 | { 6712 | if (!$productId) 6713 | { 6714 | return $this->client->read('theme/products', $params); 6715 | } 6716 | else 6717 | { 6718 | return $this->client->read('theme/products/' . $productId, $params); 6719 | } 6720 | } 6721 | 6722 | /** 6723 | * @param array $params 6724 | * 6725 | * @return int 6726 | * @throws WebshopappApiException 6727 | */ 6728 | public function count($params = array()) 6729 | { 6730 | return $this->client->read('theme/products/count', $params); 6731 | } 6732 | 6733 | /** 6734 | * @param int $productId 6735 | * @param array $fields 6736 | * 6737 | * @return array 6738 | * @throws WebshopappApiException 6739 | */ 6740 | public function update($productId, $fields) 6741 | { 6742 | $fields = array('themeProduct' => $fields); 6743 | 6744 | return $this->client->update('theme/products/' . $productId, $fields); 6745 | } 6746 | 6747 | /** 6748 | * @param int $productId 6749 | * 6750 | * @return array 6751 | * @throws WebshopappApiException 6752 | */ 6753 | public function delete($productId) 6754 | { 6755 | return $this->client->delete('theme/products/' . $productId); 6756 | } 6757 | } 6758 | 6759 | class WebshopappApiResourceTickets 6760 | { 6761 | /** 6762 | * @var WebshopappApiClient 6763 | */ 6764 | private $client; 6765 | 6766 | public function __construct(WebshopappApiClient $client) 6767 | { 6768 | $this->client = $client; 6769 | } 6770 | 6771 | /** 6772 | * @param array $fields 6773 | * 6774 | * @return array 6775 | * @throws WebshopappApiException 6776 | */ 6777 | public function create($fields) 6778 | { 6779 | $fields = array('ticket' => $fields); 6780 | 6781 | return $this->client->create('tickets', $fields); 6782 | } 6783 | 6784 | /** 6785 | * @param int $ticketId 6786 | * @param array $params 6787 | * 6788 | * @return array 6789 | * @throws WebshopappApiException 6790 | */ 6791 | public function get($ticketId = null, $params = array()) 6792 | { 6793 | if (!$ticketId) 6794 | { 6795 | return $this->client->read('tickets', $params); 6796 | } 6797 | else 6798 | { 6799 | return $this->client->read('tickets/' . $ticketId, $params); 6800 | } 6801 | } 6802 | 6803 | /** 6804 | * @param array $params 6805 | * 6806 | * @return int 6807 | * @throws WebshopappApiException 6808 | */ 6809 | public function count($params = array()) 6810 | { 6811 | return $this->client->read('tickets/count', $params); 6812 | } 6813 | 6814 | /** 6815 | * @param int $ticketId 6816 | * @param array $fields 6817 | * 6818 | * @return array 6819 | * @throws WebshopappApiException 6820 | */ 6821 | public function update($ticketId, $fields) 6822 | { 6823 | $fields = array('ticket' => $fields); 6824 | 6825 | return $this->client->update('tickets/' . $ticketId, $fields); 6826 | } 6827 | 6828 | /** 6829 | * @param int $ticketId 6830 | * 6831 | * @return array 6832 | * @throws WebshopappApiException 6833 | */ 6834 | public function delete($ticketId) 6835 | { 6836 | return $this->client->delete('tickets/' . $ticketId); 6837 | } 6838 | } 6839 | 6840 | class WebshopappApiResourceTicketsMessages 6841 | { 6842 | /** 6843 | * @var WebshopappApiClient 6844 | */ 6845 | private $client; 6846 | 6847 | public function __construct(WebshopappApiClient $client) 6848 | { 6849 | $this->client = $client; 6850 | } 6851 | 6852 | /** 6853 | * @param int $ticketId 6854 | * @param array $fields 6855 | * 6856 | * @return array 6857 | * @throws WebshopappApiException 6858 | */ 6859 | public function create($ticketId, $fields) 6860 | { 6861 | $fields = array('ticketMessage' => $fields); 6862 | 6863 | return $this->client->create('tickets/' . $ticketId . '/messages', $fields); 6864 | } 6865 | 6866 | /** 6867 | * @param int $ticketId 6868 | * @param int $messageId 6869 | * @param array $params 6870 | * 6871 | * @return array 6872 | * @throws WebshopappApiException 6873 | */ 6874 | public function get($ticketId, $messageId = null, $params = array()) 6875 | { 6876 | if (!$messageId) 6877 | { 6878 | return $this->client->read('tickets/' . $ticketId . '/messages', $params); 6879 | } 6880 | else 6881 | { 6882 | return $this->client->read('tickets/' . $ticketId . '/messages/' . $messageId, $params); 6883 | } 6884 | } 6885 | 6886 | /** 6887 | * @param int $ticketId 6888 | * @param array $params 6889 | * 6890 | * @return int 6891 | * @throws WebshopappApiException 6892 | */ 6893 | public function count($ticketId, $params = array()) 6894 | { 6895 | return $this->client->read('tickets/' . $ticketId . '/messages/count', $params); 6896 | } 6897 | 6898 | /** 6899 | * @param int $ticketId 6900 | * @param int $messageId 6901 | * @param array $fields 6902 | * 6903 | * @return array 6904 | * @throws WebshopappApiException 6905 | */ 6906 | public function update($ticketId, $messageId, $fields) 6907 | { 6908 | $fields = array('ticketMessage' => $fields); 6909 | 6910 | return $this->client->update('tickets/' . $ticketId . '/messages/' . $messageId, $fields); 6911 | } 6912 | 6913 | /** 6914 | * @param int $ticketId 6915 | * @param int $messageId 6916 | * 6917 | * @return array 6918 | * @throws WebshopappApiException 6919 | */ 6920 | public function delete($ticketId, $messageId) 6921 | { 6922 | return $this->client->delete('tickets/' . $ticketId . '/messages/' . $messageId); 6923 | } 6924 | } 6925 | 6926 | class WebshopappApiResourceTime 6927 | { 6928 | /** 6929 | * @var WebshopappApiClient 6930 | */ 6931 | private $client; 6932 | 6933 | public function __construct(WebshopappApiClient $client) 6934 | { 6935 | $this->client = $client; 6936 | } 6937 | 6938 | /** 6939 | * @return array 6940 | * @throws WebshopappApiException 6941 | */ 6942 | public function get() 6943 | { 6944 | return $this->client->read('time'); 6945 | } 6946 | } 6947 | 6948 | class WebshopappApiResourceTypes 6949 | { 6950 | /** 6951 | * @var WebshopappApiClient 6952 | */ 6953 | private $client; 6954 | 6955 | public function __construct(WebshopappApiClient $client) 6956 | { 6957 | $this->client = $client; 6958 | } 6959 | 6960 | /** 6961 | * @param array $fields 6962 | * 6963 | * @return array 6964 | * @throws WebshopappApiException 6965 | */ 6966 | public function create($fields) 6967 | { 6968 | $fields = array('type' => $fields); 6969 | 6970 | return $this->client->create('types', $fields); 6971 | } 6972 | 6973 | /** 6974 | * @param int $typeId 6975 | * @param array $params 6976 | * 6977 | * @return array 6978 | * @throws WebshopappApiException 6979 | */ 6980 | public function get($typeId = null, $params = array()) 6981 | { 6982 | if (!$typeId) 6983 | { 6984 | return $this->client->read('types', $params); 6985 | } 6986 | else 6987 | { 6988 | return $this->client->read('types/' . $typeId, $params); 6989 | } 6990 | } 6991 | 6992 | /** 6993 | * @param array $params 6994 | * 6995 | * @return int 6996 | * @throws WebshopappApiException 6997 | */ 6998 | public function count($params = array()) 6999 | { 7000 | return $this->client->read('types/count', $params); 7001 | } 7002 | 7003 | /** 7004 | * @param int $typeId 7005 | * @param array $fields 7006 | * 7007 | * @return array 7008 | * @throws WebshopappApiException 7009 | */ 7010 | public function update($typeId, $fields) 7011 | { 7012 | $fields = array('type' => $fields); 7013 | 7014 | return $this->client->update('types/' . $typeId, $fields); 7015 | } 7016 | 7017 | /** 7018 | * @param int $typeId 7019 | * 7020 | * @return array 7021 | * @throws WebshopappApiException 7022 | */ 7023 | public function delete($typeId) 7024 | { 7025 | return $this->client->delete('types/' . $typeId); 7026 | } 7027 | } 7028 | 7029 | class WebshopappApiResourceTypesAttributes 7030 | { 7031 | /** 7032 | * @var WebshopappApiClient 7033 | */ 7034 | private $client; 7035 | 7036 | public function __construct(WebshopappApiClient $client) 7037 | { 7038 | $this->client = $client; 7039 | } 7040 | 7041 | /** 7042 | * @param array $fields 7043 | * 7044 | * @return array 7045 | * @throws WebshopappApiException 7046 | */ 7047 | public function create($fields) 7048 | { 7049 | $fields = array('typesAttribute' => $fields); 7050 | 7051 | return $this->client->create('types/attributes', $fields); 7052 | } 7053 | 7054 | /** 7055 | * @param int $relationId 7056 | * @param array $params 7057 | * 7058 | * @return array 7059 | * @throws WebshopappApiException 7060 | */ 7061 | public function get($relationId = null, $params = array()) 7062 | { 7063 | if (!$relationId) 7064 | { 7065 | return $this->client->read('types/attributes', $params); 7066 | } 7067 | else 7068 | { 7069 | return $this->client->read('types/attributes/' . $relationId, $params); 7070 | } 7071 | } 7072 | 7073 | /** 7074 | * @param array $params 7075 | * 7076 | * @return int 7077 | * @throws WebshopappApiException 7078 | */ 7079 | public function count($params = array()) 7080 | { 7081 | return $this->client->read('types/attributes/count', $params); 7082 | } 7083 | 7084 | /** 7085 | * @param int $relationId 7086 | * 7087 | * @return array 7088 | * @throws WebshopappApiException 7089 | */ 7090 | public function delete($relationId) 7091 | { 7092 | return $this->client->delete('types/attributes/' . $relationId); 7093 | } 7094 | } 7095 | 7096 | class WebshopappApiResourceVariants 7097 | { 7098 | /** 7099 | * @var WebshopappApiClient 7100 | */ 7101 | private $client; 7102 | 7103 | public function __construct(WebshopappApiClient $client) 7104 | { 7105 | $this->client = $client; 7106 | } 7107 | 7108 | /** 7109 | * @param array $fields 7110 | * 7111 | * @return array 7112 | * @throws WebshopappApiException 7113 | */ 7114 | public function create($fields) 7115 | { 7116 | $fields = array('variant' => $fields); 7117 | 7118 | return $this->client->create('variants', $fields); 7119 | } 7120 | 7121 | /** 7122 | * @param int $variantId 7123 | * @param array $params 7124 | * 7125 | * @return array 7126 | * @throws WebshopappApiException 7127 | */ 7128 | public function get($variantId = null, $params = array()) 7129 | { 7130 | if (!$variantId) 7131 | { 7132 | return $this->client->read('variants', $params); 7133 | } 7134 | else 7135 | { 7136 | return $this->client->read('variants/' . $variantId, $params); 7137 | } 7138 | } 7139 | 7140 | /** 7141 | * @param array $params 7142 | * 7143 | * @return int 7144 | * @throws WebshopappApiException 7145 | */ 7146 | public function count($params = array()) 7147 | { 7148 | return $this->client->read('variants/count', $params); 7149 | } 7150 | 7151 | /** 7152 | * @param int $variantId 7153 | * @param array $fields 7154 | * 7155 | * @return array 7156 | * @throws WebshopappApiException 7157 | */ 7158 | public function update($variantId, $fields) 7159 | { 7160 | $fields = array('variant' => $fields); 7161 | 7162 | return $this->client->update('variants/' . $variantId, $fields); 7163 | } 7164 | 7165 | /** 7166 | * @param int $variantId 7167 | * 7168 | * @return array 7169 | * @throws WebshopappApiException 7170 | */ 7171 | public function delete($variantId) 7172 | { 7173 | return $this->client->delete('variants/' . $variantId); 7174 | } 7175 | } 7176 | 7177 | class WebshopappApiResourceVariantsImage 7178 | { 7179 | /** 7180 | * @var WebshopappApiClient 7181 | */ 7182 | private $client; 7183 | 7184 | public function __construct(WebshopappApiClient $client) 7185 | { 7186 | $this->client = $client; 7187 | } 7188 | 7189 | /** 7190 | * @param int $variantId 7191 | * @param array $fields 7192 | * 7193 | * @return array 7194 | * @throws WebshopappApiException 7195 | */ 7196 | public function create($variantId, $fields) 7197 | { 7198 | $fields = array('variantImage' => $fields); 7199 | 7200 | return $this->client->create('variants/' . $variantId . '/image', $fields); 7201 | } 7202 | 7203 | /** 7204 | * @param int $variantId 7205 | * 7206 | * @return array 7207 | * @throws WebshopappApiException 7208 | */ 7209 | public function get($variantId) 7210 | { 7211 | return $this->client->read('variants/' . $variantId . '/image'); 7212 | } 7213 | 7214 | /** 7215 | * @param int $variantId 7216 | * 7217 | * @return array 7218 | * @throws WebshopappApiException 7219 | */ 7220 | public function delete($variantId) 7221 | { 7222 | return $this->client->delete('variants/' . $variantId . '/image'); 7223 | } 7224 | } 7225 | 7226 | class WebshopappApiResourceVariantsMetafields 7227 | { 7228 | /** 7229 | * @var WebshopappApiClient 7230 | */ 7231 | private $client; 7232 | 7233 | public function __construct(WebshopappApiClient $client) 7234 | { 7235 | $this->client = $client; 7236 | } 7237 | 7238 | /** 7239 | * @param int $variantId 7240 | * @param array $fields 7241 | * 7242 | * @return array 7243 | * @throws WebshopappApiException 7244 | */ 7245 | public function create($variantId, $fields) 7246 | { 7247 | $fields = array('variantMetafield' => $fields); 7248 | 7249 | return $this->client->create('variants/' . $variantId . '/metafields', $fields); 7250 | } 7251 | 7252 | /** 7253 | * @param int $variantId 7254 | * @param int $metafieldId 7255 | * @param array $params 7256 | * 7257 | * @return array 7258 | * @throws WebshopappApiException 7259 | */ 7260 | public function get($variantId, $metafieldId = null, $params = array()) 7261 | { 7262 | if (!$metafieldId) 7263 | { 7264 | return $this->client->read('variants/' . $variantId . '/metafields', $params); 7265 | } 7266 | else 7267 | { 7268 | return $this->client->read('variants/' . $variantId . '/metafields/' . $metafieldId, $params); 7269 | } 7270 | } 7271 | 7272 | /** 7273 | * @param int $variantId 7274 | * @param array $params 7275 | * 7276 | * @return int 7277 | * @throws WebshopappApiException 7278 | */ 7279 | public function count($variantId, $params = array()) 7280 | { 7281 | return $this->client->read('variants/' . $variantId . '/metafields/count', $params); 7282 | } 7283 | 7284 | /** 7285 | * @param int $variantId 7286 | * @param int $metafieldId 7287 | * @param array $fields 7288 | * 7289 | * @return array 7290 | * @throws WebshopappApiException 7291 | */ 7292 | public function update($variantId, $metafieldId, $fields) 7293 | { 7294 | $fields = array('variantMetafield' => $fields); 7295 | 7296 | return $this->client->update('variants/' . $variantId . '/metafields/' . $metafieldId, $fields); 7297 | } 7298 | 7299 | /** 7300 | * @param int $variantId 7301 | * @param int $metafieldId 7302 | * 7303 | * @return array 7304 | * @throws WebshopappApiException 7305 | */ 7306 | public function delete($variantId, $metafieldId) 7307 | { 7308 | return $this->client->delete('variants/' . $variantId . '/metafields/' . $metafieldId); 7309 | } 7310 | } 7311 | 7312 | class WebshopappApiResourceVariantsBulk 7313 | { 7314 | /** 7315 | * @var WebshopappApiClient 7316 | */ 7317 | private $client; 7318 | 7319 | public function __construct(WebshopappApiClient $client) 7320 | { 7321 | $this->client = $client; 7322 | } 7323 | 7324 | /** 7325 | * @param array $fields 7326 | * 7327 | * @return array 7328 | * @throws WebshopappApiException 7329 | */ 7330 | public function update($fields) 7331 | { 7332 | $fields = array('variant' => $fields); 7333 | 7334 | return $this->client->update('variants/bulk', $fields); 7335 | } 7336 | } 7337 | 7338 | class WebshopappApiResourceVariantsMovements 7339 | { 7340 | /** 7341 | * @var WebshopappApiClient 7342 | */ 7343 | private $client; 7344 | 7345 | public function __construct(WebshopappApiClient $client) 7346 | { 7347 | $this->client = $client; 7348 | } 7349 | 7350 | /** 7351 | * @param int $movementId 7352 | * @param array $params 7353 | * 7354 | * @return array 7355 | * @throws WebshopappApiException 7356 | */ 7357 | public function get($movementId = null, $params = array()) 7358 | { 7359 | if (!$movementId) 7360 | { 7361 | return $this->client->read('variants/movements', $params); 7362 | } 7363 | else 7364 | { 7365 | return $this->client->read('variants/movements/' . $movementId, $params); 7366 | } 7367 | } 7368 | 7369 | /** 7370 | * @param array $params 7371 | * 7372 | * @return int 7373 | * @throws WebshopappApiException 7374 | */ 7375 | public function count($params = array()) 7376 | { 7377 | return $this->client->read('variants/movements/count', $params); 7378 | } 7379 | } 7380 | 7381 | class WebshopappApiResourceWebhooks 7382 | { 7383 | /** 7384 | * @var WebshopappApiClient 7385 | */ 7386 | private $client; 7387 | 7388 | public function __construct(WebshopappApiClient $client) 7389 | { 7390 | $this->client = $client; 7391 | } 7392 | 7393 | /** 7394 | * @param array $fields 7395 | * 7396 | * @return array 7397 | * @throws WebshopappApiException 7398 | */ 7399 | public function create($fields) 7400 | { 7401 | $fields = array('webhook' => $fields); 7402 | 7403 | return $this->client->create('webhooks', $fields); 7404 | } 7405 | 7406 | /** 7407 | * @param int $webhookId 7408 | * @param array $params 7409 | * 7410 | * @return array 7411 | * @throws WebshopappApiException 7412 | */ 7413 | public function get($webhookId = null, $params = array()) 7414 | { 7415 | if (!$webhookId) 7416 | { 7417 | return $this->client->read('webhooks', $params); 7418 | } 7419 | else 7420 | { 7421 | return $this->client->read('webhooks/' . $webhookId, $params); 7422 | } 7423 | } 7424 | 7425 | /** 7426 | * @param array $params 7427 | * 7428 | * @return int 7429 | * @throws WebshopappApiException 7430 | */ 7431 | public function count($params = array()) 7432 | { 7433 | return $this->client->read('webhooks/count', $params); 7434 | } 7435 | 7436 | /** 7437 | * @param int $webhookId 7438 | * @param array $fields 7439 | * 7440 | * @return array 7441 | * @throws WebshopappApiException 7442 | */ 7443 | public function update($webhookId, $fields) 7444 | { 7445 | $fields = array('webhook' => $fields); 7446 | 7447 | return $this->client->update('webhooks/' . $webhookId, $fields); 7448 | } 7449 | 7450 | /** 7451 | * @param int $webhookId 7452 | * 7453 | * @return array 7454 | * @throws WebshopappApiException 7455 | */ 7456 | public function delete($webhookId) 7457 | { 7458 | return $this->client->delete('webhooks/' . $webhookId); 7459 | } 7460 | } 7461 | --------------------------------------------------------------------------------