paypaplane/svix-client

Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix

1.0.1 2023-10-30 04:31 UTC

This package is not auto-updated.

Last update: 2024-05-14 05:10:18 UTC


README

Welcome to the Svix API documentation!

Useful links: Homepage | Support email | Blog | Slack Community

Introduction

This is the reference documentation and schemas for the Svix webhook service API. For tutorials and other documentation please refer to the documentation.

Main concepts

In Svix you have four important entities you will be interacting with:

  • messages: these are the webhooks being sent. They can have contents and a few other properties.
  • application: this is where messages are sent to. Usually you want to create one application for each user on your platform.
  • endpoint: endpoints are the URLs messages will be sent to. Each application can have multiple endpoints and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type).
  • event-type: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint.

Authentication

Get your authentication token (AUTH_TOKEN) from the Svix dashboard and use it as part of the Authorization header as such: Authorization: Bearer ${AUTH_TOKEN}. For more information on authentication, please refer to the authentication token docs.

Code samples

The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to the documentation.

Idempotency

Svix supports idempotency for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response.

To perform an idempotent request, pass the idempotency key in the Idempotency-Key header to the request. The idempotency key should be a unique value generated by the client. You can create the key in however way you like, though we suggest using UUID v4, or any other string with enough entropy to avoid collisions.

Svix's idempotency works by saving the resulting status code and body of the first request made for any given idempotency key for any successful request. Subsequent requests with the same key return the same result.

Please note that idempotency is only supported for POST requests.

Cross-Origin Resource Sharing

This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with W3C spec. And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.

Installation & Usage

Requirements

PHP 7.4 and later. Should also work with PHP 8.0.

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?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 Endpoints

All URIs are relative to https://api.eu.svix.com

Class Method HTTP request Description
ApplicationApi v1ApplicationCreate POST /api/v1/app/ Create Application
ApplicationApi v1ApplicationDelete DELETE /api/v1/app/{app_id}/ Delete Application
ApplicationApi v1ApplicationGet GET /api/v1/app/{app_id}/ Get Application
ApplicationApi v1ApplicationList GET /api/v1/app/ List Applications
ApplicationApi v1ApplicationPatch PATCH /api/v1/app/{app_id}/ Patch Application
ApplicationApi v1ApplicationUpdate PUT /api/v1/app/{app_id}/ Update Application
AuthenticationApi v1AuthenticationAppPortalAccess POST /api/v1/auth/app-portal-access/{app_id}/ Get Consumer App Portal Access
AuthenticationApi v1AuthenticationDashboardAccess POST /api/v1/auth/dashboard-access/{app_id}/ Dashboard Access
AuthenticationApi v1AuthenticationExpireAll POST /api/v1/auth/app/{app_id}/expire-all/ Expire All
AuthenticationApi v1AuthenticationLogout POST /api/v1/auth/logout/ Logout
BackgroundTasksApi getBackgroundTask GET /api/v1/background-task/{task_id}/ Get Background Task
BackgroundTasksApi listBackgroundTasks GET /api/v1/background-task/ List Background Tasks
EndpointApi v1EndpointCreate POST /api/v1/app/{app_id}/endpoint/ Create Endpoint
EndpointApi v1EndpointDelete DELETE /api/v1/app/{app_id}/endpoint/{endpoint_id}/ Delete Endpoint
EndpointApi v1EndpointGet GET /api/v1/app/{app_id}/endpoint/{endpoint_id}/ Get Endpoint
EndpointApi v1EndpointGetHeaders GET /api/v1/app/{app_id}/endpoint/{endpoint_id}/headers/ Get Endpoint Headers
EndpointApi v1EndpointGetSecret GET /api/v1/app/{app_id}/endpoint/{endpoint_id}/secret/ Get Endpoint Secret
EndpointApi v1EndpointGetStats GET /api/v1/app/{app_id}/endpoint/{endpoint_id}/stats/ Endpoint Stats
EndpointApi v1EndpointList GET /api/v1/app/{app_id}/endpoint/ List Endpoints
EndpointApi v1EndpointPatch PATCH /api/v1/app/{app_id}/endpoint/{endpoint_id}/ Patch Endpoint
EndpointApi v1EndpointPatchHeaders PATCH /api/v1/app/{app_id}/endpoint/{endpoint_id}/headers/ Patch Endpoint Headers
EndpointApi v1EndpointRecover POST /api/v1/app/{app_id}/endpoint/{endpoint_id}/recover/ Recover Failed Webhooks
EndpointApi v1EndpointReplay POST /api/v1/app/{app_id}/endpoint/{endpoint_id}/replay-missing/ Replay Missing Webhooks
EndpointApi v1EndpointRotateSecret POST /api/v1/app/{app_id}/endpoint/{endpoint_id}/secret/rotate/ Rotate Endpoint Secret
EndpointApi v1EndpointSendExample POST /api/v1/app/{app_id}/endpoint/{endpoint_id}/send-example/ Send Event Type Example Message
EndpointApi v1EndpointTransformationGet GET /api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation/ Get Endpoint Transformation
EndpointApi v1EndpointTransformationPartialUpdate PATCH /api/v1/app/{app_id}/endpoint/{endpoint_id}/transformation/ Set Endpoint Transformation
EndpointApi v1EndpointUpdate PUT /api/v1/app/{app_id}/endpoint/{endpoint_id}/ Update Endpoint
EndpointApi v1EndpointUpdateHeaders PUT /api/v1/app/{app_id}/endpoint/{endpoint_id}/headers/ Update Endpoint Headers
EventTypeApi v1EventTypeCreate POST /api/v1/event-type/ Create Event Type
EventTypeApi v1EventTypeDelete DELETE /api/v1/event-type/{event_type_name}/ Delete Event Type
EventTypeApi v1EventTypeGet GET /api/v1/event-type/{event_type_name}/ Get Event Type
EventTypeApi v1EventTypeImportOpenapi POST /api/v1/event-type/import/openapi/ Event Type Import From Openapi
EventTypeApi v1EventTypeList GET /api/v1/event-type/ List Event Types
EventTypeApi v1EventTypePatch PATCH /api/v1/event-type/{event_type_name}/ Patch Event Type
EventTypeApi v1EventTypeUpdate PUT /api/v1/event-type/{event_type_name}/ Update Event Type
HealthApi v1HealthGet GET /api/v1/health/ Health
IntegrationApi v1IntegrationCreate POST /api/v1/app/{app_id}/integration/ Create Integration
IntegrationApi v1IntegrationDelete DELETE /api/v1/app/{app_id}/integration/{integ_id}/ Delete Integration
IntegrationApi v1IntegrationGet GET /api/v1/app/{app_id}/integration/{integ_id}/ Get Integration
IntegrationApi v1IntegrationGetKey GET /api/v1/app/{app_id}/integration/{integ_id}/key/ Get Integration Key
IntegrationApi v1IntegrationList GET /api/v1/app/{app_id}/integration/ List Integrations
IntegrationApi v1IntegrationRotateKey POST /api/v1/app/{app_id}/integration/{integ_id}/key/rotate/ Rotate Integration Key
IntegrationApi v1IntegrationUpdate PUT /api/v1/app/{app_id}/integration/{integ_id}/ Update Integration
MessageApi v1MessageCreate POST /api/v1/app/{app_id}/msg/ Create Message
MessageApi v1MessageExpungeContent DELETE /api/v1/app/{app_id}/msg/{msg_id}/content/ Delete message payload
MessageApi v1MessageGet GET /api/v1/app/{app_id}/msg/{msg_id}/ Get Message
MessageApi v1MessageList GET /api/v1/app/{app_id}/msg/ List Messages
MessageAttemptApi v1MessageAttemptExpungeContent DELETE /api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}/content/ Delete attempt response body
MessageAttemptApi v1MessageAttemptGet GET /api/v1/app/{app_id}/msg/{msg_id}/attempt/{attempt_id}/ Get Attempt
MessageAttemptApi v1MessageAttemptListAttemptedDestinations GET /api/v1/app/{app_id}/msg/{msg_id}/endpoint/ List Attempted Destinations
MessageAttemptApi v1MessageAttemptListAttemptedMessages GET /api/v1/app/{app_id}/endpoint/{endpoint_id}/msg/ List Attempted Messages
MessageAttemptApi v1MessageAttemptListByEndpoint GET /api/v1/app/{app_id}/attempt/endpoint/{endpoint_id}/ List Attempts By Endpoint
MessageAttemptApi v1MessageAttemptListByEndpointDeprecated GET /api/v1/app/{app_id}/msg/{msg_id}/endpoint/{endpoint_id}/attempt/ List Attempts For Endpoint
MessageAttemptApi v1MessageAttemptListByMsg GET /api/v1/app/{app_id}/attempt/msg/{msg_id}/ List Attempts By Msg
MessageAttemptApi v1MessageAttemptListByMsgDeprecated GET /api/v1/app/{app_id}/msg/{msg_id}/attempt/ List Attempts
MessageAttemptApi v1MessageAttemptResend POST /api/v1/app/{app_id}/msg/{msg_id}/endpoint/{endpoint_id}/resend/ Resend Webhook
StatisticsApi calculateAggregateAppStats POST /api/v1/stats/usage/app/ Calculate Aggregate App Stats

Models

Authorization

Authentication schemes defined for the API:

HTTPBearer

  • Type: Bearer authentication

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 1.13.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen