mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
- 2022년 3월 개발팀 결정사항 적용 - 모듈 등 서드파티 자료 개발시 composer를 사용하면 상위 경로에 있는 코어의 composer.json을 수정하고, 코어의 vendor 디렉토리를 건드리는 것이 기본값임 - 이를 방지하기 위해 코어의 composer.json과 vendor를 common 디렉토리 안으로 이동하여, 모듈 경로에서 상위 폴더로 인식하지 않도록 함
116 lines
3.3 KiB
PHP
116 lines
3.3 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 SenderID
|
|
* @brief management sender id, using Rest API
|
|
*/
|
|
class SenderID extends Coolsms
|
|
{
|
|
/**
|
|
* @brief change api name and api version
|
|
* @param string $api_key [required]
|
|
* @param string $api_secret [required]
|
|
* @param boolean $basecamp [optional]
|
|
* @return object(group_id)
|
|
*/
|
|
function __construct($api_key, $api_secret, $basecamp = false)
|
|
{
|
|
// set api_key and api_secret
|
|
parent::__construct($api_key, $api_secret, $basecamp);
|
|
|
|
// set API and version
|
|
$this->setApiConfig("senderid", "1.1");
|
|
}
|
|
|
|
/**
|
|
* @brief sender id registration request ( HTTP Method POST )
|
|
* @param string $phone [required]
|
|
* @param string $site_user [optional]
|
|
* @return object(handle_key, ars_number)
|
|
*/
|
|
public function register($phone, $site_user = null)
|
|
{
|
|
if (!$phone) throw new CoolsmsSDKException('phone number is required', 202);
|
|
|
|
$options = new \stdClass();
|
|
$options->phone = $phone;
|
|
$options->site_user = $site_user;
|
|
return $this->request('register', $options, true);
|
|
}
|
|
|
|
/**
|
|
* @brief verify sender id ( HTTP Method POST )
|
|
* @param string $handle_key [required]
|
|
* @return none
|
|
*/
|
|
public function verify($handle_key)
|
|
{
|
|
if (!$handle_key) throw new CoolsmsSDKException('handle_key is required', 202);
|
|
|
|
$options = new \stdClass();
|
|
$options->handle_key = $handle_key;
|
|
return $this->request('verify', $options, true);
|
|
}
|
|
|
|
/**
|
|
* @brief delete sender id ( HTTP Method POST )
|
|
* @param string $handle_key [required]
|
|
* @return none
|
|
*/
|
|
public function delete($handle_key)
|
|
{
|
|
if (!$handle_key) throw new CoolsmsSDKException('handle_key is required', 202);
|
|
|
|
$options = new \stdClass();
|
|
$options->handle_key = $handle_key;
|
|
return $this->request('delete', $options, true);
|
|
}
|
|
|
|
/**
|
|
* @brief get sender id list ( HTTP Method GET )
|
|
* @param string $site_user [optional]
|
|
* @return object(site_user, idno, phone_number, flag_default, updatetime, regdate)
|
|
*/
|
|
public function getSenderidList($site_user = null)
|
|
{
|
|
$options = new \stdClass();
|
|
$options->site_user = $site_user;
|
|
return $this->request('list', $options);
|
|
}
|
|
|
|
/**
|
|
* @brief set default sender id ( HTTP Method POST )
|
|
* @param string $handle_key [required]
|
|
* @param string $site_user [optional]
|
|
* @return none
|
|
*/
|
|
public function setDefault($handle_key, $site_user = null)
|
|
{
|
|
if (!$handle_key) throw new CoolsmsSDKException('handle_key is required', 202);
|
|
|
|
$options = new \stdClass();
|
|
$options->handle_key = $handle_key;
|
|
$options->site_user = $site_user;
|
|
return $this->request('set_default', $options, true);
|
|
}
|
|
|
|
/**
|
|
* @brief get default sender id ( HTTP Method GET )
|
|
* @param string $site_user [optional]
|
|
* @return object(handle_key, phone_number)
|
|
*/
|
|
public function getDefault($site_user = null)
|
|
{
|
|
$options = new \stdClass();
|
|
$options->site_user = $site_user;
|
|
return $this->request('get_default', $options);
|
|
}
|
|
}
|