Skip to content

Commit

Permalink
Add import method to the Unsubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-mykhailenko committed Aug 3, 2024
1 parent 41d83ac commit 1f1e28a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Api/Suppression/Unsubscribe.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,27 @@ public function deleteAll(string $domain, array $requestHeaders = [])

return $this->hydrateResponse($response, DeleteResponse::class);
}

/**
* @param string $domain
* @param string $filePath
* @return mixed
* @throws ClientExceptionInterface
*/
public function import(string $domain, string $filePath)
{
Assert::stringNotEmpty($domain);
Assert::stringNotEmpty($filePath);
Assert::fileExists($filePath);

$response = $this->httpPost(
sprintf('/v3/%s/unsubscribes/import', $domain),
['file' => fopen($filePath, 'r')],
[
'filename' => basename($filePath),
]
);

return $this->hydrateResponse($response, ShowResponse::class);
}
}

0 comments on commit 1f1e28a

Please sign in to comment.