Skip to content

Latest commit

 

History

History
292 lines (208 loc) · 12.7 KB

File metadata and controls

292 lines (208 loc) · 12.7 KB

Events

(events)

Overview

REST APIs for managing events captured by a speakeasy binary (CLI, GitHub Action etc)

Available Operations

  • getEventsByTarget - Load recent events for a particular workspace
  • getTargets - Load targets for a particular workspace
  • getTargetsDeprecated - Load targets for a particular workspace
  • post - Post events for a specific workspace
  • search - Search events for a particular workspace by any field

getEventsByTarget

Load recent events for a particular workspace

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Operations;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '<YOUR_API_KEY_HERE>',
        )
    )
    ->build();

$request = new Operations\GetWorkspaceEventsByTargetRequest(
    targetId: '<id>',
    workspaceId: '<id>',
);

$response = $sdk->events->getEventsByTarget(
    request: $request
);

if ($response->cliEventBatch !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\GetWorkspaceEventsByTargetRequest ✔️ The request object to use for the request.

Response

?Operations\GetWorkspaceEventsByTargetResponse

Errors

Error Type Status Code Content Type
Errorors\Error 5XX application/json
Errorors\SDKException 4XX */*

getTargets

Load targets for a particular workspace

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Operations;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '<YOUR_API_KEY_HERE>',
        )
    )
    ->build();

$request = new Operations\GetWorkspaceTargetsRequest();

$response = $sdk->events->getTargets(
    request: $request
);

if ($response->targetSDKList !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\GetWorkspaceTargetsRequest ✔️ The request object to use for the request.

Response

?Operations\GetWorkspaceTargetsResponse

Errors

Error Type Status Code Content Type
Errorors\Error 5XX application/json
Errorors\SDKException 4XX */*

getTargetsDeprecated

Load targets for a particular workspace

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Operations;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '<YOUR_API_KEY_HERE>',
        )
    )
    ->build();

$request = new Operations\GetWorkspaceTargetsDeprecatedRequest(
    workspaceId: '<id>',
);

$response = $sdk->events->getTargetsDeprecated(
    request: $request
);

if ($response->targetSDKList !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\GetWorkspaceTargetsDeprecatedRequest ✔️ The request object to use for the request.

Response

?Operations\GetWorkspaceTargetsDeprecatedResponse

Errors

Error Type Status Code Content Type
Errorors\Error 5XX application/json
Errorors\SDKException 4XX */*

post

Sends an array of events to be stored for a particular workspace.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Operations;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;
use Speakeasy\SpeakeasyClientSDK\Utils;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '<YOUR_API_KEY_HERE>',
        )
    )
    ->build();

$request = new Operations\PostWorkspaceEventsRequest(
    requestBody: [
        new Shared\CliEvent(
            createdAt: Utils\Utils::parseDateTime('2024-05-07T03:24:39.583Z'),
            executionId: '<id>',
            id: '<id>',
            interactionType: Shared\InteractionType::Quickstart,
            localStartedAt: Utils\Utils::parseDateTime('2024-09-08T05:59:33.876Z'),
            speakeasyApiKeyName: '<value>',
            speakeasyVersion: '<value>',
            success: false,
            workspaceId: '<id>',
        ),
    ],
    workspaceId: '<id>',
);

$response = $sdk->events->post(
    request: $request
);

if ($response->statusCode === 200) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\PostWorkspaceEventsRequest ✔️ The request object to use for the request.

Response

?Operations\PostWorkspaceEventsResponse

Errors

Error Type Status Code Content Type
Errorors\Error 5XX application/json
Errorors\SDKException 4XX */*

search

Search events for a particular workspace by any field

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Operations;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '<YOUR_API_KEY_HERE>',
        )
    )
    ->build();

$request = new Operations\SearchWorkspaceEventsRequest(
    workspaceId: '<id>',
);

$response = $sdk->events->search(
    request: $request
);

if ($response->cliEventBatch !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\SearchWorkspaceEventsRequest ✔️ The request object to use for the request.

Response

?Operations\SearchWorkspaceEventsResponse

Errors

Error Type Status Code Content Type
Errorors\Error 5XX application/json
Errorors\SDKException 4XX */*