sigwin/reddit-client
Composer 安装命令:
composer require sigwin/reddit-client
包简介
Reddit.com API
README 文档
README
Reddit.com API
For more information, please visit https://ssl.reddit.com/dev/api.
Installation & Usage
Requirements
PHP 8.1 and later.
Composer
To install the bindings via Composer, add the following to composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/sigwin/reddit-client.git"
}
],
"require": {
"sigwin/reddit-client": "*@dev"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php:
<?php require_once('/path/to/RedditClient/vendor/autoload.php');
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure OAuth2 access token for authorization: oauth2 $config = Sigwin\RedditClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Sigwin\RedditClient\Api\ThingApi( // 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 ); $id = t3_11e9mr5; // string $sr_name = pics; // string try { $result = $apiInstance->getInfo($id, $sr_name); print_r($result); } catch (Exception $e) { echo 'Exception when calling ThingApi->getInfo: ', $e->getMessage(), PHP_EOL; }
API Endpoints
All URIs are relative to https://oauth.reddit.com
| Class | Method | HTTP request | Description |
|---|---|---|---|
| ThingApi | getInfo | GET /api/info | Get thing info |
| UserApi | getAbout | GET /user/{username}/about | Returns the identity of a user. |
| UserApi | getSaved | GET /user/{username}/saved | Get user saved things |
| UserApi | me | GET /api/me | Returns the identity of the current user. |
Models
Authorization
Authentication schemes defined for the API:
oauth2
- Type:
OAuth - Flow:
accessCode - Authorization URL:
/authorize - Scopes: N/A
Tests
To run the tests, use:
composer install vendor/bin/phpunit
Author
About this package
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
1.2.0- Generator version:
7.13.0-SNAPSHOT
- Generator version:
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen
统计信息
- 总下载量: 2.23k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-26