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); } }
/** * Post the data * * @param array $data * @return array */ public function insertPost(array $data) { return Call::communicate('POST', ["organizations/{$this->organizationId}/crawlers/posts" => $data]); }
/** * Insert. * * @param array $data * @return array */ public function insert(array $data) { return Call::communicate('POST', ["organizations/{$this->organizationId}/jobagents" => $data]); }
/** * Add new country. * * @param string $name * @return array */ public function addCountry($name) { return Call::communicate('POST', ["organizations/{$this->organizationId}/countries" => ['name' => $name]]); }
/** * 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'])]]); }
/** * 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]); }
/** * Delete the organization. * * @param integer $organizationId * @return array */ public function insertOrganization($organizationId) { return Call::communicate('DELETE', ["organizations/{$organizationId}" => []]); }
/** * 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]]); }
/** * 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]]); }
/** * 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]]); }
/** * 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" => []]); }