Overview
  • Package
  • Class
  • Tree
  • Todo

Packages

  • AddonValue
    • Interfaces
  • ApiV2Controllers
  • Category
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • Customer
    • Address
    • Country
    • CountryZone
    • Interfaces
    • Validation
    • ValueObjects
  • Email
    • Collections
    • Entities
    • Exceptions
    • Interfaces
    • Repository
    • ValueObjects
  • Http
    • Collections
    • Exceptions
    • Factories
    • Interfaces
    • ValueObjects
  • Loaders
    • CrossCuttingLoader
    • GXCoreLoader
    • Interfaces
  • None
  • Order
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Repositories
    • Storages
    • ValueObjects
  • Product
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • ProductModule
    • Collections
    • Deleter
    • Entities
    • Factories
    • Interface
    • Interfaces
    • Reader
    • Repositories
    • Writer
  • Shared
    • Exceptions
    • FileSystem
    • Interfaces
    • Storage
    • Types
  • Statistics
    • Interfaces
  • UserConfiguration
    • Interfaces
    • Repository

Classes

  • AbstractAddonValueServiceFactory
  • AbstractAddonValueStorage
  • AbstractApiV2Controller
  • AbstractCategoryServiceFactory
  • AbstractCollection
  • AbstractCustomerFactory
  • AbstractCustomerServiceFactory
  • AbstractFileStorage
  • AbstractHttpContextFactory
  • AbstractHttpViewControllerRegistryFactory
  • AbstractImagesApiV2Controller
  • AbstractOrderServiceFactory
  • AbstractProductAttributeServiceFactory
  • AbstractProductServiceFactory
  • AddonValueService
  • AddonValueServiceFactory
  • AddonValueStorageFactory
  • AddressBlock
  • AddressBookService
  • AddressClass
  • AddressesApiV2Controller
  • AddressFormatProvider
  • AdminHttpViewController
  • AdminPageHttpControllerResponse
  • Asset
  • AssetCollection
  • AttachmentCollection
  • AttachmentName
  • AttachmentPath
  • AttachmentsApiV2Controller
  • AttachmentsHandler
  • BoolType
  • CategoriesApiV2Controller
  • Category
  • CategoryAddonValueStorage
  • CategoryFactory
  • CategoryIconsApiV2Controller
  • CategoryImagesApiV2Controller
  • CategoryListItem
  • CategoryListItemCollection
  • CategoryListProvider
  • CategoryListProviderFactory
  • CategoryObjectService
  • CategoryReadService
  • CategoryRepository
  • CategoryRepositoryDeleter
  • CategoryRepositoryReader
  • CategoryRepositoryWriter
  • CategoryServiceFactory
  • CategorySettings
  • CategorySettingsRepository
  • CategorySettingsRepositoryReader
  • CategorySettingsRepositoryWriter
  • CategoryWriteService
  • ContactCollection
  • ContactName
  • ContactType
  • CountriesApiV2Controller
  • CountryService
  • CrossCuttingLoader
  • CurrencyCode
  • Customer
  • CustomerAccountInputValidator
  • CustomerAddress
  • CustomerAddressDeleter
  • CustomerAddressInputValidator
  • CustomerAddressReader
  • CustomerAddressRepository
  • CustomerAddressWriter
  • CustomerB2BStatus
  • CustomerCallNumber
  • CustomerCity
  • CustomerCompany
  • CustomerCountry
  • CustomerCountryIso2
  • CustomerCountryIso3
  • CustomerCountryName
  • CustomerCountryReader
  • CustomerCountryRepository
  • CustomerCountryZone
  • CustomerCountryZoneIsoCode
  • CustomerCountryZoneName
  • CustomerCountryZoneReader
  • CustomerCountryZoneRepository
  • CustomerDateOfBirth
  • CustomerDeleter
  • CustomerEmail
  • CustomerFactory
  • CustomerFirstname
  • CustomerGender
  • CustomerInputValidator
  • CustomerInputValidatorSettings
  • CustomerLastname
  • CustomerNumber
  • CustomerPassword
  • CustomerPostcode
  • CustomerReader
  • CustomerReadService
  • CustomerRegistrationInputValidatorService
  • CustomerRepository
  • CustomersApiV2Controller
  • CustomerService
  • CustomerServiceFactory
  • CustomerServiceSettings
  • CustomerStatusInformation
  • CustomerStatusProvider
  • CustomerStreet
  • CustomerSuburb
  • CustomerVatNumber
  • CustomerWriter
  • CustomerWriteService
  • DecimalType
  • DefaultApiV2Controller
  • EditableCollection
  • EditableKeyValueCollection
  • Email
  • EmailAddress
  • EmailAttachment
  • EmailCollection
  • EmailContact
  • EmailContent
  • EmailDeleter
  • EmailFactory
  • EmailReader
  • EmailRepository
  • EmailsApiV2Controller
  • EmailService
  • EmailStringType
  • EmailSubject
  • EmailWriter
  • EmptyCurrencyCode
  • EmptyDateTime
  • EmptyLanguageCode
  • EmptyOrderItemDownloadInformation
  • EmptyProductImage
  • EnvCategoryServiceSettings
  • EnvironmentHttpContextFactory
  • EnvironmentHttpViewControllerRegistryFactory
  • EnvProductImageFileStorageSettings
  • ExistingDirectory
  • ExistingFile
  • FilenameStringType
  • GXCoreLoader
  • GXCoreLoaderSettings
  • GXEngineOrder
  • GXEngineProduct
  • HttpApiV2Controller
  • HttpContext
  • HttpContextReader
  • HttpControllerResponse
  • HttpDispatcher
  • HttpResponseProcessor
  • HttpService
  • HttpServiceFactory
  • HttpViewController
  • HttpViewControllerFactory
  • HttpViewControllerRegistry
  • IdCollection
  • IdType
  • ImageFileStorage
  • IntType
  • JsonHttpControllerResponse
  • KeyValueCollection
  • LanguageCode
  • LegacyProductImageProcessing
  • MailerAdapter
  • NonEmptyStringType
  • OrderAddonValueStorage
  • OrderFactory
  • OrderItem
  • OrderItemAddonValueStorage
  • OrderItemAttribute
  • OrderItemAttributeCollection
  • OrderItemAttributeFactory
  • OrderItemAttributeRepository
  • OrderItemAttributeRepositoryDeleter
  • OrderItemAttributeRepositoryFactory
  • OrderItemAttributeRepositoryReader
  • OrderItemAttributeRepositoryWriter
  • OrderItemCollection
  • OrderItemDownloadInformation
  • OrderItemFactory
  • OrderItemProperty
  • OrderItemPropertyFactory
  • OrderItemPropertyRepository
  • OrderItemPropertyRepositoryDeleter
  • OrderItemPropertyRepositoryReader
  • OrderItemPropertyRepositoryWriter
  • OrderItemRepository
  • OrderItemRepositoryDeleter
  • OrderItemRepositoryReader
  • OrderItemRepositoryWriter
  • OrderListGenerator
  • OrderListItem
  • OrderListItemCollection
  • OrderObjectService
  • OrderPaymentType
  • OrderReadService
  • OrderRepository
  • OrderRepositoryDeleter
  • OrderRepositoryReader
  • OrderRepositoryWriter
  • OrdersApiV2Controller
  • OrderServiceFactory
  • OrderServiceSettings
  • OrderShippingType
  • OrdersHistoryApiV2Controller
  • OrdersItemsApiV2Controller
  • OrdersItemsAttributesApiV2Controller
  • OrderStatusHistoryListItem
  • OrderStatusHistoryListItemCollection
  • OrderStatusHistoryStorage
  • OrdersTotalsApiV2Controller
  • OrderTotal
  • OrderTotalCollection
  • OrderTotalFactory
  • OrderTotalRepository
  • OrderTotalRepositoryDeleter
  • OrderTotalRepositoryReader
  • OrderTotalRepositoryWriter
  • OrderWriteService
  • ProductAddonValueStorage
  • ProductAttribute
  • ProductAttributeCollection
  • ProductAttributeFactory
  • ProductAttributeObjectService
  • ProductAttributeRepository
  • ProductAttributeRepositoryDeleter
  • ProductAttributeRepositoryReader
  • ProductAttributeRepositoryWriter
  • ProductAttributeService
  • ProductAttributeServiceFactory
  • ProductCategoryLinker
  • ProductFactory
  • ProductImage
  • ProductImageCollection
  • ProductImageContainer
  • ProductImageContainerRepository
  • ProductImageFileStorage
  • ProductImagesApiV2Controller
  • ProductListItem
  • ProductListItemCollection
  • ProductListProvider
  • ProductListProviderFactory
  • ProductObjectService
  • ProductPermissionSetter
  • ProductReadService
  • ProductRepository
  • ProductRepositoryDeleter
  • ProductRepositoryReader
  • ProductRepositoryWriter
  • ProductsApiV2Controller
  • ProductServiceFactory
  • ProductSettings
  • ProductSettingsRepository
  • ProductSettingsRepositoryReader
  • ProductSettingsRepositoryWriter
  • ProductsLinksApiV2Controller
  • ProductWriteService
  • RedirectHttpControllerResponse
  • StaticCrossCuttingLoader
  • StaticGXCoreLoader
  • StatisticsService
  • StoredCategory
  • StoredOrderItem
  • StoredOrderItemAttribute
  • StoredOrderItemAttributeCollection
  • StoredOrderItemCollection
  • StoredOrderItemProperty
  • StoredOrderTotal
  • StoredOrderTotalCollection
  • StoredProduct
  • StoredProductAttribute
  • StoredProductAttributeCollection
  • StringCollection
  • StringType
  • UserConfigurationReader
  • UserConfigurationService
  • UserConfigurationWriter
  • VatNumberValidator
  • WritableDirectory
  • WritableFile
  • YetAnotherLanguageProvider
  • ZonesApiV2Controller

Interfaces

  • AddonValueContainerInterface
  • AddonValueServiceInterface
  • AddonValueStorageFactoryInterface
  • AddressBlockInterface
  • AddressBookServiceInterface
  • AddressClassInterface
  • AddressFormatProviderInterface
  • AssetCollectionInterface
  • AssetInterface
  • AttachmentCollectionInterface
  • AttachmentNameInterface
  • AttachmentPathInterface
  • AttachmentsHandlerInterface
  • CategoryFactoryInterface
  • CategoryInterface
  • CategoryListProviderFactoryInterface
  • CategoryListProviderInterface
  • CategoryObjectServiceInterface
  • CategoryReadServiceInterface
  • CategoryRepositoryDeleterInterface
  • CategoryRepositoryInterface
  • CategoryRepositoryReaderInterface
  • CategoryRepositoryWriterInterface
  • CategoryServiceSettingsInterface
  • CategorySettingsInterface
  • CategorySettingsRepositoryInterface
  • CategorySettingsRepositoryReaderInterface
  • CategorySettingsRepositoryWriterInterface
  • CategoryWriteServiceInterface
  • ContactCollectionInterface
  • ContactNameInterface
  • ContactTypeInterface
  • ContentViewInterface
  • CountryServiceInterface
  • CrossCuttingLoaderInterface
  • CrossCuttingObjectInterface
  • CustomerAccountInputValidatorInterface
  • CustomerAddressDeleterInterface
  • CustomerAddressInputValidatorInterface
  • CustomerAddressInterface
  • CustomerAddressReaderInterface
  • CustomerAddressRepositoryInterface
  • CustomerAddressWriterInterface
  • CustomerB2BStatusInterface
  • CustomerCallNumberInterface
  • CustomerCityInterface
  • CustomerCompanyInterface
  • CustomerCountryInterface
  • CustomerCountryIso2Interface
  • CustomerCountryIso3Interface
  • CustomerCountryNameInterface
  • CustomerCountryReaderInterface
  • CustomerCountryRepositoryInterface
  • CustomerCountryZoneInterface
  • CustomerCountryZoneIsoCodeInterface
  • CustomerCountryZoneNameInterface
  • CustomerCountryZoneReaderInterface
  • CustomerCountryZoneRepositoryInterface
  • CustomerDeleterInterface
  • CustomerEmailInterface
  • CustomerFirstnameInterface
  • CustomerGenderInterface
  • CustomerInputValidatorInterface
  • CustomerInputValidatorSettingsInterface
  • CustomerInterface
  • CustomerLastnameInterface
  • CustomerNumberInterface
  • CustomerPasswordInterface
  • CustomerPostcodeInterface
  • CustomerReaderInterface
  • CustomerReadServiceInterface
  • CustomerRegistrationInputValidatorServiceInterface
  • CustomerRepositoryInterface
  • CustomerServiceInterface
  • CustomerServiceSettingsInterface
  • CustomerStatusProviderInterface
  • CustomerStreetInterface
  • CustomerSuburbInterface
  • CustomerVatNumberInterface
  • CustomerWriterInterface
  • CustomerWriteServiceInterface
  • EmailAddressInterface
  • EmailAttachmentInterface
  • EmailCollectionInterface
  • EmailContactInterface
  • EmailContentInterface
  • EmailDeleterInterface
  • EmailFactoryInterface
  • EmailInterface
  • EmailReaderInterface
  • EmailRepositoryInterface
  • EmailServiceInterface
  • EmailSubjectInterface
  • EmailWriterInterface
  • GXCoreLoaderInterface
  • GXCoreLoaderSettingsInterface
  • HttpContextInterface
  • HttpContextReaderInterface
  • HttpControllerResponseInterface
  • HttpDispatcherInterface
  • HttpResponseProcessorInterface
  • HttpServiceFactoryInterface
  • HttpServiceInterface
  • HttpViewControllerFactoryInterface
  • HttpViewControllerInterface
  • HttpViewControllerRegistryInterface
  • IdInterface
  • LanguageProviderInterface
  • MailerAdapterInterface
  • OrderFactoryInterface
  • OrderInterface
  • OrderItemAttributeFactoryInterface
  • OrderItemAttributeInterface
  • OrderItemAttributeRepositoryDeleterInterface
  • OrderItemAttributeRepositoryFactoryInterface
  • OrderItemAttributeRepositoryInterface
  • OrderItemAttributeRepositoryReaderInterface
  • OrderItemAttributeRepositoryWriterInterface
  • OrderItemFactoryInterface
  • OrderItemInterface
  • OrderItemPropertyFactoryInterface
  • OrderItemPropertyRepositoryDeleterInterface
  • OrderItemPropertyRepositoryReaderInterface
  • OrderItemPropertyRepositoryWriterInterface
  • OrderItemRepositoryDeleterInterface
  • OrderItemRepositoryInterface
  • OrderItemRepositoryReaderInterface
  • OrderItemRepositoryWriterInterface
  • OrderListGeneratorInterface
  • OrderObjectServiceInterface
  • OrderPaymentTypeInterface
  • OrderReadServiceInterface
  • OrderRepositoryDeleterInterface
  • OrderRepositoryInterface
  • OrderRepositoryReaderInterface
  • OrderRepositoryWriterInterface
  • OrderServiceSettingsInterface
  • OrderShippingTypeInterface
  • OrderStatusHistoryReaderInterface
  • OrderStatusHistoryWriterInterface
  • OrderTotalFactoryInterface
  • OrderTotalInterface
  • OrderTotalRepositoryDeleterInterface
  • OrderTotalRepositoryInterface
  • OrderTotalRepositoryReaderInterface
  • OrderTotalRepositoryWriterInterface
  • OrderWriteServiceInterface
  • ProductAttributeFactoryInterface
  • ProductAttributeInterface
  • ProductAttributeObjectServiceInterface
  • ProductAttributeRepositoryDeleterInterface
  • ProductAttributeRepositoryInterface
  • ProductAttributeRepositoryReaderInterface
  • ProductAttributeRepositoryWriterInterface
  • ProductAttributeServiceInterface
  • ProductCategoryLinkerInterface
  • ProductFactoryInterface
  • ProductImageContainerInterface
  • ProductImageContainerRepositoryInterface
  • ProductImageInterface
  • ProductImagePathsSettingsInterface
  • ProductImageProcessingInterface
  • ProductInterface
  • ProductListProviderFactoryInterface
  • ProductListProviderInterface
  • ProductObjectServiceInterface
  • ProductPermissionSetterInterface
  • ProductReadServiceInterface
  • ProductRepositoryDeleterInterface
  • ProductRepositoryInterface
  • ProductRepositoryReaderInterface
  • ProductRepositoryWriterInterface
  • ProductSettingsInterface
  • ProductSettingsRepositoryInterface
  • ProductSettingsRepositoryReaderInterface
  • ProductSettingsRepositoryWriterInterface
  • ProductWriteServiceInterface
  • StatisticsServiceInterface
  • StoredCategoryInterface
  • StoredOrderItemAttributeInterface
  • StoredOrderItemInterface
  • StoredOrderTotalInterface
  • StoredProductAttributeInterface
  • StoredProductInterface
  • UserConfigurationReaderInterface
  • UserConfigurationServiceInterface
  • UserConfigurationWriterInterface
  • VatNumberValidatorInterface

Exceptions

  • AjaxException
  • AttachmentNotFoundException
  • FileNotFoundException
  • HttpApiV2Exception
  • MissingControllerNameException
  • UnknownEnvironmentException
  1 <?php
  2 
  3 /* --------------------------------------------------------------
  4    CategoryImagesApiV2Controller.inc.php 2016-03-07
  5    Gambio GmbH
  6    http://www.gambio.de
  7    Copyright (c) 2016 Gambio GmbH
  8    Released under the GNU General Public License (Version 2)
  9    [http://www.gnu.org/licenses/gpl-2.0.html]
 10    --------------------------------------------------------------
 11 */
 12 
 13 MainFactory::load_class('AbstractImagesApiV2Controller');
 14 
 15 /**
 16  * Class CategoryImagesApiV2Controller
 17  *
 18  * This controller handles the Category Image file operations. The clients of the API can list, upload, rename or delete
 19  * files that exist in the server.
 20  *
 21  * @category   System
 22  * @package    ApiV2Controllers
 23  */
 24 class CategoryImagesApiV2Controller extends AbstractImagesApiV2Controller
 25 {
 26     /**
 27      * Initializes API Controller
 28      */
 29     protected function __initialize()
 30     {
 31         $this->writeService = StaticGXCoreLoader::getService('CategoryWrite');
 32     }
 33 
 34 
 35     /**
 36      * Returns the absolute path where the image files are located.
 37      *
 38      * @return string Image folder name.
 39      */
 40     protected function _getImageFolderName()
 41     {
 42         return DIR_FS_CATALOG . DIR_WS_IMAGES . 'categories/';
 43     }
 44 
 45 
 46     /**
 47      * @api        {post} /category_images Upload Category Image
 48      * @apiVersion 2.1.0
 49      * @apiName    UploadCategoryImage
 50      * @apiGroup   Categories
 51      *
 52      * @apiDescription
 53      * Uploads an icon image for the categories. Make this request without the "Content-Type: application/json". Except
 54      * from the file the POST request must also contain a "filename" value with the final file name.
 55      *
 56      * @apiSuccess (Success 201) Response-Body Contains information about the uploaded file.
 57      *
 58      * @apiSuccessExample {json} Success-Response
 59      * {
 60      *   "code": 201,
 61      *   "status": "success",
 62      *   "action": "upload",
 63      *   "filename": "my-image-file.png"
 64      * }
 65      *
 66      * @apiError 400-BadRequest No image file was provided or the "filename" parameter was not provided.
 67      * 
 68      * @apiErrorExample Error-Response (Missing image file)
 69      * HTTP/1.1 400 Bad Request
 70      * {
 71      *   "code": 400,
 72      *   "status": "error",
 73      *   "message": "No image file was provided."
 74      * }
 75      *                  
 76      * @apiErrorExample Error-Response (Missing filename parameter)
 77      * HTTP/1.1 400 Bad Request
 78      * {
 79      *   "code": 400,
 80      *   "status": "error",
 81      *   "message": "The 'filename' parameter is required and was not provided with the request."
 82      * }
 83      *
 84      */
 85     public function post()
 86     {
 87         if(!isset($_FILES) || empty($_FILES))
 88         {
 89             throw new HttpApiV2Exception('No image file was provided.', 400);
 90         }
 91 
 92         $file = array_shift($_FILES);
 93 
 94         $existingFile = new ExistingFile(new NonEmptyStringType($file['tmp_name']));
 95 
 96         if($this->api->request->post('filename') === null)
 97         {
 98             throw new HttpApiV2Exception('The "filename" parameter is required and was not provided with the request. '
 99                                          . 'Check the documentation on how to properly use the API.', 400);
100         }
101 
102         $filename = new FilenameStringType($this->api->request->post('filename'));
103 
104         $filename = $this->writeService->importCategoryImageFile($existingFile, $filename);
105 
106         // Return success response to client.
107         $response = array(
108             'code'     => 201,
109             'status'   => 'success',
110             'action'   => 'upload',
111             'filename' => (string)$filename
112         );
113 
114         $this->_writeResponse($response, 201);
115     }
116 
117 
118     /**
119      * @api        {put} /category_images Rename Image File
120      * @apiVersion 2.1.0
121      * @apiName    RenameImageFile
122      * @apiGroup   Categories
123      *
124      * @apiDescription
125      * Use this method to rename an existing image file.
126      *
127      * @apiExample {json} Request-Body
128      * {
129      *   "oldFilename": "my-old-image.png",
130      *   "newFilename": "my-new-image.png"
131      * }
132      *
133      * @apiSuccess Response-Body Contains information about the executed operation.
134      *
135      * @apiSuccessExample {json} Response-Body
136      * {
137      *   "code": 200,
138      *   "status": "success",
139      *   "action": "rename",
140      *   "oldFilename": "my-old-image.png",
141      *   "newFilename": "my-new-image.png"
142      * }
143      *
144      * @apiError 400-BadRequest The body of the request was empty or the request body did not contain the
145      * oldFilename or newFilename properties, or their values were invalid.
146      *             
147      * @apiErrorExample Error-Response (Empty request body)
148      * HTTP/1.1 400 Bad Request
149      * {
150      *   "code": 400,
151      *   "status": "error",
152      *   "message": "Category image data were not provided."
153      * }
154      *
155      * @apiErrorExample Error-Response (Missing parameters)
156      * HTTP/1.1 400 Bad Request
157      * {
158      *   "code": 400,
159      *   "status": "error",
160      *   "message": "This operation requires a JSON object with 'oldFilename' and 'newFilename' properties set."
161      * }
162      *
163      */
164     public function put()
165     {
166         $imageJsonString = $this->api->request->getBody();
167 
168         if(empty($imageJsonString))
169         {
170             throw new HttpApiV2Exception('Category image data were not provided.', 400);
171         }
172 
173         $json = json_decode($imageJsonString);
174 
175         if($json->oldFilename === null || $json->newFilename === null)
176         {
177             throw new HttpApiV2Exception('This operation requires a JSON object with "oldFilename" and "newFilename" '
178                                          . 'properties set. Check the documentation on how to properly use the API.',
179                                          400);
180         }
181 
182         $oldFilename = new FilenameStringType($json->oldFilename);
183         $newFilename = new FilenameStringType($json->newFilename);
184 
185         $this->writeService->renameCategoryImageFile($oldFilename, $newFilename);
186 
187         $response = array(
188             'code'        => 200,
189             'status'      => 'success',
190             'action'      => 'rename',
191             'oldFilename' => $json->oldFilename,
192             'newFilename' => $json->newFilename
193         );
194 
195         $this->_writeResponse($response);
196     }
197 
198 
199     /**
200      * @api        {delete} /category_images Delete Category Image
201      * @apiVersion 2.1.0
202      * @apiName    DeleteCategoryImage
203      * @apiGroup   Categories
204      *
205      * @apiDescription
206      * Removes the category image file from the server. This method will always provide a successful response even if
207      * the image file was not found.
208      *
209      * @apiExample {json} Request-Body
210      * {
211      *   "filename": "file-to-be-deleted.png"
212      * }
213      *
214      * @apiSuccessExample {json} Success-Response
215      * {
216      *   "code": 200,
217      *   "status": "success",
218      *   "action": "delete",
219      *   "filename": "file-to-be-deleted.png"
220      * }
221      *
222      * @apiError 400-BadRequest The body of the request was empty or the request body did not contain the
223      * filename or its value was invalid.
224      * 
225      * @apiErrorExample Error-Response (Empty request body)
226      * HTTP/1.1 400 Bad Request
227      * {
228      *   "code": 400,
229      *   "status": "error",
230      *   "message": "Category image data were not provided."
231      * }
232      *
233      * @apiErrorExample Error-Response (Missing parameter)
234      * HTTP/1.1 400 Bad Request
235      * {
236      *   "code": 400,
237      *   "status": "error",
238      *   "message": "This operation requires a JSON object with 'filename' properties set."
239      * }
240      */
241     public function delete()
242     {
243         $imageJsonString = $this->api->request->getBody();
244 
245         if(empty($imageJsonString))
246         {
247             throw new HttpApiV2Exception('Category image data were not provided.', 400);
248         }
249 
250         $imageJsonObject = json_decode($this->api->request->getBody());
251 
252         if($imageJsonObject->filename === null)
253         {
254             throw new HttpApiV2Exception('This operation requires a JSON object with "filename" properties set. '
255                                          . 'Check the documentation on how to properly use the API.', 400);
256         }
257 
258         $this->writeService->deleteCategoryImageFile(new FilenameStringType($imageJsonObject->filename));
259 
260         $response = array(
261             'code'     => 200,
262             'status'   => 'success',
263             'action'   => 'delete',
264             'filename' => $imageJsonObject->filename
265         );
266 
267         $this->_writeResponse($response);
268     }
269 
270 
271     /**
272      * @api        {get} /category_images
273      * @apiVersion 2.1.0
274      * @apiName    GetCategoryImages
275      * @apiGroup   Categories
276      *
277      * @apiDescription
278      * Get a list of all category image files which exists in the server's filesystem through a GET request.
279      *
280      * @apiExample {curl} Get All Category Images
281      *             curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/category_images
282      */
283     public function get()
284     {
285         parent::get();
286     }
287 }
288 
API documentation generated by ApiGen