1 | <?php |
||
26 | class BaseClient |
||
27 | { |
||
28 | use HasHttpRequests { request as performRequest; } |
||
29 | |||
30 | /** |
||
31 | * @var \EasyWeChat\Payment\Application |
||
32 | */ |
||
33 | protected $app; |
||
34 | |||
35 | /** |
||
36 | * Constructor. |
||
37 | * |
||
38 | * @param \EasyWeChat\Payment\Application $app |
||
39 | */ |
||
40 | public function __construct(Application $app) |
||
53 | |||
54 | /** |
||
55 | * Extra request params. |
||
56 | * |
||
57 | * @return array |
||
58 | */ |
||
59 | protected function prepends() |
||
63 | |||
64 | /** |
||
65 | * Make a API request. |
||
66 | * |
||
67 | * @param string $endpoint |
||
68 | * @param array $params |
||
69 | * @param string $method |
||
70 | * @param array $options |
||
71 | * @param bool $returnResponse |
||
72 | * |
||
73 | * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
||
74 | */ |
||
75 | protected function request(string $endpoint, array $params = [], $method = 'post', array $options = [], $returnResponse = false) |
||
97 | |||
98 | /** |
||
99 | * Make a request and return raw response. |
||
100 | * |
||
101 | * @param string $endpoint |
||
102 | * @param array $params |
||
103 | * @param string $method |
||
104 | * @param array $options |
||
105 | * |
||
106 | * @return array|Support\Collection|object|ResponseInterface|string |
||
107 | */ |
||
108 | protected function requestRaw($endpoint, array $params = [], $method = 'post', array $options = []) |
||
112 | |||
113 | /** |
||
114 | * Request with SSL. |
||
115 | * |
||
116 | * @param string $endpoint |
||
117 | * @param array $params |
||
118 | * @param string $method |
||
119 | * |
||
120 | * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
||
121 | */ |
||
122 | protected function safeRequest($endpoint, array $params, $method = 'post') |
||
131 | |||
132 | /** |
||
133 | * @param string $endpoint |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | protected function getKey(string $endpoint) |
||
145 | } |
||
146 |