Skip to content

Latest commit

 

History

History
270 lines (178 loc) · 11.7 KB

README.md

File metadata and controls

270 lines (178 loc) · 11.7 KB

PolarLicenseKeys

(customerPortal->licenseKeys)

Overview

Available Operations

activate

Activate a license key instance.

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\LicenseKeyActivate(
    key: '<key>',
    organizationId: '<value>',
    label: '<value>',
);

$response = $sdk->customerPortal->licenseKeys->activate(
    request: $request
);

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

Parameters

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

Response

?Operations\CustomerPortalLicenseKeysActivateResponse

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 */*

deactivate

Deactivate a license key instance.

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\LicenseKeyDeactivate(
    key: '<key>',
    organizationId: '<value>',
    activationId: '<value>',
);

$response = $sdk->customerPortal->licenseKeys->deactivate(
    request: $request
);

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

Parameters

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

Response

?Operations\CustomerPortalLicenseKeysDeactivateResponse

Errors

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

get

Get a license key.

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->customerPortal->licenseKeys->get(
    id: '<value>'
);

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

Parameters

Parameter Type Required Description
id string ✔️ N/A

Response

?Operations\CustomerPortalLicenseKeysGetResponse

Errors

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

list

List License Keys

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Polar;

$security = '<YOUR_BEARER_TOKEN_HERE>';

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



$responses = $sdk->customerPortal->licenseKeys->list(
    page: 1,
    limit: 10,
    organizationId: [
        '<value>',
    ],
    benefitId: '<value>'

);


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.
organizationId string|array|null Filter by organization ID.
benefitId ?string Filter by a specific benefit

Response

?Operations\CustomerPortalLicenseKeysListResponse

Errors

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

validate

Validate a license key.

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\LicenseKeyValidate(
    key: '<key>',
    organizationId: '<value>',
);

$response = $sdk->customerPortal->licenseKeys->validate(
    request: $request
);

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

Parameters

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

Response

?Operations\CustomerPortalLicenseKeysValidateResponse

Errors

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