tba-api/tba-api-client-php

# 概述 FIRST Robotics Competition 团队和活动的信息和统计数据。 # 认证 所有端点都需要在头文件 `X-TBA-Auth-Key` 中传递一个 Auth Key。如果您还没有 Auth Key,可以从您的 [账户页面](/account) 获取。可能需要设置 User-Agent 头来防止出现 403 未授权错误。

v3.8.0 2020-03-10 02:37 UTC

This package is auto-updated.

Last update: 2024-09-05 03:34:41 UTC


README

概述

关于 FIRST Robotics Competition 团队和活动的信息和统计数据。

认证

所有端点都需要在头文件 X-TBA-Auth-Key 中传递一个 Auth Key。如果您还没有 Auth Key,可以从您的 账户页面 获取。

可能需要设置 User-Agent 头来防止出现 403 未授权错误。

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

  • API 版本:3.8.0
  • 构建包:org.openapitools.codegen.languages.PhpClientCodegen

要求

PHP 7.3 及更高版本

安装和用法

Composer

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

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

然后运行 composer install

手动安装

下载文件并包含 autoload.php

    require_once('/path/to/TBA-API-v3client/vendor/autoload.php');

测试

要运行单元测试

composer install
./vendor/bin/phpunit

入门

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

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



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


$apiInstance = new TBAAPI\v3client\Api\DistrictApi(
    // 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
);
$district_key = 'district_key_example'; // string | TBA District Key, eg `2016fim`
$if_modified_since = 'if_modified_since_example'; // string | Value of the `Last-Modified` header in the most recently cached response by the client.

try {
    $result = $apiInstance->getDistrictEvents($district_key, $if_modified_since);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DistrictApi->getDistrictEvents: ', $e->getMessage(), PHP_EOL;
}

?>

API 端点文档

所有 URI 都相对于 https://www.thebluealliance.com/api/v3

模型文档

授权文档

apiKey

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

作者