class YfyUserClient extends YfyBaseApiClient

Class YfyUserClient

Constants

API_PREFIX

SELF_INFO_URI

USER_INFO_URI

PROFILE_PIC_DOWNLOAD_URI

UPDATE_SELF_URI

SEARCH_USER_URI

Properties

protected YfyContext $yfyContext from YfyBaseApiClient
protected YfyHttpClient $httpClient from YfyBaseApiClient
protected OAuthClient $oauthClient from YfyBaseApiClient

Methods

__construct(YfyContext $yfyContext, YfyHttpClient $httpClient, OAuthClient $oauthClient)

YfyUserClient constructor.

execute(YfyRequest $yfyRequest)

执行请求, 调用realExecute, 封装了重试的逻辑

realExecute(YfyRequest $yfyRequest)

真正执行请求的函数 会进行所有错误处理

array
getSelf()

返回用户个人信息

array
getUser(int $userId)

返回指定用户信息

downloadProfilePic(string $userId, string $profilePicKey, string $savePath = null)

下载用户头像

mixed
updateSelf(string $name)

更新用户信息

mixed
searchUser(string $queryWords = null, int $pageId)

搜索用户

Details

at line 36
__construct(YfyContext $yfyContext, YfyHttpClient $httpClient, OAuthClient $oauthClient)

YfyUserClient constructor.

Parameters

YfyContext $yfyContext
YfyHttpClient $httpClient
OAuthClient $oauthClient

in YfyBaseApiClient at line 61
protected YfyRawResponse execute(YfyRequest $yfyRequest)

执行请求, 调用realExecute, 封装了重试的逻辑

Parameters

YfyRequest $yfyRequest

Return Value

YfyRawResponse

Exceptions

YfySdkException

in YfyBaseApiClient at line 93
protected YfyRawResponse realExecute(YfyRequest $yfyRequest)

真正执行请求的函数 会进行所有错误处理

at line 47
array getSelf()

返回用户个人信息

Return Value

array

Exceptions

YfySdkException

at line 65
array getUser(int $userId)

返回指定用户信息

Parameters

int $userId 指定的用户id

Return Value

array

Exceptions

YfySdkException

at line 87
void|DownloadFile downloadProfilePic(string $userId, string $profilePicKey, string $savePath = null)

下载用户头像

Parameters

string $userId 用户id
string $profilePicKey 用户的profile pic key
string $savePath 保存路径, 可以是文件或者文件夹

Return Value

void|DownloadFile

Exceptions

YfySdkException

at line 113
mixed updateSelf(string $name)

更新用户信息

Parameters

string $name 更新的用户名

Return Value

mixed

Exceptions

YfySdkException

at line 135
mixed searchUser(string $queryWords = null, int $pageId)

搜索用户

Parameters

string $queryWords 搜索关键词
int $pageId 页码

Return Value

mixed