sematext/stcloud

Sematext Cloud API for PHP客户端

v0.5.0 2022-08-24 14:25 UTC

This package is auto-updated.

Last update: 2024-09-24 19:14:04 UTC


README


A Sematext Cloud API客户端,用于与Sematext Cloud解决方案的监控、警报和日志传输进行交互。


License


以下客户端家族之一


有关API的更多信息,请参阅以下链接。


内容


## 入门

以下说明将帮助您在本地机器上安装项目副本,以便进行开发和测试。

安装

要求

PHP 5.5及更高版本

Composer

要使用Composer安装绑定,请将以下内容添加到composer.json

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/sematext/sematext-api-client-php.git"
    }
  ],
  "require": {
    "/sematext/stcloud": "*@dev"
  }
}

然后运行composer install

手动安装

下载文件并包含autoload.php

    require_once('/path/to/stcloud/vendor/autoload.php');

测试

要运行单元测试

composer install
./vendor/bin/phpunit

入门

请按照安装过程进行操作,然后运行以下命令

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: api_key
$config = sematext\stcloud\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = sematext\stcloud\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new sematext\stcloud\Api\AlertNotificationsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$app_id = 789; // int | appId
$time_interval = new \sematext\stcloud\Model\AlertNotificationRequest(); // \sematext\stcloud\Model\AlertNotificationRequest | Time Interval

try {
    $result = $apiInstance->getAlertNotificationsForAppUsingPOST($app_id, $time_interval);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AlertNotificationsApi->getAlertNotificationsForAppUsingPOST: ', $e->getMessage(), PHP_EOL;
}

?>

身份验证

此客户端代码需要Sematext API访问令牌才能正常工作。您可以通过登录您的Sematext Cloud账户来找到它

版本控制

我们使用SemVer进行版本控制。有关可用的版本,请参阅此存储库的标签

许可

本项目采用Apache License v2.0许可 - 有关详细信息,请参阅LICENSE文件

致谢

此API客户端最初由swagger-codegen项目生成。

  • API版本:v3
  • 包版本:1.0.0

参考

所有URI均相对于https://

模型文档

模型文档

授权文档

api_key

  • 类型:API密钥
  • API密钥参数名:Authorization
  • 位置:HTTP头