rhymix/common/vendor/coolsms/php-sdk/app/Nurigo/Api/Image.php
Kijin Sung 5fff6b6eab Move all composer files inside the common directory
- 2022년 3월 개발팀 결정사항 적용
- 모듈 등 서드파티 자료 개발시 composer를 사용하면 상위 경로에 있는 코어의
  composer.json을 수정하고, 코어의 vendor 디렉토리를 건드리는 것이 기본값임
- 이를 방지하기 위해 코어의 composer.json과 vendor를 common 디렉토리 안으로
  이동하여, 모듈 경로에서 상위 폴더로 인식하지 않도록 함
2022-12-26 16:33:32 +09:00

74 lines
2.1 KiB
PHP

<?php
/* vi:set sw=4 ts=4 expandtab: */
namespace Nurigo\Api;
use Nurigo\Coolsms;
use Nurigo\Exceptions\CoolsmsSDKException;
require_once __DIR__ . "/../../../bootstrap.php";
/**
* @class Image
* @brief management image, using Rest API
*/
class Image extends Coolsms
{
/**
* @brief get image list( HTTP Method GET )
* @param integer $offset [optional]
* @param integer $limit [optional]
* @return object(total_count, offset, limit, list['image_id', 'image_id' ...])
*/
public function getImageList($offset = null, $limit = null)
{
$options = new \stdClass();
$options->offset = $offset;
$options->limit = $limit;
return $this->request('image_list', $options);
}
/**
* @brief get image info ( HTTP Method GET )
* @param string $image_id [required]
* @return object(image_id, file_name, original_name, file_size, width, height)
*/
public function getImageInfo($image_id)
{
if (!$image_id) throw new CoolsmsSDKException('image_id is required', 202);
$options = new \stdClass();
$options->image_id = $image_id;
return $this->request(sprintf('images/%s', $image_id), $options);;
}
/**
* @brief upload image ( HTTP Method POST )
* @param mixed $image [required]
* @param string $encoding [optional]
* @return object(image_id)
*/
public function uploadImage($image, $encoding = null)
{
if (!$image) throw new CoolsmsSDKException('image is required', 202);
$options = new \stdClass();
$options->image = $image;
$options->encoding = $encoding;
return $this->request('upload_image', $options, true);
}
/**
* @brief delete images ( HTTP Method POST )
* @param string $image_ids [required]
* @return object(success_count)
*/
public function deleteImages($image_ids)
{
if (!$image_ids) throw new CoolsmsSDKException('image_ids is required', 202);
$options = new \stdClass();
$options->image_ids = $image_ids;
return $this->request('delete_images', $options, true);
}
}