fitzgibbonjack / pandadoc
PandaDoc SDK
dev-master
2022-09-14 10:01 UTC
Requires
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^6.2.2
- squizlabs/php_codesniffer: ^3.0
This package is not auto-updated.
Last update: 2024-09-26 18:30:54 UTC
README
此库为PandaDoc的REST API提供了便捷的包装函数。API文档在此处记录。
需求
安装
依赖项由Composer管理。安装Composer后,从库根目录运行以下命令
composer install --no-dev --ignore-platform-reqs
或者使用phpunit进行安装
composer install
使用文档
<?php require 'vendor/autoload.php'; $accessToken = 'your-access-token'; $documents = new Documents($accessToken); // List all the documents. $data = $documents->list(); // Search for a document. $filter = [ 'q' => 'Search string here' ]; $data = $documents->list($filter); // Show document details. $data = $documents->details('documentID'); // Show document state. $data = $documents->status('documentID'); // Download a document $data = $documents->download('documentID', "destination-path");
使用模板
<?php require 'vendor/autoload.php'; $accessToken = 'your-access-token'; $templates = new Templates($accessToken); // List all the templates. $data = $templates->list(); // Show template details. $data =$templates->details('templateID');
刷新访问令牌
<?php require 'vendor/autoload.php'; $accessToken = 'your-access-token'; // Refresh access token $auth = new Auth(); $client_id = 'your-client-id'; $client_secret = 'your-secret'; $refresh_token = 'your-refresh-token'; // Show new tokens. $data = $auth->refreshAccessToken($client_id, $client_secret, $refresh_token);