1 | <?php |
||
24 | class BaseClient |
||
25 | { |
||
26 | use HasHttpRequests { request as performRequest; } |
||
27 | |||
28 | /** |
||
29 | * @var \EasyWeChat\Payment\Application |
||
30 | */ |
||
31 | protected $app; |
||
32 | |||
33 | /** |
||
34 | * Constructor. |
||
35 | * |
||
36 | * @param \EasyWeChat\Payment\Application $app |
||
37 | */ |
||
38 | public function __construct(Application $app) |
||
44 | |||
45 | /** |
||
46 | * Extra request params. |
||
47 | * |
||
48 | * @return array |
||
49 | */ |
||
50 | protected function prepends() |
||
54 | |||
55 | /** |
||
56 | * Make a API request. |
||
57 | * |
||
58 | * @param string $endpoint |
||
59 | * @param array $params |
||
60 | * @param string $method |
||
61 | * @param array $options |
||
62 | * @param bool $returnResponse |
||
63 | * |
||
64 | * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
||
65 | */ |
||
66 | protected function request(string $endpoint, array $params = [], $method = 'post', array $options = [], $returnResponse = false) |
||
88 | |||
89 | /** |
||
90 | * Make a request and return raw response. |
||
91 | * |
||
92 | * @param string $endpoint |
||
93 | * @param array $params |
||
94 | * @param string $method |
||
95 | * @param array $options |
||
96 | * |
||
97 | * @return array|Support\Collection|object|ResponseInterface|string |
||
98 | */ |
||
99 | protected function requestRaw($endpoint, array $params = [], $method = 'post', array $options = []) |
||
103 | |||
104 | /** |
||
105 | * Request with SSL. |
||
106 | * |
||
107 | * @param string $endpoint |
||
108 | * @param array $params |
||
109 | * @param string $method |
||
110 | * @param array $options |
||
111 | * |
||
112 | * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
||
113 | */ |
||
114 | protected function safeRequest($endpoint, array $params, $method = 'post', array $options = []) |
||
123 | |||
124 | /** |
||
125 | * Wrapping an API endpoint. |
||
126 | * |
||
127 | * @param string $endpoint |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | protected function wrap(string $endpoint): string |
||
135 | } |
||
136 |