bitween-software/dev-to-open-api-client

通过 API 访问 Forem 文章、用户和其他资源。查看 Forem 的实际应用示例,请访问 [DEV](https://www.dev.to)。所有不需要身份验证的端点都启用了 CORS。除非另有说明,日期和时间必须以 [RFC 3339](https://tools.i

1.0 2021-03-03 07:39 UTC

This package is auto-updated.

Last update: 2024-09-29 05:43:15 UTC


README

通过 API 访问 Forem 文章、用户和其他资源。

查看 Forem 的实际应用示例,请访问 DEV

不需要身份验证的所有端点都启用了 CORS。

除非另有说明,日期和时间必须以 RFC 3339 格式。

身份验证

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

安装 & 使用

要求

PHP 7.2 及以上。

Composer

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

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/bitween-software/dev-to-open-api-client.git"
    }
  ],
  "require": {
    "bitween-software/dev-to-open-api-client": "*@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: api_key
$config = Bitween\DevTo\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Bitween\DevTo\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');

// Configure OAuth2 access token for authorization: oauth2
$config = Bitween\DevTo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

// Configure OAuth2 access token for authorization: oauth2
$config = Bitween\DevTo\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Bitween\DevTo\Api\AdminConfigurationApi(
    // 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 {
    $result = $apiInstance->getConfig();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AdminConfigurationApi->getConfig: ', $e->getMessage(), PHP_EOL;
}

API 端点

所有 URI 都相对于 https://dev.to/api

模型

授权

api_key

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

oauth2

  • 类型: OAuth
  • 流程: application
  • 授权 URL: ``
  • 作用域: N/A

oauth2

  • 类型: OAuth
  • 流程: accessCode
  • 授权 URL: https://dev.to/oauth/authorize
  • 作用域: N/A

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

yo@dev.to

关于此包

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

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