speakeasy-api/speakeasy-client-sdk-php


README

SDK Installation

Composer

composer require "speakeasy-api/speakeasy-client-sdk-php"

SDK Example Usage

Example

<?php

declare(strict_types=1);

require 'vendor/autoload.php';

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

$security = new Shared\Security();
$security->apiKey = '<YOUR_API_KEY_HERE>';

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setWorkspaceID('<value>')
    ->setSecurity($security)
    ->build();

try {
    $request = new Operations\GetApisRequest();
    $request->metadata = [
        'South' => ['<value>'],
    ];
    $request->op = new Operations\QueryParamOp();
    $request->op->and = false;

    $response = $sdk->apis->getApis($request);

    if ($response->apis !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Available Resources and Operations

Apis

ApiEndpoints

Metadata

Schemas

Artifacts

Auth

Requests

Organizations

Reports

Embeds

Events

Server Selection

Server Selection

Select Server by Name

You can override the default server globally by passing a server name to the server: str optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:

Name Server Variables
prod https://api.prod.speakeasyapi.dev None

Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the server_url: str optional parameter when initializing the SDK client instance. For example:

Global Parameters

A parameter is configured globally. This parameter may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed.

For example, you can set workspaceID to '<value>' at SDK initialization and then you do not have to pass the same value on calls to operations like getWorkspaceEventsByTarget. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.

Available Globals

The following global parameter is available.

Name Type Required Description
workspaceID string The workspaceID parameter.

Example

<?php

declare(strict_types=1);

require 'vendor/autoload.php';

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

$security = new Shared\Security();
$security->apiKey = '<YOUR_API_KEY_HERE>';

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setWorkspaceID('<value>')
    ->setSecurity($security)
    ->build();

try {
    $request = new Operations\GetWorkspaceEventsByTargetRequest();
    $request->afterCreatedAt = DateTime::createFromFormat(
        'Y-m-d\TH:i:s+',
        '2024-04-01T04:00:29.393Z',
    );
    $request->targetID = '<value>';

    $response = $sdk->events->getWorkspaceEventsByTarget($request);

    if ($response->cliEventBatch !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release !

SDK Created by Speakeasy