承接 socioevents/webex-events-php-sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

socioevents/webex-events-php-sdk

最新稳定版本:v1.0.0

Composer 安装命令:

composer require socioevents/webex-events-php-sdk

包简介

webex events php sdk Check https://github.com/SocioEvents/webex-events-php-sdk for more info.

README 文档

README

License: MIT Webex Events

Webex EVENTS

Webex Events Api Php SDK

Webex Events provides a range of additional SDKs to accelerate your development process. They allow a standardized way for developers to interact with and leverage the features and functionalities. Pre-built code modules will help access the APIs with your private keys, simplifying data gathering and update flows.

Requirements

  • PHP ^8.1

Installation

Via command line:

composer require socioevents/webex-events-php-sdk

Configuration

    Configuration::setAccessToken('access token');
    Configuration::setLogger($logger); // implement your logger via LoggerInterface, default is off
    Configuration::setMaxRetries(3); //optional default 3
    Configuration::setReadTimeoutSeconds(30); //optional default 30 sec
    Configuration::setConnectTimeoutSeconds(10); //optional default 10 sec

Usage

  $query = 'query EventsConnection($first: Int) {
          eventsConnection(first: $first){
              edges{
                  cursor
                  node{
                      id
                      name
                  }
              }
          }
      }';
    $variables = ["first" => 100];
    $requestOptions = new RequestOptions(Helpers::generateUUID());
    
    $response = Client::query($query, 'eventsConnection', $variables, $requestOptions );
    $data = $response->getJsonResponseBody()['data'];
    

If the request is successful, WebexEvents\Client.query will return WebexEvents\Response object which has the following methods.

Method Type
httpStatusCode int
responseHeaders array
jsonResponseBody ?array (lazy loaded)
responseBodyString string
requestHeaders array
requestBody array
url string
retryCount int
$timeSpendInMs int
rateLimiter WebexEvents\RateLimiter

For non 200 status codes, an exception is raised for every status code such as WebexEvents\Errors\ServerError for server errors. For the flow-control these exceptions should be handled like the following. This is an example for 429 status code. For the full list please refer to this file.

try {
    $response = Client::query($query, $operationName, $variables, $requestOptions);
}
catch (DailyQuotaIsReachedError $e) {
    // do someteging here
}
catch (SecondBasedQuotaIsReachedError $e){
    $sleepTime = $e->getResponse()->getRateLimiter()->getSecondlyRetryAfterInMs();
    usleep($sleepTime * 1000);
    // do retry
}

By default, Webex::Client.query has retry policy under the hood. It retries the request for the following exceptions according to the Configuration::getMaxRetries().

WebexEvents\Errors\RequestTimeoutError => 408
WebexEvents\Errors\ConflictError => 409
WebexEvents\Errors\SecondBasedQuotaIsReachedError => 429
WebexEvents\Errors\BadGatewayError => 502
WebexEvents\Errors\ServiceUnavailableError => 503
WebexEvents\Errors\GatewayTimeoutError => 504

For Introspection

WebexEvents\Client.doIntrospectionQuery()

Idempotency

The API supports idempotency for safely retrying requests without accidentally performing the same operation twice. When doing a mutation request, use an idempotency key. If a connection error occurs, you can repeat the request without risk of creating a second object or performing the update twice.

To perform mutation request, you must add a header which contains the idempotency key such as Idempotency-Key: <your key>. The SDK does not produce an Idempotency Key on behalf of you if it is missed. Here is an example like the following:

    $mutation = 'mutation ComponentCreate($input: ComponentCreateInput!) {
                  componentCreate(input: $input) {
                    eventId
                    featureTypeId
                    id
                    name
                  } }';
    
    $mutationVariables = [
        "input" => [
            "eventId" => 1,
            "featureTypeId" => 6,
            "name" => "Speakers",
            "pictureUrl"=>'https://webexevents.com/media_test.jpeg',
            "settings" => [
                "displayMethod" => "GRID",
                "isHidden" => false
            ]
        ]
    ];
    
    try
    {
        $response = Client::query(
            $mutation,
            'ComponentCreate',
            $mutationVariables,
            new RequestOptions(Helpers::generateUUID())
        );    
    }
    catch (ConflictError $e)
    {
        // Conflict errors will be retried, but to guarantee it you can handle the exception again.
        usleep(20000);
        // do retry
    }

Telemetry Data Collection

Webex Events collects telemetry data, including hostname, operating system, language and SDK version, via API requests. This information allows us to improve our services and track any usage-related faults/issues. We handle all data with the utmost respect for your privacy. For more details, please refer to the Privacy Policy at https://www.cisco.com/c/en/us/about/legal/privacy-full.html

Development

After checking out the repo, composer install install dependencies. Then, run ./vendor/bin/phpunit tests to run the tests.

Contributing

Please see the contributing guidelines.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Webex Events API project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

统计信息

  • 总下载量: 41
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 6
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固