Application.php 3.4 KB

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