10 defined(
'JPATH_PLATFORM') or die();
31 public function getJob($id, $fields = null)
33 $token = $this->oauth->getToken();
37 'oauth_token' => $token[
'key']
41 $base =
'/v1/jobs/' . $id;
44 $data[
'format'] =
'json';
49 $base .=
':' . $fields;
53 $path = $this->getOption(
'api.url') . $base;
56 $response = $this->oauth->oauthRequest($path,
'GET', $parameters, $data);
58 return json_decode($response->body);
70 public function getBookmarked($fields = null)
72 $token = $this->oauth->getToken();
76 'oauth_token' => $token[
'key']
80 $base =
'/v1/people/~/job-bookmarks';
83 $data[
'format'] =
'json';
88 $base .=
':' . $fields;
92 $path = $this->getOption(
'api.url') . $base;
95 $response = $this->oauth->oauthRequest($path,
'GET', $parameters, $data);
97 return json_decode($response->body);
109 public function bookmark($id)
111 $token = $this->oauth->getToken();
115 'oauth_token' => $token[
'key']
119 $this->oauth->setOption(
'success_code', 201);
122 $base =
'/v1/people/~/job-bookmarks';
125 $xml =
'<job-bookmark><job><id>' . $id .
'</id></job></job-bookmark>';
128 $path = $this->getOption(
'api.url') . $base;
130 $header[
'Content-Type'] =
'text/xml';
133 $response = $this->oauth->oauthRequest($path,
'POST', $parameters, $xml, $header);
147 public function deleteBookmark($id)
149 $token = $this->oauth->getToken();
153 'oauth_token' => $token[
'key']
157 $this->oauth->setOption(
'success_code', 204);
160 $base =
'/v1/people/~/job-bookmarks/' . $id;
163 $path = $this->getOption(
'api.url') . $base;
166 $response = $this->oauth->oauthRequest($path,
'DELETE', $parameters);
182 public function getSuggested($fields = null, $start = 0, $count = 0)
184 $token = $this->oauth->getToken();
188 'oauth_token' => $token[
'key']
192 $base =
'/v1/people/~/suggestions/job-suggestions';
194 $data[
'format'] =
'json';
199 $base .=
':' . $fields;
205 $data[
'start'] = $start;
211 $data[
'count'] = $count;
215 $path = $this->getOption(
'api.url') . $base;
218 $response = $this->oauth->oauthRequest($path,
'GET', $parameters, $data);
220 return json_decode($response->body);
247 public function search($fields = null, $keywords = null, $company_name = null, $job_title = null, $country_code = null, $postal_code = null,
248 $distance = null, $facets = null, $facet = null, $start = 0, $count = 0, $sort = null)
250 $token = $this->oauth->getToken();
254 'oauth_token' => $token[
'key']
258 $base =
'/v1/job-search';
260 $data[
'format'] =
'json';
265 $base .=
':' . $fields;
271 $data[
'keywords'] = $keywords;
277 $data[
'company-name'] = $company_name;
283 $data[
'job-title'] = $job_title;
289 $data[
'country-code'] = $country_code;
295 $data[
'postal-code'] = $postal_code;
301 $data[
'distance'] = $distance;
307 $data[
'facets'] = $facets;
313 $data[
'facet'] = array();
314 for ($i = 0; $i < count($facet); $i++)
320 $data[
'facet'][] =
'company,' . $this->oauth->safeEncode($facet[$i]);
324 $data[
'facet'][] =
'date-posted,' . $facet[$i];
328 $data[
'facet'][] =
'location,' . $facet[$i];
332 $data[
'facet'][] =
'job-function,' . $this->oauth->safeEncode($facet[$i]);
336 $data[
'facet'][] =
'industry,' . $facet[$i];
340 $data[
'facet'][] =
'salary,' . $facet[$i];
349 $data[
'start'] = $start;
355 $data[
'count'] = $count;
361 $data[
'sort'] = $sort;
365 $path = $this->getOption(
'api.url') . $base;
368 $response = $this->oauth->oauthRequest($path,
'GET', $parameters, $data);
370 return json_decode($response->body);