/** * * treat transcriptions * create/0 different * as we need the path */ public function create() { $data = Ensure::Input(func_get_args()); $data = $data->get(); if (!isset($data['recordingId'])) { $data['recordingId'] = ""; } return parent::create($data, new RemoveResource($this, array("recordingId"), new PathResource($this, array("recordings" => $data['recordingId'], "transcriptions" => "")))); }
/** * Create musn't preserve the domainId * as this will be our path. We will pass * it in the parameter, use PathResource * then remove it * * @param: args Endpoint create data */ public function create() { $data = Ensure::Input(func_get_args()); $data = $data->get(); if (isset($data['domainId'])) { new PathResource($this, array("domains" => $data['domainId'], "endpoints" => "")); } return parent::create($data); }
/** * construct the domains as initiated * or new. Domains should have functions * to access their endpoints as well * * init forms * GET: * Domains('domain-id') * Domains() * * POST * Domains(array) */ public function __construct() { $data = Ensure::Input(func_get_args()); return parent::_init($data, new DependsResource(), new LoadsResource(array("primary" => "GET", "id" => "id", "init" => TRUE, "silent" => FALSE)), new SchemaResource(array("fields" => array('name', 'description'), "needs" => array('id', 'name'))), new SubFunctionResource()); }
/** * CTor for NumberInfo * Init Forms: * * GET * NumberInfo('cname-number') * */ public function __construct() { $data = Ensure::Input(func_get_args()); parent::_init($data, new DependsResource(array(array("term" => "phoneNumbers", "plural" => true))), new LoadsResource(array("primary" => "GET", "init" => array(), "id" => "number", "silent" => false)), new SchemaResource(array("needs" => array('name', 'number', 'created', 'updated'), "fields" => array('name', 'number')))); }
/** * CTor for phone numbers * use PhoneNumbers path primary, * availableNumbers secondary * * Init Forms * GET * PhoneNumbers('number-id') * PhoneNumbers * * POST * PhoneNumbers(array) */ public function __construct() { $data = Ensure::Input(func_get_args()); parent::_init($data, new DependsResource(), new LoadsResource(array("primary" => "GET", "id" => "number", "init" => array(), "silent" => true)), new SchemaResource(array("fields" => array('id', 'application', 'number', 'nationalNumber', 'name', 'createdTime', 'city', 'state', 'price', 'numberState', 'fallbackNumber', 'patternMatch', 'lata', 'rateCenter'), "needs" => array("id", "number", "name")))); }
/** * Bridge call CTor accept calls * as main argument * * Init forms * GET * Bridge('bridge-id') * Bridge() * * POST * Bridge(array) */ public function __construct($data = null) { $data = Ensure::Input($data); parent::_init($data, new DependsResource(), new LoadsResource(array("primary" => "get", "id" => "id", "init" => "", "silent" => false)), new SchemaResource(array("fields" => array('audio', 'completedTime', 'createdTime', 'activatedTime', 'callIds'), "needs" => array("id"))), new SubFunctionResource(array(array("type" => "get", "term" => "calls")))); }
/** * Construct a media object * where data must be a blob * in binary. Store in memory until * store/1 is called * if data is passed use this as object * otherwise initialize from passed id. * In rare cases when media is called only to list or create * disregard both data and id * * * Init Forms: * GET * Media('media-id') * * PUT * Media(array) * */ public function __construct() { $data = Ensure::Input(func_get_args()); parent::_init($data, new DependsResource(), new LoadsResource(array("primary" => "GET", "id" => "content", "init" => "", "silent" => true)), new SchemaResource(array("fields" => array("contentLength", "mediaName", "content"), "needs" => array("mediaName")))); }
/** * CTor for recordings * * Init Forms: * GET * Recording('recording-id') * * POST * Recording(array) */ public function __construct($args = null) { $data = Ensure::Input($args); parent::_init($data, new DependsResource(), new LoadsResource(array("primary" => "GET", "id" => "id", "init" => "", "silent" => false)), new SchemaResource(array("fields" => array("id", "call", "endTime", "media", "startTime", "state", "page", "size"), "needs" => array("id"))), new SubFunctionResource(array(array("term" => "transcriptions", "type" => "get", "plural" => true)))); }
/** * CTor for application * * Init forms: * GET * Application('application-id') * * POST * Application(array) * Application() */ public function __construct() { $data = Ensure::Input(func_get_args()); parent::_init($data, new DependsResource(), new LoadsResource(array("primary" => "GET", "id" => "id", "silent" => false, "init" => array())), new SchemaResource(array("fields" => array('id', 'name', 'incomingCallUrl', 'incomingCallUrlCallbackTimeout', 'incomingCallFallbackUrl', 'incomingSmsUrl', 'incomingSmsUrlCallbackTimeout', 'incomingSmsFallbackUrl', 'callbackHttpMethod', 'autoAnswer'), "needs" => array("id", "name")))); }
/** * Init forms * GET * UserError('user-error-id') * UserError() */ public function __construct() { $data = Ensure::Input(func_get_args()); parent::_init($data, new DependsResource(), new LoadsResource(array("primary" => "get", "id" => "id", "init" => "", "silent" => false)), new SchemaResource(array("fields" => array('id', 'time', 'category', 'code', 'message', 'details', 'version', 'user'), "needs" => array("id")))); }
/** * CTor to message object * inherit base provide all implementation here. * * Init form: * GET * Message('message-id') * Message() * * POST * Message(array) * */ public function __construct() { $data = Ensure::Input(func_get_args()); parent::_init($data, new DependsResource(), new LoadsResource(array("primary" => "GET", "id" => "id", "init" => "", "silent" => false)), new SchemaResource(array("fields" => array('id', 'direction', 'callbackUrl', 'callbackTimeout', 'fallbackUrl', 'from', 'to', 'state', 'time', 'text', 'errorMessage', 'tag', 'media', 'receiptRequested'), "needs" => array("id", "from", "to", "state"))), new SubFunctionResource()); }
/** * * CallEvents do not directly provide * GET or POST functions they can be accessed * by calls only. * * Init Forms: * * GET: * CallEvents() * CallEvents('event-id') */ public function __construct() { $data = Ensure::Input(func_get_args()); parent::_init($data, new DependsResource(array(array("term" => "calls", "plural" => false))), new LoadsResource(array("silent" => false, "primary" => "GET", "id" => "id", "init" => array("callId"))), new SchemaResource(array("fields" => array("id", "time", "name"), "needs" => "id"))); }
/** * CTor for gather resource. * Init Forms * * GET * Gather('call-id') * Gather('call-id', 'gather-id') * * POST * Gather('call-id', array) * Gather(array) */ public function __construct() { $data = Ensure::Input(func_get_args()); parent::_init($data, new DependsResource(array(array("term" => "calls", "plural" => true))), new LoadsResource(array("parent" => false, "primary" => "create", "id" => "id", "init" => array("callId"), "silent" => true)), new SchemaResource(array("fields" => array("maxDigits", "interDigitTimeout", "terinatingDigits", "tag", "prompt.sentance", "prompt.gender", "prompt.fileUrl", "prompt.loopEnabled", "prompt.bargeable"), "needs" => array("id")))); }
/** * Mock get functions * read whether we need to * use an id or not * then run accordingly * last parameter will always * be 'this' object */ public static function get() { $args = func_get_args(); $that = self::get_this($args); $term = self::get_term($args); $id = self::get_id($args); $plural = self::get_is_plural($args); if ($plural) { $url = URIResource::Make($that->path, array($that->id, GenericResource::getPath($term))); $dp = new DataPacketCollection($that->client->get($url)); $cl = GenericResource::getObjClass($term); $pobjcl = "Catapult\\" . $cl . "Collection"; $pobj = new $pobjcl($dp); return $pobj; } else { $url = URIResource::Make($that->path, array($that->id, GenericResource::getPath($term))); $dp = new DataPacket($that->client->get($url)); $cl = GenericResource::getObjClass($term); $pobjcl = "Catapult\\" . $cl; $pobj = new $pobjcl(); return Constructor::Make($pobj, $dp->get()); } return Constructor::Make($pobj, $dp->get()); }
/** * * Init forms: * * GET * Account() * */ public function __construct($data = null) { $data = Ensure::Input($data); parent::_init($data, new DependsResource(), new LoadsResource(array("primary" => "GET", "id" => "id", "init" => "", "silent" => false)), new SchemaResource(array("fields" => array("balance", "accountType"), "needs" => array("balance", "accountType")), new SubFunctionResource(array("term" => "transactions", "type" => "get")))); }