softonic / download_api_sdk
此包已被弃用且不再维护。未建议替代包。
2.6.0
2020-12-15 17:33 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~1.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
README
带有TTL的生成下载二进制文件的URL
此PHP包由Swagger Codegen项目自动生成
- API版本:2.44.0
- 包版本:2.3.0
- 构建包:io.swagger.codegen.languages.PhpClientCodegen。更多信息请访问http://corporate.softonic.com/contact-us
要求
PHP 5.5及以上
安装 & 使用
Composer
要通过Composer安装绑定,请将以下内容添加到composer.json
{
"repositories": [
{
"type": "git",
"url": "https://github.com/softonic/download_api_sdk.git"
}
],
"require": {
"softonic/download_api_sdk": "*@dev"
}
}
然后运行composer install
手动安装
下载文件并包含autoload.php
require_once('/path/to/DownloadApiSdk/vendor/autoload.php');
测试
运行单元测试
composer install
./vendor/bin/phpunit
入门
请按照安装过程操作,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure OAuth2 access token for authorization: download_api_access_code $config = Softonic\DownloadApiSdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); // Configure OAuth2 access token for authorization: download_api_application $config = Softonic\DownloadApiSdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); // Configure OAuth2 access token for authorization: download_api_implicit $config = Softonic\DownloadApiSdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); // Configure OAuth2 access token for authorization: download_api_password $config = Softonic\DownloadApiSdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Softonic\DownloadApiSdk\Api\FilesApi( // 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_files = "id_files_example"; // string | SHA-1 hash that identifies a file $country = "country_example"; // string | The country from where the request is being done, used to sort download URL list $extra = "extra_example"; // string | Associative array of parameters serialized and encoded in base64 try { $result = $apiInstance->readFile($id_files, $country, $extra); print_r($result); } catch (Exception $e) { echo 'Exception when calling FilesApi->readFile: ', $e->getMessage(), PHP_EOL; } ?>
API端点文档
所有URI都是相对于 https://download-v2.eu-west.sftapi.com
类 | 方法 | HTTP请求 | 描述 |
---|---|---|---|
FilesApi | readFile | GET /files/{id_files} | 获取单个文件 |
FilesUrlsApi | findFileUrl | GET /files/{id_files}/urls | 文件URL列表 |
模型文档
授权文档
download_api_access_code
- 类型: OAuth
- 流程: accessCode
- 授权URL: https://oauth-v2.softonic.com/token
- 作用域:
- download_api.read.files: 读取文件
- download_api.find.files.urls: 查找文件/URL
download_api_application
- 类型: OAuth
- 流程: application
- 授权URL:
- 作用域:
- download_api.read.files: 读取文件
- download_api.find.files.urls: 查找文件/URL
download_api_implicit
- 类型: OAuth
- 流程: implicit
- 授权URL: https://oauth-v2.softonic.com/authorize
- 作用域:
- download_api.read.files: 读取文件
- download_api.find.files.urls: 查找文件/URL
download_api_password
- 类型: OAuth
- 流程: 密码
- 授权URL:
- 作用域:
- download_api.read.files: 读取文件
- download_api.find.files.urls: 查找文件/URL