gaming-engine / sendportal-api-client
SendPortal.IO 的 API 客户端
1.0.0
2021-10-26 21:27 UTC
Requires
- php: ^8.0|^8.1
- guzzlehttp/guzzle: ^7.4
- spatie/data-transfer-object: ^3.7
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-06 12:50:02 UTC
README
A simple wrapper around the SendPortal.IO Version 2 API.
安装
您可以通过 composer 安装此包
composer require gaming-engine/sendportal-api-client
用法
此库最好与依赖注入库一起使用,但也可以不使用它来实例化。
您可以使用几个客户端,每个客户端对应 API 提供的每种端点类型。以下
客户端如下
GamingEngine\SendPortalAPI\Clients\CampaignClientGamingEngine\SendPortalAPI\Clients\SubscriberClientGamingEngine\SendPortalAPI\Clients\SubscriberTagClientGamingEngine\SendPortalAPI\Clients\TagClientGamingEngine\SendPortalAPI\Clients\TagSubscriberClientGamingEngine\SendPortalAPI\Clients\TemplateClient
有关 API 请求参数的更多详细信息,请参阅文档。
检索
use GamingEngine\SendPortalAPI\Clients\ApiClient; use GamingEngine\SendPortalAPI\Clients\CampaignClient; use GamingEngine\SendPortalAPI\Http\GuzzleHttpClient; use GamingEngine\SendPortalAPI\Models\Configuration; use GuzzleHttp\Client; require_once './vendor/autoload.php'; $apiClient = new ApiClient( new Configuration('https://sendportal.domain.tld', 'bearer-token'), new GuzzleHttpClient( new Client() ) ); $specific = new CampaignClient($apiClient); var_dump($specific->retrieve());
创建/更新
use GamingEngine\SendPortalAPI\Clients\ApiClient; use GamingEngine\SendPortalAPI\Clients\CampaignClient; use GamingEngine\SendPortalAPI\DataTransfer\CampaignDTO; use GamingEngine\SendPortalAPI\Http\GuzzleHttpClient; use GamingEngine\SendPortalAPI\Models\Configuration; use GuzzleHttp\Client; require_once './vendor/autoload.php'; $apiClient = new ApiClient( new Configuration('https://sendportal.domain.tld', 'bearer-token'), new GuzzleHttpClient( new Client() ) ); $specific = new CampaignClient($apiClient); $dto = new CampaignDTO([ 'name' => 'Hello', // All fields ]); // Provides the newly created campaign var_dump($specific->create($dto)); // Provides the newly updated campaign var_dump($specific->update(2, $dto));
测试
composer test
变更日志
请参阅CHANGELOG 获取有关最近更改的更多信息。
贡献
请参阅CONTRIBUTING 了解详情。
安全
如果您发现任何安全相关的问题,请通过电子邮件awjudd@gmail.com 而不是使用问题跟踪器。
鸣谢
许可
MIT 许可证 (MIT)。请参阅许可文件 获取更多信息。