ayinkellc / otito-php-sdk

Otito PHP SDK。由swagger文件生成

dev-main 2023-06-10 13:40 UTC

This package is auto-updated.

Last update: 2024-09-10 16:20:22 UTC


README

更多信息,请访问 https://otito.dev

安装与使用

需求

PHP 7.4 及以上版本。也应适用于PHP 8.0。

Composer

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

composer require ayinkellc/otito-php

然后运行 composer install

入门

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

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



// Configure API key authorization: ApiKeyAuth
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization','sk_YOUR_API_KEY');
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new OpenAPI\Client\Api\ApplicationApi(
    // If you want use a custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

$message = new \OpenAPI\Client\Model\ServerCreateApplicationRequest("Name of Application");

try {
    $result = $apiInstance->applicationsPost($message);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ApplicationApi->applicationsPost: ', $e->getMessage(), PHP_EOL;
}