(organizations)
- create - Create Organization
- get - Get Organization
- list - List Organizations
- update - Update Organization
Create an organization.
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
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Components\OrganizationCreate | ✔️ | The request object to use for the request. |
?Operations\OrganizationsCreateResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Get an organization by ID.
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
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | N/A |
?Operations\OrganizationsGetResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ResourceNotFound | 404 | application/json |
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
List organizations.
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
}
}
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. |
?Operations\OrganizationsListResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Update an organization.
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
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | N/A |
organizationUpdate |
Components\OrganizationUpdate | ✔️ | N/A |
?Operations\OrganizationsUpdateResponse
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 | */* |