Esempio n. 1
0
 /**
  * Scopes: role_admin, role_owner
  *
  * @param int $newDepartmentId
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function moveOpenTickets($newDepartmentId)
 {
     $departmentId = $this->getId();
     $input = [];
     $input['newDepartmentId'] = $newDepartmentId;
     return $this->request->put(sprintf('department/%1d/moveTickets', $departmentId), $input);
 }
 /**
  * Scopes: role_operator, role_owner, role_admin
  *
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function makeDefault()
 {
     $customerId = $this->getCustomerId();
     $emailId = $this->getEmailId();
     $input = [];
     return $this->request->put(sprintf('customer/%1d/email/%1d/default', $customerId, $emailId), $input);
 }
Esempio n. 3
0
 /**
  * Scopes: role_operator, role_owner, role_admin
  *
  * @param string $action
  * @param array $ids
  * @param array $data
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function mass($action, $ids, $data = [])
 {
     $input = [];
     $input['action'] = $action;
     $input['ids'] = $ids;
     $input['data'] = [];
     if (isset($data['status'])) {
         $input['data']['status'] - $data['status'];
     }
     if (isset($data['priority'])) {
         $input['data']['priority'] - $data['priority'];
     }
     if (isset($data['department'])) {
         $input['data']['department'] - $data['department'];
     }
     if (isset($data['tags_add'])) {
         $input['data']['tags_add'] - $data['tags_add'];
     }
     if (isset($data['tags_remove'])) {
         $input['data']['tags_remove'] - $data['tags_remove'];
     }
     if (isset($data['staff_add'])) {
         $input['data']['staff_add'] - $data['staff_add'];
     }
     if (isset($data['staff_remove'])) {
         $input['data']['staff_remove'] - $data['staff_remove'];
     }
     return $this->request->put('ticket/mass', $input);
 }
 /**
  * Scopes: role_operator, role_admin, role_owner, customer_autologin
  *
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function remove()
 {
     $customerId = $this->getCustomerId();
     $autologinId = $this->getAutoLoginId();
     $input = [];
     return $this->request->delete(sprintf('customer/%1d/autologin/%1d', $customerId, $autologinId), $input);
 }
Esempio n. 5
0
 /**
  * Scopes: www
  *
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function activate()
 {
     $customerId = $this->getId();
     $input = [];
     $input['activate'] = true;
     return $this->request->post(sprintf('customer/%1d/activate', $customerId), $input);
 }
Esempio n. 6
0
 /**
  * Scopes: role_owner, role_admin
  *
  * @param array $optional
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function invites($optional = [])
 {
     $input = [];
     if (isset($optional['page'])) {
         $input['page'] = $optional['page'];
     }
     return $this->request->get('staff/invite', $input);
 }
 /**
  * Scopes: role_customer, role_operator, role_admin, role_owner
  *
  * @param array $optional
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function get($optional = [])
 {
     $ticketId = $this->getTicketId();
     $messageId = $this->getMessageId();
     $input = [];
     if (isset($optional['with'])) {
         $input['with'] = $optional['with'];
     }
     return $this->request->get(sprintf('ticket/%1d/message/%1d', $ticketId, $messageId), $input);
 }
Esempio n. 8
0
 /**
  * Scopes: role_owner, role_admin
  *
  * @param string|resource $file
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  * @throws \Aikidesk\SDK\Instance\Exceptions\SDKValidationException
  */
 public function logo($file)
 {
     $input = [];
     if (is_string($file)) {
         $resource = fopen($file, 'r');
         $psr7Stream = new Stream($resource);
     } elseif (is_resource($file) and (get_resource_type($file) == 'file' or get_resource_type($file) == 'stream')) {
         $resource = $file;
         $psr7Stream = new Stream($resource);
     } else {
         throw new SDKValidationException('Logo is not file path nor file resource');
     }
     $fileContent = $psr7Stream->getContents();
     $fileType = pathinfo($psr7Stream->getMetadata('uri'), PATHINFO_EXTENSION);
     $fileName = pathinfo($psr7Stream->getMetadata('uri'), PATHINFO_FILENAME);
     $input['logo_img_s3key'] = 'data:image/' . $fileType . ';base64,' . base64_encode($fileContent) . ',' . $fileName;
     return $this->request->post('setting/theme', $input);
 }
Esempio n. 9
0
 /**
  * @return string
  */
 public function getAccessToken()
 {
     return $this->request->getAccessToken();
 }
Esempio n. 10
0
 /**
  * Scopes: role_owner, role_admin, www
  *
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function delete()
 {
     $oauthId = $this->getOAuthId();
     $input = [];
     return $this->request->delete(sprintf('oauth/%1d', $oauthId), $input);
 }
Esempio n. 11
0
 /**
  * Scopes: stats_unread_messages, role_operator, role_owner, role_admin
  *
  * @param int $customerId
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function unreadMessages($customerId)
 {
     return $this->request->get(sprintf('stats/unreadMessages/%1d', $customerId));
 }