diff --git a/vendor/qcloud/cos-sdk-v5/.github/workflows/format.yml b/vendor/qcloud/cos-sdk-v5/.github/workflows/format.yml new file mode 100644 index 0000000..c1dced7 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/.github/workflows/format.yml @@ -0,0 +1,37 @@ +name: format + +on: + push: + pull_request: + +jobs: + format: + name: Format Code + runs-on: "${{ matrix.os }}" + strategy: + matrix: + os: [ubuntu-latest] + php-version: ['8.0'] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: none + + - name: Setup Dependencies + run: + composer install -o + + - name: Run + run: | + php bin/format + php bin/release + + - name: Commit Updated + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Format code diff --git a/vendor/qcloud/cos-sdk-v5/.github/workflows/install.yml b/vendor/qcloud/cos-sdk-v5/.github/workflows/install.yml new file mode 100644 index 0000000..6eb3a6f --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/.github/workflows/install.yml @@ -0,0 +1,29 @@ +name: Support Multiple Versions + +on: + push: + pull_request: + +jobs: + install: + name: PHP${{ matrix.php-version }} Test Install + runs-on: "${{ matrix.os }}" + strategy: + matrix: + os: [ubuntu-latest] + php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'] + max-parallel: 10 + fail-fast: false + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: none + + - name: Setup Dependencies + run: + composer install -o diff --git a/vendor/qcloud/cos-sdk-v5/CHANGELOG.md b/vendor/qcloud/cos-sdk-v5/CHANGELOG.md new file mode 100644 index 0000000..fc9083d --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/CHANGELOG.md @@ -0,0 +1,262 @@ +cos-php-sdk-v5 Upgrade Guide +==================== +2.5.2 to 2.5.3 +--------- +- 增加ETag的兼容逻辑,防止因为特殊框架或者网关规则导致etag undefined + +2.5.1 to 2.5.2 +--------- +- 修复预签名中Headers参数无效的问题 + +2.5.0 to 2.5.1 +--------- +- 万象相关接口的DetectType审核类型参数可选 +- 万象内容审核接口增加DataId自定义业务标识 +- 新增万象网页审核任务相关接口 +- 新增部分参数校验 +- 修复PHP8.1中将null传递给不可为空的内部函数的问题 + +2.4.4 to 2.5.0 +--------- +- 万象支持病毒检测、人声分离任务接口 +- 万象转码任务支持多个水印参数/多任务接口/查询接口/列表接口 +- 修复签名长期存在的bug +- 修复copy接口404问题,copyObject示例添加注释 +- 审核接口增加仅支持https的说明 + +2.4.3 to 2.4.4 +--------- +- 修复图片水印签名问题 + +2.4.2 to 2.4.3 +--------- +- 优化审核接口返回相关字段 +- 增加host开关功能 +- GetObject接口支持万象自定义样式 +- 修复ip的host bug + +2.4.1 to 2.4.2 +--------- +- 修复图片处理相关接口403签名不对的bug + +2.4.0 to 2.4.1 +--------- +- 增加桶Bucket、GetBucket对应Sample详细注解 +- 对部分传入参数进行检查 +- 添加doesObjectExist、doesBucketExist对应Sample +- 调整整体项目架构,修复composer依赖问题 +- 调整UT + +2.3.4 to 2.4.0 +--------- +- 新增文档转码功能,包括提交、查询、拉取文档预览任务 +- 丰富头域参数说明 +- 修复预签名中将万象参数作为key报错问题 +- 调整travis与action,后续版本保证多版本测试正常 + +2.3.3 to 2.3.4 +--------- +- 修复laravel8中guzzlehttp/psr7报错问题,后续重新整理依赖 +- 修复putBucketAccelerate接口与目前API不一致的问题 + +2.3.2 to 2.3.3 +--------- +- 修复laravel8中guzzlehttp/psr7报错问题 +- 清理无用代码 + +2.3.1 to 2.3.2 +--------- +- 新增视频截帧,视频信息查询示例 +- 新增PUT/GET Bucket Referer示例 +- 对于相应接口添加CRC返回信息 +- 修复图片审核中ci-process param出现两次的问题 +- 修复PHP5.6 版本的依赖问题 +- 根据PHP版本自动composer install guzzle6.x或guzzle7 + +2.3.0 to 2.3.1 +--------- +- 修复文本检测的返回格式 +- 修复sample中的问题 +- 新增视频、文本、文档、音频检测 +- 新增媒体转码、截图、拼接 + +2.2.3 to 2.3.0 +--------- +- 新增图片审核,视频审核,音频审核,文本审核,文档审核接口 +- 新增单链接限速demo +- 暴露getPresigned接口Headers和Params参数接口 +- 补充textDetect UT +- 修复stream_for废弃问题 +- 修复x-cos头检测逻辑问题 +- 修复UT部分bug + +2.2.2 to 2.2.3 +- 在putObejct中新增x-cos-tagging头 +- 修复`GetObjectWithoutSign`bug + +2.2.1 to 2.2.2 +---------- +新增appendObject SDK,包括sample,service,test +增加无签名对象下载地址 SDK,包括sample,service,test +增加全球加速相关配置参数 +将COS_SECRETID修改为SECRETID、COS_SECRETKEY修改为SECRETKEY,防止混淆 +修复部分逻辑代码bug +修复部分拼写错误 +- Add `AppendObject` interface +- Add `GetObjectWithoutSign` interface +- Add `allow_accelerate` param to client +- Change const name `COS_SECRETID->SECRETID` `COS_SECRETKEY->SECRETKEY` +- Fix `getPresigned` interface +- Fix typo + +2.2.0 to 2.2.1 +---------- +- Add `PutObjectTagging` interface +- Add `GetObjectTagging` interface +- Add `DeleteObjectTagging` interface + +2.1.6 to 2.2.0 +---------- +- `PutObject` interface supports ci image process +- `GetObject` interface supports ci image process +- Add `ImageInfo` interface, which is used for get image info +- Add `ImageExif` interface, which is used for get image exif +- Add `ImageAve` interface, which is used for get image ave +- Add `ImageProcess` interface, which is used for data processing on cloud +- Add `Qrcode` interface, which is used for qrcode recognition +- Add `QrcodeGenerate` interface, which is used for generate qrcode +- Add `DetectLabel` interface, which is used for detect image label +- Add `PutBucketImageStyle` interface, which is used for add bucket image style +- Add `GetBucketImageStyle` interface, which is used for get bucket image style +- Add `DeleteBucketImageStyle` interface, which is used for delete bucket image style +- Add `PutBucketGuetzli` interface, which is used for open bucket guetzli state +- Add `GetBucketGuetzli` interface, which is used for get bucket guetzli state +- Add `DeleteBucketGuetzli` interface, which is used for close bucket guetzli state + +2.1.5 to 2.1.6 +---------- +- Add `allow_redirects` parameter +- Fix `selectObjectContent` interface + +2.1.3 to 2.1.5 +---------- +- The `download` interface supports breakpoint +- Rename `getPresignetUrl` to `getPresignedUrl` + +2.1.2 to 2.1.3 +---------- +- Add `download` interface, which is used for concurrent block download +- Add callback of `upload` and `download` progress +- Fix request retry + +2.1.1 to 2.1.2 +---------- +- The interface supports custom parameters +- Fix `ListBucketInventoryConfigurations` + +2.1.0 to 2.1.1 +---------- +- Fix bug of urlencode when calculating signature + +2.0.9 to 2.1.0 +---------- +- `upload` support upload with multithread +- Add `retry` params for interface retry +- Support add customer header +- Signature will restrict part of the header and all parameters +- Fix `listBuckets` with `doamin` + +2.0.8 to 2.0.9 +---------- +- Fix bug of `listObjectVersions` +- Update `getObject` with param of `saveas` + +2.0.7 to 2.0.8 +---------- +- Fix presigned url when using tmpSecretId/tmpSecretKey/Token + +2.0.6 to 2.0.7 +---------- +- Fix response of `ListParts` + +2.0.5 to 2.0.6 +---------- +- Support Domain +- Add Select Object Content Interface +- Add Traffic Limit +- Fix bug of object endswith / + +2.0.4 to 2.0.5 +---------- +- Fix bug when upload object with metadata + +2.0.3 to 2.0.4 +---------- +- Fix bug when using ip-port + +2.0.2 to 2.0.3 +---------- +- Fix path parse bug with /0/ + +2.0.1 to 2.0.2 +---------- +- Fix bug of `putObject` with `fopen` +- Add ut + + +2.0.0 to 2.0.1 +---------- +- Add interface of inventory/tagging/logging +- Fix bug of some interface with query string + + +1.3 to 2.0 +---------- +cos-php-sdk-v5 now uses [GuzzleHttp] for HTTP message. +Due to fact, it depending on PHP >= 5.6. + +- Use the `Qcloud\Cos\Client\getPresignetUrl()` method instead of the `Qcloud\Cos\Command\createPresignedUrl()` + +v2: +```php +$signedUrl = $cosClient->getPresignetUrl($method='putObject', + $args=['Bucket'=>'examplebucket-1250000000', 'Key'=>'exampleobject', 'Body'=>''], + $expires='+30 minutes'); +``` + +v1: +```php +$command = $cosClient->getCommand('putObject', array( + 'Bucket' => "examplebucket-1250000000", + 'Key' => "exampleobject", + 'Body' => '', +)); +$signedUrl = $command->createPresignedUrl('+30 minutes'); +``` + +- `$copSource` parameters of the `Qcloud\Cos\Client\Copy` interface are no longer compatible with older versions. + +v2: + +```php +$result = $cosClient->copy( + $bucket = '', + $Key = '', + $copySorce = array( + 'Region' => '', + 'Bucket' => '', + 'Key' => '', + ) +); +``` + +v1: +```php +$result = $cosClient->Copy( + $bucket = '', + $key = '', + $copysource = '.cos..myqcloud.com/' +); +``` +- Now when uploading files with using `open()` to upload stream, if the local file does not exist, a 0 byte file will be uploaded without throwing an exception, only a warning. + diff --git a/vendor/qcloud/cos-sdk-v5/LICENSE b/vendor/qcloud/cos-sdk-v5/LICENSE new file mode 100644 index 0000000..2c948c8 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 腾讯云 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/qcloud/cos-sdk-v5/README.md b/vendor/qcloud/cos-sdk-v5/README.md new file mode 100644 index 0000000..9a951b2 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/README.md @@ -0,0 +1,302 @@ +# COS-PHP-SDK-V5 + +腾讯云 COS-PHP-SDK-V5([XML API](https://cloud.tencent.com/document/product/436/7751)) + +[![PHP Version](http://poser.pugx.org/qcloud/cos-sdk-v5/require/php)](https://packagist.org/packages/qcloud/cos-sdk-v5) +[![License](https://poser.pugx.org/qcloud/cos-sdk-v5/license)](LICENSE) +[![Latest Stable Version](https://poser.pugx.org/qcloud/cos-sdk-v5/v/stable)](https://packagist.org/packages/qcloud/cos-sdk-v5) +[![Total Downloads](https://img.shields.io/packagist/dt/qcloud/cos-sdk-v5.svg?style=flat)](https://packagist.org/packages/qcloud/cos-sdk-v5) +[![Build Status](https://api.travis-ci.com/tencentyun/cos-php-sdk-v5.svg?branch=master)](https://app.travis-ci.com/github/tencentyun/cos-php-sdk-v5) +[![codecov](https://codecov.io/gh/tencentyun/cos-php-sdk-v5/branch/master/graph/badge.svg)](https://codecov.io/gh/tencentyun/cos-php-sdk-v5) +[![Support Multiple Versions](https://github.com/tencentyun/cos-php-sdk-v5/actions/workflows/install.yml/badge.svg)](https://github.com/tencentyun/cos-php-sdk-v5/actions/workflows/install.yml) + +## 依赖 + +- [x] PHP >= 5.6 +> 如果您的 php 版本 `>=5.3` 且 `<5.6` , 请使用 [v1.3](https://github.com/tencentyun/cos-php-sdk-v5/tree/1.3) 版本 + +- [x] ext-curl +- [x] ext-json +- [x] ext-simplexml + +## 安装 + +SDK 安装有三种方式: + +- [Composer 方式](#composer-方式) +- [Phar 方式](#Phar-方式) +- [源码方式](#源码方式) + +### Composer 方式 + +推荐使用 Composer 安装 cos-php-sdk-v5,Composer 是 PHP 的依赖管理工具,允许您声明项目所需的依赖,然后自动将它们安装到您的项目中。 + +```bash +composer require qcloud/cos-sdk-v5 +``` + +> 您可以在 [Composer 官网](https://getcomposer.org/) 上找到更多关于如何安装 Composer,配置自动加载以及用于定义依赖项的其他最佳实践等相关信息。 + +#### 安装步骤 + +1. 打开终端; +2. 下载 Composer,执行以下命令: + +```bash +curl -sS https://getcomposer.org/installer | php +``` + +3. 创建一个名为`composer.json`的文件,内容如下: + +```json +{ + "require": { + "qcloud/cos-sdk-v5": "2.*" + } +} +``` + +4. 使用 Composer 安装,执行以下命令: + +```bash +php composer.phar install +``` + +使用该命令后会在当前目录中创建一个 vendor 文件夹,里面包含 SDK 的依赖库和一个 autoload.php 脚本,方便在项目中调用。 + +5. 通过 autoload.php 脚本调用 cos-php-sdk-v5: + +```php +require '/path/to/vendor/autoload.php'; +``` + +现在您的项目已经可以使用 COS 的 V5 版本 SDK 了。 + +### Phar 方式 + +Phar 方式安装 SDK 的步骤如下: + +1. 在 [GitHub 发布页面](https://github.com/tencentyun/cos-php-sdk-v5/releases) 下载相应的 phar 文件; +> 对于 PHP 版本`>= 5.6`且`<7.2.5`的用户请下载`cos-sdk-v5-6.phar`以使用 Guzzle6 版本。 +> 对于 PHP 版本`>=7.2.5`的用户请下载`cos-sdk-v5-7.phar`以使用 Guzzle7 版本。 +2. 在代码中引入 phar 文件: + +```php +require '/path/to/cos-sdk-v5.phar'; +``` + +### 源码方式 + +源码方式安装 SDK 的步骤如下: + +1. 在 [GitHub 发布页面](https://github.com/tencentyun/cos-php-sdk-v5/releases) 下载相应的 cos-sdk-v5.tar.gz 文件; +> 对于 PHP 版本`>= 5.6`且`<7.2.5`的用户请下载`cos-sdk-v5-6.tar.gz`以使用 Guzzle6 版本。 +> 对于 PHP 版本`>=7.2.5`的用户请下载`cos-sdk-v5-7.tar.gz`以使用 Guzzle7 版本。 +2. 解压后通过 autoload.php 脚本加载 SDK: + +```php +require '/path/to/cos-sdk-v5/vendor/autoload.php'; +``` + +## 快速入门 + +可参照 Demo 程序,详见 [sample 目录](https://github.com/tencentyun/cos-php-sdk-v5/tree/master/sample) 。 + +## 接口文档 + +PHP SDK 接口文档,详见 [https://cloud.tencent.com/document/product/436/12267](https://cloud.tencent.com/document/product/436/12267) + +### 配置文件 + +```php +$cosClient = new Qcloud\Cos\Client(array( + 'region' => '', + 'credentials' => array( + 'secretId' => '', + 'secretKey' => '' + ) +)); +``` + +若您使用 [临时密钥](https://cloud.tencent.com/document/product/436/14048) 初始化,请用下面方式创建实例。 + +```php +$cosClient = new Qcloud\Cos\Client(array( + 'region' => '', + 'credentials' => array( + 'secretId' => '', + 'secretKey' => '', + 'token' => '' + ) +)); +``` + +### 上传文件 + +- 使用 putObject 接口上传文件(最大 5G) +- 使用 Upload 接口分块上传文件 + +```php +# 上传文件 +## putObject(上传接口,最大支持上传5G文件) +### 上传内存中的字符串 +//bucket 的命名规则为{name}-{appid} ,此处填写的存储桶名称必须为此格式 +try { + $result = $cosClient->putObject(array( + 'Bucket' => $bucket, + 'Key' => $key, + 'Body' => 'Hello World!')); + print_r($result); +} catch (\Exception $e) { + echo "$e\n"; +} + +### 上传文件流 +try { + $result = $cosClient->putObject(array( + 'Bucket' => $bucket, + 'Key' => $key, + 'Body' => fopen($local_path, 'rb'))); + print_r($result); +} catch (\Exception $e) { + echo "$e\n"; +} + +### 设置header和meta +try { + $result = $cosClient->putObject(array( + 'Bucket' => $bucket, + 'Key' => $key, + 'Body' => fopen($local_path, 'rb'), + 'ACL' => 'string', + 'CacheControl' => 'string', + 'ContentDisposition' => 'string', + 'ContentEncoding' => 'string', + 'ContentLanguage' => 'string', + 'ContentLength' => integer, + 'ContentType' => 'string', + 'Expires' => 'mixed type: string (date format)|int (unix timestamp)|\DateTime', + 'Metadata' => array( + 'string' => 'string', + ), + 'StorageClass' => 'string')); + print_r($result); +} catch (\Exception $e) { + echo "$e\n"; +} + +## Upload(高级上传接口,默认使用分块上传最大支持50T) +### 上传内存中的字符串 +try { + $result = $cosClient->Upload( + $bucket = $bucket, + $key = $key, + $body = 'Hello World!'); + print_r($result); +} catch (\Exception $e) { + echo "$e\n"; +} + +### 上传文件流 +try { + $result = $cosClient->Upload( + $bucket = $bucket, + $key = $key, + $body = fopen($local_path, 'rb')); + print_r($result); +} catch (\Exception $e) { + echo "$e\n"; +} + +### 设置header和meta +try { + $result = $cosClient->Upload( + $bucket= $bucket, + $key = $key, + $body = fopen($local_path, 'rb'), + $options = array( + 'ACL' => 'string', + 'CacheControl' => 'string', + 'ContentDisposition' => 'string', + 'ContentEncoding' => 'string', + 'ContentLanguage' => 'string', + 'ContentLength' => integer, + 'ContentType' => 'string', + 'Expires' => 'mixed type: string (date format)|int (unix timestamp)|\DateTime', + 'Metadata' => array( + 'string' => 'string', + ), + 'StorageClass' => 'string')); + print_r($result); +} catch (\Exception $e) { + echo "$e\n"; +} +``` + +### 下载文件 + +- 使用 getObject 接口下载文件 +- 使用 getObjectUrl 接口获取文件下载 URL + +```php +# 下载文件 +## getObject(下载文件) +### 下载到内存 +//bucket 的命名规则为{name}-{appid} ,此处填写的存储桶名称必须为此格式 +try { + $result = $cosClient->getObject(array( + 'Bucket' => $bucket, + 'Key' => $key)); + echo($result['Body']); +} catch (\Exception $e) { + echo "$e\n"; +} + +### 下载到本地 +try { + $result = $cosClient->getObject(array( + 'Bucket' => $bucket, + 'Key' => $key, + 'SaveAs' => $local_path)); +} catch (\Exception $e) { + echo "$e\n"; +} + +### 指定下载范围 +/* + * Range 字段格式为 'bytes=a-b' + */ +try { + $result = $cosClient->getObject(array( + 'Bucket' => $bucket, + 'Key' => $key, + 'Range' => 'bytes=0-10', + 'SaveAs' => $local_path)); +} catch (\Exception $e) { + echo "$e\n"; +} + +### 设置返回header +try { + $result = $cosClient->getObject(array( + 'Bucket' => $bucket, + 'Key' => $key, + 'ResponseCacheControl' => 'string', + 'ResponseContentDisposition' => 'string', + 'ResponseContentEncoding' => 'string', + 'ResponseContentLanguage' => 'string', + 'ResponseContentType' => 'string', + 'ResponseExpires' => 'mixed type: string (date format)|int (unix timestamp)|\DateTime', + 'SaveAs' => $local_path)); +} catch (\Exception $e) { + echo "$e\n"; +} + +## getObjectUrl(获取文件Url) +try { + $signedUrl = $cosClient->getObjectUrl($bucket, $key, '+10 minutes'); + echo $signedUrl; +} catch (\Exception $e) { + echo "$e\n"; +} +``` diff --git a/vendor/qcloud/cos-sdk-v5/composer.json b/vendor/qcloud/cos-sdk-v5/composer.json new file mode 100644 index 0000000..628ba92 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/composer.json @@ -0,0 +1,56 @@ +{ + "name": "qcloud/cos-sdk-v5", + "description": "PHP SDK for QCloud COS", + "keywords": [ + "qcloud", "cos", "php" + ], + "license": "MIT", + "authors": [ + { + "name": "yaozongyou", + "email": "yaozongyou@vip.qq.com" + }, + { + "name": "lewzylu", + "email": "327874225@qq.com" + }, + { + "name": "tuunalai", + "email": "550566181@qq.com" + } + ], + "autoload": { + "psr-4": { + "Qcloud\\Cos\\": "src/" + }, + "files": ["src/Common.php"] + }, + "autoload-dev": { + "psr-4": { + "Qcloud\\Cos\\Tests\\": "tests/" + } + }, + "require": { + "php": ">=5.6", + "ext-curl": "*", + "ext-json": "*", + "ext-simplexml": "*", + "guzzlehttp/guzzle": "^6.2.1 || ^7.0", + "guzzlehttp/guzzle-services": "^1.1", + "guzzlehttp/psr7": "^1.3.1 || ^2.0" + }, + "config": { + "optimize-autoloader": true + }, + "scripts": { + "test": [ + "@putenv XDEBUG_MODE=coverage", + "phpunit -v --color=always" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + } +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/abortMultipartUpload.php b/vendor/qcloud/cos-sdk-v5/sample/abortMultipartUpload.php new file mode 100644 index 0000000..0d8cf88 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/abortMultipartUpload.php @@ -0,0 +1,26 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->abortMultipartUpload(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'UploadId' => 'string', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/appendObject.php b/vendor/qcloud/cos-sdk-v5/sample/appendObject.php new file mode 100644 index 0000000..88ac654 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/appendObject.php @@ -0,0 +1,36 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials' => array( + 'secretId' => $secretId, + 'secretKey' => $secretKey))); +$local_path = "/data/exampleobject"; +try { + $result = $cosClient->appendObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Position' => 0, //追加对象位置 + 'Body' => fopen($local_path, 'rb'),//读取文件内容 + )); + /* + $result = $cosClient->appendObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Position' => (integer)$result['Position'], //取出上一个追加文件的对象位置进行追加 + 'Body' => "hello", //文件流 + )); + */ + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/blindWatermark.php b/vendor/qcloud/cos-sdk-v5/sample/blindWatermark.php new file mode 100644 index 0000000..e8252a3 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/blindWatermark.php @@ -0,0 +1,31 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $blindWatermarkTemplate = new Qcloud\Cos\ImageParamTemplate\BlindWatermarkTemplate(); + $blindWatermarkTemplate->setImage("http://examplebucket-125000000.cos.ap-beijing.myqcloud.com/shuiyin.jpeg"); + $blindWatermarkTemplate->setType(2); + $blindWatermarkTemplate->setLevel(3); + $result = $cosClient->getObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'ImageHandleParam' => $blindWatermarkTemplate->queryString(), + 'SaveAs' => '/data/exampleobject' + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/catchException.php b/vendor/qcloud/cos-sdk-v5/sample/catchException.php new file mode 100644 index 0000000..0c12f54 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/catchException.php @@ -0,0 +1,29 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getBucketAcl(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + $statusCode = $e->getStatusCode(); // 获取错误码 + $errorMessage = $e->getMessage(); // 获取错误信息 + $requestId = $e->getRequestId(); // 获取错误的requestId + $errorCode = $e->getCosErrorCode(); // 获取错误名称 + $request = $e->getRequest(); // 获取完整的请求 + $response = $e->getResponse(); // 获取完整的响应 +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/ciTransformation.php b/vendor/qcloud/cos-sdk-v5/sample/ciTransformation.php new file mode 100644 index 0000000..9dbab31 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/ciTransformation.php @@ -0,0 +1,38 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $imageMogrTemplate = new Qcloud\Cos\ImageParamTemplate\ImageMogrTemplate(); + $imageMogrTemplate->thumbnailByScale(50); + $imageMogrTemplate->rotate(50); + $imageViewTemplate = new Qcloud\Cos\ImageParamTemplate\ImageViewTemplate(); + $imageViewTemplate->setMode(1); + $imageViewTemplate->setWidth(400); + $imageViewTemplate->setHeight(600); + $imageViewTemplate->setQuality(1, 85); + $ciParamTransformation = new Qcloud\Cos\ImageParamTemplate\CIParamTransformation(); + $ciParamTransformation->addRule($imageMogrTemplate); + $ciParamTransformation->addRule($imageViewTemplate); + $result = $cosClient->getObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'ImageHandleParam' => $ciParamTransformation->queryString(), + 'SaveAs' => '/data/exampleobject', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/completeMultipartUpload.php b/vendor/qcloud/cos-sdk-v5/sample/completeMultipartUpload.php new file mode 100644 index 0000000..5950368 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/completeMultipartUpload.php @@ -0,0 +1,36 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->completeMultipartUpload(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'UploadId' => 'string', + 'Parts' => array( + array( + 'ETag' => 'string', + 'PartNumber' => integer, + ), + array( + 'ETag' => 'string', + 'PartNumber' => integer, + )), + // ... repeated + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/copy.php b/vendor/qcloud/cos-sdk-v5/sample/copy.php new file mode 100644 index 0000000..f400dc3 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/copy.php @@ -0,0 +1,31 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +$local_path = "/data/exampleobject"; +try { + $result = $cosClient->copy( + $bucket = 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + $key = 'exampleobject', + $copySource = array( + 'Region' => '', + 'Bucket' => '', + 'Key' => '', + ) + ); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/copyObject.php b/vendor/qcloud/cos-sdk-v5/sample/copyObject.php new file mode 100644 index 0000000..d58fc93 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/copyObject.php @@ -0,0 +1,27 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->copyObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'CopySource' => urlencode('examplebucket2-125000000.cos.ap-guangzhou.myqcloud.com/exampleobject'), //请注意这里需要urlencode,防止因特殊字符产生的400或404错误 + 'MetadataDirective' => 'Replaced', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/cosClient.php b/vendor/qcloud/cos-sdk-v5/sample/cosClient.php new file mode 100644 index 0000000..4b68d1a --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/cosClient.php @@ -0,0 +1,30 @@ + $region, //园区 + 'schema' => 'https', //协议头部,默认为http + 'timeout' => 10, //超时时间 + 'connect_timeout' => 10, //连接超时时间 + 'ip' => '', //ip + 'port' => '', //端口 + 'endpoint' => '', //endpoint + 'domain' => '', //domain可以填写用户自定义域名,或者桶的全球加速域名 + 'proxy' => '', //代理服务器 + 'retry' => 10, //重试次数 + 'userAgent' => '', //UA + 'allow_redirects' => false, //是否follow302 + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey, + 'token' => $token, + 'anonymous' => true, //匿名模式 + ) + ) +); diff --git a/vendor/qcloud/cos-sdk-v5/sample/createBucket.php b/vendor/qcloud/cos-sdk-v5/sample/createBucket.php new file mode 100644 index 0000000..a2ed0d2 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/createBucket.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->createBucket(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/createDocProcessJobs.php b/vendor/qcloud/cos-sdk-v5/sample/createDocProcessJobs.php new file mode 100644 index 0000000..ca8e654 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/createDocProcessJobs.php @@ -0,0 +1,49 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->createDocProcessJobs(array( + 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Tag' => 'DocProcess', //任务的 Tag:DocProcess 固定值 + 'QueueId' => 'pd8e422a2ea134165a92f2012ea43****', //任务所在的队列 ID + 'Input' => array( + 'Object' => 'Append功能测试.pdf' //待操作的文件对象 + ), + 'Operation' => array( + 'DocProcess' => array( + 'SrcType' => 'pdf', //源数据的后缀类型 + 'TgtType' => 'png', //转换输出目标文件类型 + 'SheetId' => 0, //表格文件参数,转换第 X 个表,默认为1 + 'StartPage' => 1, //从第 X 页开始转换,默认为1 + 'EndPage' => 3, //转换至第 X 页,默认为-1,即转换全部页 + 'ImageParams' => '', //转换后的图片处理参数 + 'DocPassword' => '', //Office 文档的打开密码 + 'Comments' => 0, //是否隐藏批注和应用修订,默认为 0 + 'PaperDirection' => 0, //表格文件转换纸张方向,默认为0 + 'Quality' => 100, //生成预览图的图片质量,取值范围 [1-100],默认值100 + 'Zoom' => 100, //预览图片的缩放参数,取值范围[10-200], 默认值100 + ), + 'Output' => array( + 'Region' => $region, //存储桶的地域 + 'Bucket' => 'examplebucket-1250000000', //存储结果的存储桶 + 'Object' => 'pic-${Page}.jpg', //输出文件路径 + ), + ), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/createFolder.php b/vendor/qcloud/cos-sdk-v5/sample/createFolder.php new file mode 100644 index 0000000..1d3b26d --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/createFolder.php @@ -0,0 +1,26 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->putObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'folder/', + 'Body' => "", + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/createMediaConcatJobs.php b/vendor/qcloud/cos-sdk-v5/sample/createMediaConcatJobs.php new file mode 100644 index 0000000..090a449 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/createMediaConcatJobs.php @@ -0,0 +1,95 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + // start --------------- 使用模版 ----------------- // + $result = $cosClient->createMediaConcatJobs(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Tag' => 'Concat', + 'QueueId' => 'asdadadfafsdkjhfjghdfjg', + 'CallBack' => 'https://example.com/callback', + 'Input' => array( + 'Object' => 'video01.mp4' + ), + 'Operation' => array( + 'TemplateId' => 'asdfafiahfiushdfisdhfuis', + 'Output' => array( + 'Region' => $region, + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Object' => 'concat-video02.mp4', + ), + ), + )); + // 请求成功 + print_r($result); + // end --------------- 使用模版 ----------------- // + + // start --------------- 自定义参数 ----------------- // + $result = $cosClient->createMediaConcatJobs(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Tag' => 'Concat', + 'QueueId' => 'asdadadfafsdkjhfjghdfjg', + 'CallBack' => 'https://example.com/callback', + 'Input' => array( + 'Object' => 'video01.mp4' + ), + 'Operation' => array( + 'Output' => array( + 'Region' => $region, + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Object' => 'concat-video03.mp4', + ), + 'ConcatTemplate' => array( + 'ConcatFragments' => array( + array( + 'Url' => 'https://example.com/video01.mp4', + 'Mode' => 'Start', +// 'StartTime' => '0', +// 'EndTime' => '7', + ), + array( + 'Url' => 'https://example.com/video02.mp4', + 'Mode' => 'Start', +// 'StartTime' => '0', +// 'EndTime' => '10', + ), + // ... repeated + ), + 'Index' => 1, + 'Container' => array( + 'Format' => 'mp4' + ), + 'Audio' => array( + 'Codec' => 'mp3', + 'Samplerate' => '', + 'Bitrate' => '', + 'Channels' => '', + ), + 'Video' => array( + 'Codec' => 'H.264', + 'Bitrate' => '1000', + 'Width' => '1280', + 'Height' => '', + 'Fps' => '30', + ), + ), + ), + )); + // 请求成功 + print_r($result); + // end --------------- 自定义参数 ----------------- // +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/createMediaSnapshotJobs.php b/vendor/qcloud/cos-sdk-v5/sample/createMediaSnapshotJobs.php new file mode 100644 index 0000000..16e0d90 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/createMediaSnapshotJobs.php @@ -0,0 +1,70 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + // start --------------- 使用模版 ----------------- // + $result = $cosClient->createMediaSnapshotJobs(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Tag' => 'Snapshot', + 'QueueId' => 'asdadadfafsdkjhfjghdfjg', + 'CallBack' => 'https://example.com/callback', + 'Input' => array( + 'Object' => 'video01.mp4' + ), + 'Operation' => array( + 'TemplateId' => 'asdfafiahfiushdfisdhfuis', + 'Output' => array( + 'Region' => $region, + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Object' => 'snapshot-${Number}.jpg', + ), + ), + )); + // 请求成功 + print_r($result); + // end --------------- 使用模版 ----------------- // + + + // start --------------- 自定义参数 ----------------- // + $result = $cosClient->createMediaSnapshotJobs(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Tag' => 'Snapshot', + 'QueueId' => 'asdadadfafsdkjhfjghdfjg', + 'CallBack' => 'https://example.com/callback', + 'Input' => array( + 'Object' => 'video01.mp4' + ), + 'Operation' => array( + 'Output' => array( + 'Region' => $region, + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Object' => 'snapshot-${Number}.jpg', + ), + 'Snapshot' => array( + 'Mode' => 'Average', + 'Start' => 3, + 'TimeInterval' => '', + 'Count' => 3, + 'Width' => '1280', + 'Height' => '', + ), + ), + )); + // 请求成功 + print_r($result); + // end --------------- 自定义参数 ----------------- // +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/createMediaTranscodeJobs.php b/vendor/qcloud/cos-sdk-v5/sample/createMediaTranscodeJobs.php new file mode 100644 index 0000000..3e97d24 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/createMediaTranscodeJobs.php @@ -0,0 +1,164 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + // 多任务接口 + $result = $cosClient->CreateMediaJobs(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Tag' => 'Transcode', + 'QueueId' => 'paaf4fce5521a40888a3034a5de80f6ca', + 'CallBack' => '', + 'Input' => array( + 'Object' => 'example.mp4' + ), + 'Operation' => array( + array( + 'TemplateId' => 't04e1ab86554984f1aa17c062fbf6c007c', + 'Output' => array( + 'Region' => $region, + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Object' => 'video01.mp4', + ), + 'WatermarkTemplateId' => array( + 't112d18d9b2a9b430e91d3c320f80af341', + ), + ), + array( + 'TemplateId' => 't04e1ab86554984f1aa17c062fbf6c007c', + 'Output' => array( + 'Region' => $region, + 'Bucket' => 'wwj-cq-1253960454', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Object' => 'video02.mp4', + ), + 'WatermarkTemplateId' => array( + 't1bf713bb5c6a5496e859aebc4a8973ab5', + ), + ), + ), + )); + + // 单任务接口 + // start --------------- 使用模版 ----------------- // + $result = $cosClient->createMediaTranscodeJobs(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Tag' => 'Transcode', + 'QueueId' => 'paaf4fce5521a40888a3034a5de80f6ca', + 'Input' => array( + 'Object' => 'example.mp4' + ), + 'Operation' => array( + 'TemplateId' => 't04e1ab86554984f1aa17c062fbf6c007c', + 'Output' => array( + 'Region' => $region, + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Object' => 'video02.mp4', + ), + 'Watermark' => arrray( + array( + 'Type' => 'Text', + 'LocMode' => 'Absolute', + 'Dx' => '64', + 'Dy' => '64', + 'Pos' => 'TopRight', + 'Text' => array( + 'Text' => '第一个水印', + 'FontSize' => '30', + 'FontType' => 'simfang.ttf', + 'FontColor' => '#99ff00', + 'Transparency' => '100', // 不透明度 + ), + ), + array( + 'Type' => 'Text', + 'LocMode' => 'Absolute', + 'Dx' => '64', + 'Dy' => '64', + 'Pos' => 'TopLeft', + 'Text' => array( + 'Text' => '第二个水印', + 'FontSize' => '30', + 'FontType' => 'simfang.ttf', + 'FontColor' => '#99ff00', + 'Transparency' => '100', // 不透明度 + ), + ), + ), + ), + )); + $result = $cosClient->DescribeMediaJob(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'j20f7a6be6c5511eca253f3ee9d4082e0', + )); + $result = $cosClient->DescribeMediaJobs(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Tag' => 'Transcode', + 'QueueId' => 'paaf4fce5521a40888a3034a5de80f6ca', + )); + // 请求成功 + print_r($result); + // end --------------- 使用模版 ----------------- // + + + // start --------------- 自定义参数 ----------------- // + $result = $cosClient->createMediaTranscodeJobs(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Tag' => 'Transcode', + 'QueueId' => 'asdadadfafsdkjhfjghdfjg', + 'CallBack' => 'https://example.com/callback', + 'Input' => array( + 'Object' => 'video01.mp4' + ), + 'Operation' => array( + 'Output' => array( + 'Region' => $region, + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Object' => 'video01.mkv', + ), + 'Transcode' => array( + 'Container' => array( + 'Format' => 'mp4' + ), + 'Video' => array( + 'Codec' => 'H.264', + 'Profile' => 'high', + 'Bitrate' => '1000', + 'Preset' => 'medium', + 'Width' => '1280', + 'Fps' => '30', + ), + 'Audio' => array( + 'Codec' => 'aac', + 'Samplerate' => '44100', + 'Bitrate' => '128', + 'Channels' => '4', + ), + 'TransConfig' => array( + 'AdjDarMethod' => 'scale', + 'IsCheckReso' => 'false', + 'ResoAdjMethod' => '1', + ), + 'TimeInterval' => array( + 'Start' => '0', + 'Duration' => '60', + ), + ), + ), + )); + // 请求成功 + print_r($result); + // end --------------- 自定义参数 ----------------- // +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/createMediaVoiceSeparateJobs.php b/vendor/qcloud/cos-sdk-v5/sample/createMediaVoiceSeparateJobs.php new file mode 100644 index 0000000..1f16d59 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/createMediaVoiceSeparateJobs.php @@ -0,0 +1,72 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + // start --------------- 使用模版 ----------------- // + $result = $cosClient->createMediaVoiceSeparateJobs(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Tag' => 'VoiceSeparate', + 'QueueId' => '', + 'CallBack' => '', + 'Input' => array( + 'Object' => 'test.mp3' + ), + 'Operation' => array( + 'TemplateId' => '', + 'Output' => array( + 'Region' => $region, + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Object' => 'VoiceSeparate01.mp3', + 'AuObject' => 'VoiceSeparate02.mp3', + ), + ), + )); + // 请求成功 + print_r($result); + // end --------------- 使用模版 ----------------- // + + // start --------------- 自定义参数 ----------------- // + $result = $cosClient->createMediaVoiceSeparateJobs(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Tag' => 'VoiceSeparate', + 'QueueId' => '', + 'CallBack' => '', + 'Input' => array( + 'Object' => 'test.mp3' + ), + 'Operation' => array( + 'Output' => array( + 'Region' => $region, + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Object' => 'VoiceSeparate01.mp3', + 'AuObject' => 'VoiceSeparate02.mp3', + ), + 'VoiceSeparate' => array( + 'AudioMode' => 'AudioAndBackground', + 'AudioConfig' => array( + 'Codec' => 'mp3', + 'Samplerate' => '11025', + 'Bitrate' => '256', + 'Channels' => '2', + ), + ), + ), + )); + // 请求成功 + print_r($result); + // end --------------- 自定义参数 ----------------- // +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/createMultipartUpload.php b/vendor/qcloud/cos-sdk-v5/sample/createMultipartUpload.php new file mode 100644 index 0000000..d81756f --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/createMultipartUpload.php @@ -0,0 +1,38 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->createMultipartUpload(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + /* + 'CacheControl' => 'string', + 'ContentDisposition' => 'string', + 'ContentEncoding' => 'string', + 'ContentLanguage' => 'string', + 'ContentLength' => integer, + 'ContentType' => 'string', + 'Expires' => 'string', + 'Metadata' => array( + 'string' => 'string', + ), + 'StorageClass' => 'string' + */ + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/deleteBucket.php b/vendor/qcloud/cos-sdk-v5/sample/deleteBucket.php new file mode 100644 index 0000000..700cb87 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/deleteBucket.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->deleteBucket(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/deleteBucketCors.php b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketCors.php new file mode 100644 index 0000000..c4ebd87 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketCors.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->deleteBucketCors(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/deleteBucketDomain.php b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketDomain.php new file mode 100644 index 0000000..cbb5ba2 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketDomain.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->deleteBucketDomain(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/deleteBucketGuetzli.php b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketGuetzli.php new file mode 100644 index 0000000..5c00244 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketGuetzli.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->DeleteBucketGuetzli(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/deleteBucketImageStyle.php b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketImageStyle.php new file mode 100644 index 0000000..bc403a0 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketImageStyle.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->DeleteBucketImageStyle(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/deleteBucketLifecycle.php b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketLifecycle.php new file mode 100644 index 0000000..69985d7 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketLifecycle.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->deleteBucketLifecycle(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/deleteBucketTagging.php b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketTagging.php new file mode 100644 index 0000000..ce6ac23 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketTagging.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->deleteBucketTagging(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/deleteBucketWebsite.php b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketWebsite.php new file mode 100644 index 0000000..2b6a300 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/deleteBucketWebsite.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->deleteBucketWebsite(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/deleteBuckets.php b/vendor/qcloud/cos-sdk-v5/sample/deleteBuckets.php new file mode 100644 index 0000000..d7f1ba1 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/deleteBuckets.php @@ -0,0 +1,52 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + //列出所有buckets + $buckets = $cosClient->listBuckets(); + + //若bucket列表不为空则进行删除逻辑,先删除对象,再判断是否有上传的任务进行删除,最后删除桶 + if (!empty($buckets['Buckets'][0])) { + foreach ($buckets['Buckets'][0]['Bucket'] as $key => $value) { + $result = $cosClient->listObjects(array('Bucket' => $value['Name'])); + if (isset($result['Contents'])) { + foreach ($result['Contents'] as $content) { + $cosClient->deleteObject(array('Bucket' => $value['Name'], 'Key' => $content['Key'])); + } + } + while(True){ + $result = $cosClient->ListMultipartUploads( + array('Bucket' => $value['Name'])); + if ($result['Uploads'] == array()) { + break; + } + foreach ($result['Uploads'] as $upload) { + try { + $cosClient->AbortMultipartUpload( + array('Bucket' => $value['Name'], + 'Key' => $upload['Key'], + 'UploadId' => $upload['UploadId'])); + } catch (\Exception $e) { + print_r($e); + } + } + } + $cosClient->deleteBucket(array('Bucket' => $value['Name'])); + } + } + print_r('DELETE ALL BUCKETS SUCCEED!'); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/deleteFolder.php b/vendor/qcloud/cos-sdk-v5/sample/deleteFolder.php new file mode 100644 index 0000000..f771405 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/deleteFolder.php @@ -0,0 +1,48 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); + +$cos_path = "cos/folder"; +$nextMarker = ''; +$isTruncated = true; +while ( $isTruncated ) { + try { + $result = $cosClient->listObjects( + ['Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Delimiter' => '', + 'EncodingType' => 'url', + 'Marker' => $nextMarker, + 'Prefix' => $cos_path, + 'MaxKeys' => 1000] + ); + $isTruncated = $result['IsTruncated']; + $nextMarker = $result['NextMarker']; + foreach ( $result['Contents'] as $content ) { + $cos_file_path = $content['Key']; + $local_file_path = $content['Key']; + // 按照需求自定义拼接下载路径 + try { + $cosClient->deleteObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => $cos_file_path, + )); + echo ( $cos_file_path . "\n" ); + } catch ( \Exception $e ) { + echo( $e ); + } + } + } catch ( \Exception $e ) { + echo( $e ); + } +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/deleteObject.php b/vendor/qcloud/cos-sdk-v5/sample/deleteObject.php new file mode 100644 index 0000000..133667c --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/deleteObject.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->deleteObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/deleteObjectTagging.php b/vendor/qcloud/cos-sdk-v5/sample/deleteObjectTagging.php new file mode 100644 index 0000000..2d1ad16 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/deleteObjectTagging.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->deleteObjectTagging(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/detectAudio.php b/vendor/qcloud/cos-sdk-v5/sample/detectAudio.php new file mode 100644 index 0000000..5cba84f --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/detectAudio.php @@ -0,0 +1,54 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + // start --------------- 桶文件审核 ----------------- // + $result = $cosClient->detectAudio(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Input' => array( + 'Object' => 'sound01.mp3', +// 'DataId' => '', // 可选 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。 + ), +// 'Conf' => array( +// 'BizType' => '', // 可选 定制化策略 +// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 可选 若不传此参数,BizType为空时走默认策略,BizType不为空走定制化策略 +// 'Callback' => '', // 可选 回调URL +// 'CallbackVersion' => '', // 可选 回调内容的结构,有效值:Simple(回调内容包含基本信息)、Detail(回调内容包含详细信息)。默认为 Simple。 +// ), // 可选 走默认策略及默认审核场景。 + )); + // 请求成功 + print_r($result); + // end --------------- 桶文件审核 ----------------- // + + // start --------------- 音频文件地址审核 ----------------- // + $result = $cosClient->detectAudio(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Input' => array( + 'Url' => 'https://example.com/test.mp3', +// 'DataId' => '', // 可选 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。 + ), +// 'Conf' => array( +// 'BizType' => '', // 可选 定制化策略 +// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 可选 若不传此参数,BizType为空时走默认策略,BizType不为空走定制化策略 +// 'Callback' => '', // 可选 回调URL +// 'CallbackVersion' => '', // 可选 回调内容的结构,有效值:Simple(回调内容包含基本信息)、Detail(回调内容包含详细信息)。默认为 Simple。 +// ), // 可选 走默认策略及默认审核场景。 + )); + // 请求成功 + print_r($result); + // end --------------- 音频文件地址审核 ----------------- // +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/detectDocument.php b/vendor/qcloud/cos-sdk-v5/sample/detectDocument.php new file mode 100644 index 0000000..5d84675 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/detectDocument.php @@ -0,0 +1,50 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + // 存储桶文档审核 + $result = $cosClient->detectDocument(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Input' => array( + 'Object' => 'test01.docx', +// 'Type' => 'docx', +// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。 + ), +// 'Conf' => array( +// 'BizType' => '', +// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 选填,在只有BizType时走设定策略的审核场景 +// 'Callback' => '', // 回调URL 选填 +// ), // 选填 在DetectType/BizType都不传的情况下,走默认策略及默认审核场景。 + )); + + // 文档URL审核 + $result = $cosClient->detectDocument(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Input' => array( + 'Url' => 'https://example.com/test01.docx', +// 'Type' => 'docx', +// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。 + ), +// 'Conf' => array( +// 'BizType' => '', +// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 选填,在只有BizType时走设定策略的审核场景 +// 'Callback' => '', // 回调URL 选填 +// ), // 选填 在DetectType/BizType都不传的情况下,走默认策略及默认审核场景。 + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/detectImage.php b/vendor/qcloud/cos-sdk-v5/sample/detectImage.php new file mode 100644 index 0000000..58a21e9 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/detectImage.php @@ -0,0 +1,47 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials' => array( + 'secretId' => $secretId, + 'secretKey' => $secretKey))); +try { + //存储桶图片审核 + $result = $cosClient->detectImage(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'test.png', // 桶文件 + 'ci-process' => 'sensitive-content-recognition', +// 'BizType' => '', // 可选 定制化策略,不传走默认策略 +// 'DetectType' => 'porn,ads', // 可选 不填走默认策略 或 定制化策略,四种参数:porn,ads等,可使用多种规则,注意规则间不要加空格 +// 'Interval' => 5, // 可选 审核 GIF 时使用 截帧的间隔 +// 'MaxFrames' => 5, // 可选 针对 GIF 动图审核的最大截帧数量,需大于0。 + )); + // 请求成功 + print_r($result); + + + //图片链接审核 + $imgUrl = 'https://test.jpg'; + $result = $cosClient->detectImage(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => '/', // 链接图片资源路径写 / 即可 + 'ci-process' => 'sensitive-content-recognition', + 'DetectUrl' => $imgUrl, +// 'BizType' => '', // 可选 定制化策略,不传走默认策略 +// 'DetectType' => 'porn,ads', // 可选 不填走默认策略 或 定制化策略,四种参数:porn,ads等,可使用多种规则,注意规则间不要加空格 +// 'Interval' => 5, // 可选 审核 GIF 时使用 截帧的间隔 +// 'MaxFrames' => 5, // 可选 针对 GIF 动图审核的最大截帧数量,需大于0。 + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/detectImages.php b/vendor/qcloud/cos-sdk-v5/sample/detectImages.php new file mode 100644 index 0000000..b35024a --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/detectImages.php @@ -0,0 +1,42 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials' => array( + 'secretId' => $secretId, + 'secretKey' => $secretKey))); +try { + $result = $cosClient->detectImages(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Inputs' => array( + array( + 'Object' => 'test01.png', // 桶文件 +// 'Interval' => '', // 可选 审核 GIF 时使用 截帧的间隔 +// 'MaxFrames' => '', // 可选 针对 GIF 动图审核的最大截帧数量,需大于0。 +// 'DataId' => 'aaa', // 可选 图片标识,该字段在结果中返回原始内容,长度限制为512字节 + ), + array( + 'Url' => 'http://example.com/test.png', // 图片URL +// 'Interval' => 5, // 可选 审核 GIF 时使用 截帧的间隔 +// 'MaxFrames' => 5, // 可选 针对 GIF 动图审核的最大截帧数量,需大于0。 +// 'DataId' => 'bbb', // 可选 图片标识,该字段在结果中返回原始内容,长度限制为512字节 + ), + ), +// 'Conf' => array( +// 'BizType' => '' // 可选 定制化策略,不传走默认策略 +// 'DetectType' => 'Porn,Ads', // 可选 不填走默认策略 或 定制化策略,四种参数:Porn,Ads等,可使用多种规则,注意规则间不要加空格 +// ) // 可选 在DetectType/BizType都不传的情况下,走默认策略及默认审核场景。 + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/detectLable.php b/vendor/qcloud/cos-sdk-v5/sample/detectLable.php new file mode 100644 index 0000000..e0aa056 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/detectLable.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->DetectLabel(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/detectText.php b/vendor/qcloud/cos-sdk-v5/sample/detectText.php new file mode 100644 index 0000000..d8f6f12 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/detectText.php @@ -0,0 +1,71 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + // start --------------- 文本内容审核 ----------------- // + $content = '敏感词'; + $result = $cosClient->detectText(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Input' => array( + 'Content' => base64_encode($content), // 文本需base64_encode +// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。 + ), +// 'Conf' => array( +// 'DetectType' => 'Porn,Terrorism,Politics,Ads,Illegal,Abuse', // 选填,在只有BizType时走设定策略的审核场景 +// 'BizType' => '', +// ), // 非必选,在DetectType/BizType都不传的情况下,走默认策略及默认审核场景。 + )); + // 请求成功 + print_r($result); + // end --------------- 文本内容审核 ----------------- // + + // start --------------- 存储桶文本文件审核 ----------------- // + $result = $cosClient->detectText(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Input' => array( + 'Object' => 'test01.txt' +// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。 + ), +// 'Conf' => array( +// 'BizType' => '', +// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 选填,在只有BizType时走设定策略的审核场景 +// 'Callback' => '', // 回调URL 选填 +// 'CallbackVersion' => 'Detail', // 选填 Detail、Simple 默认为 Simple +// ), // 非必选,在DetectType/BizType都不传的情况下,走默认策略及默认审核场景。 + )); + // 请求成功 + print_r($result); + // end --------------- 存储桶文本文件审核 ----------------- // + + // start --------------- 文本文件Url审核 ----------------- // + $result = $cosClient->detectText(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Input' => array( + 'Url' => 'http://example.com/test.txt' +// 'DataId' => '', // 选填 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。 + ), +// 'Conf' => array( +// 'BizType' => '', +// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 选填,在只有BizType时走设定策略的审核场景 +// 'Callback' => '', // 选填 回调URL +// 'CallbackVersion' => 'Detail', // 选填 Detail、Simple 默认为 Simple +// ), // 非必选,在DetectType/BizType都不传的情况下,走默认策略及默认审核场景。 + )); + // 请求成功 + print_r($result); + // end --------------- 文本文件Url审核 ----------------- // +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/detectVideo.php b/vendor/qcloud/cos-sdk-v5/sample/detectVideo.php new file mode 100644 index 0000000..5810fc6 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/detectVideo.php @@ -0,0 +1,64 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + //存储桶视频审核 + $result = $cosClient->detectVideo(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Input' => array( + 'Object' => 'test.mp4', // 存储桶文件 +// 'DataId' => '', // 可选 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。 + ), + 'Conf' => array( +// 'BizType' => '', // 可选 定制化策略 +// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 可选 不传走默认策略或定制化策略 +// 'Callback' => '', // 可选 回调URL +// 'DetectContent' => 1, // 可选 用于指定是否审核视频声音,当值为0时:表示只审核视频画面截图;值为1时:表示同时审核视频画面截图和视频声音。默认值为0。 +// 'CallbackVersion' => 'Detail', // 可选 回调内容的结构,有效值:Simple(回调内容包含基本信息)、Detail(回调内容包含详细信息)。默认为 Simple。 + 'Snapshot' => array( +// 'Mode' => 'Average', // 可选 截帧模式,默认值为 Interval。Interval 表示间隔模式;Average 表示平均模式;Fps 表示固定帧率模式。 +// 'TimeInterval' => 50, // 可选 视频截帧频率 + 'Count' => '3', // 视频截帧数量 + ), + ), + )); + + //视频url审核 + $videoUrl = 'http://example.com/test.mp4'; + $result = $cosClient->detectVideo(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Input' => array( + 'Url' => $videoUrl, // 视频url +// 'DataId' => '', // 可选 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。 + ), + 'Conf' => array( +// 'BizType' => '', // 可选 定制化策略 +// 'DetectType' => 'Porn,Terrorism,Politics,Ads', // 可选 不传走默认策略或定制化策略 +// 'Callback' => '', // 可选 回调URL +// 'DetectContent' => 1, // 可选 用于指定是否审核视频声音,当值为0时:表示只审核视频画面截图;值为1时:表示同时审核视频画面截图和视频声音。默认值为0。 +// 'CallbackVersion' => 'Detail', // 可选 回调内容的结构,有效值:Simple(回调内容包含基本信息)、Detail(回调内容包含详细信息)。默认为 Simple。 + 'Snapshot' => array( +// 'Mode' => 'Average', // 可选 截帧模式,默认值为 Interval。Interval 表示间隔模式;Average 表示平均模式;Fps 表示固定帧率模式。 +// 'TimeInterval' => 50, // 可选 视频截帧频率 + 'Count' => '3', // 视频截帧数量 + ), + ), + )); + + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/detectVirus.php b/vendor/qcloud/cos-sdk-v5/sample/detectVirus.php new file mode 100644 index 0000000..5cc3747 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/detectVirus.php @@ -0,0 +1,44 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + // 存储桶文件查毒 + $result = $cosClient->detectVirus(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Input' => array( + 'Object' => 'test01.exe' + ), + 'Conf' => array( + 'DetectType' => 'Virus', +// 'Callback' => '', + ), + )); + + // URL查毒 + $result = $cosClient->detectVirus(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Input' => array( + 'Url' => 'https://example.com/test01.exe', + ), + 'Conf' => array( + 'DetectType' => 'Virus', +// 'Callback' => '', + ), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/detectWebpage.php b/vendor/qcloud/cos-sdk-v5/sample/detectWebpage.php new file mode 100644 index 0000000..cf38dbd --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/detectWebpage.php @@ -0,0 +1,33 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials' => array( + 'secretId' => $secretId, + 'secretKey' => $secretKey))); +try { + $result = $cosClient->detectWebpage(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Input' => array( + 'Url' => 'https://www.xxx.com/', +// 'DataId' => '' // 可选 该字段在审核结果中会返回原始内容,长度限制为512字节。您可以使用该字段对待审核的数据进行唯一业务标识。 + ), +// 'Conf' => array( +//// 'DetectType' => 'Porn,Ads', // 可选 不填走默认策略 +//// 'ReturnHighlightHtml' => 'true', // 可选 'true' 或者 'false' +//// 'Callback' => '', // 可选 +// ), // 可选 在DetectType/BizType都不传的情况下,走默认策略及默认审核场景。 + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/doesBucketExist.php b/vendor/qcloud/cos-sdk-v5/sample/doesBucketExist.php new file mode 100644 index 0000000..9c5641d --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/doesBucketExist.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->doesBucketExist( + 'examplebucket-125000000'//存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + ); ; + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/doesObjectExist.php b/vendor/qcloud/cos-sdk-v5/sample/doesObjectExist.php new file mode 100644 index 0000000..ff297c9 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/doesObjectExist.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->doesObjectExist( + 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'exampleobject' //对象名 + ); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/download.php b/vendor/qcloud/cos-sdk-v5/sample/download.php new file mode 100644 index 0000000..f266e92 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/download.php @@ -0,0 +1,38 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +$local_path = "/data/exampleobject"; + +$printbar = function($totalSize, $downloadedSize) { + printf("downloaded [%d/%d]\n", $downloadedSize, $totalSize); +}; + +try { + $result = $cosClient->download( + $bucket = 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + $key = 'exampleobject', + $saveAs = $local_path, + $options=['Progress' => $printbar, //指定进度条 + 'PartSize' => 10 * 1024 * 1024, //分块大小 + 'Concurrency' => 5, //并发数 + 'ResumableDownload' => true, //是否开启断点续传,默认为false + 'ResumableTaskFile' => 'tmp.cosresumabletask' //断点文件信息路径,默认为.cosresumabletask + ] + ); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/downloadFolder.php b/vendor/qcloud/cos-sdk-v5/sample/downloadFolder.php new file mode 100644 index 0000000..db91471 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/downloadFolder.php @@ -0,0 +1,52 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey + ) + ) +); +$cos_path = 'cos/folder'; +$nextMarker = ''; +$isTruncated = true; + +while ( $isTruncated ) { + try { + $result = $cosClient->listObjects( + ['Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Delimiter' => '', + 'EncodingType' => 'url', + 'Marker' => $nextMarker, + 'Prefix' => $cos_path, + 'MaxKeys' => 1000] + ); + } catch ( \Exception $e ) { + echo( $e ); + } + $isTruncated = $result['IsTruncated']; + $nextMarker = $result['NextMarker']; + foreach ( $result['Contents'] as $content ) { + $cos_file_path = $content['Key']; + $local_file_path = $content['Key']; + // 按照需求自定义拼接下载路径 + try { + $result = $cosClient->download( + $bucket = 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + $key = $cos_file_path, + $saveAs = $local_file_path + ); + echo ( $cos_file_path . "\n" ); + } catch ( \Exception $e ) { + echo( $e ); + } + } +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBlindWatermark.php b/vendor/qcloud/cos-sdk-v5/sample/getBlindWatermark.php new file mode 100644 index 0000000..d300fe5 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBlindWatermark.php @@ -0,0 +1,35 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +$local_path = "/data/exampleobject"; +try { + $blindWatermarkTemplate = new Qcloud\Cos\ImageParamTemplate\BlindWatermarkTemplate(); + $blindWatermarkTemplate->setPick(); + $blindWatermarkTemplate->setImage("http://examplebucket-125000000.cos.ap-beijing.myqcloud.com/shuiyin.jpeg"); + $blindWatermarkTemplate->setType(2); + $picOperationsTemplate = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation(); + $picOperationsTemplate->setIsPicInfo(1); + $picOperationsTemplate->addRule($blindWatermarkTemplate, "resultobject"); + $result = $cosClient->putObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Body' => fopen($local_path, 'rb'), + 'PicOperations' => $picOperationsTemplate->queryString(), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBucketAccelerate.php b/vendor/qcloud/cos-sdk-v5/sample/getBucketAccelerate.php new file mode 100644 index 0000000..bf4e1bc --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBucketAccelerate.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getBucketAccelerate(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBucketAcl.php b/vendor/qcloud/cos-sdk-v5/sample/getBucketAcl.php new file mode 100644 index 0000000..b37d93a --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBucketAcl.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getBucketAcl(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBucketCors.php b/vendor/qcloud/cos-sdk-v5/sample/getBucketCors.php new file mode 100644 index 0000000..405b63b --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBucketCors.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getBucketCors(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBucketDomain.php b/vendor/qcloud/cos-sdk-v5/sample/getBucketDomain.php new file mode 100644 index 0000000..6c74798 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBucketDomain.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getBucketDomain(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBucketGuetzli.php b/vendor/qcloud/cos-sdk-v5/sample/getBucketGuetzli.php new file mode 100644 index 0000000..145f331 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBucketGuetzli.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->GetBucketGuetzli(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBucketImageStyle.php b/vendor/qcloud/cos-sdk-v5/sample/getBucketImageStyle.php new file mode 100644 index 0000000..962c797 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBucketImageStyle.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->GetBucketImageStyle(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'StyleName' => 'stylename', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBucketInventory.php b/vendor/qcloud/cos-sdk-v5/sample/getBucketInventory.php new file mode 100644 index 0000000..87e78c5 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBucketInventory.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getBucketInvnetory(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Id' => 'string', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBucketLifecycle.php b/vendor/qcloud/cos-sdk-v5/sample/getBucketLifecycle.php new file mode 100644 index 0000000..0552591 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBucketLifecycle.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getBucketLifecycle(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBucketLogging.php b/vendor/qcloud/cos-sdk-v5/sample/getBucketLogging.php new file mode 100644 index 0000000..9b5b713 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBucketLogging.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getBucketLogging(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBucketReferer.php b/vendor/qcloud/cos-sdk-v5/sample/getBucketReferer.php new file mode 100644 index 0000000..48d52c5 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBucketReferer.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials' => array( + 'secretId' => $secretId, + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getBucketReferer(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + ) + ); + // 请求成功 + echo($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBucketTagging.php b/vendor/qcloud/cos-sdk-v5/sample/getBucketTagging.php new file mode 100644 index 0000000..e89a40a --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBucketTagging.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getBucketTagging(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getBucketWebsite.php b/vendor/qcloud/cos-sdk-v5/sample/getBucketWebsite.php new file mode 100644 index 0000000..8a31f5b --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getBucketWebsite.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getBucketWebsite(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getDescribeDocProcessJob.php b/vendor/qcloud/cos-sdk-v5/sample/getDescribeDocProcessJob.php new file mode 100644 index 0000000..fbfaf01 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getDescribeDocProcessJob.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->describeDocProcessJob(array( + 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'examplejobid', // JobId + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getDescribeDocProcessJobs.php b/vendor/qcloud/cos-sdk-v5/sample/getDescribeDocProcessJobs.php new file mode 100644 index 0000000..c3c53d8 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getDescribeDocProcessJobs.php @@ -0,0 +1,32 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getDescribeDocProcessJobs(array( + 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'QueueId' => 'pd8e422a2ea134165a92f2012ea43****', //拉取该队列 ID 下的任务 + 'Tag' => 'DocProcess', //任务的 Tag:DocProcess 固定值 +// 'NextToken' => '143486', //请求的上下文,用于翻页。上次返回的值 +// 'OrderByTime' => 'Desc', //Desc 或者 Asc。默认为 Desc +// 'Size' => 2, //拉取的最大任务数。默认为10。最大为100 +// 'States' => 'All', //拉取该状态的任务,以,分割,支持多状态:All、Submitted、Running、Success、Failed、Pause、Cancel。默认为 All。 +// 'StartCreationTime' => '2021-10-10T16:20:07+0800', //拉取创建时间大于该时间的任务 +// 'EndCreationTime' => '2021-10-10T16:20:07+0800', //拉取创建时间小于该时间的任务 + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getDescribeDocProcessQueues.php b/vendor/qcloud/cos-sdk-v5/sample/getDescribeDocProcessQueues.php new file mode 100644 index 0000000..4dcb405 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getDescribeDocProcessQueues.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->describeDocProcessQueues(array( + 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getDescribeMediaVoiceSeparateJob.php b/vendor/qcloud/cos-sdk-v5/sample/getDescribeMediaVoiceSeparateJob.php new file mode 100644 index 0000000..3b5fc7e --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getDescribeMediaVoiceSeparateJob.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->describeMediaVoiceSeparateJob(array( + 'Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'examplejobid', // JobId + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getDetectAudioResult.php b/vendor/qcloud/cos-sdk-v5/sample/getDetectAudioResult.php new file mode 100644 index 0000000..5c418c9 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getDetectAudioResult.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getDetectAudioResult(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => '', // jobId + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getDetectDocumentResult.php b/vendor/qcloud/cos-sdk-v5/sample/getDetectDocumentResult.php new file mode 100644 index 0000000..6d72ada --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getDetectDocumentResult.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getDetectDocumentResult(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => '', // jobId + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getDetectImageResult.php b/vendor/qcloud/cos-sdk-v5/sample/getDetectImageResult.php new file mode 100644 index 0000000..00036ab --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getDetectImageResult.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getDetectImageResult(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', // jobId + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getDetectTextResult.php b/vendor/qcloud/cos-sdk-v5/sample/getDetectTextResult.php new file mode 100644 index 0000000..c98fae6 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getDetectTextResult.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getDetectTextResult(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => '', // jobId + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getDetectVideoResult.php b/vendor/qcloud/cos-sdk-v5/sample/getDetectVideoResult.php new file mode 100644 index 0000000..a4c4d78 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getDetectVideoResult.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getDetectVideoResult(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => '', // jobId + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getDetectVirusResult.php b/vendor/qcloud/cos-sdk-v5/sample/getDetectVirusResult.php new file mode 100644 index 0000000..5c10a97 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getDetectVirusResult.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getDetectVirusResult(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => '', // jobId + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getDetectWebpageResult.php b/vendor/qcloud/cos-sdk-v5/sample/getDetectWebpageResult.php new file mode 100644 index 0000000..cd79585 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getDetectWebpageResult.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', // 审核时必须为https + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getDetectWebpageResult(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => '', // jobId + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getMediaInfo.php b/vendor/qcloud/cos-sdk-v5/sample/getMediaInfo.php new file mode 100644 index 0000000..28d328e --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getMediaInfo.php @@ -0,0 +1,29 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); + +try { + $result = $cosClient->GetMediaInfo( + array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' =>'exampleobject', //桶中的媒体文件,如test.mp4 + 'ci-process' => 'videoinfo' //操作类型,固定使用 videoinfo + ) + ); + // 请求成功 + echo($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getObject.php b/vendor/qcloud/cos-sdk-v5/sample/getObject.php new file mode 100644 index 0000000..6e7afda --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getObject.php @@ -0,0 +1,35 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'SaveAs' => '/data/exampleobject', + /* + 'Range' => 'bytes=0-10', + 'ResponseCacheControl' => 'string', + 'ResponseContentDisposition' => 'string', + 'ResponseContentEncoding' => 'string', + 'ResponseContentLanguage' => 'string', + 'ResponseContentType' => 'string', + 'ResponseExpires' => 'string', + */ + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getObjectSensitiveContentRecognition.php b/vendor/qcloud/cos-sdk-v5/sample/getObjectSensitiveContentRecognition.php new file mode 100644 index 0000000..adde2bf --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getObjectSensitiveContentRecognition.php @@ -0,0 +1,52 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials' => array( + 'secretId' => $secretId, + 'secretKey' => $secretKey))); +try { + /** + * 此接口已不再维护 2021.11.25 + * 图片审核建议使用 detectImage & detectImages 两个接口 + * 新增功能字段会在 detectImage & detectImages 接口维护 + */ + //存储桶图片审核 + $result = $cosClient->getObjectSensitiveContentRecognition(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'DetectType' => 'porn,politics', //可选四种参数:porn,politics,terrorist,ads,可使用多种规则,注意规则间不要加空格 + 'ci-process' => 'sensitive-content-recognition', +// 'Interval' => 5, // 审核gif时使用 截帧的间隔 +// 'MaxFrames' => 5, // 针对 GIF 动图审核的最大截帧数量,需大于0。 +// 'BizType' => '', // 审核策略 + )); + // 请求成功 + print_r($result); + + + //图片链接审核 + $imgUrl = 'https://test.jpg'; + $result = $cosClient->getObjectSensitiveContentRecognition(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => '/', // 链接图片资源路径写 / 即可 + 'DetectType' => 'porn,ads',//可选四种参数:porn,politics,terrorist,ads,可使用多种规则,注意规则间不要加空格 + 'DetectUrl' => $imgUrl, + 'ci-process' => 'sensitive-content-recognition', +// 'Interval' => 5, // 审核gif时使用 截帧的间隔 +// 'MaxFrames' => 5, // 针对 GIF 动图审核的最大截帧数量,需大于0。 +// 'BizType' => '', // 审核策略 + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getObjectTagging.php b/vendor/qcloud/cos-sdk-v5/sample/getObjectTagging.php new file mode 100644 index 0000000..8bb6023 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getObjectTagging.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials' => array( + 'secretId' => $secretId, + 'secretKey' => $secretKey))); +try { + $result = $cosClient->getObjectTagging(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject' + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getObjectUrl.php b/vendor/qcloud/cos-sdk-v5/sample/getObjectUrl.php new file mode 100644 index 0000000..823cbfa --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getObjectUrl.php @@ -0,0 +1,40 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials' => array( + 'secretId' => $secretId, + 'secretKey' => $secretKey + ) + ) +); +$local_path = "/data/exampleobject"; + +try { + $bucket = "examplebucket-1250000000"; //存储桶,存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + $key = "exampleobject"; //对象在存储桶中的位置,即对象键 + $signedUrl = $cosClient->getObjectUrl( + $bucket, + $key, + '+10 minutes', //签名的有效时间 + [ + 'ResponseContentDisposition' => '111', + 'Params' => [ // Params中可以传自定义querystring + 'aaa' => 'bbb', + 'ccc' => 'ddd' + ], + ] + ); + // 请求成功 + echo $signedUrl; +} catch (\Exception $e) { + // 请求失败 + print_r($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getObjectWithoutSign.php b/vendor/qcloud/cos-sdk-v5/sample/getObjectWithoutSign.php new file mode 100644 index 0000000..bc331f5 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getObjectWithoutSign.php @@ -0,0 +1,26 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials' => array( + 'secretId' => $secretId, + 'secretKey' => $secretKey))); + +try { + $bucket = 'examplebucket-125000000'; //存储桶,存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + $key = "exampleobject"; //对象在存储桶中的位置,即对象键 + $signedUrl = $cosClient -> getObjectUrlWithoutSign($bucket, $key); + + // 请求成功 + echo $signedUrl; +} catch (\Exception $e) { + // 请求失败 + print_r($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getPresignedUrl.php b/vendor/qcloud/cos-sdk-v5/sample/getPresignedUrl.php new file mode 100644 index 0000000..147cf68 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getPresignedUrl.php @@ -0,0 +1,30 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $signedUrl = $cosClient->getPresignedUrl( + $method='getObject', + $args=array( + 'Bucket'=>'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key'=>'exampleobject', + 'Body'=>'', + 'Params'=>array(), + 'Headers'=>array()), //若上传加入headers,content-md5写法为"content-md5" => base64_encode( md5( Body, true ) ) + $expires='+30 minutes'); + // 请求成功 + echo($signedUrl); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/getSnapshot.php b/vendor/qcloud/cos-sdk-v5/sample/getSnapshot.php new file mode 100644 index 0000000..68d928f --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/getSnapshot.php @@ -0,0 +1,41 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +$time = 3.14; +$local_path = "/data/exampleobject/test.jpg"; +try { + /* + * 如果访问400,media bucket unbinded, bucket's host is unavailable + * 请先在控制台开启媒体处理开关 + */ + $result = $cosClient->getSnapshot( + array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' =>'exampleobject', //桶中的媒体文件,如test.mp4 + 'ci-process' => 'snapshot', //操作类型,固定使用 snapshot + 'Time' => $time, //截图的时间点,单位为秒 + 'SaveAs' => $local_path, //本地保存路径 +// 'Width' => 0, +// 'Height' => 0, +// 'Format' => 'jpg', +// 'Rotate' => 'auto', +// 'Mode' => 'exactframe', + ) + ); + // 请求成功 + echo($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/headBucket.php b/vendor/qcloud/cos-sdk-v5/sample/headBucket.php new file mode 100644 index 0000000..ff1fd48 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/headBucket.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->headBucket(array( + 'Bucket' => 'examplebucket-125000000' //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/headObject.php b/vendor/qcloud/cos-sdk-v5/sample/headObject.php new file mode 100644 index 0000000..e5e8e8b --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/headObject.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->headObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/imageAve.php b/vendor/qcloud/cos-sdk-v5/sample/imageAve.php new file mode 100644 index 0000000..892bbcb --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/imageAve.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->ImageAve(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/imageExif.php b/vendor/qcloud/cos-sdk-v5/sample/imageExif.php new file mode 100644 index 0000000..a9973ce --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/imageExif.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->ImageExif(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/imageInfo.php b/vendor/qcloud/cos-sdk-v5/sample/imageInfo.php new file mode 100644 index 0000000..3166578 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/imageInfo.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->ImageInfo(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/imageMogr.php b/vendor/qcloud/cos-sdk-v5/sample/imageMogr.php new file mode 100644 index 0000000..435c12e --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/imageMogr.php @@ -0,0 +1,30 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $imageMogrTemplate = new Qcloud\Cos\ImageParamTemplate\ImageMogrTemplate(); + $imageMogrTemplate->thumbnailByScale(50); + $imageMogrTemplate->rotate(50); + $result = $cosClient->getObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'ImageHandleParam' => $imageMogrTemplate->queryString(), + 'SaveAs' => '/data/exampleobject', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/imageProcess.php b/vendor/qcloud/cos-sdk-v5/sample/imageProcess.php new file mode 100644 index 0000000..0b70b7e --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/imageProcess.php @@ -0,0 +1,31 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $imageMogrTemplate = new Qcloud\Cos\ImageParamTemplate\ImageMogrTemplate(); + $imageMogrTemplate->thumbnailByScale(50); + $picOperationsTemplate = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation(); + $picOperationsTemplate->setIsPicInfo(1); + $picOperationsTemplate->addRule($imageMogrTemplate, "resultobject"); + $result = $cosClient->ImageProcess(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'PicOperations' => $picOperationsTemplate->queryString(), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/imageView.php b/vendor/qcloud/cos-sdk-v5/sample/imageView.php new file mode 100644 index 0000000..7a9873c --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/imageView.php @@ -0,0 +1,32 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $imageViewTemplate = new Qcloud\Cos\ImageParamTemplate\ImageViewTemplate(); + $imageViewTemplate->setMode(1); + $imageViewTemplate->setWidth(400); + $imageViewTemplate->setHeight(600); + $imageViewTemplate->setQuality(1, 85); + $result = $cosClient->getObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'ImageHandleParam' => $imageViewTemplate->queryString(), + 'SaveAs' => '/data/exampleobject' + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/imageWatermark.php b/vendor/qcloud/cos-sdk-v5/sample/imageWatermark.php new file mode 100644 index 0000000..14a0b23 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/imageWatermark.php @@ -0,0 +1,33 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $imageWatermarkTemplate = new Qcloud\Cos\ImageParamTemplate\ImageWatermarkTemplate(); + $imageWatermarkTemplate->setImage("http://examplebucket-125000000.cos.ap-beijing.myqcloud.com/shuiyin.jpeg"); + $imageWatermarkTemplate->setGravity('center'); + $imageWatermarkTemplate->setDx(10); + $imageWatermarkTemplate->setDy(10); + $imageWatermarkTemplate->setSpcent(100); + $result = $cosClient->getObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'ImageHandleParam' => $imageWatermarkTemplate->queryString(), + 'SaveAs' => '/data/exampleobject' + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/listBuckets.php b/vendor/qcloud/cos-sdk-v5/sample/listBuckets.php new file mode 100644 index 0000000..3ed6de2 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/listBuckets.php @@ -0,0 +1,23 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); + +try { + $result = $cosClient->listBuckets(); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/listMultipartUploads.php b/vendor/qcloud/cos-sdk-v5/sample/listMultipartUploads.php new file mode 100644 index 0000000..dc1050e --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/listMultipartUploads.php @@ -0,0 +1,30 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->listMultipartUploads(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Delimiter' => '/', + 'EncodingType' => 'url', + 'KeyMarker' => 'string', + 'UploadIdMarker' => 'string', + 'Prefix' => 'prfix', + 'MaxUploads' => 1000, + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/listObjects.php b/vendor/qcloud/cos-sdk-v5/sample/listObjects.php new file mode 100644 index 0000000..562a98b --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/listObjects.php @@ -0,0 +1,29 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->listObjects(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Delimiter' => '/', //Delimiter表示分隔符, 设置为/表示列出当前目录下的object, 设置为空表示列出所有的object + 'EncodingType' => 'url',//编码格式,对应请求中的 encoding-type 参数 + 'Marker' => 'prefix/picture.jpg',//起始对象键标记 + 'Prefix' => 'prfix/', //Prefix表示列出的object的key以prefix开始 + 'MaxKeys' => 1000, // 设置最大遍历出多少个对象, 一次listObjects最大支持1000 + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/listParts.php b/vendor/qcloud/cos-sdk-v5/sample/listParts.php new file mode 100644 index 0000000..d0c1053 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/listParts.php @@ -0,0 +1,28 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->listParts(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'UploadId' => 'NWNhNDY0YzFfMmZiNTM1MGFfNTM2YV8xYjliMTg', + 'PartNumberMarker' => 1, + 'MaxParts' => 1000, + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/picOperations.php b/vendor/qcloud/cos-sdk-v5/sample/picOperations.php new file mode 100644 index 0000000..5d419b6 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/picOperations.php @@ -0,0 +1,33 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +$local_path = "/data/exampleobject"; +try { + $imageMogrTemplate = new Qcloud\Cos\ImageParamTemplate\ImageMogrTemplate(); + $imageMogrTemplate->thumbnailByScale(50); + $picOperationsTemplate = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation(); + $picOperationsTemplate->setIsPicInfo(0); + $picOperationsTemplate->addRule($imageMogrTemplate, "resultobject"); + $result = $cosClient->putObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Body' => fopen($local_path, 'rb'), + 'PicOperations' => $picOperationsTemplate->queryString(), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBlindWatermark.php b/vendor/qcloud/cos-sdk-v5/sample/putBlindWatermark.php new file mode 100644 index 0000000..872f9a9 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBlindWatermark.php @@ -0,0 +1,34 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +$local_path = "/data/exampleobject"; +try { + $blindWatermarkTemplate = new Qcloud\Cos\ImageParamTemplate\BlindWatermarkTemplate(); + $blindWatermarkTemplate->setText("Test"); + $blindWatermarkTemplate->setType(3); + $picOperationsTemplate = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation(); + $picOperationsTemplate->setIsPicInfo(1); + $picOperationsTemplate->addRule($blindWatermarkTemplate, "resultobject"); + $result = $cosClient->putObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Body' => fopen($local_path, 'rb'), + 'PicOperations' => $picOperationsTemplate->queryString(), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBucketAccelerate.php b/vendor/qcloud/cos-sdk-v5/sample/putBucketAccelerate.php new file mode 100644 index 0000000..791631a --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBucketAccelerate.php @@ -0,0 +1,25 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->putBucketAccelerate(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Status' => 'Enabled' + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBucketAcl.php b/vendor/qcloud/cos-sdk-v5/sample/putBucketAcl.php new file mode 100644 index 0000000..716ac8b --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBucketAcl.php @@ -0,0 +1,39 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->putBucketAcl(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'ACL' => 'private', + 'Grants' => array( + array( + 'Grantee' => array( + 'DisplayName' => 'qcs::cam::uin/100000000001:uin/100000000001', + 'ID' => 'qcs::cam::uin/100000000001:uin/100000000001', + 'Type' => 'CanonicalUser', + ), + 'Permission' => 'FULL_CONTROL', + ), + // ... repeated + ), + 'Owner' => array( + 'DisplayName' => 'qcs::cam::uin/3210232098:uin/3210232098', + 'ID' => 'qcs::cam::uin/3210232098:uin/3210232098', + ))); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBucketCors.php b/vendor/qcloud/cos-sdk-v5/sample/putBucketCors.php new file mode 100644 index 0000000..5ae60b5 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBucketCors.php @@ -0,0 +1,32 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->putBucketCors(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'CORSRules' => array( + array( + 'ID' => '1234', + 'AllowedHeaders' => array('*'), + 'AllowedMethods' => array('PUT'), + 'AllowedOrigins' => array('http://www.qq.com'), + ), + ), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBucketDomain.php b/vendor/qcloud/cos-sdk-v5/sample/putBucketDomain.php new file mode 100644 index 0000000..0431c4c --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBucketDomain.php @@ -0,0 +1,33 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->putBucketDomain(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'DomainRules' => array( + array( + 'Name' => 'www.qq.com', + 'Status' => 'ENABLED', + 'Type' => 'REST', + 'ForcedReplacement' => 'CNAME', + ), + // ... repeated + ), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBucketGuetzli.php b/vendor/qcloud/cos-sdk-v5/sample/putBucketGuetzli.php new file mode 100644 index 0000000..e7bcda4 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBucketGuetzli.php @@ -0,0 +1,24 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->PutBucketGuetzli(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBucketImageStyle.php b/vendor/qcloud/cos-sdk-v5/sample/putBucketImageStyle.php new file mode 100644 index 0000000..4df401b --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBucketImageStyle.php @@ -0,0 +1,26 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->PutBucketImageStyle(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'StyleName' => 'stylename', + 'StyleBody' => 'imageMogr2/thumbnail/!50px', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBucketInventory.php b/vendor/qcloud/cos-sdk-v5/sample/putBucketInventory.php new file mode 100644 index 0000000..8e6f48d --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBucketInventory.php @@ -0,0 +1,45 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->putBucketInventory(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Id' => 'string', + 'Destination' => array( + 'COSBucketDestination'=>array( + 'Format' => 'CSV', + 'AccountId' => '125000000', + 'Bucket' => 'qcs::cos:ap-chengdu::examplebucket-125000000', + 'Prefix' => 'string', + ) + ), + 'IsEnabled' => 'True', + 'Schedule' => array( + 'Frequency' => 'Daily', + ), + 'Filter' => array( + 'Prefix' => 'string', + ), + 'IncludedObjectVersions' => 'Current', + 'OptionalFields' => array( + 'Size', + 'ETag', + ) + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBucketLifecycle.php b/vendor/qcloud/cos-sdk-v5/sample/putBucketLifecycle.php new file mode 100644 index 0000000..8f3b963 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBucketLifecycle.php @@ -0,0 +1,44 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->putBucketLifecycle(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Rules' => array( + array( + 'Expiration' => array( + 'Days' => integer, + ), + 'ID' => 'string', + 'Filter' => array( + 'Prefix' => 'string' + ), + 'Status' => 'string', + 'Transitions' => array( + array( + 'Days' => integer, + 'StorageClass' => 'string' + ), + // ... repeated + ), + ), + // ... repeated + ) + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBucketLogging.php b/vendor/qcloud/cos-sdk-v5/sample/putBucketLogging.php new file mode 100644 index 0000000..0695959 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBucketLogging.php @@ -0,0 +1,28 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->putBucketLogging(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'LoggingEnabled' => array( + 'TargetBucket' => 'examplebucket2-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'TargetPrefix' => '', + ) + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBucketReferer.php b/vendor/qcloud/cos-sdk-v5/sample/putBucketReferer.php new file mode 100644 index 0000000..1de0687 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBucketReferer.php @@ -0,0 +1,35 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials' => array( + 'secretId' => $secretId, + 'secretKey' => $secretKey))); +try { + $result = $cosClient->putBucketReferer( + array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Status' => 'Enabled', //是否开启防盗链,枚举值:Enabled、Disabled + 'RefererType' => 'White-List', //防盗链类型,枚举值:Black-List、White-List + 'DomainList' => array( + 'Domains' => array( + '*.qq.com', + '*.qcloud.com', + ) + ), //生效域名列表 +// 'EmptyReferConfiguration' => 'Allow',//是否允许空 Referer 访问,枚举值:Allow、Deny,默认值为 Deny + ) + ); + // 请求成功 + echo($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBucketTagging.php b/vendor/qcloud/cos-sdk-v5/sample/putBucketTagging.php new file mode 100644 index 0000000..bf27b1e --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBucketTagging.php @@ -0,0 +1,32 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->putBucketTagging(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'TagSet' => array( + array('Key'=>'key1', + 'Value'=>'value1', + ), + array('Key'=>'key2', + 'Value'=>'value2', + ), + ), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putBucketWebsite.php b/vendor/qcloud/cos-sdk-v5/sample/putBucketWebsite.php new file mode 100644 index 0000000..96afb28 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putBucketWebsite.php @@ -0,0 +1,46 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); + +try { + $result = $cosClient->putBucketWebsite(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'IndexDocument' => array( + 'Suffix' => 'index.html', + ), + 'RedirectAllRequestsTo' => array( + 'Protocol' => 'https', + ), + 'ErrorDocument' => array( + 'Key' => 'Error.html', + ), + 'RoutingRules' => array( + array( + 'Condition' => array( + 'HttpErrorCodeReturnedEquals' => '405', + ), + 'Redirect' => array( + 'Protocol' => 'https', + 'ReplaceKeyWith' => '404.html', + ), + ), + // ... repeated + ), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putImageStyle.php b/vendor/qcloud/cos-sdk-v5/sample/putImageStyle.php new file mode 100644 index 0000000..dfa021f --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putImageStyle.php @@ -0,0 +1,33 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +$local_path = "/data/exampleobject"; +try { + $imageStyleTemplate = new Qcloud\Cos\ImageParamTemplate\ImageStyleTemplate(); + $imageStyleTemplate->setStyle("stylename"); + $picOperationsTemplate = new \Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation(); + $picOperationsTemplate->setIsPicInfo(1); + $picOperationsTemplate->addRule($imageStyleTemplate, "resultobject"); + $result = $cosClient->putObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Body' => fopen($local_path, 'rb'), + 'PicOperations' => $picOperationsTemplate->queryString(), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putObject.php b/vendor/qcloud/cos-sdk-v5/sample/putObject.php new file mode 100644 index 0000000..56860c9 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putObject.php @@ -0,0 +1,48 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +$local_path = "/data/exampleobject"; +//添加tagging +/*$tagSet = http_build_query( array( + urlencode("key1") => urlencode("value1"), + urlencode("key2") => urlencode("value2")), + '', + '&' +); */ +try { + $result = $cosClient->putObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Body' => fopen($local_path, 'rb'), + /* + 'CacheControl' => 'string', + 'ContentDisposition' => 'string', + 'ContentEncoding' => 'string', + 'ContentLanguage' => 'string', + 'ContentLength' => integer, + 'ContentType' => 'string', + 'Expires' => 'string', + 'Metadata' => array( + 'string' => 'string', + ), + 'StorageClass' => 'string', + 'Tagging' => $tagSet //最多10个标签 + */ + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putObjectTagging.php b/vendor/qcloud/cos-sdk-v5/sample/putObjectTagging.php new file mode 100644 index 0000000..4fe22ed --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putObjectTagging.php @@ -0,0 +1,33 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->putObjectTagging(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'TagSet' => array( + array('Key'=>'key1', + 'Value'=>'value1', + ), + array('Key'=>'key2', + 'Value'=>'value2', + ), + ), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo "$e\n"; +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/putQrcode.php b/vendor/qcloud/cos-sdk-v5/sample/putQrcode.php new file mode 100644 index 0000000..1951ada --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/putQrcode.php @@ -0,0 +1,33 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +$local_path = "/data/exampleobject"; +try { + $imageQrcodeTemplate = new Qcloud\Cos\ImageParamTemplate\ImageQrcodeTemplate(); + $imageQrcodeTemplate->setMode(0); + $picOperationsTemplate = new Qcloud\Cos\ImageParamTemplate\PicOperationsTransformation(); + $picOperationsTemplate->setIsPicInfo(1); + $picOperationsTemplate->addRule($imageQrcodeTemplate, "resultobject"); + $result = $cosClient->putObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Body' => fopen($local_path, 'rb'), + 'PicOperations' => $picOperationsTemplate->queryString(), + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/qrcode.php b/vendor/qcloud/cos-sdk-v5/sample/qrcode.php new file mode 100644 index 0000000..0f35466 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/qrcode.php @@ -0,0 +1,26 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->Qrcode(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Cover' => 0, + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/qrcodeGenerate.php b/vendor/qcloud/cos-sdk-v5/sample/qrcodeGenerate.php new file mode 100644 index 0000000..16fd8d5 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/qrcodeGenerate.php @@ -0,0 +1,27 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->QrcodeGenerate(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'QrcodeContent' => '', + 'QrcodeMode' => 0, + 'QrcodeWidth' => '200', + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/restoreObject.php b/vendor/qcloud/cos-sdk-v5/sample/restoreObject.php new file mode 100644 index 0000000..cfe0880 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/restoreObject.php @@ -0,0 +1,29 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->restoreObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Days' => integer, + 'CASJobParameters' => array( + 'Tier' =>'string' + ) + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/selectObjectContent.php b/vendor/qcloud/cos-sdk-v5/sample/selectObjectContent.php new file mode 100644 index 0000000..c9b8de2 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/selectObjectContent.php @@ -0,0 +1,85 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey + ) +)); +try { + $result = $cosClient->selectObjectContent(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Expression' => 'Select * from COSObject s', + 'ExpressionType' => 'SQL', + 'InputSerialization' => array( + 'CompressionType' => 'None', + 'CSV' => array( + 'FileHeaderInfo' => 'NONE', + 'RecordDelimiter' => '\n', + 'FieldDelimiter' => ',', + 'QuoteEscapeCharacter' => '"', + 'Comments' => '#', + 'AllowQuotedRecordDelimiter' => 'FALSE' + ) + ), + 'OutputSerialization' => array( + 'CSV' => array( + 'QuoteField' => 'ASNEEDED', + 'RecordDelimiter' => '\n', + 'FieldDelimiter' => ',', + 'QuoteCharacter' => '"', + 'QuoteEscapeCharacter' => '"' + ) + ), + 'RequestProgress' => array( + 'Enabled' => 'FALSE' + ) + )); + // 请求成功 + foreach ($result['Data'] as $data) { + // 迭代遍历select结果 + print_r($data); + } +} catch (\Exception $e) { + // 请求失败 + echo($e); +} + +try { + $result = $cosClient->selectObjectContent(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Expression' => 'Select * from COSObject s', + 'ExpressionType' => 'SQL', + 'InputSerialization' => array( + 'CompressionType' => 'None', + 'JSON' => array( + 'Type' => 'DOCUMENT' + ) + ), + 'OutputSerialization' => array( + 'JSON' => array( + 'RecordDelimiter' => '\n', + ) + ), + 'RequestProgress' => array( + 'Enabled' => 'FALSE' + ) + )); + // 请求成功 + foreach ($result['Data'] as $data) { + // 迭代遍历select结果 + print_r($data); + } +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/textWatermark.php b/vendor/qcloud/cos-sdk-v5/sample/textWatermark.php new file mode 100644 index 0000000..f8ef0a8 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/textWatermark.php @@ -0,0 +1,31 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $textWatermarkTemplate = new Qcloud\Cos\ImageParamTemplate\TextWatermarkTemplate(); + $textWatermarkTemplate->setText("testetst"); + $textWatermarkTemplate->setGravity('center'); + $textWatermarkTemplate->setFontsize(30); + $result = $cosClient->getObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'ImageHandleParam' => $textWatermarkTemplate->queryString(), + 'SaveAs' => '/data/exampleobject' + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/trafficLimit.php b/vendor/qcloud/cos-sdk-v5/sample/trafficLimit.php new file mode 100644 index 0000000..9bc8b1d --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/trafficLimit.php @@ -0,0 +1,40 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); + +$local_path = '/data/exampleobject'; +try { + //上传对象,单链接限速 + $result = $cosClient->putObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Body' => fopen($local_path, 'rb'), + 'TrafficLimit' => 8 * 1024 * 1024 // 限制为1MB/s + )); + // 请求成功 + print_r($result); + + //下载对象,单链接限速 + $result = $cosClient->getObject(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'SaveAs' => $local_path, + 'TrafficLimit' => 8 * 1024 * 1024 // 限制为1MB/s + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/upload.php b/vendor/qcloud/cos-sdk-v5/sample/upload.php new file mode 100644 index 0000000..1c92698 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/upload.php @@ -0,0 +1,56 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +$local_path = "/data/exampleobject"; + +$printbar = function($totalSize, $uploadedSize) { + printf("uploaded [%d/%d]\n", $uploadedSize, $totalSize); +}; + +try { + $result = $cosClient->upload( + $bucket = 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + $key = 'exampleobject', + $body = fopen($local_path, 'rb') + /* + $options = array( + 'ACL' => 'string', + 'CacheControl' => 'string', + 'ContentDisposition' => 'string', + 'ContentEncoding' => 'string', + 'ContentLanguage' => 'string', + 'ContentLength' => integer, + 'ContentType' => 'string', + 'Expires' => 'string', + 'GrantFullControl' => 'string', + 'GrantRead' => 'string', + 'GrantWrite' => 'string', + 'Metadata' => array( + 'string' => 'string', + ), + 'ContentMD5' => 'string', + 'ServerSideEncryption' => 'string', + 'StorageClass' => 'string', //存储类型 + 'Progress' => $printbar, //指定进度条 + 'PartSize' => 10 * 1024 * 1024, //分块大小 + 'Concurrency' => 5 //并发数 + ) + */ + ); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/sample/uploadFolder.php b/vendor/qcloud/cos-sdk-v5/sample/uploadFolder.php new file mode 100644 index 0000000..3885f7d --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/uploadFolder.php @@ -0,0 +1,42 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey + ) + ) +); + +function uploadfiles( $path, $cosClient ) { + foreach ( scandir( $path ) as $afile ) { + if ( $afile == '.' || $afile == '..' ) continue; + if ( is_dir( $path.'/'.$afile ) ) { + uploadfiles( $path.'/'.$afile, $cosClient ); + } else { + $local_file_path = $path.'/'.$afile; + $cos_file_path = $local_file_path; + // 按照需求自定义拼接上传路径 + try { + $cosClient->upload( + $bucket = 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + $key = $cos_file_path, + $body = fopen( $cos_file_path, 'rb' ) + ); + } catch ( \Exception $e ) { + echo( $e ); + } + } + } +} + +$local_path = '/data/home/folder'; +uploadfiles( $local_path, $cosClient ); diff --git a/vendor/qcloud/cos-sdk-v5/sample/uploadPart.php b/vendor/qcloud/cos-sdk-v5/sample/uploadPart.php new file mode 100644 index 0000000..b1709cc --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/sample/uploadPart.php @@ -0,0 +1,30 @@ + $region, + 'schema' => 'https', //协议头部,默认为http + 'credentials'=> array( + 'secretId' => $secretId , + 'secretKey' => $secretKey))); +try { + $result = $cosClient->uploadPart(array( + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket + 'Key' => 'exampleobject', + 'Body' => 'string', + 'UploadId' => 'NWNhNDY0YzFfMmZiNTM1MGFfNTM2YV8xYjliMTg', + 'PartNumber' => 1, + 'ContentMD5' => 'string', + 'ContentLength' => 100, + )); + // 请求成功 + print_r($result); +} catch (\Exception $e) { + // 请求失败 + echo($e); +} diff --git a/vendor/qcloud/cos-sdk-v5/src/Client.php b/vendor/qcloud/cos-sdk-v5/src/Client.php new file mode 100644 index 0000000..3d7a7f2 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/Client.php @@ -0,0 +1,490 @@ +rawCosConfig = $cosConfig; + $this->cosConfig['schema'] = isset($cosConfig['schema']) ? $cosConfig['schema'] : 'http'; + $this->cosConfig['region'] = isset($cosConfig['region']) ? region_map($cosConfig['region']) : null; + $this->cosConfig['appId'] = isset($cosConfig['credentials']['appId']) ? $cosConfig['credentials']['appId'] : null; + $this->cosConfig['secretId'] = isset($cosConfig['credentials']['secretId']) ? trim($cosConfig['credentials']['secretId']) : ''; + $this->cosConfig['secretKey'] = isset($cosConfig['credentials']['secretKey']) ? trim($cosConfig['credentials']['secretKey']) : ''; + $this->cosConfig['anonymous'] = isset($cosConfig['credentials']['anonymous']) ? $cosConfig['credentials']['anonymous'] : false; + $this->cosConfig['token'] = isset($cosConfig['credentials']['token']) ? trim($cosConfig['credentials']['token']) : null; + $this->cosConfig['timeout'] = isset($cosConfig['timeout']) ? $cosConfig['timeout'] : 3600; + $this->cosConfig['connect_timeout'] = isset($cosConfig['connect_timeout']) ? $cosConfig['connect_timeout'] : 3600; + $this->cosConfig['ip'] = isset($cosConfig['ip']) ? $cosConfig['ip'] : null; + $this->cosConfig['port'] = isset($cosConfig['port']) ? $cosConfig['port'] : null; + $this->cosConfig['endpoint'] = isset($cosConfig['endpoint']) ? $cosConfig['endpoint'] : null; + $this->cosConfig['domain'] = isset($cosConfig['domain']) ? $cosConfig['domain'] : null; + $this->cosConfig['proxy'] = isset($cosConfig['proxy']) ? $cosConfig['proxy'] : null; + $this->cosConfig['retry'] = isset($cosConfig['retry']) ? $cosConfig['retry'] : 1; + $this->cosConfig['userAgent'] = isset($cosConfig['userAgent']) ? $cosConfig['userAgent'] : 'cos-php-sdk-v5.'. Client::VERSION; + $this->cosConfig['pathStyle'] = isset($cosConfig['pathStyle']) ? $cosConfig['pathStyle'] : false; + $this->cosConfig['signHost'] = isset($cosConfig['signHost']) ? $cosConfig['signHost'] : true; + $this->cosConfig['allow_redirects'] = isset($cosConfig['allow_redirects']) ? $cosConfig['allow_redirects'] : false; + $this->cosConfig['allow_accelerate'] = isset($cosConfig['allow_accelerate']) ? $cosConfig['allow_accelerate'] : false; + + // check config + $this->inputCheck(); + + $service = Service::getService(); + $handler = HandlerStack::create(); + $handler->push(Middleware::retry($this->retryDecide(), $this->retryDelay())); + $handler->push(Middleware::mapRequest(function (RequestInterface $request) { + return $request->withHeader('User-Agent', $this->cosConfig['userAgent']); + })); + if ($this->cosConfig['anonymous'] != true) { + $handler->push($this::handleSignature($this->cosConfig['secretId'], $this->cosConfig['secretKey'], $this->cosConfig['signHost'])); + } + if ($this->cosConfig['token'] != null) { + $handler->push(Middleware::mapRequest(function (RequestInterface $request) { + return $request->withHeader('x-cos-security-token', $this->cosConfig['token']); + })); + } + $handler->push($this::handleErrors()); + $this->signature = new Signature($this->cosConfig['secretId'], $this->cosConfig['secretKey'], $this->cosConfig, $this->cosConfig['token']); + $area = $this->cosConfig['allow_accelerate'] ? 'accelerate' : $this->cosConfig['region']; + $this->httpClient = new HttpClient([ + 'base_uri' => "{$this->cosConfig['schema']}://cos.{$area}.myqcloud.com/", + 'timeout' => $this->cosConfig['timeout'], + 'handler' => $handler, + 'proxy' => $this->cosConfig['proxy'], + 'allow_redirects' => $this->cosConfig['allow_redirects'] + ]); + $this->desc = new Description($service); + $this->api = (array) $this->desc->getOperations(); + parent::__construct($this->httpClient, $this->desc, [$this, + 'commandToRequestTransformer'], [$this, 'responseToResultTransformer'], + null); + } + + public function inputCheck() { + $message = null; + //检查Region + if (empty($this->cosConfig['region']) && + empty($this->cosConfig['domain']) && + empty($this->cosConfig['endpoint']) && + empty($this->cosConfig['ip'])) { + $message = 'Region is empty'; + } + //检查Secret + if (empty($this->cosConfig['secretId']) || empty($this->cosConfig['secretKey'])) { + $message = 'Secret is empty'; + } + if ($message !== null) { + $e = new Exception\CosException($message); + $e->setExceptionCode('Invalid Argument'); + throw $e; + } + } + + + public function retryDecide() { + return function ( + $retries, + RequestInterface $request, + ResponseInterface $response = null, + \Exception $exception = null + ) { + if ($retries >= $this->cosConfig['retry']) { + return false; + } + if ($response != null && $response->getStatusCode() >= 400 ) { + return true; + } + if ($exception instanceof Exception\ServiceResponseException) { + if ($exception->getStatusCode() >= 400) { + return true; + } + } + + if ($exception instanceof ConnectException) { + return true; + } + + return false; + }; + } + + public function retryDelay() { + return function ($numberOfRetries) { + return 1000 * $numberOfRetries; + }; + } + + public function commandToRequestTransformer(CommandInterface $command) + { + $this->action = $command->GetName(); + $this->operation = $this->api[$this->action]; + $transformer = new CommandToRequestTransformer($this->cosConfig, $this->operation); + $seri = new Serializer($this->desc); + $request = $seri($command); + $request = $transformer->bucketStyleTransformer($command, $request); + $request = $transformer->uploadBodyTransformer($command, $request); + $request = $transformer->metadataTransformer($command, $request); + $request = $transformer->queryStringTransformer($command, $request); + $request = $transformer->headerTransformer($command, $request); + $request = $transformer->md5Transformer($command, $request); + $request = $transformer->specialParamTransformer($command, $request); + $request = $transformer->ciParamTransformer($command, $request); + $request = $transformer->cosDomain2CiTransformer($command, $request); + return $request; + } + + public function responseToResultTransformer(ResponseInterface $response, RequestInterface $request, CommandInterface $command) + { + $transformer = new ResultTransformer($this->cosConfig, $this->operation); + $transformer->writeDataToLocal($command, $request, $response); + $deseri = new Deserializer($this->desc, true); + $result = $deseri($response, $request, $command); + + $result = $transformer->metaDataTransformer($command, $response, $result); + $result = $transformer->extraHeadersTransformer($command, $request, $result); + $result = $transformer->selectContentTransformer($command, $result); + $result = $transformer->ciContentInfoTransformer($command, $result); + return $result; + } + + public function __destruct() { + } + + public function __call($method, array $args) { + try { + $rt = parent::__call(ucfirst($method), $args); + return $rt; + } catch (\Exception $e) { + $previous = $e->getPrevious(); + if ($previous !== null) { + throw $previous; + } else { + throw $e; + } + } + } + + public function getApi() { + return $this->api; + } + + private function getCosConfig() { + return $this->cosConfig; + } + + private function createPresignedUrl(RequestInterface $request, $expires) { + return $this->signature->createPresignedUrl($request, $expires); + } + + public function getPresignedUrl($method, $args, $expires = "+30 minutes") { + $command = $this->getCommand($method, $args); + $request = $this->commandToRequestTransformer($command); + return $this->createPresignedUrl($request, $expires); + } + + + public function getObjectUrl($bucket, $key, $expires = "+30 minutes", array $args = array()) { + $command = $this->getCommand('GetObject', $args + array('Bucket' => $bucket, 'Key' => $key)); + $request = $this->commandToRequestTransformer($command); + return $this->createPresignedUrl($request, $expires)->__toString(); + } + + public function getObjectUrlWithoutSign($bucket, $key, array $args = array()) { + $command = $this->getCommand('GetObject', $args + array('Bucket' => $bucket, 'Key' => $key)); + $request = $this->commandToRequestTransformer($command); + return $request->getUri()-> __toString(); + } + + public function upload($bucket, $key, $body, $options = array()) { + $body = Psr7\Utils::streamFor($body); + $options['Retry'] = $this->cosConfig['retry']; + $options['PartSize'] = isset($options['PartSize']) ? $options['PartSize'] : MultipartUpload::DEFAULT_PART_SIZE; + if ($body->getSize() < $options['PartSize']) { + $rt = $this->putObject(array( + 'Bucket' => $bucket, + 'Key' => $key, + 'Body' => $body, + ) + $options); + } + else { + $multipartUpload = new MultipartUpload($this, $body, array( + 'Bucket' => $bucket, + 'Key' => $key, + ) + $options); + + $rt = $multipartUpload->performUploading(); + } + return $rt; + } + + public function download($bucket, $key, $saveAs, $options = array()) { + $options['PartSize'] = isset($options['PartSize']) ? $options['PartSize'] : RangeDownload::DEFAULT_PART_SIZE; + $contentLength = 0; + $versionId = isset($options['VersionId']) ? $options['VersionId'] : ''; + + $rt = $this->headObject(array( + 'Bucket'=>$bucket, + 'Key'=>$key, + 'VersionId'=>$versionId, + ) + ); + $contentLength = $rt['ContentLength']; + $resumableJson = [ + 'LastModified' => $rt['LastModified'], + 'ContentLength' => $rt['ContentLength'], + 'ETag' => $rt['ETag'], + 'Crc64ecma' => $rt['Crc64ecma'] + ]; + $options['ResumableJson'] = $resumableJson; + + if ($contentLength < $options['PartSize']) { + $rt = $this->getObject(array( + 'Bucket' => $bucket, + 'Key' => $key, + 'SaveAs' => $saveAs, + ) + $options); + } else { + $rangeDownload = new RangeDownload($this, $contentLength, $saveAs, array( + 'Bucket' => $bucket, + 'Key' => $key, + ) + $options); + + $rt = $rangeDownload->performDownloading(); + } + return $rt; + } + + public function resumeUpload($bucket, $key, $body, $uploadId, $options = array()) { + $body = Psr7\Utils::streamFor($body); + $options['PartSize'] = isset($options['PartSize']) ? $options['PartSize'] : MultipartUpload::DEFAULT_PART_SIZE; + $multipartUpload = new MultipartUpload($this, $body, array( + 'Bucket' => $bucket, + 'Key' => $key, + 'UploadId' => $uploadId, + ) + $options); + + $rt = $multipartUpload->resumeUploading(); + return $rt; + } + + public function copy($bucket, $key, $copySource, $options = array()) { + + $options['PartSize'] = isset($options['PartSize']) ? $options['PartSize'] : Copy::DEFAULT_PART_SIZE; + + // set copysource client + $sourceConfig = $this->rawCosConfig; + $sourceConfig['region'] = $copySource['Region']; + $cosSourceClient = new Client($sourceConfig); + $copySource['VersionId'] = isset($copySource['VersionId']) ? $copySource['VersionId'] : ''; + + $rt = $cosSourceClient->headObject( + array('Bucket'=>$copySource['Bucket'], + 'Key'=>$copySource['Key'], + 'VersionId'=>$copySource['VersionId'], + ) + ); + + $contentLength = $rt['ContentLength']; + // sample copy + if ($contentLength < $options['PartSize']) { + $rt = $this->copyObject(array( + 'Bucket' => $bucket, + 'Key' => $key, + 'CopySource' => "{$copySource['Bucket']}.cos.{$copySource['Region']}.myqcloud.com/". urlencode("{$copySource['Key']}")."?versionId={$copySource['VersionId']}", + ) + $options + ); + return $rt; + } + // multi part copy + $copySource['ContentLength'] = $contentLength; + $copy = new Copy($this, $copySource, array( + 'Bucket' => $bucket, + 'Key' => $key + ) + $options + ); + return $copy->copy(); + } + + public function doesBucketExist($bucket, array $options = array()) + { + try { + $this->HeadBucket(array( + 'Bucket' => $bucket)); + return true; + } catch (\Exception $e){ + return false; + } + } + + public function doesObjectExist($bucket, $key, array $options = array()) + { + try { + $this->HeadObject(array( + 'Bucket' => $bucket, + 'Key' => $key)); + return true; + } catch (\Exception $e){ + return false; + } + } + + public static function explodeKey($key) { + // Remove a leading slash if one is found + $split_key = explode('/', $key && $key[0] == '/' ? substr($key, 1) : $key); + // Remove empty element + $split_key = array_filter($split_key, function($var) { + return !($var == '' || $var == null); + }); + $final_key = implode("/", $split_key); + if (substr($key, -1) == '/') { + $final_key = $final_key . '/'; + } + return $final_key; + } + + + public static function handleSignature($secretId, $secretKey, $signHost) { + return function (callable $handler) use ($secretId, $secretKey, $signHost) { + return new SignatureMiddleware($handler, $secretId, $secretKey, $signHost); + }; + } + + public static function handleErrors() { + return function (callable $handler) { + return new ExceptionMiddleware($handler); + }; + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/CommandToRequestTransformer.php b/vendor/qcloud/cos-sdk-v5/src/CommandToRequestTransformer.php new file mode 100644 index 0000000..ce5b970 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/CommandToRequestTransformer.php @@ -0,0 +1,296 @@ +config = $config; + $this->operation = $operation; + } + + // format bucket style + + public function bucketStyleTransformer( CommandInterface $command, RequestInterface $request ) { + $action = $command->getName(); + if ($action == 'ListBuckets') { + $uri = "service.cos.myqcloud.com"; + + if ($this->config['endpoint'] != null) { + $uri = $this->config['endpoint']; + } + if ($this->config['domain'] != null) { + $uri = $this->config['domain']; + } + if ($this->config['ip'] != null) { + $uri = $this->config['ip']; + if ($this->config['port'] != null) { + $uri = $this->config['ip'] . ":" . $this->config['port']; + } + } + return $request->withUri(new Uri($this->config['schema']."://". $uri. "/")); + } + $operation = $this->operation; + $bucketname = $command['Bucket']; + + $appId = $this->config['appId']; + if ( $appId != null && endWith( $bucketname, '-'.$appId ) == False ) { + $bucketname = $bucketname.'-'.$appId; + } + $command['Bucket'] = $bucketname; + $path = ''; + + $http_method = $operation['httpMethod']; + $uri = $operation['uri']; + + // Hoststyle is used by default + // Pathstyle + if ( $this->config['pathStyle'] != true ) { + if ( isset( $operation['parameters']['Bucket'] ) && $command->hasParam( 'Bucket' ) ) { + $uri = str_replace( '{Bucket}', '', $uri ); + } + + if ( isset( $operation['parameters']['Key'] ) && $command->hasParam( 'Key' ) ) { + $uri = str_replace( '{/Key*}', encodeKey( $command['Key'] ), $uri ); + } + } + + if ($this->config['endpoint'] == null) { + $this->config['endpoint'] = "myqcloud.com"; + } + + $domain_type = '.cos.'; + if ($action == 'PutBucketImageStyle' || $action == 'GetBucketImageStyle' || $action == 'DeleteBucketImageStyle' + || $action == 'PutBucketGuetzli' || $action == 'GetBucketGuetzli' || $action == 'DeleteBucketGuetzli') { + $domain_type = '.pic.'; + } + + $origin_host = $this->config['allow_accelerate'] ? + $bucketname . $domain_type . 'accelerate' . '.' . $this->config['endpoint'] : + $bucketname . $domain_type . $this->config['region'] . '.' . $this->config['endpoint']; + + // domain + if ( $this->config['domain'] != null ) { + $origin_host = $this->config['domain']; + } + $host = $origin_host; + if ( $this->config['ip'] != null ) { + $host = $this->config['ip']; + if ( $this->config['port'] != null ) { + $host = $this->config['ip'] . ':' . $this->config['port']; + } + } + + $path = $this->config['schema'].'://'. $host . $uri; + $uri = new Uri( $path ); + $query = $request->getUri()->getQuery(); + if ( $uri->getQuery() != $query && $uri->getQuery() != '' ) { + $query = $uri->getQuery() . '&' . $request->getUri()->getQuery(); + } + $uri = $uri->withQuery( $query ); + $request = $request->withUri( $uri ); + $request = $request->withHeader( 'Host', $origin_host ); + return $request; + } + + // format upload body + + public function uploadBodyTransformer( CommandInterface $command, $request, $bodyParameter = 'Body', $sourceParameter = 'SourceFile' ) { + + $operation = $this->operation; + if ( !isset( $operation['parameters']['Body'] ) ) { + return $request; + } + $source = isset( $command[$sourceParameter] ) ? $command[$sourceParameter] : null; + $body = isset( $command[$bodyParameter] ) ? $command[$bodyParameter] : null; + // If a file path is passed in then get the file handle + if ( is_string( $source ) && file_exists( $source ) ) { + $body = fopen( $source, 'rb' ); + } + // Prepare the body parameter and remove the source file parameter + if ( null !== $body ) { + return $request; + } else { + throw new InvalidArgumentException( + "You must specify a non-null value for the {$bodyParameter} or {$sourceParameter} parameters." ); + } + } + + // update md5 + + public function md5Transformer( CommandInterface $command, $request ) { + $operation = $this->operation; + if ( isset( $operation['data']['contentMd5'] ) ) { + $request = $this->addMd5( $request ); + } + if ( isset( $operation['parameters']['ContentMD5'] ) && + isset( $command['ContentMD5'] ) ) { + $value = $command['ContentMD5']; + if ( $value != false ) { + $request = $this->addMd5( $request ); + } + } + + return $request; + } + + // add Query string + + public function queryStringTransformer( CommandInterface $command, $request ) { + $operation = $this->operation; + if ( isset( $command['Params'] ) ) { + $params = $command['Params']; + foreach ( $params as $key => $value ) { + $uri = $request->getUri(); + $query = $uri->getQuery(); + $uri = $uri->withQuery($query. "&" . urlencode($key) . "=" . $value ); + $request = $request->withUri( $uri ); + } + } + + return $request; + } + + // add Header string + + public function headerTransformer( CommandInterface $command, $request ) { + $operation = $this->operation; + if ( isset( $command['Headers'] ) ) { + $headers = $command['Headers']; + foreach ( $headers as $key => $value ) { + $request = $request->withHeader( $key, $value); + } + } + return $request; + } + + // add meta + + public function metadataTransformer( CommandInterface $command, $request ) { + $operation = $this->operation; + if ( isset( $command['Metadata'] ) ) { + $meta = $command['Metadata']; + foreach ( $meta as $key => $value ) { + $request = $request->withHeader( 'x-cos-meta-' . $key, $value ); + } + } + $request = headersMap( $command, $request ); + + return $request; + } + + // count md5 + + private function addMd5( $request ) { + $body = $request->getBody(); + if ( $body && $body->getSize() > 0 ) { + $md5 = base64_encode( md5( $body, true ) ); + return $request->withHeader( 'Content-MD5', $md5 ); + } + return $request; + } + + // inventoryId + + public function specialParamTransformer( CommandInterface $command, $request ) { + $action = $command->getName(); + if ( $action == 'PutBucketInventory' ) { + $id = $command['Id']; + $uri = $request->getUri(); + $query = $uri->getQuery(); + $uri = $uri->withQuery( $query . '&Id='.$id ); + return $request->withUri( $uri ); + } + return $request; + } + + public function ciParamTransformer( CommandInterface $command, $request ) { + $action = $command->getName(); + if ( $action == 'GetObject' ) { + if(str_contains($uri = $request->getUri(), '%21') ) { + $uri = new Uri( str_replace('%21', '!', $uri) ); + $request = $request->withUri( $uri ); + } + if(isset($command['ImageHandleParam']) && $command['ImageHandleParam']){ + $uri = $request->getUri(); + $query = $uri->getQuery(); + if($query){ + $query .= "&" . urlencode($command['ImageHandleParam']); + }else{ + $query .= urlencode($command['ImageHandleParam']); + } + $uri = $uri->withQuery($query); + $request = $request->withUri( $uri ); + } + } + return $request; + } + + public function cosDomain2CiTransformer(CommandInterface $command, $request) { + $action = $command->getName(); + $ciActions = array( + 'DetectText' => 1, + 'CreateMediaTranscodeJobs' => 1, + 'CreateMediaJobs' => 1, + 'DescribeMediaJob' => 1, + 'DescribeMediaJobs' => 1, + 'CreateMediaSnapshotJobs' => 1, + 'CreateMediaConcatJobs' => 1, + 'DetectAudio' => 1, + 'GetDetectAudioResult' => 1, + 'GetDetectTextResult' => 1, + 'DetectVideo' => 1, + 'GetDetectVideoResult' => 1, + 'DetectDocument' => 1, + 'GetDetectDocumentResult' => 1, + 'CreateDocProcessJobs' => 1, + 'DescribeDocProcessQueues' => 1, + 'DescribeDocProcessJob' => 1, + 'GetDescribeDocProcessJobs' => 1, + 'DetectImages' => 1, + 'GetDetectImageResult' => 1, + 'DetectVirus' => 1, + 'GetDetectVirusResult' => 1, + 'CreateMediaVoiceSeparateJobs' => 1, + 'DescribeMediaVoiceSeparateJob' => 1, + 'DetectWebpage' => 1, + 'GetDetectWebpageResult' => 1, + ); + if (key_exists($action, $ciActions)) { + $bucketname = $command['Bucket']; + $appId = $this->config['appId']; + if ( $appId != null && endWith( $bucketname, '-'.$appId ) == False ) { + $bucketname = $bucketname.'-'.$appId; + } + $command['Bucket'] = $bucketname; + $domain_type = '.ci.'; + $origin_host = $bucketname . $domain_type . $this->config['region'] . '.' . $this->config['endpoint']; + $host = $origin_host; + if ( $this->config['ip'] != null ) { + $host = $this->config['ip']; + if ( $this->config['port'] != null ) { + $host = $this->config['ip'] . ':' . $this->config['port']; + } + } + $path = $this->config['schema'].'://'. $host . $request->getUri()->getPath(); + $uri = new Uri( $path ); + $query = $request->getUri()->getQuery(); + $uri = $uri->withQuery( $query ); + $request = $request->withUri( $uri ); + $request = $request->withHeader( 'Host', $origin_host ); + } + return $request; + } + + public function __destruct() { + } + + } diff --git a/vendor/qcloud/cos-sdk-v5/src/Common.php b/vendor/qcloud/cos-sdk-v5/src/Common.php new file mode 100644 index 0000000..1cc3246 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/Common.php @@ -0,0 +1,69 @@ + 'ap-shanghai', + 'cn-south' => 'ap-guangzhou', + 'cn-north' => 'ap-beijing-1', + 'cn-south-2' => 'ap-guangzhou-2', + 'cn-southwest' => 'ap-chengdu', + 'sg' => 'ap-singapore', + 'tj' => 'ap-beijing-1', + 'bj' => 'ap-beijing', + 'sh' => 'ap-shanghai', + 'gz' => 'ap-guangzhou', + 'cd' => 'ap-chengdu', + 'sgp' => 'ap-singapore' + ); + if (isset($regionmap[$region])) { + return $regionmap[$region]; + } + return $region; +} + +function encodeKey($key) +{ + return str_replace('%2F', '/', rawurlencode($key)); +} + +function endWith($haystack, $needle) +{ + $length = strlen($needle); + if ($length == 0) { + return true; + } + return (substr($haystack, -$length) === $needle); +} + +function startWith($haystack, $needle) +{ + $length = strlen($needle); + if ($length == 0) { + return true; + } + return (substr($haystack, 0, $length) === $needle); +} + +function headersMap($command, $request) +{ + $headermap = array( + 'TransferEncoding' => 'Transfer-Encoding', + 'ChannelId' => 'x-cos-channel-id' + ); + foreach ($headermap as $key => $value) { + if (isset($command[$key])) { + $request = $request->withHeader($value, $command[$key]); + } + } + return $request; +} + +if (!function_exists('str_contains')) { + function str_contains($haystack, $needle) + { + return strpos($haystack, $needle) !== false; + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/Copy.php b/vendor/qcloud/cos-sdk-v5/src/Copy.php new file mode 100644 index 0000000..18b3d03 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/Copy.php @@ -0,0 +1,140 @@ +client = $client; + $this->copySource = $source; + $this->options = $options; + $this->size = $source['ContentLength']; + unset($source['ContentLength']); + $this->partSize = $this->calculatePartSize($minPartSize); + $this->concurrency = isset($options['Concurrency']) ? $options['Concurrency'] : 10; + $this->retry = isset($options['Retry']) ? $options['Retry'] : 5; + } + public function copy() { + $uploadId= $this->initiateMultipartUpload(); + for ($i = 0; $i < $this->retry; $i += 1) { + $rt = $this->uploadParts($uploadId); + if ($rt == 0) { + break; + } + sleep(1 << $i); + } + foreach ( $this->parts as $key => $row ){ + $num1[$key] = $row ['PartNumber']; + $num2[$key] = $row ['ETag']; + } + array_multisort($num1, SORT_ASC, $num2, SORT_ASC, $this->parts); + return $this->client->completeMultipartUpload(array( + 'Bucket' => $this->options['Bucket'], + 'Key' => $this->options['Key'], + 'UploadId' => $uploadId, + 'Parts' => $this->parts) + ); + + } + public function uploadParts($uploadId) { + $copyRequests = function ($uploadId) { + $offset = 0; + $partNumber = 1; + $partSize = $this->partSize; + $finishedNum = 0; + $this->parts = array(); + for ($index = 1; ; $index ++) { + if ($offset + $partSize >= $this->size) + { + $partSize = $this->size - $offset; + } + $copySourcePath = $this->copySource['Bucket']. '.cos.'. $this->copySource['Region']. + ".myqcloud.com/". $this->copySource['Key']. "?versionId=". $this->copySource['VersionId']; + $params = array( + 'Bucket' => $this->options['Bucket'], + 'Key' => $this->options['Key'], + 'UploadId' => $uploadId, + 'PartNumber' => $partNumber, + 'CopySource'=> $copySourcePath, + 'CopySourceRange' => 'bytes='.((string)$offset).'-'.(string)($offset+$partSize - 1), + ); + if(!isset($this->parts[$partNumber])) { + $command = $this->client->getCommand('uploadPartCopy', $params); + $request = $this->client->commandToRequestTransformer($command); + $this->commandList[$index] = $command; + $this->requestList[$index] = $request; + yield $request; + } + ++$partNumber; + $offset += $partSize; + if ($this->size == $offset) { + break; + } + } + }; + $pool = new Pool($this->client->httpClient, $copyRequests($uploadId), [ + 'concurrency' => $this->concurrency, + 'fulfilled' => function ($response, $index) { + $index = $index + 1; + $response = $this->client->responseToResultTransformer($response, $this->requestList[$index], $this->commandList[$index]); + $part = array('PartNumber' => $index, 'ETag' => $response['ETag']); + $this->parts[$index] = $part; + }, + + 'rejected' => function ($reason, $index) { + $index = $index += 1; + $retry = 2; + for ($i = 1; $i <= $retry; $i++) { + try { + $rt =$this->client->execute($this->commandList[$index]); + $part = array('PartNumber' => $index, 'ETag' => $rt['ETag']); + $this->parts[$index] = $part; + } catch(\Exception $e) { + if ($i == $retry) { + throw($e); + } + } + } + }, + ]); + + // Initiate the transfers and create a promise + $promise = $pool->promise(); + + // Force the pool of requests to complete. + $promise->wait(); + } + + + private function calculatePartSize($minPartSize) + { + $partSize = intval(ceil(($this->size / self::MAX_PARTS))); + $partSize = max($minPartSize, $partSize); + $partSize = min($partSize, self::MAX_PART_SIZE); + $partSize = max($partSize, self::MIN_PART_SIZE); + return $partSize; + } + + private function initiateMultipartUpload() { + $result = $this->client->createMultipartUpload($this->options); + return $result['UploadId']; + } + +} diff --git a/vendor/qcloud/cos-sdk-v5/src/Descriptions.php b/vendor/qcloud/cos-sdk-v5/src/Descriptions.php new file mode 100644 index 0000000..c007eb4 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/Descriptions.php @@ -0,0 +1,4963 @@ + 'POST', + 'uri' => '/{Bucket}jobs', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'CreateMediaTranscodeJobsOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( 'required' => true, 'type' => 'string', 'location' => 'uri', ), + 'Tag' => array( 'required' => false, 'location' => 'xml', 'type' => 'string', ), + 'QueueId' => array( 'required' => true, 'location' => 'xml', 'type' => 'string', ), + 'CallBack' => array( 'required' => false, 'location' => 'xml', 'type' => 'string', ), + 'Input' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Object' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Operation' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Tag' => array('location' => 'xml', 'type' => 'string', ), + 'TemplateId' => array( 'type' => 'string', 'location' => 'xml', ), + 'WatermarkTemplateId' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'WatermarkTemplateId', + 'type' => 'string', + 'location' => 'xml', + 'sentAs' => 'WatermarkTemplateId', + ), + ), + 'Transcode' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Container' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Format' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Video' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Codec' => array( 'type' => 'string', 'location' => 'xml', ), + 'Width' => array( 'type' => 'string', 'location' => 'xml', ), + 'Height' => array( 'type' => 'string', 'location' => 'xml', ), + 'Fps' => array( 'type' => 'string', 'location' => 'xml', ), + 'Remove' => array( 'type' => 'string', 'location' => 'xml', ), + 'Profile' => array( 'type' => 'string', 'location' => 'xml', ), + 'Bitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Crf' => array( 'type' => 'string', 'location' => 'xml', ), + 'Gop' => array( 'type' => 'string', 'location' => 'xml', ), + 'Preset' => array( 'type' => 'string', 'location' => 'xml', ), + 'Bufsize' => array( 'type' => 'string', 'location' => 'xml', ), + 'Maxrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'HlsTsTime' => array( 'type' => 'string', 'location' => 'xml', ), + 'Pixfmt' => array( 'type' => 'string', 'location' => 'xml', ), + 'LongShortMode' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'TimeInterval' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Start' => array( 'type' => 'string', 'location' => 'xml', ), + 'Duration' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Audio' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Codec' => array( 'type' => 'string', 'location' => 'xml', ), + 'Samplerate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Bitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Channels' => array( 'type' => 'string', 'location' => 'xml', ), + 'Remove' => array( 'type' => 'string', 'location' => 'xml', ), + 'KeepTwoTracks' => array( 'type' => 'string', 'location' => 'xml', ), + 'SwitchTrack' => array( 'type' => 'string', 'location' => 'xml', ), + 'SampleFormat' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'TransConfig' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'AdjDarMethod' => array( 'type' => 'string', 'location' => 'xml', ), + 'IsCheckReso' => array( 'type' => 'string', 'location' => 'xml', ), + 'ResoAdjMethod' => array( 'type' => 'string', 'location' => 'xml', ), + 'IsCheckVideoBitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'VideoBitrateAdjMethod' => array( 'type' => 'string', 'location' => 'xml', ), + 'IsCheckAudioBitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'AudioBitrateAdjMethod' => array( 'type' => 'string', 'location' => 'xml', ), + 'DeleteMetadata' => array( 'type' => 'string', 'location' => 'xml', ), + 'IsHdr2Sdr' => array( 'type' => 'string', 'location' => 'xml', ), + 'HlsEncrypt' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'IsHlsEncrypt' => array( 'type' => 'string', 'location' => 'xml', ), + 'UriKey' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + ), + ), + 'Watermark' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'Watermark', + 'type' => 'object', + 'sentAs' => 'Watermark', + 'properties' => array( + 'Type' => array( 'type' => 'string', 'location' => 'xml', ), + 'Pos' => array( 'type' => 'string', 'location' => 'xml', ), + 'LocMode' => array( 'type' => 'string', 'location' => 'xml', ), + 'Dx' => array( 'type' => 'string', 'location' => 'xml', ), + 'Dy' => array( 'type' => 'string', 'location' => 'xml', ), + 'StartTime' => array( 'type' => 'string', 'location' => 'xml', ), + 'EndTime' => array( 'type' => 'string', 'location' => 'xml', ), + 'Image' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Url' => array( 'type' => 'string', 'location' => 'xml', ), + 'Mode' => array( 'type' => 'string', 'location' => 'xml', ), + 'Width' => array( 'type' => 'string', 'location' => 'xml', ), + 'Height' => array( 'type' => 'string', 'location' => 'xml', ), + 'Transparency' => array( 'type' => 'string', 'location' => 'xml', ), + 'Background' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Text' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'FontSize' => array( 'type' => 'string', 'location' => 'xml', ), + 'FontType' => array( 'type' => 'string', 'location' => 'xml', ), + 'FontColor' => array( 'type' => 'string', 'location' => 'xml', ), + 'Transparency' => array( 'type' => 'string', 'location' => 'xml', ), + 'Text' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ) + ), + 'RemoveWatermark' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Dx' => array( 'type' => 'string', 'location' => 'xml', ), + 'Dy' => array( 'type' => 'string', 'location' => 'xml', ), + 'Width' => array( 'type' => 'string', 'location' => 'xml', ), + 'Height' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Output' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Region' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + 'Bucket' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + 'Object' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + ), + ); + } + + public static function CreateMediaTranscodeJobsOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + ), + ); + } + + public static function CreateMediaJobs() { + return array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}jobs', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'CreateMediaJobsOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( 'required' => true, 'type' => 'string', 'location' => 'uri', ), + 'Tag' => array( 'required' => false, 'location' => 'xml', 'type' => 'string', ), + 'QueueId' => array( 'required' => true, 'location' => 'xml', 'type' => 'string', ), + 'CallBack' => array( 'required' => false, 'location' => 'xml', 'type' => 'string', ), + 'Input' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Object' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Operation' => array( + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'Operation', + 'type' => 'object', + 'sentAs' => 'Operation', + 'properties' => array( + 'Tag' => array('location' => 'xml', 'type' => 'string', ), + 'TemplateId' => array( 'type' => 'string', 'location' => 'xml', ), + 'TranscodeTemplateId' => array( 'type' => 'string', 'location' => 'xml', ), + 'VideoProcess' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'ColorEnhance' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Enable' => array( 'type' => 'string', 'location' => 'xml', ), + 'Contrast' => array( 'type' => 'string', 'location' => 'xml', ), + 'Correction' => array( 'type' => 'string', 'location' => 'xml', ), + 'Saturation' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'MsSharpen' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Enable' => array( 'type' => 'string', 'location' => 'xml', ), + 'SharpenLevel' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + 'VideoMontage' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Duration' => array( 'type' => 'string', 'location' => 'xml', ), + 'Container' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Format' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Video' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Codec' => array( 'type' => 'string', 'location' => 'xml', ), + 'Width' => array( 'type' => 'string', 'location' => 'xml', ), + 'Height' => array( 'type' => 'string', 'location' => 'xml', ), + 'Fps' => array( 'type' => 'string', 'location' => 'xml', ), + 'Remove' => array( 'type' => 'string', 'location' => 'xml', ), + 'Bitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Crf' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Audio' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Codec' => array( 'type' => 'string', 'location' => 'xml', ), + 'Samplerate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Bitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Channels' => array( 'type' => 'string', 'location' => 'xml', ), + 'Remove' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + 'Animation' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Container' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Format' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Video' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Codec' => array( 'type' => 'string', 'location' => 'xml', ), + 'Width' => array( 'type' => 'string', 'location' => 'xml', ), + 'Height' => array( 'type' => 'string', 'location' => 'xml', ), + 'Fps' => array( 'type' => 'string', 'location' => 'xml', ), + 'Remove' => array( 'type' => 'string', 'location' => 'xml', ), + 'AnimateOnlyKeepKeyFrame' => array( 'type' => 'string', 'location' => 'xml', ), + 'AnimateTimeIntervalOfFrame' => array( 'type' => 'string', 'location' => 'xml', ), + 'AnimateFramesPerSecond' => array( 'type' => 'string', 'location' => 'xml', ), + 'Quality' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'TimeInterval' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Start' => array( 'type' => 'string', 'location' => 'xml', ), + 'Duration' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + 'Snapshot' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Mode' => array( 'type' => 'string', 'location' => 'xml', ), + 'Start' => array( 'type' => 'string', 'location' => 'xml', ), + 'TimeInterval' => array( 'type' => 'string', 'location' => 'xml', ), + 'Count' => array( 'type' => 'string', 'location' => 'xml', ), + 'Width' => array( 'type' => 'string', 'location' => 'xml', ), + 'Height' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'VoiceSeparate' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'AudioMode' => array( 'type' => 'string', 'location' => 'xml', ), + 'AudioConfig' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Codec' => array( 'type' => 'string', 'location' => 'xml', ), + 'Samplerate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Bitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Channels' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + 'Segment' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Format' => array( 'type' => 'string', 'location' => 'xml', ), + 'Duration' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'SDRtoHDR' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HdrMode' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'SuperResolution' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Resolution' => array( 'type' => 'string', 'location' => 'xml', ), + 'EnableScaleUp' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'WatermarkTemplateId' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'WatermarkTemplateId', + 'type' => 'string', + 'location' => 'xml', + 'sentAs' => 'WatermarkTemplateId', + ), + ), + 'Transcode' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Container' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Format' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Video' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Codec' => array( 'type' => 'string', 'location' => 'xml', ), + 'Width' => array( 'type' => 'string', 'location' => 'xml', ), + 'Height' => array( 'type' => 'string', 'location' => 'xml', ), + 'Fps' => array( 'type' => 'string', 'location' => 'xml', ), + 'Remove' => array( 'type' => 'string', 'location' => 'xml', ), + 'Profile' => array( 'type' => 'string', 'location' => 'xml', ), + 'Bitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Crf' => array( 'type' => 'string', 'location' => 'xml', ), + 'Gop' => array( 'type' => 'string', 'location' => 'xml', ), + 'Preset' => array( 'type' => 'string', 'location' => 'xml', ), + 'Bufsize' => array( 'type' => 'string', 'location' => 'xml', ), + 'Maxrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'HlsTsTime' => array( 'type' => 'string', 'location' => 'xml', ), + 'Pixfmt' => array( 'type' => 'string', 'location' => 'xml', ), + 'LongShortMode' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'TimeInterval' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Start' => array( 'type' => 'string', 'location' => 'xml', ), + 'Duration' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Audio' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Codec' => array( 'type' => 'string', 'location' => 'xml', ), + 'Samplerate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Bitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Channels' => array( 'type' => 'string', 'location' => 'xml', ), + 'Remove' => array( 'type' => 'string', 'location' => 'xml', ), + 'KeepTwoTracks' => array( 'type' => 'string', 'location' => 'xml', ), + 'SwitchTrack' => array( 'type' => 'string', 'location' => 'xml', ), + 'SampleFormat' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'TransConfig' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'AdjDarMethod' => array( 'type' => 'string', 'location' => 'xml', ), + 'IsCheckReso' => array( 'type' => 'string', 'location' => 'xml', ), + 'ResoAdjMethod' => array( 'type' => 'string', 'location' => 'xml', ), + 'IsCheckVideoBitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'VideoBitrateAdjMethod' => array( 'type' => 'string', 'location' => 'xml', ), + 'IsCheckAudioBitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'AudioBitrateAdjMethod' => array( 'type' => 'string', 'location' => 'xml', ), + 'DeleteMetadata' => array( 'type' => 'string', 'location' => 'xml', ), + 'IsHdr2Sdr' => array( 'type' => 'string', 'location' => 'xml', ), + 'HlsEncrypt' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'IsHlsEncrypt' => array( 'type' => 'string', 'location' => 'xml', ), + 'UriKey' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + ), + ), + 'Watermark' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'Watermark', + 'type' => 'object', + 'sentAs' => 'Watermark', + 'properties' => array( + 'Type' => array( 'type' => 'string', 'location' => 'xml', ), + 'Pos' => array( 'type' => 'string', 'location' => 'xml', ), + 'LocMode' => array( 'type' => 'string', 'location' => 'xml', ), + 'Dx' => array( 'type' => 'string', 'location' => 'xml', ), + 'Dy' => array( 'type' => 'string', 'location' => 'xml', ), + 'StartTime' => array( 'type' => 'string', 'location' => 'xml', ), + 'EndTime' => array( 'type' => 'string', 'location' => 'xml', ), + 'Image' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Url' => array( 'type' => 'string', 'location' => 'xml', ), + 'Mode' => array( 'type' => 'string', 'location' => 'xml', ), + 'Width' => array( 'type' => 'string', 'location' => 'xml', ), + 'Height' => array( 'type' => 'string', 'location' => 'xml', ), + 'Transparency' => array( 'type' => 'string', 'location' => 'xml', ), + 'Background' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Text' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'FontSize' => array( 'type' => 'string', 'location' => 'xml', ), + 'FontType' => array( 'type' => 'string', 'location' => 'xml', ), + 'FontColor' => array( 'type' => 'string', 'location' => 'xml', ), + 'Transparency' => array( 'type' => 'string', 'location' => 'xml', ), + 'Text' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ) + ), + 'RemoveWatermark' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Dx' => array( 'type' => 'string', 'location' => 'xml', ), + 'Dy' => array( 'type' => 'string', 'location' => 'xml', ), + 'Width' => array( 'type' => 'string', 'location' => 'xml', ), + 'Height' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Output' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Region' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + 'Bucket' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + 'Object' => array( 'required' => false, 'type' => 'string', 'location' => 'xml', ), + 'AuObject' => array( 'required' => false, 'type' => 'string', 'location' => 'xml', ), + 'SpriteObject' => array( 'required' => false, 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + ), + ), + ); + } + + public static function CreateMediaJobsOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + ), + ); + } + + public static function DescribeMediaJob() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}jobs/{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DescribeMediaJobOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ); + } + public static function DescribeMediaJobOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + ), + ); + } + + public static function DescribeMediaJobs() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}jobs', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DescribeMediaJobsOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Tag' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'tag', + ), + 'QueueId' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'queueId', + ), + 'OrderByTime' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'orderByTime', + ), + 'NextToken' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'nextToken', + ), + 'Size' => array( + 'type' => 'integer', + 'location' => 'query', + 'sentAs' => 'size', + ), + 'States' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'states', + ), + 'StartCreationTime' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'startCreationTime', + ), + 'EndCreationTime' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'endCreationTime', + ), + ), + ); + } + public static function DescribeMediaJobsOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + ), + ); + } + + public static function CreateMediaSnapshotJobs() { + return array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}jobs', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'CreateMediaSnapshotJobsOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( 'required' => true, 'type' => 'string', 'location' => 'uri', ), + 'Tag' => array( 'required' => true, 'location' => 'xml', 'type' => 'string', ), + 'QueueId' => array( 'required' => true, 'location' => 'xml', 'type' => 'string', ), + 'CallBack' => array( 'required' => false, 'location' => 'xml', 'type' => 'string', ), + 'Input' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Object' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Operation' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'TemplateId' => array( 'type' => 'string', 'location' => 'xml', ), + 'Output' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Region' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + 'Bucket' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + 'Object' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Snapshot' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Mode' => array( 'type' => 'string', 'location' => 'xml', ), + 'Start' => array( 'type' => 'string', 'location' => 'xml', ), + 'TimeInterval' => array( 'type' => 'string', 'location' => 'xml', ), + 'Count' => array( 'type' => 'string', 'location' => 'xml', ), + 'Width' => array( 'type' => 'string', 'location' => 'xml', ), + 'Height' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + ), + ); + } + + public static function CreateMediaSnapshotJobsOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + ), + ); + } + + public static function CreateMediaConcatJobs() { + return array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}jobs', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'CreateMediaConcatJobsOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( 'required' => true, 'type' => 'string', 'location' => 'uri', ), + 'Tag' => array( 'required' => true, 'location' => 'xml', 'type' => 'string', ), + 'QueueId' => array( 'required' => true, 'location' => 'xml', 'type' => 'string', ), + 'CallBack' => array( 'required' => false, 'location' => 'xml', 'type' => 'string', ), + 'Input' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Object' => array( 'required' =>false, 'type' => 'string', 'location' => 'xml', ), // 拼接任务Input可以为空,完全用数组内的元素拼接 + ), + ), + 'Operation' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'TemplateId' => array( 'type' => 'string', 'location' => 'xml', ), + 'Output' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Region' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + 'Bucket' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + 'Object' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'ConcatTemplate' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Audio' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Codec' => array( 'type' => 'string', 'location' => 'xml', ), + 'Samplerate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Bitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Channels' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Index' => array( 'type' => 'string', 'location' => 'xml', ), + 'DirectConcat' => array( 'type' => 'string', 'location' => 'xml', ), + 'ConcatFragments' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'ConcatFragment', + 'type' => 'object', + 'sentAs' => 'ConcatFragment', + 'properties' => array( + 'Url' => array( 'type' => 'string', 'location' => 'xml', ), + 'StartTime' => array( 'type' => 'string', 'location' => 'xml', ), + 'EndTime' => array( 'type' => 'string', 'location' => 'xml', ), + // 'Mode' => array( 'type' => 'string', 'location' => 'xml', ), 拼接接口不需要Mode参数 + ), + ), + ), + 'Video' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Codec' => array( 'type' => 'string', 'location' => 'xml', ), + 'Width' => array( 'type' => 'string', 'location' => 'xml', ), + 'Height' => array( 'type' => 'string', 'location' => 'xml', ), + 'Fps' => array( 'type' => 'string', 'location' => 'xml', ), + 'Bitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Remove' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Container' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Format' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + ), + ), + ), + ); + } + + public static function CreateMediaConcatJobsOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + ), + ); + } + + public static function DetectAudio() { + return array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}audio/auditing', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DetectAudioOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Input' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'Url' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Object' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'DataId' => array( + 'type' => 'string', + 'location' => 'xml', + ), + ), + ), + 'Conf' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'DetectType' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Callback' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'BizType' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'CallbackVersion' => array( + 'type' => 'string', + 'location' => 'xml', + ), + ), + ), + ), + ); + } + public static function DetectAudioOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( 'type' => 'string', 'location' => 'header', 'sentAs' => 'x-ci-request-id', ), + 'ContentType' => array( 'type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type', ), + 'ContentLength' => array( 'type' => 'numeric', 'minimum'=> 0, 'location' => 'header', 'sentAs' => 'Content-Length', ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'DataId' => array( 'type' => 'string', 'location' => 'xml', ), + 'JobId' => array( 'type' => 'string', 'location' => 'xml', ), + 'State' => array( 'type' => 'string', 'location' => 'xml', ), + 'CreationTime' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ); + } + + public static function GetDetectAudioResult() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}audio/auditing/{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetDetectAudioResultOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ); + } + + public static function GetDetectAudioResultOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'string', 'location' => 'xml', ), + 'Message' => array( 'type' => 'string', 'location' => 'xml', ), + 'DataId' => array( 'type' => 'string', 'location' => 'xml', ), + 'JobId' => array( 'type' => 'string', 'location' => 'xml', ), + 'State' => array( 'type' => 'string', 'location' => 'xml', ), + 'CreationTime' => array( 'type' => 'string', 'location' => 'xml', ), + 'Object' => array( 'type' => 'string', 'location' => 'xml', ), + 'Url' => array( 'type' => 'string', 'location' => 'xml', ), + 'Label' => array( 'type' => 'string', 'location' => 'xml', ), + 'Result' => array( 'type' => 'integer', 'location' => 'xml', ), + 'AudioText' => array( 'type' => 'string', 'location' => 'xml', ), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Label' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Label' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Label' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Label' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Section' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Url' => array( 'type' => 'string', 'location' => 'xml', ), + 'Text' => array( 'type' => 'string', 'location' => 'xml', ), + 'OffsetTime' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Duration' => array( 'type' => 'integer', 'location' => 'xml', ), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ); + } + + public static function GetDetectTextResult() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}text/auditing/{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetDetectTextResultOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ); + } + public static function GetDetectTextResultOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'string', 'location' => 'xml', ), + 'Message' => array( 'type' => 'string', 'location' => 'xml', ), + 'DataId' => array( 'type' => 'string', 'location' => 'xml', ), + 'JobId' => array( 'type' => 'string', 'location' => 'xml', ), + 'State' => array( 'type' => 'string', 'location' => 'xml', ), + 'CreationTime' => array( 'type' => 'string', 'location' => 'xml', ), + 'Object' => array( 'type' => 'string', 'location' => 'xml', ), + 'Content' => array( 'type' => 'string', 'location' => 'xml', ), + 'SectionCount' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Label' => array( 'type' => 'string', 'location' => 'xml', ), + 'Result' => array( 'type' => 'integer', 'location' => 'xml', ), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Count' => array( 'type' => 'integer', 'location' => 'xml', ), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Count' => array( 'type' => 'integer', 'location' => 'xml', ), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Count' => array( 'type' => 'integer', 'location' => 'xml', ), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Count' => array( 'type' => 'integer', 'location' => 'xml', ), + ), + ), + 'IllegalInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Count' => array( 'type' => 'integer', 'location' => 'xml', ), + ), + ), + 'AbuseInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Count' => array( 'type' => 'integer', 'location' => 'xml', ), + ), + ), + 'Section' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'StartByte' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Label' => array( 'type' => 'string', 'location' => 'xml', ), + 'Result' => array( 'type' => 'integer', 'location' => 'xml', ), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Keywords' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Keywords' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Keywords' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Keywords' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'IllegalInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Keywords' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'AbuseInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Keywords' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + ), + ), + ), + ), + ); + } + + public static function DetectVideo() { + return array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}video/auditing', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DetectVideoOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Input' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'Object' => array( 'type' => 'string', 'location' => 'xml', ), + 'Url' => array( 'type' => 'string', 'location' => 'xml', ), + 'DataId' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Conf' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'DetectType' => array( 'type' => 'string', 'location' => 'xml', ), + 'Callback' => array( 'type' => 'string', 'location' => 'xml', ), + 'BizType' => array( 'type' => 'string', 'location' => 'xml', ), + 'CallbackVersion' => array( 'type' => 'string', 'location' => 'xml', ), + 'DetectContent' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Snapshot' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'Mode' => array( 'type' => 'string', 'location' => 'xml', ), + 'Count' => array( 'type' => 'string', 'location' => 'xml', ), + 'TimeInterval' => array( 'type' => 'numeric', 'location' => 'xml', ), + ), + ), + ), + ), + ), + ); + } + public static function DetectVideoOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( 'type' => 'string', 'location' => 'header', 'sentAs' => 'x-ci-request-id', ), + 'ContentType' => array( 'type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type', ), + 'ContentLength' => array( 'type' => 'numeric', 'minimum'=> 0, 'location' => 'header', 'sentAs' => 'Content-Length', ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'DataId' => array( 'type' => 'string', 'location' => 'xml', ), + 'JobId' => array( 'type' => 'string', 'location' => 'xml', ), + 'State' => array( 'type' => 'string', 'location' => 'xml', ), + 'CreationTime' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ); + } + + public static function GetDetectVideoResult() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}video/auditing/{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetDetectVideoResultOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ); + } + public static function GetDetectVideoResultOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array('type' => 'string', 'location' => 'xml',), + 'Message' => array('type' => 'string', 'location' => 'xml',), + 'DataId' => array('type' => 'string', 'location' => 'xml',), + 'JobId' => array('type' => 'string', 'location' => 'xml',), + 'State' => array('type' => 'string', 'location' => 'xml',), + 'CreationTime' => array('type' => 'string', 'location' => 'xml',), + 'Object' => array('type' => 'string', 'location' => 'xml',), + 'Url' => array('type' => 'string', 'location' => 'xml',), + 'SnapshotCount' => array('type' => 'string', 'location' => 'xml',), + 'Label' => array('type' => 'string', 'location' => 'xml',), + 'Result' => array('type' => 'integer', 'location' => 'xml',), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Count' => array('type' => 'integer', 'location' => 'xml',), + ) + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Count' => array('type' => 'integer', 'location' => 'xml',), + ) + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Count' => array('type' => 'integer', 'location' => 'xml',), + ) + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Count' => array('type' => 'integer', 'location' => 'xml',), + ) + ), + 'TeenagerInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Count' => array('type' => 'integer', 'location' => 'xml',), + ) + ), + 'Snapshot' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Url' => array('type' => 'string', 'location' => 'xml',), + 'SnapshotTime' => array('type' => 'integer', 'location' => 'xml',), + 'Text' => array('type' => 'string', 'location' => 'xml',), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'Label' => array('type' => 'string', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array('type' => 'integer', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ) + ), + ) + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array('type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ) + ), + ) + ), + ), + ) + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'Label' => array('type' => 'string', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array('type' => 'integer', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ) + ), + ) + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array('type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ) + ), + ) + ), + ), + ) + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'Label' => array('type' => 'string', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array('type' => 'integer', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ) + ), + ) + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array('type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ) + ), + ) + ), + ), + ) + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'Label' => array('type' => 'string', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array('type' => 'integer', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ) + ), + ) + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array('type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ) + ), + ) + ), + ), + ) + ), + 'TeenagerInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'Label' => array('type' => 'string', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array('type' => 'integer', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ) + ), + ) + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array('type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ) + ), + ) + ), + ), + ) + ), + ) + ), + ), + 'AudioSection' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Url' => array('type' => 'string', 'location' => 'xml',), + 'Text' => array('type' => 'string', 'location' => 'xml',), + 'OffsetTime' => array('type' => 'integer', 'location' => 'xml',), + 'Duration' => array('type' => 'integer', 'location' => 'xml',), + 'Label' => array('type' => 'string', 'location' => 'xml',), + 'Result' => array('type' => 'integer', 'location' => 'xml',), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'string', 'location' => 'xml',), + 'Score' => array('type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',), + ), + ) + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'string', 'location' => 'xml',), + 'Score' => array('type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',), + ), + ) + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'string', 'location' => 'xml',), + 'Score' => array('type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',), + ), + ) + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'string', 'location' => 'xml',), + 'Score' => array('type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',), + ), + ) + ), + 'TeenagerInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'string', 'location' => 'xml',), + 'Score' => array('type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',), + ), + ) + ), + ), + ), + ), + ) + ), + 'NonExistJobIds' => array('type' => 'string', 'location' => 'xml',) + ), + ); + } + + public static function DetectDocument() { + return array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}document/auditing', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DetectDocumentOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Input' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'Object' => array( 'type' => 'string', 'location' => 'xml', ), + 'Url' => array( 'type' => 'string', 'location' => 'xml', ), + 'Type' => array( 'type' => 'string', 'location' => 'xml', ), + 'DataId' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Conf' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'DetectType' => array( 'type' => 'string', 'location' => 'xml', ), + 'Callback' => array( 'type' => 'string', 'location' => 'xml', ), + 'BizType' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ); + } + public static function DetectDocumentOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( 'type' => 'string', 'location' => 'header', 'sentAs' => 'x-ci-request-id', ), + 'ContentType' => array( 'type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type', ), + 'ContentLength' => array( 'type' => 'numeric', 'minimum'=> 0, 'location' => 'header', 'sentAs' => 'Content-Length', ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'DataId' => array( 'type' => 'string', 'location' => 'xml', ), + 'JobId' => array( 'type' => 'string', 'location' => 'xml', ), + 'State' => array( 'type' => 'string', 'location' => 'xml', ), + 'CreationTime' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ); + } + + public static function GetDetectDocumentResult() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}document/auditing/{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetDetectDocumentResultOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ); + } + public static function GetDetectDocumentResultOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array('type' => 'string', 'location' => 'xml',), + 'Message' => array('type' => 'string', 'location' => 'xml',), + 'DataId' => array('type' => 'string', 'location' => 'xml',), + 'JobId' => array('type' => 'string', 'location' => 'xml',), + 'State' => array('type' => 'string', 'location' => 'xml',), + 'Suggestion' => array('type' => 'integer', 'location' => 'xml',), + 'Label' => array('type' => 'string', 'location' => 'xml',), + 'CreationTime' => array('type' => 'string', 'location' => 'xml',), + 'Object' => array('type' => 'string', 'location' => 'xml',), + 'Url' => array('type' => 'string', 'location' => 'xml',), + 'PageCount' => array('type' => 'integer', 'location' => 'xml',), + 'Labels' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + ), + ), + ), + ), + 'PageSegment' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Results' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Url' => array('type' => 'string', 'location' => 'xml',), + 'Text' => array('type' => 'string', 'location' => 'xml',), + 'PageNumber' => array('type' => 'integer', 'location' => 'xml',), + 'SheetNumber' => array('type' => 'integer', 'location' => 'xml',), + 'Label' => array('type' => 'string', 'location' => 'xml',), + 'Suggestion' => array('type' => 'integer', 'location' => 'xml',), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array('type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',) + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array('type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array('type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',) + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array('type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array('type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',) + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array('type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array('type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array('type' => 'string', 'location' => 'xml',) + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array('type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array('type' => 'numeric', 'location' => 'xml',), + 'Y' => array('type' => 'numeric', 'location' => 'xml',), + 'Height' => array('type' => 'numeric', 'location' => 'xml',), + 'Width' => array('type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array('type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ); + } + public static function CreateDocProcessJobs() { + return array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}doc_jobs', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'CreateDocProcessJobsOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Tag' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'xml', + ), + 'QueueId' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'xml', + ), + 'Input' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Object' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Operation' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Output' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Region' => array( + 'type' => 'string','required' => true,'location' => 'xml', + ), + 'Bucket' => array( + 'type' => 'string','required' => true,'location' => 'xml', + ), + 'Object' => array( + 'type' => 'string','required' => true,'location' => 'xml', + ), + ), + ), + 'DocProcess' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'SrcType' => array( + 'type' => 'string', + ), + 'TgtType' => array( + 'type' => 'string', + ), + 'SheetId' => array( + 'type' => 'integer', + ), + 'StartPage' => array( + 'type' => 'integer', + ), + 'EndPage' => array( + 'type' => 'integer', + ), + 'ImageParams' => array( + 'type' => 'string', + ), + 'DocPassword' => array( + 'type' => 'string', + ), + 'Comments' => array( + 'type' => 'integer', + ), + 'PaperDirection' => array( + 'type' => 'integer', + ), + 'Quality' => array( + 'type' => 'integer', + ), + 'Zoom' => array( + 'type' => 'integer', + ), + ), + ), + ), + ), + ), + ); + } + public static function CreateDocProcessJobsOutput() + { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-ci-request-id',), + 'ContentType' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type',), + 'ContentLength' => array('type' => 'numeric', 'minimum' => 0, 'location' => 'header', 'sentAs' => 'Content-Length',), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'EndTime' => array('type' => 'string', 'location' => 'xml',), + 'StartTime' => array('type' => 'string', 'location' => 'xml',), + 'Code' => array('type' => 'string', 'location' => 'xml',), + 'Message' => array('type' => 'string', 'location' => 'xml',), + 'JobId' => array('type' => 'string', 'location' => 'xml',), + 'Tag' => array('type' => 'string', 'location' => 'xml',), + 'State' => array('type' => 'string', 'location' => 'xml',), + 'CreationTime' => array('type' => 'string', 'location' => 'xml',), + 'QueueId' => array('type' => 'string', 'location' => 'xml',), + 'Input' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Object' => array('type' => 'string', 'location' => 'xml',), + ), + ), + 'Operation' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Output' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Region' => array( + 'type' => 'string','location' => 'xml', + ), + 'Bucket' => array( + 'type' => 'string','location' => 'xml', + ), + 'Object' => array( + 'type' => 'string','location' => 'xml', + ), + ), + ), + 'DocProcess' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'SrcType' => array( + 'type' => 'string', + ), + 'TgtType' => array( + 'type' => 'string', + ), + 'SheetId' => array( + 'type' => 'integer', + ), + 'StartPage' => array( + 'type' => 'integer', + ), + 'EndPage' => array( + 'type' => 'integer', + ), + 'ImageParams' => array( + 'type' => 'string', + ), + 'DocPassword' => array( + 'type' => 'string', + ), + 'Comments' => array( + 'type' => 'integer', + ), + 'PaperDirection' => array( + 'type' => 'integer', + ), + 'Quality' => array( + 'type' => 'integer', + ), + 'Zoom' => array( + 'type' => 'integer', + ), + ), + ), + ), + ), + ), + ), + ), + ); + } + public static function DescribeDocProcessQueues() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}docqueue', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DescribeDocProcessQueuesOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'queueIds' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'state' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'pageNumber' => array( + 'type' => 'string', + 'location' => 'query', + ), + 'pageSize' => array( + 'type' => 'string', + 'location' => 'query', + ), + ), + ); + } + public static function DescribeDocProcessQueuesOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array('type' => 'string', 'location' => 'xml',), + 'TotalCount' => array('type' => 'integer', 'location' => 'xml',), + 'PageNumber' => array('type' => 'integer', 'location' => 'xml',), + 'PageSize' => array('type' => 'integer', 'location' => 'xml',), + 'QueueList' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'State' => array('type' => 'string', 'location' => 'xml',), + 'Name' => array('type' => 'string', 'location' => 'xml',), + 'MaxSize' => array('type' => 'integer', 'location' => 'xml',), + 'MaxConcurrent' => array('type' => 'integer', 'location' => 'xml',), + 'CreateTime' => array('type' => 'string', 'location' => 'xml',), + 'UpdateTime' => array('type' => 'string', 'location' => 'xml',), + 'BucketId' => array('type' => 'string', 'location' => 'xml',), + 'Category' => array('type' => 'string', 'location' => 'xml',), + 'QueueId' => array('type' => 'string', 'location' => 'xml',), + 'NotifyConfig' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Url' => array('type' => 'string', 'location' => 'xml',), + 'Event' => array('type' => 'string', 'location' => 'xml',), + 'Type' => array('type' => 'string', 'location' => 'xml',), + 'State' => array('type' => 'string', 'location' => 'xml',), + ), + ), + ), + ), + ), + ); + } + + public static function DescribeDocProcessJob() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}doc_jobs/{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DescribeDocProcessJobOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ); + } + + public static function DescribeDocProcessJobOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( + 'type' => 'string', + ), + 'Message' => array( + 'type' => 'string', + ), + 'JobId' => array( + 'type' => 'string', + ), + 'State' => array( + 'type' => 'string', + ), + 'CreationTime' => array( + 'type' => 'string', + ), + 'QueueId' => array( + 'type' => 'string', + ), + 'Tag' => array( + 'type' => 'string', + ), + 'EndTime' => array( + 'type' => 'string', + ), + 'Input' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Object' => array( + 'type' => 'string', + ), + ), + ), + 'Operation' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'DocProcess' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'SrcType' => array( + 'type' => 'string', + ), + 'TgtType' => array( + 'type' => 'string', + ), + 'SheetId' => array( + 'type' => 'integer', + ), + 'StartPage' => array( + 'type' => 'integer', + ), + 'EndPage' => array( + 'type' => 'integer', + ), + 'ImageParams' => array( + 'type' => 'string', + ), + 'DocPassword' => array( + 'type' => 'string', + ), + 'Comments' => array( + 'type' => 'integer', + ), + 'PaperDirection' => array( + 'type' => 'integer', + ), + 'Quality' => array( + 'type' => 'integer', + ), + 'Zoom' => array( + 'type' => 'integer', + ), + ), + ), + 'DocProcessResult' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'PageInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'PageNo' => array( + 'type' => 'integer', + ), + 'TgtUri' => array( + 'type' => 'string', + ), + 'PicIndex' => array( + 'type' => 'integer', + ), + 'PicNum' => array( + 'type' => 'integer', + ), + 'X-SheetPics' => array( + 'type' => 'integer', + ), + ), + ), + 'SuccPageCount' => array( + 'type' => 'integer', + ), + 'FailPageCount' => array( + 'type' => 'integer', + ), + 'TaskId' => array( + 'type' => 'string', + ), + 'TgtType' => array( + 'type' => 'string', + ), + 'TotalPageCount' => array( + 'type' => 'integer', + ), + 'TotalSheetCount' => array( + 'type' => 'integer', + ), + ), + ), + 'Output' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Bucket' => array( + 'type' => 'string', + ), + 'Object' => array( + 'type' => 'string', + ), + 'Region' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + ), + ), + ), + ); + } + + public static function GetDescribeDocProcessJobs() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}doc_jobs', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetDescribeDocProcessJobsOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Tag' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'tag', + ), + 'QueueId' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'queueId', + ), + 'OrderByTime' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'orderByTime', + ), + 'NextToken' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'nextToken', + ), + 'Size' => array( + 'type' => 'integer', + 'location' => 'query', + 'sentAs' => 'size', + ), + 'States' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'states', + ), + 'StartCreationTime' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'startCreationTime', + ), + 'EndCreationTime' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'endCreationTime', + ), + ), + ); + } + + public static function GetDescribeDocProcessJobsOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'x-ci-request-id',), + 'ContentType' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type',), + 'ContentLength' => array('type' => 'numeric', 'minimum' => 0, 'location' => 'header', 'sentAs' => 'Content-Length',), + 'NextToken' => array('type' => 'string','location' => 'xml',), + 'JobsDetail' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Code' => array('type' => 'string', 'location' => 'xml',), + 'Message' => array('type' => 'string', 'location' => 'xml',), + 'JobId' => array('type' => 'string', 'location' => 'xml',), + 'Tag' => array('type' => 'string', 'location' => 'xml',), + 'State' => array('type' => 'string', 'location' => 'xml',), + 'CreationTime' => array('type' => 'string', 'location' => 'xml',), + 'QueueId' => array('type' => 'string', 'location' => 'xml',), + 'Input' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Object' => array('type' => 'string', 'location' => 'xml',), + ), + ), + 'Operation' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Output' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Region' => array( + 'type' => 'string','location' => 'xml', + ), + 'Bucket' => array( + 'type' => 'string','location' => 'xml', + ), + 'Object' => array( + 'type' => 'string','location' => 'xml', + ), + ), + ), + 'DocProcess' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'SrcType' => array( + 'type' => 'string', + ), + 'TgtType' => array( + 'type' => 'string', + ), + 'SheetId' => array( + 'type' => 'integer', + ), + 'StartPage' => array( + 'type' => 'integer', + ), + 'EndPage' => array( + 'type' => 'integer', + ), + 'ImageParams' => array( + 'type' => 'string', + ), + 'DocPassword' => array( + 'type' => 'string', + ), + 'Comments' => array( + 'type' => 'integer', + ), + 'PaperDirection' => array( + 'type' => 'integer', + ), + 'Quality' => array( + 'type' => 'integer', + ), + 'Zoom' => array( + 'type' => 'integer', + ), + ), + ), + ), + ), + ), + ), + ), + ), + ); + } + + public static function DetectImage() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DetectImageOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'ci-process' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query' + ), + 'DetectType' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'detect-type' + ), + 'DetectUrl' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'detect-url' + ), + 'Interval' => array( + 'type' => 'integer', + 'location' => 'query', + 'sentAs' => 'interval' + ), + 'MaxFrames' => array( + 'type' => 'integer', + 'location' => 'query', + 'sentAs' => 'max-frames' + ), + 'BizType' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'biz-type' + ) + ), + ); + } + + public static function DetectImageOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( 'location' => 'header', 'sentAs' => 'x-cos-request-id', ), + 'ContentType' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type',), + 'ContentLength' => array('type' => 'numeric', 'minimum' => 0, 'location' => 'header', 'sentAs' => 'Content-Length',), + 'Result' => array('type' => 'integer', 'location' => 'xml',), + 'Label' => array('type' => 'string', 'location' => 'xml',), + 'JobId' => array('type' => 'string', 'location' => 'xml',), + 'CompressionResult' => array('type' => 'integer', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'Text' => array('type' => 'string', 'location' => 'xml',), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'integer', 'location' => 'xml',), + 'Msg' => array( 'type' => 'string', 'location' => 'xml',), + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'TerroristInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'integer', 'location' => 'xml',), + 'Msg' => array( 'type' => 'string', 'location' => 'xml',), + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'integer', 'location' => 'xml',), + 'Msg' => array( 'type' => 'string', 'location' => 'xml',), + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'integer', 'location' => 'xml',), + 'Msg' => array( 'type' => 'string', 'location' => 'xml',), + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'integer', 'location' => 'xml',), + 'Msg' => array( 'type' => 'string', 'location' => 'xml',), + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'TeenagerInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'integer', 'location' => 'xml',), + 'Msg' => array( 'type' => 'string', 'location' => 'xml',), + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + ) + ); + } + + public static function DetectImages() { + return array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}image/auditing', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DetectImagesOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Inputs' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'Input', + 'type' => 'object', + 'location' => 'xml', + 'sentAs' => 'Input', + 'properties' => array( + 'Object' => array( 'type' => 'string', 'location' => 'xml', ), + 'Url' => array( 'type' => 'string', 'location' => 'xml', ), + 'Interval' => array( 'type' => 'integer', 'location' => 'xml', ), + 'MaxFrames' => array( 'type' => 'integer', 'location' => 'xml', ), + 'DataId' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + 'Conf' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'DetectType' => array( 'type' => 'string', 'location' => 'xml', ), + 'BizType' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ); + } + + public static function DetectImagesOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( 'location' => 'header', 'sentAs' => 'x-ci-request-id', ), + 'ContentType' => array('type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type',), + 'ContentLength' => array('type' => 'numeric', 'minimum' => 0, 'location' => 'header', 'sentAs' => 'Content-Length',), + 'JobsDetail' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'string', 'location' => 'xml',), + 'Message' => array( 'type' => 'string', 'location' => 'xml',), + 'JobId' => array( 'type' => 'string', 'location' => 'xml',), + 'DataId' => array( 'type' => 'string', 'location' => 'xml',), + 'CompressionResult' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'Result' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml',), + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Object' => array( 'type' => 'string', 'location' => 'xml',), + 'Url' => array( 'type' => 'string', 'location' => 'xml',), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'integer', 'location' => 'xml',), + 'Msg' => array( 'type' => 'string', 'location' => 'xml',), + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'integer', 'location' => 'xml',), + 'Msg' => array( 'type' => 'string', 'location' => 'xml',), + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'integer', 'location' => 'xml',), + 'Msg' => array( 'type' => 'string', 'location' => 'xml',), + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'integer', 'location' => 'xml',), + 'Msg' => array( 'type' => 'string', 'location' => 'xml',), + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'TeenagerInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'integer', 'location' => 'xml',), + 'Msg' => array( 'type' => 'string', 'location' => 'xml',), + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ) + ); + } + + public static function DetectVirus() { + return array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}virus/detect', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DetectVirusOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Input' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'Object' => array( 'type' => 'string', 'location' => 'xml', ), + 'Url' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Conf' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'DetectType' => array( 'type' => 'string', 'location' => 'xml', ), + 'Callback' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ); + } + public static function DetectVirusOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( 'type' => 'string', 'location' => 'header', 'sentAs' => 'x-ci-request-id', ), + 'ContentType' => array( 'type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type', ), + 'ContentLength' => array( 'type' => 'numeric', 'minimum'=> 0, 'location' => 'header', 'sentAs' => 'Content-Length', ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'JobId' => array( 'type' => 'string', 'location' => 'xml', ), + 'State' => array( 'type' => 'string', 'location' => 'xml', ), + 'CreationTime' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ); + } + + public static function GetDetectVirusResult() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}virus/detect/{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetDetectVirusResultOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ); + } + public static function GetDetectVirusResultOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array('type' => 'string', 'location' => 'xml',), + 'Message' => array('type' => 'string', 'location' => 'xml',), + 'JobId' => array('type' => 'string', 'location' => 'xml',), + 'State' => array('type' => 'string', 'location' => 'xml',), + 'CreationTime' => array('type' => 'string', 'location' => 'xml',), + 'Object' => array('type' => 'string', 'location' => 'xml',), + 'Url' => array('type' => 'string', 'location' => 'xml',), + 'Suggestion' => array('type' => 'string', 'location' => 'xml',), + 'DetectDetail' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Result' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'FileName' => array( 'type' => 'string', 'location' => 'xml', ), + 'VirusName' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ); + } + + public static function GetDetectImageResult() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}image/auditing/{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetDetectImageResultOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ); + } + public static function GetDetectImageResultOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array('type' => 'string', 'location' => 'xml',), + 'Message' => array('type' => 'string', 'location' => 'xml',), + 'JobId' => array('type' => 'string', 'location' => 'xml',), + 'State' => array('type' => 'string', 'location' => 'xml',), + 'CreationTime' => array('type' => 'string', 'location' => 'xml',), + 'Object' => array('type' => 'string', 'location' => 'xml',), + 'Url' => array('type' => 'string', 'location' => 'xml',), + 'CompressionResult' => array('type' => 'integer', 'location' => 'xml',), + 'Text' => array('type' => 'string', 'location' => 'xml',), + 'Label' => array('type' => 'string', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'Result' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Label' => array( 'type' => 'string', 'location' => 'xml', ), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml', ), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Label' => array( 'type' => 'string', 'location' => 'xml', ), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml', ), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Label' => array( 'type' => 'string', 'location' => 'xml', ), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml', ), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Label' => array( 'type' => 'string', 'location' => 'xml', ), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml', ), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'TeenagerInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Score' => array( 'type' => 'integer', 'location' => 'xml', ), + 'Label' => array( 'type' => 'string', 'location' => 'xml', ), + 'SubLabel' => array( 'type' => 'string', 'location' => 'xml', ), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ); + } + + public static function CreateMediaVoiceSeparateJobs() { + return array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}jobs', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'CreateMediaVoiceSeparateJobsOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( 'required' => true, 'type' => 'string', 'location' => 'uri', ), + 'Tag' => array( 'required' => true, 'location' => 'xml', 'type' => 'string', ), + 'QueueId' => array( 'required' => true, 'location' => 'xml', 'type' => 'string', ), + 'CallBack' => array( 'location' => 'xml', 'type' => 'string', ), + 'Input' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Object' => array( 'required' => true, 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Operation' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'TemplateId' => array( 'type' => 'string', 'location' => 'xml', ), + 'VoiceSeparate' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'AudioMode' => array( 'type' => 'string', 'location' => 'xml', ), + 'AudioConfig' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Codec' => array( 'type' => 'string', 'location' => 'xml', ), + 'Samplerate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Bitrate' => array( 'type' => 'string', 'location' => 'xml', ), + 'Channels' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + 'Output' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Region' => array('type' => 'string', 'location' => 'xml', ), + 'Bucket' => array('type' => 'string', 'location' => 'xml', ), + 'Object' => array('type' => 'string', 'location' => 'xml', ), + 'AuObject' => array('type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + ), + ); + } + + public static function CreateMediaVoiceSeparateJobsOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + ), + ); + } + + public static function DescribeMediaVoiceSeparateJob() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}jobs/{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DescribeMediaVoiceSeparateJobOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ); + } + public static function DescribeMediaVoiceSeparateJobOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + ), + ); + } + + public static function DetectWebpage() { + return array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}webpage/auditing', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DetectWebpageOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Input' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'Url' => array( 'type' => 'string', 'location' => 'xml', ), + 'DataId' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + 'Conf' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'DetectType' => array( 'type' => 'string', 'location' => 'xml', ), + 'Callback' => array( 'type' => 'string', 'location' => 'xml', ), + 'ReturnHighlightHtml' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ); + } + public static function DetectWebpageOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( 'type' => 'string', 'location' => 'header', 'sentAs' => 'x-ci-request-id', ), + 'ContentType' => array( 'type' => 'string', 'location' => 'header', 'sentAs' => 'Content-Type', ), + 'ContentLength' => array( 'type' => 'numeric', 'minimum'=> 0, 'location' => 'header', 'sentAs' => 'Content-Length', ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'DataId' => array( 'type' => 'string', 'location' => 'xml', ), + 'JobId' => array( 'type' => 'string', 'location' => 'xml', ), + 'State' => array( 'type' => 'string', 'location' => 'xml', ), + 'CreationTime' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ); + } + + public static function GetDetectWebpageResult() { + return array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}webpage/auditing/{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetDetectWebpageResultOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ); + } + public static function GetDetectWebpageResultOutput() { + return array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array('type' => 'string', 'location' => 'xml',), + 'Message' => array('type' => 'string', 'location' => 'xml',), + 'DataId' => array('type' => 'string', 'location' => 'xml',), + 'JobId' => array('type' => 'string', 'location' => 'xml',), + 'State' => array('type' => 'string', 'location' => 'xml',), + 'CreationTime' => array('type' => 'string', 'location' => 'xml',), + 'Url' => array('type' => 'string', 'location' => 'xml',), + 'Suggestion' => array('type' => 'integer', 'location' => 'xml',), + 'Label' => array('type' => 'string', 'location' => 'xml',), + 'PageCount' => array('type' => 'integer', 'location' => 'xml',), + 'HighlightHtml' => array('type' => 'string', 'location' => 'xml',), + 'Labels' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + ), + ), + ), + ), + 'ImageResults' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Results' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Url' => array( 'type' => 'string', 'location' => 'xml',), + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'Suggestion' => array( 'type' => 'integer', 'location' => 'xml',), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'SubLabel' => array('type' => 'string', 'location' => 'xml',), + 'OcrResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Keywords' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( 'type' => 'string', 'location' => 'xml',), + ), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + 'ObjectResults' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Name' => array( 'type' => 'string', 'location' => 'xml',), + 'Location' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'X' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Y' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Width' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Height' => array( 'type' => 'numeric', 'location' => 'xml',), + 'Rotate' => array( 'type' => 'numeric', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + 'TextResults' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Results' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Text' => array( 'type' => 'string', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'Suggestion' => array( 'type' => 'integer', 'location' => 'xml',), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'Keywords' => array('type' => 'string', 'location' => 'xml',), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'Keywords' => array('type' => 'string', 'location' => 'xml',), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'Keywords' => array('type' => 'string', 'location' => 'xml',), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array('type' => 'integer', 'location' => 'xml',), + 'Score' => array('type' => 'integer', 'location' => 'xml',), + 'Keywords' => array('type' => 'string', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ); + } + +} diff --git a/vendor/qcloud/cos-sdk-v5/src/Exception/CosException.php b/vendor/qcloud/cos-sdk-v5/src/Exception/CosException.php new file mode 100644 index 0000000..8e482c6 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/Exception/CosException.php @@ -0,0 +1,5 @@ +exceptionCode = $code; + } + + /** + * Get the exception code + * + * @return string|null + */ + public function getExceptionCode() { + return $this->exceptionCode; + } + + /** + * Set the exception type + * + * @param string $type Exception type + */ + public function setExceptionType($type) { + $this->exceptionType = $type; + } + + /** + * Get the exception type (one of client or server) + * + * @return string|null + */ + public function getExceptionType() { + return $this->exceptionType; + } + + /** + * Set the request ID + * + * @param string $id Request ID + */ + public function setRequestId($id) { + $this->requestId = $id; + } + + /** + * Get the Request ID + * + * @return string|null + */ + public function getRequestId() { + return $this->requestId; + } + + /** + * Set the associated response + * + * @param Response $response + */ + public function setResponse(ResponseInterface $response) { + $this->response = $response; + } + + /** + * Get the associated response object + * + * @return Response|null + */ + public function getResponse() { + return $this->response; + } + + /** + * Set the associated request + * + * @param RequestInterface $request + */ + public function setRequest(RequestInterface $request) { + $this->request = $request; + } + + /** + * Get the associated request object + * + * @return RequestInterface|null + */ + public function getRequest() { + return $this->request; + } + + /** + * Get the status code of the response + * + * @return int|null + */ + public function getStatusCode() { + return $this->response ? $this->response->getStatusCode() : null; + } + + /** + * Cast to a string + * + * @return string + */ + public function __toString() { + $message = get_class($this) . ': ' + . 'Cos Error Code: ' . $this->getExceptionCode() . ', ' + . 'Status Code: ' . $this->getStatusCode() . ', ' + . 'Cos Request ID: ' . $this->getRequestId() . ', ' + . 'Cos Error Type: ' . $this->getExceptionType() . ', ' + . 'Cos Error Message: ' . $this->getMessage(); + + // Add the User-Agent if available + if ($this->request) { + $message .= ', ' . 'User-Agent: ' . $this->request->getHeader('User-Agent')[0]; + } + + return $message; + } + + /** + * Get the request ID of the error. This value is only present if a + * response was received, and is not present in the event of a networking + * error. + * + * Same as `getRequestId()` method, but matches the interface for SDKv3. + * + * @return string|null Returns null if no response was received + */ + public function getCosRequestId() { + return $this->requestId; + } + + /** + * Get the Cos error type. + * + * Same as `getExceptionType()` method, but matches the interface for SDKv3. + * + * @return string|null Returns null if no response was received + */ + public function getCosErrorType() { + return $this->exceptionType; + } + + /** + * Get the Cos error code. + * + * Same as `getExceptionCode()` method, but matches the interface for SDKv3. + * + * @return string|null Returns null if no response was received + */ + public function getCosErrorCode() { + return $this->exceptionCode; + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/ExceptionMiddleware.php b/vendor/qcloud/cos-sdk-v5/src/ExceptionMiddleware.php new file mode 100644 index 0000000..3bc980a --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/ExceptionMiddleware.php @@ -0,0 +1,71 @@ +nextHandler = $nextHandler; + $this->parser = new ExceptionParser(); + $this->defaultException = 'Qcloud\Cos\Exception\ServiceResponseException'; + } + + /** + * @param RequestInterface $request + * @param array $options + * + * @return PromiseInterface + */ + public function __invoke(RequestInterface $request, array $options) { + $fn = $this->nextHandler; + return $fn($request, $options)->then( + function (ResponseInterface $response) use ($request) { + return $this->handle($request, $response); + } + ); + } + + public function handle(RequestInterface $request, ResponseInterface $response) { + $code = $response->getStatusCode(); + if ($code < 400) { + return $response; + } + + //throw RequestException::create($request, $response); + $parts = $this->parser->parse($request, $response); + + $className = 'Qcloud\\Cos\\Exception\\' . $parts['code']; + if (substr($className, -9) !== 'Exception') { + $className .= 'Exception'; + } + + $className = class_exists($className) ? $className : $this->defaultException; + + throw $this->createException($className, $request, $response, $parts); + } + + protected function createException($className, RequestInterface $request, ResponseInterface $response, array $parts) { + $class = new $className($parts['message']); + + if ($class instanceof ServiceResponseException) { + $class->setExceptionCode($parts['code']); + $class->setExceptionType($parts['type']); + $class->setResponse($response); + $class->setRequest($request); + $class->setRequestId($parts['request_id']); + } + return $class; + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/ExceptionParser.php b/vendor/qcloud/cos-sdk-v5/src/ExceptionParser.php new file mode 100644 index 0000000..c15400b --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/ExceptionParser.php @@ -0,0 +1,112 @@ + null, + 'message' => null, + //'type' => $response->isClientError() ? 'client' : 'server', + 'type' => 'client', + 'request_id' => null, + 'parsed' => null + ); + + $body = strval($response->getBody()); + + if (empty($body)) { + $this->parseHeaders($request, $response, $data); + return $data; + } + + try { + $xml = new \SimpleXMLElement(utf8_encode($body)); + $this->parseBody($xml, $data); + return $data; + } catch (\Exception $e) { + $data['code'] = 'PhpInternalXmlParseError'; + $data['message'] = 'A non-XML response was received'; + return $data; + } + } + + /** + * Parses additional exception information from the response headers + * + * @param RequestInterface $request Request that was issued + * @param Response $response The response from the request + * @param array $data The current set of exception data + */ + protected function parseHeaders(RequestInterface $request, ResponseInterface $response, array &$data) { + $data['message'] = $response->getStatusCode() . ' ' . $response->getReasonPhrase(); + $requestId = $response->getHeader('x-cos-request-id'); + if (isset($requestId[0])) { + $requestId = $requestId[0]; + $data['request_id'] = $requestId; + $data['message'] .= " (Request-ID: $requestId)"; + } + + // Get the request + $status = $response->getStatusCode(); + $method = $request->getMethod(); + + // Attempt to determine code for 403s and 404s + if ($status === 403) { + $data['code'] = 'AccessDenied'; + } elseif ($method === 'HEAD' && $status === 404) { + $path = explode('/', trim($request->getUri()->getPath(), '/')); + $host = explode('.', $request->getUri()->getHost()); + $bucket = (count($host) >= 4) ? $host[0] : array_shift($path); + $object = array_shift($path); + + if ($bucket && $object) { + $data['code'] = 'NoSuchKey'; + } elseif ($bucket) { + $data['code'] = 'NoSuchBucket'; + } + } + } + + /** + * Parses additional exception information from the response body + * + * @param \SimpleXMLElement $body The response body as XML + * @param array $data The current set of exception data + */ + protected function parseBody(\SimpleXMLElement $body, array &$data) { + $data['parsed'] = $body; + + $namespaces = $body->getDocNamespaces(); + if (isset($namespaces[''])) { + // Account for the default namespace being defined and PHP not being able to handle it :( + $body->registerXPathNamespace('ns', $namespaces['']); + $prefix = 'ns:'; + } else { + $prefix = ''; + } + + if ($tempXml = $body->xpath("//{$prefix}Code[1]")) { + $data['code'] = (string) $tempXml[0]; + } + + if ($tempXml = $body->xpath("//{$prefix}Message[1]")) { + $data['message'] = (string) $tempXml[0]; + } + + $tempXml = $body->xpath("//{$prefix}RequestId[1]"); + if (empty($tempXml)) { + $tempXml = $body->xpath("//{$prefix}RequestID[1]"); + } + if (isset($tempXml[0])) { + $data['request_id'] = (string) $tempXml[0]; + } + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/BlindWatermarkTemplate.php b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/BlindWatermarkTemplate.php new file mode 100644 index 0000000..0f03b1e --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/BlindWatermarkTemplate.php @@ -0,0 +1,87 @@ +markType = 3; + $this->type = ""; + $this->image = ""; + $this->text = ""; + $this->level = ""; + + } + + public function setPick() { + $this->markType = 4; + } + + public function setType($value) { + $this->type = "/type/" . $value; + } + + public function setImage($value) { + $this->image = "/image/" . $this->ciBase64($value); + } + + public function setText($value) { + $this->text = "/text/" . $this->ciBase64($value); + } + + public function setLevel($value) { + $this->level = "/level/" . $value; + } + + public function getType() { + return $this->type; + } + + public function getImage() { + return $this->image; + } + + public function getText() { + return $this->text; + } + + public function getLevel() { + return $this->level; + } + + + public function queryString() { + $head = "watermark/$this->markType"; + $res = ""; + if($this->type){ + $res .= $this->type; + } + if($this->image){ + $res .= $this->image; + } + if($this->text){ + $res .= $this->text; + } + if($this->level){ + $res .= $this->level; + } + if($res){ + $res = $head . $res; + } + return $res; + } + + public function resetRule() { + $this->markType = 3; + $this->type = ""; + $this->image = ""; + $this->text = ""; + $this->level = ""; + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/CIParamTransformation.php b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/CIParamTransformation.php new file mode 100644 index 0000000..0ee780a --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/CIParamTransformation.php @@ -0,0 +1,39 @@ +spilt = $spilt; + $this->tranParams = array(); + $this->tranString = ""; + } + + public function addRule(ImageTemplate $template) { + if($template->queryString()){ + $this->tranParams[] = $template->queryString(); + } + } + + public function queryString() { + if($this->tranParams) { + $this->tranString = implode($this->spilt, $this->tranParams); + } + return $this->tranString; + } + + public function resetRule() { + $this->tranParams = array(); + $this->tranString = ""; + } + + public function defineRule($value) { + $this->tranParams[] = $value; + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageMogrTemplate.php b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageMogrTemplate.php new file mode 100644 index 0000000..eacf677 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageMogrTemplate.php @@ -0,0 +1,159 @@ +tranParams = array(); + $this->tranString = ""; + } + + public function thumbnailByScale($widthScale) { + $this->tranParams[] = "/thumbnail/!" . $widthScale . "p"; + } + + public function thumbnailByWidthScale($heightScale) { + $this->tranParams[] = "/thumbnail/!" . $heightScale . "px"; + } + + public function thumbnailByHeightScale($scale) { + $this->tranParams[] = "/thumbnail/!x" . $scale . "p"; + } + + public function thumbnailByWidth($width) { + $this->tranParams[] = "/thumbnail/" . $width . "x"; + } + + public function thumbnailByHeight($height) { + $this->tranParams[] = "/thumbnail/x" . $height; + } + + public function thumbnailByMaxWH($maxW, $maxH) { + $this->tranParams[] = "/thumbnail/" . $maxW . "x" . $maxH; + } + + public function thumbnailByMinWH($minW, $minH) { + $this->tranParams[] = "/thumbnail/!" . $minW . "x" . $minH . "r" ; + } + + public function thumbnailByWH($width, $height) { + $this->tranParams[] = "/thumbnail/" . $width . "x" . $height . "!"; + } + + public function thumbnailByPixel($pixel) { + $this->tranParams[] = "/thumbnail/" . $pixel . "@"; + } + + public function cut($width, $height, $dx, $dy) { + $this->tranParams[] = "/cut/" . $width . "x" . "$height" . "x" . $dx . "x" . $dy; + } + + public function cropByWidth($width, $gravity = "") { + $temp = "/crop/" . $width . "x"; + if($gravity){ + $temp .= "/gravity/" . $gravity; + } + $this->tranParams[] = $temp; + } + + public function cropByHeight($height, $gravity = "") { + $temp = "/crop/x" . $height; + if($gravity){ + $temp .= "/gravity/" . $gravity; + } + $this->tranParams[] = $temp; + } + + public function cropByWH($width, $height, $gravity = "") { + $temp = "/crop/" . $width . "x" . $height; + if($gravity){ + $temp .= "/gravity/" . $gravity; + } + $this->tranParams[] = $temp; + } + + public function iradius($radius) { + $this->tranParams[] = "/iradius/" . $radius; + } + + public function rradius($radius) { + $this->tranParams[] = "/rradius/" . $radius; + } + + public function scrop($width, $height) { + $this->tranParams[] = "/scrop/" . $width . "x" . $height; + } + + public function rotate($degree) { + $this->tranParams[] = "/rotate/" . $degree; + } + + public function autoOrient() { + $this->tranParams[] = "/rotate/auto-orient"; + } + + public function format($format) { + $this->tranParams[] = "/format/" . $format; + } + + public function gifOptimization($frameNumber) { + $this->tranParams[] = "/cgif/" . $frameNumber; + } + + public function jpegInterlaceMode($mode) { + $this->tranParams[] = "/interlace/" . $mode; + } + + public function quality($value, $force = 0) { + $temp = "/quality/" . $value; + if($force){ + $temp .= "!"; + } + $this->tranParams[] = $temp; + } + + public function lowestQuality($value) { + $this->tranParams[] = "/lquality/" . $value; + } + + public function relativelyQuality($value) { + $this->tranParams[] = "/rquality/" . $value; + } + + public function blur($radius, $sigma) { + $this->tranParams[] = "/blur/" . $radius . "x" . $sigma; + } + + public function bright($value) { + $this->tranParams[] = "/bright/" . $value; + } + + public function contrast($value) { + $this->tranParams[] = "/contrast/" . $value; + } + + public function sharpen($value) { + $this->tranParams[] = "/sharpen/" . $value; + } + + public function strip() { + $this->tranParams[] = "/strip"; + } + + public function queryString() { + if($this->tranParams) { + $this->tranString = "imageMogr2" . implode("", $this->tranParams); + } + return $this->tranString; + } + + public function resetRule() { + $this->tranString = ""; + $this->tranParams = array(); + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageQrcodeTemplate.php b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageQrcodeTemplate.php new file mode 100644 index 0000000..606168b --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageQrcodeTemplate.php @@ -0,0 +1,37 @@ +mode = ""; + } + + public function setMode($mode) { + $this->mode = "/cover/" . $mode; + } + + public function getMode() { + return $this->mode; + } + + public function queryString() { + $head = "QRcode"; + $res = ""; + if($this->mode) { + $res .= $this->mode; + } + if($res) { + $res = $head . $res; + } + return $res; + } + + public function resetRule() { + $this->mode = ""; + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageStyleTemplate.php b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageStyleTemplate.php new file mode 100644 index 0000000..c8fa533 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageStyleTemplate.php @@ -0,0 +1,33 @@ +style = ""; + } + + public function setStyle($styleName) { + $this->style = "style/" . $styleName; + } + + public function getStyle() { + return $this->style; + } + + public function queryString() { + $res = ""; + if($this->style) { + $res = $this->style; + } + return $res; + } + + public function resetRule() { + $this->style = ""; + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageTemplate.php b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageTemplate.php new file mode 100644 index 0000000..eabe676 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageTemplate.php @@ -0,0 +1,18 @@ +mode = ""; + $this->width = ""; + $this->height = ""; + $this->format = ""; + $this->quality = ""; + } + + public function setMode($value) { + $this->mode = "/" . $value; + } + + public function setWidth($value) { + $this->width = "/w/" . $value; + } + + public function setHeight($value) { + $this->height = "/h/" . $value; + } + + public function setFormat($value) { + $this->format = "/format/" . $value; + } + + public function setQuality($qualityType, $qualityValue, $force = 0) { + if($qualityType == 1){ + $this->quality = "/q/$qualityValue" ; + if($force){ + $this->quality .= "!"; + } + }else if($qualityType == 2){ + $this->quality = "/rq/$qualityValue" ; + }else if ($qualityType == 3){ + $this->quality = "/lq/$qualityValue" ; + } + } + + public function getMode() { + return $this->mode; + } + + public function getWidth() { + return $this->width; + } + + public function getHeight() { + return $this->height; + } + + public function getFormat() { + return $this->format; + } + + public function getQuality() { + return $this->quality; + } + + public function queryString() { + $head = "imageView2"; + $res = ""; + if($this->mode) { + $res .= $this->mode; + } + if($this->width) { + $res .= $this->width; + } + if($this->height) { + $res .= $this->height; + } + if($this->format) { + $res .= $this->format; + } + if($this->quality) { + $res .= $this->quality; + } + if($res) { + $res = $head . $res; + } + return $res; + } + + public function resetRule() { + $this->mode = ""; + $this->width = ""; + $this->height = ""; + $this->format = ""; + $this->quality = ""; + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageWatermarkTemplate.php b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageWatermarkTemplate.php new file mode 100644 index 0000000..d9f4c5a --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/ImageWatermarkTemplate.php @@ -0,0 +1,122 @@ +image = ""; + $this->gravity = ""; + $this->dx = ""; + $this->dy = ""; + $this->blogo = ""; + $this->scatype = ""; + $this->spcent = ""; + } + + public function setImage($value) { + $this->image = "/image/" . $this->ciBase64($value); + } + + public function setGravity($value) { + $this->gravity = "/gravity/" . $value; + } + + public function setDx($value) { + $this->dx = "/dx/" . $value; + } + + public function setDy($value) { + $this->dy = "/dy/" . $value; + } + + public function setBlogo($value) { + $this->blogo = "/blogo/" . $value; + } + + public function setScatype($value) { + $this->scatype = "/scatype/" . $value; + } + + public function setSpcent($value) { + $this->spcent = "/spcent/" . $value; + } + + public function getImage() { + return $this->image; + } + + public function getGravity() { + return $this->gravity; + } + + public function getDx() { + return $this->dx; + } + + public function getDy() { + return $this->dy; + } + + public function getBlogo() { + return $this->blogo; + } + + public function getScatype() { + return $this->scatype; + } + + public function getSpcent() { + return $this->spcent; + } + + public function queryString() { + $head = "watermark/1"; + $res = ""; + if($this->image) { + $res .= $this->image; + } + if($this->gravity) { + $res .= $this->gravity; + } + if($this->dx) { + $res .= $this->dx; + } + if($this->dy) { + $res .= $this->dy; + } + if($this->blogo) { + $res .= $this->blogo; + } + if($this->scatype) { + $res .= $this->scatype; + } + if($this->spcent) { + $res .= $this->spcent; + } + if($res) { + $res = $head . $res; + } + return $res; + } + + public function resetRule() { + $this->image = ""; + $this->gravity = ""; + $this->dx = ""; + $this->dy = ""; + $this->blogo = ""; + $this->scatype = ""; + $this->spcent = ""; + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/PicOperationsTransformation.php b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/PicOperationsTransformation.php new file mode 100644 index 0000000..b10f5d5 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/PicOperationsTransformation.php @@ -0,0 +1,60 @@ +isPicInfo = 0; + $this->rules = array(); + } + + public function setIsPicInfo($value) { + $this->isPicInfo = $value; + } + + public function addRule(ImageTemplate $template, $fileid = "", $bucket = "") { + $rule = $template->queryString(); + if($rule){ + $item = array(); + $item['rule'] = $rule; + if($fileid){ + $item['fileid'] = $fileid; + } + if($bucket) { + $item['bucket'] = $bucket; + } + $this->rules[] = $item; + } + } + + public function getIsPicInfo() { + return $this->isPicInfo; + } + + public function getRules() { + return $this->rules; + } + + public function queryString() { + $res = ""; + $picOperations = array(); + if($this->isPicInfo){ + $picOperations['is_pic_info'] = $this->isPicInfo; + } + if($this->rules){ + $picOperations['rules'] = $this->rules; + } + if($picOperations){ + $res = json_encode($picOperations); + } + return $res; + } + + public function resetRule() { + $this->isPicInfo = 0; + $this->rules = array(); + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/TextWatermarkTemplate.php b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/TextWatermarkTemplate.php new file mode 100644 index 0000000..f1561a7 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/ImageParamTemplate/TextWatermarkTemplate.php @@ -0,0 +1,166 @@ +text = ""; + $this->font = ""; + $this->fontsize = ""; + $this->fill = ""; + $this->dissolve = ""; + $this->gravity = ""; + $this->dx = ""; + $this->dy = ""; + $this->batch = ""; + $this->degree = ""; + } + + public function setText($value) { + $this->text = "/text/" . $this->ciBase64($value); + } + + public function setFont($value) { + $this->font = "/font/" . $this->ciBase64($value); + } + + public function setFontsize($value) { + $this->fontsize = "/fontsize/" . $value; + } + + public function setFill($value) { + $this->fill = "/fill/" . $this->ciBase64($value); + } + + public function setDissolve($value) { + $this->dissolve = "/dissolve/" . $value; + } + + public function setGravity($value) { + $this->gravity = "/gravity/" . $value; + } + + public function setDx($value) { + $this->dx = "/dx/" . $value; + } + + public function setDy($value) { + $this->dy = "/dy/" . $value; + } + + public function setBatch($value) { + $this->batch = "/batch/" . $value; + } + + public function setDegree($value) { + $this->degree = "/degree/" . $value; + } + + public function getText() { + return $this->text; + } + + public function getFont() { + return $this->font; + } + + public function getFontsize() { + return $this->fontsize; + } + + public function getFill() { + return $this->fill; + } + + public function getDissolve() { + return $this->dissolve; + } + + public function getGravity() { + return $this->gravity; + } + + public function getDx() { + return $this->dx; + } + + public function getDy() { + return $this->dy; + } + + public function getBatch() { + return $this->batch; + } + + public function getDegree() { + return $this->degree; + } + + public function queryString() { + $head = "watermark/2"; + $res = ""; + if($this->text) { + $res .= $this->text; + } + if($this->font) { + $res .= $this->font; + } + if($this->fontsize) { + $res .= $this->fontsize; + } + if($this->fill) { + $res .= $this->fill; + } + if($this->dissolve) { + $res .= $this->dissolve; + } + if($this->gravity) { + $res .= $this->gravity; + } + if($this->dx) { + $res .= $this->dx; + } + if($this->dy) { + $res .= $this->dy; + } + if($this->batch) { + $res .= $this->batch; + } + if($this->degree) { + $res .= $this->degree; + } + if($res) { + $res = $head . $res; + } + return $res; + } + + public function resetRule() { + $this->text = ""; + $this->font = ""; + $this->fontsize = ""; + $this->fill = ""; + $this->dissolve = ""; + $this->gravity = ""; + $this->dx = ""; + $this->dy = ""; + $this->batch = ""; + $this->degree = ""; + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/MultipartUpload.php b/vendor/qcloud/cos-sdk-v5/src/MultipartUpload.php new file mode 100644 index 0000000..2eec9c0 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/MultipartUpload.php @@ -0,0 +1,167 @@ +body = $body; + $this->client = $client; + $this->options = $options; + $this->partSize = $this->calculatePartSize($minPartSize); + $this->concurrency = isset($options['Concurrency']) ? $options['Concurrency'] : 10; + $this->progress = isset($options['Progress']) ? $options['Progress'] : function($totalSize, $uploadedSize) {}; + $this->parts = []; + $this->partNumberList = []; + $this->uploadedSize = 0; + $this->totalSize = $this->body->getSize(); + $this->needMd5 = isset($options['ContentMD5']) ? $options['ContentMD5'] : true; + $this->retry = isset($options['Retry']) ? $options['Retry'] : 3; + } + public function performUploading() { + $uploadId= $this->initiateMultipartUpload(); + $this->uploadParts($uploadId); + foreach ( $this->parts as $key => $row ){ + $num1[$key] = $row ['PartNumber']; + $num2[$key] = $row ['ETag']; + } + array_multisort($num1, SORT_ASC, $num2, SORT_ASC, $this->parts); + return $this->client->completeMultipartUpload(array( + 'Bucket' => $this->options['Bucket'], + 'Key' => $this->options['Key'], + 'UploadId' => $uploadId, + 'Parts' => $this->parts) + ); + + } + public function uploadParts($uploadId) { + $uploadRequests = function ($uploadId) { + $partNumber = 1; + $index = 1; + $offset = 0; + $partSize = 0; + for ( ; ; $partNumber ++) { + if ($this->body->eof()) { + break; + } + $body = $this->body->read($this->partSize); + $partSize = $this->partSize; + if ($offset + $this->partSize >= $this->totalSize) { + $partSize = $this->totalSize - $offset; + } + $offset += $partSize; + if (empty($body)) { + break; + } + if (isset($this->parts[$partNumber])) { + continue; + } + $this->partNumberList[$index]['PartNumber'] = $partNumber; + $this->partNumberList[$index]['PartSize'] = $partSize; + $params = array( + 'Bucket' => $this->options['Bucket'], + 'Key' => $this->options['Key'], + 'UploadId' => $uploadId, + 'PartNumber' => $partNumber, + 'Body' => $body, + 'ContentMD5' => $this->needMd5 + ); + if ($this->needMd5 == false) { + unset($params["ContentMD5"]); + } + if (!isset($this->parts[$partNumber])) { + $command = $this->client->getCommand('uploadPart', $params); + $request = $this->client->commandToRequestTransformer($command); + $index ++; + yield $request; + } + } + }; + $pool = new Pool($this->client->httpClient, $uploadRequests($uploadId), [ + 'concurrency' => $this->concurrency, + 'fulfilled' => function ($response, $index) { + $index = $index + 1; + $partNumber = $this->partNumberList[$index]['PartNumber']; + $partSize = $this->partNumberList[$index]['PartSize']; + + //兼容两种写法,防止index为undefined + if (array_key_exists('etag', $response->getHeaders())) { + $etag = $response->getHeaders()["etag"][0]; + } + + if (array_key_exists('ETag', $response->getHeaders())) { + $etag = $response->getHeaders()["ETag"][0]; + } + $part = array('PartNumber' => $partNumber, 'ETag' => $etag); + $this->parts[$partNumber] = $part; + $this->uploadedSize += $partSize; + call_user_func_array($this->progress, [$this->totalSize, $this->uploadedSize]); + }, + + 'rejected' => function ($reason, $index) { + printf("part [%d] upload failed, reason: %s\n", $index, $reason); + throw($reason); + } + ]); + $promise = $pool->promise(); + $promise->wait(); + } + + public function resumeUploading() { + $uploadId = $this->options['UploadId']; + $rt = $this->client->ListParts( + array('UploadId' => $uploadId, + 'Bucket'=>$this->options['Bucket'], + 'Key'=>$this->options['Key'])); + $parts = array(); + if (count($rt['Parts']) > 0) { + foreach ($rt['Parts'] as $part) { + $this->parts[$part['PartNumber']] = array('PartNumber' => $part['PartNumber'], 'ETag' => $part['ETag']); + } + } + $this->uploadParts($uploadId); + foreach ( $this->parts as $key => $row ){ + $num1[$key] = $row ['PartNumber']; + $num2[$key] = $row ['ETag']; + } + array_multisort($num1, SORT_ASC, $num2, SORT_ASC, $this->parts); + return $this->client->completeMultipartUpload(array( + 'Bucket' => $this->options['Bucket'], + 'Key' => $this->options['Key'], + 'UploadId' => $uploadId, + 'Parts' => $this->parts) + ); + } + + private function calculatePartSize($minPartSize) + { + $partSize = intval(ceil(($this->body->getSize() / self::MAX_PARTS))); + $partSize = max($minPartSize, $partSize); + $partSize = min($partSize, self::MAX_PART_SIZE); + $partSize = max($partSize, self::MIN_PART_SIZE); + return $partSize; + } + + private function initiateMultipartUpload() { + $result = $this->client->createMultipartUpload($this->options); + return $result['UploadId']; + } + +} diff --git a/vendor/qcloud/cos-sdk-v5/src/RangeDownload.php b/vendor/qcloud/cos-sdk-v5/src/RangeDownload.php new file mode 100644 index 0000000..77f50f7 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/RangeDownload.php @@ -0,0 +1,145 @@ +client = $client; + $this->options = $options; + $this->partSize = isset( $options['PartSize'] ) ? $options['PartSize'] : self::DEFAULT_PART_SIZE; + $this->concurrency = isset( $options['Concurrency'] ) ? $options['Concurrency'] : 10; + $this->progress = isset( $options['Progress'] ) ? $options['Progress'] : function( $totalSize, $downloadedSize ) { + } + ; + $this->parts = []; + $this->partNumberList = []; + $this->downloadedSize = 0; + $this->totalSize = $contentLength; + $this->saveAs = $saveAs; + $this->resumableJson = []; + $this->resumableJson = isset( $options['ResumableJson'] ) ? $options['ResumableJson'] : []; + unset( $options['ResumableJson'] ); + $this->resumableTaskFile = isset( $options['ResumableTaskFile'] ) ? $options['ResumableTaskFile'] : $saveAs . '.cosresumabletask'; + $this->resumableDownload = isset( $options['ResumableDownload'] ) ? $options['ResumableDownload'] : false; + } + + public function performdownloading() { + if ( $this->resumableDownload ) { + try { + if ( file_exists( $this->resumableTaskFile ) ) { + $origin_content = file_get_contents( $this->resumableTaskFile ); + $this->resumableJsonLocal = json_decode( $origin_content, true ); + if ( $this->resumableJsonLocal == null ) { + $this->resumableJsonLocal = []; + } else if ( $this->resumableJsonLocal['LastModified'] != $this->resumableJson['LastModified'] || + $this->resumableJsonLocal['ContentLength'] != $this->resumableJson['ContentLength'] || + $this->resumableJsonLocal['ETag'] != $this->resumableJson['ETag'] || + $this->resumableJsonLocal['Crc64ecma'] != $this->resumableJson['Crc64ecma'] ) { + $this->resumableDownload = false; + } + } + } catch ( \Exception $e ) { + $this->resumableDownload = false; + } + } + try { + if ($this->resumableDownload) { + $this->fp = fopen( $this->saveAs, 'r+' ); + } else { + $this->fp = fopen( $this->saveAs, 'wb' ); + } + $rt = $this->donwloadParts(); + $this->resumableJson['DownloadedBlocks'] = []; + if (file_exists( $this->resumableTaskFile )) { + unlink($this->resumableTaskFile); + } + } catch ( \Exception $e ) { + $this->fp_resume = fopen( $this->resumableTaskFile, 'wb' ); + fwrite( $this->fp_resume, json_encode( $this->resumableJson ) ); + fclose( $this->fp_resume ); + throw ( $e ); + } + finally { + fclose( $this->fp ); + } + return $rt; + } + + public function donwloadParts() { + $uploadRequests = function () { + $index = 1; + $partSize = 0; + for ( $offset = 0; $offset < $this->totalSize; ) { + $partSize = $this->partSize; + if ( $offset + $this->partSize >= $this->totalSize ) { + $partSize = $this->totalSize - $offset; + } + $this->parts[$index]['PartSize'] = $partSize; + $this->parts[$index]['Offset'] = $offset; + $begin = $offset; + $end = $offset + $partSize - 1; + if ( !( $this->resumableDownload && + isset( $this->resumableJsonLocal['DownloadedBlocks'] ) && + in_array( ['from' => $begin, 'to' => $end], $this->resumableJsonLocal['DownloadedBlocks'] ) ) ) { + $params = array( + 'Bucket' => $this->options['Bucket'], + 'Key' => $this->options['Key'], + 'Range' => sprintf( 'bytes=%d-%d', $begin, $end ) + ); + $command = $this->client->getCommand( 'getObject', $params ); + $request = $this->client->commandToRequestTransformer( $command ); + $index += 1; + yield $request; + } else { + $this->resumableJson['DownloadedBlocks'][] = ['from' => $begin, 'to' => $end]; + $this->downloadedSize += $partSize; + call_user_func_array( $this->progress, [$this->totalSize, $this->downloadedSize] ); + } + $offset += $partSize; + } + + } + ; + + $pool = new Pool( $this->client->httpClient, $uploadRequests(), [ + 'concurrency' => $this->concurrency, + 'fulfilled' => function ( $response, $index ) { + $index = $index + 1; + $stream = $response->getBody(); + $offset = $this->parts[$index]['Offset']; + $partsize = 8192; + $begin = $offset; + fseek( $this->fp, $offset ); + while ( !$stream->eof() ) { + $output = $stream->read( $partsize ); + $writeLen = fwrite( $this->fp, $output ); + $offset += $writeLen; + } + $end = $offset - 1; + $this->resumableJson['DownloadedBlocks'][] = ['from' => $begin, 'to' => $end]; + $partSize = $this->parts[$index]['PartSize']; + $this->downloadedSize += $partSize; + call_user_func_array( $this->progress, [$this->totalSize, $this->downloadedSize] ); + } + , + 'rejected' => function ( $reason, $index ) { + throw( $reason ); + } + ] ); + $promise = $pool->promise(); + $promise->wait(); + } + +} diff --git a/vendor/qcloud/cos-sdk-v5/src/Request/BodyLocation.php b/vendor/qcloud/cos-sdk-v5/src/Request/BodyLocation.php new file mode 100644 index 0000000..73787fd --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/Request/BodyLocation.php @@ -0,0 +1,49 @@ +getBody()->getContents(); + if ('' !== $value) { + throw new \RuntimeException('Only one "body" location may exist per operation'); + } + // binary string data from bound parameter + $value = $command[$param->getName()]; + return $request->withBody(Psr7\Utils::streamFor($value)); + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/ResultTransformer.php b/vendor/qcloud/cos-sdk-v5/src/ResultTransformer.php new file mode 100644 index 0000000..70f22fa --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/ResultTransformer.php @@ -0,0 +1,187 @@ +config = $config; + $this->operation = $operation; + } + + public function writeDataToLocal(CommandInterface $command, RequestInterface $request, ResponseInterface $response) { + $action = $command->getName(); + if ($action == "GetObject" || $action == "GetSnapshot") { + if (isset($command['SaveAs'])) { + $fp = fopen($command['SaveAs'], "wb"); + $stream = $response->getBody(); + $offset = 0; + $partsize = 8192; + while (!$stream->eof()) { + $output = $stream->read($partsize); + fseek($fp, $offset); + fwrite($fp, $output); + $offset += $partsize; + } + fclose($fp); + } + } + } + + public function metaDataTransformer(CommandInterface $command, ResponseInterface $response, Result $result) { + $headers = $response->getHeaders(); + $metadata = array(); + foreach ($headers as $key => $value) { + if (strpos($key, "x-cos-meta-") === 0) { + $metadata[substr($key, 11)] = $value[0]; + } + } + if (!empty($metadata)) { + $result['Metadata'] = $metadata; + } + return $result; + } + + public function extraHeadersTransformer(CommandInterface $command, RequestInterface $request, Result $result) { + if ($command['Key'] != null && $result['Key'] == null) { + $result['Key'] = $command['Key']; + } + if ($command['Bucket'] != null && $result['Bucket'] == null) { + $result['Bucket'] = $command['Bucket']; + } + $result['Location'] = $request->getHeader("Host")[0] . $request->getUri()->getPath(); + return $result; + } + + public function selectContentTransformer(CommandInterface $command, Result $result) { + $action = $command->getName(); + if ($action == "SelectObjectContent") { + $result['Data'] = $this->getSelectContents($result); + } + return $result; + } + + public function ciContentInfoTransformer(CommandInterface $command, Result $result) { + $action = $command->getName(); + if ($action == "ImageInfo" || $action == "ImageExif" || $action == "ImageAve") { + $length = intval($result['ContentLength']); + if($length > 0){ + $result['Data'] = $this->geCiContentInfo($result, $length); + } + } + + if ($action == "PutObject" && isset($command["PicOperations"]) && $command["PicOperations"]) { + $picOperations = json_decode($command["PicOperations"], true); + $picRuleSize = isset($picOperations['rules']) && is_array($picOperations['rules']) ? sizeof($picOperations['rules']) : 0; + $length = intval($result['ContentLength']); + if($length > 0){ + $content = $this->geCiContentInfo($result, $length); + $obj = simplexml_load_string($content, "SimpleXMLElement", LIBXML_NOCDATA); + $xmlData = json_decode(json_encode($obj),true); + if ($picRuleSize == 1 && isset($xmlData['ProcessResults']['Object'])){ + $tmp = $xmlData['ProcessResults']['Object']; + unset($xmlData['ProcessResults']['Object']); + $xmlData['ProcessResults']['Object'][] = $tmp; + } + $result['Data'] = $xmlData; + } + } + + if ($action == "GetBucketGuetzli" ) { + $length = intval($result['ContentLength']); + if($length > 0){ + $content = $this->geCiContentInfo($result, $length); + $obj = simplexml_load_string($content, "SimpleXMLElement", LIBXML_NOCDATA); + $arr = json_decode(json_encode($obj),true); + $result['GuetzliStatus'] = isset($arr[0]) ? $arr[0] : ''; + } + } + + $xml2JsonActions = array( + 'CreateMediaTranscodeJobs' => 1, + 'CreateMediaJobs' => 1, + 'DescribeMediaJob' => 1, + 'DescribeMediaJobs' => 1, + 'CreateMediaSnapshotJobs' => 1, + 'CreateMediaConcatJobs' => 1, + 'CreateMediaVoiceSeparateJobs' => 1, + 'DescribeMediaVoiceSeparateJob' => 1, + ); + if (key_exists($action, $xml2JsonActions)) { + $length = intval($result['ContentLength']); + if($length > 0){ + $content = $this->geCiContentInfo($result, $length); + $obj = simplexml_load_string($content, "SimpleXMLElement", LIBXML_NOCDATA); + $xmlData = json_decode(json_encode($obj),true); + $result['Response'] = $xmlData; + } + } + + return $result; + } + + public function geCiContentInfo($result, $length) { + $f = $result['Body']; + $data = ""; + while (!$f->eof()) { + $tmp = $f->read($length); + if (empty($tmp)) { + break; + } + $data .= $tmp; + } + return $data; + } + + public function getSelectContents($result) { + $f = $result['RawData']; + while (!$f->eof()) { + $data = array(); + $tmp = $f->read(4); + if (empty($tmp)) { + break; + } + $total_length = (int)(unpack("N", $tmp)[1]); + $headers_length = (int)(unpack("N", $f->read(4))[1]); + $body_length = $total_length - $headers_length - 16; + $predule_crc = (int)(unpack("N", $f->read(4))[1]); + $headers = array(); + for ($offset = 0; $offset < $headers_length;) { + $key_length = (int)(unpack("C", $f->read(1))[1]); + $key = $f->read($key_length); + + $head_value_type = (int)(unpack("C", $f->read(1))[1]); + + $value_length = (int)(unpack("n", $f->read(2))[1]); + $value = $f->read($value_length); + $offset += 4 + $key_length + $value_length; + if ($key == ":message-type") { + $data['MessageType'] = $value; + } + if ($key == ":event-type") { + $data['EventType'] = $value; + } + if ($key == ":error-code") { + $data['ErrorCode'] = $value; + } + if ($key == ":error-message") { + $data['ErrorMessage'] = $value; + } + } + $body = $f->read($body_length); + $message_crc = (int)(unpack("N", $f->read(4))[1]); + $data['Body'] = $body; + yield $data; + } + } + public function __destruct() { + } + +} diff --git a/vendor/qcloud/cos-sdk-v5/src/Serializer.php b/vendor/qcloud/cos-sdk-v5/src/Serializer.php new file mode 100644 index 0000000..1999e1b --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/Serializer.php @@ -0,0 +1,81 @@ +offsetExists('key') === true) { + $mode = empty($command->offsetGet('auth')) === false + ? $command->offsetGet('auth') + : 'loco'; + if ($mode !== 'query') { + // else use Authorization header of various types + if ($mode === 'loco') { + $value = 'Loco '.$command->offsetGet('key'); + $request = $request->withHeader('Authorization', $value); + } elseif ($mode === 'basic') { + $value = 'Basic '.base64_encode($command->offsetGet('key').':'); + $request = $request->withHeader('Authorization', $value); + } else { + throw new \InvalidArgumentException("Invalid auth type: {$mode}"); + } + // avoid request sending key parameter in query string + $command->offsetUnset('key'); + } + } + // Remap legacy parameters to common `data` binding on request body + static $remap = [ + 'import' => ['src'=>'data'], + 'translate' => ['translation'=>'data'], + ]; + $name = $command->getName(); + if (isset($remap[$name])) { + foreach ($remap[$name] as $old => $new) { + if ($command->offsetExists($old)) { + $command->offsetSet($new, $command->offsetGet($old)); + $command->offsetUnset($old); + } + } + } + */ + return parent::prepareRequest($command, $request); + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/Service.php b/vendor/qcloud/cos-sdk-v5/src/Service.php new file mode 100644 index 0000000..ee9f6d3 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/Service.php @@ -0,0 +1,7072 @@ + 'Cos Service', + 'apiVersion' => 'V5', + 'description' => 'Cos V5 API Service', + 'operations' => array( + // 舍弃一个分块上传且删除已上传的分片块 + 'AbortMultipartUpload' => array( + 'httpMethod' => 'DELETE', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'AbortMultipartUploadOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri'), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey')), + 'UploadId' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId' + ) + ) + ), + // 创建存储桶(Bucket) + 'CreateBucket' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'CreateBucketOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'CreateBucketConfiguration')), + 'parameters' => array( + 'ACL' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-acl'), + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ) + ) + ), + // 完成整个分块上传 + 'CompleteMultipartUpload' => array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'CompleteMultipartUploadOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'CompleteMultipartUpload' + ) + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri'), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'Parts' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true), + 'items' => array( + 'name' => 'CompletedPart', + 'type' => 'object', + 'sentAs' => 'Part', + 'properties' => array( + 'ETag' => array( + 'type' => 'string' + ), + 'PartNumber' => array( + 'type' => 'numeric' + ) + ) + ) + ), + 'UploadId' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId', + ), + 'PicOperations' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Pic-Operations', + ) + ) + ), + // 初始化分块上传 + 'CreateMultipartUpload' => array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}{/Key*}?uploads', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'CreateMultipartUploadOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'CreateMultipartUploadRequest' + ) + ), + 'parameters' => array( + 'ACL' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-acl', + ), + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'CacheControl' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Cache-Control', + ), + 'ContentDisposition' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Disposition', + ), + 'ContentEncoding' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Encoding', + ), + 'ContentLanguage' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Language', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'Expires' => array( + 'type' => array( + 'object', + 'string', + 'integer', + ), + 'format' => 'date-time-http', + 'location' => 'header', + ), + 'GrantFullControl' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-full-control', + ), + 'GrantRead' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-read', + ), + 'GrantReadACP' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-read-acp', + ), + 'GrantWriteACP' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-write-acp', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'StorageClass' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-storage-class', + ), + 'WebsiteRedirectLocation' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-website-redirect-location', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKey' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'SSEKMSKeyId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-aws-kms-key-id', + ), + 'RequestPayer' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-payer', + ), + 'ACP' => array( + 'type' => 'object', + 'additionalProperties' => true, + ), + 'PicOperations' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Pic-Operations', + ) + ) + ), + // 复制对象 + 'CopyObject' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'CopyObjectOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'CopyObjectRequest', + ), + ), + 'parameters' => array( + 'ACL' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-acl', + ), + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'CacheControl' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Cache-Control', + ), + 'ContentDisposition' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Disposition', + ), + 'ContentEncoding' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Encoding', + ), + 'ContentLanguage' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Language', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'CopySource' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source', + ), + 'CopySourceIfMatch' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-if-match', + ), + 'CopySourceIfModifiedSince' => array( + 'type' => array( + 'object', + 'string', + 'integer', + ), + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-if-modified-since', + ), + 'CopySourceIfNoneMatch' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-if-none-match', + ), + 'CopySourceIfUnmodifiedSince' => array( + 'type' => array( + 'object', + 'string', + 'integer', + ), + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-if-unmodified-since', + ), + 'Expires' => array( + 'type' => array( + 'object', + 'string', + 'integer', + ), + 'format' => 'date-time-http', + 'location' => 'header', + ), + 'GrantFullControl' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-full-control', + ), + 'GrantRead' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-read', + ), + 'GrantReadACP' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-read-acp', + ), + 'GrantWriteACP' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-write-acp', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey') + ), + 'MetadataDirective' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-metadata-directive', + ), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'StorageClass' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-storage-class', + ), + 'WebsiteRedirectLocation' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-website-redirect-location', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKey' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key', + ), + 'CopySourceSSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-server-side-encryption-customer-algorithm', + ), + 'CopySourceSSECustomerKey' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-server-side-encryption-customer-key', + ), + 'CopySourceSSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-server-side-encryption-customer-key-MD5', + ), + 'RequestPayer' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-payer', + ), + 'ACP' => array( + 'type' => 'object', + 'additionalProperties' => true, + ) + ), + ), + // 删除存储桶 (Bucket) + 'DeleteBucket' => array( + 'httpMethod' => 'DELETE', + 'uri' => '/{Bucket}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DeleteBucketOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ) + ) + ), + // 删除跨域访问配置信息 + 'DeleteBucketCors' => array( + 'httpMethod' => 'DELETE', + 'uri' => '/{Bucket}?cors', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DeleteBucketCorsOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ), + // 删除存储桶标签信息 + 'DeleteBucketTagging' => array( + 'httpMethod' => 'DELETE', + 'uri' => '/{Bucket}?tagging', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DeleteBucketTaggingOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ), + // 删除存储桶标清单任务 + 'DeleteBucketInventory' => array( + 'httpMethod' => 'Delete', + 'uri' => '/{Bucket}?inventory', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DeleteBucketInventoryOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Id' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'id', + ) + ), + ), + // 删除 COS 上单个对象 + 'DeleteObject' => array( + 'httpMethod' => 'DELETE', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DeleteObjectOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'MFA' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-mfa', + ), + 'VersionId' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ), + 'RequestPayer' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-payer', + ) + ) + ), + // 批量删除 COS 对象 + 'DeleteObjects' => array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}?delete', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DeleteObjectsOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Delete', + ), + 'contentMd5' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Objects' => array( + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'sentAs' => 'Object', + 'properties' => array( + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'minLength' => 1, + ), + 'VersionId' => array( + 'type' => 'string', + ), + ), + ), + ), + 'Quiet' => array( + 'type' => 'boolean', + 'format' => 'boolean-string', + 'location' => 'xml', + ), + 'MFA' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-mfa', + ), + 'RequestPayer' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-payer', + ) + ), + ), + // 删除存储桶(Bucket)的website + 'DeleteBucketWebsite' => array( + 'httpMethod' => 'DELETE', + 'uri' => '/{Bucket}?website', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DeleteBucketWebsiteOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ), + // 删除存储桶(Bucket)的生命周期配置 + 'DeleteBucketLifecycle' => array( + 'httpMethod' => 'DELETE', + 'uri' => '/{Bucket}?lifecycle', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DeleteBucketLifecycleOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ), + // 删除跨区域复制配置 + 'DeleteBucketReplication' => array( + 'httpMethod' => 'DELETE', + 'uri' => '/{Bucket}?replication', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DeleteBucketReplicationOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ), + // 配置对象标签 + 'PutObjectTagging' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}{/Key*}?tagging', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutObjectTaggingOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Tagging', + ), + 'contentMd5' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'TagSet' => array( + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'name' => 'TagRule', + 'type' => 'object', + 'sentAs' => 'Tag', + 'properties' => array( + 'Key' => array( + 'required' => true, + 'type' => 'string', + ), + 'Value' => array( + 'required' => true, + 'type' => 'string', + ), + ), + ), + ), + ), + ), + // 获取对象标签信息 + 'GetObjectTagging' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}?tagging', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetObjectTaggingOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ) + ), + ), + // 删除对象标签 + 'DeleteObjectTagging' => array( + 'httpMethod' => 'DELETE', + 'uri' => '/{Bucket}{/Key*}?tagging', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DeleteObjectTaggingOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ) + ) + ), + // 下载对象 + 'GetObject' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetObjectOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ), + 'IfMatch' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'If-Match' + ), + 'IfModifiedSince' => array( + 'type' => array( + 'object', + 'string', + 'integer' + ), + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'If-Modified-Since' + ), + 'IfNoneMatch' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'If-None-Match' + ), + 'IfUnmodifiedSince' => array( + 'type' => array( + 'object', + 'string', + 'integer' + ), + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'If-Unmodified-Since' + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'Range' => array( + 'type' => 'string', + 'location' => 'header'), + 'ResponseCacheControl' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-cache-control' + ), + 'ResponseContentDisposition' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-content-disposition' + ), + 'ResponseContentEncoding' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-content-encoding' + ), + 'ResponseContentLanguage' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-content-language' + ), + 'ResponseContentType' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'response-content-type' + ), + 'ResponseExpires' => array( + 'type' => array( + 'object', + 'string', + 'integer' + ), + 'format' => 'date-time-http', + 'location' => 'query', + 'sentAs' => 'response-expires' + ), + 'VersionId' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKey' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'TrafficLimit' => array( + 'type' => 'integer', + 'location' => 'header', + 'sentAs' => 'x-cos-traffic-limit', + ) + ) + ), + // 获取 COS 对象的访问权限信息(Access Control List, ACL) + 'GetObjectAcl' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}?acl', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetObjectAclOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey') + ), + 'VersionId' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ), + 'RequestPayer' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-payer', + ) + ) + ), + // 获取存储桶(Bucket)的访问权限信息(Access Control List, ACL) + 'GetBucketAcl' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?acl', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketAclOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ) + ) + ), + // 查询存储桶(Bucket)跨域访问配置信息 + 'GetBucketCors' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?cors', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketCorsOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ) + ), + ), + // 查询存储桶(Bucket)Domain配置信息 + 'GetBucketDomain' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?domain', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketDomainOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ) + ), + ), + // 查询存储桶(Bucket)Accelerate配置信息 + 'GetBucketAccelerate' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?accelerate', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketAccelerateOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ) + ), + ), + // 查询存储桶(Bucket)Website配置信息 + 'GetBucketWebsite' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?website', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketWebsiteOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ) + ), + ), + // 查询存储桶(Bucket)的生命周期配置 + 'GetBucketLifecycle' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?lifecycle', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketLifecycleOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ) + ), + ), + // 获取存储桶(Bucket)版本控制信息 + 'GetBucketVersioning' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?versioning', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketVersioningOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ) + ), + ), + // 获取存储桶(Bucket)跨区域复制配置信息 + 'GetBucketReplication' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?replication', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketReplicationOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ) + ), + ), + // 获取存储桶(Bucket)所在的地域信息 + 'GetBucketLocation' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?location', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketLocationOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ), + // 获取存储桶(Bucket)Notification信息 + 'GetBucketNotification' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?notification', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketNotificationOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ) + ), + ), + // 获取存储桶(Bucket)日志信息 + 'GetBucketLogging' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?logging', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketLoggingOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ) + ), + ), + // 获取存储桶(Bucket)清单信息 + 'GetBucketInventory' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?inventory', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketInventoryOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Id' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'id', + ) + ), + ), + // 获取存储桶(Bucket)标签信息 + 'GetBucketTagging' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?tagging', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketTaggingOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ) + ), + ), + // 分块上传 + 'UploadPart' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'UploadPartOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'UploadPartRequest' + ) + ), + 'parameters' => array( + 'Body' => array( + 'type' => array( + 'any'), + 'location' => 'body' + ), + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length' + ), + 'ContentMD5' => array( + 'type' => array( + 'boolean' + ), + 'location' => 'header', + 'sentAs' => 'Content-MD5' + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'PartNumber' => array( + 'required' => true, + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'partNumber'), + 'UploadId' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId'), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKey' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'RequestPayer' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-payer', + ), + 'TrafficLimit' => array( + 'type' => 'integer', + 'location' => 'header', + 'sentAs' => 'x-cos-traffic-limit', + ) + ) + ), + // 上传对象 + 'PutObject' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutObjectOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'PutObjectRequest' + ) + ), + 'parameters' => array( + 'ACL' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-acl' + ), + 'Body' => array( + 'required' => true, + 'type' => array( + 'any' + ), + 'location' => 'body' + ), + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ), + 'CacheControl' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Cache-Control' + ), + 'ContentDisposition' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Disposition' + ), + 'ContentEncoding' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Encoding' + ), + 'ContentLanguage' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Language' + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length' + ), + 'ContentMD5' => array( + 'type' => array( + 'boolean' + ), + 'location' => 'header', + 'sentAs' => 'Content-MD5' + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type' + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'StorageClass' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-storage-class', + ), + 'WebsiteRedirectLocation' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-website-redirect-location', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKey' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'SSEKMSKeyId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-cos-kms-key-id', + ), + 'RequestPayer' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-payer', + ), + 'ACP' => array( + 'type' => 'object', + 'additionalProperties' => true, + ), + 'PicOperations' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Pic-Operations', + ), + 'TrafficLimit' => array( + 'type' => 'integer', + 'location' => 'header', + 'sentAs' => 'x-cos-traffic-limit', + ), + 'Tagging' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-tagging', + ), + ) + ), + // 追加对象 + 'AppendObject' => array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}{/Key*}?append', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'AppendObjectOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'AppendObjectRequest' + ) + ), + 'parameters' => array( + 'Position' => array( + 'type' => 'integer', + 'required' => true, + 'location' => 'query', + 'sentAs' => 'position' + ), + 'ACL' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-acl' + ), + 'Body' => array( + 'required' => true, + 'type' => array( + 'any' + ), + 'location' => 'body' + ), + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ), + 'CacheControl' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Cache-Control' + ), + 'ContentDisposition' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Disposition' + ), + 'ContentEncoding' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Encoding' + ), + 'ContentLanguage' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Language' + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length' + ), + 'ContentMD5' => array( + 'type' => array( + 'boolean' + ), + 'location' => 'header', + 'sentAs' => 'Content-MD5' + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type' + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'StorageClass' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-storage-class', + ), + 'WebsiteRedirectLocation' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-website-redirect-location', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKey' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'SSEKMSKeyId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-cos-kms-key-id', + ), + 'RequestPayer' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-payer', + ), + 'ACP' => array( + 'type' => 'object', + 'additionalProperties' => true, + ), + 'PicOperations' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Pic-Operations', + ), + 'TrafficLimit' => array( + 'type' => 'integer', + 'location' => 'header', + 'sentAs' => 'x-cos-traffic-limit', + ) + ) + ), + // 设置 COS 对象的访问权限信息(Access Control List, ACL) + 'PutObjectAcl' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}{/Key*}?acl', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutObjectAclOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'AccessControlPolicy', + ), + ), + 'parameters' => array( + 'ACL' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-acl', + ), + 'Grants' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'AccessControlList', + 'items' => array( + 'name' => 'Grant', + 'type' => 'object', + 'properties' => array( + 'Grantee' => array( + 'type' => 'object', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string'), + 'ID' => array( + 'type' => 'string'), + 'Type' => array( + 'type' => 'string', + 'sentAs' => 'xsi:type', + 'data' => array( + 'xmlAttribute' => true, + 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance')), + 'URI' => array( + 'type' => 'string') )), + 'Permission' => array( + 'type' => 'string', + ), + ), + ), + ), + 'Owner' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string', + ), + 'ID' => array( + 'type' => 'string', + ), + ), + ), + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'GrantFullControl' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-full-control', + ), + 'GrantRead' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-read', + ), + 'GrantReadACP' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-read-acp', + ), + 'GrantWrite' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-write', + ), + 'GrantWriteACP' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-write-acp', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey') + ), + 'RequestPayer' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-payer', + ), + 'ACP' => array( + 'type' => 'object', + 'additionalProperties' => true, + ), + ) + ), + // 设置存储桶(Bucket)的访问权限(Access Control List, ACL) + 'PutBucketAcl' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?acl', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketAclOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'AccessControlPolicy', + ), + ), + 'parameters' => array( + 'ACL' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-acl', + ), + 'Grants' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'AccessControlList', + 'items' => array( + 'name' => 'Grant', + 'type' => 'object', + 'properties' => array( + 'Grantee' => array( + 'type' => 'object', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string', + ), + 'EmailAddress' => array( + 'type' => 'string', + ), + 'ID' => array( + 'type' => 'string', + ), + 'Type' => array( + 'required' => true, + 'type' => 'string', + 'sentAs' => 'xsi:type', + 'data' => array( + 'xmlAttribute' => true, + 'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance', + ), + ), + 'URI' => array( + 'type' => 'string', + ), + ), + ), + 'Permission' => array( + 'type' => 'string', + ), + ), + ), + ), + 'Owner' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string', + ), + 'ID' => array( + 'type' => 'string', + ), + ), + ), + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'GrantFullControl' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-full-control', + ), + 'GrantRead' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-read', + ), + 'GrantReadACP' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-read-acp', + ), + 'GrantWrite' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-write', + ), + 'GrantWriteACP' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-grant-write-acp', + ), + 'ACP' => array( + 'type' => 'object', + 'additionalProperties' => true, + ), + ), + ), + // 设置存储桶(Bucket)的跨域配置信息 + 'PutBucketCors' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?cors', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketCorsOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'CORSConfiguration', + ), + 'contentMd5' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'CORSRules' => array( + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'CORSRule', + 'type' => 'object', + 'sentAs' => 'CORSRule', + 'properties' => array( + 'ID' => array( + 'type' => 'string', + ), + 'AllowedHeaders' => array( + 'type' => 'array', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'AllowedHeader', + 'type' => 'string', + 'sentAs' => 'AllowedHeader', + ), + ), + 'AllowedMethods' => array( + 'required' => true, + 'type' => 'array', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'AllowedMethod', + 'type' => 'string', + 'sentAs' => 'AllowedMethod', + ), + ), + 'AllowedOrigins' => array( + 'required' => true, + 'type' => 'array', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'AllowedOrigin', + 'type' => 'string', + 'sentAs' => 'AllowedOrigin', + ), + ), + 'ExposeHeaders' => array( + 'type' => 'array', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'ExposeHeader', + 'type' => 'string', + 'sentAs' => 'ExposeHeader', + ), + ), + 'MaxAgeSeconds' => array( + 'type' => 'numeric', + ), + ), + ), + ), + ), + ), + // 设置存储桶(Bucket)的Domain信息 + 'PutBucketDomain' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?domain', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketDomainOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'DomainConfiguration', + ), + 'contentMd5' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'DomainRules' => array( + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'DomainRule', + 'type' => 'object', + 'sentAs' => 'DomainRule', + 'properties' => array( + 'Status' => array( + 'required' => true, + 'type' => 'string', + ), + 'Name' => array( + 'required' => true, + 'type' => 'string', + ), + 'Type' => array( + 'required' => true, + 'type' => 'string', + ), + 'ForcedReplacement' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + // 设置存储桶(Bucket)生命周期配置 + 'PutBucketLifecycle' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?lifecycle', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketLifecycleOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'LifecycleConfiguration', + ), + 'contentMd5' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Rules' => array( + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'Rule', + 'type' => 'object', + 'sentAs' => 'Rule', + 'properties' => array( + 'Expiration' => array( + 'type' => 'object', + 'properties' => array( + 'Date' => array( + 'type' => array( + 'object', + 'string', + 'integer', + ), + 'format' => 'date-time', + ), + 'Days' => array( + 'type' => 'numeric', + ), + ), + ), + 'ID' => array( + 'type' => 'string', + ), + 'Filter' => array( + 'type' => 'object', + 'require' => true, + 'properties' => array( + 'Prefix' => array( + 'type' => 'string', + 'require' => true, + ), + 'Tag' => array( + 'type' => 'object', + 'require' => true, + 'properties' => array( + 'Key' => array( + 'type' => 'string' + ), + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey'), + 'Value' => array( + 'type' => 'string' + ), + ) + ) + ), + ), + 'Status' => array( + 'required' => true, + 'type' => 'string', + ), + 'Transitions' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'Transition', + 'type' => 'object', + 'sentAs' => 'Transition', + 'properties' => array( + 'Date' => array( + 'type' => array( + 'object', + 'string', + 'integer', + ), + 'format' => 'date-time', + ), + 'Days' => array( + 'type' => 'numeric', + ), + 'StorageClass' => array( + 'type' => 'string', + )))), + 'NoncurrentVersionTransition' => array( + 'type' => 'object', + 'properties' => array( + 'NoncurrentDays' => array( + 'type' => 'numeric', + ), + 'StorageClass' => array( + 'type' => 'string', + ), + ), + ), + 'NoncurrentVersionExpiration' => array( + 'type' => 'object', + 'properties' => array( + 'NoncurrentDays' => array( + 'type' => 'numeric', + ), + ), + ), + ), + ), + ), + ), + ), + // 存储桶(Bucket)版本控制 + 'PutBucketVersioning' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?versioning', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketVersioningOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'VersioningConfiguration', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'MFA' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-mfa', + ), + 'MFADelete' => array( + 'type' => 'string', + 'location' => 'xml', + 'sentAs' => 'MfaDelete', + ), + 'Status' => array( + 'type' => 'string', + 'location' => 'xml', + ), + ), + ), + // 配置存储桶(Bucket)Accelerate + 'PutBucketAccelerate' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?accelerate', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketAccelerateOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'AccelerateConfiguration', + ), + 'xmlAllowEmpty' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Status' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'xml', + ) + ), + ), + // 配置存储桶(Bucket)website + 'PutBucketWebsite' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?website', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketWebsiteOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'WebsiteConfiguration', + ), + 'xmlAllowEmpty' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'ErrorDocument' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Key' => array( + 'type' => 'string', + 'minLength' => 1, + ), + ), + ), + 'IndexDocument' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Suffix' => array( + 'required' => true, + 'type' => 'string', + ), + ), + ), + 'RedirectAllRequestsTo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HostName' => array( + 'type' => 'string', + ), + 'Protocol' => array( + 'type' => 'string', + ), + ), + ), + 'RoutingRules' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'name' => 'RoutingRule', + 'type' => 'object', + 'properties' => array( + 'Condition' => array( + 'type' => 'object', + 'properties' => array( + 'HttpErrorCodeReturnedEquals' => array( + 'type' => 'string', + ), + 'KeyPrefixEquals' => array( + 'type' => 'string', + ), + ), + ), + 'Redirect' => array( + 'type' => 'object', + 'properties' => array( + 'HostName' => array( + 'type' => 'string', + ), + 'HttpRedirectCode' => array( + 'type' => 'string', + ), + 'Protocol' => array( + 'type' => 'string', + ), + 'ReplaceKeyPrefixWith' => array( + 'type' => 'string', + ), + 'ReplaceKeyWith' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + ), + ), + // 配置存储桶(Bucket)跨区域复制 + 'PutBucketReplication' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?replication', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketReplicationOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'ReplicationConfiguration', + ), + 'contentMd5' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Role' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'xml', + ), + 'Rules' => array( + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'ReplicationRule', + 'type' => 'object', + 'sentAs' => 'Rule', + 'properties' => array( + 'ID' => array( + 'type' => 'string', + ), + 'Prefix' => array( + 'required' => true, + 'type' => 'string', + ), + 'Status' => array( + 'required' => true, + 'type' => 'string', + ), + 'Destination' => array( + 'required' => true, + 'type' => 'object', + 'properties' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + ), + 'StorageClass' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + ), + ), + // 设置存储桶(Bucket)的回调设置 + 'PutBucketNotification' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?notification', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketNotificationOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'NotificationConfiguration', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'CloudFunctionConfigurations' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'CloudFunctionConfiguration', + 'type' => 'object', + 'sentAs' => 'CloudFunctionConfiguration', + 'properties' => array( + 'Id' => array( + 'type' => 'string', + ), + 'CloudFunction' => array( + 'required' => true, + 'type' => 'string', + 'sentAs' => 'CloudFunction', + ), + 'Events' => array( + 'required' => true, + 'type' => 'array', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'Event', + 'type' => 'string', + 'sentAs' => 'Event', + ), + ), + 'Filter' => array( + 'type' => 'object', + 'properties' => array( + 'Key' => array( + 'type' => 'object', + 'sentAs' => 'Key', + 'properties' => array( + 'FilterRules' => array( + 'type' => 'array', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'FilterRule', + 'type' => 'object', + 'sentAs' => 'FilterRule', + 'properties' => array( + 'Name' => array( + 'type' => 'string', + ), + 'Value' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey') + ), + ), + ), + ), + ), + ), + ), + // 配置存储桶(Bucket)标签 + 'PutBucketTagging' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?tagging', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketTaggingOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Tagging', + ), + 'contentMd5' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'TagSet' => array( + 'required' => true, + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'name' => 'TagRule', + 'type' => 'object', + 'sentAs' => 'Tag', + 'properties' => array( + 'Key' => array( + 'required' => true, + 'type' => 'string', + ), + 'Value' => array( + 'required' => true, + 'type' => 'string', + ), + ), + ), + ), + ), + ), + //开启存储桶(Bucket)日志服务 + 'PutBucketLogging' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?logging', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketLoggingOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'BucketLoggingStatus', + ), + 'contentMd5' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'LoggingEnabled' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'TargetBucket' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'TargetPrefix' => array( + 'type' => 'string', + 'location' => 'xml', + ), + ) + ), + ), + ), + // 配置存储桶(Bucket)清单 + 'PutBucketInventory' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?inventory', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketInventoryOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'InventoryConfiguration', + ), + 'contentMd5' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Id' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'xml', + ), + 'IsEnabled' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'xml', + ), + 'Destination' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'COSBucketDestination'=> array( + 'type' => 'object', + 'properties' => array( + 'Format' => array( + 'type' => 'string', + 'require' => true, + ), + 'AccountId' => array( + 'type' => 'string', + 'require' => true, + ), + 'Bucket' => array( + 'type' => 'string', + 'require' => true, + ), + 'Prefix' => array( + 'type' => 'string', + ), + 'Encryption' => array( + 'type' => 'object', + 'properties' => array( + 'SSE-COS' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + ), + 'Schedule' => array( + 'required' => true, + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Frequency' => array( + 'type' => 'string', + 'require' => true, + ), + ) + ), + 'Filter' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Prefix' => array( + 'type' => 'string', + ), + ) + ), + 'IncludedObjectVersions' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'xml', + ), + 'OptionalFields' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'name' => 'Fields', + 'type' => 'string', + 'sentAs' => 'Field', + ), + ), + ), + ), + // 回热归档对象 + 'RestoreObject' => array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}{/Key*}?restore', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'RestoreObjectOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'RestoreRequest', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey') + ), + 'VersionId' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ), + 'Days' => array( + 'required' => true, + 'type' => 'numeric', + 'location' => 'xml', + ), + 'CASJobParameters' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Tier' => array( + 'type' => 'string', + 'required' => true, + ), + ), + ), + 'RequestPayer' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-payer', + ), + ), + ), + // 查询存储桶(Bucket)中正在进行中的分块上传对象 + 'ListParts' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'ListPartsOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'MaxParts' => array( + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'max-parts'), + 'PartNumberMarker' => array( + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'part-number-marker' + ), + 'UploadId' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId' + ) + ) + ), + // 查询存储桶(Bucket)下的部分或者全部对象 + 'ListObjects' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'ListObjectsOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ), + 'Delimiter' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'delimiter' + ), + 'EncodingType' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'encoding-type' + ), + 'Marker' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'marker' + ), + 'MaxKeys' => array( + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'max-keys' + ), + 'Prefix' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'prefix' + ) + ) + ), + // 获取所属账户的所有存储空间列表 + 'ListBuckets' => array( + 'httpMethod' => 'GET', + 'uri' => '/', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'ListBucketsOutput', + 'responseType' => 'model', + 'parameters' => array( + ), + ), + // 获取多版本对象 + 'ListObjectVersions' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?versions', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'ListObjectVersionsOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Delimiter' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'delimiter', + ), + 'EncodingType' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'encoding-type', + ), + 'KeyMarker' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'key-marker', + ), + 'MaxKeys' => array( + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'max-keys', + ), + 'Prefix' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'prefix', + ), + 'VersionIdMarker' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'version-id-marker', + ) + ), + ), + // 获取已上传分块列表 + 'ListMultipartUploads' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?uploads', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'ListMultipartUploadsOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Delimiter' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'delimiter', + ), + 'EncodingType' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'encoding-type', + ), + 'KeyMarker' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'key-marker', + ), + 'MaxUploads' => array( + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'max-uploads', + ), + 'Prefix' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'prefix', + ), + 'UploadIdMarker' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'upload-id-marker', + ) + ), + ), + // 获取清单列表 + 'ListBucketInventoryConfigurations' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?inventory', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'ListBucketInventoryConfigurationsOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ), + 'ContinuationToken' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'continuation-token', + ), + ), + ), + // 获取对象的meta信息 + 'HeadObject' => array( + 'httpMethod' => 'HEAD', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'HeadObjectOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'IfMatch' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'If-Match', + ), + 'IfModifiedSince' => array( + 'type' => array( + 'object', + 'string', + 'integer', + ), + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'If-Modified-Since', + ), + 'IfNoneMatch' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'If-None-Match', + ), + 'IfUnmodifiedSince' => array( + 'type' => array( + 'object', + 'string', + 'integer', + ), + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'If-Unmodified-Since', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey') + ), + 'Range' => array( + 'type' => 'string', + 'location' => 'header', + ), + 'VersionId' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'versionId', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKey' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'RequestPayer' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-payer', + ), + ) + ), + // 存储桶(Bucket)是否存在 + 'HeadBucket' => array( + 'httpMethod' => 'HEAD', + 'uri' => '/{Bucket}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'HeadBucketOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ) + ), + // 分块copy + 'UploadPartCopy' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'UploadPartCopyOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'UploadPartCopyRequest', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'CopySource' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source', + ), + 'CopySourceIfMatch' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-if-match', + ), + 'CopySourceIfModifiedSince' => array( + 'type' => array( + 'object', + 'string', + 'integer', + ), + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-if-modified-since', + ), + 'CopySourceIfNoneMatch' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-if-none-match', + ), + 'CopySourceIfUnmodifiedSince' => array( + 'type' => array( + 'object', + 'string', + 'integer', + ), + 'format' => 'date-time-http', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-if-unmodified-since', + ), + 'CopySourceRange' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-range', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey') + ), + 'PartNumber' => array( + 'required' => true, + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'partNumber', + ), + 'UploadId' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'uploadId', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKey' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'CopySourceSSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-server-side-encryption-customer-algorithm', + ), + 'CopySourceSSECustomerKey' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-server-side-encryption-customer-key', + ), + 'CopySourceSSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-server-side-encryption-customer-key-MD5', + ), + 'RequestPayer' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-payer', + ) + ), + ), + // 检索对象内容 + 'SelectObjectContent' => array( + 'httpMethod' => 'Post', + 'uri' => '/{/Key*}?select&select-type=2', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'SelectObjectContentOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'SelectRequest', + ), + 'contentMd5' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey') + ), + 'Expression' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'ExpressionType' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'InputSerialization' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'CompressionType' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'CSV' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'FileHeaderInfo' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'RecordDelimiter' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'FieldDelimiter' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'QuoteCharacter' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'QuoteEscapeCharacter' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Comments' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'AllowQuotedRecordDelimiter' => array( + 'type' => 'string', + 'location' => 'xml', + ), + ) + ), + 'JSON' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Type' => array( + 'type' => 'string', + 'location' => 'xml', + ) + ) + ), + ) + ), + 'OutputSerialization' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'CompressionType' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'CSV' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'QuoteFields' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'RecordDelimiter' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'FieldDelimiter' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'QuoteCharacter' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'QuoteEscapeCharacter' => array( + 'type' => 'string', + 'location' => 'xml', + ), + ) + ), + 'JSON' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'RecordDelimiter' => array( + 'type' => 'string', + 'location' => 'xml', + ) + ) + ), + ) + ), + 'RequestProgress' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'Enabled' => array( + 'type' => 'string', + 'location' => 'xml', + ), + ) + ), + ), + ), + // 存储桶(Bucket)开启智能分层 + 'PutBucketIntelligentTiering' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?intelligenttiering', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketIntelligentTieringOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'IntelligentTieringConfiguration', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Status' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Transition' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'Days' => array( + 'type' => 'integer', + 'location' => 'xml', + ), + 'RequestFrequent' => array( + 'type' => 'integer', + 'location' => 'xml', + ), + ) + ), + ), + ), + // 查询存储桶(Bucket)智能分层 + 'GetBucketIntelligentTiering' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?intelligenttiering', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketIntelligentTieringOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ), + //万象-获取图片基本信息 + 'ImageInfo' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}?imageInfo', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'ImageInfoOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + ) + ), + //万象-获取图片EXIF信息 + 'ImageExif' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}?exif', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'ImageExifOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + ) + ), + //万象-获取图片主色调信息 + 'ImageAve' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}?imageAve', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'ImageAveOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + ), + ), + //万象-云上数据处理 + 'ImageProcess' => array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}{/Key*}?image_process', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'ImageProcessOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'PicOperations' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Pic-Operations', + ), + ), + ), + //万象-二维码下载时识别 + 'Qrcode' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}?ci-process=QRcode', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'QrcodeOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'Cover' => array( + 'type' => 'integer', + 'location' => 'query', + 'sentAs' => 'cover' + ), + ), + ), + //万象-二维码生成 + 'QrcodeGenerate' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?ci-process=qrcode-generate', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'QrcodeGenerateOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'QrcodeContent' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'qrcode-content' + ), + 'QrcodeMode' => array( + 'type' => 'integer', + 'location' => 'query', + 'sentAs' => 'mode' + ), + 'QrcodeWidth' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'width' + ), + ), + ), + //万象-图片标签 + 'DetectLabel' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}?ci-process=detect-label', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DetectLabelOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + ), + ), + //万象-增加样式 + 'PutBucketImageStyle' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?style', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketImageStyleOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'AddStyle', + ), + ), + 'parameters' => array( + 'StyleName' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'StyleBody' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ), + //万象-查询样式 + 'GetBucketImageStyle' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?style', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketImageStyleOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'GetStyle', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'StyleName' => array( + 'type' => 'string', + 'location' => 'xml', + ), + ), + ), + //万象-删除样式 + 'DeleteBucketImageStyle' => array( + 'httpMethod' => 'Delete', + 'uri' => '/{Bucket}?style', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DeleteBucketImageStyleOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'DeleteStyle', + ), + ), + 'parameters' => array( + 'StyleName' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ), + //万象-开通Guetzli压缩 + 'PutBucketGuetzli' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?guetzli', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketGuetzliOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ), + //万象-查询Guetzli状态 + 'GetBucketGuetzli' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?guetzli', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketGuetzliOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ), + //万象-关闭Guetzli压缩 + 'DeleteBucketGuetzli' => array( + 'httpMethod' => 'Delete', + 'uri' => '/{Bucket}?guetzli', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DeleteBucketGuetzliOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + ), + ), + //图片审核 + 'GetObjectSensitiveContentRecognition' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetObjectSensitiveContentRecognitionOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'ci-process' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query' + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'DetectType' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'detect-type' + ), + 'DetectUrl' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'detect-url' + ), + 'Interval' => array( + 'type' => 'integer', + 'location' => 'query', + 'sentAs' => 'interval' + ), + 'MaxFrames' => array( + 'type' => 'integer', + 'location' => 'query', + 'sentAs' => 'max-frames' + ), + 'BizType' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'biz-type' + ) + ), + ), + // 文本审核 + 'DetectText' => array( + 'httpMethod' => 'POST', + 'uri' => '/{Bucket}text/auditing', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'DetectTextOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'Request', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Input' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'Content' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Object' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Url' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'DataId' => array( + 'type' => 'string', + 'location' => 'xml', + ), + ), + ), + 'Conf' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'DetectType' => array( 'type' => 'string', 'location' => 'xml', ), + 'Callback' => array( 'type' => 'string', 'location' => 'xml', ), + 'BizType' => array( 'type' => 'string', 'location' => 'xml', ), + 'CallbackVersion' => array( 'type' => 'string', 'location' => 'xml', ), + ), + ), + ), + ), + //媒体截图 + 'GetSnapshot' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetSnapshotOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'Time' => array( + 'required' => true, + 'type' => 'numeric', + 'location' => 'query', + 'sentAs' => 'time' + ), + 'ci-process' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query' + ), + 'Width' => array( + 'type' => 'integer', + 'location' => 'query', + 'sentAs' => 'width' + ), + 'Height' => array( + 'type' => 'integer', + 'location' => 'query', + 'sentAs' => 'height' + ), + 'Format' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'format' + ), + 'Rotate' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'rotate' + ), + 'Mode' => array( + 'type' => 'string', + 'location' => 'query', + 'sentAs' => 'mode' + ) + ), + ), + //添加防盗链 + 'PutBucketReferer' => array( + 'httpMethod' => 'PUT', + 'uri' => '/{Bucket}?referer', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'PutBucketRefererOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'RefererConfiguration', + ), + 'contentMd5' => true, + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Status' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'xml', + ), + 'RefererType' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'xml', + ), + 'EmptyReferConfiguration' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'xml', + ), + + 'DomainList' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'Domains' => array( + 'type' => 'array', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'Domain', + 'type' => 'string', + 'sentAs' => 'Domain', + ), + ) + ) + ), + ), + ), + //获取防盗链规则 + 'GetBucketReferer' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}?referer', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetBucketRefererOutput', + 'responseType' => 'model', + 'data' => array( + 'xmlRoot' => array( + 'name' => 'RefererConfiguration', + ), + ), + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri' + ) + ) + ), + //获取媒体信息 + 'GetMediaInfo' => array( + 'httpMethod' => 'GET', + 'uri' => '/{Bucket}{/Key*}', + 'class' => 'Qcloud\\Cos\\Command', + 'responseClass' => 'GetMediaInfoOutput', + 'responseType' => 'model', + 'parameters' => array( + 'Bucket' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + ), + 'Key' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'uri', + 'minLength' => 1, + 'filters' => array( + 'Qcloud\\Cos\\Client::explodeKey' + ) + ), + 'ci-process' => array( + 'required' => true, + 'type' => 'string', + 'location' => 'query' + ) + ), + ), + 'CreateMediaTranscodeJobs' => Descriptions::CreateMediaTranscodeJobs(), // 媒体转码 + 'CreateMediaJobs' => Descriptions::CreateMediaJobs(), // 媒体任务 + 'DescribeMediaJob' => Descriptions::DescribeMediaJob(), // 查询指定的媒体任务 + 'DescribeMediaJobs' => Descriptions::DescribeMediaJobs(), // 拉取拉取符合条件的媒体任务 + 'CreateMediaSnapshotJobs' => Descriptions::CreateMediaSnapshotJobs(), // 媒体截图 + 'CreateMediaConcatJobs' => Descriptions::CreateMediaConcatJobs(), // 媒体拼接 + 'DetectAudio' => Descriptions::DetectAudio(), // 音频审核 + 'GetDetectAudioResult' => Descriptions::GetDetectAudioResult(), // 主动获取音频审核结果 + 'GetDetectTextResult' => Descriptions::GetDetectTextResult(), // 主动获取文本文件审核结果 + 'DetectVideo' => Descriptions::DetectVideo(), // 视频审核 + 'GetDetectVideoResult' => Descriptions::GetDetectVideoResult(), // 主动获取视频审核结果 + 'DetectDocument' => Descriptions::DetectDocument(), // 文档审核 + 'GetDetectDocumentResult' => Descriptions::GetDetectDocumentResult(), // 主动获取文档审核结果 + 'CreateDocProcessJobs' => Descriptions::CreateDocProcessJobs(), // 提交文档转码任务 + 'DescribeDocProcessQueues' => Descriptions::DescribeDocProcessQueues(), // 查询文档转码队列 + 'DescribeDocProcessJob' => Descriptions::DescribeDocProcessJob(), // 查询文档转码任务 + 'GetDescribeDocProcessJobs' => Descriptions::GetDescribeDocProcessJobs(), // 拉取符合条件的文档转码任务 + 'DetectImage' => Descriptions::DetectImage(), // 图片审核 + 'DetectImages' => Descriptions::DetectImages(), // 图片审核-批量 + 'DetectVirus' => Descriptions::DetectVirus(), // 云查毒 + 'GetDetectVirusResult' => Descriptions::GetDetectVirusResult(), // 查询病毒检测任务结果 + 'GetDetectImageResult' => Descriptions::GetDetectImageResult(), // 主动获取图片审核结果 + 'CreateMediaVoiceSeparateJobs' => Descriptions::CreateMediaVoiceSeparateJobs(), // 提交人声分离任务 + 'DescribeMediaVoiceSeparateJob' => Descriptions::DescribeMediaVoiceSeparateJob(), // 查询指定的人声分离任务 + 'DetectWebpage' => Descriptions::DetectWebpage(), // 提交网页审核任务 + 'GetDetectWebpageResult' => Descriptions::GetDetectWebpageResult(), // 查询网页审核任务结果 + ), + 'models' => array( + 'AbortMultipartUploadOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id' + ) + ) + ), + 'CreateBucketOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Location' => array( + 'type' => 'string', + 'location' => 'header' + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id' + ) + ) + ), + 'CompleteMultipartUploadOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Location' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Bucket' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Key' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'Expiration' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-expiration', + ), + 'ETag' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'VersionId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-version-id', + ), + 'SSEKMSKeyId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-aws-kms-key-id', + ), + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'CRC' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-hash-crc64ecma', + ), + 'ImageInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Format' => array( + 'type' => 'string', + ), + 'Width' => array( + 'type' => 'string', + ), + 'Height' => array( + 'type' => 'string', + ), + 'Quality' => array( + 'type' => 'string', + ), + 'Ave' => array( + 'type' => 'string', + ), + 'Orientation' => array( + 'type' => 'string', + ), + ), + ), + 'ProcessResults' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Object' => array( + 'type' => 'array', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Key' => array( + 'type' => 'string', + ), + 'Location' => array( + 'type' => 'string', + ), + 'Format' => array( + 'type' => 'string', + ), + 'Width' => array( + 'type' => 'string', + ), + 'Height' => array( + 'type' => 'string', + ), + 'Size' => array( + 'type' => 'string', + ), + 'Quality' => array( + 'type' => 'string', + ), + 'ETag' => array( + 'type' => 'string', + ), + 'WatermarkStatus' => array( + 'type' => 'integer', + ), + ), + ), + ), + ), + ), + ), + ), + 'CreateMultipartUploadOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Bucket' => array( + 'type' => 'string', + 'location' => 'xml', + 'sentAs' => 'Bucket' + ), + 'Key' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'UploadId' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'SSEKMSKeyId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-aws-kms-key-id', + ), + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ) + ) + ), + 'CopyObjectOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'ETag' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'LastModified' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Expiration' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-expiration', + ), + 'CopySourceVersionId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-version-id', + ), + 'VersionId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-version-id', + ), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'CRC' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-hash-crc64ecma', + ) + ), + ), + 'DeleteBucketOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id' + ) + ) + ), + 'DeleteBucketCorsOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'DeleteBucketTaggingOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'DeleteBucketInventoryOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'DeleteObjectOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'DeleteMarker' => array( + 'type' => 'boolean', + 'location' => 'header', + 'sentAs' => 'x-cos-delete-marker', + ), + 'VersionId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-version-id', + ), + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'DeleteObjectsOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Deleted' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Deleted', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Key' => array( + 'type' => 'string', + ), + 'VersionId' => array( + 'type' => 'string', + ), + 'DeleteMarker' => array( + 'type' => 'boolean', + ), + 'DeleteMarkerVersionId' => array( + 'type' => 'string', + ), + ), + ), + ), + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'Errors' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Error', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Key' => array( + 'type' => 'string', + ), + 'VersionId' => array( + 'type' => 'string', + ), + 'Code' => array( + 'type' => 'string', + ), + 'Message' => array( + 'type' => 'string', + ), + ), + ), + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'DeleteBucketLifecycleOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'DeleteBucketReplicationOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'DeleteBucketWebsiteOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutObjectTaggingOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetObjectTaggingOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'TagSet' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'sentAs' => 'Tag', + 'type' => 'object', + 'properties' => array( + 'Key' => array( + 'type' => 'string', + ), + 'Value' => array( + 'type' => 'string', + ), + ), + ), + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'DeleteObjectTaggingOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id' + ) + ) + ), + 'GetObjectOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'DeleteMarker' => array( + 'type' => 'boolean', + 'location' => 'header', + 'sentAs' => 'x-cos-delete-marker', + ), + 'AcceptRanges' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'accept-ranges', + ), + 'Expiration' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-expiration', + ), + 'Restore' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-restore', + ), + 'LastModified' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Last-Modified', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'ETag' => array( + 'type' => 'string', + 'location' => 'header', + ), + 'MissingMeta' => array( + 'type' => 'numeric', + 'location' => 'header', + 'sentAs' => 'x-cos-missing-meta', + ), + 'VersionId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-version-id', + ), + 'CacheControl' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Cache-Control', + ), + 'ContentDisposition' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Disposition', + ), + 'ContentEncoding' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Encoding', + ), + 'ContentLanguage' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Language', + ), + 'ContentRange' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Range', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'Expires' => array( + 'type' => 'string', + 'location' => 'header', + ), + 'WebsiteRedirectLocation' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-website-redirect-location', + ), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'SSEKMSKeyId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-aws-kms-key-id', + ), + 'StorageClass' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-storage-class', + ), + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'ReplicationStatus' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-replication-status', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'CRC' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-hash-crc64ecma', + ) + ), + ), + 'GetObjectAclOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Owner' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string', + ), + 'ID' => array( + 'type' => 'string', + ), + ), + ), + 'Grants' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'AccessControlList', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Grantee' => array( + 'type' => 'object', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string'), + 'ID' => array( + 'type' => 'string'))), + 'Permission' => array( + 'type' => 'string', + ), + ), + ), + ), + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketAclOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Owner' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string' + ), + 'ID' => array( + 'type' => 'string' + ) + ) + ), + 'Grants' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'AccessControlList', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Grantee' => array( + 'type' => 'object', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string' + ), + 'ID' => array( + 'type' => 'string' + ) + ) + ), + 'Permission' => array( + 'type' => 'string' + ) + ) + ) + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id' + ) + ) + ), + 'GetBucketCorsOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'CORSRules' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'CORSRule', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'ID' => array( + 'type' => 'string'), + 'AllowedHeaders' => array( + 'type' => 'array', + 'sentAs' => 'AllowedHeader', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'string', + ) + ), + 'AllowedMethods' => array( + 'type' => 'array', + 'sentAs' => 'AllowedMethod', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'string', + ), + ), + 'AllowedOrigins' => array( + 'type' => 'array', + 'sentAs' => 'AllowedOrigin', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'string', + ), + ), + 'ExposeHeaders' => array( + 'type' => 'array', + 'sentAs' => 'ExposeHeader', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'string', + ), + ), + 'MaxAgeSeconds' => array( + 'type' => 'numeric', + ), + ), + ), + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketDomainOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'DomainRules' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'DomainRule', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Status' => array( + 'type' => 'string' + ), + 'Name' => array( + 'type' => 'string' + ), + 'Type' => array( + 'type' => 'string' + ), + 'ForcedReplacement' => array( + 'type' => 'string' + ), + ), + ), + ), + 'DomainTxtVerification' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-domain-txt-verification', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketLifecycleOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Rules' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Rule', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Expiration' => array( + 'type' => 'object', + 'properties' => array( + 'Date' => array( + 'type' => 'string', + ), + 'Days' => array( + 'type' => 'numeric', + ), + ), + ), + 'ID' => array( + 'type' => 'string', + ), + 'Filter' => array( + 'type' => 'object', + 'properties' => array( + 'Prefix' => array( + 'type' => 'string', + ), + 'Tag' => array( + 'type' => 'object', + 'properties' => array( + 'Key' => array( + 'type' => 'string' + ), + 'Value' => array( + 'type' => 'string' + ), + ) + ) + ), + ), + 'Status' => array( + 'type' => 'string', + ), + 'Transition' => array( + 'type' => 'object', + 'properties' => array( + 'Date' => array( + 'type' => 'string', + ), + 'Days' => array( + 'type' => 'numeric', + ), + 'StorageClass' => array( + 'type' => 'string', + ), + ), + ), + 'NoncurrentVersionTransition' => array( + 'type' => 'object', + 'properties' => array( + 'NoncurrentDays' => array( + 'type' => 'numeric', + ), + 'StorageClass' => array( + 'type' => 'string', + ), + ), + ), + 'NoncurrentVersionExpiration' => array( + 'type' => 'object', + 'properties' => array( + 'NoncurrentDays' => array( + 'type' => 'numeric', + ), + ), + ), + ), + ), + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketVersioningOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Status' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'MFADelete' => array( + 'type' => 'string', + 'location' => 'xml', + 'sentAs' => 'MfaDelete', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketReplicationOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Role' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Rules' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Rule', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'ID' => array( + 'type' => 'string', + ), + 'Prefix' => array( + 'type' => 'string', + ), + 'Status' => array( + 'type' => 'string', + ), + 'Destination' => array( + 'type' => 'object', + 'properties' => array( + 'Bucket' => array( + 'type' => 'string', + ), + 'StorageClass' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketLocationOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Location' => array( + 'type' => 'string', + 'location' => 'body', + 'filters' => array( + 'strval', + 'strip_tags', + 'trim', + ), + ), + ), + ), + 'GetBucketAccelerateOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Status' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Type' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketWebsiteOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RedirectAllRequestsTo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HostName' => array( + 'type' => 'string', + ), + 'Protocol' => array( + 'type' => 'string', + ), + ), + ), + 'IndexDocument' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Suffix' => array( + 'type' => 'string', + ), + ), + ), + 'ErrorDocument' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Key' => array( + 'type' => 'string', + ), + ), + ), + 'RoutingRules' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'name' => 'RoutingRule', + 'type' => 'object', + 'sentAs' => 'RoutingRule', + 'properties' => array( + 'Condition' => array( + 'type' => 'object', + 'properties' => array( + 'HttpErrorCodeReturnedEquals' => array( + 'type' => 'string', + ), + 'KeyPrefixEquals' => array( + 'type' => 'string', + ), + ), + ), + 'Redirect' => array( + 'type' => 'object', + 'properties' => array( + 'HostName' => array( + 'type' => 'string', + ), + 'HttpRedirectCode' => array( + 'type' => 'string', + ), + 'Protocol' => array( + 'type' => 'string', + ), + 'ReplaceKeyPrefixWith' => array( + 'type' => 'string', + ), + 'ReplaceKeyWith' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketInventoryOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Destination' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'COSBucketDestination' => array( + 'type' => 'object', + 'properties' => array( + 'Format' => array( + 'type' => 'string', + ), + 'AccountId' => array( + 'type' => 'string', + ), + 'Bucket' => array( + 'type' => 'string', + ), + 'Prefix' => array( + 'type' => 'string', + ), + 'Encryption' => array( + 'type' => 'object', + 'properties' => array( + 'SSE-COS' => array( + 'type' => 'string', + ) + ) + ), + + ), + ), + ), + ), + 'Schedule' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Frequency' => array( + 'type' => 'string', + ), + ), + ), + 'OptionalFields' => array( + 'type' => 'array', + 'location' => 'xml', + 'properties' => array( + 'Key' => array( + 'type' => 'string', + ), + ), + ), + 'OptionalFields' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'name' => 'Field', + 'type' => 'string', + 'sentAs' => 'Field', + ), + ), + 'IsEnabled' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Id' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'IncludedObjectVersions' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketTaggingOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'TagSet' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'sentAs' => 'Tag', + 'type' => 'object', + 'properties' => array( + 'Key' => array( + 'type' => 'string', + ), + 'Value' => array( + 'type' => 'string', + ), + ), + ), + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketNotificationOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'CloudFunctionConfigurations' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'CloudFunctionConfiguration', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Id' => array( + 'type' => 'string', + ), + 'CloudFunction' => array( + 'type' => 'string', + 'sentAs' => 'CloudFunction', + ), + 'Events' => array( + 'type' => 'array', + 'sentAs' => 'Event', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'string', + ), + ), + 'Filter' => array( + 'type' => 'object', + 'properties' => array( + 'Key' => array( + 'type' => 'object', + 'sentAs' => 'Key', + 'properties' => array( + 'FilterRules' => array( + 'type' => 'array', + 'sentAs' => 'FilterRule', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Name' => array( + 'type' => 'string', + ), + 'Value' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketLoggingOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'LoggingEnabled' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'TargetBucket' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'TargetPrefix' => array( + 'type' => 'string', + ), + ), + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'UploadPartOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'ETag' => array( + 'type' => 'string', + 'location' => 'header', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'SSEKMSKeyId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-aws-kms-key-id', + ), + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'CRC' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-hash-crc64ecma', + ) + ), + ), + 'UploadPartCopyOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'CopySourceVersionId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-copy-source-version-id', + ), + 'ETag' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'LastModified' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'SSEKMSKeyId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-aws-kms-key-id', + ), + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'CRC' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-hash-crc64ecma', + ) + ), + ), + 'PutBucketAclOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id' + ) + ) + ), + 'PutObjectOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Expiration' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-expiration', + ), + 'ETag' => array( + 'type' => 'string', + 'location' => 'header', + ), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'VersionId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-version-id', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'SSEKMSKeyId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-aws-kms-key-id', + ), + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'CRC' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-hash-crc64ecma', + ) + ), + ), + 'AppendObjectOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'ETag' => array( + 'type' => 'string', + 'location' => 'header', + ), + 'Position' => array( + 'type' => 'integer', + 'location' => 'header', + 'sentAs' => 'x-cos-next-append-position', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ) + ), + ), + 'PutObjectAclOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketCorsOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketDomainOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketLifecycleOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketVersioningOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketReplicationOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketNotificationOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketWebsiteOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketAccelerateOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketLoggingOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketInventoryOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketTaggingOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'RestoreObjectOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'ListPartsOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Bucket' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'Key' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'UploadId' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'PartNumberMarker' => array( + 'type' => 'numeric', + 'location' => 'xml' + ), + 'NextPartNumberMarker' => array( + 'type' => 'numeric', + 'location' => 'xml' + ), + 'MaxParts' => array( + 'type' => 'numeric', + 'location' => 'xml' + ), + 'IsTruncated' => array( + 'type' => 'boolean', + 'location' => 'xml' + ), + 'Parts' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Part', + 'data' => array( + 'xmlFlattened' => true + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'PartNumber' => array( + 'type' => 'numeric' + ), + 'LastModified' => array( + 'type' => 'string' + ), + 'ETag' => array( + 'type' => 'string' + ), + 'Size' => array( + 'type' => 'numeric' + ) + ) + ) + ), + 'Initiator' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'ID' => array( + 'type' => 'string' + ), + 'DisplayName' => array( + 'type' => 'string' + ) + ) + ), + 'Owner' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string' + ), + 'ID' => array( + 'type' => 'string' + ) + ) + ), + 'StorageClass' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id' + ) + ) + ), + 'ListObjectsOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'IsTruncated' => array( + 'type' => 'boolean', + 'location' => 'xml' + ), + 'Marker' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'NextMarker' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'Contents' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Key' => array( + 'type' => 'string' + ), + 'LastModified' => array( + 'type' => 'string' + ), + 'ETag' => array( + 'type' => 'string' + ), + 'Size' => array( + 'type' => 'numeric' + ), + 'StorageClass' => array( + 'type' => 'string' + ), + 'Owner' => array( + 'type' => 'object', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string' + ), + 'ID' => array( + 'type' => 'string' + ) + ) + ) + ) + ) + ), + 'Name' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'Prefix' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'Delimiter' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'MaxKeys' => array( + 'type' => 'numeric', + 'location' => 'xml' + ), + 'CommonPrefixes' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Prefix' => array( + 'type' => 'string' + ) + ) + ) + ), + 'EncodingType' => array( + 'type' => 'string', + 'location' => 'xml'), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id' + ) + ) + ), + 'ListBucketsOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Buckets' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Name' => array( + 'type' => 'string', + ), + 'CreationDate' => array( + 'type' => 'string', + ), + ), + ), + ), + 'Owner' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string', + ), + 'ID' => array( + 'type' => 'string', + ), + ), + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'ListObjectVersionsOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'IsTruncated' => array( + 'type' => 'boolean', + 'location' => 'xml', + ), + 'KeyMarker' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'VersionIdMarker' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'NextKeyMarker' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'NextVersionIdMarker' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Version' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'ETag' => array( + 'type' => 'string', + ), + 'Size' => array( + 'type' => 'numeric', + ), + 'StorageClass' => array( + 'type' => 'string', + ), + 'Key' => array( + 'type' => 'string', + ), + 'VersionId' => array( + 'type' => 'string', + ), + 'IsLatest' => array( + 'type' => 'boolean', + ), + 'LastModified' => array( + 'type' => 'string', + ), + 'Owner' => array( + 'type' => 'object', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string', + ), + 'ID' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + 'DeleteMarkers' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'DeleteMarker', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Owner' => array( + 'type' => 'object', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string', + ), + 'ID' => array( + 'type' => 'string', + ), + ), + ), + 'Key' => array( + 'type' => 'string', + ), + 'VersionId' => array( + 'type' => 'string', + ), + 'IsLatest' => array( + 'type' => 'boolean', + ), + 'LastModified' => array( + 'type' => 'string', + ), + ), + ), + ), + 'Name' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Prefix' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Delimiter' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'MaxKeys' => array( + 'type' => 'numeric', + 'location' => 'xml', + ), + 'CommonPrefixes' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Prefix' => array( + 'type' => 'string', + ), + ), + ), + ), + 'EncodingType' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'ListMultipartUploadsOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Bucket' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'KeyMarker' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'UploadIdMarker' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'NextKeyMarker' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Prefix' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Delimiter' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'NextUploadIdMarker' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'MaxUploads' => array( + 'type' => 'numeric', + 'location' => 'xml', + ), + 'IsTruncated' => array( + 'type' => 'boolean', + 'location' => 'xml', + ), + 'Uploads' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'Upload', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'UploadId' => array( + 'type' => 'string', + ), + 'Key' => array( + 'type' => 'string', + ), + 'Initiated' => array( + 'type' => 'string', + ), + 'StorageClass' => array( + 'type' => 'string', + ), + 'Owner' => array( + 'type' => 'object', + 'properties' => array( + 'DisplayName' => array( + 'type' => 'string', + ), + 'ID' => array( + 'type' => 'string', + ), + ), + ), + 'Initiator' => array( + 'type' => 'object', + 'properties' => array( + 'ID' => array( + 'type' => 'string', + ), + 'DisplayName' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + 'CommonPrefixes' => array( + 'type' => 'array', + 'location' => 'xml', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Prefix' => array( + 'type' => 'string', + ), + ), + ), + ), + 'EncodingType' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'ListBucketInventoryConfigurationsOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'InventoryConfiguration' => array( + 'type' => 'array', + 'location' => 'xml', + 'sentAs' => 'InventoryConfiguration', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Destination' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'COSBucketDestination' => array( + 'type' => 'object', + 'properties' => array( + 'Format' => array( + 'type' => 'string', + ), + 'AccountId' => array( + 'type' => 'string', + ), + 'Bucket' => array( + 'type' => 'string', + ), + 'Prefix' => array( + 'type' => 'string', + ), + 'Encryption' => array( + 'type' => 'object', + 'properties' => array( + 'SSE-COS' => array( + 'type' => 'string', + ) + ) + ), + + ), + ), + ), + ), + 'Schedule' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Frequency' => array( + 'type' => 'string', + ), + ), + ), + 'OptionalFields' => array( + 'type' => 'array', + 'location' => 'xml', + 'properties' => array( + 'Key' => array( + 'type' => 'string', + ), + ), + ), + 'OptionalFields' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'name' => 'Field', + 'type' => 'string', + 'sentAs' => 'Field', + ), + ), + 'IsEnabled' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Id' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'IncludedObjectVersions' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + ), + ), + ), + 'HeadObjectOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'DeleteMarker' => array( + 'type' => 'boolean', + 'location' => 'header', + 'sentAs' => 'x-cos-delete-marker', + ), + 'AcceptRanges' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'accept-ranges', + ), + 'Expiration' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-expiration', + ), + 'Restore' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-restore', + ), + 'LastModified' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Last-Modified', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'ETag' => array( + 'type' => 'string', + 'location' => 'header', + ), + 'MissingMeta' => array( + 'type' => 'numeric', + 'location' => 'header', + 'sentAs' => 'x-cos-missing-meta', + ), + 'VersionId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-version-id', + ), + 'CacheControl' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Cache-Control', + ), + 'ContentDisposition' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Disposition', + ), + 'ContentEncoding' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Encoding', + ), + 'ContentLanguage' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Language', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'Expires' => array( + 'type' => 'string', + 'location' => 'header', + ), + 'WebsiteRedirectLocation' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-website-redirect-location', + ), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'SSEKMSKeyId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-aws-kms-key-id', + ), + 'StorageClass' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-storage-class', + ), + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'ReplicationStatus' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-replication-status', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'CRC' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-hash-crc64ecma', + ) + ) + ), + 'HeadBucketOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'SelectObjectContentOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RawData' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + ), + ), + 'GetBucketIntelligentTieringOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Status' => array( + 'type' => 'string', + 'location' => 'xml', + ), + 'Transition' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Days' => array( + 'type' => 'string', + ), + 'RequestFrequent' => array( + 'type' => 'string', + ), + ) + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketIntelligentTieringOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'ImageInfoOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + ), + ), + 'ImageExifOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + ), + ), + 'ImageAveOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + ), + ), + 'ImageProcessOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'OriginalInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Key' => array( + 'type' => 'string', + ), + 'Location' => array( + 'type' => 'string', + ), + 'ETag' => array( + 'type' => 'string', + ), + 'ImageInfo' => array( + 'type' => 'object', + 'properties' => array( + 'Format' => array( + 'type' => 'string', + ), + 'Width' => array( + 'type' => 'string', + ), + 'Height' => array( + 'type' => 'string', + ), + 'Quality' => array( + 'type' => 'string', + ), + 'Ave' => array( + 'type' => 'string', + ), + 'Orientation' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + 'ProcessResults' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Object' => array( + 'type' => 'array', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Key' => array( + 'type' => 'string', + ), + 'Location' => array( + 'type' => 'string', + ), + 'Format' => array( + 'type' => 'string', + ), + 'Width' => array( + 'type' => 'string', + ), + 'Height' => array( + 'type' => 'string', + ), + 'Size' => array( + 'type' => 'string', + ), + 'Quality' => array( + 'type' => 'string', + ), + 'ETag' => array( + 'type' => 'string', + ), + 'WatermarkStatus' => array( + 'type' => 'integer', + ), + ), + ), + ), + ), + ), + ), + ), + 'QrcodeOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'CodeStatus' => array( + 'type' => 'integer', + 'location' => 'xml', + ), + 'QRcodeInfo' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'CodeUrl' => array( + 'type' => 'string', + ), + 'Point' => array( + 'type' => 'array', + 'items' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + 'ResultImage' => array( + 'type' => 'string', + 'location' => 'xml', + ), + ), + ), + 'QrcodeGenerateOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'ResultImage' => array( + 'type' => 'string', + 'location' => 'xml', + ), + ), + ), + 'DetectLabelOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'Labels' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Confidence' => array( + 'type' => 'integer', + ), + 'Name' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + 'PutBucketImageStyleOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketImageStyleOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'StyleRule' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'StyleName' => array( + 'type' => 'string', + ), + 'StyleBody' => array( + 'type' => 'string', + ), + ), + ), + ), + ), + ), + 'DeleteBucketImageStyleOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'PutBucketGuetzliOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetBucketGuetzliOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + ), + ), + 'DeleteBucketGuetzliOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + ), + ), + 'GetObjectSensitiveContentRecognitionOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'PornInfo' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Code' => array( + 'type' => 'integer', + ), + 'Msg' => array( + 'type' => 'string', + ), + 'HitFlag' => array( + 'type' => 'integer', + ), + 'Score' => array( + 'type' => 'integer', + ), + 'Label' => array( + 'type' => 'string', + ) + ), + ), + ), + 'TerroristInfo' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Code' => array( + 'type' => 'integer', + ), + 'Msg' => array( + 'type' => 'string', + ), + 'HitFlag' => array( + 'type' => 'integer', + ), + 'Score' => array( + 'type' => 'integer', + ), + 'Label' => array( + 'type' => 'string', + ) + ), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Code' => array( + 'type' => 'integer', + ), + 'Msg' => array( + 'type' => 'string', + ), + 'HitFlag' => array( + 'type' => 'integer', + ), + 'Score' => array( + 'type' => 'integer', + ), + 'Label' => array( + 'type' => 'string', + ) + ), + ), + ), + 'AdsInfo' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'Code' => array( + 'type' => 'integer', + ), + 'Msg' => array( + 'type' => 'string', + ), + 'HitFlag' => array( + 'type' => 'integer', + ), + 'Score' => array( + 'type' => 'integer', + ), + 'Label' => array( + 'type' => 'string', + ) + ), + ), + ), + ) + ), + 'DetectTextOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-ci-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'JobsDetail' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Code' => array( 'type' => 'string', 'location' => 'xml',), + 'DataId' => array( 'type' => 'string', 'location' => 'xml',), + 'Message' => array( 'type' => 'string', 'location' => 'xml',), + 'JobId' => array( 'type' => 'string', 'location' => 'xml',), + 'State' => array( 'type' => 'string', 'location' => 'xml',), + 'CreationTime' => array( 'type' => 'string', 'location' => 'xml',), + 'Content' => array( 'type' => 'string', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'Result' => array( 'type' => 'integer', 'location' => 'xml',), + 'SectionCount' => array( 'type' => 'integer', 'location' => 'xml',), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Count' => array( 'type' => 'integer', 'location' => 'xml',), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Count' => array( 'type' => 'integer', 'location' => 'xml',), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Count' => array( 'type' => 'integer', 'location' => 'xml',), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Count' => array( 'type' => 'integer', 'location' => 'xml',), + ), + ), + 'IllegalInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Count' => array( 'type' => 'integer', 'location' => 'xml',), + ), + ), + 'AbuseInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Count' => array( 'type' => 'integer', 'location' => 'xml',), + ), + ), + 'Section' => array( + 'type' => 'array', + 'location' => 'xml', + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'StartByte' => array( 'type' => 'integer', 'location' => 'xml',), + 'Label' => array( 'type' => 'string', 'location' => 'xml',), + 'Result' => array( 'type' => 'integer', 'location' => 'xml',), + 'PornInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Keywords' => array( 'type' => 'string', 'location' => 'xml',), + ), + ), + 'TerrorismInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Keywords' => array( 'type' => 'string', 'location' => 'xml',), + ), + ), + 'PoliticsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Keywords' => array( 'type' => 'string', 'location' => 'xml',), + ), + ), + 'AdsInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Keywords' => array( 'type' => 'string', 'location' => 'xml',), + ), + ), + 'IllegalInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Keywords' => array( 'type' => 'string', 'location' => 'xml',), + ), + ), + 'AbuseInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'HitFlag' => array( 'type' => 'integer', 'location' => 'xml',), + 'Score' => array( 'type' => 'integer', 'location' => 'xml',), + 'Keywords' => array( 'type' => 'string', 'location' => 'xml',), + ), + ), + ), + ), + ), + ), + ), + ), + ), + 'GetSnapshotOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'Body' => array( + 'type' => 'string', + 'instanceOf' => 'GuzzleHttp\\Psr7\\Stream', + 'location' => 'body', + ), + 'DeleteMarker' => array( + 'type' => 'boolean', + 'location' => 'header', + 'sentAs' => 'x-cos-delete-marker', + ), + 'AcceptRanges' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'accept-ranges', + ), + 'Expiration' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-expiration', + ), + 'Restore' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-restore', + ), + 'LastModified' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Last-Modified', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'ETag' => array( + 'type' => 'string', + 'location' => 'header', + ), + 'MissingMeta' => array( + 'type' => 'numeric', + 'location' => 'header', + 'sentAs' => 'x-cos-missing-meta', + ), + 'VersionId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-version-id', + ), + 'CacheControl' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Cache-Control', + ), + 'ContentDisposition' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Disposition', + ), + 'ContentEncoding' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Encoding', + ), + 'ContentLanguage' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Language', + ), + 'ContentRange' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Range', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'Expires' => array( + 'type' => 'string', + 'location' => 'header', + ), + 'WebsiteRedirectLocation' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-website-redirect-location', + ), + 'ServerSideEncryption' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption', + ), + 'SSECustomerAlgorithm' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-algorithm', + ), + 'SSECustomerKeyMD5' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-customer-key-MD5', + ), + 'SSEKMSKeyId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-server-side-encryption-aws-kms-key-id', + ), + 'StorageClass' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-storage-class', + ), + 'RequestCharged' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-charged', + ), + 'ReplicationStatus' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-replication-status', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ) + ) + ), + 'PutBucketRefererOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'ETag' => array( + 'type' => 'string', + 'location' => 'header', + ), + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ) + ) + ), + 'GetBucketRefererOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'location' => 'header', + 'sentAs' => 'x-cos-request-id' + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'Status' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'RefererType' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'EmptyReferConfiguration' => array( + 'type' => 'string', + 'location' => 'xml' + ), + 'DomainList' => array( + 'location' => 'xml', + 'type' => 'object', + 'properties' => array( + 'Domains' => array( + 'type' => 'array', + 'data' => array( + 'xmlFlattened' => true, + ), + 'items' => array( + 'name' => 'Domain', + 'type' => 'string', + 'sentAs' => 'Domain', + ), + ) + ) + ) + ) + ), + 'GetMediaInfoOutput' => array( + 'type' => 'object', + 'additionalProperties' => true, + 'properties' => array( + 'RequestId' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'x-cos-request-id', + ), + 'ContentType' => array( + 'type' => 'string', + 'location' => 'header', + 'sentAs' => 'Content-Type', + ), + 'ContentLength' => array( + 'type' => 'numeric', + 'minimum'=> 0, + 'location' => 'header', + 'sentAs' => 'Content-Length', + ), + 'MediaInfo' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Stream' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'JobId' => array( + 'type' => 'string', + ), + 'State' => array( + 'type' => 'string', + ), + 'Video' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Index' => array( + 'type' => 'integer', + ), + 'CodecName' => array( + 'type' => 'string', + ), + 'CodecLongName' => array( + 'type' => 'string', + ), + 'CodecTimeBase' => array( + 'type' => 'string', + ), + 'CodecTag' => array( + 'type' => 'string', + ), + 'Profile' => array( + 'type' => 'string', + ), + 'Height' => array( + 'type' => 'integer', + ), + 'Width' => array( + 'type' => 'integer', + ), + 'HasBFrame' => array( + 'type' => 'integer', + ), + 'RefFrames' => array( + 'type' => 'integer', + ), + 'Sar' => array( + 'type' => 'string', + ), + 'Dar' => array( + 'type' => 'string', + ), + 'PixFormat' => array( + 'type' => 'string', + ), + 'FieldOrder' => array( + 'type' => 'string', + ), + 'Level' => array( + 'type' => 'integer', + ), + 'Fps' => array( + 'type' => 'integer', + ), + 'AvgFps' => array( + 'type' => 'string', + ), + 'Timebase' => array( + 'type' => 'string', + ), + 'StartTime' => array( + 'type' => 'numeric', + ), + 'Duration' => array( + 'type' => 'numeric', + ), + 'Bitrate' => array( + 'type' => 'numeric', + ), + 'NumFrames' => array( + 'type' => 'integer', + ), + 'Language' => array( + 'type' => 'string', + ) + ), + 'Audio' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Index' => array( + 'type' => 'integer', + ), + 'CodecName' => array( + 'type' => 'string', + ), + 'CodecLongName' => array( + 'type' => 'string', + ), + 'CodecTimeBase' => array( + 'type' => 'string', + ), + 'CodecTagString' => array( + 'type' => 'string', + ), + 'CodecTag' => array( + 'type' => 'string', + ), + 'SampleFmt' => array( + 'type' => 'string', + ), + 'SampleRate' => array( + 'type' => 'integer', + ), + 'Channel' => array( + 'type' => 'integer', + ), + 'ChannelLayout' => array( + 'type' => 'string', + ), + 'Timebase' => array( + 'type' => 'string', + ), + 'StartTime' => array( + 'type' => 'numeric', + ), + 'Duration' => array( + 'type' => 'numeric', + ), + 'Bitrate' => array( + 'type' => 'numeric', + ), + 'Language' => array( + 'type' => 'string', + ) + ) + ), + 'Subtitle' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'Index' => array( + 'type' => 'integer', + ), + 'Language' => array( + 'type' => 'string', + ) + ) + ) + ), + ) + ), + 'Format' => array( + 'type' => 'object', + 'location' => 'xml', + 'properties' => array( + 'NumStream' => array( + 'type' => 'integer', + ), + 'NumProgram' => array( + 'type' => 'integer', + ), + 'FormatName' => array( + 'type' => 'string', + ), + 'FormatLongName' => array( + 'type' => 'string', + ), + 'StartTime' => array( + 'type' => 'numeric', + ), + 'Duration' => array( + 'type' => 'numeric', + ), + 'Bitrate' => array( + 'type' => 'integer', + ), + 'Size' => array( + 'type' => 'integer', + ) + ) + ) + ) + ) + + + ) + ), + 'CreateMediaTranscodeJobsOutput' => Descriptions::CreateMediaTranscodeJobsOutput(), + 'DescribeMediaJobOutput' => Descriptions::DescribeMediaJobOutput(), + 'DescribeMediaJobsOutput' => Descriptions::DescribeMediaJobsOutput(), + 'CreateMediaJobsOutput' => Descriptions::CreateMediaJobsOutput(), + 'CreateMediaSnapshotJobsOutput' => Descriptions::CreateMediaSnapshotJobsOutput(), + 'CreateMediaConcatJobsOutput' => Descriptions::CreateMediaConcatJobsOutput(), + 'DetectAudioOutput' => Descriptions::DetectAudioOutput(), + 'GetDetectAudioResultOutput' => Descriptions::GetDetectAudioResultOutput(), + 'GetDetectTextResultOutput' => Descriptions::GetDetectTextResultOutput(), + 'DetectVideoOutput' => Descriptions::DetectVideoOutput(), + 'GetDetectVideoResultOutput' => Descriptions::GetDetectVideoResultOutput(), + 'DetectDocumentOutput' => Descriptions::DetectDocumentOutput(), + 'GetDetectDocumentResultOutput' => Descriptions::GetDetectDocumentResultOutput(), + 'CreateDocProcessJobsOutput' => Descriptions::CreateDocProcessJobsOutput(), + 'DescribeDocProcessQueuesOutput' => Descriptions::DescribeDocProcessQueuesOutput(), + 'DescribeDocProcessJobOutput' => Descriptions::DescribeDocProcessJobOutput(), + 'GetDescribeDocProcessJobsOutput' => Descriptions::GetDescribeDocProcessJobsOutput(), + 'DetectImageOutput' => Descriptions::DetectImageOutput(), + 'DetectImagesOutput' => Descriptions::DetectImagesOutput(), + 'DetectVirusOutput' => Descriptions::DetectVirusOutput(), + 'GetDetectVirusResultOutput' => Descriptions::GetDetectVirusResultOutput(), + 'GetDetectImageResultOutput' => Descriptions::GetDetectImageResultOutput(), + 'CreateMediaVoiceSeparateJobsOutput' => Descriptions::CreateMediaVoiceSeparateJobsOutput(), + 'DescribeMediaVoiceSeparateJobOutput' => Descriptions::DescribeMediaVoiceSeparateJobOutput(), + 'DetectWebpageOutput' => Descriptions::DetectWebpageOutput(), + 'GetDetectWebpageResultOutput' => Descriptions::GetDetectWebpageResultOutput(), + ) + ); + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/Signature.php b/vendor/qcloud/cos-sdk-v5/src/Signature.php new file mode 100644 index 0000000..bb07304 --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/Signature.php @@ -0,0 +1,131 @@ +accessKey = $accessKey; + $this->secretKey = $secretKey; + $this->signHost = $signHost; + $this->token = $token; + $this->signHeader = [ + 'cache-control', + 'content-disposition', + 'content-encoding', + 'content-length', + 'content-md5', + 'content-type', + 'expect', + 'expires', + 'host', + 'if-match', + 'if-modified-since', + 'if-none-match', + 'if-unmodified-since', + 'origin', + 'range', + 'response-cache-control', + 'response-content-disposition', + 'response-content-encoding', + 'response-content-language', + 'response-content-type', + 'response-expires', + 'transfer-encoding', + 'versionid', + ]; + date_default_timezone_set( 'PRC' ); + } + + public function __destruct() { + } + + public function needCheckHeader( $header ) { + if ( startWith( $header, 'x-cos-' ) ) { + return true; + } + if ( in_array( $header, $this->signHeader ) ) { + return true; + } + return false; + } + + public function signRequest( RequestInterface $request ) { + $authorization = $this->createAuthorization( $request ); + return $request->withHeader( 'Authorization', $authorization ); + } + + public function createAuthorization( RequestInterface $request, $expires = '+30 minutes' ) { + if ( is_null( $expires ) || !strtotime( $expires )) { + $expires = '+30 minutes'; + } + $signTime = ( string )( time() - 60 ) . ';' . ( string )( strtotime( $expires ) ); + $urlParamListArray = []; + foreach ( explode( '&', $request->getUri()->getQuery() ) as $query ) { + if (!empty($query)) { + $tmpquery = explode( '=', $query ); + //为了保证CI的key中有=号的情况也能正常通过,ci在这层之前已经encode了,这里需要拆开重新encode,防止上方explode拆错 + $key = strtolower( rawurlencode(urldecode($tmpquery[0])) ); + if (count($tmpquery) >= 2) { + $value = $tmpquery[1]; + } else { + $value = ""; + } + //host开关 + if (!$this->signHost && $key == 'host') { + continue; + } + $urlParamListArray[$key] = $key. '='. $value; + } + } + ksort($urlParamListArray); + $urlParamList = join(';', array_keys($urlParamListArray)); + $httpParameters = join('&', array_values($urlParamListArray)); + + $headerListArray = []; + foreach ( $request->getHeaders() as $key => $value ) { + $key = strtolower( urlencode( $key ) ); + $value = rawurlencode( $value[0] ); + if ( !$this->signHost && $key == 'host' ) { + continue; + } + if ( $this->needCheckHeader( $key ) ) { + $headerListArray[$key] = $key. '='. $value; + } + } + ksort($headerListArray); + $headerList = join(';', array_keys($headerListArray)); + $httpHeaders = join('&', array_values($headerListArray)); + $httpString = strtolower( $request->getMethod() ) . "\n" . urldecode( $request->getUri()->getPath() ) . "\n" . $httpParameters. + "\n". $httpHeaders. "\n"; + $sha1edHttpString = sha1( $httpString ); + $stringToSign = "sha1\n$signTime\n$sha1edHttpString\n"; + $signKey = hash_hmac( 'sha1', $signTime, trim($this->secretKey) ); + $signature = hash_hmac( 'sha1', $stringToSign, $signKey ); + $authorization = 'q-sign-algorithm=sha1&q-ak='. trim($this->accessKey) . + "&q-sign-time=$signTime&q-key-time=$signTime&q-header-list=$headerList&q-url-param-list=$urlParamList&" . + "q-signature=$signature"; + return $authorization; + } + + public function createPresignedUrl( RequestInterface $request, $expires = '+30 minutes' ) { + $authorization = $this->createAuthorization( $request, $expires); + $uri = $request->getUri(); + $query = 'sign='.urlencode( $authorization ) . '&' . $uri->getQuery(); + if ( $this->token != null ) { + $query = $query.'&x-cos-security-token='.$this->token; + } + $uri = $uri->withQuery( $query ); + return $uri; + } +} diff --git a/vendor/qcloud/cos-sdk-v5/src/SignatureMiddleware.php b/vendor/qcloud/cos-sdk-v5/src/SignatureMiddleware.php new file mode 100644 index 0000000..358a87e --- /dev/null +++ b/vendor/qcloud/cos-sdk-v5/src/SignatureMiddleware.php @@ -0,0 +1,23 @@ +nextHandler = $nextHandler; + $this->signature = new Signature($accessKey, $secretKey, $signHost); + } + + public function __invoke(RequestInterface $request, array $options) { + $fn = $this->nextHandler; + return $fn($this->signature->signRequest($request), $options); + } +} diff --git a/vendor/qiniu/php-sdk/.github/workflows/test-ci.yml b/vendor/qiniu/php-sdk/.github/workflows/test-ci.yml new file mode 100644 index 0000000..a3f76f1 --- /dev/null +++ b/vendor/qiniu/php-sdk/.github/workflows/test-ci.yml @@ -0,0 +1,44 @@ +name: PHP CI with Composer + +on: + push: + paths-ignore: + - '**.md' + +jobs: + build: + strategy: + fail-fast: false + max-parallel: 1 + matrix: + php-versions: ['5.4', '5.5', '5.6', '7.0'] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup php + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + + - name: Install dependencies + run: | + composer self-update + composer install --no-interaction --prefer-source --dev + + - name: Run cases + run: | + ./vendor/bin/phpcs --standard=PSR2 src + ./vendor/bin/phpcs --standard=PSR2 examples + ./vendor/bin/phpcs --standard=PSR2 tests + ./vendor/bin/phpunit --coverage-clover=coverage.xml + + env: + QINIU_ACCESS_KEY: ${{ secrets.QINIU_ACCESS_KEY }} + QINIU_SECRET_KEY: ${{ secrets.QINIU_SECRET_KEY }} + QINIU_TEST_BUCKET: ${{ secrets.QINIU_TEST_BUCKET }} + QINIU_TEST_DOMAIN: ${{ secrets.QINIU_TEST_DOMAIN }} + + - name: After_success + run: bash <(curl -s https://codecov.io/bash) diff --git a/vendor/qiniu/php-sdk/.gitignore b/vendor/qiniu/php-sdk/.gitignore new file mode 100644 index 0000000..4c842c8 --- /dev/null +++ b/vendor/qiniu/php-sdk/.gitignore @@ -0,0 +1,12 @@ +*.phar +*.zip +build/artifacts +phpunit.xml +phpunit.functional.xml +.DS_Store +.swp +.build +composer.lock +vendor +src/package.xml +.idea/ diff --git a/vendor/qiniu/php-sdk/.scrutinizer.yml b/vendor/qiniu/php-sdk/.scrutinizer.yml new file mode 100644 index 0000000..6a2d0d8 --- /dev/null +++ b/vendor/qiniu/php-sdk/.scrutinizer.yml @@ -0,0 +1,42 @@ +filter: + excluded_paths: [tests/*] +checks: + php: + code_rating: true + remove_extra_empty_lines: true + remove_php_closing_tag: true + remove_trailing_whitespace: true + fix_use_statements: + remove_unused: true + preserve_multiple: false + preserve_blanklines: true + order_alphabetically: true + fix_php_opening_tag: true + fix_linefeed: true + fix_line_ending: true + fix_identation_4spaces: true + fix_doc_comments: true +tools: + external_code_coverage: + timeout: 1200 + runs: 3 + php_analyzer: true + php_code_coverage: false + php_code_sniffer: + config: + standard: PSR2 + filter: + paths: ['src'] + php_loc: + enabled: true + excluded_dirs: [vendor, tests] + php_cpd: + enabled: true + excluded_dirs: [vendor, tests] +build: + nodes: + analysis: + tests: + override: + - php-scrutinizer-run + diff --git a/vendor/qiniu/php-sdk/CHANGELOG.md b/vendor/qiniu/php-sdk/CHANGELOG.md new file mode 100644 index 0000000..200b76a --- /dev/null +++ b/vendor/qiniu/php-sdk/CHANGELOG.md @@ -0,0 +1,147 @@ +# Changelog + +## 7.5.0 (2022-04-18) +* 对象存储,新增支持 [深度归档存储类型](https://developer.qiniu.com/kodo/3956/kodo-category#deep_archive) + +## 7.4.3 (2022-04-01) +* 优化签名算法逻辑 + +## 7.4.2(2022-03-01) +* 修复已知关于请求 Header 处理不当问题,比如没有处理为大小写不敏感等问题 + +## 7.4.1(2021-09-24) +* 修复了 分片上传 v2 已知问题,明确给出了参数不合理情况下对应的错误提示信息 + +## 7.4.0 (2021-07-19) +* 【对象存储】支持 [分片上传 v2](https://developer.qiniu.com/kodo/7458/multipartupload) 和 断点续传,使用方式见 [开发者文档](https://developer.qiniu.com/kodo/1241/php#resume-upload-file) + +## 7.3.0 (2020-09-24) +### 新增 +* 【对象存储】增加异步抓取方法与demo +* 【融合cdn】增加查询CDN刷新记录、查询CDN预取记录方法与demo +* 【云短信】增加查询短信发送记录的方法 +* 【实时音视频】增加rtc停止房间的合流转推方法 +* 【内容审核】增加图片审核、视频审核方法与demo + +### 修复 +* 【对象存储】修复签算 token 时上传策略中的 forceSaveKey 字段不生效的问题 +* 【对象存储】修复更新空间事件通知规则方法 + +### 优化 +* 【对象存储】创建空间迁移到mkbucketv3 api +* 优化对 http2 返回头的判断 +* 优化 demo 中的文档注释说明 +* docs 目录下的 rtc demo 移动至 examples/rtc 目录下 +* docs 目录下的 sms demo 移动至 examples/sms 目录下 + +## 7.2.10 (2019-10-28) +* 去除云短信类类型指定 +* 修改不传文件名时存在表单上传错误的情况 + +## 7.2.9 (2019-07-09) +* 添加空间管理、云短信接口 +* 去除无效参数 + +## 7.2.7 (2018-11-06) +* 添加 QVM 内网上传到 KODO 的 zone 设置 + +## 7.2.6 (2018-05-18) +* 修复rs,rsf在不同机房默认的https域名 + +## 7.2.5 (2018-05-10) +* 修复表单上传中多余的参数checkCrc导致的fname错位问题 + +## 7.2.4 (2018-05-09) +### 增加 +* 连麦功能 + +## 7.2.3 (2018-01-20) +### 增加 +* 新加坡机房 +### 修正 +* 获取域名的入口域名 +* http回复头部兼容大小写 + +## 7.2.2 (2017-11-06) +### 增加 +* Qiniu算法的鉴权方法 + +## 7.1.4 (2017-06-21) +### 增加 +* cdn 文件/目录 刷新 +* cdn 获取 流量/带宽 +* cdn 获取域名的访问日志列表 +* cdn 对资源链接进行时间戳防盗链签名 + +## 7.1.3 (2016-11-18) +### 增加 +* move, copy操作增加force参数 + +## 7.1.2 (2016-11-12) +### 修正 +* 明确抛出获取各区域域名失败时的报错 + +## 7.1.1 (2016-11-02) +### 修正 +* 多区域配置文件存储目录从home修改到tmp目录 + + +## 7.1.0 (2016-10-22) +### 增加 +* 多存储区域的支持 + +## 7.0.8 (2016-07-19) +### 增加 +* demo +* https url 支持 +* deleteAfterDays 策略 +* 添加图片处理链接统一拼接方法 by @SherlockRen + +## 7.0.7 (2016-01-12) +### 修正 +* PersistentFop参数pipeline和notify_url失效 +* resume 模式 close file inputstream + +## 7.0.6 (2015-12-05) +### 修正 +* php7.0 Json 对空字符串解析单元测试报错 +* 开启安全模式或者设置可操作目录树时,设置CURLOPT_FOLLOWLOCATION报错, by @twocabbages +* fetch 支持不指定key, by @sinkcup + +## 7.0.5 (2015-10-29) +### 增加 +* 增加上传策略最小文件大小限制 fsizeMin +* 增加常见examples + +## 7.0.4 (2015-07-23) +### 修正 +* 一些地方的严格比较检查 +* resumeupload 备用地址失效 + +## 7.0.3 (2015-07-10) +### 修改 +* 多zone 支持 + +## 7.0.2 (2015-04-18) +### 修改 +* fetch 接口返回内容调整 +* pfop 接口调整 + +###修正 +* exception 类调用 + +## 7.0.1 (2015-03-27) +### 增加 +* 增加代码注释 + +## 7.0.0 (2015-02-03) + +### 增加 +* 简化上传接口 +* 自动选择断点续上传还是直传 +* 重构代码,接口和内部结构更清晰 +* 改变mime +* 代码覆盖度报告 +* policy改为array, 便于灵活增加,并加入过期字段检查 +* 文件列表支持目录形式 +* 利用元编程方式支持 fop 和 pfop diff --git a/vendor/qiniu/php-sdk/CONTRIBUTING.md b/vendor/qiniu/php-sdk/CONTRIBUTING.md new file mode 100644 index 0000000..0466bf9 --- /dev/null +++ b/vendor/qiniu/php-sdk/CONTRIBUTING.md @@ -0,0 +1,30 @@ +# 贡献代码指南 + +我们非常欢迎大家来贡献代码,我们会向贡献者致以最诚挚的敬意。 + +一般可以通过在Github上提交[Pull Request](https://github.com/qiniu/php-sdk)来贡献代码。 + +## Pull Request要求 + +- **[PSR-2 编码风格标准](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** 。要通过项目中的code sniffer检查。 + +- **代码格式** 提交前 请按 ./vendor/bin/phpcbf --standard=PSR2 进行格式化。 + +- **必须添加测试!** - 如果没有测试(单元测试、集成测试都可以),那么提交的补丁是不会通过的。 + +- **记得更新文档** - 保证`README.md`以及其他相关文档及时更新,和代码的变更保持一致性。 + +- **考虑我们的发布周期** - 我们的版本号会服从[SemVer v2.0.0](http://semver.org/),我们绝对不会随意变更对外的API。 + +- **创建feature分支** - 最好不要从你的master分支提交 pull request。 + +- **一个feature提交一个pull请求** - 如果你的代码变更了多个操作,那就提交多个pull请求吧。 + +- **清晰的commit历史** - 保证你的pull请求的每次commit操作都是有意义的。如果你开发中需要执行多次的即时commit操作,那么请把它们放到一起再提交pull请求。 + +## 运行测试 + +``` bash +./vendor/bin/phpunit tests/Qiniu/Tests/ + +``` diff --git a/vendor/qiniu/php-sdk/LICENSE b/vendor/qiniu/php-sdk/LICENSE new file mode 100644 index 0000000..ba646be --- /dev/null +++ b/vendor/qiniu/php-sdk/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014 Qiniu, Ltd. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/vendor/qiniu/php-sdk/README.md b/vendor/qiniu/php-sdk/README.md new file mode 100644 index 0000000..447a07d --- /dev/null +++ b/vendor/qiniu/php-sdk/README.md @@ -0,0 +1,76 @@ +# Qiniu Cloud SDK for PHP +[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE) +[![Build Status](https://travis-ci.org/qiniu/php-sdk.svg)](https://travis-ci.org/qiniu/php-sdk) +[![GitHub release](https://img.shields.io/github/v/tag/qiniu/php-sdk.svg?label=release)](https://github.com/qiniu/php-sdk/releases) +[![Latest Stable Version](https://img.shields.io/packagist/v/qiniu/php-sdk.svg)](https://packagist.org/packages/qiniu/php-sdk) +[![Total Downloads](https://img.shields.io/packagist/dt/qiniu/php-sdk.svg)](https://packagist.org/packages/qiniu/php-sdk) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/qiniu/php-sdk/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/qiniu/php-sdk/?branch=master) +[![Coverage Status](https://codecov.io/gh/qiniu/php-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/qiniu/php-sdk) +[![Join Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/qiniu/php-sdk?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![@qiniu on weibo](http://img.shields.io/badge/weibo-%40qiniutek-blue.svg)](http://weibo.com/qiniutek) + + +## 安装 + +* 推荐使用 `composer` 进行安装。可以使用 composer.json 声明依赖,或者运行下面的命令。SDK 包已经放到这里 [`qiniu/php-sdk`][install-packagist] 。 +```bash +$ composer require qiniu/php-sdk +``` +* 直接下载安装,SDK 没有依赖其他第三方库,但需要参照 composer 的 autoloader,增加一个自己的 autoloader 程序。 + +## 运行环境 + +| Qiniu SDK版本 | PHP 版本 | +|:--------------------:|:---------------------------:| +| 7.x | cURL extension, 5.3 - 5.6,7.0 | +| 6.x | cURL extension, 5.2 - 5.6 | + +## 使用方法 + +### 上传 +```php +use Qiniu\Storage\UploadManager; +use Qiniu\Auth; +... + $uploadMgr = new UploadManager(); + $auth = new Auth($accessKey, $secretKey); + $token = $auth->uploadToken($bucket); + list($ret, $error) = $uploadMgr->putFile($token, 'key', 'filePath'); +... +``` + +## 测试 + +``` bash +$ ./vendor/bin/phpunit tests/Qiniu/Tests/ +``` + +## 常见问题 + +- `$error` 保留了请求响应的信息,失败情况下 `ret` 为 `none`, 将 `$error` 可以打印出来,提交给我们。 +- API 的使用 demo 可以参考 [examples](https://github.com/qiniu/php-sdk/tree/master/examples)。 + +## 代码贡献 + +详情参考[代码提交指南](https://github.com/qiniu/php-sdk/blob/master/CONTRIBUTING.md)。 + +## 贡献记录 + +- [所有贡献者](https://github.com/qiniu/php-sdk/contributors) + +## 联系我们 + +- 如果需要帮助,请提交工单(在portal右侧点击咨询和建议提交工单,或者直接向 support@qiniu.com 发送邮件) +- 如果有什么问题,可以到问答社区提问,[问答社区](https://qiniu.segmentfault.com/) +- 更详细的文档,见[官方文档站](https://developer.qiniu.com/) +- 如果发现了 bug, 欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues) +- 如果有功能需求,欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues) +- 如果要提交代码,欢迎提交 pull request +- 欢迎关注我们的[微信](https://www.qiniu.com/#weixin) [微博](https://weibo.com/qiniutek),及时获取动态信息。 + +## 代码许可 + +The MIT License (MIT).详情见 [License文件](https://github.com/qiniu/php-sdk/blob/master/LICENSE). + +[packagist]: http://packagist.org +[install-packagist]: https://packagist.org/packages/qiniu/php-sdk diff --git a/vendor/qiniu/php-sdk/autoload.php b/vendor/qiniu/php-sdk/autoload.php new file mode 100644 index 0000000..b553d1c --- /dev/null +++ b/vendor/qiniu/php-sdk/autoload.php @@ -0,0 +1,18 @@ +=5.3.3", + "myclabs/php-enum": "1.6.6" + }, + "require-dev": { + "paragonie/random_compat": ">=2", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~3.6" + }, + "autoload": { + "psr-4": { + "Qiniu\\": "src/Qiniu" + }, + "files": [ + "src/Qiniu/functions.php" + ] + } +} diff --git a/vendor/qiniu/php-sdk/examples/README.md b/vendor/qiniu/php-sdk/examples/README.md new file mode 100644 index 0000000..b7b4f98 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/README.md @@ -0,0 +1,10 @@ +# examples + +这些 examples 旨在帮助你快速了解使用七牛的 SDK。这些 demo 都是可以直接运行的, 但是在运行之前需要填上您自己的参数。 + +比如: + +* `$bucket` 需要填上您想操作的 [bucket名字](https://portal.qiniu.com/kodo/bucket)。 +* `$accessKey` 和 `$secretKey` 可以在我们的[管理后台](https://portal.qiniu.com/user/key)找到。 +* 在进行`视频转码`, `压缩文件`等异步操作时 需要使用到的队列名称也可以在我们[管理后台](https://portal.qiniu.com/dora/media-gate/pipeline)新建。 + diff --git a/vendor/qiniu/php-sdk/examples/bucket_lifecycleRule.php b/vendor/qiniu/php-sdk/examples/bucket_lifecycleRule.php new file mode 100644 index 0000000..9dc0f84 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/bucket_lifecycleRule.php @@ -0,0 +1,40 @@ +bucketLifecycleRule( + $bucket, + $name, + $prefix, + $delete_after_days, + $to_line_after_days, + $to_archive_after_days, + $to_deep_archive_after_days +); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/cdn_get_bandwidth.php b/vendor/qiniu/php-sdk/examples/cdn_get_bandwidth.php new file mode 100644 index 0000000..c9de0e6 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/cdn_get_bandwidth.php @@ -0,0 +1,41 @@ +getBandwidthData( + $domains, + $startDate, + $endDate, + $granularity +); + +if ($getBandwidthErr != null) { + var_dump($getBandwidthErr); +} else { + echo "get bandwidth data success\n"; + print_r($bandwidthData); +} diff --git a/vendor/qiniu/php-sdk/examples/cdn_get_flux.php b/vendor/qiniu/php-sdk/examples/cdn_get_flux.php new file mode 100644 index 0000000..57df808 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/cdn_get_flux.php @@ -0,0 +1,35 @@ +getFluxData($domains, $startDate, $endDate, $granularity); +if ($getFluxErr != null) { + var_dump($getFluxErr); +} else { + echo "get flux data success\n"; + print_r($fluxData); +} diff --git a/vendor/qiniu/php-sdk/examples/cdn_get_log_list.php b/vendor/qiniu/php-sdk/examples/cdn_get_log_list.php new file mode 100644 index 0000000..2b3f7dd --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/cdn_get_log_list.php @@ -0,0 +1,31 @@ +getCdnLogList($domains, $logDate); +if ($getLogErr != null) { + var_dump($getLogErr); +} else { + echo "get cdn log list success\n"; + print_r($logListData); +} diff --git a/vendor/qiniu/php-sdk/examples/cdn_get_prefetch_list.php b/vendor/qiniu/php-sdk/examples/cdn_get_prefetch_list.php new file mode 100644 index 0000000..958e5eb --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/cdn_get_prefetch_list.php @@ -0,0 +1,46 @@ +getCdnPrefetchList( + $requestId, + $urls, + $state, + $pageNo, + $pageSize, + $startTime, + $endTime +); +echo "\n====> query prefetch list: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/cdn_get_refresh_list.php b/vendor/qiniu/php-sdk/examples/cdn_get_refresh_list.php new file mode 100644 index 0000000..ad4fca2 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/cdn_get_refresh_list.php @@ -0,0 +1,48 @@ +getCdnRefreshList( + $requestId, + $isDir, + $urls, + $state, + $pageNo, + $pageSize, + $startTime, + $endTime +); +echo "\n====> query refresh list: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/cdn_refresh_urls_dirs.php b/vendor/qiniu/php-sdk/examples/cdn_refresh_urls_dirs.php new file mode 100644 index 0000000..2140378 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/cdn_refresh_urls_dirs.php @@ -0,0 +1,59 @@ +refreshUrlsAndDirs($urls, $dirs); +if ($refreshErr != null) { + var_dump($refreshErr); +} else { + echo "refresh request sent\n"; + print_r($refreshResult); +} + +//---------------------------------------- demo2 ---------------------------------------- +// 刷新文件 + +list($refreshResult, $refreshErr) = $cdnManager->refreshUrls($urls); +if ($refreshErr != null) { + var_dump($refreshErr); +} else { + echo "refresh urls request sent\n"; + print_r($refreshResult); +} + +//---------------------------------------- demo3 ---------------------------------------- +// 刷新目录 + +list($refreshResult, $refreshErr) = $cdnManager->refreshDirs($dirs); +if ($refreshErr != null) { + var_dump($refreshErr); +} else { + echo "refresh dirs request sent\n"; + print_r($refreshResult); +} diff --git a/vendor/qiniu/php-sdk/examples/cdn_timestamp_antileech.php b/vendor/qiniu/php-sdk/examples/cdn_timestamp_antileech.php new file mode 100644 index 0000000..f2d7855 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/cdn_timestamp_antileech.php @@ -0,0 +1,20 @@ +censorImage($body); +echo "\n====> Result is: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/censor_video.php b/vendor/qiniu/php-sdk/examples/censor_video.php new file mode 100644 index 0000000..7ac056f --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/censor_video.php @@ -0,0 +1,52 @@ +censorVideo($body); +echo "\n====> Result is: \n"; +if ($err !== null) { + var_dump($err); +} else { + echo "job_id is: $jobid\n"; +} + +// 查询视频审核结果 +list($ret, $err) = $argusManager->censorStatus($jobid); +echo "\n====> job status: \n"; + +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/delete_bucket.php b/vendor/qiniu/php-sdk/examples/delete_bucket.php new file mode 100644 index 0000000..325a47a --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/delete_bucket.php @@ -0,0 +1,27 @@ +deleteBucket($bucket); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/delete_bucketEvent.php b/vendor/qiniu/php-sdk/examples/delete_bucketEvent.php new file mode 100644 index 0000000..7eb744d --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/delete_bucketEvent.php @@ -0,0 +1,28 @@ +deleteBucketEvent($bucket, $name); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/delete_bucketLifecycleRule.php b/vendor/qiniu/php-sdk/examples/delete_bucketLifecycleRule.php new file mode 100644 index 0000000..2146b1b --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/delete_bucketLifecycleRule.php @@ -0,0 +1,27 @@ +deleteBucketLifecycleRule($bucket, $name); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketEvents.php b/vendor/qiniu/php-sdk/examples/get_bucketEvents.php new file mode 100644 index 0000000..2379584 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketEvents.php @@ -0,0 +1,26 @@ +getBucketEvents($bucket); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketLifecycleRules.php b/vendor/qiniu/php-sdk/examples/get_bucketLifecycleRules.php new file mode 100644 index 0000000..a35feed --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketLifecycleRules.php @@ -0,0 +1,26 @@ +getBucketLifecycleRules($bucket); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketList.php b/vendor/qiniu/php-sdk/examples/get_bucketList.php new file mode 100644 index 0000000..6a2f7b0 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketList.php @@ -0,0 +1,26 @@ +listbuckets($region); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketQuota.php b/vendor/qiniu/php-sdk/examples/get_bucketQuota.php new file mode 100644 index 0000000..93474b5 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketQuota.php @@ -0,0 +1,26 @@ +getBucketQuota($bucket); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketinfo.php b/vendor/qiniu/php-sdk/examples/get_bucketinfo.php new file mode 100644 index 0000000..98fd9f7 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketinfo.php @@ -0,0 +1,25 @@ +bucketInfo($bucket); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/get_bucketinfos.php b/vendor/qiniu/php-sdk/examples/get_bucketinfos.php new file mode 100644 index 0000000..5eec1d8 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_bucketinfos.php @@ -0,0 +1,26 @@ +bucketInfos($region); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/get_corsRules.php b/vendor/qiniu/php-sdk/examples/get_corsRules.php new file mode 100644 index 0000000..58e28be --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/get_corsRules.php @@ -0,0 +1,26 @@ +getCorsRules($bucket); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/image_url_builder.php b/vendor/qiniu/php-sdk/examples/image_url_builder.php new file mode 100644 index 0000000..20e2b00 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/image_url_builder.php @@ -0,0 +1,74 @@ + + */ +$thumbLink = $imageUrlBuilder->thumbnail($url, 1, 100, 100); + +// 函数方式调用 也可拼接多个操作参数 图片+水印 +$thumbLink2 = \Qiniu\thumbnail($url2, 1, 100, 100); +var_dump($thumbLink, $thumbLink2); + +/** + * 图片水印 + * + * @param string $url 图片链接 + * @param string $image 水印图片链接 + * @param int $dissolve 透明度 [可选] + * @param string $gravity 水印位置 [可选] + * @param int $dx 横轴边距 [可选] + * @param int $dy 纵轴边距 [可选] + * @param int $watermarkScale 自适应原图的短边比例 [可选] + * @link https://developer.qiniu.com/dora/api/1316/image-watermarking-processing-watermark + * @return string + * @author Sherlock Ren + */ +$waterLink = $imageUrlBuilder->waterImg($url, $waterImage); +// 函数调用方法 +//$waterLink = \Qiniu\waterImg($url, $waterImage); +var_dump($waterLink); + +/** + * 文字水印 + * + * @param string $url 图片链接 + * @param string $text 文字 + * @param string $font 文字字体 + * @param string $fontSize 文字字号 + * @param string $fontColor 文字颜色 [可选] + * @param int $dissolve 透明度 [可选] + * @param string $gravity 水印位置 [可选] + * @param int $dx 横轴边距 [可选] + * @param int $dy 纵轴边距 [可选] + * @link http://developer.qiniu.com/code/v6/api/kodo-api/image/watermark.html#text-watermark + * @return string + * @author Sherlock Ren + */ +$textLink = $imageUrlBuilder->waterText($url, '你瞅啥', '微软雅黑', 300); +// 函数调用方法 +// $textLink = \Qiniu\waterText($url, '你瞅啥', '微软雅黑', 300); +var_dump($textLink); diff --git a/vendor/qiniu/php-sdk/examples/persistent_fop_init.php b/vendor/qiniu/php-sdk/examples/persistent_fop_init.php new file mode 100644 index 0000000..baca846 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/persistent_fop_init.php @@ -0,0 +1,18 @@ +useHTTPS=true; + +// 初始化 +$pfop = new PersistentFop($auth, $config); diff --git a/vendor/qiniu/php-sdk/examples/persistent_fop_status.php b/vendor/qiniu/php-sdk/examples/persistent_fop_status.php new file mode 100644 index 0000000..73e85a3 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/persistent_fop_status.php @@ -0,0 +1,19 @@ +status($persistentId); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/pfop_mkzip.php b/vendor/qiniu/php-sdk/examples/pfop_mkzip.php new file mode 100644 index 0000000..fb95cc2 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/pfop_mkzip.php @@ -0,0 +1,58 @@ +execute($bucket, $key, $fops, $pipeline, $notify_url, $force); + +echo "\n====> pfop mkzip result: \n"; +if ($err != null) { + var_dump($err); +} else { + echo "PersistentFop Id: $id\n"; +} + +// 查询转码的进度和状态 +list($ret, $err) = $pfop->status($id); +echo "\n====> pfop mkzip status: \n"; +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/pfop_vframe.php b/vendor/qiniu/php-sdk/examples/pfop_vframe.php new file mode 100644 index 0000000..49fd36d --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/pfop_vframe.php @@ -0,0 +1,55 @@ +useHTTPS = true; +$pfop = new PersistentFop($auth, $config); + +// 视频处理完毕后保存到空间中的名称 +$saveasKey = 'qiniu_480x360.jpg'; + +// 进行视频截帧操作 +$fops = "vframe/jpg/offset/1/w/480/h/360/rotate/90|saveas/" . + \Qiniu\base64_urlSafeEncode("$bucket:$saveasKey"); + +list($id, $err) = $pfop->execute($bucket, $key, $fops, $pipeline, $notifyUrl, $force); +echo "\n====> pfop avthumb result: \n"; +if ($err != null) { + var_dump($err); +} else { + echo "PersistentFop Id: $id\n"; +} + +// 查询转码的进度和状态 +list($ret, $err) = $pfop->status($id); +echo "\n====> pfop avthumb status: \n"; +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/pfop_video_avthumb.php b/vendor/qiniu/php-sdk/examples/pfop_video_avthumb.php new file mode 100644 index 0000000..986aa8c --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/pfop_video_avthumb.php @@ -0,0 +1,55 @@ +useHTTPS=true; + +// 视频处理完毕后保存到空间中的名称 +$saveasKey = 'qiniu_640x360.mp4'; + +$pfop = new PersistentFop($auth, $config); + +// 进行视频转码操作 +$fops = "avthumb/mp4/s/640x360/vb/1.4m|saveas/" . \Qiniu\base64_urlSafeEncode("$bucket:$saveasKey"); + +list($id, $err) = $pfop->execute($bucket, $key, $fops, $pipeline, $notifyUrl, $force); +echo "\n====> pfop avthumb result: \n"; +if ($err != null) { + var_dump($err); +} else { + echo "PersistentFop Id: $id\n"; +} + +// 查询转码的进度和状态 +list($ret, $err) = $pfop->status($id); +echo "\n====> pfop avthumb status: \n"; +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/pfop_watermark.php b/vendor/qiniu/php-sdk/examples/pfop_watermark.php new file mode 100644 index 0000000..ea3d6bc --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/pfop_watermark.php @@ -0,0 +1,59 @@ +useHTTPS=true; +$pfop = new PersistentFop($auth, $config); + +// 图片水印的源路径,也就是给视频打图片水印的图片 +$base64URL = Qiniu\base64_urlSafeEncode('http://test-2.qiniudn.com/logo.png'); + +// 视频处理完毕后保存到空间中的名称 +$saveasKey = 'qiniu_watermark.mp4'; + +// 进行视频打图片水印操作 +$fops = "avthumb/mp4/wmImage/" . $base64URL . "|saveas/" + . \Qiniu\base64_urlSafeEncode("$bucket:$saveasKey"); + +list($id, $err) = $pfop->execute($bucket, $key, $fops, $pipeline, $notifyUrl, $force); +echo "\n====> pfop avthumb result: \n"; +if ($err != null) { + var_dump($err); +} else { + echo "PersistentFop Id: $id\n"; +} + +// 查询转码的进度和状态 +list($ret, $err) = $pfop->status($id); +echo "\n====> pfop avthumb status: \n"; +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/php-logo.png b/vendor/qiniu/php-sdk/examples/php-logo.png new file mode 100644 index 0000000..77e051f Binary files /dev/null and b/vendor/qiniu/php-sdk/examples/php-logo.png differ diff --git a/vendor/qiniu/php-sdk/examples/prefop.php b/vendor/qiniu/php-sdk/examples/prefop.php new file mode 100644 index 0000000..1b8950a --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/prefop.php @@ -0,0 +1,27 @@ +useHTTPS=true; + +$pfop = new PersistentFop($auth, $config); + +$id = "z2.01z201c4oyre6q1hgy00murnel0002nh"; + +// 查询持久化处理的进度和状态 +list($ret, $err) = $pfop->status($id); +echo "\n====> pfop avthumb status: \n"; +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketAccessMode.php b/vendor/qiniu/php-sdk/examples/put_bucketAccessMode.php new file mode 100644 index 0000000..638ae3c --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketAccessMode.php @@ -0,0 +1,27 @@ +putBucketAccessMode($bucket, $private); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketAccessStyleMode.php b/vendor/qiniu/php-sdk/examples/put_bucketAccessStyleMode.php new file mode 100644 index 0000000..3cc2aec --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketAccessStyleMode.php @@ -0,0 +1,27 @@ +putBucketAccessStyleMode($bucket, $mode); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketEvent.php b/vendor/qiniu/php-sdk/examples/put_bucketEvent.php new file mode 100644 index 0000000..f3c830d --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketEvent.php @@ -0,0 +1,32 @@ +putBucketEvent($bucket, $name, $prefix, $suffix, $event, $callbackURL); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketMaxAge.php b/vendor/qiniu/php-sdk/examples/put_bucketMaxAge.php new file mode 100644 index 0000000..4890174 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketMaxAge.php @@ -0,0 +1,27 @@ +putBucketMaxAge($bucket, $maxAge); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/put_bucketQuota.php b/vendor/qiniu/php-sdk/examples/put_bucketQuota.php new file mode 100644 index 0000000..b00ec48 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_bucketQuota.php @@ -0,0 +1,29 @@ +putBucketQuota($bucket, $size, $count); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/put_referAntiLeech.php b/vendor/qiniu/php-sdk/examples/put_referAntiLeech.php new file mode 100644 index 0000000..7d56d1e --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/put_referAntiLeech.php @@ -0,0 +1,30 @@ +putReferAntiLeech($bucket, $mode, $norefer, $pattern); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/qetag.php b/vendor/qiniu/php-sdk/examples/qetag.php new file mode 100644 index 0000000..1fe90d1 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/qetag.php @@ -0,0 +1,14 @@ +useHTTPS = true; // 接口是否使用 HTTPS 协议 + +$bucketManager = new BucketManager($auth, $config); + +// 异步第三方资源抓取 +// 参考文档:https://developer.qiniu.com/kodo/api/4097/asynch-fetch + +// 需要抓取的文件 URL +$url = 'http://devtools.qiniu.com/qiniu.png'; + +//回调 URL(需要可以公网访问,并能够相应 200 OK) +$callbackurl = "http://your.domain.com/upload_verify_callback.php"; + +// 回调Body +$callbackbody = '{"key":"$(key)","hash":"$(etag)","w":"$(imageInfo.width)","h":"$(imageInfo.height)"}'; + + +//---------------------------------------- demo1 ---------------------------------------- +// 指定抓取的文件保存到七牛云空间中的名称 + +$key = time() . '.png'; +list($ret, $err) = $bucketManager->asynchFetch($url, $bucket, null, $key, null, null, $callbackurl, $callbackbody); +echo "=====> asynch fetch $url to bucket: $bucket key: $key\n"; +if ($err !== null) { + var_dump($err); +} else { + $id = $ret['id']; + echo "id is: $id\n"; +} + +//---------------------------------------- demo2 ---------------------------------------- +// 不指定 key 时,以文件内容的 hash 作为文件名 + +$key = null; +list($ret, $err) = $bucketManager->asynchFetch($url, $bucket, null, $key, null, null, $callbackurl, $callbackbody); +echo "=====> asynch fetch $url to bucket: $bucket key: $(etag)\n"; +if ($err !== null) { + var_dump($err); +} else { + $id = $ret['id']; + echo "id is: $id\n"; +} + +// 查询异步抓取的进度和状态 + +// 华东:z0,华北:z1,华南:z2,北美:na0,东南亚:as0 +$zone = 'z2'; + +sleep(10); // 由于异步抓取需要耗时,等待 10 秒后再查询状态 +list($ret, $err) = $bucketManager->asynchFetchStatus($zone, $id); +echo "\n====> asynch fetch status: \n"; +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_batch_change_mime.php b/vendor/qiniu/php-sdk/examples/rs_batch_change_mime.php new file mode 100644 index 0000000..c5bd6b4 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_batch_change_mime.php @@ -0,0 +1,32 @@ + 'video/x-mp4', + 'qiniu.png' => 'image/x-png', + 'qiniu.jpg' => 'image/x-jpg' +); + +$ops = $bucketManager->buildBatchChangeMime($bucket, $keyMimePairs); +list($ret, $err) = $bucketManager->batch($ops); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_batch_change_type.php b/vendor/qiniu/php-sdk/examples/rs_batch_change_type.php new file mode 100644 index 0000000..6c8df84 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_batch_change_type.php @@ -0,0 +1,44 @@ +batch($ops); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_batch_copy.php b/vendor/qiniu/php-sdk/examples/rs_batch_copy.php new file mode 100644 index 0000000..66c4d4d --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_batch_copy.php @@ -0,0 +1,40 @@ +buildBatchCopy($srcBucket, $keyPairs, $destBucket, true); +list($ret, $err) = $bucketManager->batch($ops); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_batch_delete.php b/vendor/qiniu/php-sdk/examples/rs_batch_delete.php new file mode 100644 index 0000000..ebcdbe6 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_batch_delete.php @@ -0,0 +1,32 @@ +buildBatchDelete($bucket, $keys); +list($ret, $err) = $bucketManager->batch($ops); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_batch_delete_after_days.php b/vendor/qiniu/php-sdk/examples/rs_batch_delete_after_days.php new file mode 100644 index 0000000..928dd14 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_batch_delete_after_days.php @@ -0,0 +1,39 @@ +buildBatchDeleteAfterDays($bucket, $keyDayPairs); +list($ret, $err) = $bucketManager->batch($ops); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_batch_move.php b/vendor/qiniu/php-sdk/examples/rs_batch_move.php new file mode 100644 index 0000000..01d8c91 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_batch_move.php @@ -0,0 +1,40 @@ +buildBatchMove($srcBucket, $keyPairs, $destBucket, true); +list($ret, $err) = $bucketManager->batch($ops); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_batch_restore_ar.php b/vendor/qiniu/php-sdk/examples/rs_batch_restore_ar.php new file mode 100644 index 0000000..b2f79d0 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_batch_restore_ar.php @@ -0,0 +1,41 @@ +batch($ops); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_batch_stat.php b/vendor/qiniu/php-sdk/examples/rs_batch_stat.php new file mode 100644 index 0000000..88bc32e --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_batch_stat.php @@ -0,0 +1,32 @@ +buildBatchStat($bucket, $keys); +list($ret, $err) = $bucketManager->batch($ops); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_bucket_domains.php b/vendor/qiniu/php-sdk/examples/rs_bucket_domains.php new file mode 100644 index 0000000..3cc9cb3 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_bucket_domains.php @@ -0,0 +1,26 @@ +domains($bucket); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_buckets.php b/vendor/qiniu/php-sdk/examples/rs_buckets.php new file mode 100644 index 0000000..84263a9 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_buckets.php @@ -0,0 +1,25 @@ +buckets(true); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_change_mime.php b/vendor/qiniu/php-sdk/examples/rs_change_mime.php new file mode 100644 index 0000000..f4442aa --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_change_mime.php @@ -0,0 +1,29 @@ +changeMime($bucket, $key, $newMime); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_change_status.php b/vendor/qiniu/php-sdk/examples/rs_change_status.php new file mode 100644 index 0000000..bedf61c --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_change_status.php @@ -0,0 +1,29 @@ +changeStatus($bucket, $key, $status); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_change_type.php b/vendor/qiniu/php-sdk/examples/rs_change_type.php new file mode 100644 index 0000000..802c9f4 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_change_type.php @@ -0,0 +1,31 @@ +changeType($bucket, $key, $fileType); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_copy.php b/vendor/qiniu/php-sdk/examples/rs_copy.php new file mode 100644 index 0000000..aae4d96 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_copy.php @@ -0,0 +1,33 @@ +copy($srcBucket, $srcKey, $destBucket, $destKey, true); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_delete.php b/vendor/qiniu/php-sdk/examples/rs_delete.php new file mode 100644 index 0000000..ad97266 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_delete.php @@ -0,0 +1,27 @@ +delete($bucket, $key); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_delete_after_days.php b/vendor/qiniu/php-sdk/examples/rs_delete_after_days.php new file mode 100644 index 0000000..96e55de --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_delete_after_days.php @@ -0,0 +1,26 @@ +deleteAfterDays($bucket, $key, $days); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_download_urls.php b/vendor/qiniu/php-sdk/examples/rs_download_urls.php new file mode 100644 index 0000000..e803ddc --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_download_urls.php @@ -0,0 +1,19 @@ +/,一定要带访问协议,也就是 http:// 或者 https:// +$baseUrl = 'http://if-pri.qiniudn.com/qiniu.png?imageView2/1/h/500'; + +// 对链接进行签名,参考文档:https://developer.qiniu.com/kodo/manual/1656/download-private +$signedUrl = $auth->privateDownloadUrl($baseUrl); + +echo $signedUrl; diff --git a/vendor/qiniu/php-sdk/examples/rs_fetch.php b/vendor/qiniu/php-sdk/examples/rs_fetch.php new file mode 100644 index 0000000..5c1a5ab --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_fetch.php @@ -0,0 +1,43 @@ +fetch($url, $bucket, $key); +echo "=====> fetch $url to bucket: $bucket key: $key\n"; +if ($err !== null) { + var_dump($err); +} else { + print_r($ret); +} + +//---------------------------------------- demo2 ---------------------------------------- +// 不指定 key 时,以文件内容的 hash 作为文件名 + +$key = null; +list($ret, $err) = $bucketManager->fetch($url, $bucket, $key); +echo "=====> fetch $url to bucket: $bucket key: $(etag)\n"; +if ($err !== null) { + var_dump($err); +} else { + print_r($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_move.php b/vendor/qiniu/php-sdk/examples/rs_move.php new file mode 100644 index 0000000..a399665 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_move.php @@ -0,0 +1,29 @@ +move($srcBucket, $srcKey, $destBucket, $destKey, true); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_prefetch.php b/vendor/qiniu/php-sdk/examples/rs_prefetch.php new file mode 100644 index 0000000..28af115 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_prefetch.php @@ -0,0 +1,25 @@ +prefetch($bucket, $key); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_restore.php b/vendor/qiniu/php-sdk/examples/rs_restore.php new file mode 100644 index 0000000..a3bf070 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_restore.php @@ -0,0 +1,28 @@ +restoreAr($bucket, $key, 1); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rs_stat.php b/vendor/qiniu/php-sdk/examples/rs_stat.php new file mode 100644 index 0000000..36e863e --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rs_stat.php @@ -0,0 +1,28 @@ +stat($bucket, $key); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rsf_list_bucket.php b/vendor/qiniu/php-sdk/examples/rsf_list_bucket.php new file mode 100644 index 0000000..97a5838 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rsf_list_bucket.php @@ -0,0 +1,47 @@ +listFiles($bucket, $prefix, $marker, $limit, $delimiter); + if ($err !== null) { + echo "\n====> list file err: \n"; + var_dump($err); + } else { + $marker = null; + if (array_key_exists('marker', $ret)) { + $marker = $ret['marker']; + } + echo "Marker: $marker\n"; + echo "\nList Items====>\n"; + //var_dump($ret['items']); + print('items count:' . count($ret['items']) . "\n"); + if (array_key_exists('commonPrefixes', $ret)) { + print_r($ret['commonPrefixes']); + } + } +} while (!empty($marker)); diff --git a/vendor/qiniu/php-sdk/examples/rsf_list_files.php b/vendor/qiniu/php-sdk/examples/rsf_list_files.php new file mode 100644 index 0000000..31c455b --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rsf_list_files.php @@ -0,0 +1,39 @@ +listFiles($bucket, $prefix, $marker, $limit, $delimiter); +if ($err !== null) { + echo "\n====> list file err: \n"; + var_dump($err); +} else { + if (array_key_exists('marker', $ret)) { + echo "Marker:" . $ret["marker"] . "\n"; + } + echo "\nList Iterms====>\n"; +} diff --git a/vendor/qiniu/php-sdk/examples/rsf_v2list_bucket.php b/vendor/qiniu/php-sdk/examples/rsf_v2list_bucket.php new file mode 100644 index 0000000..5f9d763 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rsf_v2list_bucket.php @@ -0,0 +1,34 @@ +listFilesv2($bucket, $prefix, $marker, $limit, $delimiter, true); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rtc/README.md b/vendor/qiniu/php-sdk/examples/rtc/README.md new file mode 100644 index 0000000..c7fff4d --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rtc/README.md @@ -0,0 +1,34 @@ +# Rtc Streaming Cloud Server-Side Library For PHP + +## Features + +- RoomToken 签发 + - [x] 生成 RoomToken: client->appToken() + +- App 管理 + - [x] 创建应用: client->createApp() + - [x] 获取应用配置信息: client->getApp() + - [x] 更新应用配置信息: client->updateApp() + - [x] 删除应用: client->deleteApp() + +- 房间管理 + - [x] 列举房间下的所有用户: client->listUser() + - [x] 指定一个用户踢出房间: client->kickUser() + - [x] 停止一个房间的合流转推: client->stopMerge() + - [x] 获取当前所有活跃的房间: client->listActiveRooms() + +## Demo +- RoomToken 签发 + - [生成 RoomToken](https://github.com/qiniu/php-sdk/tree/master/examples/rtc/rtc_create_roomToken.php) + +- App 管理 + - [创建应用](https://github.com/qiniu/php-sdk/tree/master/examples/rtc/rtc_createApp.php) + - [获取应用配置信息](https://github.com/qiniu/php-sdk/tree/master/examples/rtc/rtc_getApp.php) + - [更新应用配置信息](https://github.com/qiniu/php-sdk/tree/master/examples/rtc/rtc_updateApp.php) + - [删除应用](https://github.com/qiniu/php-sdk/tree/master/examples/rtc/rtc_deleteApp.php) + +- 房间管理 + - [列举房间下的所有用户](https://github.com/qiniu/php-sdk/tree/master/examples/rtc/rtc_rooms_listUser.php) + - [指定一个用户踢出房间](https://github.com/qiniu/php-sdk/tree/master/examples/rtc/rtc_rooms_kickUser.php) + - [停止一个房间的合流转推](https://github.com/qiniu/php-sdk/tree/master/examples/rtc/rtc_rooms_stopMerge.php) + - [获取当前所有活跃的房间](https://github.com/qiniu/php-sdk/tree/master/examples/rtc/rtc_rooms_listActiveRooms.php) \ No newline at end of file diff --git a/vendor/qiniu/php-sdk/examples/rtc/rtc_createApp.php b/vendor/qiniu/php-sdk/examples/rtc/rtc_createApp.php new file mode 100644 index 0000000..039eadd --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rtc/rtc_createApp.php @@ -0,0 +1,32 @@ +createApp($hub, $title, $maxUsers); +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> Create Successfully: \n"; + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rtc/rtc_create_roomToken.php b/vendor/qiniu/php-sdk/examples/rtc/rtc_create_roomToken.php new file mode 100644 index 0000000..6a62aa2 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rtc/rtc_create_roomToken.php @@ -0,0 +1,34 @@ +appToken($appId, $roomName, $userId, $expireAt, $permission); +echo "\n====> Create RoomToken Successfully: \n"; +var_dump($RoomToken); diff --git a/vendor/qiniu/php-sdk/examples/rtc/rtc_deleteApp.php b/vendor/qiniu/php-sdk/examples/rtc/rtc_deleteApp.php new file mode 100644 index 0000000..68bff33 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rtc/rtc_deleteApp.php @@ -0,0 +1,25 @@ +deleteApp($appId); +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> Delete $appId Successfully \n"; +} diff --git a/vendor/qiniu/php-sdk/examples/rtc/rtc_getApp.php b/vendor/qiniu/php-sdk/examples/rtc/rtc_getApp.php new file mode 100644 index 0000000..9f8e374 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rtc/rtc_getApp.php @@ -0,0 +1,26 @@ +getApp($appId); +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> $appId Conf: \n"; + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rtc/rtc_rooms_kickUser.php b/vendor/qiniu/php-sdk/examples/rtc/rtc_rooms_kickUser.php new file mode 100644 index 0000000..019c3f2 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rtc/rtc_rooms_kickUser.php @@ -0,0 +1,31 @@ +kickUser($appId, $roomName, $userId); +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> Kick User $userId Successfully \n"; +} diff --git a/vendor/qiniu/php-sdk/examples/rtc/rtc_rooms_listActiveRooms.php b/vendor/qiniu/php-sdk/examples/rtc/rtc_rooms_listActiveRooms.php new file mode 100644 index 0000000..16e6027 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rtc/rtc_rooms_listActiveRooms.php @@ -0,0 +1,35 @@ +listActiveRooms($appId, $prefix, $offset, $limit); +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> Active Rooms:\n"; + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rtc/rtc_rooms_listUser.php b/vendor/qiniu/php-sdk/examples/rtc/rtc_rooms_listUser.php new file mode 100644 index 0000000..a839728 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rtc/rtc_rooms_listUser.php @@ -0,0 +1,29 @@ +listUser($appId, $roomName); +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> User List: \n"; + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/rtc/rtc_rooms_stopMerge.php b/vendor/qiniu/php-sdk/examples/rtc/rtc_rooms_stopMerge.php new file mode 100644 index 0000000..e140907 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rtc/rtc_rooms_stopMerge.php @@ -0,0 +1,28 @@ +stopMerge($appId, $roomName); +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> Stop Merge Successfully \n"; +} diff --git a/vendor/qiniu/php-sdk/examples/rtc/rtc_updateApp.php b/vendor/qiniu/php-sdk/examples/rtc/rtc_updateApp.php new file mode 100644 index 0000000..f771075 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/rtc/rtc_updateApp.php @@ -0,0 +1,40 @@ +updateApp($appId, $hub, $title, $maxUsers, false, $mergePublishRtmp); +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> Update $appId Conf Successfully: \n"; + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/saveas.php b/vendor/qiniu/php-sdk/examples/saveas.php new file mode 100644 index 0000000..5d51ef4 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/saveas.php @@ -0,0 +1,33 @@ +为生成缩略图的文件名 +$entry = ':'; + +// 生成的值 +$encodedEntryURI = \Qiniu\base64_urlSafeEncode($entry); + +// 使用 SecretKey 对新的下载 URL 进行 HMAC1-SHA1 签名 +$newurl = "78re52.com1.z0.glb.clouddn.com/resource/Ship.jpg?imageView2/2/w/200/h/200|saveas/" . $encodedEntryURI; + +$sign = hash_hmac("sha1", $newurl, $secretKey, true); + +// 对签名进行 URL 安全的 Base64 编码 +$encodedSign = \Qiniu\base64_urlSafeEncode($sign); + +// 最终得到的完整下载 URL +$finalURL = "http://" . $newurl . "/sign/" . $accessKey . ":" . $encodedSign; + +$callbackBody = file_get_contents("$finalURL"); + +echo $callbackBody; diff --git a/vendor/qiniu/php-sdk/examples/sms/README.md b/vendor/qiniu/php-sdk/examples/sms/README.md new file mode 100644 index 0000000..8c80a38 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/README.md @@ -0,0 +1,45 @@ +# SMS Server-Side Library For PHP + +## Features + +- 签名管理 + - [x] 创建签名: client->createSignature() + - [x] 列出签名: client->checkSignature() + - [x] 查询单个签名: client->checkSingleSignature() + - [x] 编辑签名: client->updateSignature() + - [x] 删除签名: client->deleteSignature() + +- 模板管理 + - [x] 创建模板: client->createTemplate() + - [x] 列出模板: client->queryTemplate() + - [x] 查询单个模板: client->querySingleTemplate() + - [x] 编辑模板: client->updateTemplate() + - [x] 删除模板: client->deleteTemplate() + +- 发送短信 + - [x] 发送短信: client->sendMessage() + +- 查询发送记录 + - [x] 查询发送记录: client->querySendSms() + +## Demo + +- 签名管理 + - [创建签名](https://github.com/qiniu/php-sdk/tree/master/examples/sms/sms_create_signature.php) + - [列出签名](https://github.com/qiniu/php-sdk/tree/master/examples/sms/sms_query_signature.php) + - [查询单个签名](https://github.com/qiniu/php-sdk/tree/master/examples/sms/sms_query_single_signature.php) + - [编辑签名](https://github.com/qiniu/php-sdk/tree/master/examples/sms/sms_edit_signature.php) + - [删除签名](https://github.com/qiniu/php-sdk/tree/master/examples/sms/sms_delete_signature.php) + +- 模板管理 + - [创建模板](https://github.com/qiniu/php-sdk/tree/master/examples/sms/sms_create_template.php) + - [列出模板](https://github.com/qiniu/php-sdk/tree/master/examples/sms/sms_query_template.php) + - [查询单个模板](https://github.com/qiniu/php-sdk/tree/master/examples/sms/sms_query_single_template.php) + - [编辑模板](https://github.com/qiniu/php-sdk/tree/master/examples/sms/sms_edit_template.php) + - [删除模板](https://github.com/qiniu/php-sdk/tree/master/examples/sms/sms_delete_template.php) + +- 发送短信 + - [发送短信](https://github.com/qiniu/php-sdk/tree/master/examples/sms/sms_send_message.php) + +- 查询发送记录 + - [查询发送记录](https://github.com/qiniu/php-sdk/tree/master/examples/sms/sms_query_send_sms.php) diff --git a/vendor/qiniu/php-sdk/examples/sms/sms_create_signature.php b/vendor/qiniu/php-sdk/examples/sms/sms_create_signature.php new file mode 100644 index 0000000..ea1f158 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/sms_create_signature.php @@ -0,0 +1,29 @@ +createSignature($signature, $source, $pics); + +echo "\n====> create signature result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/sms/sms_create_template.php b/vendor/qiniu/php-sdk/examples/sms/sms_create_template.php new file mode 100644 index 0000000..3cb3874 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/sms_create_template.php @@ -0,0 +1,33 @@ +createTemplate($name, $template, $type, $description, $signature_id); + +echo "\n====> create signature result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/sms/sms_delete_signature.php b/vendor/qiniu/php-sdk/examples/sms/sms_delete_signature.php new file mode 100644 index 0000000..fd873fa --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/sms_delete_signature.php @@ -0,0 +1,25 @@ +deleteSignature($signature_id); +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> Delete Signature $signature_id Successfully\n"; +} diff --git a/vendor/qiniu/php-sdk/examples/sms/sms_delete_template.php b/vendor/qiniu/php-sdk/examples/sms/sms_delete_template.php new file mode 100644 index 0000000..4590835 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/sms_delete_template.php @@ -0,0 +1,25 @@ +deleteTemplate($template_id); +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> Delete Template $template_id Successfully\n"; +} diff --git a/vendor/qiniu/php-sdk/examples/sms/sms_edit_signature.php b/vendor/qiniu/php-sdk/examples/sms/sms_edit_signature.php new file mode 100644 index 0000000..edf14e0 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/sms_edit_signature.php @@ -0,0 +1,30 @@ +updateSignature($id, $signature, $source, $pics); + +echo "\n====> edit signature result: \n"; +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> Update Signature Successfully\n"; +} diff --git a/vendor/qiniu/php-sdk/examples/sms/sms_edit_template.php b/vendor/qiniu/php-sdk/examples/sms/sms_edit_template.php new file mode 100644 index 0000000..1be5509 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/sms_edit_template.php @@ -0,0 +1,31 @@ +updateTemplate($template_id, $name, $template, $description, $signature_id); + +echo "\n====> edit template result: \n"; +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> Update Template Successfully\n"; +} diff --git a/vendor/qiniu/php-sdk/examples/sms/sms_query_send_sms.php b/vendor/qiniu/php-sdk/examples/sms/sms_query_send_sms.php new file mode 100644 index 0000000..cdbbe71 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/sms_query_send_sms.php @@ -0,0 +1,50 @@ +querySendSms( + $job_id, + $message_id, + $mobile, + $status, + $template_id, + $type, + $start, + $end, + $page, + $page_size +); +echo "\n====> query send sms result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/sms/sms_query_signature.php b/vendor/qiniu/php-sdk/examples/sms/sms_query_signature.php new file mode 100644 index 0000000..224d09b --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/sms_query_signature.php @@ -0,0 +1,28 @@ +querySignature($audit_status, $page, $page_size); +echo "\n====> query signature result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/sms/sms_query_single_signature.php b/vendor/qiniu/php-sdk/examples/sms/sms_query_single_signature.php new file mode 100644 index 0000000..8afb4d5 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/sms_query_single_signature.php @@ -0,0 +1,26 @@ +checkSingleSignature($signature_id); +echo "\n====> query single signature result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/sms/sms_query_single_template.php b/vendor/qiniu/php-sdk/examples/sms/sms_query_single_template.php new file mode 100644 index 0000000..8e0b279 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/sms_query_single_template.php @@ -0,0 +1,26 @@ +querySingleTemplate($template_id); +echo "\n====> query single template result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/sms/sms_query_template.php b/vendor/qiniu/php-sdk/examples/sms/sms_query_template.php new file mode 100644 index 0000000..6be260e --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/sms_query_template.php @@ -0,0 +1,28 @@ +queryTemplate($audit_status, $page, $page_size); +echo "\n====> query template result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/sms/sms_send_message.php b/vendor/qiniu/php-sdk/examples/sms/sms_send_message.php new file mode 100644 index 0000000..d943e52 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/sms/sms_send_message.php @@ -0,0 +1,32 @@ + 'xxxx'); + +list($ret, $err) = $client->sendMessage($template_id, $mobiles, $code); +if ($err !== null) { + var_dump($err); +} else { + echo "\n====> Send Message Successfully: \n"; + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/update_bucketEvent.php b/vendor/qiniu/php-sdk/examples/update_bucketEvent.php new file mode 100644 index 0000000..7b0d1d0 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/update_bucketEvent.php @@ -0,0 +1,31 @@ +updateBucketEvent($bucket, $name, $prefix, $suffix, $event, $callbackURL); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/update_bucketLifecycleRule.php b/vendor/qiniu/php-sdk/examples/update_bucketLifecycleRule.php new file mode 100644 index 0000000..73f0f56 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/update_bucketLifecycleRule.php @@ -0,0 +1,36 @@ +updateBucketLifecycleRule( + $bucket, + $name, + $prefix, + $delete_after_days, + $to_line_after_days +); +if ($err != null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/upload_and_callback.php b/vendor/qiniu/php-sdk/examples/upload_and_callback.php new file mode 100644 index 0000000..a0c793a --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/upload_and_callback.php @@ -0,0 +1,31 @@ + 'http://your.domain.com/upload_verify_callback.php', + 'callbackBody' => 'filename=$(fname)&filesize=$(fsize)' +); +$uptoken = $auth->uploadToken($bucket, null, 3600, $policy); + +// 上传文件的本地路径 +$filePath = './php-logo.png'; + +$uploadMgr = new UploadManager(); +list($ret, $err) = $uploadMgr->putFile($uptoken, null, $filePath); +echo "\n====> putFile result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/upload_and_pfop.php b/vendor/qiniu/php-sdk/examples/upload_and_pfop.php new file mode 100644 index 0000000..32c1eb5 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/upload_and_pfop.php @@ -0,0 +1,49 @@ + $pfop, + 'persistentNotifyUrl' => $notifyUrl, + 'persistentPipeline' => $pipeline +); +$token = $auth->uploadToken($bucket, null, 3600, $policy); + +list($ret, $err) = $uploadMgr->putFile($token, $key, $filePath); +echo "\n====> putFile result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/upload_mgr_init.php b/vendor/qiniu/php-sdk/examples/upload_mgr_init.php new file mode 100644 index 0000000..1164c90 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/upload_mgr_init.php @@ -0,0 +1,19 @@ +uploadToken($bucket); + +// 构建 UploadManager 对象 +$uploadMgr = new UploadManager(); diff --git a/vendor/qiniu/php-sdk/examples/upload_multi_demos.php b/vendor/qiniu/php-sdk/examples/upload_multi_demos.php new file mode 100644 index 0000000..d724235 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/upload_multi_demos.php @@ -0,0 +1,89 @@ +uploadToken($bucket); +$uploadMgr = new UploadManager(); + +//---------------------------------------- upload demo1 ---------------------------------------- +// 上传字符串到七牛 + +list($ret, $err) = $uploadMgr->put($token, null, 'content string'); +echo "\n====> put result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} + + +//---------------------------------------- upload demo2 ---------------------------------------- +// 上传文件到七牛 + +$filePath = './php-logo.png'; +$key = 'php-logo.png'; +list($ret, $err) = $uploadMgr->putFile($token, $key, $filePath); +echo "\n====> putFile result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} + + +//---------------------------------------- upload demo3 ---------------------------------------- +// 上传文件到七牛后, 七牛将文件名和文件大小回调给业务服务器. +// 可参考文档: https://developer.qiniu.com/kodo/manual/1206/put-policy + +$policy = array( + 'callbackUrl' => 'http://172.30.251.210/upload_verify_callback.php', + 'callbackBody' => 'filename=$(fname)&filesize=$(fsize)' +// 'callbackBodyType' => 'application/json', +// 'callbackBody' => '{"filename":$(fname), "filesize": $(fsize)}' //设置application/json格式回调 +); +$token = $auth->uploadToken($bucket, null, 3600, $policy); + + +list($ret, $err) = $uploadMgr->putFile($token, null, $key); +echo "\n====> putFile result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} + + +//---------------------------------------- upload demo4 ---------------------------------------- +// 上传视频,上传完成后进行 m3u8 的转码, 并给视频打水印 + +$wmImg = Qiniu\base64_urlSafeEncode('http://devtools.qiniudn.com/qiniu.png'); +$pfop = "avthumb/m3u8/wmImage/$wmImg"; + +// 转码完成后回调到业务服务器。(公网可以访问,并相应 200 OK) +$notifyUrl = 'http://notify.fake.com'; + +$policy = array( + 'persistentOps' => $pfop, + 'persistentNotifyUrl' => $notifyUrl, + 'persistentPipeline' => $pipeline +); +$token = $auth->uploadToken($bucket, null, 3600, $policy); +print($token); +list($ret, $err) = $uploadMgr->putFile($token, null, $key); +echo "\n====> putFile result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/upload_simple_file.php b/vendor/qiniu/php-sdk/examples/upload_simple_file.php new file mode 100644 index 0000000..f495a02 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/upload_simple_file.php @@ -0,0 +1,37 @@ +uploadToken($bucket); + +// 要上传文件的本地路径 +$filePath = './php-logo.png'; + +// 上传到七牛存储后保存的文件名 +$key = 'my-php-logo.png'; + +// 初始化 UploadManager 对象并进行文件的上传。 +$uploadMgr = new UploadManager(); + +// 调用 UploadManager 的 putFile 方法进行文件的上传,该方法会判断文件大小,进而决定使用表单上传还是分片上传,无需手动配置。 +list($ret, $err) = $uploadMgr->putFile($token, $key, $filePath); +echo "\n====> putFile result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/upload_tokens.php b/vendor/qiniu/php-sdk/examples/upload_tokens.php new file mode 100644 index 0000000..d2cf02c --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/upload_tokens.php @@ -0,0 +1,82 @@ +uploadToken($bucket, null, $expires, $policy, true); +print($upToken . "\n"); + +//---------------------------------------- demo2 ---------------------------------------- +// 自定义凭证有效期(示例2小时) + +$expires = 7200; +$upToken = $auth->uploadToken($bucket, null, $expires, $policy, true); +print($upToken . "\n"); + +//---------------------------------------- demo3 ---------------------------------------- +// 覆盖上传凭证 + +$expires = 3600; +$keyToOverwrite = 'qiniu.mp4'; +$upToken = $auth->uploadToken($bucket, $keyToOverwrite, $expires, $policy, true); +print($upToken . "\n"); + +//---------------------------------------- demo4 ---------------------------------------- +// 自定义上传回复(非callback模式)凭证 + +$returnBody = '{"key":"$(key)","hash":"$(etag)","fsize":$(fsize),"bucket":"$(bucket)","name":"$(x:name)"}'; +$policy = array( + 'returnBody' => $returnBody +); +$upToken = $auth->uploadToken($bucket, null, $expires, $policy, true); +print($upToken . "\n"); + +//---------------------------------------- demo5 ---------------------------------------- +// 带回调业务服务器的凭证(application/json) + +$policy = array( + 'callbackUrl' => 'http://api.example.com/qiniu/upload/callback', + 'callbackBody' => '{"key":"$(key)","hash":"$(etag)","fsize":$(fsize),"bucket":"$(bucket)","name":"$(x:name)"}', + 'callbackBodyType' => 'application/json' +); +$upToken = $auth->uploadToken($bucket, null, $expires, $policy, true); +print($upToken . "\n"); + +//---------------------------------------- demo6 ---------------------------------------- +// 带回调业务服务器的凭证(application/x-www-form-urlencoded) + +$policy = array( + 'callbackUrl' => 'http://api.example.com/qiniu/upload/callback', + 'callbackBody' => 'key=$(key)&hash=$(etag)&bucket=$(bucket)&fsize=$(fsize)&name=$(x:name)' +); +$upToken = $auth->uploadToken($bucket, null, $expires, $policy, true); +print($upToken . "\n"); + +//---------------------------------------- demo7 ---------------------------------------- +// 带数据处理的凭证 + +$saveMp4Entry = \Qiniu\base64_urlSafeEncode($bucket . ":avthumb_test_target.mp4"); +$saveJpgEntry = \Qiniu\base64_urlSafeEncode($bucket . ":vframe_test_target.jpg"); +$avthumbMp4Fop = "avthumb/mp4|saveas/" . $saveMp4Entry; +$vframeJpgFop = "vframe/jpg/offset/1|saveas/" . $saveJpgEntry; +$policy = array( + 'persistentOps' => $avthumbMp4Fop . ";" . $vframeJpgFop, + 'persistentPipeline' => "video-pipe", + 'persistentNotifyUrl' => "http://api.example.com/qiniu/pfop/notify", +); +$upToken = $auth->uploadToken($bucket, null, $expires, $policy, true); +print($upToken . "\n"); diff --git a/vendor/qiniu/php-sdk/examples/upload_verify_callback.php b/vendor/qiniu/php-sdk/examples/upload_verify_callback.php new file mode 100644 index 0000000..dcb64c9 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/upload_verify_callback.php @@ -0,0 +1,34 @@ +verifyCallback($contentType, $authorization, $url, $callbackBody); + +if ($isQiniuCallback) { + $resp = array('ret' => 'success'); +} else { + $resp = array('ret' => 'failed'); +} + +echo json_encode($resp); diff --git a/vendor/qiniu/php-sdk/examples/upload_with_qvmzone.php b/vendor/qiniu/php-sdk/examples/upload_with_qvmzone.php new file mode 100644 index 0000000..ce2b21f --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/upload_with_qvmzone.php @@ -0,0 +1,40 @@ +uploadToken($bucket); + +// 上传文件的本地路径 +$filePath = './php-logo.png'; + +// 七牛云主机QVM和七牛对象存储KODO内网上传,目前支持华东1区域(杭州)和华北2区域(北京)的云主机可以访问同区域的对象存储服务 +// 参考文档:https://developer.qiniu.com/qvm/manual/4269/qvm-kodo + +$zone = Zone::qvmZonez0(); // 华东:z0,华北:z1 +$config = new Config($zone); +$config->useHTTPS = true; + +// 指定 config +$uploadMgr = new UploadManager($config); + +list($ret, $err) = $uploadMgr->putFile($uptoken, $key, $filePath); +echo "\n====> putFile result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/examples/upload_with_zone.php b/vendor/qiniu/php-sdk/examples/upload_with_zone.php new file mode 100644 index 0000000..6192666 --- /dev/null +++ b/vendor/qiniu/php-sdk/examples/upload_with_zone.php @@ -0,0 +1,39 @@ +uploadToken($bucket); + +// 上传文件的本地路径 +$filePath = './php-logo.png'; + +// 指定 zone 上传 +// 参考文档:https://developer.qiniu.com/kodo/manual/1671/region-endpoint +$zone = Zone::zonez0(); // 华东:z0,华北:z1,华南:z2,北美:na0,东南亚:as0 +$config = new Config($zone); +$config->useHTTPS = true; + +// 指定 config +$uploadMgr = new UploadManager($config); + +list($ret, $err) = $uploadMgr->putFile($uptoken, $key, $filePath); +echo "\n====> putFile result: \n"; +if ($err !== null) { + var_dump($err); +} else { + var_dump($ret); +} diff --git a/vendor/qiniu/php-sdk/phpunit.xml.dist b/vendor/qiniu/php-sdk/phpunit.xml.dist new file mode 100644 index 0000000..840f6e5 --- /dev/null +++ b/vendor/qiniu/php-sdk/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + tests + + + + diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Auth.php b/vendor/qiniu/php-sdk/src/Qiniu/Auth.php new file mode 100644 index 0000000..90231e9 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Auth.php @@ -0,0 +1,231 @@ +accessKey = $accessKey; + $this->secretKey = $secretKey; + } + + public function getAccessKey() + { + return $this->accessKey; + } + + public function sign($data) + { + $hmac = hash_hmac('sha1', $data, $this->secretKey, true); + return $this->accessKey . ':' . \Qiniu\base64_urlSafeEncode($hmac); + } + + public function signWithData($data) + { + $encodedData = \Qiniu\base64_urlSafeEncode($data); + return $this->sign($encodedData) . ':' . $encodedData; + } + + public function signRequest($urlString, $body, $contentType = null) + { + $url = parse_url($urlString); + $data = ''; + if (array_key_exists('path', $url)) { + $data = $url['path']; + } + if (array_key_exists('query', $url)) { + $data .= '?' . $url['query']; + } + $data .= "\n"; + + if ($body !== null && $contentType === 'application/x-www-form-urlencoded') { + $data .= $body; + } + return $this->sign($data); + } + + /** + * @param string $urlString + * @param string $method + * @param string $body + * @param null|Header $headers + */ + public function signQiniuAuthorization($urlString, $method = "GET", $body = "", $headers = null) + { + $url = parse_url($urlString); + if (!$url) { + return array(null, new \Exception("parse_url error")); + } + + // append method, path and query + if ($method === "") { + $data = "GET "; + } else { + $data = $method . " "; + } + if (isset($url["path"])) { + $data .= $url["path"]; + } + if (isset($url["query"])) { + $data .= "?" . $url["query"]; + } + + // append Host + $data .= "\n"; + $data .= "Host: "; + if (isset($url["host"])) { + $data .= $url["host"]; + } + if (isset($url["port"]) && $url["port"] > 0) { + $data .= ":" . $url["port"]; + } + + // try append content type + if ($headers != null && isset($headers["Content-Type"])) { + // append content type + $data .= "\n"; + $data .= "Content-Type: " . $headers["Content-Type"]; + } + + // try append xQiniuHeaders + if ($headers != null) { + $headerLines = array(); + $keyPrefix = "X-Qiniu-"; + foreach ($headers as $k => $v) { + if (strlen($k) > strlen($keyPrefix) && strpos($k, $keyPrefix) === 0) { + array_push( + $headerLines, + $k . ": " . $v + ); + } + } + if (count($headerLines) > 0) { + $data .= "\n"; + sort($headerLines); + $data .= implode("\n", $headerLines); + } + } + + // append body + $data .= "\n\n"; + if (!empty($body) > 0 + && isset($headers["Content-Type"]) + && $headers["Content-Type"] != "application/octet-stream" + ) { + $data .= $body; + } + + return array($this->sign(utf8_encode($data)), null); + } + + public function verifyCallback($contentType, $originAuthorization, $url, $body) + { + $authorization = 'QBox ' . $this->signRequest($url, $body, $contentType); + return $originAuthorization === $authorization; + } + + public function privateDownloadUrl($baseUrl, $expires = 3600) + { + $deadline = time() + $expires; + + $pos = strpos($baseUrl, '?'); + if ($pos !== false) { + $baseUrl .= '&e='; + } else { + $baseUrl .= '?e='; + } + $baseUrl .= $deadline; + + $token = $this->sign($baseUrl); + return "$baseUrl&token=$token"; + } + + public function uploadToken($bucket, $key = null, $expires = 3600, $policy = null, $strictPolicy = true) + { + $deadline = time() + $expires; + $scope = $bucket; + if ($key !== null) { + $scope .= ':' . $key; + } + + $args = self::copyPolicy($args, $policy, $strictPolicy); + $args['scope'] = $scope; + $args['deadline'] = $deadline; + + $b = json_encode($args); + return $this->signWithData($b); + } + + /** + *上传策略,参数规格详见 + *http://developer.qiniu.com/docs/v6/api/reference/security/put-policy.html + */ + private static $policyFields = array( + 'callbackUrl', + 'callbackBody', + 'callbackHost', + 'callbackBodyType', + 'callbackFetchKey', + + 'returnUrl', + 'returnBody', + + 'endUser', + 'saveKey', + 'forceSaveKey', + 'insertOnly', + + 'detectMime', + 'mimeLimit', + 'fsizeMin', + 'fsizeLimit', + + 'persistentOps', + 'persistentNotifyUrl', + 'persistentPipeline', + + 'deleteAfterDays', + 'fileType', + 'isPrefixalScope', + ); + + private static function copyPolicy(&$policy, $originPolicy, $strictPolicy) + { + if ($originPolicy === null) { + return array(); + } + foreach ($originPolicy as $key => $value) { + if (!$strictPolicy || in_array((string)$key, self::$policyFields, true)) { + $policy[$key] = $value; + } + } + return $policy; + } + + public function authorization($url, $body = null, $contentType = null) + { + $authorization = 'QBox ' . $this->signRequest($url, $body, $contentType); + return array('Authorization' => $authorization); + } + + public function authorizationV2($url, $method, $body = null, $contentType = null) + { + $headers = null; + $result = array(); + if ($contentType != null) { + $headers = new Header(array( + 'Content-Type' => array($contentType), + )); + $result['Content-Type'] = $contentType; + } + list($sign) = $this->signQiniuAuthorization($url, $method, $body, $headers); + $result['Authorization'] = 'Qiniu ' . $sign; + return $result; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php new file mode 100644 index 0000000..a6efced --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Cdn/CdnManager.php @@ -0,0 +1,260 @@ +auth = $auth; + $this->server = 'http://fusion.qiniuapi.com'; + } + + /** + * @param array $urls 待刷新的文件链接数组 + * @return array + */ + public function refreshUrls(array $urls) + { + return $this->refreshUrlsAndDirs($urls, array()); + } + + /** + * @param array $dirs 待刷新的文件链接数组 + * @return array + * 目前客户默认没有目录刷新权限,刷新会有400038报错,参考:https://developer.qiniu.com/fusion/api/1229/cache-refresh + * 需要刷新目录请工单联系技术支持 https://support.qiniu.com/tickets/category + */ + public function refreshDirs(array $dirs) + { + return $this->refreshUrlsAndDirs(array(), $dirs); + } + + /** + * @param array $urls 待刷新的文件链接数组 + * @param array $dirs 待刷新的目录链接数组 + * + * @return array 刷新的请求回复和错误,参考 examples/cdn_manager.php 代码 + * @link http://developer.qiniu.com/article/fusion/api/refresh.html + * + * 目前客户默认没有目录刷新权限,刷新会有400038报错,参考:https://developer.qiniu.com/fusion/api/1229/cache-refresh + * 需要刷新目录请工单联系技术支持 https://support.qiniu.com/tickets/category + */ + public function refreshUrlsAndDirs(array $urls, array $dirs) + { + $req = array(); + if (!empty($urls)) { + $req['urls'] = $urls; + } + if (!empty($dirs)) { + $req['dirs'] = $dirs; + } + + $url = $this->server . '/v2/tune/refresh'; + $body = json_encode($req); + return $this->post($url, $body); + } + + /** + * 查询 CDN 刷新记录 + * + * @param string $requestId 指定要查询记录所在的刷新请求id + * @param string $isDir 指定是否查询目录,取值为 yes/no,默认不填则为两种类型记录都查询 + * @param array $urls 要查询的url列表,每个url可以是文件url,也可以是目录url + * @param string $state 指定要查询记录的状态,取值processing/success/failure + * @param int $pageNo 要求返回的页号,默认为0 + * @param int $pageSize 要求返回的页长度,默认为100 + * @param string $startTime 指定查询的开始日期,格式2006-01-01 + * @param string $endTime 指定查询的结束日期,格式2006-01-01 + * @return array + * @link https://developer.qiniu.com/fusion/api/1229/cache-refresh#4 + */ + public function getCdnRefreshList( + $requestId = null, + $isDir = null, + $urls = array(), + $state = null, + $pageNo = 0, + $pageSize = 100, + $startTime = null, + $endTime = null + ) { + $req = array(); + \Qiniu\setWithoutEmpty($req, 'requestId', $requestId); + \Qiniu\setWithoutEmpty($req, 'isDir', $isDir); + \Qiniu\setWithoutEmpty($req, 'urls', $urls); + \Qiniu\setWithoutEmpty($req, 'state', $state); + \Qiniu\setWithoutEmpty($req, 'pageNo', $pageNo); + \Qiniu\setWithoutEmpty($req, 'pageSize', $pageSize); + \Qiniu\setWithoutEmpty($req, 'startTime', $startTime); + \Qiniu\setWithoutEmpty($req, 'endTime', $endTime); + + $body = json_encode($req); + $url = $this->server . '/v2/tune/refresh/list'; + return $this->post($url, $body); + } + + /** + * @param array $urls 待预取的文件链接数组 + * + * @return array 预取的请求回复和错误,参考 examples/cdn_manager.php 代码 + * + * @link http://developer.qiniu.com/article/fusion/api/refresh.html + */ + public function prefetchUrls(array $urls) + { + $req = array( + 'urls' => $urls, + ); + + $url = $this->server . '/v2/tune/prefetch'; + $body = json_encode($req); + return $this->post($url, $body); + } + + /** + * 查询 CDN 预取记录 + * + * @param string $requestId 指定要查询记录所在的刷新请求id + * @param array $urls 要查询的url列表,每个url可以是文件url,也可以是目录url + * @param string $state 指定要查询记录的状态,取值processing/success/failure + * @param int $pageNo 要求返回的页号,默认为0 + * @param int $pageSize 要求返回的页长度,默认为100 + * @param string $startTime 指定查询的开始日期,格式2006-01-01 + * @param string $endTime 指定查询的结束日期,格式2006-01-01 + * @return array + * @link https://developer.qiniu.com/fusion/api/1227/file-prefetching#4 + */ + public function getCdnPrefetchList( + $requestId = null, + $urls = array(), + $state = null, + $pageNo = 0, + $pageSize = 100, + $startTime = null, + $endTime = null + ) { + $req = array(); + \Qiniu\setWithoutEmpty($req, 'requestId', $requestId); + \Qiniu\setWithoutEmpty($req, 'urls', $urls); + \Qiniu\setWithoutEmpty($req, 'state', $state); + \Qiniu\setWithoutEmpty($req, 'pageNo', $pageNo); + \Qiniu\setWithoutEmpty($req, 'pageSize', $pageSize); + \Qiniu\setWithoutEmpty($req, 'startTime', $startTime); + \Qiniu\setWithoutEmpty($req, 'endTime', $endTime); + + $body = json_encode($req); + $url = $this->server . '/v2/tune/prefetch/list'; + return $this->post($url, $body); + } + + /** + * @param array $domains 待获取带宽数据的域名数组 + * @param string $startDate 开始的日期,格式类似 2017-01-01 + * @param string $endDate 结束的日期,格式类似 2017-01-01 + * @param string $granularity 获取数据的时间间隔,可以是 5min, hour 或者 day + * + * @return array 带宽数据和错误信息,参考 examples/cdn_manager.php 代码 + * + * @link http://developer.qiniu.com/article/fusion/api/traffic-bandwidth.html + */ + public function getBandwidthData(array $domains, $startDate, $endDate, $granularity) + { + $req = array(); + $req['domains'] = implode(';', $domains); + $req['startDate'] = $startDate; + $req['endDate'] = $endDate; + $req['granularity'] = $granularity; + + $url = $this->server . '/v2/tune/bandwidth'; + $body = json_encode($req); + return $this->post($url, $body); + } + + /** + * @param array $domains 待获取流量数据的域名数组 + * @param string $startDate 开始的日期,格式类似 2017-01-01 + * @param string $endDate 结束的日期,格式类似 2017-01-01 + * @param string $granularity 获取数据的时间间隔,可以是 5min, hour 或者 day + * + * @return array 流量数据和错误信息,参考 examples/cdn_manager.php 代码 + * + * @link http://developer.qiniu.com/article/fusion/api/traffic-bandwidth.html + */ + public function getFluxData(array $domains, $startDate, $endDate, $granularity) + { + $req = array(); + $req['domains'] = implode(';', $domains); + $req['startDate'] = $startDate; + $req['endDate'] = $endDate; + $req['granularity'] = $granularity; + + $url = $this->server . '/v2/tune/flux'; + $body = json_encode($req); + return $this->post($url, $body); + } + + /** + * @param array $domains 待获取日志下载链接的域名数组 + * @param string $logDate 获取指定日期的日志下载链接,格式类似 2017-01-01 + * + * @return array 日志下载链接数据和错误信息,参考 examples/cdn_manager.php 代码 + * + * @link http://developer.qiniu.com/article/fusion/api/log.html + */ + public function getCdnLogList(array $domains, $logDate) + { + $req = array(); + $req['domains'] = implode(';', $domains); + $req['day'] = $logDate; + + $url = $this->server . '/v2/tune/log/list'; + $body = json_encode($req); + return $this->post($url, $body); + } + + private function post($url, $body) + { + $headers = $this->auth->authorization($url, $body, 'application/json'); + $headers['Content-Type'] = 'application/json'; + $ret = Client::post($url, $body, $headers); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + return array($r, null); + } + + /** + * 构建时间戳防盗链鉴权的访问外链 + * + * @param string $rawUrl 需要签名的资源url + * @param string $encryptKey 时间戳防盗链密钥 + * @param string $durationInSeconds 链接的有效期(以秒为单位) + * + * @return string 带鉴权信息的资源外链,参考 examples/cdn_timestamp_antileech.php 代码 + */ + public static function createTimestampAntiLeechUrl($rawUrl, $encryptKey, $durationInSeconds) + { + $parsedUrl = parse_url($rawUrl); + $deadline = time() + $durationInSeconds; + $expireHex = dechex($deadline); + $path = isset($parsedUrl['path']) ? $parsedUrl['path'] : ''; + $strToSign = $encryptKey . $path . $expireHex; + $signStr = md5($strToSign); + if (isset($parsedUrl['query'])) { + $signedUrl = $rawUrl . '&sign=' . $signStr . '&t=' . $expireHex; + } else { + $signedUrl = $rawUrl . '?sign=' . $signStr . '&t=' . $expireHex; + } + return $signedUrl; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Config.php b/vendor/qiniu/php-sdk/src/Qiniu/Config.php new file mode 100644 index 0000000..b93d99c --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Config.php @@ -0,0 +1,146 @@ +zone = $z; + $this->useHTTPS = false; + $this->useCdnDomains = false; + $this->regionCache = array(); + } + + public function getUpHost($accessKey, $bucket) + { + $region = $this->getRegion($accessKey, $bucket); + if ($this->useHTTPS === true) { + $scheme = "https://"; + } else { + $scheme = "http://"; + } + + $host = $region->srcUpHosts[0]; + if ($this->useCdnDomains === true) { + $host = $region->cdnUpHosts[0]; + } + + return $scheme . $host; + } + + public function getUpBackupHost($accessKey, $bucket) + { + $region = $this->getRegion($accessKey, $bucket); + if ($this->useHTTPS === true) { + $scheme = "https://"; + } else { + $scheme = "http://"; + } + + $host = $region->cdnUpHosts[0]; + if ($this->useCdnDomains === true) { + $host = $region->srcUpHosts[0]; + } + + return $scheme . $host; + } + + public function getRsHost($accessKey, $bucket) + { + $region = $this->getRegion($accessKey, $bucket); + + if ($this->useHTTPS === true) { + $scheme = "https://"; + } else { + $scheme = "http://"; + } + + return $scheme . $region->rsHost; + } + + public function getRsfHost($accessKey, $bucket) + { + $region = $this->getRegion($accessKey, $bucket); + + if ($this->useHTTPS === true) { + $scheme = "https://"; + } else { + $scheme = "http://"; + } + + return $scheme . $region->rsfHost; + } + + public function getIovipHost($accessKey, $bucket) + { + $region = $this->getRegion($accessKey, $bucket); + + if ($this->useHTTPS === true) { + $scheme = "https://"; + } else { + $scheme = "http://"; + } + + return $scheme . $region->iovipHost; + } + + public function getApiHost($accessKey, $bucket) + { + $region = $this->getRegion($accessKey, $bucket); + + if ($this->useHTTPS === true) { + $scheme = "https://"; + } else { + $scheme = "http://"; + } + + return $scheme . $region->apiHost; + } + + private function getRegion($accessKey, $bucket) + { + $cacheId = "$accessKey:$bucket"; + + if (isset($this->regionCache[$cacheId])) { + $region = $this->regionCache[$cacheId]; + } elseif (isset($this->zone)) { + $region = $this->zone; + $this->regionCache[$cacheId] = $region; + } else { + $region = Zone::queryZone($accessKey, $bucket); + if (is_array($region)) { + list($region, $err) = $region; + if ($err != null) { + throw new \Exception($err->message()); + } + } + $this->regionCache[$cacheId] = $region; + } + return $region; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Enum/QiniuEnum.php b/vendor/qiniu/php-sdk/src/Qiniu/Enum/QiniuEnum.php new file mode 100644 index 0000000..28afac8 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Enum/QiniuEnum.php @@ -0,0 +1,41 @@ + $val) { + array_push($data, '--' . $mimeBoundary); + array_push($data, "Content-Disposition: form-data; name=\"$key\""); + array_push($data, ''); + array_push($data, $val); + } + + array_push($data, '--' . $mimeBoundary); + $finalMimeType = empty($mimeType) ? 'application/octet-stream' : $mimeType; + $finalFileName = self::escapeQuotes($fileName); + array_push($data, "Content-Disposition: form-data; name=\"$name\"; filename=\"$finalFileName\""); + array_push($data, "Content-Type: $finalMimeType"); + array_push($data, ''); + array_push($data, $fileBody); + + array_push($data, '--' . $mimeBoundary . '--'); + array_push($data, ''); + + $body = implode("\r\n", $data); + // var_dump($data);exit; + $contentType = 'multipart/form-data; boundary=' . $mimeBoundary; + $headers['Content-Type'] = $contentType; + $request = new Request('POST', $url, $headers, $body); + return self::sendRequest($request); + } + + private static function userAgent() + { + $sdkInfo = "QiniuPHP/" . Config::SDK_VER; + + $systemInfo = php_uname("s"); + $machineInfo = php_uname("m"); + + $envInfo = "($systemInfo/$machineInfo)"; + + $phpVer = phpversion(); + + $ua = "$sdkInfo $envInfo PHP/$phpVer"; + return $ua; + } + + public static function sendRequest($request) + { + $t1 = microtime(true); + $ch = curl_init(); + $options = array( + CURLOPT_USERAGENT => self::userAgent(), + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYPEER => false, + CURLOPT_SSL_VERIFYHOST => false, + CURLOPT_HEADER => true, + CURLOPT_NOBODY => false, + CURLOPT_CUSTOMREQUEST => $request->method, + CURLOPT_URL => $request->url, + ); + // Handle open_basedir & safe mode + if (!ini_get('safe_mode') && !ini_get('open_basedir')) { + $options[CURLOPT_FOLLOWLOCATION] = true; + } + if (!empty($request->headers)) { + $headers = array(); + foreach ($request->headers as $key => $val) { + array_push($headers, "$key: $val"); + } + $options[CURLOPT_HTTPHEADER] = $headers; + } + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); + if (!empty($request->body)) { + $options[CURLOPT_POSTFIELDS] = $request->body; + } + curl_setopt_array($ch, $options); + $result = curl_exec($ch); + $t2 = microtime(true); + $duration = round($t2 - $t1, 3); + $ret = curl_errno($ch); + if ($ret !== 0) { + $r = new Response(-1, $duration, array(), null, curl_error($ch)); + curl_close($ch); + return $r; + } + $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); + $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); + $headers = Header::parseRawText(substr($result, 0, $header_size)); + $body = substr($result, $header_size); + curl_close($ch); + return new Response($code, $duration, $headers, $body, null); + } + + private static function escapeQuotes($str) + { + $find = array("\\", "\""); + $replace = array("\\\\", "\\\""); + return str_replace($find, $replace, $str); + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Http/Error.php b/vendor/qiniu/php-sdk/src/Qiniu/Http/Error.php new file mode 100644 index 0000000..73477cf --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Http/Error.php @@ -0,0 +1,35 @@ + + * {"error" : "detailed error message"} + * + */ +final class Error +{ + private $url; + private $response; + + public function __construct($url, $response) + { + $this->url = $url; + $this->response = $response; + } + + public function code() + { + return $this->response->statusCode; + } + + public function getResponse() + { + return $this->response; + } + + public function message() + { + return $this->response->error; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Http/Header.php b/vendor/qiniu/php-sdk/src/Qiniu/Http/Header.php new file mode 100644 index 0000000..7fa3faf --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Http/Header.php @@ -0,0 +1,280 @@ + $values) { + $normalizedKey = self::normalizeKey($key); + $normalizedValues = array(); + foreach ($values as $value) { + array_push($normalizedValues, self::normalizeValue($value)); + } + $this->data[$normalizedKey] = $normalizedValues; + } + return $this; + } + + /** + * return origin headers, which is field name case-sensitive + * + * @param string $raw + * + * @return array + */ + public static function parseRawText($raw) + { + $headers = array(); + $headerLines = explode("\r\n", $raw); + foreach ($headerLines as $line) { + $headerLine = trim($line); + $kv = explode(':', $headerLine); + if (count($kv) <= 1) { + continue; + } + // for http2 [Pseudo-Header Fields](https://datatracker.ietf.org/doc/html/rfc7540#section-8.1.2.1) + if ($kv[0] == "") { + $fieldName = ":" . $kv[1]; + } else { + $fieldName = $kv[0]; + } + $fieldValue = trim(substr($headerLine, strlen($fieldName . ":"))); + if (isset($headers[$fieldName])) { + array_push($headers[$fieldName], $fieldValue); + } else { + $headers[$fieldName] = array($fieldValue); + } + } + return $headers; + } + + /** + * @param string $raw + * + * @return Header + */ + public static function fromRawText($raw) + { + return new Header(self::parseRawText($raw)); + } + + /** + * @param string $key + * + * @return string + */ + public static function normalizeKey($key) + { + $key = trim($key); + + if (!self::isValidKeyName($key)) { + return $key; + } + + return ucwords(strtolower($key), '-'); + } + + /** + * @param string|numeric $value + * + * @return string|numeric + */ + public static function normalizeValue($value) + { + if (is_numeric($value)) { + return $value + 0; + } + return trim($value); + } + + /** + * @return array + */ + public function getRawData() + { + return $this->data; + } + + /** + * @param $offset string + * + * @return boolean + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + $key = self::normalizeKey($offset); + return isset($this->data[$key]); + } + + /** + * @param $offset string + * + * @return string|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + $key = self::normalizeKey($offset); + if (isset($this->data[$key]) && count($this->data[$key])) { + return $this->data[$key][0]; + } else { + return null; + } + } + + /** + * @param $offset string + * @param $value string + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + $key = self::normalizeKey($offset); + if (isset($this->data[$key]) && count($this->data[$key]) > 0) { + $this->data[$key][0] = self::normalizeValue($value); + } else { + $this->data[$key] = array(self::normalizeValue($value)); + } + } + + /** + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + $key = self::normalizeKey($offset); + unset($this->data[$key]); + } + + /** + * @return \ArrayIterator + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + $arr = array(); + foreach ($this->data as $k => $v) { + $arr[$k] = $v[0]; + } + return new \ArrayIterator($arr); + } + + /** + * @return int + */ + #[\ReturnTypeWillChange] + public function count() + { + return count($this->data); + } + + private static $isTokenTable = array( + '!' => true, + '#' => true, + '$' => true, + '%' => true, + '&' => true, + '\'' => true, + '*' => true, + '+' => true, + '-' => true, + '.' => true, + '0' => true, + '1' => true, + '2' => true, + '3' => true, + '4' => true, + '5' => true, + '6' => true, + '7' => true, + '8' => true, + '9' => true, + 'A' => true, + 'B' => true, + 'C' => true, + 'D' => true, + 'E' => true, + 'F' => true, + 'G' => true, + 'H' => true, + 'I' => true, + 'J' => true, + 'K' => true, + 'L' => true, + 'M' => true, + 'N' => true, + 'O' => true, + 'P' => true, + 'Q' => true, + 'R' => true, + 'S' => true, + 'T' => true, + 'U' => true, + 'W' => true, + 'V' => true, + 'X' => true, + 'Y' => true, + 'Z' => true, + '^' => true, + '_' => true, + '`' => true, + 'a' => true, + 'b' => true, + 'c' => true, + 'd' => true, + 'e' => true, + 'f' => true, + 'g' => true, + 'h' => true, + 'i' => true, + 'j' => true, + 'k' => true, + 'l' => true, + 'm' => true, + 'n' => true, + 'o' => true, + 'p' => true, + 'q' => true, + 'r' => true, + 's' => true, + 't' => true, + 'u' => true, + 'v' => true, + 'w' => true, + 'x' => true, + 'y' => true, + 'z' => true, + '|' => true, + '~' => true, + ); + + /** + * @param string $str + * + * @return boolean + */ + private static function isValidKeyName($str) + { + for ($i = 0; $i < strlen($str); $i += 1) { + if (!isset(self::$isTokenTable[$str[$i]])) { + return false; + } + } + return true; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Http/Request.php b/vendor/qiniu/php-sdk/src/Qiniu/Http/Request.php new file mode 100644 index 0000000..43b0bfd --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Http/Request.php @@ -0,0 +1,18 @@ +method = strtoupper($method); + $this->url = $url; + $this->headers = $headers; + $this->body = $body; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Http/Response.php b/vendor/qiniu/php-sdk/src/Qiniu/Http/Response.php new file mode 100644 index 0000000..bb50dd9 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Http/Response.php @@ -0,0 +1,212 @@ + 'Continue', + 101 => 'Switching Protocols', + 102 => 'Processing', + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 207 => 'Multi-Status', + 208 => 'Already Reported', + 226 => 'IM Used', + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 307 => 'Temporary Redirect', + 308 => 'Permanent Redirect', + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Timeout', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Long', + 415 => 'Unsupported Media Type', + 416 => 'Requested Range Not Satisfiable', + 417 => 'Expectation Failed', + 422 => 'Unprocessable Entity', + 423 => 'Locked', + 424 => 'Failed Dependency', + 425 => 'Reserved for WebDAV advanced collections expired proposal', + 426 => 'Upgrade required', + 428 => 'Precondition Required', + 429 => 'Too Many Requests', + 431 => 'Request Header Fields Too Large', + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Timeout', + 505 => 'HTTP Version Not Supported', + 506 => 'Variant Also Negotiates (Experimental)', + 507 => 'Insufficient Storage', + 508 => 'Loop Detected', + 510 => 'Not Extended', + 511 => 'Network Authentication Required', + ); + + /** + * @param int $code 状态码 + * @param double $duration 请求时长 + * @param array $headers 响应头部 + * @param string $body 响应内容 + * @param string $error 错误描述 + */ + public function __construct($code, $duration, array $headers = array(), $body = null, $error = null) + { + $this->statusCode = $code; + $this->duration = $duration; + $this->headers = array(); + $this->body = $body; + $this->error = $error; + $this->jsonData = null; + + if ($error !== null) { + return; + } + + foreach ($headers as $k => $vs) { + if (is_array($vs)) { + $this->headers[$k] = $vs[count($vs) - 1]; + } else { + $this->headers[$k] = $vs; + } + } + $this->normalizedHeaders = new Header($headers); + + if ($body === null) { + if ($code >= 400) { + $this->error = self::$statusTexts[$code]; + } + return; + } + if (self::isJson($this->normalizedHeaders)) { + try { + $jsonData = self::bodyJson($body); + if ($code >= 400) { + $this->error = $body; + if ($jsonData['error'] !== null) { + $this->error = $jsonData['error']; + } + } + $this->jsonData = $jsonData; + } catch (\InvalidArgumentException $e) { + $this->error = $body; + if ($code >= 200 && $code < 300) { + $this->error = $e->getMessage(); + } + } + } elseif ($code >= 400) { + $this->error = $body; + } + return; + } + + public function json() + { + return $this->jsonData; + } + + public function headers($normalized = false) + { + if ($normalized) { + return $this->normalizedHeaders; + } + return $this->headers; + } + + public function body() + { + return $this->body; + } + + private static function bodyJson($body) + { + return \Qiniu\json_decode((string) $body, true, 512); + } + + public function xVia() + { + $via = $this->normalizedHeaders['X-Via']; + if ($via === null) { + $via = $this->normalizedHeaders['X-Px']; + } + if ($via === null) { + $via = $this->normalizedHeaders['Fw-Via']; + } + return $via; + } + + public function xLog() + { + return $this->normalizedHeaders['X-Log']; + } + + public function xReqId() + { + return $this->normalizedHeaders['X-Reqid']; + } + + public function ok() + { + return $this->statusCode >= 200 && $this->statusCode < 300 && $this->error === null; + } + + public function needRetry() + { + $code = $this->statusCode; + if ($code < 0 || ($code / 100 === 5 and $code !== 579) || $code === 996) { + return true; + } + } + + private static function isJson($headers) + { + return isset($headers['Content-Type']) && strpos($headers['Content-Type'], 'application/json') === 0; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Processing/ImageUrlBuilder.php b/vendor/qiniu/php-sdk/src/Qiniu/Processing/ImageUrlBuilder.php new file mode 100644 index 0000000..f5575ed --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Processing/ImageUrlBuilder.php @@ -0,0 +1,292 @@ + + */ + public function thumbnail( + $url, + $mode, + $width, + $height, + $format = null, + $interlace = null, + $quality = null, + $ignoreError = 1 + ) { + + // url合法效验 + if (!$this->isUrl($url)) { + return $url; + } + + // 参数合法性效验 + if (!in_array(intval($mode), $this->modeArr, true)) { + return $url; + } + + if (!$width || !$height) { + return $url; + } + + $thumbStr = 'imageView2/' . $mode . '/w/' . $width . '/h/' . $height . '/'; + + // 拼接输出格式 + if (!is_null($format) + && in_array($format, $this->formatArr) + ) { + $thumbStr .= 'format/' . $format . '/'; + } + + // 拼接渐进显示 + if (!is_null($interlace) + && in_array(intval($interlace), array(0, 1), true) + ) { + $thumbStr .= 'interlace/' . $interlace . '/'; + } + + // 拼接图片质量 + if (!is_null($quality) + && intval($quality) >= 0 + && intval($quality) <= 100 + ) { + $thumbStr .= 'q/' . $quality . '/'; + } + + $thumbStr .= 'ignore-error/' . $ignoreError . '/'; + + // 如果有query_string用|线分割实现多参数 + return $url . ($this->hasQuery($url) ? '|' : '?') . $thumbStr; + } + + /** + * 图片水印 + * + * @param string $url 图片链接 + * @param string $image 水印图片链接 + * @param int $dissolve 透明度 + * @param string $gravity 水印位置 + * @param int $dx 横轴边距 + * @param int $dy 纵轴边距 + * @param int $watermarkScale 自适应原图的短边比例 + * @return string + * @link http://developer.qiniu.com/code/v6/api/kodo-api/image/watermark.html + * @author Sherlock Ren + */ + public function waterImg( + $url, + $image, + $dissolve = 100, + $gravity = 'SouthEast', + $dx = null, + $dy = null, + $watermarkScale = null + ) { + // url合法效验 + if (!$this->isUrl($url)) { + return $url; + } + + $waterStr = 'watermark/1/image/' . \Qiniu\base64_urlSafeEncode($image) . '/'; + + // 拼接水印透明度 + if (is_numeric($dissolve) + && $dissolve <= 100 + ) { + $waterStr .= 'dissolve/' . $dissolve . '/'; + } + + // 拼接水印位置 + if (in_array($gravity, $this->gravityArr, true)) { + $waterStr .= 'gravity/' . $gravity . '/'; + } + + // 拼接横轴边距 + if (!is_null($dx) + && is_numeric($dx) + ) { + $waterStr .= 'dx/' . $dx . '/'; + } + + // 拼接纵轴边距 + if (!is_null($dy) + && is_numeric($dy) + ) { + $waterStr .= 'dy/' . $dy . '/'; + } + + // 拼接自适应原图的短边比例 + if (!is_null($watermarkScale) + && is_numeric($watermarkScale) + && $watermarkScale > 0 + && $watermarkScale < 1 + ) { + $waterStr .= 'ws/' . $watermarkScale . '/'; + } + + // 如果有query_string用|线分割实现多参数 + return $url . ($this->hasQuery($url) ? '|' : '?') . $waterStr; + } + + /** + * 文字水印 + * + * @param string $url 图片链接 + * @param string $text 文字 + * @param string $font 文字字体 + * @param string $fontSize 文字字号 + * @param string $fontColor 文字颜色 + * @param int $dissolve 透明度 + * @param string $gravity 水印位置 + * @param int $dx 横轴边距 + * @param int $dy 纵轴边距 + * @return string + * @link http://developer.qiniu.com/code/v6/api/kodo-api/image/watermark.html#text-watermark + * @author Sherlock Ren + */ + public function waterText( + $url, + $text, + $font = '黑体', + $fontSize = 0, + $fontColor = null, + $dissolve = 100, + $gravity = 'SouthEast', + $dx = null, + $dy = null + ) { + // url合法效验 + if (!$this->isUrl($url)) { + return $url; + } + + $waterStr = 'watermark/2/text/' + . \Qiniu\base64_urlSafeEncode($text) . '/font/' + . \Qiniu\base64_urlSafeEncode($font) . '/'; + + // 拼接文字大小 + if (is_int($fontSize)) { + $waterStr .= 'fontsize/' . $fontSize . '/'; + } + + // 拼接文字颜色 + if (!is_null($fontColor) + && $fontColor + ) { + $waterStr .= 'fill/' . \Qiniu\base64_urlSafeEncode($fontColor) . '/'; + } + + // 拼接水印透明度 + if (is_numeric($dissolve) + && $dissolve <= 100 + ) { + $waterStr .= 'dissolve/' . $dissolve . '/'; + } + + // 拼接水印位置 + if (in_array($gravity, $this->gravityArr, true)) { + $waterStr .= 'gravity/' . $gravity . '/'; + } + + // 拼接横轴边距 + if (!is_null($dx) + && is_numeric($dx) + ) { + $waterStr .= 'dx/' . $dx . '/'; + } + + // 拼接纵轴边距 + if (!is_null($dy) + && is_numeric($dy) + ) { + $waterStr .= 'dy/' . $dy . '/'; + } + + // 如果有query_string用|线分割实现多参数 + return $url . ($this->hasQuery($url) ? '|' : '?') . $waterStr; + } + + /** + * 效验url合法性 + * + * @param string $url url链接 + * @return string + * @author Sherlock Ren + */ + protected function isUrl($url) + { + $urlArr = parse_url($url); + + return $urlArr['scheme'] + && in_array($urlArr['scheme'], array('http', 'https')) + && $urlArr['host'] + && $urlArr['path']; + } + + /** + * 检测是否有query + * + * @param string $url url链接 + * @return string + * @author Sherlock Ren + */ + protected function hasQuery($url) + { + $urlArr = parse_url($url); + + return !empty($urlArr['query']); + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Processing/Operation.php b/vendor/qiniu/php-sdk/src/Qiniu/Processing/Operation.php new file mode 100644 index 0000000..7cdd352 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Processing/Operation.php @@ -0,0 +1,60 @@ +auth = $auth; + $this->domain = $domain; + $this->token_expire = $token_expire; + } + + + /** + * 对资源文件进行处理 + * + * @param string $key 待处理的资源文件名 + * @param string $fops string|array fop操作,多次fop操作以array的形式传入。 + * eg. imageView2/1/w/200/h/200, imageMogr2/thumbnail/!75px + * + * @return array 文件处理后的结果及错误。 + * + * @link http://developer.qiniu.com/docs/v6/api/reference/fop/ + */ + public function execute($key, $fops) + { + $url = $this->buildUrl($key, $fops); + $resp = Client::get($url); + if (!$resp->ok()) { + return array(null, new Error($url, $resp)); + } + if ($resp->json() !== null) { + return array($resp->json(), null); + } + return array($resp->body, null); + } + + public function buildUrl($key, $fops, $protocol = 'http') + { + if (is_array($fops)) { + $fops = implode('|', $fops); + } + + $url = $protocol . "://$this->domain/$key?$fops"; + if ($this->auth !== null) { + $url = $this->auth->privateDownloadUrl($url, $this->token_expire); + } + + return $url; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php b/vendor/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php new file mode 100644 index 0000000..ac95d25 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Processing/PersistentFop.php @@ -0,0 +1,94 @@ +auth = $auth; + if ($config == null) { + $this->config = new Config(); + } else { + $this->config = $config; + } + } + + /** + * 对资源文件进行异步持久化处理 + * @param string $bucket 资源所在空间 + * @param string $key 待处理的源文件 + * @param string $fops string|array 待处理的pfop操作,多个pfop操作以array的形式传入。 + * eg. avthumb/mp3/ab/192k, vframe/jpg/offset/7/w/480/h/360 + * @param string $pipeline 资源处理队列 + * @param string $notify_url 处理结果通知地址 + * @param bool $force 是否强制执行一次新的指令 + * + * + * @return array 返回持久化处理的persistentId, 和返回的错误。 + * + * @link http://developer.qiniu.com/docs/v6/api/reference/fop/ + */ + public function execute($bucket, $key, $fops, $pipeline = null, $notify_url = null, $force = false) + { + if (is_array($fops)) { + $fops = implode(';', $fops); + } + $params = array('bucket' => $bucket, 'key' => $key, 'fops' => $fops); + \Qiniu\setWithoutEmpty($params, 'pipeline', $pipeline); + \Qiniu\setWithoutEmpty($params, 'notifyURL', $notify_url); + if ($force) { + $params['force'] = 1; + } + $data = http_build_query($params); + $scheme = "http://"; + if ($this->config->useHTTPS === true) { + $scheme = "https://"; + } + $url = $scheme . Config::API_HOST . '/pfop/'; + $headers = $this->auth->authorization($url, $data, 'application/x-www-form-urlencoded'); + $headers['Content-Type'] = 'application/x-www-form-urlencoded'; + $response = Client::post($url, $data, $headers); + if (!$response->ok()) { + return array(null, new Error($url, $response)); + } + $r = $response->json(); + $id = $r['persistentId']; + return array($id, null); + } + + public function status($id) + { + $scheme = "http://"; + + if ($this->config->useHTTPS === true) { + $scheme = "https://"; + } + $url = $scheme . Config::API_HOST . "/status/get/prefop?id=$id"; + $response = Client::get($url); + if (!$response->ok()) { + return array(null, new Error($url, $response)); + } + return array($response->json(), null); + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Region.php b/vendor/qiniu/php-sdk/src/Qiniu/Region.php new file mode 100644 index 0000000..eae21d1 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Region.php @@ -0,0 +1,196 @@ +srcUpHosts = $srcUpHosts; + $this->cdnUpHosts = $cdnUpHosts; + $this->rsHost = $rsHost; + $this->rsfHost = $rsfHost; + $this->apiHost = $apiHost; + $this->iovipHost = $iovipHost; + } + + //华东机房 + public static function regionHuadong() + { + $regionHuadong = new Region( + array("up.qiniup.com", 'up-jjh.qiniup.com', 'up-xs.qiniup.com'), + array('upload.qiniup.com', 'upload-jjh.qiniup.com', 'upload-xs.qiniup.com'), + 'rs.qbox.me', + 'rsf.qbox.me', + 'api.qiniu.com', + 'iovip.qbox.me' + ); + return $regionHuadong; + } + + //华东机房内网上传 + public static function qvmRegionHuadong() + { + $qvmRegionHuadong = new Region( + array("free-qvm-z0-xs.qiniup.com"), + 'rs.qbox.me', + 'rsf.qbox.me', + 'api.qiniu.com', + 'iovip.qbox.me' + ); + return $qvmRegionHuadong; + } + + //华北机房内网上传 + public static function qvmRegionHuabei() + { + $qvmRegionHuabei = new Region( + array("free-qvm-z1-zz.qiniup.com"), + "rs-z1.qbox.me", + "rsf-z1.qbox.me", + "api-z1.qiniu.com", + "iovip-z1.qbox.me" + ); + return $qvmRegionHuabei; + } + + //华北机房 + public static function regionHuabei() + { + $regionHuabei = new Region( + array('up-z1.qiniup.com'), + array('upload-z1.qiniup.com'), + "rs-z1.qbox.me", + "rsf-z1.qbox.me", + "api-z1.qiniu.com", + "iovip-z1.qbox.me" + ); + + return $regionHuabei; + } + + //华南机房 + public static function regionHuanan() + { + $regionHuanan = new Region( + array('up-z2.qiniup.com', 'up-dg.qiniup.com', 'up-fs.qiniup.com'), + array('upload-z2.qiniup.com', 'upload-dg.qiniup.com', 'upload-fs.qiniup.com'), + "rs-z2.qbox.me", + "rsf-z2.qbox.me", + "api-z2.qiniu.com", + "iovip-z2.qbox.me" + ); + return $regionHuanan; + } + + //北美机房 + public static function regionNorthAmerica() + { + //北美机房 + $regionNorthAmerica = new Region( + array('up-na0.qiniup.com'), + array('upload-na0.qiniup.com'), + "rs-na0.qbox.me", + "rsf-na0.qbox.me", + "api-na0.qiniu.com", + "iovip-na0.qbox.me" + ); + return $regionNorthAmerica; + } + + //新加坡机房 + public static function regionSingapore() + { + //新加坡机房 + $regionSingapore = new Region( + array('up-as0.qiniup.com'), + array('upload-as0.qiniup.com'), + "rs-as0.qbox.me", + "rsf-as0.qbox.me", + "api-as0.qiniu.com", + "iovip-as0.qbox.me" + ); + return $regionSingapore; + } + + /* + * GET /v2/query?ak=&&bucket= + **/ + public static function queryRegion($ak, $bucket) + { + $Region = new Region(); + $url = Config::API_HOST . '/v2/query' . "?ak=$ak&bucket=$bucket"; + $ret = Client::Get($url); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + //parse Region; + + $iovipHost = $r['io']['src']['main'][0]; + $Region->iovipHost = $iovipHost; + $accMain = $r['up']['acc']['main'][0]; + array_push($Region->cdnUpHosts, $accMain); + if (isset($r['up']['acc']['backup'])) { + foreach ($r['up']['acc']['backup'] as $key => $value) { + array_push($Region->cdnUpHosts, $value); + } + } + $srcMain = $r['up']['src']['main'][0]; + array_push($Region->srcUpHosts, $srcMain); + if (isset($r['up']['src']['backup'])) { + foreach ($r['up']['src']['backup'] as $key => $value) { + array_push($Region->srcUpHosts, $value); + } + } + + //set specific hosts + if (strstr($Region->iovipHost, "z1") !== false) { + $Region->rsHost = "rs-z1.qbox.me"; + $Region->rsfHost = "rsf-z1.qbox.me"; + $Region->apiHost = "api-z1.qiniu.com"; + } elseif (strstr($Region->iovipHost, "z2") !== false) { + $Region->rsHost = "rs-z2.qbox.me"; + $Region->rsfHost = "rsf-z2.qbox.me"; + $Region->apiHost = "api-z2.qiniu.com"; + } elseif (strstr($Region->iovipHost, "na0") !== false) { + $Region->rsHost = "rs-na0.qbox.me"; + $Region->rsfHost = "rsf-na0.qbox.me"; + $Region->apiHost = "api-na0.qiniu.com"; + } elseif (strstr($Region->iovipHost, "as0") !== false) { + $Region->rsHost = "rs-as0.qbox.me"; + $Region->rsfHost = "rsf-as0.qbox.me"; + $Region->apiHost = "api-as0.qiniu.com"; + } else { + $Region->rsHost = "rs.qbox.me"; + $Region->rsfHost = "rsf.qbox.me"; + $Region->apiHost = "api.qiniu.com"; + } + + return $Region; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php b/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php new file mode 100644 index 0000000..4f45aae --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Rtc/AppClient.php @@ -0,0 +1,234 @@ +auth = $auth; + + $this->baseURL = sprintf("%s/%s/apps", Config::RTCAPI_HOST, Config::RTCAPI_VERSION); + } + + /** + * 创建应用 + * + * @param string $hub 绑定的直播 hub + * @param string $title app 的名称 注意,Title 不是唯一标识,重复 create 动作将生成多个 app + * @param int $maxUsers 连麦房间支持的最大在线人数 + * @param bool $noAutoKickUser 禁止自动踢人(抢流),默认为 false + * @return array + * @link https://doc.qnsdk.com/rtn/docs/server_overview#2_1 + */ + public function createApp($hub, $title, $maxUsers = null, $noAutoKickUser = null) + { + $params = array(); + $params['hub'] = $hub; + $params['title'] = $title; + if (!empty($maxUsers)) { + $params['maxUsers'] = $maxUsers; + } + if ($noAutoKickUser !== null) { + $params['noAutoKickUser'] = $noAutoKickUser; + } + $body = json_encode($params); + return $this->post($this->baseURL, $body); + } + + /** + * 更新一个应用的配置信息 + * + * @param string $appId app 的唯一标识,创建的时候由系统生成 + * @param string $hub app 的名称,可选 + * @param string $title 绑定的直播 hub,可选,用于合流后 rtmp 推流 + * @param int $maxUsers 连麦房间支持的最大在线人数,可选 + * @param bool $noAutoKickUser 禁止自动踢人,可选 + * @param null $mergePublishRtmp 连麦合流转推 RTMP 的配置,可选择。其详细配置可以参考文档 + * @return array + * @link https://doc.qnsdk.com/rtn/docs/server_overview#2_1 + */ + public function updateApp($appId, $hub, $title, $maxUsers = null, $noAutoKickUser = null, $mergePublishRtmp = null) + { + $url = $this->baseURL . '/' . $appId; + $params = array(); + $params['hub'] = $hub; + $params['title'] = $title; + if (!empty($maxUsers)) { + $params['maxUsers'] = $maxUsers; + } + if ($noAutoKickUser !== null) { + $params['noAutoKickUser'] = $noAutoKickUser; + } + if (!empty($mergePublishRtmp)) { + $params['mergePublishRtmp'] = $mergePublishRtmp; + } + $body = json_encode($params); + return $this->post($url, $body); + } + + /** + * 获取应用信息 + * + * @param string $appId + * @return array + * @link https://doc.qnsdk.com/rtn/docs/server_overview#2_1 + */ + public function getApp($appId) + { + $url = $this->baseURL . '/' . $appId; + return $this->get($url); + } + + /** + * 删除应用 + * + * @param string $appId app 的唯一标识,创建的时候由系统生成 + * @return array + * @link https://doc.qnsdk.com/rtn/docs/server_overview#2_1 + */ + public function deleteApp($appId) + { + $url = $this->baseURL . '/' . $appId; + return $this->delete($url); + } + + /** + * 获取房间内用户列表 + * + * @param string $appId app 的唯一标识,创建的时候由系统生成 + * @param string $roomName 操作所查询的连麦房间 + * @return array + * @link https://doc.qnsdk.com/rtn/docs/server_overview#2_2 + */ + public function listUser($appId, $roomName) + { + $url = sprintf("%s/%s/rooms/%s/users", $this->baseURL, $appId, $roomName); + return $this->get($url); + } + + /** + * 指定一个用户踢出房间 + * + * @param string $appId app 的唯一标识,创建的时候由系统生成 + * @param string $roomName 连麦房间 + * @param string $userId 操作所剔除的用户 + * @return mixed + * @link https://doc.qnsdk.com/rtn/docs/server_overview#2_2 + */ + public function kickUser($appId, $roomName, $userId) + { + $url = sprintf("%s/%s/rooms/%s/users/%s", $this->baseURL, $appId, $roomName, $userId); + return $this->delete($url); + } + + /** + * 停止一个房间的合流转推 + * + * @param string $appId + * @param string $roomName + * @return array + * @link https://doc.qnsdk.com/rtn/docs/server_overview#2_2 + */ + public function stopMerge($appId, $roomName) + { + $url = sprintf("%s/%s/rooms/%s/merge", $this->baseURL, $appId, $roomName); + return $this->delete($url); + } + + /** + * 获取应用中活跃房间 + * + * @param string $appId 连麦房间所属的 app + * @param null $prefix 所查询房间名的前缀索引,可以为空。 + * @param int $offset 分页查询的位移标记 + * @param int $limit 此次查询的最大长度 + * @return array + * @link https://doc.qnsdk.com/rtn/docs/server_overview#2_2 + */ + public function listActiveRooms($appId, $prefix = null, $offset = null, $limit = null) + { + $query = array(); + if (isset($prefix)) { + $query['prefix'] = $prefix; + } + if (isset($offset)) { + $query['offset'] = $offset; + } + if (isset($limit)) { + $query['limit'] = $limit; + } + if (isset($query) && !empty($query)) { + $query = '?' . http_build_query($query); + $url = sprintf("%s/%s/rooms%s", $this->baseURL, $appId, $query); + } else { + $url = sprintf("%s/%s/rooms", $this->baseURL, $appId); + } + return $this->get($url); + } + + /** + * 生成加入房间的令牌 + * + * @param string $appId app 的唯一标识,创建的时候由系统生成 + * @param string $roomName 房间名称,需满足规格 ^[a-zA-Z0-9_-]{3,64}$ + * @param string $userId 请求加入房间的用户 ID,需满足规格 ^[a-zA-Z0-9_-]{3,50}$ + * @param int $expireAt 鉴权的有效时间,传入以秒为单位的64位 Unix 绝对时间 + * @param string $permission 该用户的房间管理权限,"admin" 或 "user",默认为 "user" + * @return string + * @link https://doc.qnsdk.com/rtn/docs/server_overview#1 + */ + public function appToken($appId, $roomName, $userId, $expireAt, $permission) + { + $params = array(); + $params['appId'] = $appId; + $params['userId'] = $userId; + $params['roomName'] = $roomName; + $params['permission'] = $permission; + $params['expireAt'] = $expireAt; + $appAccessString = json_encode($params); + return $this->auth->signWithData($appAccessString); + } + + private function get($url, $cType = null) + { + $rtcToken = $this->auth->authorizationV2($url, "GET", null, $cType); + $rtcToken['Content-Type'] = $cType; + $ret = Client::get($url, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + return array($ret->json(), null); + } + + private function delete($url, $contentType = 'application/json') + { + $rtcToken = $this->auth->authorizationV2($url, "DELETE", null, $contentType); + $rtcToken['Content-Type'] = $contentType; + $ret = Client::delete($url, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + return array($ret->json(), null); + } + + private function post($url, $body, $contentType = 'application/json') + { + $rtcToken = $this->auth->authorizationV2($url, "POST", $body, $contentType); + $rtcToken['Content-Type'] = $contentType; + $ret = Client::post($url, $body, $rtcToken); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + return array($r, null); + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php b/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php new file mode 100644 index 0000000..625ec30 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Sms/Sms.php @@ -0,0 +1,380 @@ +auth = $auth; + + $this->baseURL = sprintf("%s/%s/", Config::SMS_HOST, Config::SMS_VERSION); + } + + /** + * 创建签名 + * + * @param string $signature 签名 + * @param string $source 签名来源,申请签名时必须指定签名来源 + * @param string $pics 签名对应的资质证明图片进行 base64 编码格式转换后的字符串,可选 + * @return array + * + * @link https://developer.qiniu.com/sms/api/5844/sms-api-create-signature + */ + public function createSignature($signature, $source, $pics = null) + { + $params = array(); + $params['signature'] = $signature; + $params['source'] = $source; + if (!empty($pics)) { + $params['pics'] = array($this->imgToBase64($pics)); + } + $body = json_encode($params); + $url = $this->baseURL . 'signature'; + return $this->post($url, $body); + } + + /** + * 编辑签名 + * + * @param string $id 签名 ID + * @param string $signature 签名 + * @param string $source 签名来源 + * @param string $pics 签名对应的资质证明图片进行 base64 编码格式转换后的字符串,可选 + * @return array + * @link https://developer.qiniu.com/sms/api/5890/sms-api-edit-signature + */ + public function updateSignature($id, $signature, $source, $pics = null) + { + $params = array(); + $params['signature'] = $signature; + $params['source'] = $source; + if (!empty($pics)) { + $params['pics'] = array($this->imgToBase64($pics)); + } + $body = json_encode($params); + $url = $this->baseURL . 'signature/' . $id; + return $this->PUT($url, $body); + } + + /** + * 列出签名 + * + * @param string $audit_status 审核状态:"passed"(通过), "rejected"(未通过), "reviewing"(审核中) + * @param int $page 页码。默认为 1 + * @param int $page_size 分页大小。默认为 20 + * @return array + * @link https://developer.qiniu.com/sms/api/5889/sms-api-query-signature + */ + public function querySignature($audit_status = null, $page = 1, $page_size = 20) + { + + $url = sprintf( + "%s?audit_status=%s&page=%s&page_size=%s", + $this->baseURL . 'signature', + $audit_status, + $page, + $page_size + ); + return $this->get($url); + } + + /** + * 查询单个签名 + * + * @param string $signature_id + * @return array + * @link https://developer.qiniu.com/sms/api/5970/query-a-single-signature + */ + public function checkSingleSignature($signature_id) + { + + $url = sprintf( + "%s/%s", + $this->baseURL . 'signature', + $signature_id + ); + return $this->get($url); + } + + /** + * 删除签名 + * + * @param string $signature_id 签名 ID + * @return array + * @link https://developer.qiniu.com/sms/api/5891/sms-api-delete-signature + */ + public function deleteSignature($signature_id) + { + $url = $this->baseURL . 'signature/' . $signature_id; + return $this->delete($url); + } + + /** + * 创建模板 + * + * @param string $name 模板名称 + * @param string $template 模板内容 可设置自定义变量,发送短信时候使用,参考:${code} + * @param string $type notification:通知类,verification:验证码,marketing:营销类,voice:语音类 + * @param string $description 申请理由简述 + * @param string $signature_id 已经审核通过的签名 + * @return array array + * @link https://developer.qiniu.com/sms/api/5893/sms-api-create-template + */ + public function createTemplate( + $name, + $template, + $type, + $description, + $signature_id + ) { + $params = array(); + $params['name'] = $name; + $params['template'] = $template; + $params['type'] = $type; + $params['description'] = $description; + $params['signature_id'] = $signature_id; + + $body = json_encode($params); + $url = $this->baseURL . 'template'; + return $this->post($url, $body); + } + + /** + * 列出模板 + * + * @param string $audit_status 审核状态:passed (通过), rejected (未通过), reviewing (审核中) + * @param int $page 页码。默认为 1 + * @param int $page_size 分页大小。默认为 20 + * @return array + * @link https://developer.qiniu.com/sms/api/5894/sms-api-query-template + */ + public function queryTemplate($audit_status = null, $page = 1, $page_size = 20) + { + + $url = sprintf( + "%s?audit_status=%s&page=%s&page_size=%s", + $this->baseURL . 'template', + $audit_status, + $page, + $page_size + ); + return $this->get($url); + } + + /** + * 查询单个模版 + * + * @param string $template_id 模版ID + * @return array + * @link https://developer.qiniu.com/sms/api/5969/query-a-single-template + */ + public function querySingleTemplate($template_id) + { + + $url = sprintf( + "%s/%s", + $this->baseURL . 'template', + $template_id + ); + return $this->get($url); + } + + /** + * 编辑模板 + * + * @param string $id 模板 ID + * @param string $name 模板名称 + * @param string $template 模板内容 + * @param string $description 申请理由简述 + * @param string $signature_id 已经审核通过的签名 ID + * @return array + * @link https://developer.qiniu.com/sms/api/5895/sms-api-edit-template + */ + public function updateTemplate( + $id, + $name, + $template, + $description, + $signature_id + ) { + $params = array(); + $params['name'] = $name; + $params['template'] = $template; + $params['description'] = $description; + $params['signature_id'] = $signature_id; + $body = json_encode($params); + $url = $this->baseURL . 'template/' . $id; + return $this->PUT($url, $body); + } + + /** + * 删除模板 + * + * @param string $template_id 模板 ID + * @return array + * @link https://developer.qiniu.com/sms/api/5896/sms-api-delete-template + */ + public function deleteTemplate($template_id) + { + $url = $this->baseURL . 'template/' . $template_id; + return $this->delete($url); + } + + /** + * 发送短信 + * + * @param string $template_id 模板 ID + * @param array $mobiles 手机号 + * @param array $parameters 自定义模板变量,变量设置在创建模板时,参数template指定 + * @return array + * @link https://developer.qiniu.com/sms/api/5897/sms-api-send-message + */ + public function sendMessage($template_id, $mobiles, $parameters = null) + { + $params = array(); + $params['template_id'] = $template_id; + $params['mobiles'] = $mobiles; + if (!empty($parameters)) { + $params['parameters'] = $parameters; + } + $body = json_encode($params); + $url = $this->baseURL . 'message'; + return $this->post($url, $body); + } + + /** + * 查询发送记录 + * + * @param string $job_id 发送任务返回的 id + * @param string $message_id 单条短信发送接口返回的 id + * @param string $mobile 接收短信的手机号码 + * @param string $status sending: 发送中,success: 发送成功,failed: 发送失败,waiting: 等待发送 + * @param string $template_id 模版 id + * @param string $type marketing:营销,notification:通知,verification:验证码,voice:语音 + * @param string $start 开始时间,timestamp,例如: 1563280448 + * @param int $end 结束时间,timestamp,例如: 1563280471 + * @param int $page 页码,默认为 1 + * @param int $page_size 每页返回的数据条数,默认20,最大200 + * @return array + * @link https://developer.qiniu.com/sms/api/5852/query-send-sms + */ + public function querySendSms( + $job_id = null, + $message_id = null, + $mobile = null, + $status = null, + $template_id = null, + $type = null, + $start = null, + $end = null, + $page = 1, + $page_size = 20 + ) { + $query = array(); + \Qiniu\setWithoutEmpty($query, 'job_id', $job_id); + \Qiniu\setWithoutEmpty($query, 'message_id', $message_id); + \Qiniu\setWithoutEmpty($query, 'mobile', $mobile); + \Qiniu\setWithoutEmpty($query, 'status', $status); + \Qiniu\setWithoutEmpty($query, 'template_id', $template_id); + \Qiniu\setWithoutEmpty($query, 'type', $type); + \Qiniu\setWithoutEmpty($query, 'start', $start); + \Qiniu\setWithoutEmpty($query, 'end', $end); + \Qiniu\setWithoutEmpty($query, 'page', $page); + \Qiniu\setWithoutEmpty($query, 'page_size', $page_size); + + $url = $this->baseURL . 'messages?' . http_build_query($query); + return $this->get($url); + } + + + public function imgToBase64($img_file) + { + $img_base64 = ''; + if (file_exists($img_file)) { + $app_img_file = $img_file; // 图片路径 + $img_info = getimagesize($app_img_file); // 取得图片的大小,类型等 + $fp = fopen($app_img_file, "r"); // 图片是否可读权限 + if ($fp) { + $filesize = filesize($app_img_file); + if ($filesize > 5 * 1024 * 1024) { + die("pic size < 5M !"); + } + $img_type = null; + $content = fread($fp, $filesize); + $file_content = chunk_split(base64_encode($content)); // base64编码 + switch ($img_info[2]) { //判读图片类型 + case 1: + $img_type = 'gif'; + break; + case 2: + $img_type = 'jpg'; + break; + case 3: + $img_type = 'png'; + break; + } + //合成图片的base64编码 + $img_base64 = 'data:image/' . $img_type . ';base64,' . $file_content; + } + fclose($fp); + } + + return $img_base64; + } + + private function get($url, $contentType = 'application/x-www-form-urlencoded') + { + $headers = $this->auth->authorizationV2($url, "GET", null, $contentType); + $headers['Content-Type'] = $contentType; + $ret = Client::get($url, $headers); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + return array($ret->json(), null); + } + + private function delete($url, $contentType = 'application/json') + { + $headers = $this->auth->authorizationV2($url, "DELETE", null, $contentType); + $headers['Content-Type'] = $contentType; + $ret = Client::delete($url, $headers); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + return array($ret->json(), null); + } + + private function post($url, $body, $contentType = 'application/json') + { + $headers = $this->auth->authorizationV2($url, "POST", $body, $contentType); + + $headers['Content-Type'] = $contentType; + $ret = Client::post($url, $body, $headers); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + return array($r, null); + } + + private function PUT($url, $body, $contentType = 'application/json') + { + $headers = $this->auth->authorizationV2($url, "PUT", $body, $contentType); + $headers['Content-Type'] = $contentType; + $ret = Client::put($url, $body, $headers); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + return array($r, null); + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Storage/ArgusManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/ArgusManager.php new file mode 100644 index 0000000..0f2baee --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Storage/ArgusManager.php @@ -0,0 +1,123 @@ +auth = $auth; + if ($config == null) { + $this->config = new Config(); + } else { + $this->config = $config; + } + } + + /** + * 视频审核 + * + * @param string $body body信息 + * + * @return array 成功返回NULL,失败返回对象Qiniu\Http\Error + * @link https://developer.qiniu.com/censor/api/5620/video-censor + */ + public function censorVideo($body) + { + $path = '/v3/video/censor'; + + return $this->arPost($path, $body); + } + + + /** + * 图片审核 + * + * @param string $body + * + * @return array 成功返回NULL,失败返回对象Qiniu\Http\Error + * @link https://developer.qiniu.com/censor/api/5588/image-censor + */ + public function censorImage($body) + { + $path = '/v3/image/censor'; + + return $this->arPost($path, $body); + } + + /** + * 查询视频审核结果 + * + * @param string $jobid 任务ID + * @return array + * @link https://developer.qiniu.com/censor/api/5620/video-censor + */ + public function censorStatus($jobid) + { + $scheme = "http://"; + + if ($this->config->useHTTPS === true) { + $scheme = "https://"; + } + $url = $scheme . Config::ARGUS_HOST . "/v3/jobs/video/$jobid"; + $response = $this->get($url); + if (!$response->ok()) { + print("statusCode: " . $response->statusCode); + return array(null, new Error($url, $response)); + } + return array($response->json(), null); + } + + private function getArHost() + { + $scheme = "http://"; + if ($this->config->useHTTPS === true) { + $scheme = "https://"; + } + return $scheme . Config::ARGUS_HOST; + } + + private function arPost($path, $body = null) + { + $url = $this->getArHost() . $path; + return $this->post($url, $body); + } + + private function get($url) + { + $headers = $this->auth->authorizationV2($url, 'GET'); + + return Client::get($url, $headers); + } + + private function post($url, $body) + { + $headers = $this->auth->authorizationV2($url, 'POST', $body, 'application/json'); + $headers['Content-Type'] = 'application/json'; + $ret = Client::post($url, $body, $headers); + if (!$ret->ok()) { + print("statusCode: " . $ret->statusCode); + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + if (strstr($url, "video")) { + $jobid = $r['job']; + return array($jobid, null); + } + return array($r, null); + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php new file mode 100644 index 0000000..93fa267 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Storage/BucketManager.php @@ -0,0 +1,1110 @@ +auth = $auth; + if ($config == null) { + $this->config = new Config(); + } else { + $this->config = $config; + } + } + + /** + * 获取指定账号下所有的空间名 + * + * @param bool $shared 指定共享空间,rw:读写权限空间,rd:读权限空间 + * @return array 包含所有空间名 + */ + public function buckets($shared = true) + { + $includeShared = "false"; + if ($shared === true) { + $includeShared = "true"; + } + return $this->rsGet('/buckets?shared=' . $includeShared); + } + + /** + * 列举空间,返回bucket列表 + * + * @param string $region 区域 + * @param string $line + * @param string $shared 指定共享空间,rw:读写权限空间,rd:读权限空间 + * @return array + */ + public function listbuckets( + $region = null, + $line = 'false', + $shared = 'false' + ) { + $path = '/v3/buckets?region=' . $region . '&line=' . $line . '&shared=' . $shared; + return $this->ucPost($path); + } + + /** + * 创建空间 + * + * @param string $name 创建的空间名 + * @param string $region 创建的区域,默认华东 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/1382/mkbucketv3 + */ + public function createBucket($name, $region = 'z0') + { + $path = '/mkbucketv3/' . $name . '/region/' . $region; + return $this->rsPost($path, null); + } + + /** + * 删除空间 + * + * @param string $name 需要删除的目标空间名 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/1601/drop-bucket + */ + public function deleteBucket($name) + { + $path = '/drop/' . $name; + return $this->rsPost($path, null); + } + + /** + * 获取指定空间绑定的所有的域名 + * + * @param string $bucket 空间名称 + * @return array + */ + public function domains($bucket) + { + return $this->apiGet('/v6/domain/list?tbl=' . $bucket); + } + + /** + * 获取指定空间的相关信息 + * + * @param string $bucket 空间名称 + * @return array + */ + public function bucketInfo($bucket) + { + $path = '/v2/bucketInfo?bucket=' . $bucket; + return $this->ucPost($path); + } + + /** + * 获取指定zone的空间信息列表 + * + * @param string $region 区域 + * @param string $shared 指定共享空间,rw:读写权限空间,rd:读权限空间 + * @param string $fs 如果为 true,会返回每个空间当前的文件数和存储量(实时数据) + * @return array + */ + public function bucketInfos($region = null, $shared = 'false', $fs = 'false') + { + $path = '/v2/bucketInfos?region=' . $region . '&shared=' . $shared . '&fs=' . $fs; + return $this->ucPost($path); + } + + /** + * 列取空间的文件列表 + * + * @param string $bucket 空间名 + * @param string $prefix 列举前缀 + * @param string $marker 列举标识符 + * @param int $limit 单次列举个数限制 + * @param string $delimiter 指定目录分隔符 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/1284/list + */ + public function listFiles( + $bucket, + $prefix = null, + $marker = null, + $limit = 1000, + $delimiter = null + ) { + $query = array('bucket' => $bucket); + \Qiniu\setWithoutEmpty($query, 'prefix', $prefix); + \Qiniu\setWithoutEmpty($query, 'marker', $marker); + \Qiniu\setWithoutEmpty($query, 'limit', $limit); + \Qiniu\setWithoutEmpty($query, 'delimiter', $delimiter); + $url = $this->getRsfHost() . '/list?' . http_build_query($query); + return $this->getV2($url); + } + + /** + * 列取空间的文件列表 + * + * @param string $bucket 空间名 + * @param string $prefix 列举前缀 + * @param string $marker 列举标识符 + * @param int $limit 单次列举个数限制 + * @param string $delimiter 指定目录分隔符 + * @param bool $skipconfirm 是否跳过已删除条目的确认机制 + * + * @return array + * @link http://developer.qiniu.com/docs/v6/api/reference/rs/list.html + */ + public function listFilesv2( + $bucket, + $prefix = null, + $marker = null, + $limit = 1000, + $delimiter = null, + $skipconfirm = true + ) { + $query = array('bucket' => $bucket); + \Qiniu\setWithoutEmpty($query, 'prefix', $prefix); + \Qiniu\setWithoutEmpty($query, 'marker', $marker); + \Qiniu\setWithoutEmpty($query, 'limit', $limit); + \Qiniu\setWithoutEmpty($query, 'delimiter', $delimiter); + \Qiniu\setWithoutEmpty($query, 'skipconfirm', $skipconfirm); + $path = '/v2/list?' . http_build_query($query); + $url = $this->getRsfHost() . $path; + $headers = $this->auth->authorizationV2($url, 'POST', null, 'application/x-www-form-urlencoded'); + $ret = Client::post($url, null, $headers); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = explode("\n", $ret->body); + array_pop($r); + return array($r, null); + } + + /** + * 增加bucket生命规则 + * + * @param string $bucket 空间名 + * @param string $name 规则名称 bucket 内唯一,长度小于50,不能为空,只能为 + * 字母、数字、下划线 + * @param string $prefix 同一个 bucket 里面前缀不能重复 + * @param int $delete_after_days 指定上传文件多少天后删除,指定为0表示不删除, + * 大于0表示多少天后删除,需大于 to_line_after_days + * @param int $to_line_after_days 指定文件上传多少天后转低频存储。指定为0表示 + * 不转低频存储,小于0表示上传的文件立即变低频存储 + * @param int $to_archive_after_days 指定文件上传多少天后转归档存储。指定为0表示 + * 不转归档存储,小于0表示上传的文件立即变归档存储 + * @param int $to_deep_archive_after_days 指定文件上传多少天后转深度归档存储。指定为0表示 + * 不转深度归档存储,小于0表示上传的文件立即变深度归档存储 + * @return array + */ + public function bucketLifecycleRule( + $bucket, + $name, + $prefix, + $delete_after_days = null, + $to_line_after_days = null, + $to_archive_after_days = null, + $to_deep_archive_after_days = null + ) { + $path = '/rules/add'; + $params = array(); + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + if ($prefix) { + $params['prefix'] = $prefix; + } + if ($delete_after_days) { + $params['delete_after_days'] = $delete_after_days; + } + if ($to_line_after_days) { + $params['to_line_after_days'] = $to_line_after_days; + } + if ($to_archive_after_days) { + $params['to_archive_after_days'] = $to_archive_after_days; + } + if ($to_deep_archive_after_days) { + $params['to_deep_archive_after_days'] = $to_deep_archive_after_days; + } + $data = http_build_query($params); + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 更新bucket生命规则 + * + * @param string $bucket 空间名 + * @param string $name 规则名称 bucket 内唯一,长度小于50,不能为空,只能为字母、 + * 数字、下划线 + * @param string $prefix 同一个 bucket 里面前缀不能重复 + * @param int $delete_after_days 指定上传文件多少天后删除,指定为0表示不删除, + * 大于0表示多少天后删除,需大于 to_line_after_days + * @param int $to_line_after_days 指定文件上传多少天后转低频存储。指定为0表示不 + * 转低频存储,小于0表示上传的文件立即变低频存储 + * @param int $to_archive_after_days 指定文件上传多少天后转归档存储。指定为0表示 + * 不转归档存储,小于0表示上传的文件立即变归档存储 + * @param int $to_deep_archive_after_days 指定文件上传多少天后转深度归档存储。指定为0表示 + * 不转深度归档存储,小于0表示上传的文件立即变深度归档存储 + * @return array + */ + public function updateBucketLifecycleRule( + $bucket, + $name, + $prefix, + $delete_after_days = null, + $to_line_after_days = null, + $to_archive_after_days = null, + $to_deep_archive_after_days = null + ) { + $path = '/rules/update'; + $params = array(); + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + if ($prefix) { + $params['prefix'] = $prefix; + } + if ($delete_after_days) { + $params['delete_after_days'] = $delete_after_days; + } + if ($to_line_after_days) { + $params['to_line_after_days'] = $to_line_after_days; + } + if ($to_archive_after_days) { + $params['to_archive_after_days'] = $to_archive_after_days; + } + if ($to_deep_archive_after_days) { + $params['to_deep_archive_after_days'] = $to_deep_archive_after_days; + } + $data = http_build_query($params); + return $this->ucPost($path, $data); + } + + /** + * 获取bucket生命规则 + * + * @param string $bucket 空间名 + * @return array + */ + public function getBucketLifecycleRules($bucket) + { + $path = '/rules/get?bucket=' . $bucket; + $info = $this->ucGet($path); + return $info; + } + + /** + * 删除bucket生命规则 + * + * @param string $bucket 空间名 + * @param string $name 规则名称 bucket 内唯一,长度小于50,不能为空, + * 只能为字母、数字、下划线() + * @return array + */ + public function deleteBucketLifecycleRule($bucket, $name) + { + $path = '/rules/delete'; + $params = array(); + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + $data = http_build_query($params); + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 增加bucket事件通知规则 + * + * @param string $bucket 空间名 + * @param string $name 规则名称 bucket 内唯一,长度小于50,不能为空, + * 只能为字母、数字、下划线() + * @param string $prefix 同一个 bucket 里面前缀不能重复 + * @param string $suffix 可选,文件配置的后缀 + * @param array $event 事件类型,可以指定多个,包括 put,mkfile,delete,copy,move,append, + * disable,enable,deleteMarkerCreate + * @param string $callbackURL 通知URL,可以指定多个,失败依次重试 + * @param string $access_key 可选,设置的话会对通知请求用对应的ak、sk进行签名 + * @param string $host 可选,通知请求的host + * + * @return array + */ + public function putBucketEvent( + $bucket, + $name, + $prefix, + $suffix, + $event, + $callbackURL, + $access_key = null, + $host = null + ) { + $path = '/events/add'; + $params = array(); + if (!empty($bucket)) { + $params['bucket'] = $bucket; + } + if (!empty($name)) { + $params['name'] = $name; + } + if (!empty($prefix)) { + $params['prefix'] = $prefix; + } + if (!empty($suffix)) { + $params['suffix'] = $suffix; + } + if (!empty($callbackURL)) { + $params['callbackURL'] = $callbackURL; + } + if (!empty($access_key)) { + $params['access_key'] = $access_key; + } + if (!empty($host)) { + $params['host'] = $host; + } + $data = http_build_query($params); + if (!empty($event)) { + $eventpath = ""; + foreach ($event as $key => $value) { + $eventpath .= "&event=$value"; + } + $data .= $eventpath; + } + $info = $this->ucPost($path, $data); + return $info; + } + + /** + * 更新bucket事件通知规则 + * + * @param string $bucket 空间名 + * @param string $name 规则名称 bucket 内唯一,长度小于50,不能为空, + * 只能为字母、数字、下划线() + * @param string $prefix 同一个 bucket 里面前缀不能重复 + * @param string $suffix 可选,文件配置的后缀 + * @param array $event 事件类型,可以指定多个,包括 put,mkfile,delete,copy,move,append,disable, + * enable,deleteMarkerCreate + * @param string $callbackURL 通知URL,可以指定多个,失败依次重试 + * @param string $access_key 可选,设置的话会对通知请求用对应的ak、sk进行签名 + * @param string $host 可选,通知请求的host + * + * @return array + */ + public function updateBucketEvent( + $bucket, + $name, + $prefix, + $suffix, + $event, + $callbackURL, + $access_key = null, + $host = null + ) { + $path = '/events/update'; + $params = array(); + if (!empty($bucket)) { + $params['bucket'] = $bucket; + } + if (!empty($name)) { + $params['name'] = $name; + } + if (!empty($prefix)) { + $params['prefix'] = $prefix; + } + if ($suffix) { + $params['suffix'] = $suffix; + } + if (!empty($event)) { + $params['event'] = $event; + } + if (!empty($callbackURL)) { + $params['callbackURL'] = $callbackURL; + } + if (!empty($access_key)) { + $params['access_key'] = $access_key; + } + if (!empty($host)) { + $params['host'] = $host; + } + $data = http_build_query($params); + if (!empty($event)) { + $eventpath = ""; + foreach ($event as $key => $value) { + $eventpath .= "&event=$value"; + } + $data .= $eventpath; + } + return $this->ucPost($path, $data); + } + + /** + * 获取bucket事件通知规则 + * + * @param string $bucket 空间名 + * @return array + */ + public function getBucketEvents($bucket) + { + $path = '/events/get?bucket=' . $bucket; + return $this->ucGet($path); + } + + /** + * 删除bucket事件通知规则 + * + * @param string $bucket 空间名 + * @param string $name 规则名称bucket内唯一,长度小于50,不能为空,只能为字母、数字、下划线 + * @return array + */ + public function deleteBucketEvent($bucket, $name) + { + $path = '/events/delete'; + $params = array(); + if ($bucket) { + $params['bucket'] = $bucket; + } + if ($name) { + $params['name'] = $name; + } + $data = http_build_query($params); + return $this->ucPost($path, $data); + } + + /** + * 获取bucket的跨域信息 + * + * @param string $bucket 空间名 + * @return array + */ + public function getCorsRules($bucket) + { + $path = '/corsRules/get/' . $bucket; + return $this->ucGet($path); + } + + /** + * 开关原图保护 + * + * @param string $bucket 空间名称 + * @param int $mode mode 为1表示开启原图保护,0表示关闭 + * @return array + */ + public function putBucketAccessStyleMode($bucket, $mode) + { + $path = '/accessMode/' . $bucket . '/mode/' . $mode; + return $this->ucPost($path, null); + } + + /** + * 设置私有属性 + * + * @param string $bucket 空间名称 + * @param int $private private为0表示公开,为1表示私有 + * @return array + */ + public function putBucketAccessMode($bucket, $private) + { + $path = "/private?bucket=$bucket&private=$private"; + return $this->ucPost($path, null); + } + + /** + * 设置 referer 防盗链 + * + * @param string $bucket 空间名称 + * @param int $mode 0:关闭Referer(使用此选项将会忽略以下参数并将恢复默认值); + * 1:设置Referer白名单; 2:设置Referer黑名单 + * @param string $norefer 0:不允许空 Refer 访问; 1:表示允许空Refer访问 + * @param string $pattern 规则字符串 + * @param int $enabled 源站是否支持,默认为0只给CDN配置, 设置为1表示开启源站防盗链 + * @return array + * @link https://developer.qiniu.com/kodo/manual/6093/set-the-hotlinking-prevention + */ + public function putReferAntiLeech($bucket, $mode, $norefer, $pattern, $enabled = 1) + { + $path = "/referAntiLeech?bucket=$bucket&mode=$mode&norefer=$norefer&pattern=$pattern&source_enabled=$enabled"; + return $this->ucPost($path, null); + } + + /** + * 设置Bucket的maxAge + * + * @param string $bucket 空间名称 + * @param int $maxAge maxAge为0或者负数表示为默认值(31536000) + * @return array + */ + public function putBucketMaxAge($bucket, $maxAge) + { + $path = '/maxAge?bucket=' . $bucket . '&maxAge=' . $maxAge; + return $this->ucPost($path, null); + } + + /** + * 设置空间配额 + * + * @param string $bucket 空间名称,不支持授权空间 + * @param string $size 空间存储量配额,参数传入0或不传表示不更改当前配置,传入-1表示取消限额,新创建的空间默认没有限额 + * @param string $count 空间文件数配额,参数含义同 + * @return array + */ + public function putBucketQuota($bucket, $size, $count) + { + $path = '/setbucketquota/' . $bucket . '/size/' . $size . '/count/' . $count; + return $this->apiPost($path, null); + } + + /** + * 获取空间配额 + * + * @param string $bucket 空间名称 + * @return array + */ + public function getBucketQuota($bucket) + { + $path = '/getbucketquota/' . $bucket; + return $this->apiPost($path, null); + } + + /** + * 获取资源的元信息,但不返回文件内容 + * + * @param string $bucket 待获取信息资源所在的空间 + * @param string $key 待获取资源的文件名 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/1308/stat + */ + public function stat($bucket, $key) + { + $path = '/stat/' . \Qiniu\entry($bucket, $key); + return $this->rsGet($path); + } + + /** + * 删除指定资源 + * + * @param string $bucket 待删除资源所在的空间 + * @param string $key 待删除资源的文件名 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/1257/delete + */ + public function delete($bucket, $key) + { + $path = '/delete/' . \Qiniu\entry($bucket, $key); + return $this->rsPost($path); + } + + /** + * 给资源进行重命名,本质为move操作。 + * + * @param string $bucket 待操作资源所在空间 + * @param string $oldname 待操作资源文件名 + * @param string $newname 目标资源文件名 + * + * @return array + */ + public function rename($bucket, $oldname, $newname) + { + return $this->move($bucket, $oldname, $bucket, $newname); + } + + /** + * 对资源进行复制。 + * + * @param string $from_bucket 待操作资源所在空间 + * @param string $from_key 待操作资源文件名 + * @param string $to_bucket 目标资源空间名 + * @param string $to_key 目标资源文件名 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/1254/copy + */ + public function copy($from_bucket, $from_key, $to_bucket, $to_key, $force = false) + { + $from = \Qiniu\entry($from_bucket, $from_key); + $to = \Qiniu\entry($to_bucket, $to_key); + $path = '/copy/' . $from . '/' . $to; + if ($force === true) { + $path .= '/force/true'; + } + return $this->rsPost($path); + } + + /** + * 将资源从一个空间到另一个空间 + * + * @param string $from_bucket 待操作资源所在空间 + * @param string $from_key 待操作资源文件名 + * @param string $to_bucket 目标资源空间名 + * @param string $to_key 目标资源文件名 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/1288/move + */ + public function move($from_bucket, $from_key, $to_bucket, $to_key, $force = false) + { + $from = \Qiniu\entry($from_bucket, $from_key); + $to = \Qiniu\entry($to_bucket, $to_key); + $path = '/move/' . $from . '/' . $to; + if ($force) { + $path .= '/force/true'; + } + return $this->rsPost($path); + } + + /** + * 主动修改指定资源的文件元信息 + * + * @param string $bucket 待操作资源所在空间 + * @param string $key 待操作资源文件名 + * @param string $mime 待操作文件目标mimeType + * + * @return array + * @link https://developer.qiniu.com/kodo/api/1252/chgm + */ + public function changeMime($bucket, $key, $mime) + { + $resource = \Qiniu\entry($bucket, $key); + $encode_mime = \Qiniu\base64_urlSafeEncode($mime); + $path = '/chgm/' . $resource . '/mime/' . $encode_mime; + return $this->rsPost($path); + } + + + /** + * 修改指定资源的存储类型 + * + * @param string $bucket 待操作资源所在空间 + * @param string $key 待操作资源文件名 + * @param int $fileType 0 表示标准存储;1 表示低频存储;2 表示归档存储;3 表示深度归档存储 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/3710/chtype + */ + public function changeType($bucket, $key, $fileType) + { + $resource = \Qiniu\entry($bucket, $key); + $path = '/chtype/' . $resource . '/type/' . $fileType; + return $this->rsPost($path); + } + + /** + * 解冻指定资源的存储类型 + * + * @param string $bucket 待操作资源所在空间 + * @param string $key 待操作资源文件名 + * @param int $freezeAfterDays 解冻有效时长,取值范围 1~7 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/6380/restore-archive + */ + public function restoreAr($bucket, $key, $freezeAfterDays) + { + $resource = \Qiniu\entry($bucket, $key); + $path = '/restoreAr/' . $resource . '/freezeAfterDays/' . $freezeAfterDays; + return $this->rsPost($path); + } + + /** + * 修改文件的存储状态,即禁用状态和启用状态间的的互相转换 + * + * @param string $bucket 待操作资源所在空间 + * @param string $key 待操作资源文件名 + * @param int $status 0表示启用;1表示禁用 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/4173/modify-the-file-status + */ + public function changeStatus($bucket, $key, $status) + { + $resource = \Qiniu\entry($bucket, $key); + $path = '/chstatus/' . $resource . '/status/' . $status; + return $this->rsPost($path); + } + + /** + * 从指定URL抓取资源,并将该资源存储到指定空间中 + * + * @param string $url 指定的URL + * @param string $bucket 目标资源空间 + * @param string $key 目标资源文件名 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/1263/fetch + */ + public function fetch($url, $bucket, $key = null) + { + + $resource = \Qiniu\base64_urlSafeEncode($url); + $to = \Qiniu\entry($bucket, $key); + $path = '/fetch/' . $resource . '/to/' . $to; + + $ak = $this->auth->getAccessKey(); + try { + $ioHost = $this->config->getIovipHost($ak, $bucket); + } catch (\Exception $err) { + return array(null, $err); + } + + $url = $ioHost . $path; + return $this->postV2($url, null); + } + + /** + * 从指定URL异步抓取资源,并将该资源存储到指定空间中 + * + * @param string $url 需要抓取的url + * @param string $bucket 所在区域的bucket + * @param string $host 从指定url下载数据时使用的Host + * @param string $key 文件存储的key + * @param string $md5 文件md5 + * @param string $etag 文件etag + * @param string $callbackurl 回调URL + * @param string $callbackbody 回调Body + * @param string $callbackbodytype 回调Body内容类型,默认为"application/x-www-form-urlencoded" + * @param string $callbackhost 回调时使用的Host + * @param int $file_type 存储文件类型 0:标准存储(默认),1:低频存储,2:归档存储 + * @param bool $ignore_same_key 如果空间中已经存在同名文件则放弃本次抓取 + * @return array + * @link https://developer.qiniu.com/kodo/api/4097/asynch-fetch + */ + public function asynchFetch( + $url, + $bucket, + $host = null, + $key = null, + $md5 = null, + $etag = null, + $callbackurl = null, + $callbackbody = null, + $callbackbodytype = 'application/x-www-form-urlencoded', + $callbackhost = null, + $file_type = 0, + $ignore_same_key = false + ) { + $path = '/sisyphus/fetch'; + + $params = array('url' => $url, 'bucket' => $bucket); + \Qiniu\setWithoutEmpty($params, 'host', $host); + \Qiniu\setWithoutEmpty($params, 'key', $key); + \Qiniu\setWithoutEmpty($params, 'md5', $md5); + \Qiniu\setWithoutEmpty($params, 'etag', $etag); + \Qiniu\setWithoutEmpty($params, 'callbackurl', $callbackurl); + \Qiniu\setWithoutEmpty($params, 'callbackbody', $callbackbody); + \Qiniu\setWithoutEmpty($params, 'callbackbodytype', $callbackbodytype); + \Qiniu\setWithoutEmpty($params, 'callbackhost', $callbackhost); + \Qiniu\setWithoutEmpty($params, 'file_type', $file_type); + \Qiniu\setWithoutEmpty($params, 'ignore_same_key', $ignore_same_key); + $data = json_encode($params); + + $ak = $this->auth->getAccessKey(); + try { + $apiHost = $this->config->getApiHost($ak, $bucket); + } catch (\Exception $err) { + return array(null, $err); + } + $url = $apiHost . $path; + + return $this->postV2($url, $data); + } + + + /** + * 查询异步第三方资源抓取任务状态 + * + * @param string $zone + * @param string $id + * @return array + * @link https://developer.qiniu.com/kodo/api/4097/asynch-fetch + */ + public function asynchFetchStatus($zone, $id) + { + $scheme = "http://"; + + if ($this->config->useHTTPS === true) { + $scheme = "https://"; + } + + $url = $scheme . "api-" . $zone . ".qiniu.com/sisyphus/fetch?id=" . $id; + + list($ret, $err) = $this->getV2($url); + + if ($err != null) { + return array(null, $err); + } + return array($ret, null); + } + + + /** + * 从镜像源站抓取资源到空间中,如果空间中已经存在,则覆盖该资源 + * + * @param string $bucket 待获取资源所在的空间 + * @param string $key 代获取资源文件名 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/1293/prefetch + */ + public function prefetch($bucket, $key) + { + $resource = \Qiniu\entry($bucket, $key); + $path = '/prefetch/' . $resource; + + $ak = $this->auth->getAccessKey(); + try { + $ioHost = $this->config->getIovipHost($ak, $bucket); + } catch (\Exception $err) { + return array(null, $err); + } + + $url = $ioHost . $path; + return $this->postV2($url, null); + } + + /** + * 在单次请求中进行多个资源管理操作 + * + * @param array $operations 资源管理操作数组 + * + * @return array 每个资源的处理情况,结果类似: + * [ + * { "code" => , "data" => }, + * { "code" => }, + * { "code" => }, + * { "code" => }, + * { "code" => , "data" => { "error": "" } }, + * ... + * ] + * @link http://developer.qiniu.com/docs/v6/api/reference/rs/batch.html + */ + public function batch($operations) + { + $params = 'op=' . implode('&op=', $operations); + return $this->rsPost('/batch', $params); + } + + /** + * 设置文件的生命周期 + * + * @param string $bucket 设置文件生命周期文件所在的空间 + * @param string $key 设置文件生命周期文件的文件名 + * @param int $days 设置该文件多少天后删除,当$days设置为0时表示取消该文件的生命周期 + * + * @return array + * @link https://developer.qiniu.com/kodo/api/update-file-lifecycle + */ + public function deleteAfterDays($bucket, $key, $days) + { + $entry = \Qiniu\entry($bucket, $key); + $path = "/deleteAfterDays/$entry/$days"; + return $this->rsPost($path); + } + + private function getRsfHost() + { + $scheme = "http://"; + if ($this->config->useHTTPS === true) { + $scheme = "https://"; + } + return $scheme . Config::RSF_HOST; + } + + private function getRsHost() + { + $scheme = "http://"; + if ($this->config->useHTTPS === true) { + $scheme = "https://"; + } + return $scheme . Config::RS_HOST; + } + + private function getApiHost() + { + $scheme = "http://"; + if ($this->config->useHTTPS === true) { + $scheme = "https://"; + } + return $scheme . Config::API_HOST; + } + + private function getUcHost() + { + $scheme = "http://"; + if ($this->config->useHTTPS === true) { + $scheme = "https://"; + } + return $scheme . Config::UC_HOST; + } + + private function rsPost($path, $body = null) + { + $url = $this->getRsHost() . $path; + return $this->postV2($url, $body); + } + + private function apiPost($path, $body = null) + { + $url = $this->getApiHost() . $path; + return $this->postV2($url, $body); + } + + private function ucPost($path, $body = null) + { + $url = $this->getUcHost() . $path; + return $this->postV2($url, $body); + } + + private function ucGet($path) + { + $url = $this->getUcHost() . $path; + return $this->getV2($url); + } + + private function apiGet($path) + { + $url = $this->getApiHost() . $path; + return $this->getV2($url); + } + + private function rsGet($path) + { + $url = $this->getRsHost() . $path; + return $this->getV2($url); + } + + private function getV2($url) + { + $headers = $this->auth->authorizationV2($url, 'GET', null, 'application/x-www-form-urlencoded'); + $ret = Client::get($url, $headers); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + return array($ret->json(), null); + } + + private function postV2($url, $body) + { + $headers = $this->auth->authorizationV2($url, 'POST', $body, 'application/x-www-form-urlencoded'); + $ret = Client::post($url, $body, $headers); + if (!$ret->ok()) { + return array(null, new Error($url, $ret)); + } + $r = ($ret->body === null) ? array() : $ret->json(); + return array($r, null); + } + + public static function buildBatchCopy($source_bucket, $key_pairs, $target_bucket, $force) + { + return self::twoKeyBatch('/copy', $source_bucket, $key_pairs, $target_bucket, $force); + } + + + public static function buildBatchRename($bucket, $key_pairs, $force) + { + return self::buildBatchMove($bucket, $key_pairs, $bucket, $force); + } + + + public static function buildBatchMove($source_bucket, $key_pairs, $target_bucket, $force) + { + return self::twoKeyBatch('/move', $source_bucket, $key_pairs, $target_bucket, $force); + } + + + public static function buildBatchDelete($bucket, $keys) + { + return self::oneKeyBatch('/delete', $bucket, $keys); + } + + + public static function buildBatchStat($bucket, $keys) + { + return self::oneKeyBatch('/stat', $bucket, $keys); + } + + public static function buildBatchDeleteAfterDays($bucket, $key_day_pairs) + { + $data = array(); + foreach ($key_day_pairs as $key => $day) { + array_push($data, '/deleteAfterDays/' . \Qiniu\entry($bucket, $key) . '/' . $day); + } + return $data; + } + + public static function buildBatchChangeMime($bucket, $key_mime_pairs) + { + $data = array(); + foreach ($key_mime_pairs as $key => $mime) { + array_push($data, '/chgm/' . \Qiniu\entry($bucket, $key) . '/mime/' . base64_encode($mime)); + } + return $data; + } + + public static function buildBatchChangeType($bucket, $key_type_pairs) + { + $data = array(); + foreach ($key_type_pairs as $key => $type) { + array_push($data, '/chtype/' . \Qiniu\entry($bucket, $key) . '/type/' . $type); + } + return $data; + } + + public static function buildBatchRestoreAr($bucket, $key_restore_days_pairs) + { + $data = array(); + foreach ($key_restore_days_pairs as $key => $restore_days) { + array_push($data, '/restoreAr/' . \Qiniu\entry($bucket, $key) . '/freezeAfterDays/' . $restore_days); + } + return $data; + } + + private static function oneKeyBatch($operation, $bucket, $keys) + { + $data = array(); + foreach ($keys as $key) { + array_push($data, $operation . '/' . \Qiniu\entry($bucket, $key)); + } + return $data; + } + + private static function twoKeyBatch($operation, $source_bucket, $key_pairs, $target_bucket, $force) + { + if ($target_bucket === null) { + $target_bucket = $source_bucket; + } + $data = array(); + $forceOp = "false"; + if ($force) { + $forceOp = "true"; + } + foreach ($key_pairs as $from_key => $to_key) { + $from = \Qiniu\entry($source_bucket, $from_key); + $to = \Qiniu\entry($target_bucket, $to_key); + array_push($data, $operation . '/' . $from . '/' . $to . "/force/" . $forceOp); + } + return $data; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php new file mode 100644 index 0000000..453cc38 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Storage/FormUploader.php @@ -0,0 +1,149 @@ + "", + * "key" => "" + * ] + */ + public static function put( + $upToken, + $key, + $data, + $config, + $params, + $mime, + $fname + ) { + $fields = array('token' => $upToken); + if ($key === null) { + } else { + $fields['key'] = $key; + } + + //enable crc32 check by default + $fields['crc32'] = \Qiniu\crc32_data($data); + + if ($params) { + foreach ($params as $k => $v) { + $fields[$k] = $v; + } + } + + list($accessKey, $bucket, $err) = \Qiniu\explodeUpToken($upToken); + if ($err != null) { + return array(null, $err); + } + + try { + $upHost = $config->getUpHost($accessKey, $bucket); + } catch (\Exception $err) { + return array(null, $err); + } + + $response = Client::multipartPost($upHost, $fields, 'file', $fname, $data, $mime); + if (!$response->ok()) { + return array(null, new Error($upHost, $response)); + } + return array($response->json(), null); + } + + /** + * 上传文件到七牛,内部使用 + * + * @param string $upToken 上传凭证 + * @param string $key 上传文件名 + * @param string $filePath 上传文件的路径 + * @param Config $config 上传配置 + * @param string $params 自定义变量,规格参考 + * https://developer.qiniu.com/kodo/manual/1235/vars#xvar + * @param string $mime 上传数据的mimeType + * + * @return array 包含已上传文件的信息,类似: + * [ + * "hash" => "", + * "key" => "" + * ] + */ + public static function putFile( + $upToken, + $key, + $filePath, + $config, + $params, + $mime + ) { + + + $fields = array('token' => $upToken, 'file' => self::createFile($filePath, $mime)); + if ($key !== null) { + $fields['key'] = $key; + } + + $fields['crc32'] = \Qiniu\crc32_file($filePath); + + if ($params) { + foreach ($params as $k => $v) { + $fields[$k] = $v; + } + } + $fields['key'] = $key; + $headers = array('Content-Type' => 'multipart/form-data'); + + list($accessKey, $bucket, $err) = \Qiniu\explodeUpToken($upToken); + if ($err != null) { + return array(null, $err); + } + + try { + $upHost = $config->getUpHost($accessKey, $bucket); + } catch (\Exception $err) { + return array(null, $err); + } + + $response = Client::post($upHost, $fields, $headers); + if (!$response->ok()) { + return array(null, new Error($upHost, $response)); + } + return array($response->json(), null); + } + + private static function createFile($filename, $mime) + { + // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax + // See: https://wiki.php.net/rfc/curl-file-upload + if (function_exists('curl_file_create')) { + return curl_file_create($filename, $mime); + } + + // Use the old style if using an older version of PHP + $value = "@{$filename}"; + if (!empty($mime)) { + $value .= ';type=' . $mime; + } + + return $value; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Storage/ResumeUploader.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/ResumeUploader.php new file mode 100644 index 0000000..eedc9af --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Storage/ResumeUploader.php @@ -0,0 +1,422 @@ +upToken = $upToken; + $this->key = $key; + $this->inputStream = $inputStream; + $this->size = $size; + $this->params = $params; + $this->mime = $mime; + $this->contexts = array(); + $this->finishedEtags = array("etags"=>array(), "uploadId"=>"", "expiredAt"=>0, "uploaded"=>0); + $this->config = $config; + $this->resumeRecordFile = $resumeRecordFile ? $resumeRecordFile : null; + $this->partSize = $partSize ? $partSize : config::BLOCK_SIZE; + + try { + $this->version = SplitUploadVersion::from($version ? $version : 'v1'); + } catch (\Exception $e) { + throw new \Exception("only support v1/v2 now!", 0, $e); + } + + list($accessKey, $bucket, $err) = \Qiniu\explodeUpToken($upToken); + $this->bucket = $bucket; + if ($err != null) { + return array(null, $err); + } + + $upHost = $config->getUpHost($accessKey, $bucket); + if ($err != null) { + throw new \Exception($err->message(), 1); + } + $this->host = $upHost; + } + + /** + * 上传操作 + */ + public function upload($fname) + { + $uploaded = 0; + if ($this->version == SplitUploadVersion::V2) { + $partNumber = 1; + $encodedObjectName = $this->key? \Qiniu\base64_urlSafeEncode($this->key) : '~'; + }; + // get upload record from resumeRecordFile + if ($this->resumeRecordFile != null) { + $blkputRets = null; + if (file_exists($this->resumeRecordFile)) { + $stream = fopen($this->resumeRecordFile, 'r'); + if ($stream) { + $streamLen = filesize($this->resumeRecordFile); + if ($streamLen > 0) { + $contents = fread($stream, $streamLen); + fclose($stream); + if ($contents) { + $blkputRets = json_decode($contents, true); + if ($blkputRets === null) { + error_log("resumeFile contents decode error"); + } + } else { + error_log("read resumeFile failed"); + } + } else { + error_log("resumeFile is empty"); + } + } else { + error_log("resumeFile open failed"); + } + } else { + error_log("resumeFile not exists"); + } + + if ($blkputRets) { + if ($this->version == SplitUploadVersion::V1) { + if (isset($blkputRets['contexts']) && isset($blkputRets['uploaded']) && + is_array($blkputRets['contexts']) && is_int($blkputRets['uploaded'])) { + $this->contexts = $blkputRets['contexts']; + $uploaded = $blkputRets['uploaded']; + } + } elseif ($this->version == SplitUploadVersion::V2) { + if (isset($blkputRets["etags"]) && isset($blkputRets["uploadId"]) && + isset($blkputRets["expiredAt"]) && $blkputRets["expiredAt"] > time() + && $blkputRets["uploaded"] > 0 && is_array($blkputRets["etags"]) && + is_string($blkputRets["uploadId"]) && is_int($blkputRets["expiredAt"])) { + $this->finishedEtags['etags'] = $blkputRets["etags"]; + $this->finishedEtags["uploadId"] = $blkputRets["uploadId"]; + $this->finishedEtags["expiredAt"] = $blkputRets["expiredAt"]; + $this->finishedEtags["uploaded"] = $blkputRets["uploaded"]; + $uploaded = $blkputRets["uploaded"]; + $partNumber = count($this->finishedEtags["etags"]) + 1; + } else { + $this->makeInitReq($encodedObjectName); + } + } else { + throw new \Exception("only support v1/v2 now!"); + } + } else { + if ($this->version == SplitUploadVersion::V2) { + $this->makeInitReq($encodedObjectName); + } + } + } else { + // init a Multipart Upload task if choose v2 + if ($this->version == SplitUploadVersion::V2) { + $this->makeInitReq($encodedObjectName); + } + } + + while ($uploaded < $this->size) { + $blockSize = $this->blockSize($uploaded); + $data = fread($this->inputStream, $blockSize); + if ($data === false) { + throw new \Exception("file read failed", 1); + } + if ($this->version == SplitUploadVersion::V1) { + $crc = \Qiniu\crc32_data($data); + $response = $this->makeBlock($data, $blockSize); + } elseif ($this->version == SplitUploadVersion::V2) { + $md5 = md5($data); + $response = $this->uploadPart( + $data, + $partNumber, + $this->finishedEtags["uploadId"], + $encodedObjectName, + $md5 + ); + } else { + throw new \Exception("only support v1/v2 now!"); + } + + $ret = null; + if ($response->ok() && $response->json() != null) { + $ret = $response->json(); + } + if ($response->statusCode < 0) { + list($accessKey, $bucket, $err) = \Qiniu\explodeUpToken($this->upToken); + if ($err != null) { + return array(null, $err); + } + $upHostBackup = $this->config->getUpBackupHost($accessKey, $bucket); + $this->host = $upHostBackup; + } + + if ($this->version == SplitUploadVersion::V1) { + if ($response->needRetry() || !isset($ret['crc32']) || $crc != $ret['crc32']) { + $response = $this->makeBlock($data, $blockSize); + $ret = $response->json(); + } + + if (!$response->ok() || !isset($ret['crc32']) || $crc != $ret['crc32']) { + return array(null, new Error($this->currentUrl, $response)); + } + array_push($this->contexts, $ret['ctx']); + } elseif ($this->version == SplitUploadVersion::V2) { + if ($response->needRetry() || !isset($ret['md5']) || $md5 != $ret['md5']) { + $response = $this->uploadPart( + $data, + $partNumber, + $this->finishedEtags["uploadId"], + $encodedObjectName, + $md5 + ); + $ret = $response->json(); + } + + if (!$response->ok() || !isset($ret['md5']) || $md5 != $ret['md5']) { + return array(null, new Error($this->currentUrl, $response)); + } + $blockStatus = array('etag' => $ret['etag'], 'partNumber' => $partNumber); + array_push($this->finishedEtags['etags'], $blockStatus); + $partNumber += 1; + } else { + throw new \Exception("only support v1/v2 now!"); + } + + $uploaded += $blockSize; + if ($this->version == SplitUploadVersion::V2) { + $this->finishedEtags['uploaded'] = $uploaded; + } + + if ($this->resumeRecordFile !== null) { + if ($this->version == SplitUploadVersion::V1) { + $recordData = array( + 'contexts' => $this->contexts, + 'uploaded' => $uploaded + ); + $recordData = json_encode($recordData); + } elseif ($this->version == SplitUploadVersion::V2) { + $recordData = json_encode($this->finishedEtags); + } else { + throw new \Exception("only support v1/v2 now!"); + } + if ($recordData) { + $isWritten = file_put_contents($this->resumeRecordFile, $recordData); + if ($isWritten === false) { + error_log("write resumeRecordFile failed"); + } + } else { + error_log('resumeRecordData encode failed'); + } + } + } + if ($this->version == SplitUploadVersion::V1) { + return $this->makeFile($fname); + } elseif ($this->version == SplitUploadVersion::V2) { + return $this->completeParts($fname, $this->finishedEtags['uploadId'], $encodedObjectName); + } else { + throw new \Exception("only support v1/v2 now!"); + } + } + + /** + * 创建块 + */ + private function makeBlock($block, $blockSize) + { + $url = $this->host . '/mkblk/' . $blockSize; + return $this->post($url, $block); + } + + private function fileUrl($fname) + { + $url = $this->host . '/mkfile/' . $this->size; + $url .= '/mimeType/' . \Qiniu\base64_urlSafeEncode($this->mime); + if ($this->key != null) { + $url .= '/key/' . \Qiniu\base64_urlSafeEncode($this->key); + } + $url .= '/fname/' . \Qiniu\base64_urlSafeEncode($fname); + if (!empty($this->params)) { + foreach ($this->params as $key => $value) { + $val = \Qiniu\base64_urlSafeEncode($value); + $url .= "/$key/$val"; + } + } + return $url; + } + + /** + * 创建文件 + */ + private function makeFile($fname) + { + $url = $this->fileUrl($fname); + $body = implode(',', $this->contexts); + $response = $this->post($url, $body); + if ($response->needRetry()) { + $response = $this->post($url, $body); + } + if (!$response->ok()) { + return array(null, new Error($this->currentUrl, $response)); + } + return array($response->json(), null); + } + + private function post($url, $data) + { + $this->currentUrl = $url; + $headers = array('Authorization' => 'UpToken ' . $this->upToken); + return Client::post($url, $data, $headers); + } + + private function blockSize($uploaded) + { + if ($this->size < $uploaded + $this->partSize) { + return $this->size - $uploaded; + } + return $this->partSize; + } + + private function makeInitReq($encodedObjectName) + { + $res = $this->initReq($encodedObjectName); + $this->finishedEtags["uploadId"] = $res['uploadId']; + $this->finishedEtags["expiredAt"] = $res['expireAt']; + } + + /** + * 初始化上传任务 + */ + private function initReq($encodedObjectName) + { + $url = $this->host.'/buckets/'.$this->bucket.'/objects/'.$encodedObjectName.'/uploads'; + $headers = array( + 'Authorization' => 'UpToken ' . $this->upToken, + 'Content-Type' => 'application/json' + ); + $response = $this->postWithHeaders($url, null, $headers); + return $response->json(); + } + + /** + * 分块上传v2 + */ + private function uploadPart($block, $partNumber, $uploadId, $encodedObjectName, $md5) + { + $headers = array( + 'Authorization' => 'UpToken ' . $this->upToken, + 'Content-Type' => 'application/octet-stream', + 'Content-MD5' => $md5 + ); + $url = $this->host.'/buckets/'.$this->bucket.'/objects/'.$encodedObjectName. + '/uploads/'.$uploadId.'/'.$partNumber; + $response = $this->put($url, $block, $headers); + return $response; + } + + private function completeParts($fname, $uploadId, $encodedObjectName) + { + $headers = array( + 'Authorization' => 'UpToken '.$this->upToken, + 'Content-Type' => 'application/json' + ); + $etags = $this->finishedEtags['etags']; + $sortedEtags = \Qiniu\arraySort($etags, 'partNumber'); + $metadata = array(); + $customVars = array(); + if ($this->params) { + foreach ($this->params as $k => $v) { + if (strpos($k, 'x:') === 0) { + $customVars[$k] = $v; + } elseif (strpos($k, 'x-qn-meta-') === 0) { + $metadata[$k] = $v; + } + } + } + if (empty($metadata)) { + $metadata = null; + } + if (empty($customVars)) { + $customVars = null; + } + $body = array( + 'fname' => $fname, + 'mimeType' => $this->mime, + 'metadata' => $metadata, + 'customVars' => $customVars, + 'parts' => $sortedEtags + ); + $jsonBody = json_encode($body); + $url = $this->host.'/buckets/'.$this->bucket.'/objects/'.$encodedObjectName.'/uploads/'.$uploadId; + $response = $this->postWithHeaders($url, $jsonBody, $headers); + if ($response->needRetry()) { + $response = $this->postWithHeaders($url, $jsonBody, $headers); + } + if (!$response->ok()) { + return array(null, new Error($this->currentUrl, $response)); + } + return array($response->json(), null); + } + + private function put($url, $data, $headers) + { + $this->currentUrl = $url; + return Client::put($url, $data, $headers); + } + + private function postWithHeaders($url, $data, $headers) + { + $this->currentUrl = $url; + return Client::post($url, $data, $headers); + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php b/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php new file mode 100644 index 0000000..abadeb6 --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Storage/UploadManager.php @@ -0,0 +1,154 @@ +config = $config; + } + + /** + * 上传二进制流到七牛 + * + * @param $upToken 上传凭证 + * @param $key 上传文件名 + * @param $data 上传二进制流 + * @param $params 自定义变量,规格参考 + * http://developer.qiniu.com/docs/v6/api/overview/up/response/vars.html#xvar + * @param $mime 上传数据的mimeType + * @param $checkCrc 是否校验crc32 + * + * @return array 包含已上传文件的信息,类似: + * [ + * "hash" => "", + * "key" => "" + * ] + */ + public function put( + $upToken, + $key, + $data, + $params = null, + $mime = 'application/octet-stream', + $fname = "default_filename" + ) { + + $params = self::trimParams($params); + return FormUploader::put( + $upToken, + $key, + $data, + $this->config, + $params, + $mime, + $fname + ); + } + + + /** + * 上传文件到七牛 + * + * @param string $upToken 上传凭证 + * @param string $key 上传文件名 + * @param string $filePath 上传文件的路径 + * @param array $params 定义变量,规格参考 + * http://developer.qiniu.com/docs/v6/api/overview/up/response/vars.html#xvar + * @param boolean $mime 上传数据的mimeType + * @param string $checkCrc 是否校验crc32 + * @param string $resumeRecordFile 断点续传文件路径 默认为null + * @param string $version 分片上传版本 目前支持v1/v2版本 默认v1 + * @param int $partSize 分片上传v2字段 默认大小为4MB 分片大小范围为1 MB - 1 GB + * + * @return array 包含已上传文件的信息,类似: + * [ + * "hash" => "", + * "key" => "" + * ] + * @throws \Exception + */ + public function putFile( + $upToken, + $key, + $filePath, + $params = null, + $mime = 'application/octet-stream', + $checkCrc = false, + $resumeRecordFile = null, + $version = 'v1', + $partSize = config::BLOCK_SIZE + ) { + + $file = fopen($filePath, 'rb'); + if ($file === false) { + throw new \Exception("file can not open", 1); + } + $params = self::trimParams($params); + $stat = fstat($file); + $size = $stat['size']; + if ($size <= Config::BLOCK_SIZE) { + $data = fread($file, $size); + fclose($file); + if ($data === false) { + throw new \Exception("file can not read", 1); + } + return FormUploader::put( + $upToken, + $key, + $data, + $this->config, + $params, + $mime, + basename($filePath) + ); + } + + $up = new ResumeUploader( + $upToken, + $key, + $file, + $size, + $params, + $mime, + $this->config, + $resumeRecordFile, + $version, + $partSize + ); + $ret = $up->upload(basename($filePath)); + fclose($file); + return $ret; + } + + public static function trimParams($params) + { + if ($params === null) { + return null; + } + $ret = array(); + foreach ($params as $k => $v) { + $pos1 = strpos($k, 'x:'); + $pos2 = strpos($k, 'x-qn-meta-'); + if (($pos1 === 0 || $pos2 === 0) && !empty($v)) { + $ret[$k] = $v; + } + } + return $ret; + } +} diff --git a/vendor/qiniu/php-sdk/src/Qiniu/Zone.php b/vendor/qiniu/php-sdk/src/Qiniu/Zone.php new file mode 100644 index 0000000..7af0e3f --- /dev/null +++ b/vendor/qiniu/php-sdk/src/Qiniu/Zone.php @@ -0,0 +1,47 @@ + $v) { + $keysValue[$k] = $v[$key]; + } + array_multisort($keysValue, $sort, $array); + return $array; + } + + /** + * Wrapper for JSON decode that implements error detection with helpful + * error messages. + * + * @param string $json JSON data to parse + * @param bool $assoc When true, returned objects will be converted + * into associative arrays. + * @param int $depth User specified recursion depth. + * + * @return mixed + * @throws \InvalidArgumentException if the JSON cannot be parsed. + * @link http://www.php.net/manual/en/function.json-decode.php + */ + function json_decode($json, $assoc = false, $depth = 512) + { + static $jsonErrors = array( + JSON_ERROR_DEPTH => 'JSON_ERROR_DEPTH - Maximum stack depth exceeded', + JSON_ERROR_STATE_MISMATCH => 'JSON_ERROR_STATE_MISMATCH - Underflow or the modes mismatch', + JSON_ERROR_CTRL_CHAR => 'JSON_ERROR_CTRL_CHAR - Unexpected control character found', + JSON_ERROR_SYNTAX => 'JSON_ERROR_SYNTAX - Syntax error, malformed JSON', + JSON_ERROR_UTF8 => 'JSON_ERROR_UTF8 - Malformed UTF-8 characters, possibly incorrectly encoded' + ); + + if (empty($json)) { + return null; + } + $data = \json_decode($json, $assoc, $depth); + + if (JSON_ERROR_NONE !== json_last_error()) { + $last = json_last_error(); + throw new \InvalidArgumentException( + 'Unable to parse JSON data: ' + . (isset($jsonErrors[$last]) + ? $jsonErrors[$last] + : 'Unknown error') + ); + } + + return $data; + } + + /** + * 计算七牛API中的数据格式 + * + * @param string $bucket 待操作的空间名 + * @param string $key 待操作的文件名 + * + * @return string 符合七牛API规格的数据格式 + * @link http://developer.qiniu.com/docs/v6/api/reference/data-formats.html + */ + function entry($bucket, $key) + { + $en = $bucket; + if (!empty($key)) { + $en = $bucket . ':' . $key; + } + return base64_urlSafeEncode($en); + } + + /** + * array 辅助方法,无值时不set + * + * @param array $array 待操作array + * @param string $key key + * @param string $value value 为null时 不设置 + * + * @return array 原来的array,便于连续操作 + */ + function setWithoutEmpty(&$array, $key, $value) + { + if (!empty($value)) { + $array[$key] = $value; + } + return $array; + } + + /** + * 缩略图链接拼接 + * + * @param string $url 图片链接 + * @param int $mode 缩略模式 + * @param int $width 宽度 + * @param int $height 长度 + * @param string $format 输出类型 + * @param int $quality 图片质量 + * @param int $interlace 是否支持渐进显示 + * @param int $ignoreError 忽略结果 + * @return string + * @link http://developer.qiniu.com/code/v6/api/kodo-api/image/imageview2.html + * @author Sherlock Ren + */ + function thumbnail( + $url, + $mode, + $width, + $height, + $format = null, + $quality = null, + $interlace = null, + $ignoreError = 1 + ) { + + static $imageUrlBuilder = null; + if (is_null($imageUrlBuilder)) { + $imageUrlBuilder = new \Qiniu\Processing\ImageUrlBuilder; + } + + return call_user_func_array(array($imageUrlBuilder, 'thumbnail'), func_get_args()); + } + + /** + * 图片水印 + * + * @param string $url 图片链接 + * @param string $image 水印图片链接 + * @param numeric $dissolve 透明度 + * @param string $gravity 水印位置 + * @param numeric $dx 横轴边距 + * @param numeric $dy 纵轴边距 + * @param numeric $watermarkScale 自适应原图的短边比例 + * @link http://developer.qiniu.com/code/v6/api/kodo-api/image/watermark.html + * @return string + * @author Sherlock Ren + */ + function waterImg( + $url, + $image, + $dissolve = 100, + $gravity = 'SouthEast', + $dx = null, + $dy = null, + $watermarkScale = null + ) { + + static $imageUrlBuilder = null; + if (is_null($imageUrlBuilder)) { + $imageUrlBuilder = new \Qiniu\Processing\ImageUrlBuilder; + } + + return call_user_func_array(array($imageUrlBuilder, 'waterImg'), func_get_args()); + } + + /** + * 文字水印 + * + * @param string $url 图片链接 + * @param string $text 文字 + * @param string $font 文字字体 + * @param string $fontSize 文字字号 + * @param string $fontColor 文字颜色 + * @param numeric $dissolve 透明度 + * @param string $gravity 水印位置 + * @param numeric $dx 横轴边距 + * @param numeric $dy 纵轴边距 + * @link http://developer.qiniu.com/code/v6/api/kodo-api/image/watermark.html#text-watermark + * @return string + * @author Sherlock Ren + */ + function waterText( + $url, + $text, + $font = '黑体', + $fontSize = 0, + $fontColor = null, + $dissolve = 100, + $gravity = 'SouthEast', + $dx = null, + $dy = null + ) { + + static $imageUrlBuilder = null; + if (is_null($imageUrlBuilder)) { + $imageUrlBuilder = new \Qiniu\Processing\ImageUrlBuilder; + } + + return call_user_func_array(array($imageUrlBuilder, 'waterText'), func_get_args()); + } + + /** + * 从uptoken解析accessKey和bucket + * + * @param $upToken + * @return array(ak,bucket,err=null) + */ + function explodeUpToken($upToken) + { + $items = explode(':', $upToken); + if (count($items) != 3) { + return array(null, null, "invalid uptoken"); + } + $accessKey = $items[0]; + $putPolicy = json_decode(base64_urlSafeDecode($items[2])); + $scope = $putPolicy->scope; + $scopeItems = explode(':', $scope); + $bucket = $scopeItems[0]; + return array($accessKey, $bucket, null); + } +} diff --git a/vendor/qiniu/php-sdk/test-env.sh b/vendor/qiniu/php-sdk/test-env.sh new file mode 100644 index 0000000..eedf6b5 --- /dev/null +++ b/vendor/qiniu/php-sdk/test-env.sh @@ -0,0 +1,4 @@ +export QINIU_ACCESS_KEY=xxx +export QINIU_SECRET_KEY=xxx +export QINIU_TEST_BUCKET=phpsdk +export QINIU_TEST_DOMAIN=phpsdk.qiniudn.com \ No newline at end of file diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/AuthTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/AuthTest.php new file mode 100644 index 0000000..8c6c531 --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/AuthTest.php @@ -0,0 +1,211 @@ +sign('test'); + $this->assertEquals('abcdefghklmnopq:mSNBTR7uS2crJsyFr2Amwv1LaYg=', $token); + } + + public function testSignWithData() + { + global $dummyAuth; + $token = $dummyAuth->signWithData('test'); + $this->assertEquals('abcdefghklmnopq:-jP8eEV9v48MkYiBGs81aDxl60E=:dGVzdA==', $token); + } + + public function testSignRequest() + { + global $dummyAuth; + $token = $dummyAuth->signRequest('http://www.qiniu.com?go=1', 'test', ''); + $this->assertEquals('abcdefghklmnopq:cFyRVoWrE3IugPIMP5YJFTO-O-Y=', $token); + $ctype = 'application/x-www-form-urlencoded'; + $token = $dummyAuth->signRequest('http://www.qiniu.com?go=1', 'test', $ctype); + $this->assertEquals($token, 'abcdefghklmnopq:svWRNcacOE-YMsc70nuIYdaa1e4='); + } + + public function testPrivateDownloadUrl() + { + global $dummyAuth; + $_SERVER['override_qiniu_auth_time'] = true; + $url = $dummyAuth->privateDownloadUrl('http://www.qiniu.com?go=1'); + $expect = 'http://www.qiniu.com?go=1&e=1234571490&token=abcdefghklmnopq:8vzBeLZ9W3E4kbBLFLW0Xe0u7v4='; + $this->assertEquals($expect, $url); + unset($_SERVER['override_qiniu_auth_time']); + } + + public function testUploadToken() + { + global $dummyAuth; + $_SERVER['override_qiniu_auth_time'] = true; + $token = $dummyAuth->uploadToken('1', '2', 3600, array('endUser' => 'y')); + // @codingStandardsIgnoreStart + $exp = 'abcdefghklmnopq:yyeexeUkPOROoTGvwBjJ0F0VLEo=:eyJlbmRVc2VyIjoieSIsInNjb3BlIjoiMToyIiwiZGVhZGxpbmUiOjEyMzQ1NzE0OTB9'; + // @codingStandardsIgnoreEnd + $this->assertEquals($exp, $token); + unset($_SERVER['override_qiniu_auth_time']); + } + + public function testVerifyCallback() + { + } + + public function testSignQiniuAuthorization() + { + $auth = new Auth("ak", "sk"); + + // --- + $url = ""; + $method = ""; + $headers = new Header(array( + "X-Qiniu-" => array("a"), + "X-Qiniu" => array("b"), + "Content-Type" => array("application/x-www-form-urlencoded"), + )); + $body = "{\"name\": \"test\"}"; + list($sign, $err) = $auth->signQiniuAuthorization($url, $method, $body, $headers); + $this->assertNull($err); + $this->assertEquals("ak:0i1vKClRDWFyNkcTFzwcE7PzX74=", $sign); + + // --- + $url = ""; + $method = ""; + $headers = new Header(array( + "Content-Type" => array("application/json"), + )); + list($sign, $err) = $auth->signQiniuAuthorization($url, $method, $body, $headers); + $this->assertNull($err); + $this->assertEquals("ak:K1DI0goT05yhGizDFE5FiPJxAj4=", $sign); + + // --- + $url = ""; + $method = "GET"; + $headers = new Header(array( + "X-Qiniu-" => array("a"), + "X-Qiniu" => array("b"), + "Content-Type" => array("application/x-www-form-urlencoded"), + )); + $body = "{\"name\": \"test\"}"; + list($sign, $err) = $auth->signQiniuAuthorization($url, $method, $body, $headers); + $this->assertNull($err); + $this->assertEquals("ak:0i1vKClRDWFyNkcTFzwcE7PzX74=", $sign); + + // --- + $url = ""; + $method = "POST"; + $headers = new Header(array( + "Content-Type" => array("application/json"), + "X-Qiniu" => array("b"), + )); + $body = "{\"name\": \"test\"}"; + list($sign, $err) = $auth->signQiniuAuthorization($url, $method, $body, $headers); + $this->assertNull($err); + $this->assertEquals("ak:0ujEjW_vLRZxebsveBgqa3JyQ-w=", $sign); + + // --- + $url = "http://upload.qiniup.com"; + $method = ""; + $headers = new Header(array( + "X-Qiniu-" => array("a"), + "X-Qiniu" => array("b"), + "Content-Type" => array("application/x-www-form-urlencoded"), + )); + $body = "{\"name\": \"test\"}"; + list($sign, $err) = $auth->signQiniuAuthorization($url, $method, $body, $headers); + $this->assertNull($err); + $this->assertEquals("ak:GShw5NitGmd5TLoo38nDkGUofRw=", $sign); + + // --- + $url = "http://upload.qiniup.com"; + $method = ""; + $headers = new Header(array( + "Content-Type" => array("application/json"), + "X-Qiniu-Bbb" => array("BBB", "AAA"), + "X-Qiniu-Aaa" => array("DDD", "CCC"), + "X-Qiniu-" => array("a"), + "X-Qiniu" => array("b"), + )); + $body = "{\"name\": \"test\"}"; + list($sign, $err) = $auth->signQiniuAuthorization($url, $method, $body, $headers); + $this->assertNull($err); + $this->assertEquals("ak:DhNA1UCaBqSHCsQjMOLRfVn63GQ=", $sign); + + // --- + $url = "http://upload.qiniup.com"; + $method = ""; + $headers = new Header(array( + "Content-Type" => array("application/x-www-form-urlencoded"), + "X-Qiniu-Bbb" => array("BBB", "AAA"), + "X-Qiniu-Aaa" => array("DDD", "CCC"), + "X-Qiniu-" => array("a"), + "X-Qiniu" => array("b"), + )); + $body = "name=test&language=go"; + list($sign, $err) = $auth->signQiniuAuthorization($url, $method, $body, $headers); + $this->assertNull($err); + $this->assertEquals("ak:KUAhrYh32P9bv0COD8ugZjDCmII=", $sign); + + // --- + $url = "http://upload.qiniup.com"; + $method = ""; + $headers = new Header(array( + "Content-Type" => array("application/x-www"), + "Content-Type" => array("application/x-www-form-urlencoded"), + "X-Qiniu-Bbb" => array("BBB", "AAA"), + "X-Qiniu-Aaa" => array("DDD", "CCC"), + )); + $body = "name=test&language=go"; + list($sign, $err) = $auth->signQiniuAuthorization($url, $method, $body, $headers); + $this->assertNull($err); + $this->assertEquals("ak:KUAhrYh32P9bv0COD8ugZjDCmII=", $sign); + + // --- + $url = "http://upload.qiniup.com/mkfile/sdf.jpg"; + $method = ""; + $headers = new Header(array( + "Content-Type" => array("application/x-www-form-urlencoded"), + "X-Qiniu-Bbb" => array("BBB", "AAA"), + "X-Qiniu-Aaa" => array("DDD", "CCC"), + "X-Qiniu-" => array("a"), + "X-Qiniu" => array("b"), + )); + $body = "name=test&language=go"; + list($sign, $err) = $auth->signQiniuAuthorization($url, $method, $body, $headers); + $this->assertNull($err); + $this->assertEquals("ak:fkRck5_LeyfwdkyyLk-hyNwGKac=", $sign); + + $url = "http://upload.qiniup.com/mkfile/sdf.jpg?s=er3&df"; + $method = ""; + $headers = new Header(array( + "Content-Type" => array("application/x-www-form-urlencoded"), + "X-Qiniu-Bbb" => array("BBB", "AAA"), + "X-Qiniu-Aaa" => array("DDD", "CCC"), + "X-Qiniu-" => array("a"), + "X-Qiniu" => array("b"), + )); + $body = "name=test&language=go"; + list($sign, $err) = $auth->signQiniuAuthorization($url, $method, $body, $headers); + $this->assertNull($err); + $this->assertEquals("ak:PUFPWsEUIpk_dzUvvxTTmwhp3p4=", $sign); + } + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/Base64Test.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/Base64Test.php new file mode 100644 index 0000000..6d63353 --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/Base64Test.php @@ -0,0 +1,14 @@ +assertEquals($a, \Qiniu\base64_urlSafeDecode($b)); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/BucketTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/BucketTest.php new file mode 100644 index 0000000..3fd51bb --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/BucketTest.php @@ -0,0 +1,598 @@ +bucketName = $bucketName; + $this->key = $key; + $this->key2 = $key2; + + global $customCallbackURL; + $this->customCallbackURL = $customCallbackURL; + + global $testAuth; + $config = new Config(); + $this->bucketManager = new BucketManager($testAuth, $config); + + global $dummyAuth; + $this->dummyBucketManager = new BucketManager($dummyAuth); + } + + public function testBuckets() + { + + list($list, $error) = $this->bucketManager->buckets(); + $this->assertNull($error); + $this->assertTrue(in_array($this->bucketName, $list)); + + list($list2, $error) = $this->dummyBucketManager->buckets(); + $this->assertEquals(401, $error->code()); + $this->assertNotNull($error->message()); + $this->assertNotNull($error->getResponse()); + $this->assertNull($list2); + } + + public function testListbuckets() + { + list($ret, $error) = $this->bucketManager->listbuckets('z0'); + $this->assertNull($error); + $this->assertNotNull($ret); + } + + public function testCreateBucket() + { + list($ret, $error) = $this->bucketManager->createBucket('phpsdk-ci-test'); + $this->assertNull($error); + $this->assertNotNull($ret); + } + + public function testDeleteBucket() + { + list($ret, $error) = $this->bucketManager->deleteBucket('phpsdk-ci-test'); + $this->assertNull($error); + $this->assertNotNull($ret); + } + + public function testDomains() + { + list($ret, $error) = $this->bucketManager->domains($this->bucketName); + $this->assertNull($error); + $this->assertNotNull($ret); + } + + public function testBucketInfo() + { + list($ret, $error) = $this->bucketManager->bucketInfo($this->bucketName); + $this->assertNull($error); + $this->assertNotNull($ret); + } + + public function testBucketInfos() + { + list($ret, $error) = $this->bucketManager->bucketInfos('z0'); + $this->assertNull($error); + $this->assertNotNull($ret); + } + + public function testList() + { + list($ret, $error) = $this->bucketManager->listFiles($this->bucketName, null, null, 10); + $this->assertNull($error); + $this->assertNotNull($ret['items'][0]); + $this->assertNotNull($ret['marker']); + } + + public function testListFilesv2() + { + list($ret, $error) = $this->bucketManager->listFilesv2($this->bucketName, null, null, 10); + $this->assertNull($error); + $this->assertNotNull($ret); + } + + public function testBucketLifecycleRule() + { + // delete + $this->bucketManager->deleteBucketLifecycleRule($this->bucketName, 'demo'); + + // add + list($ret, $error) = $this->bucketManager->bucketLifecycleRule( + $this->bucketName, + 'demo', + 'test', + 80, + 70, + 72, + 74 + ); + $this->assertNull($error); + $this->assertNotNull($ret); + + // get + list($ret, $error) = $this->bucketManager->getBucketLifecycleRules($this->bucketName); + $this->assertNull($error); + $this->assertNotNull($ret); + $rule = null; + foreach ($ret as $r) { + if ($r["name"] === "demo") { + $rule = $r; + break; + } + } + $this->assertNotNull($rule); + $this->assertEquals("test", $rule["prefix"]); + $this->assertEquals(80, $rule["delete_after_days"]); + $this->assertEquals(70, $rule["to_line_after_days"]); + $this->assertEquals(72, $rule["to_archive_after_days"]); + $this->assertEquals(74, $rule["to_deep_archive_after_days"]); + + // update + list($ret, $error) = $this->bucketManager->updateBucketLifecycleRule( + $this->bucketName, + 'demo', + 'testupdate', + 90, + 75, + 80, + 85 + ); + $this->assertNull($error); + $this->assertNotNull($ret); + + // get + list($ret, $error) = $this->bucketManager->getBucketLifecycleRules($this->bucketName); + $this->assertNull($error); + $this->assertNotNull($ret); + $rule = null; + foreach ($ret as $r) { + if ($r["name"] === "demo") { + $rule = $r; + break; + } + } + $this->assertNotNull($rule); + $this->assertEquals("testupdate", $rule["prefix"]); + $this->assertEquals(90, $rule["delete_after_days"]); + $this->assertEquals(75, $rule["to_line_after_days"]); + $this->assertEquals(80, $rule["to_archive_after_days"]); + $this->assertEquals(85, $rule["to_deep_archive_after_days"]); + + // delete + list($ret, $error) = $this->bucketManager->deleteBucketLifecycleRule($this->bucketName, 'demo'); + $this->assertNull($error); + $this->assertNotNull($ret); + } + + public function testPutBucketEvent() + { + list($ret, $error) = $this->bucketManager->putBucketEvent( + $this->bucketName, + 'bucketevent', + 'test', + 'img', + array('copy'), + $this->customCallbackURL + ); + $this->assertNull($error); + $this->assertNotNull($ret); + } + + public function testUpdateBucketEvent() + { + list($ret, $error) = $this->bucketManager->updateBucketEvent( + $this->bucketName, + 'bucketevent', + 'test', + 'video', + array('copy'), + $this->customCallbackURL + ); + $this->assertNull($error); + $this->assertNotNull($ret); + } + + public function testGetBucketEvent() + { + list($ret, $error) = $this->bucketManager->getBucketEvents($this->bucketName); + $this->assertNull($error); + $this->assertNotNull($ret); + } + + public function testDeleteBucketEvent() + { + list($ret, $error) = $this->bucketManager->deleteBucketEvent($this->bucketName, 'bucketevent'); + $this->assertNull($error); + $this->assertNotNull($ret); + } + + public function testStat() + { + list($stat, $error) = $this->bucketManager->stat($this->bucketName, $this->key); + $this->assertNull($error); + $this->assertNotNull($stat); + $this->assertNotNull($stat['hash']); + + list($stat, $error) = $this->bucketManager->stat($this->bucketName, 'nofile'); + $this->assertEquals(612, $error->code()); + $this->assertNotNull($error->message()); + $this->assertNull($stat); + + list($stat, $error) = $this->bucketManager->stat('nobucket', 'nofile'); + $this->assertEquals(631, $error->code()); + $this->assertNotNull($error->message()); + $this->assertNull($stat); + } + + public function testDelete() + { + list($ret, $error) = $this->bucketManager->delete($this->bucketName, 'del'); + $this->assertNotNull($error); + $this->assertNull($ret); + } + + + public function testRename() + { + $key = 'renamefrom' . rand(); + $this->bucketManager->copy($this->bucketName, $this->key, $this->bucketName, $key); + $key2 = 'renameto' . $key; + list($ret, $error) = $this->bucketManager->rename($this->bucketName, $key, $key2); + $this->assertNull($error); + list($ret, $error) = $this->bucketManager->delete($this->bucketName, $key2); + $this->assertNull($error); + } + + + public function testCopy() + { + $key = 'copyto' . rand(); + $this->bucketManager->delete($this->bucketName, $key); + + list($ret, $error) = $this->bucketManager->copy( + $this->bucketName, + $this->key, + $this->bucketName, + $key + ); + $this->assertNull($error); + + //test force copy + list($ret, $error) = $this->bucketManager->copy( + $this->bucketName, + $this->key2, + $this->bucketName, + $key, + true + ); + $this->assertNull($error); + + list($key2Stat,) = $this->bucketManager->stat($this->bucketName, $this->key2); + list($key2CopiedStat,) = $this->bucketManager->stat($this->bucketName, $key); + + $this->assertEquals($key2Stat['hash'], $key2CopiedStat['hash']); + + list($ret, $error) = $this->bucketManager->delete($this->bucketName, $key); + $this->assertNull($error); + } + + + public function testChangeMime() + { + list($ret, $error) = $this->bucketManager->changeMime( + $this->bucketName, + 'php-sdk.html', + 'text/html' + ); + $this->assertNull($error); + } + + public function testPrefetch() + { + list($ret, $error) = $this->bucketManager->prefetch( + $this->bucketName, + 'php-sdk.html' + ); + $this->assertNull($error); + } + + public function testPrefetchFailed() + { + list($ret, $error) = $this->bucketManager->prefetch( + 'fakebucket', + 'php-sdk.html' + ); + $this->assertNotNull($error); + $this->assertNull($ret); + } + + public function testFetch() + { + list($ret, $error) = $this->bucketManager->fetch( + 'http://developer.qiniu.com/docs/v6/sdk/php-sdk.html', + $this->bucketName, + 'fetch.html' + ); + $this->assertNull($error); + $this->assertArrayHasKey('hash', $ret); + + list($ret, $error) = $this->bucketManager->fetch( + 'http://developer.qiniu.com/docs/v6/sdk/php-sdk.html', + $this->bucketName, + '' + ); + $this->assertNull($error); + $this->assertArrayHasKey('key', $ret); + + list($ret, $error) = $this->bucketManager->fetch( + 'http://developer.qiniu.com/docs/v6/sdk/php-sdk.html', + $this->bucketName + ); + $this->assertNull($error); + $this->assertArrayHasKey('key', $ret); + } + + public function testFetchFailed() + { + list($ret, $error) = $this->bucketManager->fetch( + 'http://developer.qiniu.com/docs/v6/sdk/php-sdk.html', + 'fakebucket' + ); + $this->assertNotNull($error); + $this->assertNull($ret); + } + + public function testAsynchFetch() + { + list($ret, $error) = $this->bucketManager->asynchFetch( + 'http://devtools.qiniu.com/qiniu.png', + $this->bucketName, + null, + 'qiniu.png' + ); + $this->assertNull($error); + $this->assertArrayHasKey('id', $ret); + + list($ret, $error) = $this->bucketManager->asynchFetch( + 'http://devtools.qiniu.com/qiniu.png', + $this->bucketName, + null, + '' + ); + $this->assertNull($error); + $this->assertArrayHasKey('id', $ret); + + list($ret, $error) = $this->bucketManager->asynchFetch( + 'http://devtools.qiniu.com/qiniu.png', + $this->bucketName + ); + $this->assertNull($error); + $this->assertArrayHasKey('id', $ret); + } + + public function testAsynchFetchFailed() + { + list($ret, $error) = $this->bucketManager->asynchFetch( + 'http://devtools.qiniu.com/qiniu.png', + 'fakebucket' + ); + $this->assertNotNull($error); + $this->assertNull($ret); + } + + + public function testBatchCopy() + { + $key = 'copyto' . rand(); + $ops = BucketManager::buildBatchCopy( + $this->bucketName, + array($this->key => $key), + $this->bucketName, + true + ); + list($ret, $error) = $this->bucketManager->batch($ops); + $this->assertEquals(200, $ret[0]['code']); + $ops = BucketManager::buildBatchDelete($this->bucketName, array($key)); + list($ret, $error) = $this->bucketManager->batch($ops); + $this->assertEquals(200, $ret[0]['code']); + } + + public function testBatchMove() + { + $key = 'movefrom' . rand(); + $this->bucketManager->copy($this->bucketName, $this->key, $this->bucketName, $key); + $key2 = $key . 'to'; + $ops = BucketManager::buildBatchMove( + $this->bucketName, + array($key => $key2), + $this->bucketName, + true + ); + list($ret, $error) = $this->bucketManager->batch($ops); + $this->assertEquals(200, $ret[0]['code']); + list($ret, $error) = $this->bucketManager->delete($this->bucketName, $key2); + $this->assertNull($error); + } + + public function testBatchRename() + { + $key = 'rename' . rand(); + $this->bucketManager->copy($this->bucketName, $this->key, $this->bucketName, $key); + $key2 = $key . 'to'; + $ops = BucketManager::buildBatchRename($this->bucketName, array($key => $key2), true); + list($ret, $error) = $this->bucketManager->batch($ops); + $this->assertEquals(200, $ret[0]['code']); + list($ret, $error) = $this->bucketManager->delete($this->bucketName, $key2); + $this->assertNull($error); + } + + public function testBatchStat() + { + $ops = BucketManager::buildBatchStat($this->bucketName, array('php-sdk.html')); + list($ret, $error) = $this->bucketManager->batch($ops); + $this->assertEquals(200, $ret[0]['code']); + } + + public function testBatchChangeTypeAndBatchRestoreAr() + { + $key = 'toChangeTypeThenRestore' . rand(); + $this->bucketManager->copy($this->bucketName, $this->key, $this->bucketName, $key); + + $ops = BucketManager::buildBatchChangeType($this->bucketName, array($key => 2)); // 2 Archive + list($ret, $error) = $this->bucketManager->batch($ops); + $this->assertNull($error); + $this->assertEquals(200, $ret[0]['code']); + + $ops = BucketManager::buildBatchRestoreAr($this->bucketName, array($key => 1)); // 1 day + list($ret, $error) = $this->bucketManager->batch($ops); + $this->assertNull($error); + $this->assertEquals(200, $ret[0]['code']); + + $this->bucketManager->delete($this->bucketName, $key); + } + + public function testDeleteAfterDays() + { + $key = rand(); + list($ret, $error) = $this->bucketManager->deleteAfterDays($this->bucketName, $key, 1); + $this->assertNotNull($error); + + $this->bucketManager->copy($this->bucketName, $this->key, $this->bucketName, $key); + list($ret, $error) = $this->bucketManager->deleteAfterDays($this->bucketName, $key, 1); + $this->assertEquals(null, $ret); + } + + public function testGetCorsRules() + { + list($ret, $err) = $this->bucketManager->getCorsRules($this->bucketName); + $this->assertNull($err); + } + + public function testPutBucketAccessStyleMode() + { + list($ret, $err) = $this->bucketManager->putBucketAccessStyleMode($this->bucketName, 0); + $this->assertNull($err); + } + + public function testPutBucketAccessMode() + { + list($ret, $err) = $this->bucketManager->putBucketAccessMode($this->bucketName, 0); + $this->assertNull($err); + } + + public function testPutReferAntiLeech() + { + list($ret, $err) = $this->bucketManager->putReferAntiLeech($this->bucketName, 0, "1", "*"); + $this->assertNull($err); + } + + public function testPutBucketMaxAge() + { + list($ret, $err) = $this->bucketManager->putBucketMaxAge($this->bucketName, 31536000); + $this->assertNull($err); + } + + public function testPutBucketQuota() + { + list($ret, $err) = $this->bucketManager->putBucketQuota($this->bucketName, -1, -1); + $this->assertNull($err); + } + + public function testGetBucketQuota() + { + list($ret, $err) = $this->bucketManager->getBucketQuota($this->bucketName); + $this->assertNull($err); + } + + public function testChangeType() + { + list($ret, $err) = $this->bucketManager->changeType($this->bucketName, $this->key, 0); + $this->assertNull($err); + + list($ret, $err) = $this->bucketManager->changeType($this->bucketName, $this->key, 1); + $this->assertNull($err); + } + + public function testArchiveRestoreAr() + { + $key = 'archiveToRestore' . rand(); + $this->bucketManager->delete($this->bucketName, $key); + + $this->bucketManager->copy( + $this->bucketName, + $this->key, + $this->bucketName, + $key + ); + $this->bucketManager->changeType($this->bucketName, $key, 2); + + list(, $err) = $this->bucketManager->restoreAr($this->bucketName, $key, 2); + $this->assertNull($err); + list($ret, $err) = $this->bucketManager->stat($this->bucketName, $key); + $this->assertNull($err); + + $this->assertEquals(2, $ret["type"]); + + // restoreStatus + // null means frozen; + // 1 means be unfreezing; + // 2 means be unfrozen; + $this->assertNotNull($ret["restoreStatus"]); + $this->assertContains($ret["restoreStatus"], array(1, 2)); + + $this->bucketManager->delete($this->bucketName, $key); + } + + public function testDeepArchiveRestoreAr() + { + $key = 'deepArchiveToRestore' . rand(); + $this->bucketManager->delete($this->bucketName, $key); + + $this->bucketManager->copy( + $this->bucketName, + $this->key, + $this->bucketName, + $key + ); + $this->bucketManager->changeType($this->bucketName, $key, 3); + + list(, $err) = $this->bucketManager->restoreAr($this->bucketName, $key, 1); + $this->assertNull($err); + list($ret, $err) = $this->bucketManager->stat($this->bucketName, $key); + $this->assertNull($err); + + $this->assertEquals(3, $ret["type"]); + + // restoreStatus + // null means frozen; + // 1 means be unfreezing; + // 2 means be unfrozen; + $this->assertNotNull($ret["restoreStatus"]); + $this->assertContains($ret["restoreStatus"], array(1, 2)); + + $this->bucketManager->delete($this->bucketName, $key); + } + + public function testChangeStatus() + { + list($ret, $err) = $this->bucketManager->changeStatus($this->bucketName, $this->key, 1); + $this->assertNull($err); + + list($ret, $err) = $this->bucketManager->changeStatus($this->bucketName, $this->key, 0); + $this->assertNull($err); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php new file mode 100644 index 0000000..2994e83 --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/CdnManagerTest.php @@ -0,0 +1,146 @@ +cdnManager = new CdnManager($testAuth); + + global $timestampAntiLeechEncryptKey; + $this->encryptKey = $timestampAntiLeechEncryptKey; + + global $testStartDate; + $this->testStartDate = $testStartDate; + + global $testEndDate; + $this->testEndDate = $testEndDate; + + global $testGranularity; + $this->testGranularity = $testGranularity; + + global $testLogDate; + $this->testLogDate = $testLogDate; + + global $customDomain; + $this->refreshUrl = $customDomain . '/sdktest.png'; + $this->refreshDirs = $customDomain; + $this->customDomain = $customDomain; + + global $customDomain2; + $this->customDomain2 = $customDomain2; + } + + public function testRefreshUrls() + { + list($ret, $err) = $this->cdnManager->refreshUrls(array($this->refreshUrl)); + $this->assertNull($err); + $this->assertNotNull($ret); + } + + public function testRefreshDirs() + { + list($ret, $err) = $this->cdnManager->refreshDirs(array($this->refreshDirs)); + $this->assertNull($err); + $this->assertNotNull($ret); + } + + public function testRefreshUrlsAndDirs() + { + list($ret, $err) = $this->cdnManager->refreshUrlsAndDirs(array($this->refreshUrl), array($this->refreshDirs)); + $this->assertNull($err); + $this->assertNotNull($ret); + } + + public function testGetCdnRefreshList() + { + list($ret, $err) = $this->cdnManager->getCdnRefreshList(null, null, null, 'success'); + $this->assertNull($err); + $this->assertNotNull($ret); + } + + public function testPrefetchUrls() + { + list($ret, $err) = $this->cdnManager->prefetchUrls(array($this->refreshUrl)); + $this->assertNull($err); + $this->assertNotNull($ret); + } + + public function testGetCdnPrefetchList() + { + list($ret, $err) = $this->cdnManager->getCdnPrefetchList(null, null, 'success'); + $this->assertNull($err); + $this->assertNotNull($ret); + } + + public function testGetBandwidthData() + { + list($ret, $err) = $this->cdnManager->getBandwidthData( + array($this->customDomain2), + $this->testStartDate, + $this->testEndDate, + $this->testGranularity + ); + $this->assertNull($err); + $this->assertNotNull($ret); + } + + public function testGetFluxData() + { + list($ret, $err) = $this->cdnManager->getFluxData( + array($this->customDomain2), + $this->testStartDate, + $this->testEndDate, + $this->testGranularity + ); + $this->assertNull($err); + $this->assertNotNull($ret); + } + + public function testGetCdnLogList() + { + $domain = getenv('QINIU_TEST_DOMAIN'); + list($ret, $err) = $this->cdnManager->getCdnLogList(array($domain), $this->testLogDate); + $this->assertNull($err); + $this->assertNotNull($ret); + } + + public function testCreateTimestampAntiLeechUrl() + { + $signUrl = $this->cdnManager->createTimestampAntiLeechUrl($this->refreshUrl, $this->encryptKey, 3600); + $response = Client::get($signUrl); + $this->assertNull($response->error); + $this->assertEquals($response->statusCode, 200); + + $signUrl = $this->cdnManager->createTimestampAntiLeechUrl( + $this->refreshUrl . '?qiniu', + $this->encryptKey, + 3600 + ); + $response = Client::get($signUrl); + $this->assertNull($response->error); + $this->assertEquals($response->statusCode, 200); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ConfigTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ConfigTest.php new file mode 100644 index 0000000..9f7a7ac --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ConfigTest.php @@ -0,0 +1,45 @@ +accessKey = $accessKey; + global $bucketName; + $this->bucketName = $bucketName; + } + + public function testGetApiHost() + { + $conf = new Config(); + $hasException = false; + $apiHost = ''; + try { + $apiHost = $conf->getApiHost($this->accessKey, $this->bucketName); + } catch (\Exception $e) { + $hasException = true; + } + $this->assertFalse($hasException); + $this->assertEquals('http://api.qiniu.com', $apiHost); + } + + public function testGetApiHostErrored() + { + $conf = new Config(); + $hasException = false; + try { + $conf->getApiHost($this->accessKey, "fakebucket"); + } catch (\Exception $e) { + $hasException = true; + } + $this->assertTrue($hasException); + } + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/Crc32Test.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/Crc32Test.php new file mode 100644 index 0000000..bfb36da --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/Crc32Test.php @@ -0,0 +1,21 @@ +assertEquals('1352841281', $b); + } + + public function testFile() + { + $b = \Qiniu\crc32_file(__file__); + $c = \Qiniu\crc32_file(__file__); + $this->assertEquals($c, $b); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php new file mode 100644 index 0000000..5373ab3 --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/DownloadTest.php @@ -0,0 +1,25 @@ +privateDownloadUrl($base_url); + $response = Client::get($private_url); + $this->assertEquals(200, $response->statusCode); + } + + public function testFop() + { + global $testAuth; + $base_url = 'http://sdk.peterpy.cn/gogopher.jpg?exif'; + $private_url = $testAuth->privateDownloadUrl($base_url); + $response = Client::get($private_url); + $this->assertEquals(200, $response->statusCode); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/EtagTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/EtagTest.php new file mode 100644 index 0000000..b77e805 --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/EtagTest.php @@ -0,0 +1,52 @@ +assertEquals('Fto5o-5ea0sNMlW_75VgGJCv2AcJ', $r); + $this->assertNull($error); + } + + public function testLess4M() + { + $file = qiniuTempFile(3 * 1024 * 1024, false); + list($r, $error) = Etag::sum($file); + unlink($file); + $this->assertEquals('Fs5BpnAjRykYTg6o5E09cjuXrDkG', $r); + $this->assertNull($error); + } + + public function test4M() + { + $file = qiniuTempFile(4 * 1024 * 1024, false); + list($r, $error) = Etag::sum($file); + unlink($file); + $this->assertEquals('FiuKULnybewpEnrfTmxjsxc-3dWp', $r); + $this->assertNull($error); + } + + public function testMore4M() + { + $file = qiniuTempFile(5 * 1024 * 1024, false); + list($r, $error) = Etag::sum($file); + unlink($file); + $this->assertEquals('lhvyfIWMYFTq4s4alzlhXoAkqfVL', $r); + $this->assertNull($error); + } + + public function test8M() + { + $file = qiniuTempFile(8 * 1024 * 1024, false); + list($r, $error) = Etag::sum($file); + unlink($file); + $this->assertEquals('lmRm9ZfGZ86bnMys4wRTWtJj9ClG', $r); + $this->assertNull($error); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php new file mode 100644 index 0000000..6cbdb7f --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FopTest.php @@ -0,0 +1,37 @@ +execute('gogopher.jpg', 'exif'); + $this->assertNull($error); + $this->assertNotNull($exif); + } + + public function testExifPrivate() + { + global $testAuth; + $fop = new Operation('private-res.qiniudn.com', $testAuth); + list($exif, $error) = $fop->execute('noexif.jpg', 'exif'); + $this->assertNotNull($error); + $this->assertNull($exif); + } + + public function testbuildUrl() + { + $fops = 'imageView2/2/h/200'; + $fop = new Operation('testres.qiniudn.com'); + $url = $fop->buildUrl('gogopher.jpg', $fops); + $this->assertEquals($url, 'http://testres.qiniudn.com/gogopher.jpg?imageView2/2/h/200'); + + $fops = array('imageView2/2/h/200', 'imageInfo'); + $url = $fop->buildUrl('gogopher.jpg', $fops); + $this->assertEquals($url, 'http://testres.qiniudn.com/gogopher.jpg?imageView2/2/h/200|imageInfo'); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FormUpTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FormUpTest.php new file mode 100644 index 0000000..402cc39 --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/FormUpTest.php @@ -0,0 +1,76 @@ +bucketName = $bucketName; + + global $testAuth; + $this->auth = $testAuth; + $this->cfg = new Config(); + } + + public function testData() + { + $token = $this->auth->uploadToken($this->bucketName); + list($ret, $error) = FormUploader::put($token, 'formput', 'hello world', $this->cfg, null, 'text/plain', null); + $this->assertNull($error); + $this->assertNotNull($ret['hash']); + } + + public function testData2() + { + $upManager = new UploadManager(); + $token = $this->auth->uploadToken($this->bucketName); + list($ret, $error) = $upManager->put($token, 'formput', 'hello world', null, 'text/plain', null); + $this->assertNull($error); + $this->assertNotNull($ret['hash']); + } + + public function testDataFailed() + { + $token = $this->auth->uploadToken('fakebucket'); + list($ret, $error) = FormUploader::put($token, 'formput', 'hello world', $this->cfg, null, 'text/plain', null); + $this->assertNull($ret); + $this->assertNotNull($error); + } + + public function testFile() + { + $key = 'formPutFile'; + $token = $this->auth->uploadToken($this->bucketName, $key); + list($ret, $error) = FormUploader::putFile($token, $key, __file__, $this->cfg, null, 'text/plain', null); + $this->assertNull($error); + $this->assertNotNull($ret['hash']); + } + + public function testFile2() + { + $key = 'formPutFile'; + $token = $this->auth->uploadToken($this->bucketName, $key); + $upManager = new UploadManager(); + list($ret, $error) = $upManager->putFile($token, $key, __file__, null, 'text/plain', null); + $this->assertNull($error); + $this->assertNotNull($ret['hash']); + } + + public function testFileFailed() + { + $key = 'fakekey'; + $token = $this->auth->uploadToken('fakebucket', $key); + list($ret, $error) = FormUploader::putFile($token, $key, __file__, $this->cfg, null, 'text/plain', null); + $this->assertNull($ret); + $this->assertNotNull($error); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/HeaderTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/HeaderTest.php new file mode 100644 index 0000000..b7ecd1f --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/HeaderTest.php @@ -0,0 +1,167 @@ + array('200'), + ':x-test-1' => array('hello1'), + ':x-Test-2' => array('hello2'), + 'content-type' => array('application/json'), + 'CONTENT-LENGTH' => array(1234), + 'oRiGin' => array('https://www.qiniu.com'), + 'ReFer' => array('www.qiniu.com'), + 'Last-Modified' => array('Mon, 06 Sep 2021 06:44:52 GMT'), + 'acCePt-ChArsEt' => array('utf-8'), + 'x-test-3' => array('hello3'), + 'cache-control' => array('no-cache', 'no-store'), + ); + + public function testNormalizeKey() + { + $except = array( + ':status', + ':x-test-1', + ':x-Test-2', + 'Content-Type', + 'Content-Length', + 'Origin', + 'Refer', + 'Last-Modified', + 'Accept-Charset', + 'X-Test-3', + 'Cache-Control' + ); + $actual = array_map(function ($str) { + return Header::normalizeKey($str); + }, array_keys($this->heads)); + $this->assertEquals($actual, $except); + } + + + public function testInvalidKeyName() + { + $except = array( + 'a:x-test-1', + ); + + $actual = array_map(function ($str) { + return Header::normalizeKey($str); + }, $except); + + $this->assertEquals($except, $actual); + } + + public function testGetRawData() + { + $header = new Header($this->heads); + foreach ($this->heads as $k => $v) { + $rawHeader = $header->getRawData(); + $this->assertEquals($v, $rawHeader[Header::normalizeKey($k)]); + } + } + + public function testOffsetExists() + { + $header = new Header($this->heads); + foreach (array_keys($this->heads) as $k) { + $this->assertNotNull($header[$k]); + } + + $except = array( + ':status', + ':x-test-1', + ':x-Test-2', + 'Content-Type', + 'Content-Length', + 'Origin', + 'Refer', + 'Last-Modified', + 'Accept-Charset', + 'X-Test-3', + 'Cache-Control' + ); + foreach ($except as $k) { + $this->assertNotNull($header[$k], $k." is null"); + } + } + + public function testOffsetGet() + { + $header = new Header($this->heads); + foreach ($this->heads as $k => $v) { + $this->assertEquals($v[0], $header[$k]); + } + + $this->assertNull($header['no-exist']); + } + + public function testOffsetSet() + { + $header = new Header($this->heads); + $header["X-Test-3"] = "hello"; + $this->assertEquals("hello", $header["X-Test-3"]); + $header["x-test-3"] = "hello test3"; + $this->assertEquals("hello test3", $header["x-test-3"]); + $header[":x-Test-2"] = "hello"; + $this->assertEquals("hello", $header[":x-Test-2"]); + $header[":x-test-2"] = "hello test2"; + $this->assertEquals("hello", $header[":x-Test-2"]); + } + + public function testOffsetUnset() + { + $header = new Header($this->heads); + unset($header["X-Test-3"]); + $this->assertFalse(isset($header["X-Test-3"])); + + $header = new Header($this->heads); + unset($header["x-test-3"]); + $this->assertFalse(isset($header["x-test-3"])); + + $header = new Header($this->heads); + unset($header[":x-test-2"]); + $this->assertTrue(isset($header[":x-Test-2"])); + + $header = new Header($this->heads); + unset($header[":x-Test-2"]); + $this->assertFalse(isset($header[":x-Test-2"])); + } + + public function testGetIterator() + { + $header = new Header($this->heads); + + $hasException = false; + try { + foreach ($header as $k => $v) { + $hasException = !isset($header[$k]); + } + } catch (\Exception $e) { + $hasException = true; + } + $this->assertFalse($hasException); + } + + public function testCount() + { + $header = new Header($this->heads); + + $this->assertEquals(count($this->heads), count($header)); + } + + public function testFromRaw() + { + $lines = array(); + foreach ($this->heads as $k => $vs) { + foreach ($vs as $v) { + array_push($lines, $k . ": " . $v); + } + } + $raw = implode("\r\n", $lines); + $headerFromRaw = Header::fromRawText($raw); + $this->assertEquals(new Header($this->heads), $headerFromRaw); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/HttpTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/HttpTest.php new file mode 100644 index 0000000..558bc1f --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/HttpTest.php @@ -0,0 +1,79 @@ +assertEquals($response->statusCode, 200); + $this->assertNotNull($response->body); + $this->assertNull($response->error); + } + + public function testGetQiniu() + { + $response = Client::get('upload.qiniu.com'); + $this->assertEquals(405, $response->statusCode); + $this->assertNotNull($response->body); + $this->assertNotNull($response->xReqId()); + $this->assertNotNull($response->xLog()); + $this->assertNotNull($response->error); + } + + public function testDelete() + { + $response = Client::delete('uc.qbox.me/bucketTagging', array()); + $this->assertEquals($response->statusCode, 401); + $this->assertNotNull($response->body); + $this->assertNotNull($response->error); + } + + public function testDeleteQiniu() + { + $response = Client::delete('uc.qbox.me/bucketTagging', array()); + $this->assertEquals(401, $response->statusCode); + $this->assertNotNull($response->body); + $this->assertNotNull($response->xReqId()); + $this->assertNotNull($response->xLog()); + $this->assertNotNull($response->error); + } + + public function testPost() + { + $response = Client::post('qiniu.com', null); + $this->assertEquals($response->statusCode, 200); + $this->assertNotNull($response->body); + $this->assertNull($response->error); + } + + public function testPostQiniu() + { + $response = Client::post('upload.qiniu.com', null); + $this->assertEquals($response->statusCode, 400); + $this->assertNotNull($response->body); + $this->assertNotNull($response->xReqId()); + $this->assertNotNull($response->xLog()); + $this->assertNotNull($response->error); + } + + public function testPut() + { + $response = Client::PUT('uc.qbox.me/bucketTagging', null); + $this->assertEquals($response->statusCode, 401); + $this->assertNotNull($response->body); + $this->assertNotNull($response->error); + } + + public function testPutQiniu() + { + $response = Client::put('uc.qbox.me/bucketTagging', null); + $this->assertEquals(401, $response->statusCode); + $this->assertNotNull($response->body); + $this->assertNotNull($response->xReqId()); + $this->assertNotNull($response->xLog()); + $this->assertNotNull($response->error); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ImageUrlBuilderTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ImageUrlBuilderTest.php new file mode 100644 index 0000000..fca87b6 --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ImageUrlBuilderTest.php @@ -0,0 +1,261 @@ + + */ +class ImageUrlBuilderTest extends \PHPUnit_Framework_TestCase +{ + /** + * 缩略图测试 + * + * @test + * @return void + * @author Sherlock Ren + */ + public function testThumbutl() + { + $imageUrlBuilder = new \Qiniu\Processing\ImageUrlBuilder(); + $url = 'http://78re52.com1.z0.glb.clouddn.com/resource/gogopher.jpg'; + $url2 = $url . '?watermark/1/gravity/SouthEast/dx/0/dy/0/image/' + . 'aHR0cDovL2Fkcy1jZG4uY2h1Y2h1amllLmNvbS9Ga1R6bnpIY2RLdmRBUFc5cHZZZ3pTc21UY0tB'; + // 异常测试 + $this->assertEquals($url, $imageUrlBuilder->thumbnail($url, 1, 0, 0)); + $this->assertEquals($url, \Qiniu\thumbnail($url, 1, 0, 0)); + + // 简单缩略测试 + $this->assertEquals( + $url . '?imageView2/1/w/200/h/200/ignore-error/1/', + $imageUrlBuilder->thumbnail($url, 1, 200, 200) + ); + $this->assertEquals( + $url . '?imageView2/1/w/200/h/200/ignore-error/1/', + \Qiniu\thumbnail($url, 1, 200, 200) + ); + + // 输出格式测试 + $this->assertEquals( + $url . '?imageView2/1/w/200/h/200/format/png/ignore-error/1/', + $imageUrlBuilder->thumbnail($url, 1, 200, 200, 'png') + ); + $this->assertEquals( + $url . '?imageView2/1/w/200/h/200/format/png/ignore-error/1/', + \Qiniu\thumbnail($url, 1, 200, 200, 'png') + ); + + // 渐进显示测试 + $this->assertEquals( + $url . '?imageView2/1/w/200/h/200/format/png/interlace/1/ignore-error/1/', + $imageUrlBuilder->thumbnail($url, 1, 200, 200, 'png', 1) + ); + $this->assertEquals( + $url . '?imageView2/1/w/200/h/200/format/png/ignore-error/1/', + \Qiniu\thumbnail($url, 1, 200, 200, 'png', 2) + ); + + // 图片质量测试 + $this->assertEquals( + $url . '?imageView2/1/w/200/h/200/format/png/interlace/1/q/80/ignore-error/1/', + $imageUrlBuilder->thumbnail($url, 1, 200, 200, 'png', 1, 80) + ); + $this->assertEquals( + $url . '?imageView2/1/w/200/h/200/format/png/interlace/1/ignore-error/1/', + \Qiniu\thumbnail($url, 1, 200, 200, 'png', 1, 101) + ); + + // 多参数测试 + $this->assertEquals( + $url2 . '|imageView2/1/w/200/h/200/ignore-error/1/', + $imageUrlBuilder->thumbnail($url2, 1, 200, 200) + ); + $this->assertEquals( + $url2 . '|imageView2/1/w/200/h/200/ignore-error/1/', + \Qiniu\thumbnail($url2, 1, 200, 200) + ); + } + + /** + * 图片水印测试 + * + * @test + * @param void + * @return void + * @author Sherlock Ren + */ + public function waterImgTest() + { + $imageUrlBuilder = new \Qiniu\Processing\ImageUrlBuilder(); + $url = 'http://78re52.com1.z0.glb.clouddn.com/resource/gogopher.jpg'; + $url2 = $url . '?imageView2/1/w/200/h/200/format/png/ignore-error/1/'; + $image = 'http://developer.qiniu.com/resource/logo-2.jpg'; + + // 水印简单测试 + $this->assertEquals( + $url . '?watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==' + . '/dissolve/100/gravity/SouthEast/', + $imageUrlBuilder->waterImg($url, $image) + ); + $this->assertEquals( + $url . '?watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==' + . '/gravity/SouthEast/', + $imageUrlBuilder->waterImg($url, $image, 101) + ); + $this->assertEquals( + $url . '?watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==/', + $imageUrlBuilder->waterImg($url, $image, 101, 'sdfsd') + ); + $this->assertEquals( + $url . '?watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==' + . '/dissolve/100/gravity/SouthEast/', + \Qiniu\waterImg($url, $image) + ); + + // 横轴边距测试 + $this->assertEquals( + $url . '?watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==' + . '/dissolve/100/gravity/SouthEast/dx/10/', + $imageUrlBuilder->waterImg($url, $image, 100, 'SouthEast', 10) + ); + $this->assertEquals( + $url . '?watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==' + . '/dissolve/100/gravity/SouthEast/', + \Qiniu\waterImg($url, $image, 100, 'SouthEast', 'sad') + ); + + // 纵轴边距测试 + $this->assertEquals( + $url . '?watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==' + . '/dissolve/100/gravity/SouthEast/dx/10/dy/10/', + $imageUrlBuilder->waterImg($url, $image, 100, 'SouthEast', 10, 10) + ); + $this->assertEquals( + $url . '?watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==' + . '/dissolve/100/gravity/SouthEast/', + \Qiniu\waterImg($url, $image, 100, 'SouthEast', 'sad', 'asdf') + ); + + // 自适应原图的短边比例测试 + $this->assertEquals( + $url . '?watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==' + . '/dissolve/100/gravity/SouthEast/dx/10/dy/10/ws/0.5/', + $imageUrlBuilder->waterImg($url, $image, 100, 'SouthEast', 10, 10, 0.5) + ); + $this->assertEquals( + $url . '?watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==' + . '/dissolve/100/gravity/SouthEast/', + \Qiniu\waterImg($url, $image, 100, 'SouthEast', 'sad', 'asdf', 2) + ); + + // 多参数测试 + $this->assertEquals( + $url2 . '|watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==' + . '/dissolve/100/gravity/SouthEast/', + $imageUrlBuilder->waterImg($url2, $image) + ); + $this->assertEquals( + $url2 . '|watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==' + . '/dissolve/100/gravity/SouthEast/', + \Qiniu\waterImg($url2, $image) + ); + } + + /** + * 文字水印测试 + * + * @test + * @param void + * @return void + * @author Sherlock Ren + */ + public function waterTextTest() + { + $imageUrlBuilder = new \Qiniu\Processing\ImageUrlBuilder(); + $url = 'http://78re52.com1.z0.glb.clouddn.com/resource/gogopher.jpg'; + $url2 = $url . '?imageView2/1/w/200/h/200/format/png/ignore-error/1/'; + $text = '测试一下'; + $font = '微软雅黑'; + $fontColor = '#FF0000'; + + // 水印简单测试 + $this->assertEquals($url . '?watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/' + . 'fontsize/500/dissolve/100/gravity/SouthEast/', $imageUrlBuilder->waterText($url, $text, $font, 500)); + $this->assertEquals( + $url . '?watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/' + . 'dissolve/100/gravity/SouthEast/', + \Qiniu\waterText($url, $text, $font, 'sdf') + ); + + // 字体颜色测试 + $this->assertEquals( + $url . '?watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/fontsize/500/fill/' + . 'I0ZGMDAwMA==/dissolve/100/gravity/SouthEast/', + $imageUrlBuilder->waterText($url, $text, $font, 500, $fontColor) + ); + $this->assertEquals( + $url . '?watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/fill/I0ZGMDAwMA==' + . '/dissolve/100/gravity/SouthEast/', + \Qiniu\waterText($url, $text, $font, 'sdf', $fontColor) + ); + + // 透明度测试 + $this->assertEquals( + $url . '?watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/fontsize/500/fill/I0ZGMDAwMA==' + . '/dissolve/80/gravity/SouthEast/', + $imageUrlBuilder->waterText($url, $text, $font, 500, $fontColor, 80) + ); + $this->assertEquals( + $url . '?watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/fill/I0ZGMDAwMA==' + . '/gravity/SouthEast/', + \Qiniu\waterText($url, $text, $font, 'sdf', $fontColor, 101) + ); + + // 水印位置测试 + $this->assertEquals( + $url . '?watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/fontsize/500/fill/I0ZGMDAwMA==' + . '/dissolve/80/gravity/East/', + $imageUrlBuilder->waterText($url, $text, $font, 500, $fontColor, 80, 'East') + ); + $this->assertEquals( + $url . '?watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/fill/I0ZGMDAwMA==/', + \Qiniu\waterText($url, $text, $font, 'sdf', $fontColor, 101, 'sdfsdf') + ); + + // 横轴距离测试 + $this->assertEquals( + $url . '?watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/fontsize/500/fill/I0ZGMDAwMA==' + . '/dissolve/80/gravity/East/dx/10/', + $imageUrlBuilder->waterText($url, $text, $font, 500, $fontColor, 80, 'East', 10) + ); + $this->assertEquals( + $url . '?watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/fill/I0ZGMDAwMA==/', + \Qiniu\waterText($url, $text, $font, 'sdf', $fontColor, 101, 'sdfsdf', 'sdfs') + ); + + // 纵轴距离测试 + $this->assertEquals( + $url . '?watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/fontsize/500/fill/I0ZGMDAwMA==' + . '/dissolve/80/gravity/East/dx/10/dy/10/', + $imageUrlBuilder->waterText($url, $text, $font, 500, $fontColor, 80, 'East', 10, 10) + ); + $this->assertEquals( + $url . '?watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/fill/I0ZGMDAwMA==/', + \Qiniu\waterText($url, $text, $font, 'sdf', $fontColor, 101, 'sdfsdf', 'sdfs', 'ssdf') + ); + // 多参数测试 + $this->assertEquals( + $url2 . '|watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/' + . 'fontsize/500/dissolve/100/gravity/SouthEast/', + $imageUrlBuilder->waterText($url2, $text, $font, 500) + ); + $this->assertEquals( + $url2 . '|watermark/2/text/5rWL6K-V5LiA5LiL/font/5b6u6L2v6ZuF6buR/' + . 'fontsize/500/dissolve/100/gravity/SouthEast/', + \Qiniu\waterText($url2, $text, $font, 500) + ); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/PfopTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/PfopTest.php new file mode 100644 index 0000000..d03b3f6 --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/PfopTest.php @@ -0,0 +1,66 @@ +execute($bucket, $key, $fops); + $this->assertNull($error); + list($status, $error) = $pfop->status($id); + $this->assertNotNull($status); + $this->assertNull($error); + } + + + public function testPfops() + { + global $testAuth; + $bucket = 'testres'; + $key = 'sintel_trailer.mp4'; + $fops = array( + 'avthumb/m3u8/segtime/10/vcodec/libx264/s/320x240', + 'vframe/jpg/offset/7/w/480/h/360', + ); + $pfop = new PersistentFop($testAuth, null); + + list($id, $error) = $pfop->execute($bucket, $key, $fops); + $this->assertNull($error); + + list($status, $error) = $pfop->status($id); + $this->assertNotNull($status); + $this->assertNull($error); + } + + public function testMkzip() + { + global $testAuth; + $bucket = 'phpsdk'; + $key = 'php-logo.png'; + $pfop = new PersistentFop($testAuth, null); + + $url1 = 'http://phpsdk.qiniudn.com/php-logo.png'; + $url2 = 'http://phpsdk.qiniudn.com/php-sdk.html'; + $zipKey = 'test.zip'; + + $fops = 'mkzip/2/url/' . \Qiniu\base64_urlSafeEncode($url1); + $fops .= '/url/' . \Qiniu\base64_urlSafeEncode($url2); + $fops .= '|saveas/' . \Qiniu\base64_urlSafeEncode("$bucket:$zipKey"); + + list($id, $error) = $pfop->execute($bucket, $key, $fops); + $this->assertNull($error); + + list($status, $error) = $pfop->status($id); + $this->assertNotNull($status); + $this->assertNull($error); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php new file mode 100644 index 0000000..989786a --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ResumeUpTest.php @@ -0,0 +1,312 @@ +delete($bucketName, $key); + } + } + protected $bucketName; + protected $auth; + + protected function setUp() + { + global $bucketName; + $this->bucketName = $bucketName; + + global $testAuth; + $this->auth = $testAuth; + } + + public function test4ML() + { + $key = "resumePutFile4ML_".rand(); + $upManager = new UploadManager(); + $token = $this->auth->uploadToken($this->bucketName, $key); + $tempFile = qiniuTempFile(4 * 1024 * 1024 + 10); + $resumeFile = tempnam(sys_get_temp_dir(), 'resume_file'); + $this->assertNotFalse($resumeFile); + list($ret, $error) = $upManager->putFile( + $token, + $key, + $tempFile, + null, + 'application/octet-stream', + false, + $resumeFile + ); + $this->assertNull($error); + $this->assertNotNull($ret['hash']); + unlink($resumeFile); + + $domain = getenv('QINIU_TEST_DOMAIN'); + $response = Client::get("http://$domain/$key"); + $this->assertEquals(200, $response->statusCode); + $this->assertEquals(md5_file($tempFile, true), md5($response->body(), true)); + unlink($tempFile); + } + + public function test4ML2() + { + $key = 'resumePutFile4ML_'.rand(); + $zone = new Zone(array('upload.fake.qiniu.com'), array('upload.qiniup.com')); + $cfg = new Config($zone); + $upManager = new UploadManager($cfg); + $token = $this->auth->uploadToken($this->bucketName, $key); + $tempFile = qiniuTempFile(4 * 1024 * 1024 + 10); + $resumeFile = tempnam(sys_get_temp_dir(), 'resume_file'); + $this->assertNotFalse($resumeFile); + list($ret, $error) = $upManager->putFile( + $token, + $key, + $tempFile, + null, + 'application/octet-stream', + false, + $resumeFile + ); + $this->assertNull($error); + $this->assertNotNull($ret['hash']); + unlink($resumeFile); + + $domain = getenv('QINIU_TEST_DOMAIN'); + $response = Client::get("http://$domain/$key"); + $this->assertEquals(200, $response->statusCode); + $this->assertEquals(md5_file($tempFile, true), md5($response->body(), true)); + unlink($tempFile); + } + + // public function test8M() + // { + // $key = 'resumePutFile8M'; + // $upManager = new UploadManager(); + // $token = $this->auth->uploadToken($this->bucketName, $key); + // $tempFile = qiniuTempFile(8*1024*1024+10); + // list($ret, $error) = $upManager->putFile($token, $key, $tempFile); + // $this->assertNull($error); + // $this->assertNotNull($ret['hash']); + // unlink($tempFile); + // } + + public function testFileWithFileType() + { + $config = new Config(); + $bucketManager = new BucketManager($this->auth, $config); + + $testCases = array( + array( + "fileType" => 1, + "name" => "IA" + ), + array( + "fileType" => 2, + "name" => "Archive" + ), + array( + "fileType" => 3, + "name" => "DeepArchive" + ) + ); + + foreach ($testCases as $testCase) { + $key = 'FileType'.$testCase["name"].rand(); + $police = array( + "fileType" => $testCase["fileType"], + ); + $token = $this->auth->uploadToken($this->bucketName, $key, 3600, $police); + $upManager = new UploadManager(); + list($ret, $error) = $upManager->putFile($token, $key, __file__, null, 'text/plain'); + $this->assertNull($error); + $this->assertNotNull($ret); + array_push(self::$keyToDelete, $key); + list($ret, $err) = $bucketManager->stat($this->bucketName, $key); + $this->assertNull($err); + $this->assertEquals($testCase["fileType"], $ret["type"]); + } + } + + public function testResumeUploadWithParams() + { + $key = "resumePutFile4ML_".rand(); + $upManager = new UploadManager(); + $policy = array('returnBody' => '{"hash":$(etag),"fname":$(fname),"var_1":$(x:var_1),"var_2":$(x:var_2)}'); + $token = $this->auth->uploadToken($this->bucketName, $key, 3600, $policy); + $tempFile = qiniuTempFile(4 * 1024 * 1024 + 10); + $resumeFile = tempnam(sys_get_temp_dir(), 'resume_file'); + $this->assertNotFalse($resumeFile); + list($ret, $error) = $upManager->putFile( + $token, + $key, + $tempFile, + ["x:var_1" => "val_1", "x:var_2" => "val_2", "x-qn-meta-m1" => "val_1", "x-qn-meta-m2" => "val_2"], + 'application/octet-stream', + false, + $resumeFile + ); + $this->assertNull($error); + $this->assertNotNull($ret['hash']); + $this->assertEquals("val_1", $ret['var_1']); + $this->assertEquals("val_2", $ret['var_2']); + $this->assertEquals(basename($tempFile), $ret['fname']); + unlink($resumeFile); + + $domain = getenv('QINIU_TEST_DOMAIN'); + $response = Client::get("http://$domain/$key"); + $this->assertEquals(200, $response->statusCode); + $this->assertEquals(md5_file($tempFile, true), md5($response->body(), true)); + $this->assertEquals("val_1", $response->headers()["X-Qn-Meta-M1"]); + $this->assertEquals("val_2", $response->headers()["X-Qn-Meta-M2"]); + unlink($tempFile); + } + + public function testResumeUploadV2() + { + $zone = new Zone(array('up.qiniup.com')); + $cfg = new Config($zone); + $upManager = new UploadManager($cfg); + $testFileSize = array( + config::BLOCK_SIZE / 2, + config::BLOCK_SIZE, + config::BLOCK_SIZE + 10, + config::BLOCK_SIZE * 2, + config::BLOCK_SIZE * 2.5 + ); + $partSize = 5 * 1024 * 1024; + foreach ($testFileSize as $item) { + $key = 'resumePutFile4ML_'.rand()."_"; + $token = $this->auth->uploadToken($this->bucketName, $key); + $tempFile = qiniuTempFile($item); + $resumeFile = tempnam(sys_get_temp_dir(), 'resume_file'); + $this->assertNotFalse($resumeFile); + list($ret, $error) = $upManager->putFile( + $token, + $key, + $tempFile, + null, + 'application/octet-stream', + false, + $resumeFile, + 'v2', + $partSize + ); + $this->assertNull($error); + $this->assertNotNull($ret['hash']); + unlink($resumeFile); + + $domain = getenv('QINIU_TEST_DOMAIN'); + $response = Client::get("http://$domain/$key"); + $this->assertEquals(200, $response->statusCode); + $this->assertEquals(md5_file($tempFile, true), md5($response->body(), true)); + unlink($tempFile); + } + } + + public function testResumeUploadV2WithParams() + { + $key = "resumePutFile4ML_".rand(); + $upManager = new UploadManager(); + $policy = array('returnBody' => '{"hash":$(etag),"fname":$(fname),"var_1":$(x:var_1),"var_2":$(x:var_2)}'); + $token = $this->auth->uploadToken($this->bucketName, $key, 3600, $policy); + $tempFile = qiniuTempFile(4 * 1024 * 1024 + 10); + $resumeFile = tempnam(sys_get_temp_dir(), 'resume_file'); + $this->assertNotFalse($resumeFile); + list($ret, $error) = $upManager->putFile( + $token, + $key, + $tempFile, + ["x:var_1" => "val_1", "x:var_2" => "val_2", "x-qn-meta-m1" => "val_1", "x-qn-meta-m2" => "val_2"], + 'application/octet-stream', + false, + $resumeFile, + 'v2' + ); + $this->assertNull($error); + $this->assertNotNull($ret['hash']); + $this->assertEquals("val_1", $ret['var_1']); + $this->assertEquals("val_2", $ret['var_2']); + $this->assertEquals(basename($tempFile), $ret['fname']); + unlink($resumeFile); + + $domain = getenv('QINIU_TEST_DOMAIN'); + $response = Client::get("http://$domain/$key"); + $this->assertEquals(200, $response->statusCode); + $this->assertEquals(md5_file($tempFile, true), md5($response->body(), true)); + $this->assertEquals("val_1", $response->headers()["X-Qn-Meta-M1"]); + $this->assertEquals("val_2", $response->headers()["X-Qn-Meta-M2"]); + unlink($tempFile); + } + + // valid versions are tested above + // Use PHPUnit's Data Provider to test multiple Exception is better, + // but not match the test style of this project + public function testResumeUploadWithInvalidVersion() + { + $zone = new Zone(array('up.qiniup.com')); + $cfg = new Config($zone); + $upManager = new UploadManager($cfg); + $testFileSize = config::BLOCK_SIZE * 2; + $partSize = 5 * 1024 * 1024; + $testInvalidVersions = array( + // High probability invalid versions + 'v', + '1', + '2' + ); + + $expectExceptionCount = 0; + foreach ($testInvalidVersions as $invalidVersion) { + $key = 'resumePutFile4ML_'.rand()."_"; + $token = $this->auth->uploadToken($this->bucketName, $key); + $tempFile = qiniuTempFile($testFileSize); + $resumeFile = tempnam(sys_get_temp_dir(), 'resume_file'); + $this->assertNotFalse($resumeFile); + try { + $upManager->putFile( + $token, + $key, + $tempFile, + null, + 'application/octet-stream', + false, + $resumeFile, + $invalidVersion, + $partSize + ); + } catch (\Exception $e) { + $isRightException = false; + $expectExceptionCount++; + while ($e) { + $isRightException = $e instanceof \UnexpectedValueException; + if ($isRightException) { + break; + } + $e = $e->getPrevious(); + } + $this->assertTrue($isRightException); + } + + unlink($resumeFile); + unlink($tempFile); + } + $this->assertEquals(count($testInvalidVersions), $expectExceptionCount); + } +} diff --git a/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ZoneTest.php b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ZoneTest.php new file mode 100644 index 0000000..cc5cce5 --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/Qiniu/Tests/ZoneTest.php @@ -0,0 +1,125 @@ +bucketName = $bucketName; + + global $bucketNameBC; + $this->bucketNameBC = $bucketNameBC; + + global $bucketNameNA; + $this->bucketNameNA = $bucketNameNA; + + global $bucketNameFS; + $this->bucketNameFS = $bucketNameFS; + + global $bucketNameAS; + $this->bucketNameAS = $bucketNameAS; + + global $accessKey; + $this->ak = $accessKey; + + $this->zone = new Zone(); + $this->zoneHttps = new Zone('https'); + } + + public function testUpHosts() + { + list($ret, $err) = Zone::queryZone($this->ak, 'fakebucket'); + $this->assertNull($ret); + $this->assertNotNull($err); + + $zone = Zone::queryZone($this->ak, $this->bucketName); + $this->assertContains('upload.qiniup.com', $zone->cdnUpHosts); + + $zone = Zone::queryZone($this->ak, $this->bucketNameBC); + $this->assertContains('upload-z1.qiniup.com', $zone->cdnUpHosts); + + $zone = Zone::queryZone($this->ak, $this->bucketNameFS); + $this->assertContains('upload-z2.qiniup.com', $zone->cdnUpHosts); + + $zone = Zone::queryZone($this->ak, $this->bucketNameNA); + $this->assertContains('upload-na0.qiniup.com', $zone->cdnUpHosts); + + $zone = Zone::queryZone($this->ak, $this->bucketNameAS); + $this->assertContains('upload-as0.qiniup.com', $zone->cdnUpHosts); + } + + public function testIoHosts() + { + $zone = Zone::queryZone($this->ak, $this->bucketName); + $this->assertEquals($zone->iovipHost, 'iovip.qbox.me'); + + $zone = Zone::queryZone($this->ak, $this->bucketNameBC); + $this->assertEquals($zone->iovipHost, 'iovip-z1.qbox.me'); + + $zone = Zone::queryZone($this->ak, $this->bucketNameFS); + $this->assertEquals($zone->iovipHost, 'iovip-z2.qbox.me'); + + $zone = Zone::queryZone($this->ak, $this->bucketNameNA); + $this->assertEquals($zone->iovipHost, 'iovip-na0.qbox.me'); + + $zone = Zone::queryZone($this->ak, $this->bucketNameAS); + $this->assertEquals($zone->iovipHost, 'iovip-as0.qbox.me'); + } + + public function testZonez0() + { + $zone = Zone::zonez0(); + $this->assertContains('upload.qiniup.com', $zone->cdnUpHosts); + } + + public function testZonez1() + { + $zone = Zone::zonez1(); + $this->assertContains('upload-z1.qiniup.com', $zone->cdnUpHosts); + } + + public function testZonez2() + { + $zone = Zone::zonez2(); + $this->assertContains('upload-z2.qiniup.com', $zone->cdnUpHosts); + } + + public function testZoneNa0() + { + $zone = Zone::zoneNa0(); + $this->assertContains('upload-na0.qiniup.com', $zone->cdnUpHosts); + } + + public function testZoneAs0() + { + $zone = Zone::zoneAs0(); + $this->assertContains('upload-as0.qiniup.com', $zone->cdnUpHosts); + } + + public function testQvmZonez0() + { + $zone = Zone::qvmZonez0(); + $this->assertContains('free-qvm-z0-xs.qiniup.com', $zone->srcUpHosts); + } + + public function testQvmZonez1() + { + $zone = Zone::qvmZonez1(); + $this->assertContains('free-qvm-z1-zz.qiniup.com', $zone->srcUpHosts); + } +} diff --git a/vendor/qiniu/php-sdk/tests/bootstrap.php b/vendor/qiniu/php-sdk/tests/bootstrap.php new file mode 100644 index 0000000..9859a81 --- /dev/null +++ b/vendor/qiniu/php-sdk/tests/bootstrap.php @@ -0,0 +1,61 @@ + 0) { + $length = min($rest_size, 4 * 1024); + if (fwrite($file, random_bytes($length)) == false) { + return false; + } + $rest_size -= $length; + } + } else if ($size > 0) { + fseek($file, $size - 1); + fwrite($file, ' '); + } + fclose($file); + return $fileName; +} diff --git a/vendor/ralouphie/getallheaders/LICENSE b/vendor/ralouphie/getallheaders/LICENSE new file mode 100644 index 0000000..be5540c --- /dev/null +++ b/vendor/ralouphie/getallheaders/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Ralph Khattar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/ralouphie/getallheaders/README.md b/vendor/ralouphie/getallheaders/README.md new file mode 100644 index 0000000..9430d76 --- /dev/null +++ b/vendor/ralouphie/getallheaders/README.md @@ -0,0 +1,27 @@ +getallheaders +============= + +PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3. + +[![Build Status](https://travis-ci.org/ralouphie/getallheaders.svg?branch=master)](https://travis-ci.org/ralouphie/getallheaders) +[![Coverage Status](https://coveralls.io/repos/ralouphie/getallheaders/badge.png?branch=master)](https://coveralls.io/r/ralouphie/getallheaders?branch=master) +[![Latest Stable Version](https://poser.pugx.org/ralouphie/getallheaders/v/stable.png)](https://packagist.org/packages/ralouphie/getallheaders) +[![Latest Unstable Version](https://poser.pugx.org/ralouphie/getallheaders/v/unstable.png)](https://packagist.org/packages/ralouphie/getallheaders) +[![License](https://poser.pugx.org/ralouphie/getallheaders/license.png)](https://packagist.org/packages/ralouphie/getallheaders) + + +This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php). + +## Install + +For PHP version **`>= 5.6`**: + +``` +composer require ralouphie/getallheaders +``` + +For PHP version **`< 5.6`**: + +``` +composer require ralouphie/getallheaders "^2" +``` diff --git a/vendor/ralouphie/getallheaders/composer.json b/vendor/ralouphie/getallheaders/composer.json new file mode 100644 index 0000000..de8ce62 --- /dev/null +++ b/vendor/ralouphie/getallheaders/composer.json @@ -0,0 +1,26 @@ +{ + "name": "ralouphie/getallheaders", + "description": "A polyfill for getallheaders.", + "license": "MIT", + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^5 || ^6.5", + "php-coveralls/php-coveralls": "^2.1" + }, + "autoload": { + "files": ["src/getallheaders.php"] + }, + "autoload-dev": { + "psr-4": { + "getallheaders\\Tests\\": "tests/" + } + } +} diff --git a/vendor/ralouphie/getallheaders/src/getallheaders.php b/vendor/ralouphie/getallheaders/src/getallheaders.php new file mode 100644 index 0000000..c7285a5 --- /dev/null +++ b/vendor/ralouphie/getallheaders/src/getallheaders.php @@ -0,0 +1,46 @@ + 'Content-Type', + 'CONTENT_LENGTH' => 'Content-Length', + 'CONTENT_MD5' => 'Content-Md5', + ); + + foreach ($_SERVER as $key => $value) { + if (substr($key, 0, 5) === 'HTTP_') { + $key = substr($key, 5); + if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) { + $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key)))); + $headers[$key] = $value; + } + } elseif (isset($copy_server[$key])) { + $headers[$copy_server[$key]] = $value; + } + } + + if (!isset($headers['Authorization'])) { + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { + $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; + } elseif (isset($_SERVER['PHP_AUTH_USER'])) { + $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : ''; + $headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass); + } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) { + $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST']; + } + } + + return $headers; + } + +}