Skip to content

Commit 887bb50

Browse files
committed
docs: uploads snippets
1 parent e74c0cc commit 887bb50

1 file changed

Lines changed: 187 additions & 16 deletions

File tree

CODE_SNIPPETS.md

Lines changed: 187 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ $apiInstance = new OpenAPI\Client\Api\AddressesApi($config, new GuzzleHttp\Clien
100100

101101
try {
102102
$result = $apiInstance->list(
103-
2, // limit
103+
2, // limit
104104
);
105105
print_r($result);
106106
} catch (Exception $e) {
@@ -259,7 +259,7 @@ $apiInstance = new OpenAPI\Client\Api\PostcardsApi($config, new GuzzleHttp\Clien
259259

260260
try {
261261
$result = $apiInstance->list(
262-
2, // limit
262+
2, // limit
263263
);
264264
print_r($result);
265265
} catch (Exception $e) {
@@ -378,7 +378,7 @@ $apiInstance = new OpenAPI\Client\Api\SelfMailersApi($config, new GuzzleHttp\Cli
378378

379379
try {
380380
$result = $apiInstance->list(
381-
2, // limit
381+
2, // limit
382382
);
383383
print_r($result);
384384
} catch (Exception $e) {
@@ -503,7 +503,7 @@ $apiInstance = new OpenAPI\Client\Api\LettersApi($config, new GuzzleHttp\Client(
503503

504504
try {
505505
$result = $apiInstance->list(
506-
2, // limit
506+
2, // limit
507507
);
508508
print_r($result);
509509
} catch (Exception $e) {
@@ -628,7 +628,7 @@ $apiInstance = new OpenAPI\Client\Api\ChecksApi($config, new GuzzleHttp\Client()
628628

629629
try {
630630
$result = $apiInstance->list(
631-
2, // limit
631+
2, // limit
632632
);
633633
print_r($result);
634634
} catch (Exception $e) {
@@ -692,7 +692,7 @@ $apiInstance = new OpenAPI\Client\Api\BankAccountsApi($config, new GuzzleHttp\Cl
692692

693693
try {
694694
$result = $apiInstance->list(
695-
2, // limit
695+
2, // limit
696696
);
697697
print_r($result);
698698
} catch (Exception $e) {
@@ -706,9 +706,9 @@ try {
706706
### Verify
707707
```bash
708708
curl https://api.lob.com/v1/bank_accounts/bank_dfceb4a2a05b57e/verify \
709-
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
710-
-d "amounts[]=25" \
711-
-d "amounts[]=63" \
709+
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
710+
-d "amounts[]=25" \
711+
-d "amounts[]=63" \
712712
```
713713

714714
```php
@@ -821,7 +821,7 @@ $apiInstance = new OpenAPI\Client\Api\TemplatesApi($config, new GuzzleHttp\Clien
821821

822822
try {
823823
$result = $apiInstance->list(
824-
2, // limit
824+
2, // limit
825825
);
826826
print_r($result);
827827
} catch (Exception $e) {
@@ -941,8 +941,8 @@ $apiInstance = new OpenAPI\Client\Api\TemplateVersionsApi($config, new GuzzleHtt
941941

942942
try {
943943
$result = $apiInstance->list(
944-
tmpl_dadaaf7b76c9f25, // tmplId
945-
2, // limit
944+
tmpl_dadaaf7b76c9f25, // tmplId
945+
2, // limit
946946
);
947947
print_r($result);
948948
} catch (Exception $e) {
@@ -1005,6 +1005,177 @@ try {
10051005
}
10061006
```
10071007

1008+
## Uploads Api
1009+
1010+
### List
1011+
```bash
1012+
curl -X GET "https://api.lob.com/v1/uploads?limit=2" \
1013+
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc:
1014+
```
1015+
1016+
```php
1017+
$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client());
1018+
1019+
try {
1020+
$result = $apiInstance->list_upload();
1021+
print_r($result);
1022+
} catch (Exception $e) {
1023+
echo $e->getMessage(), PHP_EOL;
1024+
}
1025+
```
1026+
1027+
1028+
1029+
### Retrieve Export
1030+
```bash
1031+
curl https://api.lob.com/v1/uploads/upl_71be866e430b11e9/exports/ex_6a94fe68fd151e0f8 \
1032+
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
1033+
-d "type=failures"
1034+
```
1035+
1036+
```php
1037+
$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client());
1038+
1039+
try {
1040+
$export = $apiInstance->get_export("upl_71be866e430b11e9", "ex_6a94fe68fd151e0f8");
1041+
print_r($export);
1042+
} catch (Exception $e) {
1043+
echo $e->getMessage(), PHP_EOL;
1044+
}
1045+
```
1046+
1047+
1048+
1049+
### Upload File
1050+
1051+
```bash
1052+
curl -X POST https://api.lob.com/v1/uploads/upl_71be866e430b11e9/file \
1053+
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
1054+
-F file=@<YOUR_FILE_NAME_HERE>
1055+
```
1056+
1057+
```php
1058+
$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client());
1059+
$myFile = new \SplFileObject("<PATH_TO_YOUR_CSV>", "r");
1060+
1061+
try {
1062+
$upload = $apiInstance->upload_file("upl_71be866e430b11e9", $myFile);
1063+
print_r($upload);
1064+
} catch (Exception $e) {
1065+
echo $e->getMessage(), PHP_EOL;
1066+
}
1067+
```
1068+
1069+
### Retrieve
1070+
```bash
1071+
curl https://api.lob.com/v1/uploads/upl_71be866e430b11e9 \
1072+
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc:
1073+
```
1074+
1075+
```php
1076+
$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client());
1077+
1078+
try {
1079+
$result = $apiInstance->get_upload("upl_71be866e430b11e9");
1080+
print_r($result);
1081+
} catch (Exception $e) {
1082+
echo $e->getMessage(), PHP_EOL;
1083+
}
1084+
```
1085+
1086+
1087+
1088+
1089+
### Create Export
1090+
```bash
1091+
curl https://api.lob.com/v1/uploads/upl_71be866e430b11e9/exports \
1092+
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
1093+
-d "type=failures"
1094+
```
1095+
1096+
```php
1097+
$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client());
1098+
1099+
$exportModel = new ExportModel();
1100+
$exportModel->setType("all");
1101+
1102+
try {
1103+
$export = $apiInstance->create_export("upl_71be866e430b11e9", $exportModel);
1104+
print_r($export);
1105+
} catch (Exception $e) {
1106+
echo $e->getMessage(), PHP_EOL;
1107+
}
1108+
```
1109+
1110+
1111+
1112+
### Update
1113+
```bash
1114+
curl -X PATCH https://api.lob.com/v1/upl_71be866e430b11e9 \
1115+
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
1116+
-d "state=Ready for Validation" \
1117+
```
1118+
1119+
```php
1120+
$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client());
1121+
1122+
$uploadUpdatable = new OpenAPI\Client\Model\UploadUpdatable();
1123+
1124+
$requiredAddressColumnMapping = new OpenAPI\Client\Model\RequiredAddressColumnMapping();
1125+
$requiredAddressColumnMapping->setName("recipient");
1126+
$requiredAddressColumnMapping->setAddressLine1("primary line");
1127+
$requiredAddressColumnMapping->setAddressCity("city");
1128+
$requiredAddressColumnMapping->setAddressState("state");
1129+
$requiredAddressColumnMapping->setAddressZip("zip_code");
1130+
1131+
$uploadUpdatable->setRequiredAddressColumnMapping($requiredAddressColumnMapping);
1132+
1133+
try {
1134+
$result = $apiInstance->update_upload("upl_71be866e430b11e9", $uploadUpdatable);
1135+
print_r($result);
1136+
} catch (Exception $e) {
1137+
echo $e->getMessage(), PHP_EOL;
1138+
}
1139+
```
1140+
1141+
1142+
### Create
1143+
```bash
1144+
curl https://api.lob.com/v1/uploads \
1145+
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \
1146+
-d "campaignId=cmp_e05ee61ff80764b" \
1147+
```
1148+
1149+
```php
1150+
$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client());
1151+
$upload_writable = new OpenAPI\Client\Model\UploadWritable();
1152+
$upload_writable->setCampaignId("cmp_e05ee61ff80764b");
1153+
1154+
try {
1155+
$result = $apiInstance->create_upload($upload_writable);
1156+
print_r($result);
1157+
} catch (Exception $e) {
1158+
echo $e->getMessage(), PHP_EOL;
1159+
}
1160+
```
1161+
1162+
1163+
### Delete
1164+
```bash
1165+
curl -X DELETE "https://api.lob.com/v1/uploads/upl_71be866e430b11e9" \
1166+
-u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc:
1167+
```
1168+
1169+
```php
1170+
$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client());
1171+
1172+
try {
1173+
$result = $apiInstance->delete_upload("upl_71be866e430b11e9");
1174+
print_r($result);
1175+
} catch (Exception $e) {
1176+
echo $e->getMessage(), PHP_EOL;
1177+
}
1178+
```
10081179

10091180
## IntlVerifications Api
10101181

@@ -1056,14 +1227,14 @@ curl https://api.lob.com/v1/bulk/intl_verifications \
10561227

10571228
```php
10581229

1059-
$verificationData0 = new OpenAPI\Client\Model\MultipleComponentsIntl(array(
1230+
$verificationData0 = new OpenAPI\Client\Model\MultipleComponentsIntl(array(
10601231
'primary_line' => '35 Tower Hill',
10611232
'city' => 'London',
10621233
'postal_code' => 'EC3N 4DR',
10631234
'country' => 'GB',
10641235
));
10651236

1066-
$verificationData1 = new OpenAPI\Client\Model\MultipleComponentsIntl(array(
1237+
$verificationData1 = new OpenAPI\Client\Model\MultipleComponentsIntl(array(
10671238
'primary_line' => '370 Water St',
10681239
'city' => 'Summerside',
10691240
'state' => 'Prince Edward Island',
@@ -1105,14 +1276,14 @@ curl https://api.lob.com/v1/bulk/us_verifications \
11051276

11061277
```php
11071278

1108-
$verificationData0 = new OpenAPI\Client\Model\MultipleComponents(array(
1279+
$verificationData0 = new OpenAPI\Client\Model\MultipleComponents(array(
11091280
'primary_line' => '210 King Street',
11101281
'city' => 'San Francisco',
11111282
'state' => 'CA',
11121283
'zip_code' => '94017',
11131284
));
11141285

1115-
$verificationData1 = new OpenAPI\Client\Model\MultipleComponents(array(
1286+
$verificationData1 = new OpenAPI\Client\Model\MultipleComponents(array(
11161287
'primary_line' => '185 BERRY ST STE 6600',
11171288
'city' => 'SAN FRANCISCO',
11181289
'state' => 'CA',

0 commit comments

Comments
 (0)