Passed
Push — master ( 3c6de2...47f1c0 )
by Carlos
06:28
created

Client::getShareQrcode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the overtrue/wechat.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace EasyWeChat\MiniProgram\Broadcast;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author Abbotton <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * Add broadcast goods.
25
     *
26
     * @param array $goodsInfo
27
     *
28
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
29
     *
30
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
31
     * @throws \GuzzleHttp\Exception\GuzzleException
32
     */
33 1
    public function create(array $goodsInfo)
34
    {
35
        $params = [
36 1
            'goodsInfo' => $goodsInfo,
37
        ];
38
39 1
        return $this->httpPostJson('wxaapi/broadcast/goods/add', $params);
40
    }
41
42
    /**
43
     * Reset audit.
44
     *
45
     * @param int $auditId
46
     * @param int $goodsId
47
     *
48
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
49
     *
50
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
51
     * @throws \GuzzleHttp\Exception\GuzzleException
52
     */
53 1
    public function resetAudit(int $auditId, int $goodsId)
54
    {
55
        $params = [
56 1
            'auditId' => $auditId,
57 1
            'goodsId' => $goodsId,
58
        ];
59
60 1
        return $this->httpPostJson('wxaapi/broadcast/goods/resetaudit', $params);
61
    }
62
63
    /**
64
     * Resubmit audit goods.
65
     *
66
     * @param int $goodsId
67
     *
68
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
69
     *
70
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
71
     * @throws \GuzzleHttp\Exception\GuzzleException
72
     */
73 1
    public function resubmitAudit(int $goodsId)
74
    {
75
        $params = [
76 1
            'goodsId' => $goodsId,
77
        ];
78
79 1
        return $this->httpPostJson('wxaapi/broadcast/goods/audit', $params);
80
    }
81
82
    /**
83
     * Delete broadcast goods.
84
     *
85
     * @param int $goodsId
86
     *
87
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
88
     *
89
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
90
     * @throws \GuzzleHttp\Exception\GuzzleException
91
     */
92 1
    public function delete(int $goodsId)
93
    {
94
        $params = [
95 1
            'goodsId' => $goodsId,
96
        ];
97
98 1
        return $this->httpPostJson('wxaapi/broadcast/goods/delete', $params);
99
    }
100
101
    /**
102
     * Update goods info.
103
     *
104
     * @param array $goodsInfo
105
     *
106
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
107
     *
108
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
109
     * @throws \GuzzleHttp\Exception\GuzzleException
110
     */
111 1
    public function update(array $goodsInfo)
112
    {
113
        $params = [
114 1
            'goodsInfo' => $goodsInfo,
115
        ];
116
117 1
        return $this->httpPostJson('wxaapi/broadcast/goods/update', $params);
118
    }
119
120
    /**
121
     * Get goods information and review status.
122
     *
123
     * @param array $goodsIdArray
124
     *
125
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
126
     *
127
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
128
     * @throws \GuzzleHttp\Exception\GuzzleException
129
     */
130 1
    public function getGoodsWarehouse(array $goodsIdArray)
131
    {
132
        $params = [
133 1
            'goods_ids' => $goodsIdArray,
134
        ];
135
136 1
        return $this->httpPostJson('wxa/business/getgoodswarehouse', $params);
137
    }
138
139
    /**
140
     * Get goods list based on status
141
     *
142
     * @param  array  $params
143
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
144
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
145
     * @throws \GuzzleHttp\Exception\GuzzleException
146
     */
147 1
    public function getApproved(array $params)
148
    {
149 1
        return $this->httpGet('wxaapi/broadcast/goods/getapproved', $params);
150
    }
151
152
    /**
153
     * Add goods to the designated live room.
154
     *
155
     * @param  array  $params
156
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
157
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
158
     * @throws \GuzzleHttp\Exception\GuzzleException
159
     */
160 1
    public function addGoods(array $params)
161
    {
162 1
        return $this->httpPost('wxaapi/broadcast/room/addgoods', $params);
163
    }
164
165
    /**
166
     * Get Room List.
167
     *
168
     * @param  int  $start
169
     * @param  int  $limit
170
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
171
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
172
     * @throws \GuzzleHttp\Exception\GuzzleException
173
     * @author onekb <[email protected]>
174
     */
175
    public function getRooms(int $start = 0, int $limit = 10)
176
    {
177
        $params = [
178
            'start' => $start,
179
            'limit' => $limit,
180
        ];
181
182
        return $this->httpPostJson('wxa/business/getliveinfo', $params);
183
    }
184
185
    /**
186
     * Get Playback List.
187
     *
188
     * @param  int  $roomId
189
     * @param  int  $start
190
     * @param  int  $limit
191
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
192
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
193
     * @throws \GuzzleHttp\Exception\GuzzleException
194
     * @author onekb <[email protected]>
195
     */
196 1
    public function getPlaybacks(int $roomId, int $start = 0, int $limit = 10)
197
    {
198
        $params = [
199 1
            'action' => 'get_replay',
200 1
            'room_id' => $roomId,
201 1
            'start' => $start,
202 1
            'limit' => $limit,
203
        ];
204
205 1
        return $this->httpPostJson('wxa/business/getliveinfo', $params);
206
    }
207
208
    /**
209
     * Create a live room.
210
     *
211
     * @param  array  $params
212
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
213
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
214
     * @throws \GuzzleHttp\Exception\GuzzleException
215
     */
216 1
    public function createLiveRoom(array $params)
217
    {
218 1
        return $this->httpPost('wxaapi/broadcast/room/create', $params);
219
    }
220
221
    /**
222
     * Delete a live room.
223
     *
224
     * @param array $params
225
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
226
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
227
     */
228 1
    public function deleteLiveRoom(array $params)
229
    {
230 1
        return $this->httpPost('wxaapi/broadcast/room/deleteroom', $params);
231
    }
232
233
    /**
234
     * Update a live room.
235
     *
236
     * @param array $params
237
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
238
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
239
     */
240 1
    public function updateLiveRoom(array $params)
241
    {
242 1
        return $this->httpPost('wxaapi/broadcast/room/editroom', $params);
243
    }
244
245
    /**
246
     * Gets the live room push stream url.
247
     *
248
     * @param array $params
249
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
250
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
251
     */
252 1
    public function getPushUrl(array $params)
253
    {
254 1
        return $this->httpGet('wxaapi/broadcast/room/getpushurl', $params);
255
    }
256
257
    /**
258
     * Gets the live room share qrcode.
259
     *
260
     * @param array $params
261
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
262
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
263
     */
264 1
    public function getShareQrcode(array $params)
265
    {
266 1
        return $this->httpGet('wxaapi/broadcast/room/getsharedcode', $params);
267
    }
268
269
    /**
270
     * Add a live room assistant.
271
     *
272
     * @param array $params
273
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
274
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
275
     */
276 1
    public function addAssistant(array $params)
277
    {
278 1
        return $this->httpPost('wxaapi/broadcast/room/addassistant', $params);
279
    }
280
281
    /**
282
     * Update a live room assistant.
283
     *
284
     * @param array $params
285
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
286
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
287
     */
288 1
    public function updateAssistant(array $params)
289
    {
290 1
        return $this->httpPost('wxaapi/broadcast/room/modifyassistant', $params);
291
    }
292
293
    /**
294
     * Delete a live room assistant.
295
     *
296
     * @param array $params
297
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
298
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
299
     */
300 1
    public function deleteAssistant(array $params)
301
    {
302 1
        return $this->httpPost('wxaapi/broadcast/room/removeassistant', $params);
303
    }
304
305
    /**
306
     * Gets the assistant list.
307
     *
308
     * @param array $params
309
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
310
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
311
     */
312 1
    public function getAssistantList(array $params)
313
    {
314 1
        return $this->httpGet('wxaapi/broadcast/room/getassistantlist', $params);
315
    }
316
317
    /**
318
     * Add the sub anchor.
319
     *
320
     * @param array $params
321
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
322
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
323
     */
324 1
    public function addSubAnchor(array $params)
325
    {
326 1
        return $this->httpPost('wxaapi/broadcast/room/addsubanchor', $params);
327
    }
328
329
    /**
330
     * Update the sub anchor.
331
     *
332
     * @param array $params
333
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
334
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
335
     */
336 1
    public function updateSubAnchor(array $params)
337
    {
338 1
        return $this->httpPost('wxaapi/broadcast/room/modifysubanchor', $params);
339
    }
340
341
    /**
342
     * Delete the sub anchor.
343
     *
344
     * @param array $params
345
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
346
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
347
     */
348 1
    public function deleteSubAnchor(array $params)
349
    {
350 1
        return $this->httpPost('wxaapi/broadcast/room/deletesubanchor', $params);
351
    }
352
353
    /**
354
     * Gets the sub anchor info.
355
     *
356
     * @param array $params
357
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
358
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
359
     */
360 1
    public function getSubAnchor(array $params)
361
    {
362 1
        return $this->httpGet('wxaapi/broadcast/room/getsubanchor', $params);
363
    }
364
365
    /**
366
     * Turn official index on/off.
367
     *
368
     * @param array $params
369
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
370
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
371
     */
372 1
    public function updateFeedPublic(array $params)
373
    {
374 1
        return $this->httpPost('wxaapi/broadcast/room/updatefeedpublic', $params);
375
    }
376
377
    /**
378
     * Turn playback status on/off.
379
     *
380
     * @param array $params
381
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
382
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
383
     */
384 1
    public function updateReplay(array $params)
385
    {
386 1
        return $this->httpPost('wxaapi/broadcast/room/updatereplay', $params);
387
    }
388
389
    /**
390
     * Turn customer service status on/off.
391
     *
392
     * @param array $params
393
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
394
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
395
     */
396 1
    public function updateKf(array $params)
397
    {
398 1
        return $this->httpPost('wxaapi/broadcast/room/updatekf', $params);
399
    }
400
401
    /**
402
     * Turn global comments status on/off.
403
     *
404
     * @param array $params
405
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
406
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
407
     */
408 1
    public function updateComment(array $params)
409
    {
410 1
        return $this->httpPost('wxaapi/broadcast/room/updatecomment', $params);
411
    }
412
413
    /**
414
     * Add member role.
415
     *
416
     * @param array $params
417
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
418
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
419
     */
420 1
    public function addRole(array $params)
421
    {
422 1
        return $this->httpPost('wxaapi/broadcast/role/addrole', $params);
423
    }
424
425
    /**
426
     * Delete member role.
427
     *
428
     * @param array $params
429
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
430
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
431
     */
432 1
    public function deleteRole(array $params)
433
    {
434 1
        return $this->httpPost('wxaapi/broadcast/role/deleterole', $params);
435
    }
436
437
    /**
438
     * Gets the role list.
439
     *
440
     * @param array $params
441
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
442
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
443
     */
444 1
    public function getRoleList(array $params)
445
    {
446 1
        return $this->httpGet('wxaapi/broadcast/role/getrolelist', $params);
447
    }
448
}
449