Pages::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 10
c 2
b 1
f 0
dl 0
loc 20
rs 9.9332
cc 1
nc 1
nop 7
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Promopult\TikTokMarketingApi\Service;
6
7
/**
8
 * @psalm-suppress UnusedClass
9
 */
10
final class Pages extends \Promopult\TikTokMarketingApi\AbstractService
11
{
12
    /**
13
     * After an instant page is created, you can get the page ID and then use it in your lead ads or collection ads.
14
     *
15
     * @param int $advertiserId         Advertiser ID
16
     * @param ?string $status           Form status, optional values: EDITED, PUBLISHED
17
     * @param ?string $title            Instant Form title, will filter the form that **contains** the words in the
18
     *                                  title.
19
     * @param ?array $updateTimeRange   Filter for Instant Forms updated in time range.
20
     *                                  ['start' => (unix timestamp), 'end' => (unix timestamp)]
21
     * @param ?string $businessType     Instant page type,optional values:
22
     *                                  LEAD_GEN(InstantForm), STORE_FRONT(Storefront Page). Default: LEAD_GEN
23
     * @param ?int $page                Current number of pages, default: 1, range: ≥ 1
24
     * @param ?int $pageSize            Pagination size, default: 10, range: 1-100
25
     * @return array
26
     *
27
     * @throws \Throwable
28
     *
29
     * @see https://ads.tiktok.com/marketing_api/docs?id=1701890945985537
30
     */
31
    public function get(
32
        int $advertiserId,
33
        ?string $status = null,
34
        ?string $title = null,
35
        ?array $updateTimeRange = null,
36
        ?string $businessType = null,
37
        ?int $page = null,
38
        ?int $pageSize = null
39
    ): array {
40
        return $this->requestApi(
41
            'GET',
42
            '/open_api/v1.3/page/get/',
43
            [
44
                'advertiser_id' => $advertiserId,
45
                'page' => $page,
46
                'page_size' => $pageSize,
47
                'status' => $status,
48
                'title' => $title,
49
                'update_time_range' => $updateTimeRange,
50
                'business_type' => $businessType
51
            ]
52
        );
53
    }
54
}
55