-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathIFedoraApi.php
191 lines (175 loc) · 5.42 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?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 EasyRdf\Graph;
use Psr\Http\Message\ResponseInterface;
/**
* 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(): string;
/**
* Gets a Fedora resource.
*
* @param string $uri Resource URI
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function getResource(
string $uri = "",
array $headers = []
): ResponseInterface;
/**
* Gets a Fedora resoure's headers.
*
* @param string $uri Resource URI
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function getResourceHeaders(
string $uri = "",
array $headers = []
): ResponseInterface;
/**
* 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(
string $uri = "",
array $headers = []
): ResponseInterface;
/**
* Creates a new resource in Fedora.
*
* @param string $uri Resource URI
* @param mixed|null $content String, resource from fopen() or stream content
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function createResource(
string $uri = "",
$content = null,
array $headers = []
): ResponseInterface;
/**
* Saves a resource in Fedora.
*
* @param string $uri Resource URI
* @param mixed|null $content String, resource from fopen() or stream content
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function saveResource(
string $uri,
$content = null,
array $headers = []
): ResponseInterface;
/**
* 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(
string $uri,
string $sparql = "",
array $headers = []
): ResponseInterface;
/**
* Issues a DELETE request to Fedora.
*
* @param string $uri Resource URI
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function deleteResource(
string $uri = "",
array $headers = []
): ResponseInterface;
/**
* Saves RDF in Fedora.
*
* @param \EasyRdf\Graph $graph Graph to save
* @param string $uri Resource URI
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function saveGraph(
Graph $graph,
string $uri = "",
array $headers = []
): ResponseInterface;
/**
* Creates RDF in Fedora.
*
* @param \EasyRdf\Graph $graph Graph to save
* @param string $uri Resource URI
* @param array $headers HTTP Headers
*
* @return ResponseInterface
*/
public function createGraph(
Graph $graph,
string $uri = '',
array $headers = []
): ResponseInterface;
/**
* Gets RDF in Fedora.
*
* @param ResponseInterface $response Response received
*
* @return \EasyRdf\Graph
* @throws \EasyRdf\Exception Unable to parse graph.
*/
public function getGraph(ResponseInterface $response): Graph;
/**
* Creates a version of the resource in Fedora.
*
* @param string $uri Resource URI
* @param string $timestamp Timestamp in RFC-1123 format
* @param string|null $content Content for the version
* @param array $headers HTTP Headers
* @return \Psr\Http\Message\ResponseInterface
*/
public function createVersion(
string $uri = "",
string $timestamp = "",
?string $content = null,
array $headers = []
): ResponseInterface;
/**
* 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(
string $uri = "",
array $headers = []
): ResponseInterface;
}