Skip to content

Commit df51739

Browse files
committed
Adds configurable http adapter, closes #12
1 parent f335c53 commit df51739

File tree

1 file changed

+161
-0
lines changed

1 file changed

+161
-0
lines changed

src/ConfigurableHttpAdapter.php

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Http Adapter package.
5+
*
6+
* (c) Eric GELOEN <[email protected]>
7+
*
8+
* For the full copyright and license information, please read the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Http\Adapter;
13+
14+
use Psr\Http\Message\StreamInterface;
15+
use Psr\Http\Message\UriInterface;
16+
use Psr\Http\Message\ResponseInterface;
17+
18+
/**
19+
* @author Márk Sági-Kazár [email protected]>
20+
*/
21+
interface ConfigurableHttpAdapter extends HttpAdapter
22+
{
23+
/**
24+
* Sends a GET request
25+
*
26+
* @param string|UriInterface $uri
27+
* @param string[] $headers
28+
* @param array $options
29+
*
30+
* @throws \InvalidArgumentException
31+
* @throws HttpAdapterException
32+
*
33+
* @return ResponseInterface
34+
*/
35+
public function get($uri, array $headers = [], array $options = []);
36+
37+
/**
38+
* Sends an HEAD request
39+
*
40+
* @param string|UriInterface $uri
41+
* @param string[] $headers
42+
* @param array $options
43+
*
44+
* @throws \InvalidArgumentException
45+
* @throws HttpAdapterException
46+
*
47+
* @return ResponseInterface
48+
*/
49+
public function head($uri, array $headers = [], array $options = []);
50+
51+
/**
52+
* Sends a TRACE request
53+
*
54+
* @param string|UriInterface $uri
55+
* @param string[] $headers
56+
* @param array $options
57+
*
58+
* @throws \InvalidArgumentException
59+
* @throws HttpAdapterException
60+
*
61+
* @return ResponseInterface
62+
*/
63+
public function trace($uri, array $headers = [], array $options = []);
64+
65+
/**
66+
* Sends a POST request
67+
*
68+
* @param string|UriInterface $uri
69+
* @param string[] $headers
70+
* @param array|string|StreamInterface $data
71+
* @param array $files
72+
* @param array $options
73+
*
74+
* @throws \InvalidArgumentException
75+
* @throws HttpAdapterException
76+
*
77+
* @return ResponseInterface
78+
*/
79+
public function post($uri, array $headers = [], $data = [], array $files = [], array $options = []);
80+
81+
/**
82+
* Sends a PUT request
83+
*
84+
* @param string|UriInterface $uri
85+
* @param string[] $headers
86+
* @param array|string|StreamInterface $data
87+
* @param array $files
88+
* @param array $options
89+
*
90+
* @throws \InvalidArgumentException
91+
* @throws HttpAdapterException
92+
*
93+
* @return ResponseInterface
94+
*/
95+
public function put($uri, array $headers = [], $data = [], array $files = [], array $options = []);
96+
97+
/**
98+
* Sends a PATCH request
99+
*
100+
* @param string|UriInterface $uri
101+
* @param string[] $headers
102+
* @param array|string|StreamInterface $data
103+
* @param array $files
104+
* @param array $options
105+
*
106+
* @throws \InvalidArgumentException
107+
* @throws HttpAdapterException
108+
*
109+
* @return ResponseInterface
110+
*/
111+
public function patch($uri, array $headers = [], $data = [], array $files = [], array $options = []);
112+
113+
/**
114+
* Sends a DELETE request
115+
*
116+
* @param string|UriInterface $uri
117+
* @param string[] $headers
118+
* @param array|string|StreamInterface $data
119+
* @param array $files
120+
* @param array $options
121+
*
122+
* @throws \InvalidArgumentException
123+
* @throws HttpAdapterException
124+
*
125+
* @return ResponseInterface
126+
*/
127+
public function delete($uri, array $headers = [], $data = [], array $files = [], array $options = []);
128+
129+
/**
130+
* Sends an OPTIONS request
131+
*
132+
* @param string|UriInterface $uri
133+
* @param string[] $headers
134+
* @param array|string|StreamInterface $data
135+
* @param array $files
136+
* @param array $options
137+
*
138+
* @throws \InvalidArgumentException
139+
* @throws HttpAdapterException
140+
*
141+
* @return ResponseInterface
142+
*/
143+
public function options($uri, array $headers = [], $data = [], array $files = [], array $options = []);
144+
145+
/**
146+
* Sends a request
147+
*
148+
* @param string $method
149+
* @param string|UriInterface $uri
150+
* @param string[] $headers
151+
* @param array|string|StreamInterface $data
152+
* @param array $files
153+
* @param array $options
154+
*
155+
* @throws \InvalidArgumentException
156+
* @throws HttpAdapterException
157+
*
158+
* @return ResponseInterface
159+
*/
160+
public function send($method, $uri, array $headers = [], $data = [], array $files = [], array $options = []);
161+
}

0 commit comments

Comments
 (0)