Skip to content

Latest commit

 

History

History
178 lines (119 loc) · 14.8 KB

README.md

File metadata and controls

178 lines (119 loc) · 14.8 KB

BenefitGrants

(customerPortal->benefitGrants)

Overview

Available Operations

  • list - List Benefit Grants
  • get - Get Benefit Grant
  • update - Update Benefit Grant

list

List benefits grants of the authenticated customer.

Scopes: customer_portal:read customer_portal:write

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Polar;
use Polar\Models\Operations;

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

$request = new Operations\CustomerPortalBenefitGrantsListRequest(
    organizationId: [
        '1dbfc517-0bbf-4301-9ba8-555ca42b9737',
    ],
);
$requestSecurity = new Operations\CustomerPortalBenefitGrantsListSecurity(
    customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);

$responses = $sdk->customerPortal->benefitGrants->list(
    request: $request,
    security: $requestSecurity
);


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

Parameters

Parameter Type Required Description
$request Operations\CustomerPortalBenefitGrantsListRequest ✔️ The request object to use for the request.
security Operations\CustomerPortalBenefitGrantsListSecurity ✔️ The security requirements to use for the request.

Response

?Operations\CustomerPortalBenefitGrantsListResponse

Errors

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

get

Get a benefit grant by ID for the authenticated customer.

Scopes: customer_portal:read customer_portal:write

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Polar;
use Polar\Models\Operations;

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


$requestSecurity = new Operations\CustomerPortalBenefitGrantsGetSecurity(
    customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);

$response = $sdk->customerPortal->benefitGrants->get(
    security: $requestSecurity,
    id: '<value>'

);

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

Parameters

Parameter Type Required Description
security Operations\CustomerPortalBenefitGrantsGetSecurity ✔️ The security requirements to use for the request.
id string ✔️ The benefit grant ID.

Response

?Operations\CustomerPortalBenefitGrantsGetResponse

Errors

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

update

Update a benefit grant for the authenticated customer.

Scopes: customer_portal:write

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Polar;
use Polar\Models\Components;
use Polar\Models\Operations;

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


$requestSecurity = new Operations\CustomerPortalBenefitGrantsUpdateSecurity(
    customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);

$response = $sdk->customerPortal->benefitGrants->update(
    security: $requestSecurity,
    id: '<value>',
    customerBenefitGrantUpdate: new Components\CustomerBenefitGrantMeterCreditUpdate()

);

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

Parameters

Parameter Type Required Description
security Operations\CustomerPortalBenefitGrantsUpdateSecurity ✔️ The security requirements to use for the request.
id string ✔️ The benefit grant ID.
customerBenefitGrantUpdate Components\CustomerBenefitGrantDiscordUpdate|Components\CustomerBenefitGrantGitHubRepositoryUpdate|Components\CustomerBenefitGrantDownloadablesUpdate|Components\CustomerBenefitGrantLicenseKeysUpdate|Components\CustomerBenefitGrantCustomUpdate|Components\CustomerBenefitGrantMeterCreditUpdate ✔️ N/A

Response

?Operations\CustomerPortalBenefitGrantsUpdateResponse

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