Skip to content

Latest commit

 

History

History
259 lines (175 loc) · 7.35 KB

File metadata and controls

259 lines (175 loc) · 7.35 KB

Organizations

(organizations)

Overview

REST APIs for managing Organizations (speakeasy L1 Tenancy construct)

Available Operations

  • createFreeTrial - Create a free trial for an organization
  • create - Create an organization
  • get - Get organization
  • getUsage - Get billing usage summary for a particular organization
  • getAll - Get organizations for a user

createFreeTrial

Creates a free trial for an organization

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

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

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



$response = $sdk->organizations->createFreeTrial(

);

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

Response

?Operations\CreateFreeTrialResponse

Errors

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

create

Creates an organization

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
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 Shared\Organization(
    accountType: Shared\AccountType::ScaleUp,
    createdAt: Utils\Utils::parseDateTime('2024-11-30T17:06:07.804Z'),
    id: '<id>',
    name: '<value>',
    slug: '<value>',
    ssoActivated: false,
    telemetryDisabled: false,
    updatedAt: Utils\Utils::parseDateTime('2024-04-02T12:48:32.253Z'),
);

$response = $sdk->organizations->create(
    request: $request
);

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

Parameters

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

Response

?Operations\CreateOrganizationResponse

Errors

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

get

Get information about a particular organization.

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\GetOrganizationRequest(
    organizationID: '<id>',
);

$response = $sdk->organizations->get(
    request: $request
);

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

Parameters

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

Response

?Operations\GetOrganizationResponse

Errors

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

getUsage

Returns a billing usage summary by target languages for a particular organization

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

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

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



$response = $sdk->organizations->getUsage(

);

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

Response

?Operations\GetOrganizationUsageResponse

Errors

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

getAll

Returns a list of organizations a user has access too

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

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

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



$response = $sdk->organizations->getAll(

);

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

Response

?Operations\GetOrganizationsResponse

Errors

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