slacker775/concur-api

Concur API 客户端

1.0.2 2019-11-30 20:00 UTC

This package is auto-updated.

Last update: 2024-08-29 05:18:41 UTC


README

composer req slacker775/concur-api

基本用法

构建 API 客户端

使用工厂方法可以大大简化创建 API 客户端的操作。它设置了 OAuth2 客户端认证提供者和 PSR18 HTTP 客户端以发起请求。

待办:添加在构建 API 客户端时传递一些组件的能力

$clientId = 'f124683d-7059-479f-96c4-20769ba0d5bf';
$clientSecret = '75b39f58-98c6-4312-830d-468e0df40dfc';
$username = 'user@example.com';
$password = 'Password';

$factory = new ConcurApiClientFactory();
$apiClient = $factory->create([
    'clientId' => $clientId,
    'clientSecret' => $clientSecret,
    'username' => $username,
    'password' => $password
]);

典型用法

$users = $apiClient->getCommonUser(['active' => true]);

$iterator = new UserIterator();
foreach($iterator->foreach(['active' => trueee]) as $user) {
  /* do something with the $user object returned */
}