Passed
Push — master ( 0d4398...aeb420 )
by Dmitry
14:21
created

Pages::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

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