zhaojs
2023-07-17 e4cdea85521eca918fa4a09826707ae10e3cfb2f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?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;
 
use EasyWeChat\Kernel\ServiceContainer;
use EasyWeChat\Work\MiniProgram\Application as MiniProgram;
 
/**
 * Application.
 *
 * @author mingyoung <mingyoungcheung@gmail.com>
 *
 * @property \EasyWeChat\Work\OA\Client                        $oa
 * @property \EasyWeChat\Work\Auth\AccessToken                 $access_token
 * @property \EasyWeChat\Work\Agent\Client                     $agent
 * @property \EasyWeChat\Work\Department\Client                $department
 * @property \EasyWeChat\Work\Media\Client                     $media
 * @property \EasyWeChat\Work\Menu\Client                      $menu
 * @property \EasyWeChat\Work\Message\Client                   $message
 * @property \EasyWeChat\Work\Message\Messenger                $messenger
 * @property \EasyWeChat\Work\User\Client                      $user
 * @property \EasyWeChat\Work\User\TagClient                   $tag
 * @property \EasyWeChat\Work\Server\ServiceProvider           $server
 * @property \EasyWeChat\Work\Jssdk\Client                     $jssdk
 * @property \Overtrue\Socialite\Providers\WeWorkProvider      $oauth
 * @property \EasyWeChat\Work\Invoice\Client                   $invoice
 * @property \EasyWeChat\Work\Chat\Client                      $chat
 * @property \EasyWeChat\Work\ExternalContact\Client           $external_contact
 * @property \EasyWeChat\Work\ExternalContact\ContactWayClient $contact_way
 * @property \EasyWeChat\Work\ExternalContact\StatisticsClient $external_contact_statistics
 * @property \EasyWeChat\Work\ExternalContact\MessageClient    $external_contact_message
 * @property \EasyWeChat\Work\GroupRobot\Client                $group_robot
 * @property \EasyWeChat\Work\GroupRobot\Messenger             $group_robot_messenger
 *
 * @method mixed getCallbackIp()
 */
class Application extends ServiceContainer
{
    /**
     * @var array
     */
    protected $providers = [
        OA\ServiceProvider::class,
        Auth\ServiceProvider::class,
        Base\ServiceProvider::class,
        Menu\ServiceProvider::class,
        OAuth\ServiceProvider::class,
        User\ServiceProvider::class,
        Agent\ServiceProvider::class,
        Media\ServiceProvider::class,
        Message\ServiceProvider::class,
        Department\ServiceProvider::class,
        Server\ServiceProvider::class,
        Jssdk\ServiceProvider::class,
        Invoice\ServiceProvider::class,
        Chat\ServiceProvider::class,
        ExternalContact\ServiceProvider::class,
        GroupRobot\ServiceProvider::class,
    ];
 
    /**
     * @var array
     */
    protected $defaultConfig = [
        // http://docs.guzzlephp.org/en/stable/request-options.html
        'http' => [
            'base_uri' => 'https://qyapi.weixin.qq.com/',
        ],
    ];
 
    /**
     * Creates the miniProgram application.
     *
     * @return \EasyWeChat\Work\MiniProgram\Application
     */
    public function miniProgram(): MiniProgram
    {
        return new MiniProgram($this->getConfig());
    }
 
    /**
     * @param string $method
     * @param array  $arguments
     *
     * @return mixed
     */
    public function __call($method, $arguments)
    {
        return $this['base']->$method(...$arguments);
    }
}