-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkbService.php
More file actions
83 lines (73 loc) · 2.78 KB
/
kbService.php
File metadata and controls
83 lines (73 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/*
* PHP Representation of the WorldCat Knowledge Base API.
* Created by terrywbrady at OCLC Developer House 2014.
*/
include 'oclcService.php';
include 'oclcData.php';
include 'oclcPager.php';
include 'oclcResult.php';
include 'kbSetting.php';
include 'kbEntry.php';
include 'kbProvider.php';
include 'kbCollection.php';
class kbService extends oclcService {
public function __construct($configFile) {
parent::__construct($configFile);
$this->service = "kb/rest/";
}
public function getSettings($opt, $pageOpt) {
$req = $this->getUrl("settings/" . $this->inst_id);
$json = $this->getResponseJson($req);
$settings = new kbSetting($json);
return new oclcResult($json, $settings, $pageOpt, kbSetting::getTableHeader());
}
public function getProviders($opt, $pageOpt) {
$func = "providers";
$opt = array_merge($this->getDefaultOptions(), $opt);
$req = $this->getUrl($func, $opt);
$json = $this->getResponseJson($req);
$providers = kbProvider::getProviders($json['entries']);
return new oclcResult($json, $providers, $pageOpt, kbProvider::getTableHeader());
}
public function getProviderByUid($uid, $opt, $pageOpt) {
$func = "providers/{$uid}";
$opt = array_merge($this->getDefaultOptions(), $opt);
$req = $this->getUrl($func, $opt);
$json = $this->getResponseJson($req);
$provider = new kbProvider($json);
return new oclcResult($json, $provider, $pageOpt, kbProvider::getTableHeader());
}
public function getCollections($opt, $pageOpt) {
$func = "collections";
$opt = array_merge($this->getDefaultOptions(), $opt);
$req = $this->getUrl($func, $opt);
$json = $this->getResponseJson($req);
$collections = kbCollection::getCollections($json['entries']);
return new oclcResult($json, $collections, $pageOpt, kbCollection::getTableHeader());
}
public function getCollectionByUid($uid, $opt, $pageOpt) {
$func = "collections/{$uid}";
$opt = array_merge($this->getDefaultOptions(), $opt);
$req = $this->getUrl($func, $opt);
$json = $this->getResponseJson($req);
$collection = new kbCollection($json);
return new oclcResult($json, $collection, $pageOpt, kbCollection::getTableHeader());
}
public function getEntries($opt, $pageOpt) {
$func = "entries";
$opt = array_merge($this->getDefaultOptions(), $opt);
$req = $this->getUrl($func, $opt);
$json = $this->getResponseJson($req);
$entries = kbEntry::getEntries($json['entries']);
return new oclcResult($json, $entries, $pageOpt, kbEntry::getTableHeader());
}
public function getEntryByUid($uid, $opt, $pageOpt) {
$func = "entries/{$uid}";
$opt = array_merge($this->getDefaultOptions(), $opt);
$req = $this->getUrl($func, $opt);
$json = $this->getResponseJson($req);
$entry = new kbEntry($json);
return new oclcResult($json, $entry, $pageOpt, kbEntry::getTableHeader());
}
}