Completed
Pull Request — master (#1003)
by mingyoung
01:33
created

Client::deleteTemplate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 8
rs 9.4285
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\OpenPlatform\CodeTemplate;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author caikeal <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * 获取草稿箱内的所有临时代码草稿
25
     *
26
     * @return mixed
27
     */
28
    public function getDrafts()
29
    {
30
        return $this->httpGet('wxa/gettemplatedraftlist');
31
    }
32
33
    /**
34
     * 将草稿箱的草稿选为小程序代码模版.
35
     *
36
     * @param int $draftId
37
     *
38
     * @return mixed
39
     */
40
    public function addDraftToTemplate(int $draftId)
41
    {
42
        $params = [
43
            'draft_id' => $draftId,
44
        ];
45
46
        return $this->httpPostJson('wxa/addtotemplate', $params);
47
    }
48
49
    /**
50
     * 获取代码模版库中的所有小程序代码模版.
51
     *
52
     * @return mixed
53
     */
54
    public function getTemplates()
55
    {
56
        return $this->httpGet('wxa/gettemplatelist');
57
    }
58
59
    /**
60
     * 删除指定小程序代码模版.
61
     *
62
     * @param $templateId
63
     *
64
     * @return mixed
65
     */
66
    public function deleteTemplate($templateId)
67
    {
68
        $params = [
69
            'template_id' => $templateId,
70
        ];
71
72
        return $this->httpPostJson('wxa/deletetemplate', $params);
73
    }
74
}
75