1 | <?php |
||
44 | class OpenPlatform |
||
45 | { |
||
46 | use PrefixedContainer; |
||
47 | |||
48 | /** |
||
49 | * Create an instance of the EasyWeChat for the given authorizer. |
||
50 | * |
||
51 | * @param string $appId Authorizer AppId |
||
52 | * @param string $refreshToken Authorizer refresh-token |
||
53 | * |
||
54 | * @return \EasyWeChat\Foundation\Application |
||
55 | */ |
||
56 | 1 | public function createAuthorizerApplication($appId, $refreshToken) |
|
57 | { |
||
58 | $this->fetch('authorizer', function ($authorizer) use ($appId, $refreshToken) { |
||
59 | 1 | $authorizer->setAppId($appId); |
|
60 | 1 | $authorizer->setRefreshToken($refreshToken); |
|
61 | 1 | }); |
|
62 | |||
63 | 1 | return $this->fetch('app', function ($app) { |
|
64 | 1 | $app['access_token'] = $this->fetch('authorizer_access_token'); |
|
65 | 1 | $app['oauth'] = $this->fetch('oauth'); |
|
66 | 1 | $app['server'] = $this->fetch('server'); |
|
67 | 1 | }); |
|
68 | } |
||
69 | |||
70 | /** |
||
71 | * Quick access to the base-api. |
||
72 | * |
||
73 | * @param string $method |
||
74 | * @param array $args |
||
75 | * |
||
76 | * @return mixed |
||
77 | */ |
||
78 | public function __call($method, $args) |
||
82 | } |
||
83 |