/**
  * Scopes: role_operator, role_admin, role_owner
  *
  * @param string $email
  * @param array $optional
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function create($email, $optional = [])
 {
     $customerId = $this->getCustomerId();
     $input = [];
     $input['email'] = $email;
     return $this->request->post(sprintf('customer/%1d/email', $customerId), $input);
 }
Example #2
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);
 }
Example #3
0
 /**
  * @param string $refreshToken
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function createRefreshToken($refreshToken)
 {
     $oauthId = $this->getOauthClientId();
     $oauthSecret = $this->getOauthClientSecret();
     $postFormData = ['client_id' => $oauthId, 'client_secret' => $oauthSecret, 'grant_type' => 'refresh_token', 'refresh_token' => $refreshToken, 'state' => 'PhEbakeb4azeqAtUPrewabuxUwruqahA'];
     return $this->request->post('oauth/refresh_token', $postFormData);
 }
 /**
  * Scopes: role_operator, role_admin, role_owner, customer_autologin
  *
  * @param array $optional
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function create($optional = [])
 {
     $customerId = $this->getCustomerId();
     $input = [];
     if (isset($optional['expire'])) {
         $input['expire'] = $optional['expire'];
     }
     return $this->request->post(sprintf('customer/%1d/autologin', $customerId), $input);
 }
 /**
  * Scopes: role_customer, role_operator, role_admin, role_owner
  *
  * @param string $text
  * @param array $optional
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function reply($text, $optional = [])
 {
     $ticketId = $this->getTicketId();
     $input = [];
     $input['text'] = $text;
     if (isset($optional['close'])) {
         $input['close'] = $optional['close'];
     }
     if (isset($optional['private'])) {
         $input['private'] = $optional['private'];
     }
     return $this->request->post(sprintf('ticket/%1d/message', $ticketId), $input);
 }
Example #6
0
 /**
  * Scopes: role_customer, role_operator, role_admin, role_owner
  *
  * @param string $topic
  * @param string $text
  * @param int $department
  * @param array $optional
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function create($topic, $text, $department, $optional = [])
 {
     $input = [];
     $input['topic'] = $topic;
     $input['text'] = $text;
     $input['department'] = $department;
     $input['priority'] = 0;
     if (isset($optional['priority'])) {
         $input['priority'] = $optional['priority'];
     }
     if (isset($optional['sender'])) {
         $input['sender'] = $optional['sender'];
     }
     return $this->request->post('ticket', $input);
 }
Example #7
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);
 }
Example #8
0
 /**
  * Scopes: role_owner, role_admin
  * Roles: 10, 20
  *
  * @param string $name
  * @param string $email
  * @param int $role
  * @param array $optional
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function invite($name, $email, $role, $optional = [])
 {
     $input = [];
     $input['name'] = $name;
     $input['email'] = $email;
     $input['role'] = $role;
     if (isset($optional['departments'])) {
         $input['departments'] = $optional['departments'];
     }
     if (isset($optional['departments_add_public'])) {
         $input['departments_add_public'] = $optional['departments_add_public'];
     }
     if (isset($optional['departments_add_private'])) {
         $input['departments_add_private'] = $optional['departments_add_private'];
     }
     if (isset($optional['expireAfter'])) {
         $input['expireAfter'] = $optional['expireAfter'];
     }
     return $this->request->post('staff', $input);
 }
 /**
  * Scopes: role_admin, role_owner
  *
  * @param string $name
  * @param string $mailbox
  * @param array $leadStaff
  * @param array $optional
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function create($name, $mailbox, $leadStaff, $optional = [])
 {
     $input = [];
     $input['name'] = $name;
     $input['mailbox'] = $mailbox;
     $input['lead_staff'] = $leadStaff;
     if (isset($optional['description'])) {
         $input['description'] = $optional['description'];
     }
     if (isset($optional['forwarders'])) {
         $input['forwarders'] = $optional['forwarders'];
     }
     if (isset($optional['smtpType'])) {
         $input['smtpType'] = $optional['smtpType'];
     }
     if (isset($optional['visibility'])) {
         $input['visibility'] = $optional['visibility'];
     }
     if (isset($optional['slas'])) {
         $input['slas'] = $optional['slas'];
     }
     return $this->request->post('department', $input);
 }
Example #10
0
 /**
  * Scopes: role_owner, role_admin, www
  *
  * @param string $name
  * @param array $optional
  * @return \Aikidesk\SDK\Instance\Contracts\ResponseInterface
  */
 public function create($name, $optional = [])
 {
     $input = [];
     $input['name'] = $name;
     return $this->request->post('oauth', $input);
 }