1
|
|
|
<?php namespace JobApis\Jobs\Client\Queries; |
2
|
|
|
|
3
|
|
|
class UsajobsQuery extends AbstractQuery |
4
|
|
|
{ |
5
|
|
|
/** |
6
|
|
|
* AuthorizationKey |
7
|
|
|
* |
8
|
|
|
* Your USAJOBS API key |
9
|
|
|
* |
10
|
|
|
* @var string |
11
|
|
|
*/ |
12
|
|
|
protected $AuthorizationKey; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Keyword |
16
|
|
|
* |
17
|
|
|
* Issues search to find hits based on a keyword. Optional. |
18
|
|
|
* Keyword will search for all of the words specified (or synonyms of the word) |
19
|
|
|
* throughout the job announcement. |
20
|
|
|
* |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
protected $Keyword; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* KeywordExclusion |
27
|
|
|
* |
28
|
|
|
* Issues search to find hits NOT matching KeywordExclusion parameter. |
29
|
|
|
* Position Title is ranked first in the Exclusion. |
30
|
|
|
* |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
protected $KeywordExclusion; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* KeywordFilter |
37
|
|
|
* |
38
|
|
|
* Corresponds with the Keyword parameter. Defines the type of phrase |
39
|
|
|
* search to issue. Types include: "All", "Any", "Exact". |
40
|
|
|
* |
41
|
|
|
* @var string |
42
|
|
|
*/ |
43
|
|
|
protected $KeywordFilter; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* PositionTitle |
47
|
|
|
* |
48
|
|
|
* Issues search to find hits in the title of the job. This is the job |
49
|
|
|
* title - e.g. IT Specialist, Psychologist, etc. The title search will |
50
|
|
|
* be treated as "contains" and will select all job announcements where |
51
|
|
|
* the job title contains the value provided. |
52
|
|
|
* |
53
|
|
|
* @var string |
54
|
|
|
*/ |
55
|
|
|
protected $PositionTitle; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* RemunerationMinimumAmount |
59
|
|
|
* |
60
|
|
|
* Issues search to find hits with the minimum salary specified. Jobs are |
61
|
|
|
* placed in salary buckets: $0-$24,999, $25,000-$49,999, $50,000-$74,999, |
62
|
|
|
* $75,000-$99,999, $100,000-$124,999, $125,000-$149,999, $150,000-$174,999, |
63
|
|
|
* $175,000-$199,999 and $200,000 or greater. So a search with a minimum |
64
|
|
|
* salary of $15,500 will return jobs with a minimum salary in the $0-$24,999 |
65
|
|
|
* range. |
66
|
|
|
* |
67
|
|
|
* @var string |
68
|
|
|
*/ |
69
|
|
|
protected $RemunerationMinimumAmount; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* RemunerationMaximumAmount |
73
|
|
|
* |
74
|
|
|
* Issues search to find hits with the maximum salary specified. Jobs |
75
|
|
|
* are placed in salary buckets: $0-$24,999, $25,000-$49,999, $50,000-$74,999, |
76
|
|
|
* $75,000-$99,999, $100,000-$124,999, $125,000-$149,999, $150,000-$174,999, |
77
|
|
|
* $175,000-$199,999 and $200,000 or greater. So a search with a maximum salary |
78
|
|
|
* of $72,000 will return jobs with a maximum salary in the $50,000-$74,999 range. |
79
|
|
|
* |
80
|
|
|
* @var string |
81
|
|
|
*/ |
82
|
|
|
protected $RemunerationMaximumAmount; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* PayGradeHigh |
86
|
|
|
* |
87
|
|
|
* Issues search to find hits with the maximum pay grade specified. Must be |
88
|
|
|
* 01 through 15. This is the ending grade for the job. (Caution: Fed speak |
89
|
|
|
* ahead but it cannot be helped.) The grade along with series is used by |
90
|
|
|
* the Federal government to categorize and define jobs. |
91
|
|
|
* |
92
|
|
|
* @var string |
93
|
|
|
*/ |
94
|
|
|
protected $PayGradeHigh; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* PayGradeLow |
98
|
|
|
* |
99
|
|
|
* Issues search to find hits with the minimum pay grade specified. Must |
100
|
|
|
* be 01 through 15. This is the beginning grade for the job. See |
101
|
|
|
* PayGradeHigh for more information. |
102
|
|
|
* |
103
|
|
|
* @var string |
104
|
|
|
*/ |
105
|
|
|
protected $PayGradeLow; |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* JobCategoryCode |
109
|
|
|
* |
110
|
|
|
* Issues a search to find hits with the job category series specified. |
111
|
|
|
* |
112
|
|
|
* @var string |
113
|
|
|
*/ |
114
|
|
|
protected $JobCategoryCode; |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* LocationName |
118
|
|
|
* |
119
|
|
|
* Issues a search to find hits within the specified location. This is |
120
|
|
|
* the city or military installation name. LocationName simplifies |
121
|
|
|
* location based search as the user does not need to know or account |
122
|
|
|
* for each and every Location Code. LocationName will search for all |
123
|
|
|
* location codes and ZIP codes that have that specific description. |
124
|
|
|
* NOTE: Multiple values are semicolon delimited. |
125
|
|
|
* |
126
|
|
|
* @var string |
127
|
|
|
*/ |
128
|
|
|
protected $LocationName; |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* PostingChannel |
132
|
|
|
* |
133
|
|
|
* Issues a search to find jobs with a posting channel specified. |
134
|
|
|
* Posting channels are used to identify different sources for Agency |
135
|
|
|
* reporting, and categorizing needs. |
136
|
|
|
* |
137
|
|
|
* @var string |
138
|
|
|
*/ |
139
|
|
|
protected $PostingChannel; |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Organization |
143
|
|
|
* |
144
|
|
|
* Issues a search to find jobs for the specified agency using the Agency Subelement Code. |
145
|
|
|
* |
146
|
|
|
* @var string |
147
|
|
|
*/ |
148
|
|
|
protected $Organization; |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* PositionOfferingTypeCode |
152
|
|
|
* |
153
|
|
|
* Issues a search to find jobs within the specified type. This field |
154
|
|
|
* is also known as Work Type. |
155
|
|
|
* |
156
|
|
|
* @var string |
157
|
|
|
*/ |
158
|
|
|
protected $PositionOfferingTypeCode; |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* TravelPercentage |
162
|
|
|
* |
163
|
|
|
* Issues a search to find hits for jobs matching the specified travel level. |
164
|
|
|
* Acceptable values for travel percentage parameter are: |
165
|
|
|
* Value Definition |
166
|
|
|
* 0 Not Required |
167
|
|
|
* 1 Occasional Travel |
168
|
|
|
* 2 25% or Greater |
169
|
|
|
* 5 50% or Greater |
170
|
|
|
* 7 75% or Greater |
171
|
|
|
* |
172
|
|
|
* @var string |
173
|
|
|
*/ |
174
|
|
|
protected $TravelPercentage; |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* PositionScheduleTypeCode |
178
|
|
|
* |
179
|
|
|
* Issues a search to find hits for jobs matching the specified job schedule. |
180
|
|
|
* This field is also known as work schedule. |
181
|
|
|
* Acceptable values for Position Schedule Type Code are: |
182
|
|
|
* Value Definition |
183
|
|
|
* 1 Full-Time |
184
|
|
|
* 2 Part-Time |
185
|
|
|
* 3 Shift Work |
186
|
|
|
* 4 Intermittent |
187
|
|
|
* 5 Job Sharing |
188
|
|
|
* 6 Multiple Schedules |
189
|
|
|
* NOTE: Multiple values are semicolon delimited. |
190
|
|
|
* |
191
|
|
|
* @var string |
192
|
|
|
*/ |
193
|
|
|
protected $PositionScheduleTypeCode; |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* RelocationIndicator |
197
|
|
|
* |
198
|
|
|
* Issues a search to find hits for jobs matching the relocation filter. |
199
|
|
|
* Acceptable values for this field are: True or False |
200
|
|
|
* |
201
|
|
|
* @var string |
202
|
|
|
*/ |
203
|
|
|
protected $RelocationIndicator; |
204
|
|
|
|
205
|
|
|
/** |
206
|
|
|
* SecurityClearanceRequired |
207
|
|
|
* |
208
|
|
|
* Issues a search to find hits for jobs matching the specified security clearance. |
209
|
|
|
* Acceptable values for Security Clearance Required parameter are: |
210
|
|
|
* Value Definition |
211
|
|
|
* 0 Not Applicable |
212
|
|
|
* 1 Confidential |
213
|
|
|
* 2 Secret |
214
|
|
|
* 3 Top Secret |
215
|
|
|
* 4 Top Secret/SCI |
216
|
|
|
* 5 Q - Sensitive |
217
|
|
|
* 6 Q - Nonsensitive |
218
|
|
|
* 7 L - Atomic Energy |
219
|
|
|
* 8 Other |
220
|
|
|
* 9 Public Trust - Background Investigation |
221
|
|
|
* NOTE: Multiple values are semicolon delimited. |
222
|
|
|
* |
223
|
|
|
* @var string |
224
|
|
|
*/ |
225
|
|
|
protected $SecurityClearanceRequired; |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* SupervisoryStatus |
229
|
|
|
* |
230
|
|
|
* Issues a search to find hits for jobs matching the specified supervisory status. |
231
|
|
|
* |
232
|
|
|
* @var string |
233
|
|
|
*/ |
234
|
|
|
protected $SupervisoryStatus; |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* ExcludeJOAOpenFor30Days |
238
|
|
|
* |
239
|
|
|
* Issues a search that will exclude jobs open longer than 30 days. |
240
|
|
|
* Acceptable values for this field are: True or False |
241
|
|
|
* |
242
|
|
|
* @var string |
243
|
|
|
*/ |
244
|
|
|
protected $ExcludeJOAOpenFor30Days; |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* DatePosted |
248
|
|
|
* |
249
|
|
|
* Issues a search to find hits for jobs that were posted within the |
250
|
|
|
* number of days specified. |
251
|
|
|
* |
252
|
|
|
* @var string |
253
|
|
|
*/ |
254
|
|
|
protected $DatePosted; |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* JobGradeCode |
258
|
|
|
* |
259
|
|
|
* Issues a search to find hits for jobs matching the grade code specified. |
260
|
|
|
* This field is also known as Pay Plan. |
261
|
|
|
* NOTE: Multiple values are semicolon delimited. |
262
|
|
|
* |
263
|
|
|
* @var string |
264
|
|
|
*/ |
265
|
|
|
protected $JobGradeCode; |
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* SortField |
269
|
|
|
* |
270
|
|
|
* Issues a search that will be sorted by the specified field. |
271
|
|
|
* |
272
|
|
|
* @var string |
273
|
|
|
*/ |
274
|
|
|
protected $SortField; |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* SortDirection |
278
|
|
|
* |
279
|
|
|
* Issues a search that will be sorted by the SortField specified, in |
280
|
|
|
* the direction specified. Asc for ascending, or desc for descending. |
281
|
|
|
* |
282
|
|
|
* @var string |
283
|
|
|
*/ |
284
|
|
|
protected $SortDirection; |
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* Page |
288
|
|
|
* |
289
|
|
|
* Issues a search to pull the paged results specified. |
290
|
|
|
* |
291
|
|
|
* @var string |
292
|
|
|
*/ |
293
|
|
|
protected $Page; |
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* ResultsPerPage |
297
|
|
|
* |
298
|
|
|
* Issues a search and returns the page size specified. In this example, |
299
|
|
|
* 25 jobs will be return for the first page. |
300
|
|
|
* Acceptable values for this field are numbers, up to 500. |
301
|
|
|
* |
302
|
|
|
* @var string |
303
|
|
|
*/ |
304
|
|
|
protected $ResultsPerPage; |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* WhoMayApply |
308
|
|
|
* |
309
|
|
|
* Issues a search to find hits based on the desired candidate designation. |
310
|
|
|
* In this case, public will find jobs that U.S. citizens can apply for. |
311
|
|
|
* Acceptable values for this parameter are: "All","Public", or "Status". |
312
|
|
|
* |
313
|
|
|
* @var string |
314
|
|
|
*/ |
315
|
|
|
protected $WhoMayApply; |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* Radius |
319
|
|
|
* |
320
|
|
|
* Issues a search when used along with LocationName, will expand the locations, |
321
|
|
|
* based on the radius specified. |
322
|
|
|
* |
323
|
|
|
* @var string |
324
|
|
|
*/ |
325
|
|
|
protected $Radius; |
326
|
|
|
|
327
|
|
|
/** |
328
|
|
|
* Fields |
329
|
|
|
* |
330
|
|
|
* Issues a search that will return the minimum fields or maximum number of |
331
|
|
|
* fields in the job. Min returns only the job summary. Acceptable values for |
332
|
|
|
* this field are: "Min" and "Full" |
333
|
|
|
* |
334
|
|
|
* @var string |
335
|
|
|
*/ |
336
|
|
|
protected $Fields; |
337
|
|
|
|
338
|
|
|
/** |
339
|
|
|
* SalaryBucket |
340
|
|
|
* |
341
|
|
|
* Issues a search that will find hits for salaries matching the grouping |
342
|
|
|
* specified. Buckets are assigned based on salary ranges. For example |
343
|
|
|
* 25 = $25,000-$49,000. |
344
|
|
|
* NOTE: Multiple values are semicolon delimited. |
345
|
|
|
* |
346
|
|
|
* @var string |
347
|
|
|
*/ |
348
|
|
|
protected $SalaryBucket; |
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* GradeBucket |
352
|
|
|
* |
353
|
|
|
* Issues a search that will find hits for grades that match the grouping specified. |
354
|
|
|
* |
355
|
|
|
* @var string |
356
|
|
|
*/ |
357
|
|
|
protected $GradeBucket; |
358
|
|
|
|
359
|
|
|
/** |
360
|
|
|
* SES |
361
|
|
|
* |
362
|
|
|
* Issues a search that will find hits for jobs matching the Senior |
363
|
|
|
* executive category. Acceptable values are: True or False – Default is False. |
364
|
|
|
* |
365
|
|
|
* @var string |
366
|
|
|
*/ |
367
|
|
|
protected $SES; |
368
|
|
|
|
369
|
|
|
/** |
370
|
|
|
* Student |
371
|
|
|
* |
372
|
|
|
* Issues a search that will find hits for jobs matching the Student |
373
|
|
|
* category. Acceptable values are: True or False – Default is False. |
374
|
|
|
* When the Student query parameter is used and the value is set to True, |
375
|
|
|
* only job announcements targeted for students will be included. |
376
|
|
|
* |
377
|
|
|
* @var string |
378
|
|
|
*/ |
379
|
|
|
protected $Student; |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* Internship |
383
|
|
|
* |
384
|
|
|
* Issues a search that will find hits for jobs matching the Internship |
385
|
|
|
* category. Acceptable values are: True or False |
386
|
|
|
* |
387
|
|
|
* @var string |
388
|
|
|
*/ |
389
|
|
|
protected $Internship; |
390
|
|
|
|
391
|
|
|
/** |
392
|
|
|
* RecentGrad |
393
|
|
|
* |
394
|
|
|
* Issues a search that will find hits for jobs matching the RecentGrad |
395
|
|
|
* category. Acceptable values are: True or False |
396
|
|
|
* |
397
|
|
|
* @var string |
398
|
|
|
*/ |
399
|
|
|
protected $RecentGrad; |
400
|
|
|
|
401
|
|
|
/** |
402
|
|
|
* Get baseUrl |
403
|
|
|
* |
404
|
|
|
* @return string Value of the base url to this api |
405
|
|
|
*/ |
406
|
6 |
|
public function getBaseUrl() |
407
|
|
|
{ |
408
|
6 |
|
return 'https://data.usajobs.gov/api/search'; |
409
|
|
|
} |
410
|
|
|
|
411
|
|
|
/** |
412
|
|
|
* Get keyword |
413
|
|
|
* |
414
|
|
|
* @return string Attribute being used as the search keyword |
415
|
|
|
*/ |
416
|
6 |
|
public function getKeyword() |
417
|
|
|
{ |
418
|
6 |
|
return $this->Keyword; |
419
|
|
|
} |
420
|
|
|
|
421
|
|
|
/** |
422
|
|
|
* Get http method options based on current client. Good for adding POST parameters. |
423
|
|
|
* |
424
|
|
|
* @return array |
425
|
|
|
*/ |
426
|
4 |
|
public function getHttpMethodOptions() |
427
|
|
|
{ |
428
|
4 |
|
return ['headers' => $this->getHeaders()]; |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
/** |
432
|
|
|
* Gets the attributes to use for this API's query |
433
|
|
|
* |
434
|
|
|
* @var array |
435
|
|
|
*/ |
436
|
4 |
|
protected function getQueryAttributes() |
437
|
|
|
{ |
438
|
4 |
|
$attributes = get_object_vars($this); |
439
|
4 |
|
unset($attributes['AuthorizationKey']); |
440
|
4 |
|
return $attributes; |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
/** |
444
|
|
|
* Gets required headers as array |
445
|
|
|
* |
446
|
|
|
* @return array |
447
|
|
|
*/ |
448
|
4 |
|
protected function getHeaders() |
449
|
|
|
{ |
450
|
|
|
return [ |
451
|
4 |
|
'Host' => 'data.usajobs.gov', |
452
|
4 |
|
'Authorization-Key' => $this->get('AuthorizationKey'), |
453
|
4 |
|
'User-Agent' => null, // This prevents Guzzle from setting a user agent, which causes the API call to fail |
454
|
4 |
|
]; |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
/** |
458
|
|
|
* Required attributes for the query |
459
|
|
|
* |
460
|
|
|
* @var array |
461
|
|
|
*/ |
462
|
6 |
|
protected function requiredAttributes() |
463
|
|
|
{ |
464
|
|
|
return [ |
465
|
6 |
|
'AuthorizationKey', |
466
|
6 |
|
]; |
467
|
|
|
} |
468
|
|
|
} |
469
|
|
|
|