1 | <?php |
||
28 | class Request implements RequestInterface |
||
29 | { |
||
30 | /** |
||
31 | * Protocol for api request. |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $protocol = 'https'; |
||
36 | |||
37 | /** |
||
38 | * Hostname for api request. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $host; |
||
43 | |||
44 | /** |
||
45 | * Api port. |
||
46 | * |
||
47 | * @var int |
||
48 | */ |
||
49 | protected $port = 80; |
||
50 | |||
51 | /** |
||
52 | * Request uri. |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $uri; |
||
57 | |||
58 | /** |
||
59 | * Parameters for request. |
||
60 | * |
||
61 | * @var RequestParameters |
||
62 | */ |
||
63 | protected $parameters; |
||
64 | |||
65 | /** |
||
66 | * A list of parameters the Content API accepts. |
||
67 | * |
||
68 | * For a list of accepted parameters find the variable allowed_params in |
||
69 | * the following file: |
||
70 | * https://github.com/superdesk/superdesk-content-api/blob/master/content_api/items/service.py |
||
71 | * |
||
72 | * @var string[] |
||
73 | */ |
||
74 | protected $validParameters = array( |
||
75 | 'start_date', 'end_date', 'q', 'max_results', 'page', |
||
76 | 'include_fields', 'exclude_fields' |
||
77 | ); |
||
78 | |||
79 | /** |
||
80 | * Request headers. |
||
81 | * |
||
82 | * @var string[] |
||
83 | */ |
||
84 | protected $headers = array(); |
||
85 | |||
86 | /** |
||
87 | * Request options, usuably in clients, etc. |
||
88 | * |
||
89 | * @var mixed[] |
||
90 | */ |
||
91 | protected $options = array(); |
||
92 | |||
93 | /** |
||
94 | * Construct a request object. |
||
95 | * |
||
96 | * @param string $hostname Host name |
||
97 | * @param string $uri Request uri |
||
98 | * @param RequestParameters $parameters Parameters |
||
99 | * @param int $port Port |
||
100 | * @param string $protocol Protocol |
||
101 | */ |
||
102 | public function __construct( |
||
127 | |||
128 | /** |
||
129 | * {@inheritdoc} |
||
130 | */ |
||
131 | public function getProtocol() |
||
135 | |||
136 | /** |
||
137 | * {@inheritdoc} |
||
138 | */ |
||
139 | public function setProtocol($protocol) |
||
149 | |||
150 | /** |
||
151 | * {@inheritdoc} |
||
152 | */ |
||
153 | public function getHost() |
||
157 | |||
158 | /** |
||
159 | * {@inheritdoc} |
||
160 | */ |
||
161 | public function setHost($host) |
||
171 | |||
172 | /** |
||
173 | * {@inheritdoc} |
||
174 | */ |
||
175 | public function getPort() |
||
179 | |||
180 | /** |
||
181 | * {@inheritdoc} |
||
182 | */ |
||
183 | public function setPort($port) |
||
193 | |||
194 | /** |
||
195 | * {@inheritdoc} |
||
196 | */ |
||
197 | public function getUri() |
||
201 | |||
202 | /** |
||
203 | * {@inheritdoc} |
||
204 | */ |
||
205 | public function setUri($uri) |
||
211 | |||
212 | /** |
||
213 | * {@inheritdoc} |
||
214 | */ |
||
215 | public function getParameters() |
||
219 | |||
220 | /** |
||
221 | * {@inheritdoc} |
||
222 | */ |
||
223 | public function setParameters(RequestParameters $parameters) |
||
229 | |||
230 | /** |
||
231 | * {@inheritdoc} |
||
232 | */ |
||
233 | public function getHeaders() |
||
237 | |||
238 | /** |
||
239 | * {@inheritdoc} |
||
240 | */ |
||
241 | public function setHeaders(array $headers) |
||
247 | |||
248 | /** |
||
249 | * {@inheritdoc} |
||
250 | */ |
||
251 | public function getOptions() |
||
255 | |||
256 | /** |
||
257 | * {@inheritdoc} |
||
258 | */ |
||
259 | public function setOptions(array $options) |
||
265 | |||
266 | /** |
||
267 | * {@inheritdoc} |
||
268 | */ |
||
269 | public function getBaseUrl() |
||
273 | |||
274 | /** |
||
275 | * {@inheritdoc} |
||
276 | */ |
||
277 | public function getFullUrl() |
||
286 | } |
||
287 |