Skip to content

Latest commit

 

History

History
113 lines (72 loc) · 6.54 KB

README.md

File metadata and controls

113 lines (72 loc) · 6.54 KB

Advertisements

(advertisements)

Overview

Available Operations

  • get - Get Campaign
  • list - List Campaigns

get

Get an advertisement campaign 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->advertisements->get(
    id: '<value>'
);

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

Parameters

Parameter Type Required Description
id string ✔️ The advertisement campaign ID.

Response

?Operations\AdvertisementsGetResponse

Errors

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

list

List active advertisement campaigns for a benefit.

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->advertisements->list(
    benefitId: '<value>',
    page: 1,
    limit: 10,
    sorting: [
        Components\AdvertisementSortProperty::Clicks,
    ]

);


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

Parameters

Parameter Type Required Description
benefitId string ✔️ N/A
page ?int Page number, defaults to 1.
limit ?int Size of a page, defaults to 10. Maximum is 100.
sorting array<Components\AdvertisementSortProperty> 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\AdvertisementsListResponse

Errors

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