Skip to content

Latest commit

 

History

History
215 lines (139 loc) · 10.8 KB

README.md

File metadata and controls

215 lines (139 loc) · 10.8 KB

Organizations

(organizations)

Overview

Available Operations

  • create - Create Organization
  • get - Get Organization
  • list - List Organizations
  • update - Update Organization

create

Create an organization.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Polar;
use Polar\Models\Components;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Polar\Polar::builder()->setSecurity($security)->build();

$request = new Components\OrganizationCreate(
    name: '<value>',
    slug: '<value>',
);

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

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

Parameters

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

Response

?Operations\OrganizationsCreateResponse

Errors

Error Type Status Code Content Type
Errors\HTTPValidationError 422 application/json
Errors\APIException 4XX, 5XX */*

get

Get an organization by ID.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Polar;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Polar\Polar::builder()->setSecurity($security)->build();



$response = $sdk->organizations->get(
    id: '<value>'
);

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

Parameters

Parameter Type Required Description
id string ✔️ N/A

Response

?Operations\OrganizationsGetResponse

Errors

Error Type Status Code Content Type
Errors\ResourceNotFound 404 application/json
Errors\HTTPValidationError 422 application/json
Errors\APIException 4XX, 5XX */*

list

List organizations.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Polar;
use Polar\Models\Components;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Polar\Polar::builder()->setSecurity($security)->build();



$responses = $sdk->organizations->list(
    page: 1,
    limit: 10,
    slug: '<value>',
    sorting: [
        Components\OrganizationSortProperty::MinusName,
    ]

);


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

Parameters

Parameter Type Required Description
page ?int Page number, defaults to 1.
limit ?int Size of a page, defaults to 10. Maximum is 100.
slug ?string Filter by slug.
sorting array<Components\OrganizationSortProperty> Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order.

Response

?Operations\OrganizationsListResponse

Errors

Error Type Status Code Content Type
Errors\HTTPValidationError 422 application/json
Errors\APIException 4XX, 5XX */*

update

Update an organization.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Polar;
use Polar\Models\Components;

$security = '<YOUR_BEARER_TOKEN_HERE>';

$sdk = Polar\Polar::builder()->setSecurity($security)->build();

$organizationUpdate = new Components\OrganizationUpdate();

$response = $sdk->organizations->update(
    id: '<value>',
    organizationUpdate: $organizationUpdate

);

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

Parameters

Parameter Type Required Description
id string ✔️ N/A
organizationUpdate Components\OrganizationUpdate ✔️ N/A

Response

?Operations\OrganizationsUpdateResponse

Errors

Error Type Status Code Content Type
Errors\NotPermitted 403 application/json
Errors\ResourceNotFound 404 application/json
Errors\HTTPValidationError 422 application/json
Errors\APIException 4XX, 5XX */*