paypaplane / svix-client
欢迎使用Svix API文档!有用链接:[主页](https://www.svix.com) | [支持邮箱](mailto:support+docs@svix.com) | [博客](https://www.svix.com/blog/) | [Slack社区](https://www.svix.com/slack/) # 简介 这是Svix的参考文档和架构
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
This package is not auto-updated.
Last update: 2024-09-17 06:37:55 UTC
README
欢迎使用Svix API文档!
简介
这是Svix webhook服务API的参考文档和架构。有关教程和其他文档,请参阅文档。
主要概念
在Svix中,您将交互四个重要的实体:
messages
:这些是发送的webhooks。它们可以包含内容和一些其他属性。application
:这是messages
发送到的地方。通常,您希望在您的平台上为每个用户创建一个应用程序。endpoint
:端点是消息将被发送到的URL。每个应用程序可以有多个endpoints
,并且发送到该应用程序的每条消息都将发送到所有这些端点(除非它们没有订阅发送的事件类型)。event-type
:事件类型是标识符,表示发送的消息类型。事件类型主要用于决定哪些事件被发送到哪些端点。
身份验证
从Svix仪表板获取您的身份验证令牌(AUTH_TOKEN
),并将其用作Authorization
头的一部分,如下所示:Authorization: Bearer ${AUTH_TOKEN}
。有关身份验证的更多信息,请参阅身份验证令牌文档。
代码示例
代码示例假设您已经安装了相应的库,并且知道如何使用它们。有关如何执行此操作的最新信息,请参阅文档。
幂等性
Svix支持幂等性,可以安全地重试请求,而不会意外执行相同的操作两次。这在API调用在传输过程中中断且未收到响应时非常有用。
要执行幂等请求,请将幂等性键传递到请求的Idempotency-Key
头中。幂等性键应由客户端生成的一个唯一值。您可以通过任何方式创建该键,但我们建议使用UUID v4或任何其他具有足够熵的字符串,以避免冲突。
Svix的幂等性通过为任何给定的幂等性键保存任何成功请求的第一个请求的结果状态码和主体来实现。具有相同键的后续请求返回相同的结果。
请注意,幂等性仅支持POST
请求。
CORS(跨源资源共享)
该API支持符合 W3C 规范 的跨域资源共享(CORS),允许浏览器进行跨域通信。所有响应都有一个通配符同源,这使得它们完全公开且对每个人(包括任何网站的任何代码)都可用。
安装与使用
要求
PHP 7.4 及以上版本。也适用于 PHP 8.0。
Composer
要使用 Composer 安装绑定,请将以下内容添加到 composer.json
{ "repositories": [ { "type": "vcs", "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" } ], "require": { "GIT_USER_ID/GIT_REPO_ID": "*@dev" } }
然后运行 composer install
手动安装
下载文件并包含 autoload.php
<?php require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');
入门
请按照 安装过程 操作,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Bearer authorization: HTTPBearer $config = Svix\ApiClient\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Svix\ApiClient\Api\ApplicationApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $application_in = new \Svix\ApiClient\Model\ApplicationIn(); // \Svix\ApiClient\Model\ApplicationIn $get_if_exists = false; // bool | Get an existing application, or create a new one if doesn't exist. It's two separate functions in the libs. $idempotency_key = 'idempotency_key_example'; // string | The request's idempotency key try { $result = $apiInstance->v1ApplicationCreate($application_in, $get_if_exists, $idempotency_key); print_r($result); } catch (Exception $e) { echo 'Exception when calling ApplicationApi->v1ApplicationCreate: ', $e->getMessage(), PHP_EOL; }
API 端点
所有 URI 都是相对于 https://api.eu.svix.com
模型
- AppPortalAccessIn
- AppPortalAccessOut
- AppUsageStatsIn
- AppUsageStatsOut
- ApplicationIn
- ApplicationOut
- ApplicationPatch
- ApplicationTokenExpireIn
- BackgroundTaskOut
- BackgroundTaskStatus
- BackgroundTaskType
- DashboardAccessOut
- EndpointCreatedEvent
- EndpointCreatedEventData
- EndpointDeletedEvent
- EndpointDeletedEventData
- EndpointDisabledEvent
- EndpointDisabledEventData
- EndpointHeadersIn
- EndpointHeadersOut
- EndpointHeadersPatchIn
- EndpointIn
- EndpointMessageOut
- EndpointOut
- EndpointPatch
- EndpointSecretOut
- EndpointSecretRotateIn
- EndpointStats
- EndpointTransformationIn
- EndpointTransformationOut
- EndpointTransformationSimulateIn
- EndpointTransformationSimulateOut
- EndpointUpdate
- EndpointUpdatedEvent
- EndpointUpdatedEventData
- EventExampleIn
- EventTypeImportOpenApiIn
- EventTypeImportOpenApiOut
- EventTypeImportOpenApiOutData
- EventTypeIn
- EventTypeOut
- EventTypePatch
- EventTypeUpdate
- ExportEventTypeOut
- HTTPValidationError
- HttpErrorOut
- IntegrationIn
- IntegrationKeyOut
- IntegrationOut
- IntegrationUpdate
- ListResponseApplicationOut
- ListResponseBackgroundTaskOut
- ListResponseEndpointMessageOut
- ListResponseEndpointOut
- ListResponseEventTypeOut
- ListResponseIntegrationOut
- ListResponseMessageAttemptEndpointOut
- ListResponseMessageAttemptOut
- ListResponseMessageEndpointOut
- ListResponseMessageOut
- ListResponseTemplateOut
- MessageAttemptEndpointOut
- MessageAttemptExhaustedEvent
- MessageAttemptExhaustedEventData
- MessageAttemptFailedData
- MessageAttemptFailingEvent
- MessageAttemptFailingEventData
- MessageAttemptOut
- MessageAttemptRecoveredEvent
- MessageAttemptRecoveredEventData
- MessageAttemptTriggerType
- MessageBroadcastIn
- MessageBroadcastOut
- MessageEndpointOut
- MessageIn
- MessageOut
- MessageRawPayloadOut
- MessageStatus
- OauthPayloadIn
- OauthPayloadOut
- OneTimeTokenIn
- OneTimeTokenOut
- 排序
- RecoverIn
- RecoverOut
- ReplayIn
- ReplayOut
- StatusCodeClass
- TemplateIn
- TemplateOut
- TemplatePatch
- TemplateUpdate
- TransformationHttpMethod
- TransformationSimulateIn
- TransformationSimulateOut
- TransformationTemplateKind
- ValidationError
授权
为API定义的认证方案
HTTPBearer
- 类型:Bearer 认证
测试
要运行测试,请使用
composer install vendor/bin/phpunit
作者
关于此包
此PHP包由 OpenAPI Generator 项目自动生成
- API版本:
1.13.0
- 构建包:
org.openapitools.codegen.languages.PhpClientCodegen