inshore / bookwhen
Bookwhen API SDK,为PHP应用程序提供即插即用的Bookwhen预订平台访问。
Requires
- php: ^8.1 || ^8.2
- guzzlehttp/guzzle: ^7.0
- monolog/monolog: ^3.0
- php-http/discovery: ^1.0
- psr/http-client: ^1.0
- psr/http-client-implementation: *
- psr/http-factory-implementation: *
- psr/http-message: ^1.0
- respect/validation: ^2.0
- symfony/http-client: ^6.2
Requires (Dev)
- phpunit/phpunit: ^10.0
- dev-develop
- dev-master / 1.0.x-dev
- 0.9.18
- 0.9.17
- 0.9.16
- 0.9.15
- 0.9.14
- 0.9.13
- 0.9.12
- 0.9.11
- 0.9.10
- 0.9.9
- 0.9.8
- 0.9.7
- 0.9.6
- 0.9.5
- 0.9.4
- 0.9.3
- 0.9.2
- 0.9.1
- 0.9.0
- 0.8.6
- 0.8.5
- 0.8.1
- 0.6.0
- 0.5.2
- 0.5.1
- 0.5.0
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- v0.0.1
- dev-mr-example
- dev-main
- dev-release/0.9.18
- dev-release/0.9.17
- dev-release/0.9.16
- dev-release/0.9.15
- dev-inshore-patch-1
- dev-release/0.9.1.4
- dev-release/0.9.14
- dev-release/0.9.13
- dev-release/0.9.12
- dev-release/0.9.11
- dev-release/0.9.10
- dev-release/0.9.9
- dev-release/0.9.8
- dev-release/0.9.7
- dev-release/0.9.6
- dev-release/0.9.5
- dev-release/0.9.4
- dev-release/0.9.3
- dev-release/0.9.2
- dev-release/0.9.1
- dev-release/0.9.0
- dev-release/0.8.2
- dev-release/0.8.5
- dev-release/0.8.6
- dev-release-0.8.5
- dev-release/0.8.1
- dev-release/0.6.0
- dev-release/0/6/0
- dev-release/0.5.2
- dev-release/0.5.1
- dev-release/0.5.0
- dev-release/0.3.4
- dev-release/0.3.3
- dev-release/0.3.2
- dev-release/0.3.1
- dev-available
- dev-release/0.3.0
- dev-scrutinizer
- dev-17280206-alphabet-order
- dev-17251369-includeTesting
- dev-17228800-resource-check-for-getEvents
- dev-17228788-TitleValidation
- dev-release/0.2.2
- dev-17228405-validation-exceptions
- dev-logging
- dev-exceptions
- dev-release/0.2.1
- dev-release/0.2.0
- dev-travis
- dev-release/0.1.3
- dev-1369906-documentation
- dev-release/0.1.2
- dev-17124691-get-attachment
- dev-17124690-get-event
- dev-release/0.1.1
- dev-release/0.1.0
- dev-17029182-get-events
This package is auto-updated.
Last update: 2024-10-03 12:41:07 UTC
README
Bookwhen API的SDK套件。
安装
要求
PHP 8.1及以后版本。
Composer
$ composer require inshore/bookwhen
用法
只需将Bookwhen API密钥作为环境属性暴露出来
INSHORE_BOOKWHEN_API_KEY
通过 .env 或您喜欢的其他方式。
$bookwhen = new Bookwhen();
附件
实现 https://api.bookwhen.com/v2#tag/Attachment
附件
https://api.bookwhen.com/v2#tag/Attachment/paths/~1attachments/get
// Fetch attachments accessible by the API token. $attachments = $bookwhen->attachments());
过滤器
可以将过滤器参数作为函数参数传递。
title - 根据文件标题文本进行筛选。
fileName - 根据文件名进行筛选。
fileType - 根据文件类型进行筛选。
// Fetch attachments accessible by the API token. $attachments = $bookwhen->attachments(fileName: 'CV')); $attachments = $bookwhen->attachments(fileType: 'pdf')); $attachments = $bookwhen->attachments(title: 'Title to filter by')); $attachments = $bookwhen->attachments(fileName: 'CV', fileType: 'pdf', title: 'Title to filter by'));
附件
https://api.bookwhen.com/v2#tag/Attachment/paths/1attachments1%7Battachment_id%7D/g
// Returns the attachment for the provided attachment ID.
$attachment = $bookwhen->attachment('ev-smij-20200530100000' );
###类通行证
实现 https://api.bookwhen.com/v2#tag/ClassPass
ClassPasses
https://api.bookwhen.com/v2#tag/ClassPass/paths/~1class_passes/get
// Fetch class passes accessible by the API token. $classPasses = $bookwhen->classPasses());
过滤器
可以将过滤器参数作为函数参数传递
title - 根据通行证的标题文本进行筛选。
detail - 根据细节文本进行筛选。
usageType - 根据通行证类型进行筛选:个人或任何。
cost - 根据成本进行筛选,可以使用精确值或使用比较运算符。例如,filter[cost][gte]=2000
gt - 大于
gte - 大于或等于
lt - 小于
lte - 小于或等于
eq - 等于
usageAllowance - 根据通行证使用权限进行筛选。这也可以接受比较运算符,如cost。
useRestrictedForDays - 根据通行证天数限制进行筛选。这也可以接受比较运算符,如cost。
// Fetch class passes accessible by the API token. $classPasses = $bookwhen->classPasses()); $classPasses = $bookwhen->classPasses(title: 'Title to filter by'));
ClassPass
https://api.bookwhen.com/v2#tag/ClassPass/paths/~1class_passes~1%7Bclass_pass_id%7D/get
// Returns the class pass for the provided class pass ID. $classPass = $bookwhen->classPass('ev-smij-20200530100000');
活动
https://api.bookwhen.com/v2#tag/Event
活动
https://api.bookwhen.com/v2#tag/Event/paths/~1events/get
// Returns the event for the provided event ID. $event = $bookwhen->events();
过滤器
calendar - 限制在给定的日历(时间表页面)上的活动。
entry - 限制在给定的条目上。
location - 包含位置slugs的数组。
tag - 包含标签单词的数组。
title - 要搜索的条目标题数组。
detail - 要搜索的条目细节数组。
from - 以YYYYMMDD或YYYYMMDDHHMISS格式的包含时间来检索事件。默认为今天。
to - 以YYYYMMDD或YYYYMMDDHHMISS格式的非包含时间来检索事件,直到该时间。
compact - 布尔值:将课程中的活动合并为单个虚拟事件。
包括
默认情况下,事件将不会包含其附件、位置和票务信息。
要检索包含所需关系的活动,只需传递所需的布尔值true。
includeAttachments includeLocation includeTickets includeTickets.class_passes includeTickets.events
例如,要检索包含其位置和票务的事件。
// Returns the event for the provided event ID. $event = $bookwhen->events(title: 'Title to filter by'));
活动
https://api.bookwhen.com/v2#tag/Event/paths/1events1%7Bevent_id%7D/get
// Returns the event for the provided event ID. $event = $bookwhen->event('ev-smij-20200530100000');
// Returns the event for the provided event ID. $event = $bookwhen->event(eventId: 'ev-smij-20200530100000', includeLocation: true, includeTickets: true);
###事件###
// Fetch events accessible by the API token. $events = $bookwhen->events());
过滤器
事件列表可以根据API文档进行筛选
包括
默认情况下,事件将不会包含其附件、位置和票务信息。
要检索包含所需关系的活动,只需传递所需的布尔值true。
includeAttachments includeLocation includeTickets.class_passes includeTickets.events
例如,要检索包含其位置和票务的事件。
// Fetch events accessible by the API token. $events = $bookwhen->events(location: true, includeTickets: true);));
位置
实现了 https://api.bookwhen.com/v2#tag/Location
位置
https://api.bookwhen.com/v2#tag/Location/paths/~1locations/get
// Fetch events accessible by the API token. $locations = $bookwhen->locations()); // Returns the location for the provided location ID.
过滤器
addressText - 限制包含地址文本的地点。
additionalInfo - 通过附加信息中包含的文本进行筛选。
// Fetch events accessible by the API token. $locations = $bookwhen->locations(addressText: 'Remote')); // Returns the location for the provided location ID.
地点
https://api.bookwhen.com/v2#tag/Location/paths/1locations1%7Blocation_id%7D/get
// Returns the location for the provided location ID. $location = $bookwhen->location('ev-smij-20200530100000');
门票
实现了 https://api.bookwhen.com/v2#tag/Ticket
门票
https://api.bookwhen.com/v2#tag/Ticket/paths/~1tickets/get
// Fetch tickets for the given event. $eventId = 'ev-smij-20200530100000'; $client->tickets($eventId);
包括
默认情况下,门票将不会填充其附件、事件和地点。
要检索包含所需关系的活动,只需传递所需的布尔值true。
includeAttachments includeLocation includeTickets.class_passes includeTickets.events
// Fetch tickets for the given event. $eventId = 'ev-smij-20200530100000'; $client->tickets($eventId, includeAttachments: true);
门票
https://api.bookwhen.com/v2#tag/Ticket/paths/1tickets1%7Bticket_id%7D/get
// Retrieve a single ticket. $ticketId = 'ti-sboe-20200320100000-tk1m'; $client->ticket($ticketId);
包括
默认情况下,门票将不会填充其附件、事件和地点。
要检索包含所需关系的活动,只需传递所需的布尔值true。
includeAttachments includeLocation includeTickets.class_passes includeTickets.events
// Retrieve a single ticket. $client->ticket('ti-sboe-20200320100000-tk1m', includeAttachments: true););
日志记录
提供完整的syslog级别日志记录,可以通过在实例化Client时传递一个级别来启用。如RFC 5424所示,该协议描述了syslog协议,以下为应用的强度级别。
DEBUG:详细的调试信息。INFO:处理正常事件。例如:SQL日志 NOTICE:处理正常事件,但包含更重要的事件 WARNING:警告状态,在此变为错误之前应采取行动。ERROR:错误状态,表示有问题需要您立即采取行动 CRITICAL:关键状态。例如:系统组件不可用 ALERT:应立即采取行动。这应该触发一些警报并在夜间唤醒您。EMERGENCY:当系统不可用时使用。
$bookwhen = new Bookwhen()->debug('Debug');
测试
WIP
$ composer phpunit
贡献
有关详细信息,请参阅 https://github.com/inshore/bookwhen/blob/develop/CONTRIBUTING.md
支持
如果您需要在此包、在自己的项目或业务中实施帮助...
<script type="text/javascript" src="https://cdnjs.buymeacoffee.com/1.0.0/button.prod.min.js" data-name="bmc-button" data-slug="danielmullin" data-color="#FFDD00" data-emoji="" data-font="Cookie" data-text="Buy me a coffee" data-outline-color="#000000" data-font-color="#000000" data-coffee-color="#ffffff" ></script>https://www.buymeacoffee.com/danielmullin
鸣谢
- Daniel Mullin inshore@danielmullin.com
- Brandon Lubbehusen inshore@danielmullin.com
此包深受Nuno Maduro和https://github.com/openai-php/client包的影响。
许可
MIT https://github.com/inshore/bookwhen/blob/master/LICENSE.md