Completed
Pull Request — master (#1003)
by Keal
01:38
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
 * Created by PhpStorm.
4
 * User: keal
5
 * Date: 2017/11/3
6
 * Time: 下午2:56
7
 */
8
9
namespace EasyWeChat\OpenPlatform\CodeTemplate;
10
11
use EasyWeChat\Kernel\BaseClient;
12
13
/**
14
 * Class Client
15
 *
16
 * @author caikeal <[email protected]>
17
 */
18
class Client extends BaseClient
19
{
20
    /**
21
     * 获取草稿箱内的所有临时代码草稿
22
     * 
23
     * @return mixed
24
     */
25
    public function getDrafts()
26
    {
27
        return $this->httpGet('wxa/gettemplatedraftlist');
28
    }
29
30
    /**
31
     * 将草稿箱的草稿选为小程序代码模版
32
     *
33
     * @param int $draftId
34
     * @return mixed
35
     */
36
    public function addDraftToTemplate(int $draftId)
37
    {
38
        $params = [
39
            'draft_id' => $draftId
40
        ];
41
42
        return $this->httpPostJson('wxa/addtotemplate', $params);
43
    }
44
45
    /**
46
     * 获取代码模版库中的所有小程序代码模版
47
     *
48
     * @return mixed
49
     */
50
    public function getTemplates()
51
    {
52
        return $this->httpGet('wxa/gettemplatelist');
53
    }
54
55
    /**
56
     * 删除指定小程序代码模版
57
     *
58
     * @param $templateId
59
     * @return mixed
60
     */
61
    public function deleteTemplate($templateId)
62
    {
63
        $params = [
64
            'template_id' => $templateId
65
        ];
66
67
        return $this->httpPostJson('wxa/deletetemplate', $params);
68
    }
69
}