Composable Commerce PHP SDKPHP SDK
  • Namespace
  • Class
  • Tree

Namespaces

  • Commercetools
    • Commons
      • Helper
    • Core
      • Builder
        • Request
        • Update
      • Cache
      • Client
        • Adapter
        • OAuth
      • Error
      • Helper
        • Annotate
        • State
          • Renderer
        • Subscriber
          • Log
      • Model
        • ApiClient
        • Cart
        • CartDiscount
        • Category
        • Channel
        • Common
        • Customer
        • CustomerGroup
        • CustomField
        • CustomObject
        • DiscountCode
        • Extension
        • Inventory
        • Message
        • Order
        • OrderEdit
        • Payment
        • Product
          • Search
        • ProductDiscount
        • ProductSelection
        • ProductType
        • Project
        • Review
        • ShippingMethod
        • ShoppingList
        • State
        • Store
        • Subscription
        • TaxCategory
        • Type
        • Zone
      • Request
        • ApiClients
        • CartDiscounts
          • Command
        • Carts
          • Command
        • Categories
          • Command
        • Channels
          • Command
        • CustomerGroups
          • Command
        • Customers
          • Command
        • CustomField
          • Command
        • CustomObjects
        • DiscountCodes
          • Command
        • Extensions
          • Command
        • GraphQL
        • InStores
        • Inventory
          • Command
        • Me
          • Command
        • Messages
        • OrderEdits
          • Command
          • StagedOrder
            • Command
        • Orders
          • Command
        • Payments
          • Command
        • ProductDiscounts
          • Command
        • Products
          • Command
        • ProductSelections
          • Command
        • ProductTypes
          • Command
        • Project
          • Command
        • Query
        • Reviews
          • Command
        • ShippingMethods
          • Command
        • ShoppingLists
          • Command
        • States
          • Command
        • Stores
          • Command
        • Subscriptions
          • Command
        • TaxCategories
          • Command
        • Types
          • Command
        • Zones
          • Command
      • Response

Classes

  • ApiClientRequestBuilder
  • CartDiscountRequestBuilder
  • CartRequestBuilder
  • CategoryRequestBuilder
  • ChannelRequestBuilder
  • CustomerGroupRequestBuilder
  • CustomerRequestBuilder
  • CustomObjectRequestBuilder
  • DiscountCodeRequestBuilder
  • ExtensionRequestBuilder
  • GraphQLRequestBuilder
  • InventoryRequestBuilder
  • MeCartRequestBuilder
  • MeOrderRequestBuilder
  • MeRequestBuilder
  • MeShoppingListRequestBuilder
  • MessageRequestBuilder
  • OrderEditRequestBuilder
  • OrderRequestBuilder
  • PaymentRequestBuilder
  • ProductDiscountRequestBuilder
  • ProductProjectionRequestBuilder
  • ProductRequestBuilder
  • ProductSelectionRequestBuilder
  • ProductTypeRequestBuilder
  • ProjectRequestBuilder
  • RequestBuilder
  • ReviewRequestBuilder
  • ShippingMethodRequestBuilder
  • ShoppingListRequestBuilder
  • StateRequestBuilder
  • StoreRequestBuilder
  • SubscriptionRequestBuilder
  • TaxCategoryRequestBuilder
  • TypeRequestBuilder
  • ZoneRequestBuilder
  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 
<?php
// phpcs:disable Generic.Files.LineLength
namespace Commercetools\Core\Builder\Request;

use Commercetools\Core\Request\ShippingMethods\ShippingMethodByCartIdGetRequest;
use Commercetools\Core\Request\ShippingMethods\ShippingMethodByIdGetRequest;
use Commercetools\Core\Request\ShippingMethods\ShippingMethodByKeyGetRequest;
use Commercetools\Core\Request\ShippingMethods\ShippingMethodByLocationGetRequest;
use Commercetools\Core\Model\Zone\Location;
use Commercetools\Core\Request\ShippingMethods\ShippingMethodByMatchingLocationGetRequest;
use Commercetools\Core\Request\ShippingMethods\ShippingMethodByMatchingOrderEditGetRequest;
use Commercetools\Core\Request\ShippingMethods\ShippingMethodCreateRequest;
use Commercetools\Core\Model\ShippingMethod\ShippingMethodDraft;
use Commercetools\Core\Request\ShippingMethods\ShippingMethodDeleteByKeyRequest;
use Commercetools\Core\Model\ShippingMethod\ShippingMethod;
use Commercetools\Core\Request\ShippingMethods\ShippingMethodDeleteRequest;
use Commercetools\Core\Request\ShippingMethods\ShippingMethodQueryRequest;
use Commercetools\Core\Request\ShippingMethods\ShippingMethodUpdateByKeyRequest;
use Commercetools\Core\Request\ShippingMethods\ShippingMethodUpdateRequest;

class ShippingMethodRequestBuilder
{

    /**
     * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#get-shippingmethods-for-a-cart
     * @param string $cartId
     * @return ShippingMethodByCartIdGetRequest
     */
    public function getByCartId($cartId)
    {
        $request = ShippingMethodByCartIdGetRequest::ofCartId($cartId);
        return $request;
    }

    /**
     * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#get-shippingmethod-by-id
     * @param string $id
     * @return ShippingMethodByIdGetRequest
     */
    public function getById($id)
    {
        $request = ShippingMethodByIdGetRequest::ofId($id);
        return $request;
    }

    /**
     * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#get-shippingmethod-by-key
     * @param string $key
     * @return ShippingMethodByKeyGetRequest
     */
    public function getByKey($key)
    {
        $request = ShippingMethodByKeyGetRequest::ofKey($key);
        return $request;
    }

    /**
     * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#get-shippingmethods-for-a-location
     * @param Location $location
     * @param string $currency
     * @return ShippingMethodByLocationGetRequest
     */
    public function getByLocation(Location $location, $currency = null)
    {
        $request = ShippingMethodByLocationGetRequest::ofCountry($location->getCountry());
        if (!is_null($location->getState())) {
            $request->withState($location->getState());
        }
        if (!is_null($currency)) {
            $request->withCurrency($currency);
        }
        return $request;
    }

    /**
     * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#get-shippingmethods-for-a-location
     * @param Location $location
     * @param string $currency
     * @return ShippingMethodByMatchingLocationGetRequest
     */
    public function getMatchingLocation(Location $location, $currency = null)
    {
        $request = ShippingMethodByMatchingLocationGetRequest::ofCountry($location->getCountry());
        if (!is_null($location->getState())) {
            $request->withState($location->getState());
        }
        if (!is_null($currency)) {
            $request->withCurrency($currency);
        }
        return $request;
    }

    /**
     * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#get-shippingmethods-for-an-orderedit
     * @param string $orderEditId
     * @param Location $location
     * @return ShippingMethodByMatchingOrderEditGetRequest
     */
    public function getMatchingOrderEdit($orderEditId, Location $location)
    {
        $request = ShippingMethodByMatchingOrderEditGetRequest::ofOrderEditAndCountry($orderEditId, $location->getCountry());
        if (!is_null($location->getState())) {
            $request->withState($location->getState());
        }
        return $request;
    }

    /**
     * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#create-shippingmethod
     * @param ShippingMethodDraft $shippingMethod
     * @return ShippingMethodCreateRequest
     */
    public function create(ShippingMethodDraft $shippingMethod)
    {
        $request = ShippingMethodCreateRequest::ofDraft($shippingMethod);
        return $request;
    }

    /**
     * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#delete-shippingmethod-by-key
     * @param ShippingMethod $shippingMethod
     * @return ShippingMethodDeleteByKeyRequest
     */
    public function deleteByKey(ShippingMethod $shippingMethod)
    {
        $request = ShippingMethodDeleteByKeyRequest::ofKeyAndVersion($shippingMethod->getKey(), $shippingMethod->getVersion());
        return $request;
    }

    /**
     * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#delete-shippingmethod
     * @param ShippingMethod $shippingMethod
     * @return ShippingMethodDeleteRequest
     */
    public function delete(ShippingMethod $shippingMethod)
    {
        $request = ShippingMethodDeleteRequest::ofIdAndVersion($shippingMethod->getId(), $shippingMethod->getVersion());
        return $request;
    }

    /**
     * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#query-shippingmethods
     *
     * @return ShippingMethodQueryRequest
     */
    public function query()
    {
        $request = ShippingMethodQueryRequest::of();
        return $request;
    }

    /**
     * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#update-shippingmethod-by-key
     * @param ShippingMethod $shippingMethod
     * @return ShippingMethodUpdateByKeyRequest
     */
    public function updateByKey(ShippingMethod $shippingMethod)
    {
        $request = ShippingMethodUpdateByKeyRequest::ofKeyAndVersion($shippingMethod->getKey(), $shippingMethod->getVersion());
        return $request;
    }

    /**
     * @link https://docs.commercetools.com/http-api-projects-shippingMethods.html#update-shippingmethod
     * @param ShippingMethod $shippingMethod
     * @return ShippingMethodUpdateRequest
     */
    public function update(ShippingMethod $shippingMethod)
    {
        $request = ShippingMethodUpdateRequest::ofIdAndVersion($shippingMethod->getId(), $shippingMethod->getVersion());
        return $request;
    }

    /**
     * @return ShippingMethodRequestBuilder
     */
    public function of()
    {
        return new self();
    }
}
PHP SDK API documentation generated by ApiGen