| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- /*
- * This file is part of the overtrue/wechat.
- *
- * (c) overtrue <i@overtrue.me>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
- namespace EasyWeChat\Work\ExternalContact;
- use EasyWeChat\Kernel\BaseClient;
- /**
- * Class ContactWayClient.
- *
- * @author milkmeowo <milkmeowo@gmail.com>
- */
- class ContactWayClient extends BaseClient
- {
- /**
- * 配置客户联系「联系我」方式.
- *
- * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
- *
- * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- public function create(int $type, int $scene, array $config = [])
- {
- $params = array_merge([
- 'type' => $type,
- 'scene' => $scene,
- ], $config);
- return $this->httpPostJson('cgi-bin/externalcontact/add_contact_way', $params);
- }
- /**
- * 获取企业已配置的「联系我」方式.
- *
- * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
- *
- * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- public function get(string $configId)
- {
- return $this->httpPostJson('cgi-bin/externalcontact/get_contact_way', [
- 'config_id' => $configId,
- ]);
- }
- /**
- * 更新企业已配置的「联系我」方式.
- *
- * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
- *
- * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- public function update(string $configId, array $config = [])
- {
- $params = array_merge([
- 'config_id' => $configId,
- ], $config);
- return $this->httpPostJson('cgi-bin/externalcontact/update_contact_way', $params);
- }
- /**
- * 删除企业已配置的「联系我」方式.
- *
- * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
- *
- * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
- * @throws \GuzzleHttp\Exception\GuzzleException
- */
- public function delete(string $configId)
- {
- return $this->httpPostJson('cgi-bin/externalcontact/del_contact_way', [
- 'config_id' => $configId,
- ]);
- }
- }
|