Skip to content

Commit

Permalink
fix download leads
Browse files Browse the repository at this point in the history
  • Loading branch information
gladyshev committed Jan 21, 2022
1 parent 16cd031 commit b3f0193
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/Service/Leads.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,27 @@ final class Leads extends \Promopult\TikTokMarketingApi\AbstractService
* After the subscription, you can use the endpoints below to perform an end-to-end testing for leads generation,
* and clear the testing lead.
*
* @param int $advertiserId
* @param int $pageId
* @param ?int $advertiserId If the instant form and the generated leads are under an ad account, you must
* specify the advertiser ID.
* @param ?int $libraryId If the instant form and the generated leads are under a Business Center, you must
* specify the ID of the form library that contains the instant form and leads.
* @param int $pageId The ID of the instant form.
* @return array
*
* @throws Throwable
*
* @see https://ads.tiktok.com/marketing_api/docs?id=1701890943400962
*/
public function createTestLead(
int $advertiserId,
?int $advertiserId,
?int $libraryId,
int $pageId
): array {
return $this->requestApi(
'POST',
'/open_api/v1.2/pages/leads/mock/create/',
[
'advertiser_id' => $advertiserId,
'library_id' => $libraryId,
'page_id' => $pageId
]
);
Expand All @@ -42,23 +46,28 @@ public function createTestLead(
*
* You can use this endpoint to get a test lead.
*
* @param int $advertiserId
* @param int $pageId
* @param ?int $advertiserId If the instant form and the generated leads are under an ad account, you must
* specify the advertiser ID.
* @param ?int $libraryId If the instant form and the generated leads are under a Business Center, you must
* specify the ID of the form library that contains the instant form and leads.
* @param int $pageId The ID of the instant form.
*
* @return array
*
* @throws Throwable
*
* @see https://ads.tiktok.com/marketing_api/docs?id=1709486980307969
*/
public function getTestLeads(
int $advertiserId,
?int $advertiserId,
?int $libraryId,
int $pageId
): array {
return $this->requestApi(
'GET',
'/open_api/v1.2/pages/leads/mock/get/',
[
'advertiser_id' => $advertiserId,
'library_id' => $libraryId,
'page_id' => $pageId
]
);
Expand Down Expand Up @@ -186,9 +195,7 @@ public function downloadLeads(
/** @var array $decodedJson */
$decodedJson = json_decode(
(string) $response->getBody(),
true,
512,
JSON_THROW_ON_ERROR
true
);

if (
Expand Down

0 comments on commit b3f0193

Please sign in to comment.