forked from Islandora/chullo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIFedoraApi.php
170 lines (155 loc) · 4.46 KB
/
IFedoraApi.php
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
/**
* This file is part of Islandora.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @category Islandora
* @package Islandora
* @author Daniel Lamb <dlamb@islandora.ca>
* @author Nick Ruest <ruestn@gmail.com>
* @author Diego Pino <dpino@metro.org>
* @license https://opensource.org/licenses/MIT MIT
* @link http://www.islandora.ca
*/
namespace Islandora\Chullo;
use Psr\Http\Message\ResponseInterface;
// phpcs:disable
if (class_exists('\EasyRdf_Graph') && !class_exists('\EasyRdf\Graph')) {
class_alias('\EasyRdf_Graph', '\EasyRdf\Graph');
}
// phpcs:enable
/**
* Interface for Fedora interaction. All functions return a PSR-7 response.
*/
interface IFedoraApi
{
/**
* Gets the Fedora base uri (e.g. http://localhost:8080/fcrepo/rest)
*
* @return string
*/
public function getBaseUri();
/**
* Gets a Fedora resource.
*
* @param string $uri Resource URI
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function getResource(
$uri = "",
$headers = []
);
/**
* Gets a Fedora resoure's headers.
*
* @param string $uri Resource URI
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function getResourceHeaders(
$uri = "",
$headers = []
);
/**
* Gets information about the supported HTTP methods, etc., for a Fedora resource.
*
* @param string $uri Resource URI
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function getResourceOptions(
$uri = "",
$headers = []
);
/**
* Creates a new resource in Fedora.
*
* @param string $uri Resource URI
* @param string $content String or binary content
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function createResource(
$uri = "",
$content = null,
$headers = []
);
/**
* Saves a resource in Fedora.
*
* @param string $uri Resource URI
* @param string $content String or binary content
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function saveResource(
$uri,
$content = null,
$headers = []
);
/**
* Modifies a resource using a SPARQL Update query.
*
* @param string $uri Resource URI
* @param string $sparql SPARQL Update query
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function modifyResource(
$uri,
$sparql = "",
$headers = []
);
/**
* Issues a DELETE request to Fedora.
*
* @param string $uri Resource URI
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function deleteResource(
$uri = "",
$headers = []
);
/**
* Saves RDF in Fedora.
*
* @param EasyRdf_Resource $rdf Graph to save
* @param string $uri Resource URI
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function saveGraph(
\EasyRdf\Graph $graph,
$uri = "",
$headers = []
);
/**
* Creates a version of the resource in Fedora.
*
* @param string $uri Resource URI
* @param string $timestamp Timestamp in RFC-1123 format
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function createVersion(
$uri = "",
$timestamp = "",
$content = null,
$headers = []
);
/**
* Creates a version of the resource in Fedora.
*
* @param string $uri Resource URI
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function getVersions(
$uri = "",
$headers = []
);
}