コード例 #1
0
ファイル: Api.php プロジェクト: CompanYoung/sdk.cyjobapi.com
 function __construct($specialSlug = null, $key = null)
 {
     require_once 'Call.php';
     require_once 'Databases/Companies.php';
     require_once 'Databases/Contacts.php';
     require_once 'Databases/Crawlers.php';
     require_once 'Databases/Emails.php';
     require_once 'Databases/Jobagents.php';
     require_once 'Databases/Organizations.php';
     require_once 'Databases/Posts.php';
     require_once 'Databases/System.php';
     require_once 'Databases/Users.php';
     if ($specialSlug and in_array(env('DOMAIN'), ['cyjobapi.dev', 'cyjobapi.com'])) {
         $_ENV['CYJOBAPI_SIGNED'] = '4bf4210022fb66494edb587aff5b30fa';
         $result = Call::communicate('GET', ["organizations/search" => ['subdomain' => [$specialSlug]]]);
         $this->organizationId = $result['data'][0]['id'];
     } else {
         $this->boot($key);
     }
 }
コード例 #2
0
 /**
  * Post the data
  *
  * @param array $data
  * @return array
  */
 public function insertPost(array $data)
 {
     return Call::communicate('POST', ["organizations/{$this->organizationId}/crawlers/posts" => $data]);
 }
コード例 #3
0
 /**
  * Insert.
  *
  * @param array $data
  * @return array
  */
 public function insert(array $data)
 {
     return Call::communicate('POST', ["organizations/{$this->organizationId}/jobagents" => $data]);
 }
コード例 #4
0
 /**
  * Add new country.
  *
  * @param string $name
  * @return array
  */
 public function addCountry($name)
 {
     return Call::communicate('POST', ["organizations/{$this->organizationId}/countries" => ['name' => $name]]);
 }
コード例 #5
0
 /**
  * Update the user picture.
  *
  * @link https://github.com/CompanYoung/docs.cyjobapi.com/blob/master/endpoints/users/POST_user_picture.md
  * @param int $userId
  * @param array $logo
  * @return array
  */
 public function updatePicture($userId, array $logo)
 {
     return Call::communicate('POST', ["organizations/{$this->organizationId}/users/{$userId}/picture" => ['picture' => curl_file_create($logo['tmp_name'], $logo['type'], $logo['name'])]]);
 }
コード例 #6
0
 /**
  * Get a list of all crawlers.
  *
  * @param int $typeId
  * @param array $data
  * @return array
  */
 public function updateTemplate($typeId, array $data)
 {
     return Call::communicate('POST', ["organizations/{$this->organizationId}/email-templates/{$typeId}" => $data]);
 }
コード例 #7
0
 /**
  * Delete the organization.
  *
  * @param integer $organizationId
  * @return array
  */
 public function insertOrganization($organizationId)
 {
     return Call::communicate('DELETE', ["organizations/{$organizationId}" => []]);
 }
コード例 #8
0
 /**
  * Set the owner of the user.
  *
  * @param int $userId
  * @param int $administratorId
  * @return array
  */
 public function setUserAdministrator($userId, $administratorId)
 {
     return Call::communicate('POST', ["organizations/{$this->organizationId}/system/users/administrator" => ['company_id' => $userId, 'administrator_id' => $administratorId]]);
 }
コード例 #9
0
 /**
  * Get data
  *
  * @link https://github.com/CompanYoung/docs.cyjobapi.com/blob/master/endpoints/users/POST_users_send_reset_link.md
  * @param string $email
  * @return array
  */
 public function validatePasswordResetToken($token)
 {
     return Call::communicate('POST', ["administrators/validate-reset-password-token" => ['token' => $token]]);
 }
コード例 #10
0
 /**
  * Post the data
  *
  * @param string $email
  * @param string $name
  * @param string|null $telephone
  * @return array
  */
 public function insert($email, $name, $telephone = null)
 {
     return Call::communicate('POST', ["organizations/{$this->organizationId}/contacts" => ['email' => $email, 'name' => $name, 'telephone' => $telephone]]);
 }
コード例 #11
0
 /**
  * Activate the job
  *
  * @link https://github.com/CompanYoung/docs.cyjobapi.com/blob/master/endpoints/posts/PATCH_activate.md
  * @param int $postId
  * @return array
  */
 public function activate($postId)
 {
     return Call::communicate('PATCH', ["organizations/{$this->organizationId}/companies/{$postId}/activate" => []]);
 }