Properties

$baseUri

$baseUri : 

Type

$httpClient

$httpClient : \GuzzleHttp\ClientInterface

Type

\GuzzleHttp\ClientInterface

$middlewares

$middlewares : array

Type

array

$handlerStack

$handlerStack : \GuzzleHttp\HandlerStack

Type

\GuzzleHttp\HandlerStack

$defaults

$defaults : array

Type

array

Methods

httpGet()

httpGet(string  $url, array  $query = array()) : \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string

GET request.

Parameters

string $url
array $query

Throws

\EasyWeChat\Kernel\Exceptions\InvalidConfigException

Returns

\Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string

httpPost()

httpPost(string  $url, array  $data = array()) : \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string

POST request.

Parameters

string $url
array $data

Throws

\EasyWeChat\Kernel\Exceptions\InvalidConfigException

Returns

\Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string

httpPostJson()

httpPostJson(string  $url, string|array  $data = array(), array  $query = array()) : \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string

JSON request.

Parameters

string $url
string|array $data
array $query

Throws

\EasyWeChat\Kernel\Exceptions\InvalidConfigException

Returns

\Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string

httpUpload()

httpUpload(string  $url, array  $files = array(), array  $form = array(), array  $query = array()) : \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string

Upload file.

Parameters

string $url
array $files
array $form
array $query

Throws

\EasyWeChat\Kernel\Exceptions\InvalidConfigException

Returns

\Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string

request()

request(string  $url, string  $method = 'GET', array  $options = array()) : \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string

Make a request.

Parameters

string $url
string $method
array $options

Returns

\Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string

requestRaw()

requestRaw(string  $url, string  $method = 'GET', array  $options = array()) : \EasyWeChat\Kernel\Http\Response

Parameters

string $url
string $method
array $options

Throws

\EasyWeChat\Kernel\Exceptions\InvalidConfigException

Returns

\EasyWeChat\Kernel\Http\Response

getHttpClient()

getHttpClient() : \GuzzleHttp\ClientInterface

Return GuzzleHttp\ClientInterface instance.

Returns

\GuzzleHttp\ClientInterface

setDefaultOptions()

setDefaultOptions(array  $defaults = array()) 

Set guzzle default settings.

Parameters

array $defaults

getDefaultOptions()

getDefaultOptions() : array

Return current guzzle default settings.

Returns

array

setHttpClient()

setHttpClient(\GuzzleHttp\ClientInterface  $httpClient) : $this

Set GuzzleHttp\Client.

Parameters

\GuzzleHttp\ClientInterface $httpClient

Returns

$this

pushMiddleware()

pushMiddleware(callable  $middleware, null|string  $name = null) : $this

Add a middleware.

Parameters

callable $middleware
null|string $name

Returns

$this

getMiddlewares()

getMiddlewares() : array

Return all middlewares.

Returns

array

setHandlerStack()

setHandlerStack(\GuzzleHttp\HandlerStack  $handlerStack) : $this

Parameters

\GuzzleHttp\HandlerStack $handlerStack

Returns

$this

getHandlerStack()

getHandlerStack() : \GuzzleHttp\HandlerStack

Build a handler stack.

Returns

\GuzzleHttp\HandlerStack

getLoginUrl()

getLoginUrl(string  $redirectUri = '', string  $userType = 'admin', string  $state = '') : string

单点登录 - 获取登录的地址.

Parameters

string $redirectUri
string $userType
string $state

Returns

string

getLoginInfo()

getLoginInfo(string  $authCode) : array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string

单点登录 - 获取登录用户信息.

Parameters

string $authCode

Throws

\EasyWeChat\Kernel\Exceptions\InvalidConfigException

Returns

array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string

getRegisterUri()

getRegisterUri(string  $registerCode = '') : string

获取注册定制化URL.

Parameters

string $registerCode

Throws

\EasyWeChat\Kernel\Exceptions\InvalidConfigException

Returns

string

getRegisterCode()

getRegisterCode(string  $corpName = '', string  $adminName = '', string  $adminMobile = '', string  $state = '') : array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string

获取注册码.

Parameters

string $corpName
string $adminName
string $adminMobile
string $state

Throws

\EasyWeChat\Kernel\Exceptions\InvalidConfigException

Returns

array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string

getRegisterInfo()

getRegisterInfo(string  $registerCode) : array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string

查询注册状态.

Desc:该API用于查询企业注册状态,企业注册成功返回注册信息.

Parameters

string $registerCode

Throws

\EasyWeChat\Kernel\Exceptions\InvalidConfigException

Returns

array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string

setAgentScope()

setAgentScope(string  $accessToken, string  $agentId, array  $allowUser = array(), array  $allowParty = array(), array  $allowTag = array()) : array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string

设置授权应用可见范围.

Desc:调用该接口前提是开启通讯录迁移,收到授权成功通知后可调用。 企业注册初始化安装应用后,应用默认可见范围为根部门。 如需修改应用可见范围,服务商可以调用该接口设置授权应用的可见范围。 该接口只能使用注册完成回调事件或者查询注册状态返回的access_token。 调用设置通讯录同步完成后或者access_token超过30分钟失效(即解除通讯录锁定状态)则不能继续调用该接口。

Parameters

string $accessToken
string $agentId
array $allowUser
array $allowParty
array $allowTag

Throws

\EasyWeChat\Kernel\Exceptions\InvalidConfigException

Returns

array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string

contactSyncSuccess()

contactSyncSuccess(  $accessToken) : array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string

设置通讯录同步完成.

Desc:该API用于设置通讯录同步完成,解除通讯录锁定状态,同时使通讯录迁移access_token失效。

Parameters

$accessToken

Throws

\EasyWeChat\Kernel\Exceptions\InvalidConfigException

Returns

array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string

registerHttpMiddlewares()

registerHttpMiddlewares() 

Register Guzzle middlewares.

accessTokenMiddleware()

accessTokenMiddleware() : \Closure

Attache access token to request query.

Returns

\Closure

logMiddleware()

logMiddleware() : \Closure

Log the request.

Returns

\Closure

retryMiddleware()

retryMiddleware() : \Closure

Return retry middleware.

Returns

\Closure

fixJsonIssue()

fixJsonIssue(array  $options) : array

Parameters

array $options

Returns

array