@@ -39,6 +39,10 @@ If the package doesn't fit your needs, you might take a look at the alternative
39
39
* [ Task lists] ( #task-lists )
40
40
* [ Lending requests] ( #lending-requests )
41
41
* [ Requested resources (pick from shelf)] ( #requested-resources-pick-from-shelf )
42
+ * [ Jobs] ( #jobs )
43
+ * [ Listing jobs] ( #listing-jobs )
44
+ * [ Retrieving information about a specific job] ( #retrieving-information-about-a-specific-job )
45
+ * [ Submitting a job] ( #submitting-a-job )
42
46
* [ Automatic retries on errors] ( #automatic-retries-on-errors )
43
47
* [ Laravel integration] ( #laravel-integration )
44
48
* [ Customizing the HTTP client stack] ( #customizing-the-http-client-stack )
@@ -101,8 +105,11 @@ $alma->nz->setSruClient(new SruClient(
101
105
102
106
## Quick intro
103
107
104
- The ` $alma ` object provides ` $alma->bibs ` (for Bibs, Holdings, Items), ` $alma->users ` (for Users),
105
- ` $alma->analytics ` (for Analytics reports), ` $alma->libraries ` (for Libraries).
108
+ The library provides access to Bibs, Holdings and Items
109
+ through ` $alma->bibs ` , Users (` $alma->users ` ), Analytics reports
110
+ (` $alma->analytics ` ), Libraries (` $alma->libraries ` ), Task Lists (` $alma->taskLists ` ) and Jobs (` $alma->jobs ` ).
111
+
112
+ To fetch a Bib record:
106
113
107
114
``` php
108
115
$bib = $alma->bibs->get('990114012304702204');
@@ -485,7 +492,7 @@ Note: As of 2018-10-13, there is a bug preventing you from retrieving more than
485
492
### Requested resources (pick from shelf)
486
493
487
494
``` php
488
- $library = $alma->conf-> libraries['LIBRARY_CODE'];
495
+ $library = $alma->libraries['LIBRARY_CODE'];
489
496
$requests = $alma->taskLists->getRequestedResources($library, 'DEFAULT_CIRC_DESK', [
490
497
'printed' => 'N',
491
498
]);
@@ -494,6 +501,35 @@ foreach ($requests as $request) {
494
501
}
495
502
```
496
503
504
+ ## Jobs
505
+
506
+ ### Listing jobs
507
+
508
+ To list all jobs and their instances:
509
+
510
+ ``` php
511
+ foreach ($alma->jobs as $job) {
512
+ echo "[{$job->id}] {$job->name} / {$job->description}\n";
513
+ foreach ($job->instances as $instance) {
514
+ echo " [{$instance->id}] Status: {$instance->status->desc}\n";
515
+ }
516
+ }
517
+ ```
518
+
519
+ This is a generator, so you can start processing results before the full list has been retrieved (it fetches jobs in batches of 10).
520
+
521
+ ### Retrieving information about a specific job
522
+
523
+ ``` php
524
+ $job = $alma->jobs['M43'];
525
+ ```
526
+
527
+ ### Submitting a job
528
+
529
+ ``` php
530
+ $instance = $alma->jobs['M43']->submit();
531
+ ```
532
+
497
533
## Automatic retries on errors
498
534
499
535
If the client receives a 429 (rate limiting) response from Alma, it will sleep for a short time (0.5 seconds by default)
0 commit comments