|
@@ 64-84 (lines=21) @@
|
| 61 |
|
* |
| 62 |
|
* @throws Exception |
| 63 |
|
*/ |
| 64 |
|
public function createBulkJob(string $listId, $filePath) |
| 65 |
|
{ |
| 66 |
|
Assert::stringNotEmpty($listId); |
| 67 |
|
|
| 68 |
|
if (strlen($filePath) < PHP_MAXPATHLEN && is_file($filePath)) { |
| 69 |
|
$fileData = ['filePath' => $filePath]; |
| 70 |
|
} else { |
| 71 |
|
$fileData = [ |
| 72 |
|
'fileContent' => $filePath, |
| 73 |
|
'filename' => 'file', |
| 74 |
|
]; |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
$postDataMultipart = []; |
| 78 |
|
$postDataMultipart[] = $this->prepareFile('file', $fileData); |
| 79 |
|
|
| 80 |
|
$response = $this->httpPostRaw(sprintf('/v4/address/validate/bulk/%s', $listId), $postDataMultipart); |
| 81 |
|
$this->closeResources($postDataMultipart); |
| 82 |
|
|
| 83 |
|
return $this->hydrateResponse($response, CreateBulkJobResponse::class); |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
/** |
| 87 |
|
* @param string $listId ID given when the list created |
|
@@ 162-182 (lines=21) @@
|
| 159 |
|
* |
| 160 |
|
* @throws Exception |
| 161 |
|
*/ |
| 162 |
|
public function createBulkPreview(string $previewId, $filePath) |
| 163 |
|
{ |
| 164 |
|
Assert::stringNotEmpty($previewId); |
| 165 |
|
|
| 166 |
|
if (strlen($filePath) < PHP_MAXPATHLEN && is_file($filePath)) { |
| 167 |
|
$fileData = ['filePath' => $filePath]; |
| 168 |
|
} else { |
| 169 |
|
$fileData = [ |
| 170 |
|
'fileContent' => $filePath, |
| 171 |
|
'filename' => 'file', |
| 172 |
|
]; |
| 173 |
|
} |
| 174 |
|
|
| 175 |
|
$postDataMultipart = []; |
| 176 |
|
$postDataMultipart[] = $this->prepareFile('file', $fileData); |
| 177 |
|
|
| 178 |
|
$response = $this->httpPostRaw(sprintf('/v4/address/validate/preview/%s', $previewId), $postDataMultipart); |
| 179 |
|
$this->closeResources($postDataMultipart); |
| 180 |
|
|
| 181 |
|
return $this->hydrateResponse($response, CreateBulkPreviewResponse::class); |
| 182 |
|
} |
| 183 |
|
|
| 184 |
|
/** |
| 185 |
|
* @param string $previewId ID given when the list created |