Client::update()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Freyo\ApiGateway\API;
4
5
use Freyo\ApiGateway\Kernel\TencentCloudClient;
6
7
class Client extends TencentCloudClient
8
{
9
    /**
10
     * @return string
11
     */
12
    protected function getBaseUri()
13
    {
14
        return 'https://apigateway.api.qcloud.com/v2/';
15
    }
16
17
    /**
18
     * @param string $serviceId
19
     * @param array $options
20
     *
21
     * @return array|\Freyo\ApiGateway\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
22
     * @throws \Freyo\ApiGateway\Kernel\Exceptions\InvalidConfigException
23
     */
24
    public function lists($serviceId, array $options = [])
25
    {
26
        $params = [
27
            'Action'    => 'DescribeApisStatus',
28
            'serviceId' => $serviceId,
29
        ];
30
31
        return $this->httpPost('index.php', $params + $this->canonicalizeParameters($options));
32
    }
33
34
    /**
35
     * @param $apiId
36
     * @param $serviceId
37
     *
38
     * @return array|\Freyo\ApiGateway\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
39
     * @throws \Freyo\ApiGateway\Kernel\Exceptions\InvalidConfigException
40
     */
41
    public function get($apiId, $serviceId)
42
    {
43
        $params = [
44
            'Action'    => 'DescribeApi',
45
            'serviceId' => $serviceId,
46
            'apiId'     => $apiId,
47
        ];
48
49
        return $this->httpPost('index.php', $params);
50
    }
51
52
    /**
53
     * @param $apiId
54
     * @param $serviceId
55
     *
56
     * @return array|\Freyo\ApiGateway\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
57
     * @throws \Freyo\ApiGateway\Kernel\Exceptions\InvalidConfigException
58
     */
59
    public function delete($apiId, $serviceId)
60
    {
61
        $params = [
62
            'Action'    => 'DeleteApi',
63
            'serviceId' => $serviceId,
64
            'apiId'     => $apiId,
65
        ];
66
67
        return $this->httpPost('index.php', $params);
68
    }
69
70
    /**
71
     * @param $serviceId
72
     * @param $attributes
73
     *
74
     * @return array|\Freyo\ApiGateway\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
75
     * @throws \Freyo\ApiGateway\Kernel\Exceptions\InvalidConfigException
76
     */
77
    public function create($serviceId, array $attributes)
78
    {
79
        $params = [
80
            'Action'    => 'CreateApi',
81
            'serviceId' => $serviceId,
82
        ];
83
84
        return $this->httpPost('index.php', $params + $this->canonicalizeParameters($attributes));
85
    }
86
87
    /**
88
     * @param $apiId
89
     * @param $serviceId
90
     * @param $attributes
91
     *
92
     * @return array|\Freyo\ApiGateway\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
93
     * @throws \Freyo\ApiGateway\Kernel\Exceptions\InvalidConfigException
94
     */
95
    public function update($apiId, $serviceId, array $attributes)
96
    {
97
        $params = [
98
            'Action'    => 'ModifyApi',
99
            'serviceId' => $serviceId,
100
            'apiId'     => $apiId,
101
        ];
102
103
        return $this->httpPost('index.php', $params + $this->canonicalizeParameters($attributes));
104
    }
105
}