* Upload Mappings method - Admin API * * @property ApiClient $apiClient Defined in AdminApi class * * @api */ trait UploadMappingsTrait { /** * Lists upload mappings by folder and its mapped template (URL). * * * @param array $options The optional parameters. See the * Admin API * documentation. * * @return ApiResponse * * @see https://cloudinary.com/documentation/admin_api#get_upload_mappings */ public function uploadMappings($options = []) { $uri = ApiEndPoint::UPLOAD_MAPPINGS; $params = ArrayUtils::whitelist($options, ['next_cursor', 'max_results']); return $this->apiClient->get($uri, $params); } /** * Returns the details of the specified upload mapping. * * Retrieve the mapped template (URL) of a specified upload mapping folder. * * @param string $name The name of the upload mapping folder. * * @return ApiResponse * * @see https://cloudinary.com/documentation/admin_api#get_the_details_of_a_single_upload_mapping */ public function uploadMapping($name) { $uri = ApiEndPoint::UPLOAD_MAPPINGS; $params = ['folder' => $name]; return $this->apiClient->get($uri, $params); } /** * Deletes an upload mapping. * * * @param string $name The name of the upload mapping folder to delete. * * @return ApiResponse * * @throws ApiError * * @see https://cloudinary.com/documentation/admin_api#delete_an_upload_mapping */ public function deleteUploadMapping($name) { $uri = ApiEndPoint::UPLOAD_MAPPINGS; $params = ['folder' => $name]; return $this->apiClient->delete($uri, $params); } /** * Updates an existing upload mapping with a new template (URL). * * * @param string $name The name of the upload mapping folder to remap. * @param array $options The optional parameters. See the * Admin API * documentation. * * @return ApiResponse * * @throws ApiError * * @see https://cloudinary.com/documentation/admin_api#update_an_upload_mapping */ public function updateUploadMapping($name, $options = []) { $uri = ApiEndPoint::UPLOAD_MAPPINGS; $params = array_merge(['folder' => $name], ArrayUtils::whitelist($options, ['template'])); return $this->apiClient->put($uri, $params); } /** * Creates a new upload mapping. * * * @param string $name The name of the folder to map. * @param array $options The optional parameters. See the * Admin API * documentation. * * @return ApiResponse * * @see https://cloudinary.com/documentation/admin_api#create_an_upload_mapping */ public function createUploadMapping($name, $options = []) { $uri = ApiEndPoint::UPLOAD_MAPPINGS; $params = array_merge(['folder' => $name], ArrayUtils::whitelist($options, ['template'])); return $this->apiClient->postForm($uri, $params); } }