lexiandev/azuracast-php-api-client

AzuraCast 是一款独立、一键式网络广播管理工具。由 AzuraCast 托管的电台公开了一个 API,用于查看正在播放的数据、发送请求等。

2.0.1 2024-08-22 18:09 UTC

This package is auto-updated.

Last update: 2024-09-22 18:15:57 UTC


README

AzuraCast 是一款独立、一键式网络广播管理工具。由 AzuraCast 托管的电台公开了一个 API,用于查看正在播放的数据、发送请求等。

安装与使用

需求

PHP 7.4 及以上版本。也应该与 PHP 8.0 兼容。

Composer

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

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

然后运行 composer install

手动安装

下载文件并包含 autoload.php

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

入门

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

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



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


$apiInstance = new AzuraCast\Api\AdministrationCPUStatsApi(
    // 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
);

try {
    $apiInstance->getServerStats();
} catch (Exception $e) {
    echo 'Exception when calling AdministrationCPUStatsApi->getServerStats: ', $e->getMessage(), PHP_EOL;
}

API 端点

所有 URI 都相对于 https://demo.azuracast.com/api

模型

授权

API 定义的认证方案

ApiKey

  • 类型: API 密钥
  • API 密钥参数名: X-API-Key
  • 位置: HTTP 头部

测试

要运行测试,使用

composer install
vendor/bin/phpunit

作者

关于此包

此 PHP 包是由 OpenAPI Generator 项目自动生成的

  • API 版本: 0.20.2
    • 包版本: 2.0.1
    • 生成器版本: 7.8.0-SNAPSHOT
  • 构建包: org.openapitools.codegen.languages.PhpClientCodegen