(customFields)
- create - Create Custom Field
- delete - Delete Custom Field
- get - Get Custom Field
- list - List Custom Fields
- update - Update Custom Field
Create a custom field.
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\CustomFieldCreateNumber(
slug: '<value>',
name: '<value>',
properties: new Components\CustomFieldNumberProperties(),
);
$response = $sdk->customFields->create(
request: $request
);
if ($response->customField !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Components\CustomFieldCreateText|Components\CustomFieldCreateNumber|Components\CustomFieldCreateDate|Components\CustomFieldCreateCheckbox|Components\CustomFieldCreateSelect | ✔️ | The request object to use for the request. |
?Operations\CustomFieldsCreateResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Delete a custom field.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$response = $sdk->customFields->delete(
id: '<value>'
);
if ($response->statusCode === 200) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | The custom field ID. |
?Operations\CustomFieldsDeleteResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ResourceNotFound | 404 | application/json |
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Get a custom field 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->customFields->get(
id: '<value>'
);
if ($response->customField !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | The custom field ID. |
?Operations\CustomFieldsGetResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ResourceNotFound | 404 | application/json |
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
List custom fields.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$request = new Operations\CustomFieldsListRequest();
$responses = $sdk->customFields->list(
request: $request
);
foreach ($responses as $response) {
if ($response->statusCode === 200) {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CustomFieldsListRequest | ✔️ | The request object to use for the request. |
?Operations\CustomFieldsListResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Update a custom field.
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();
$response = $sdk->customFields->update(
id: '<value>',
customFieldUpdate: new Components\CustomFieldUpdateText()
);
if ($response->customField !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
id |
string | ✔️ | The custom field ID. |
customFieldUpdate |
Components\CustomFieldUpdateText|Components\CustomFieldUpdateNumber|Components\CustomFieldUpdateDate|Components\CustomFieldUpdateCheckbox|Components\CustomFieldUpdateSelect | ✔️ | N/A |
?Operations\CustomFieldsUpdateResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\ResourceNotFound | 404 | application/json |
Errors\HTTPValidationError | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |