From e74c0cc9a251b604315c1ae56b20d7533429cb04 Mon Sep 17 00:00:00 2001 From: Jessica Ho Date: Tue, 20 Dec 2022 01:42:58 -0800 Subject: [PATCH 1/2] uploadsApi spec tests --- lib/Api/AddressesApi.php | 1 + lib/Api/BankAccountsApi.php | 1 + lib/Api/BillingGroupsApi.php | 1 + lib/Api/BuckslipOrdersApi.php | 1 + lib/Api/BuckslipsApi.php | 1 + lib/Api/CampaignsApi.php | 1 + lib/Api/CardOrdersApi.php | 1 + lib/Api/CardsApi.php | 1 + lib/Api/ChecksApi.php | 1 + lib/Api/CreativesApi.php | 1 + lib/Api/DefaultApi.php | 1 + lib/Api/IdentityValidationApi.php | 1 + lib/Api/IntlAutocompletionsApi.php | 1 + lib/Api/IntlVerificationsApi.php | 1 + lib/Api/LettersApi.php | 1 + lib/Api/PostcardsApi.php | 1 + lib/Api/ReverseGeocodeLookupsApi.php | 1 + lib/Api/SelfMailersApi.php | 1 + lib/Api/TemplateVersionsApi.php | 1 + lib/Api/TemplatesApi.php | 1 + lib/Api/UploadsApi.php | 43 +- lib/Api/UsAutocompletionsApi.php | 1 + lib/Api/UsVerificationsApi.php | 1 + lib/Api/ZipLookupsApi.php | 1 + lib/Model/CheckEditable.php | 12 +- lib/Model/CountryExtended.php | 2 + lib/Model/GeocodeComponents.php | 8 +- lib/Model/Letter.php | 6 +- lib/Model/LetterEditable.php | 12 +- lib/Model/OptionalAddressColumnMapping.php | 403 +++++++++++++++++ lib/Model/PostcardEditable.php | 12 +- lib/Model/RequiredAddressColumnMapping.php | 475 +++++++++++++++++++++ lib/Model/SelfMailerEditable.php | 12 +- lib/Model/Upload.php | 190 ++++++--- lib/Model/UploadUpdatable.php | 147 +++++-- lib/Model/UploadWritable.php | 147 ++++++- lib/Model/UploadsMetadata.php | 338 +++++++++++++++ lib/Model/UsComponents.php | 8 +- test/Integration/UploadsApiSpecTest.php | 254 +++++++++++ test/assets/lobster-family.csv | 11 + 40 files changed, 1944 insertions(+), 159 deletions(-) create mode 100755 lib/Model/OptionalAddressColumnMapping.php create mode 100755 lib/Model/RequiredAddressColumnMapping.php create mode 100755 lib/Model/UploadsMetadata.php create mode 100644 test/Integration/UploadsApiSpecTest.php create mode 100644 test/assets/lobster-family.csv diff --git a/lib/Api/AddressesApi.php b/lib/Api/AddressesApi.php index 1325569c..9ccb1be5 100755 --- a/lib/Api/AddressesApi.php +++ b/lib/Api/AddressesApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/BankAccountsApi.php b/lib/Api/BankAccountsApi.php index f3940e41..a2969a07 100755 --- a/lib/Api/BankAccountsApi.php +++ b/lib/Api/BankAccountsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/BillingGroupsApi.php b/lib/Api/BillingGroupsApi.php index 494bda9c..53194954 100755 --- a/lib/Api/BillingGroupsApi.php +++ b/lib/Api/BillingGroupsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/BuckslipOrdersApi.php b/lib/Api/BuckslipOrdersApi.php index 8432242a..f1ecf235 100755 --- a/lib/Api/BuckslipOrdersApi.php +++ b/lib/Api/BuckslipOrdersApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/BuckslipsApi.php b/lib/Api/BuckslipsApi.php index ced37ac1..ee95d76c 100755 --- a/lib/Api/BuckslipsApi.php +++ b/lib/Api/BuckslipsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/CampaignsApi.php b/lib/Api/CampaignsApi.php index 0901cf3e..14a91adf 100755 --- a/lib/Api/CampaignsApi.php +++ b/lib/Api/CampaignsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/CardOrdersApi.php b/lib/Api/CardOrdersApi.php index 21ab9102..7dcd82a9 100755 --- a/lib/Api/CardOrdersApi.php +++ b/lib/Api/CardOrdersApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/CardsApi.php b/lib/Api/CardsApi.php index 8311b505..186910ac 100755 --- a/lib/Api/CardsApi.php +++ b/lib/Api/CardsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/ChecksApi.php b/lib/Api/ChecksApi.php index 469d0b6b..7aec2ec3 100755 --- a/lib/Api/ChecksApi.php +++ b/lib/Api/ChecksApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/CreativesApi.php b/lib/Api/CreativesApi.php index 8177379c..53b2fb89 100755 --- a/lib/Api/CreativesApi.php +++ b/lib/Api/CreativesApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/DefaultApi.php b/lib/Api/DefaultApi.php index ab6715ab..57178036 100755 --- a/lib/Api/DefaultApi.php +++ b/lib/Api/DefaultApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/IdentityValidationApi.php b/lib/Api/IdentityValidationApi.php index a2584c44..74a190b9 100755 --- a/lib/Api/IdentityValidationApi.php +++ b/lib/Api/IdentityValidationApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/IntlAutocompletionsApi.php b/lib/Api/IntlAutocompletionsApi.php index 02f58be0..ffa2c2d1 100755 --- a/lib/Api/IntlAutocompletionsApi.php +++ b/lib/Api/IntlAutocompletionsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/IntlVerificationsApi.php b/lib/Api/IntlVerificationsApi.php index 7e2b4d16..396b2ef5 100755 --- a/lib/Api/IntlVerificationsApi.php +++ b/lib/Api/IntlVerificationsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/LettersApi.php b/lib/Api/LettersApi.php index cac945d0..b837012a 100755 --- a/lib/Api/LettersApi.php +++ b/lib/Api/LettersApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/PostcardsApi.php b/lib/Api/PostcardsApi.php index 93df9705..b4c3df1e 100755 --- a/lib/Api/PostcardsApi.php +++ b/lib/Api/PostcardsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/ReverseGeocodeLookupsApi.php b/lib/Api/ReverseGeocodeLookupsApi.php index 193db903..390dcc91 100755 --- a/lib/Api/ReverseGeocodeLookupsApi.php +++ b/lib/Api/ReverseGeocodeLookupsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/SelfMailersApi.php b/lib/Api/SelfMailersApi.php index f77ffd1f..0856b6e4 100755 --- a/lib/Api/SelfMailersApi.php +++ b/lib/Api/SelfMailersApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/TemplateVersionsApi.php b/lib/Api/TemplateVersionsApi.php index 71d64815..767967f5 100755 --- a/lib/Api/TemplateVersionsApi.php +++ b/lib/Api/TemplateVersionsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/TemplatesApi.php b/lib/Api/TemplatesApi.php index c35d9ada..9664d24a 100755 --- a/lib/Api/TemplatesApi.php +++ b/lib/Api/TemplatesApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/UploadsApi.php b/lib/Api/UploadsApi.php index b0655ed1..12de2aec 100755 --- a/lib/Api/UploadsApi.php +++ b/lib/Api/UploadsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; @@ -220,11 +221,11 @@ public function get_exportWithHttpInfo($upl_id, $ex_id) (string) $response->getBody() ); } - + // Since all non successes are thrown above, we can assume success $content = (string) $response->getBody(); return ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Export', []); - + } catch (ApiException $e) { throw $e; } @@ -389,11 +390,11 @@ public function create_uploadWithHttpInfo($upload_writable) (string) $response->getBody() ); } - + // Since all non successes are thrown above, we can assume success $content = (string) $response->getBody(); return ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Upload', []); - + } catch (ApiException $e) { throw $e; } @@ -528,7 +529,7 @@ public function delete_uploadWithHttpInfo($upl_id) (string) $response->getBody() ); } - + } catch (ApiException $e) { throw $e; } @@ -676,11 +677,11 @@ public function create_exportWithHttpInfo($upl_id, $export_model) (string) $response->getBody() ); } - + // Since all non successes are thrown above, we can assume success $content = (string) $response->getBody(); return ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\UploadCreateExport', []); - + } catch (ApiException $e) { throw $e; } @@ -804,7 +805,17 @@ public function upload_fileWithHttpInfo($upl_id, $file) $options = $this->createHttpClientOption(); $requestError = null; try { - $response = $this->client->send($request, $options); + $response = $this->client->request( + 'POST', + $request->getUri()->__toString(), + [ + 'multipart' => [[ + 'name' => 'file', + 'contents' => Utils::tryFopen('/Users/jessica-ho/Desktop/lob-php/test/assets/lobster-family.csv', 'r') + ]], + 'auth' => $options['auth'] + ] + ); } catch (RequestException $e) { $errorBody = json_decode($e->getResponse()->getBody()->getContents())->error; $requestError = new LobError(); @@ -837,11 +848,11 @@ public function upload_fileWithHttpInfo($upl_id, $file) (string) $response->getBody() ); } - + // Since all non successes are thrown above, we can assume success $content = (string) $response->getBody(); return ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\UploadFile', []); - + } catch (ApiException $e) { throw $e; } @@ -998,11 +1009,11 @@ public function get_uploadWithHttpInfo($upl_id) (string) $response->getBody() ); } - + // Since all non successes are thrown above, we can assume success $content = (string) $response->getBody(); return ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Upload', []); - + } catch (ApiException $e) { throw $e; } @@ -1150,11 +1161,11 @@ public function update_uploadWithHttpInfo($upl_id, $upload_updatable) (string) $response->getBody() ); } - + // Since all non successes are thrown above, we can assume success $content = (string) $response->getBody(); return ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Upload', []); - + } catch (ApiException $e) { throw $e; } @@ -1309,11 +1320,11 @@ public function list_uploadWithHttpInfo($campaign_id = null) (string) $response->getBody() ); } - + // Since all non successes are thrown above, we can assume success $content = (string) $response->getBody(); return ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Upload[]', []); - + } catch (ApiException $e) { throw $e; } diff --git a/lib/Api/UsAutocompletionsApi.php b/lib/Api/UsAutocompletionsApi.php index 2d043fa8..918e7362 100755 --- a/lib/Api/UsAutocompletionsApi.php +++ b/lib/Api/UsAutocompletionsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/UsVerificationsApi.php b/lib/Api/UsVerificationsApi.php index f73ea431..cd4bc698 100755 --- a/lib/Api/UsVerificationsApi.php +++ b/lib/Api/UsVerificationsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Api/ZipLookupsApi.php b/lib/Api/ZipLookupsApi.php index 8d4bfd22..106ac13c 100755 --- a/lib/Api/ZipLookupsApi.php +++ b/lib/Api/ZipLookupsApi.php @@ -34,6 +34,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Psr7\Utils; use GuzzleHttp\RequestOptions; use OpenAPI\Client\ApiException; use OpenAPI\Client\Configuration; diff --git a/lib/Model/CheckEditable.php b/lib/Model/CheckEditable.php index e031a7ef..1491154b 100755 --- a/lib/Model/CheckEditable.php +++ b/lib/Model/CheckEditable.php @@ -60,8 +60,8 @@ class CheckEditable implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'from' => 'string', - 'to' => 'string', + 'from' => 'mixed', + 'to' => 'mixed', 'bank_account' => 'string', 'amount' => 'float', 'logo' => 'string', @@ -382,7 +382,7 @@ public function valid() /** * Gets from * - * @return string + * @return mixed */ public function getFrom() { @@ -392,7 +392,7 @@ public function getFrom() /** * Sets from * - * @param string $from Must either be an address ID or an inline object with correct address parameters. + * @param mixed $from Must either be an address ID or an inline object with correct address parameters. * * @return self */ @@ -407,7 +407,7 @@ public function setFrom($from) /** * Gets to * - * @return string + * @return mixed */ public function getTo() { @@ -417,7 +417,7 @@ public function getTo() /** * Sets to * - * @param string $to Must either be an address ID or an inline object with correct address parameters. + * @param mixed $to Must either be an address ID or an inline object with correct address parameters. * * @return self */ diff --git a/lib/Model/CountryExtended.php b/lib/Model/CountryExtended.php index d654c89c..95d25016 100755 --- a/lib/Model/CountryExtended.php +++ b/lib/Model/CountryExtended.php @@ -44,6 +44,8 @@ enum CountryExtended: string /** * Possible values of this enum */ + case EMPTY = ''; + case AD = 'AD'; case AE = 'AE'; diff --git a/lib/Model/GeocodeComponents.php b/lib/Model/GeocodeComponents.php index a527c5a1..57de1782 100755 --- a/lib/Model/GeocodeComponents.php +++ b/lib/Model/GeocodeComponents.php @@ -215,8 +215,8 @@ public function listInvalidProperties() } } if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { - if (!preg_match("/^\\d{4}$/", $this->container['zip_code_plus_4'])) { - $invalidProperties[] = "invalid value for 'zip_code_plus_4', must be conform to the pattern /^\\d{4}$/."; + if (!preg_match("/^(\\d{4})?$/", $this->container['zip_code_plus_4'])) { + $invalidProperties[] = "invalid value for 'zip_code_plus_4', must be conform to the pattern /^(\\d{4})?$/."; } } @@ -289,8 +289,8 @@ public function setZipCodePlus4($zip_code_plus_4) { if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { - if ((!preg_match("/^\\d{4}$/", $zip_code_plus_4))) { - throw new \InvalidArgumentException("invalid value for $zip_code_plus_4 when calling GeocodeComponents., must conform to the pattern /^\\d{4}$/."); + if ((!preg_match("/^(\\d{4})?$/", $zip_code_plus_4))) { + throw new \InvalidArgumentException("invalid value for $zip_code_plus_4 when calling GeocodeComponents., must conform to the pattern /^(\\d{4})?$/."); } } diff --git a/lib/Model/Letter.php b/lib/Model/Letter.php index fdf47520..f6174cdc 100755 --- a/lib/Model/Letter.php +++ b/lib/Model/Letter.php @@ -80,7 +80,7 @@ class Letter implements ModelInterface, ArrayAccess, \JsonSerializable 'extra_service' => 'string', 'tracking_number' => 'string', 'tracking_events' => '\OpenAPI\Client\Model\TrackingEventNormal[]', - 'return_address' => 'string', + 'return_address' => 'mixed', 'mail_type' => '\OpenAPI\Client\Model\MailType', 'color' => 'bool', 'double_sided' => 'bool', @@ -1113,7 +1113,7 @@ public function setTrackingEvents($tracking_events) /** * Gets return_address * - * @return string|null + * @return mixed|null */ public function getReturnAddress() { @@ -1123,7 +1123,7 @@ public function getReturnAddress() /** * Sets return_address * - * @param string|null $return_address Specifies the address the return envelope will be sent back to. This is an optional argument that is available if an account is signed up for the return envelope tracking beta, and has `return_envelope`, and `perforated_page` fields populated in the API request. + * @param mixed|null $return_address Specifies the address the return envelope will be sent back to. This is an optional argument that is available if an account is signed up for the return envelope tracking beta, and has `return_envelope`, and `perforated_page` fields populated in the API request. * * @return self */ diff --git a/lib/Model/LetterEditable.php b/lib/Model/LetterEditable.php index 1507d443..c3f03fcf 100755 --- a/lib/Model/LetterEditable.php +++ b/lib/Model/LetterEditable.php @@ -71,8 +71,8 @@ class LetterEditable implements ModelInterface, ArrayAccess, \JsonSerializable 'return_envelope' => 'mixed', 'perforated_page' => 'int', 'custom_envelope' => 'string', - 'to' => 'string', - 'from' => 'string', + 'to' => 'mixed', + 'from' => 'mixed', 'file' => 'string', 'extra_service' => 'string', 'cards' => 'string[]', @@ -714,7 +714,7 @@ public function setCustomEnvelope($custom_envelope) /** * Gets to * - * @return string + * @return mixed */ public function getTo() { @@ -724,7 +724,7 @@ public function getTo() /** * Sets to * - * @param string $to Must either be an address ID or an inline object with correct address parameters. + * @param mixed $to Must either be an address ID or an inline object with correct address parameters. * * @return self */ @@ -739,7 +739,7 @@ public function setTo($to) /** * Gets from * - * @return string + * @return mixed */ public function getFrom() { @@ -749,7 +749,7 @@ public function getFrom() /** * Sets from * - * @param string $from Must either be an address ID or an inline object with correct address parameters. + * @param mixed $from Must either be an address ID or an inline object with correct address parameters. * * @return self */ diff --git a/lib/Model/OptionalAddressColumnMapping.php b/lib/Model/OptionalAddressColumnMapping.php new file mode 100755 index 00000000..5f7d45ad --- /dev/null +++ b/lib/Model/OptionalAddressColumnMapping.php @@ -0,0 +1,403 @@ + Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? + * + * The version of the OpenAPI document: 1.3.0 + * Contact: lob-openapi@lob.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 5.2.1 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace OpenAPI\Client\Model; + +use \ArrayAccess; +use \OpenAPI\Client\ObjectSerializer; + +/** + * OptionalAddressColumnMapping Class Doc Comment + * + * @category Class + * @description The mapping of column headers in your file to Lob-optional fields for the resource created. See our <a href=\"https://help.lob.com/print-and-mail/building-a-mail-strategy/campaign-or-triggered-sends/campaign-audience-guide#optional-columns-3\" target=\"_blank\">Campaign Audience Guide</a> for additional details. + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null + */ +class OptionalAddressColumnMapping implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'optional_address_column_mapping'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'address_line2' => 'string', + 'company' => 'string', + 'address_country' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'address_line2' => null, + 'company' => null, + 'address_country' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'address_line2' => 'address_line2', + 'company' => 'company', + 'address_country' => 'address_country' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'address_line2' => 'setAddressLine2', + 'company' => 'setCompany', + 'address_country' => 'setAddressCountry' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'address_line2' => 'getAddressLine2', + 'company' => 'getCompany', + 'address_country' => 'getAddressCountry' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['address_line2'] = $data['address_line2'] ?? null; + $this->container['company'] = $data['company'] ?? null; + $this->container['address_country'] = $data['address_country'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['address_line2'] === null) { + $invalidProperties[] = "'address_line2' can't be null"; + } + } + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['company'] === null) { + $invalidProperties[] = "'company' can't be null"; + } + } + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['address_country'] === null) { + $invalidProperties[] = "'address_country' can't be null"; + } + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + + /** + * Gets address_line2 + * + * @return string + */ + public function getAddressLine2() + { + return $this->container['address_line2']; + } + + /** + * Sets address_line2 + * + * @param string $address_line2 The column header from the csv file that should be mapped to the optional field \"address_line2\" + * + * @return self + */ + public function setAddressLine2($address_line2) + { + $this->container['address_line2'] = $address_line2; + + return $this; + } + + + /** + * Gets company + * + * @return string + */ + public function getCompany() + { + return $this->container['company']; + } + + /** + * Sets company + * + * @param string $company The column header from the csv file that should be mapped to the optional field \"company\" + * + * @return self + */ + public function setCompany($company) + { + $this->container['company'] = $company; + + return $this; + } + + + /** + * Gets address_country + * + * @return string + */ + public function getAddressCountry() + { + return $this->container['address_country']; + } + + /** + * Sets address_country + * + * @param string $address_country The column header from the csv file that should be mapped to the optional field \"address_country\" + * + * @return self + */ + public function setAddressCountry($address_country) + { + $this->container['address_country'] = $address_country; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/PostcardEditable.php b/lib/Model/PostcardEditable.php index 5dae686f..233bfce1 100755 --- a/lib/Model/PostcardEditable.php +++ b/lib/Model/PostcardEditable.php @@ -60,8 +60,8 @@ class PostcardEditable implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'to' => 'string', - 'from' => 'string', + 'to' => 'mixed', + 'from' => 'mixed', 'size' => '\OpenAPI\Client\Model\PostcardSize', 'description' => 'string', 'metadata' => 'array', @@ -301,7 +301,7 @@ public function valid() /** * Gets to * - * @return string + * @return mixed */ public function getTo() { @@ -311,7 +311,7 @@ public function getTo() /** * Sets to * - * @param string $to Must either be an address ID or an inline object with correct address parameters. + * @param mixed $to Must either be an address ID or an inline object with correct address parameters. * * @return self */ @@ -326,7 +326,7 @@ public function setTo($to) /** * Gets from * - * @return string|null + * @return mixed|null */ public function getFrom() { @@ -336,7 +336,7 @@ public function getFrom() /** * Sets from * - * @param string|null $from Required if `to` address is international. Must either be an address ID or an inline object with correct address parameters. + * @param mixed|null $from Required if `to` address is international. Must either be an address ID or an inline object with correct address parameters. * * @return self */ diff --git a/lib/Model/RequiredAddressColumnMapping.php b/lib/Model/RequiredAddressColumnMapping.php new file mode 100755 index 00000000..eb33dfe5 --- /dev/null +++ b/lib/Model/RequiredAddressColumnMapping.php @@ -0,0 +1,475 @@ + Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? + * + * The version of the OpenAPI document: 1.3.0 + * Contact: lob-openapi@lob.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 5.2.1 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace OpenAPI\Client\Model; + +use \ArrayAccess; +use \OpenAPI\Client\ObjectSerializer; + +/** + * RequiredAddressColumnMapping Class Doc Comment + * + * @category Class + * @description The mapping of column headers in your file to Lob-required fields for the resource created. See our <a href=\"https://help.lob.com/print-and-mail/building-a-mail-strategy/campaign-or-triggered-sends/campaign-audience-guide#required-columns-2\" target=\"_blank\">Campaign Audience Guide</a> for additional details. + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null + */ +class RequiredAddressColumnMapping implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'required_address_column_mapping'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'address_line1' => 'string', + 'address_city' => 'string', + 'address_state' => 'string', + 'address_zip' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'address_line1' => null, + 'address_city' => null, + 'address_state' => null, + 'address_zip' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'address_line1' => 'address_line1', + 'address_city' => 'address_city', + 'address_state' => 'address_state', + 'address_zip' => 'address_zip' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'address_line1' => 'setAddressLine1', + 'address_city' => 'setAddressCity', + 'address_state' => 'setAddressState', + 'address_zip' => 'setAddressZip' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'address_line1' => 'getAddressLine1', + 'address_city' => 'getAddressCity', + 'address_state' => 'getAddressState', + 'address_zip' => 'getAddressZip' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['name'] = $data['name'] ?? null; + $this->container['address_line1'] = $data['address_line1'] ?? null; + $this->container['address_city'] = $data['address_city'] ?? null; + $this->container['address_state'] = $data['address_state'] ?? null; + $this->container['address_zip'] = $data['address_zip'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + } + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['address_line1'] === null) { + $invalidProperties[] = "'address_line1' can't be null"; + } + } + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['address_city'] === null) { + $invalidProperties[] = "'address_city' can't be null"; + } + } + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['address_state'] === null) { + $invalidProperties[] = "'address_state' can't be null"; + } + } + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['address_zip'] === null) { + $invalidProperties[] = "'address_zip' can't be null"; + } + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The column header from the csv file that should be mapped to the required field `name` + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + + /** + * Gets address_line1 + * + * @return string + */ + public function getAddressLine1() + { + return $this->container['address_line1']; + } + + /** + * Sets address_line1 + * + * @param string $address_line1 The column header from the csv file that should be mapped to the required field `address_line1` + * + * @return self + */ + public function setAddressLine1($address_line1) + { + $this->container['address_line1'] = $address_line1; + + return $this; + } + + + /** + * Gets address_city + * + * @return string + */ + public function getAddressCity() + { + return $this->container['address_city']; + } + + /** + * Sets address_city + * + * @param string $address_city The column header from the csv file that should be mapped to the required field `address_city` + * + * @return self + */ + public function setAddressCity($address_city) + { + $this->container['address_city'] = $address_city; + + return $this; + } + + + /** + * Gets address_state + * + * @return string + */ + public function getAddressState() + { + return $this->container['address_state']; + } + + /** + * Sets address_state + * + * @param string $address_state The column header from the csv file that should be mapped to the required field `address_state` + * + * @return self + */ + public function setAddressState($address_state) + { + $this->container['address_state'] = $address_state; + + return $this; + } + + + /** + * Gets address_zip + * + * @return string + */ + public function getAddressZip() + { + return $this->container['address_zip']; + } + + /** + * Sets address_zip + * + * @param string $address_zip The column header from the csv file that should be mapped to the required field `address_zip` + * + * @return self + */ + public function setAddressZip($address_zip) + { + $this->container['address_zip'] = $address_zip; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/SelfMailerEditable.php b/lib/Model/SelfMailerEditable.php index 9de51bc7..ed62a1d3 100755 --- a/lib/Model/SelfMailerEditable.php +++ b/lib/Model/SelfMailerEditable.php @@ -60,8 +60,8 @@ class SelfMailerEditable implements ModelInterface, ArrayAccess, \JsonSerializab * @var string[] */ protected static $openAPITypes = [ - 'to' => 'string', - 'from' => 'string', + 'to' => 'mixed', + 'from' => 'mixed', 'size' => '\OpenAPI\Client\Model\SelfMailerSize', 'description' => 'string', 'metadata' => 'array', @@ -295,7 +295,7 @@ public function valid() /** * Gets to * - * @return string + * @return mixed */ public function getTo() { @@ -305,7 +305,7 @@ public function getTo() /** * Sets to * - * @param string $to Must either be an address ID or an inline object with correct address parameters. + * @param mixed $to Must either be an address ID or an inline object with correct address parameters. * * @return self */ @@ -320,7 +320,7 @@ public function setTo($to) /** * Gets from * - * @return string|null + * @return mixed|null */ public function getFrom() { @@ -330,7 +330,7 @@ public function getFrom() /** * Sets from * - * @param string|null $from Must either be an address ID or an inline object with correct address parameters. + * @param mixed|null $from Must either be an address ID or an inline object with correct address parameters. * * @return self */ diff --git a/lib/Model/Upload.php b/lib/Model/Upload.php index d4bf2867..ffee48c5 100755 --- a/lib/Model/Upload.php +++ b/lib/Model/Upload.php @@ -62,7 +62,6 @@ class Upload implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPITypes = [ 'id' => 'string', 'account_id' => 'string', - 'campaign_id' => 'string', 'mode' => 'string', 'failures_url' => 'string', 'original_filename' => 'string', @@ -73,7 +72,10 @@ class Upload implements ModelInterface, ArrayAccess, \JsonSerializable 'bytes_processed' => 'int', 'date_created' => '\DateTime', 'date_modified' => '\DateTime', - 'deleted' => 'bool' + 'required_address_column_mapping' => '\OpenAPI\Client\Model\RequiredAddressColumnMapping', + 'optional_address_column_mapping' => '\OpenAPI\Client\Model\OptionalAddressColumnMapping', + 'metadata' => '\OpenAPI\Client\Model\UploadsMetadata', + 'merge_variable_column_mapping' => 'object' ]; /** @@ -86,7 +88,6 @@ class Upload implements ModelInterface, ArrayAccess, \JsonSerializable protected static $openAPIFormats = [ 'id' => null, 'account_id' => null, - 'campaign_id' => null, 'mode' => null, 'failures_url' => null, 'original_filename' => null, @@ -97,7 +98,10 @@ class Upload implements ModelInterface, ArrayAccess, \JsonSerializable 'bytes_processed' => null, 'date_created' => 'date-time', 'date_modified' => 'date-time', - 'deleted' => null + 'required_address_column_mapping' => null, + 'optional_address_column_mapping' => null, + 'metadata' => null, + 'merge_variable_column_mapping' => null ]; /** @@ -129,7 +133,6 @@ public static function openAPIFormats() protected static $attributeMap = [ 'id' => 'id', 'account_id' => 'accountId', - 'campaign_id' => 'campaignId', 'mode' => 'mode', 'failures_url' => 'failuresUrl', 'original_filename' => 'originalFilename', @@ -140,7 +143,10 @@ public static function openAPIFormats() 'bytes_processed' => 'bytesProcessed', 'date_created' => 'dateCreated', 'date_modified' => 'dateModified', - 'deleted' => 'deleted' + 'required_address_column_mapping' => 'requiredAddressColumnMapping', + 'optional_address_column_mapping' => 'optionalAddressColumnMapping', + 'metadata' => 'metadata', + 'merge_variable_column_mapping' => 'mergeVariableColumnMapping' ]; /** @@ -151,7 +157,6 @@ public static function openAPIFormats() protected static $setters = [ 'id' => 'setId', 'account_id' => 'setAccountId', - 'campaign_id' => 'setCampaignId', 'mode' => 'setMode', 'failures_url' => 'setFailuresUrl', 'original_filename' => 'setOriginalFilename', @@ -162,7 +167,10 @@ public static function openAPIFormats() 'bytes_processed' => 'setBytesProcessed', 'date_created' => 'setDateCreated', 'date_modified' => 'setDateModified', - 'deleted' => 'setDeleted' + 'required_address_column_mapping' => 'setRequiredAddressColumnMapping', + 'optional_address_column_mapping' => 'setOptionalAddressColumnMapping', + 'metadata' => 'setMetadata', + 'merge_variable_column_mapping' => 'setMergeVariableColumnMapping' ]; /** @@ -173,7 +181,6 @@ public static function openAPIFormats() protected static $getters = [ 'id' => 'getId', 'account_id' => 'getAccountId', - 'campaign_id' => 'getCampaignId', 'mode' => 'getMode', 'failures_url' => 'getFailuresUrl', 'original_filename' => 'getOriginalFilename', @@ -184,7 +191,10 @@ public static function openAPIFormats() 'bytes_processed' => 'getBytesProcessed', 'date_created' => 'getDateCreated', 'date_modified' => 'getDateModified', - 'deleted' => 'getDeleted' + 'required_address_column_mapping' => 'getRequiredAddressColumnMapping', + 'optional_address_column_mapping' => 'getOptionalAddressColumnMapping', + 'metadata' => 'getMetadata', + 'merge_variable_column_mapping' => 'getMergeVariableColumnMapping' ]; /** @@ -261,7 +271,6 @@ public function __construct(array $data = null) { $this->container['id'] = $data['id'] ?? null; $this->container['account_id'] = $data['account_id'] ?? null; - $this->container['campaign_id'] = $data['campaign_id'] ?? null; $this->container['mode'] = $data['mode'] ?? null; $this->container['failures_url'] = $data['failures_url'] ?? null; $this->container['original_filename'] = $data['original_filename'] ?? null; @@ -272,7 +281,10 @@ public function __construct(array $data = null) $this->container['bytes_processed'] = $data['bytes_processed'] ?? null; $this->container['date_created'] = $data['date_created'] ?? null; $this->container['date_modified'] = $data['date_modified'] ?? null; - $this->container['deleted'] = $data['deleted'] ?? null; + $this->container['required_address_column_mapping'] = $data['required_address_column_mapping'] ?? null; + $this->container['optional_address_column_mapping'] = $data['optional_address_column_mapping'] ?? null; + $this->container['metadata'] = $data['metadata'] ?? null; + $this->container['merge_variable_column_mapping'] = $data['merge_variable_column_mapping'] ?? null; } /** @@ -300,17 +312,6 @@ public function listInvalidProperties() $invalidProperties[] = "'account_id' can't be null"; } } - if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { - if ($this->container['campaign_id'] === null) { - $invalidProperties[] = "'campaign_id' can't be null"; - } - } - if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { - if (!preg_match("/^cmp_[a-zA-Z0-9]+$/", $this->container['campaign_id'])) { - $invalidProperties[] = "invalid value for 'campaign_id', must be conform to the pattern /^cmp_[a-zA-Z0-9]+$/."; - } - - } if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { if ($this->container['mode'] === null) { $invalidProperties[] = "'mode' can't be null"; @@ -362,6 +363,26 @@ public function listInvalidProperties() $invalidProperties[] = "'date_modified' can't be null"; } } + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['required_address_column_mapping'] === null) { + $invalidProperties[] = "'required_address_column_mapping' can't be null"; + } + } + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['optional_address_column_mapping'] === null) { + $invalidProperties[] = "'optional_address_column_mapping' can't be null"; + } + } + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['metadata'] === null) { + $invalidProperties[] = "'metadata' can't be null"; + } + } + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['merge_variable_column_mapping'] === null) { + $invalidProperties[] = "'merge_variable_column_mapping' can't be null"; + } + } return $invalidProperties; } @@ -435,38 +456,6 @@ public function setAccountId($account_id) } - /** - * Gets campaign_id - * - * @return string - */ - public function getCampaignId() - { - return $this->container['campaign_id']; - } - - /** - * Sets campaign_id - * - * @param string $campaign_id Unique identifier prefixed with `cmp_`. - * - * @return self - */ - public function setCampaignId($campaign_id) - { - if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { - - if ((!preg_match("/^cmp_[a-zA-Z0-9]+$/", $campaign_id))) { - throw new \InvalidArgumentException("invalid value for $campaign_id when calling Upload., must conform to the pattern /^cmp_[a-zA-Z0-9]+$/."); - } - - } - $this->container['campaign_id'] = $campaign_id; - - return $this; - } - - /** * Gets mode * @@ -731,25 +720,100 @@ public function setDateModified($date_modified) /** - * Gets deleted + * Gets required_address_column_mapping + * + * @return \OpenAPI\Client\Model\RequiredAddressColumnMapping + */ + public function getRequiredAddressColumnMapping() + { + return $this->container['required_address_column_mapping']; + } + + /** + * Sets required_address_column_mapping + * + * @param \OpenAPI\Client\Model\RequiredAddressColumnMapping $required_address_column_mapping required_address_column_mapping + * + * @return self + */ + public function setRequiredAddressColumnMapping($required_address_column_mapping) + { + $this->container['required_address_column_mapping'] = $required_address_column_mapping; + + return $this; + } + + + /** + * Gets optional_address_column_mapping + * + * @return \OpenAPI\Client\Model\OptionalAddressColumnMapping + */ + public function getOptionalAddressColumnMapping() + { + return $this->container['optional_address_column_mapping']; + } + + /** + * Sets optional_address_column_mapping + * + * @param \OpenAPI\Client\Model\OptionalAddressColumnMapping $optional_address_column_mapping optional_address_column_mapping + * + * @return self + */ + public function setOptionalAddressColumnMapping($optional_address_column_mapping) + { + $this->container['optional_address_column_mapping'] = $optional_address_column_mapping; + + return $this; + } + + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\UploadsMetadata + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\UploadsMetadata $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + $this->container['metadata'] = $metadata; + + return $this; + } + + + /** + * Gets merge_variable_column_mapping * - * @return bool|null + * @return object */ - public function getDeleted() + public function getMergeVariableColumnMapping() { - return $this->container['deleted']; + return $this->container['merge_variable_column_mapping']; } /** - * Sets deleted + * Sets merge_variable_column_mapping * - * @param bool|null $deleted Only returned if the resource has been successfully deleted. + * @param object $merge_variable_column_mapping The mapping of column headers in your file to the merge variables present in your creative. See our Campaign Audience Guide for additional details.
If a merge variable has the same \"name\" as a \"key\" in the `requiredAddressColumnMapping` or `optionalAddressColumnMapping` objects, then they **CANNOT** have a different value in this object. If a different value is provided, then when the campaign is processing it will get overwritten with the mapped value present in the `requiredAddressColumnMapping` or `optionalAddressColumnMapping` objects. * * @return self */ - public function setDeleted($deleted) + public function setMergeVariableColumnMapping($merge_variable_column_mapping) { - $this->container['deleted'] = $deleted; + $this->container['merge_variable_column_mapping'] = $merge_variable_column_mapping; return $this; } diff --git a/lib/Model/UploadUpdatable.php b/lib/Model/UploadUpdatable.php index 4e43c643..f012ab3d 100755 --- a/lib/Model/UploadUpdatable.php +++ b/lib/Model/UploadUpdatable.php @@ -60,8 +60,11 @@ class UploadUpdatable implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'state' => '\OpenAPI\Client\Model\UploadState', - 'original_filename' => 'string' + 'original_filename' => 'string', + 'required_address_column_mapping' => '\OpenAPI\Client\Model\RequiredAddressColumnMapping', + 'optional_address_column_mapping' => '\OpenAPI\Client\Model\OptionalAddressColumnMapping', + 'metadata' => '\OpenAPI\Client\Model\UploadsMetadata', + 'merge_variable_column_mapping' => 'object' ]; /** @@ -72,8 +75,11 @@ class UploadUpdatable implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'state' => null, - 'original_filename' => null + 'original_filename' => null, + 'required_address_column_mapping' => null, + 'optional_address_column_mapping' => null, + 'metadata' => null, + 'merge_variable_column_mapping' => null ]; /** @@ -103,8 +109,11 @@ public static function openAPIFormats() * @var string[] */ protected static $attributeMap = [ - 'state' => 'state', - 'original_filename' => 'originalFilename' + 'original_filename' => 'originalFilename', + 'required_address_column_mapping' => 'requiredAddressColumnMapping', + 'optional_address_column_mapping' => 'optionalAddressColumnMapping', + 'metadata' => 'metadata', + 'merge_variable_column_mapping' => 'mergeVariableColumnMapping' ]; /** @@ -113,8 +122,11 @@ public static function openAPIFormats() * @var string[] */ protected static $setters = [ - 'state' => 'setState', - 'original_filename' => 'setOriginalFilename' + 'original_filename' => 'setOriginalFilename', + 'required_address_column_mapping' => 'setRequiredAddressColumnMapping', + 'optional_address_column_mapping' => 'setOptionalAddressColumnMapping', + 'metadata' => 'setMetadata', + 'merge_variable_column_mapping' => 'setMergeVariableColumnMapping' ]; /** @@ -123,8 +135,11 @@ public static function openAPIFormats() * @var string[] */ protected static $getters = [ - 'state' => 'getState', - 'original_filename' => 'getOriginalFilename' + 'original_filename' => 'getOriginalFilename', + 'required_address_column_mapping' => 'getRequiredAddressColumnMapping', + 'optional_address_column_mapping' => 'getOptionalAddressColumnMapping', + 'metadata' => 'getMetadata', + 'merge_variable_column_mapping' => 'getMergeVariableColumnMapping' ]; /** @@ -184,8 +199,11 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['state'] = $data['state'] ?? null; $this->container['original_filename'] = $data['original_filename'] ?? null; + $this->container['required_address_column_mapping'] = $data['required_address_column_mapping'] ?? null; + $this->container['optional_address_column_mapping'] = $data['optional_address_column_mapping'] ?? null; + $this->container['metadata'] = $data['metadata'] ?? null; + $this->container['merge_variable_column_mapping'] = $data['merge_variable_column_mapping'] ?? null; } /** @@ -214,50 +232,125 @@ public function valid() /** - * Gets state + * Gets original_filename * - * @return \OpenAPI\Client\Model\UploadState|null + * @return string|null */ - public function getState() + public function getOriginalFilename() { - return $this->container['state']; + return $this->container['original_filename']; } /** - * Sets state + * Sets original_filename * - * @param \OpenAPI\Client\Model\UploadState|null $state state + * @param string|null $original_filename Original filename provided when the upload is created. * * @return self */ - public function setState($state) + public function setOriginalFilename($original_filename) { - $this->container['state'] = $state; + $this->container['original_filename'] = $original_filename; return $this; } /** - * Gets original_filename + * Gets required_address_column_mapping * - * @return string|null + * @return \OpenAPI\Client\Model\RequiredAddressColumnMapping|null */ - public function getOriginalFilename() + public function getRequiredAddressColumnMapping() { - return $this->container['original_filename']; + return $this->container['required_address_column_mapping']; } /** - * Sets original_filename + * Sets required_address_column_mapping * - * @param string|null $original_filename Original filename provided when the upload is created. + * @param \OpenAPI\Client\Model\RequiredAddressColumnMapping|null $required_address_column_mapping required_address_column_mapping * * @return self */ - public function setOriginalFilename($original_filename) + public function setRequiredAddressColumnMapping($required_address_column_mapping) { - $this->container['original_filename'] = $original_filename; + $this->container['required_address_column_mapping'] = $required_address_column_mapping; + + return $this; + } + + + /** + * Gets optional_address_column_mapping + * + * @return \OpenAPI\Client\Model\OptionalAddressColumnMapping|null + */ + public function getOptionalAddressColumnMapping() + { + return $this->container['optional_address_column_mapping']; + } + + /** + * Sets optional_address_column_mapping + * + * @param \OpenAPI\Client\Model\OptionalAddressColumnMapping|null $optional_address_column_mapping optional_address_column_mapping + * + * @return self + */ + public function setOptionalAddressColumnMapping($optional_address_column_mapping) + { + $this->container['optional_address_column_mapping'] = $optional_address_column_mapping; + + return $this; + } + + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\UploadsMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\UploadsMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + $this->container['metadata'] = $metadata; + + return $this; + } + + + /** + * Gets merge_variable_column_mapping + * + * @return object|null + */ + public function getMergeVariableColumnMapping() + { + return $this->container['merge_variable_column_mapping']; + } + + /** + * Sets merge_variable_column_mapping + * + * @param object|null $merge_variable_column_mapping The mapping of column headers in your file to the merge variables present in your creative. See our Campaign Audience Guide for additional details.
If a merge variable has the same \"name\" as a \"key\" in the `requiredAddressColumnMapping` or `optionalAddressColumnMapping` objects, then they **CANNOT** have a different value in this object. If a different value is provided, then when the campaign is processing it will get overwritten with the mapped value present in the `requiredAddressColumnMapping` or `optionalAddressColumnMapping` objects. + * + * @return self + */ + public function setMergeVariableColumnMapping($merge_variable_column_mapping) + { + $this->container['merge_variable_column_mapping'] = $merge_variable_column_mapping; return $this; } diff --git a/lib/Model/UploadWritable.php b/lib/Model/UploadWritable.php index 69731d5d..5c4aa563 100755 --- a/lib/Model/UploadWritable.php +++ b/lib/Model/UploadWritable.php @@ -60,7 +60,11 @@ class UploadWritable implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'campaign_id' => 'string' + 'campaign_id' => 'string', + 'required_address_column_mapping' => '\OpenAPI\Client\Model\RequiredAddressColumnMapping', + 'optional_address_column_mapping' => '\OpenAPI\Client\Model\OptionalAddressColumnMapping', + 'metadata' => '\OpenAPI\Client\Model\UploadsMetadata', + 'merge_variable_column_mapping' => 'object' ]; /** @@ -71,7 +75,11 @@ class UploadWritable implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'campaign_id' => null + 'campaign_id' => null, + 'required_address_column_mapping' => null, + 'optional_address_column_mapping' => null, + 'metadata' => null, + 'merge_variable_column_mapping' => null ]; /** @@ -101,7 +109,11 @@ public static function openAPIFormats() * @var string[] */ protected static $attributeMap = [ - 'campaign_id' => 'campaignId' + 'campaign_id' => 'campaignId', + 'required_address_column_mapping' => 'requiredAddressColumnMapping', + 'optional_address_column_mapping' => 'optionalAddressColumnMapping', + 'metadata' => 'metadata', + 'merge_variable_column_mapping' => 'mergeVariableColumnMapping' ]; /** @@ -110,7 +122,11 @@ public static function openAPIFormats() * @var string[] */ protected static $setters = [ - 'campaign_id' => 'setCampaignId' + 'campaign_id' => 'setCampaignId', + 'required_address_column_mapping' => 'setRequiredAddressColumnMapping', + 'optional_address_column_mapping' => 'setOptionalAddressColumnMapping', + 'metadata' => 'setMetadata', + 'merge_variable_column_mapping' => 'setMergeVariableColumnMapping' ]; /** @@ -119,7 +135,11 @@ public static function openAPIFormats() * @var string[] */ protected static $getters = [ - 'campaign_id' => 'getCampaignId' + 'campaign_id' => 'getCampaignId', + 'required_address_column_mapping' => 'getRequiredAddressColumnMapping', + 'optional_address_column_mapping' => 'getOptionalAddressColumnMapping', + 'metadata' => 'getMetadata', + 'merge_variable_column_mapping' => 'getMergeVariableColumnMapping' ]; /** @@ -180,6 +200,10 @@ public function getModelName() public function __construct(array $data = null) { $this->container['campaign_id'] = $data['campaign_id'] ?? null; + $this->container['required_address_column_mapping'] = $data['required_address_column_mapping'] ?? null; + $this->container['optional_address_column_mapping'] = $data['optional_address_column_mapping'] ?? null; + $this->container['metadata'] = $data['metadata'] ?? null; + $this->container['merge_variable_column_mapping'] = $data['merge_variable_column_mapping'] ?? null; } /** @@ -196,12 +220,6 @@ public function listInvalidProperties() $invalidProperties[] = "'campaign_id' can't be null"; } } - if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { - if (!preg_match("/^cmp_[a-zA-Z0-9]+$/", $this->container['campaign_id'])) { - $invalidProperties[] = "invalid value for 'campaign_id', must be conform to the pattern /^cmp_[a-zA-Z0-9]+$/."; - } - - } return $invalidProperties; } @@ -231,20 +249,113 @@ public function getCampaignId() /** * Sets campaign_id * - * @param string $campaign_id Unique identifier prefixed with `cmp_`. + * @param string $campaign_id campaign_id * * @return self */ public function setCampaignId($campaign_id) { - if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + $this->container['campaign_id'] = $campaign_id; - if ((!preg_match("/^cmp_[a-zA-Z0-9]+$/", $campaign_id))) { - throw new \InvalidArgumentException("invalid value for $campaign_id when calling UploadWritable., must conform to the pattern /^cmp_[a-zA-Z0-9]+$/."); - } + return $this; + } - } - $this->container['campaign_id'] = $campaign_id; + + /** + * Gets required_address_column_mapping + * + * @return \OpenAPI\Client\Model\RequiredAddressColumnMapping|null + */ + public function getRequiredAddressColumnMapping() + { + return $this->container['required_address_column_mapping']; + } + + /** + * Sets required_address_column_mapping + * + * @param \OpenAPI\Client\Model\RequiredAddressColumnMapping|null $required_address_column_mapping required_address_column_mapping + * + * @return self + */ + public function setRequiredAddressColumnMapping($required_address_column_mapping) + { + $this->container['required_address_column_mapping'] = $required_address_column_mapping; + + return $this; + } + + + /** + * Gets optional_address_column_mapping + * + * @return \OpenAPI\Client\Model\OptionalAddressColumnMapping|null + */ + public function getOptionalAddressColumnMapping() + { + return $this->container['optional_address_column_mapping']; + } + + /** + * Sets optional_address_column_mapping + * + * @param \OpenAPI\Client\Model\OptionalAddressColumnMapping|null $optional_address_column_mapping optional_address_column_mapping + * + * @return self + */ + public function setOptionalAddressColumnMapping($optional_address_column_mapping) + { + $this->container['optional_address_column_mapping'] = $optional_address_column_mapping; + + return $this; + } + + + /** + * Gets metadata + * + * @return \OpenAPI\Client\Model\UploadsMetadata|null + */ + public function getMetadata() + { + return $this->container['metadata']; + } + + /** + * Sets metadata + * + * @param \OpenAPI\Client\Model\UploadsMetadata|null $metadata metadata + * + * @return self + */ + public function setMetadata($metadata) + { + $this->container['metadata'] = $metadata; + + return $this; + } + + + /** + * Gets merge_variable_column_mapping + * + * @return object|null + */ + public function getMergeVariableColumnMapping() + { + return $this->container['merge_variable_column_mapping']; + } + + /** + * Sets merge_variable_column_mapping + * + * @param object|null $merge_variable_column_mapping The mapping of column headers in your file to the merge variables present in your creative. See our Campaign Audience Guide for additional details.
If a merge variable has the same \"name\" as a \"key\" in the `requiredAddressColumnMapping` or `optionalAddressColumnMapping` objects, then they **CANNOT** have a different value in this object. If a different value is provided, then when the campaign is processing it will get overwritten with the mapped value present in the `requiredAddressColumnMapping` or `optionalAddressColumnMapping` objects. + * + * @return self + */ + public function setMergeVariableColumnMapping($merge_variable_column_mapping) + { + $this->container['merge_variable_column_mapping'] = $merge_variable_column_mapping; return $this; } diff --git a/lib/Model/UploadsMetadata.php b/lib/Model/UploadsMetadata.php new file mode 100755 index 00000000..09ce56cc --- /dev/null +++ b/lib/Model/UploadsMetadata.php @@ -0,0 +1,338 @@ + Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? + * + * The version of the OpenAPI document: 1.3.0 + * Contact: lob-openapi@lob.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 5.2.1 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace OpenAPI\Client\Model; + +use \ArrayAccess; +use \OpenAPI\Client\ObjectSerializer; + +/** + * UploadsMetadata Class Doc Comment + * + * @category Class + * @description The list of column headers in your file as an array that you want as metadata associated with each mailpiece. See our <a href=\"https://help.lob.com/print-and-mail/building-a-mail-strategy/campaign-or-triggered-sends/campaign-audience-guide#required-columns-2\" target=\"_blank\">Campaign Audience Guide</a> for additional details. + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null + */ +class UploadsMetadata implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'uploads_metadata'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'columns' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'columns' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'columns' => 'columns' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'columns' => 'setColumns' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'columns' => 'getColumns' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['columns'] = $data['columns'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { + if ($this->container['columns'] === null) { + $invalidProperties[] = "'columns' can't be null"; + } + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + + /** + * Gets columns + * + * @return string[] + */ + public function getColumns() + { + return $this->container['columns']; + } + + /** + * Sets columns + * + * @param string[] $columns The list of column names from the csv file which you want associated with each of your mailpieces + * + * @return self + */ + public function setColumns($columns) + { + $this->container['columns'] = []; + if ($columns) { + foreach ($columns as $point) { + + $deserializedData = (string) $point; + array_push($this->container['columns'], $deserializedData); + } + } + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/UsComponents.php b/lib/Model/UsComponents.php index 2d064218..bcb161e7 100755 --- a/lib/Model/UsComponents.php +++ b/lib/Model/UsComponents.php @@ -581,8 +581,8 @@ public function listInvalidProperties() } } if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { - if (!preg_match("/^\\d{4}$/", $this->container['zip_code_plus_4'])) { - $invalidProperties[] = "invalid value for 'zip_code_plus_4', must be conform to the pattern /^\\d{4}$/."; + if (!preg_match("/^(\\d{4})?$/", $this->container['zip_code_plus_4'])) { + $invalidProperties[] = "invalid value for 'zip_code_plus_4', must be conform to the pattern /^(\\d{4})?$/."; } } @@ -1096,8 +1096,8 @@ public function setZipCodePlus4($zip_code_plus_4) { if (!method_exists($this, 'getId') || (!empty($this->getId()) && strpos($this->getId(), "fakeId") === False)) { - if ((!preg_match("/^\\d{4}$/", $zip_code_plus_4))) { - throw new \InvalidArgumentException("invalid value for $zip_code_plus_4 when calling UsComponents., must conform to the pattern /^\\d{4}$/."); + if ((!preg_match("/^(\\d{4})?$/", $zip_code_plus_4))) { + throw new \InvalidArgumentException("invalid value for $zip_code_plus_4 when calling UsComponents., must conform to the pattern /^(\\d{4})?$/."); } } diff --git a/test/Integration/UploadsApiSpecTest.php b/test/Integration/UploadsApiSpecTest.php new file mode 100644 index 00000000..f017ac20 --- /dev/null +++ b/test/Integration/UploadsApiSpecTest.php @@ -0,0 +1,254 @@ + Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? + * + * The version of the OpenAPI document: 1.3.0 + * Contact: lob-openapi@lob.com + * Generated by: https://openapi-generator.tech + * OpenAPI Generator version: 5.2.1 + */ + +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Please update the test case below to test the endpoint. + */ + +namespace OpenAPI\Client\Test\Api; + +use \OpenAPI\Client\Configuration; +use \OpenAPI\Client\ApiException; +use \OpenAPI\Client\ObjectSerializer; +use PHPUnit\Framework\TestCase; +use \OpenAPI\Client\Api\CampaignsApi; +use \OpenAPI\Client\Api\UploadsApi; +use \OpenAPI\Client\Model\CampaignWritable; +use \OpenAPI\Client\Model\CmpScheduleType; +use \OpenAPI\Client\Model\UploadWritable; +use \OpenAPI\Client\Model\UploadUpdatable; +use \OpenAPI\Client\Model\RequiredAddressColumnMapping; +use \OpenAPI\Client\Model\ExportModel; + +/** + * UploadsApiSpecTest Class Doc Comment + * + * @category Class + * @package OpenAPI\Client + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ + +class UploadsApiSpecTest extends TestCase +{ + /** + * Setup before running any test cases + */ + private static $config; + private static $uploadApi; + private static $campaignApi; + private static $campaign; + private static $uploadWritable; + + // set up constant fixtures + public static function setUpBeforeClass(): void + { + // create instance of UploadsApiSpecTest & campaign + self::$config = new Configuration(); + self::$config->setApiKey('basic', getenv('LOB_API_TEST_KEY')); + self::$uploadApi = new UploadsApi(self::$config); + + self::$campaignApi = new CampaignsApi(self::$config); + $campaignWritable = new CampaignWritable(); + $campaignWritable->setName("PHP Integration Test Upload"); + $campaignWritable->setScheduleType(CmpScheduleType::IMMEDIATE->value); + + self::$campaign = self::$campaignApi->create($campaignWritable); + + self::$uploadWritable = new UploadWritable(); + self::$uploadWritable->setCampaignId(self::$campaign->getId()); + } + + public static function tearDownAfterClass(): void + { + self::$campaignApi->delete(self::$campaign->getId()); + } + + /** + * @group integration + * @group uploads + */ + public function testUploadsApiInstantiation200() + { + try { + $uploadApi = new UploadsApi(self::$config); + $this->assertEquals(gettype($uploadApi), 'object'); + } catch (\Exception $e) { + throw new \Exception($e->getMessage()); + } + } + + /** + * @group integration + * @group uploads + */ + public function testCreate() + { + try { + $createdUpload = self::$uploadApi->create_upload(self::$uploadWritable); + $this->assertMatchesRegularExpression('/upl/', $createdUpload->getId()); + + // cleanup + self::$uploadApi->delete_upload($createdUpload->getId()); + } catch (\Exception $e) { + throw new \Exception($e->getMessage()); + } + } + + /** + * @group integration + * @group uploads + */ + public function testGet() + { + try { + $createdUpload = self::$uploadApi->create_upload(self::$uploadWritable); + + $retrievedUpload = self::$uploadApi->get_upload($createdUpload->getId()); + $this->assertEquals($createdUpload->getId(), $retrievedUpload->getId()); + + // cleanup + self::$uploadApi->delete_upload($createdUpload->getId()); + } catch (\Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + } + } + + /** + * @group integration + * @group uploads + */ + public function testList() + { + try { + $createdUpload = self::$uploadApi->create_upload(self::$uploadWritable); + + $listOfUploads = self::$uploadApi->list_upload(self::$campaign->getId()); + $this->assertGreaterThan(0, count($listOfUploads)); + $this->assertNotNull($listOfUploads[0]->getId()); + + // cleanup + self::$uploadApi->delete_upload($createdUpload->getId()); + } catch (\Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; + } + } + + /** + * @group integration + * @group uploads + */ + public function testUpdate() + { + $uploadUpdatable = new UploadUpdatable(); + $requiredAddressColumnMapping = new RequiredAddressColumnMapping(); + $requiredAddressColumnMapping->setName("recipient"); + $requiredAddressColumnMapping->setAddressLine1("primary line"); + $requiredAddressColumnMapping->setAddressCity("city"); + $requiredAddressColumnMapping->setAddressState("state"); + $requiredAddressColumnMapping->setAddressZip("zip_code"); + + $uploadUpdatable->setRequiredAddressColumnMapping($requiredAddressColumnMapping); + + try { + $createdUpload = self::$uploadApi->create_upload(self::$uploadWritable); + + $updatedUpload = self::$uploadApi->update_upload($createdUpload->getId(), $uploadUpdatable); + $this->assertEquals($updatedUpload->getRequiredAddressColumnMapping()->name, $requiredAddressColumnMapping->getName()); + + // cleanup + self::$uploadApi->delete_upload($createdUpload->getId()); + } catch (Exception $e) { + echo $e->getMessage(), PHP_EOL; + } + } + + /** + * @group integration + * @group uploads + */ + public function testUploadFile() { + try { + $createdUpload = self::$uploadApi->create_upload(self::$uploadWritable); + + $myFile = new \SplFileObject("test/assets/lobster-family.csv", "r"); + + $upload = self::$uploadApi->upload_file($createdUpload->getId(), $myFile); + $this->assertEquals("File uploaded successfully", $upload["message"]); + + // cleanup + self::$uploadApi->delete_upload($createdUpload->getId()); + } catch (\Exception $e) { + throw new \Exception($e->getMessage()); + } + } + + /** + * @group integration + * @group uploads + */ + public function testCreateExport() + { + try { + $createdUpload = self::$uploadApi->create_upload(self::$uploadWritable); + $this->assertMatchesRegularExpression('/upl/', $createdUpload->getId()); + + $exportModel = new ExportModel(); + $exportModel->setType("failures"); + + $export = self::$uploadApi->create_export($createdUpload->getId(), $exportModel); + $this->assertNotNull($export->getExportId()); + + // cleanup + self::$uploadApi->delete_upload($createdUpload->getId()); + } catch (\Exception $e) { + throw new \Exception($e->getMessage()); + } + } + + /** + * @group integration + * @group uploads + */ + public function testRetrieveExport() + { + try { + $createdUpload = self::$uploadApi->create_upload(self::$uploadWritable); + $this->assertMatchesRegularExpression('/upl/', $createdUpload->getId()); + + $exportModel = new ExportModel(); + $exportModel->setType("failures"); + + $createdExport = self::$uploadApi->create_export($createdUpload->getId(), $exportModel); + + $export = self::$uploadApi->get_export($createdUpload->getId(), $createdExport->getExportId()); + $this->assertEquals($export->getId(), $createdExport->getExportId()); + + // cleanup + self::$uploadApi->delete_upload($createdUpload->getId()); + } catch (\Exception $e) { + throw new \Exception($e->getMessage()); + } + } +} diff --git a/test/assets/lobster-family.csv b/test/assets/lobster-family.csv new file mode 100644 index 00000000..306bf273 --- /dev/null +++ b/test/assets/lobster-family.csv @@ -0,0 +1,11 @@ +recipient,primary line,city,state,zip_code +Larry Lobster,210 King St,San Francisco,CA,94107 +Lloyd Lobster,210 King St,San Francisco,CA,94107 +Lisa Lobster,210 King St,San Francisco,CA,94107 +Linda Lobster,210 King St,San Francisco,CA,94107 +Leith Lobster,210 King St,San Francisco,CA,94107 +Lala Lobster,Not A Real Street,San Francisco,CA,94107 +Krusty Krab,212 King St,San Francisco,CA,94107 +Patrick Star,211 King St,San Francisco,CA,94107 +Christopher Crawdad,209 King St,San Francisco,CA,94107 +Lost Lobster,210 King St,,CA, From cdc61534a8e8fa96c0a2da5cf75f95521059a9eb Mon Sep 17 00:00:00 2001 From: Jessica Ho Date: Tue, 20 Dec 2022 02:26:59 -0800 Subject: [PATCH 2/2] docs: uploads snippets --- CODE_SNIPPETS.md | 203 ++++++++++++++++++++++-- lib/Api/UploadsApi.php | 2 +- test/Integration/UploadsApiSpecTest.php | 4 +- 3 files changed, 189 insertions(+), 20 deletions(-) diff --git a/CODE_SNIPPETS.md b/CODE_SNIPPETS.md index 65cffd5a..e363e06a 100644 --- a/CODE_SNIPPETS.md +++ b/CODE_SNIPPETS.md @@ -100,7 +100,7 @@ $apiInstance = new OpenAPI\Client\Api\AddressesApi($config, new GuzzleHttp\Clien try { $result = $apiInstance->list( - 2, // limit + 2, // limit ); print_r($result); } catch (Exception $e) { @@ -259,7 +259,7 @@ $apiInstance = new OpenAPI\Client\Api\PostcardsApi($config, new GuzzleHttp\Clien try { $result = $apiInstance->list( - 2, // limit + 2, // limit ); print_r($result); } catch (Exception $e) { @@ -378,7 +378,7 @@ $apiInstance = new OpenAPI\Client\Api\SelfMailersApi($config, new GuzzleHttp\Cli try { $result = $apiInstance->list( - 2, // limit + 2, // limit ); print_r($result); } catch (Exception $e) { @@ -503,7 +503,7 @@ $apiInstance = new OpenAPI\Client\Api\LettersApi($config, new GuzzleHttp\Client( try { $result = $apiInstance->list( - 2, // limit + 2, // limit ); print_r($result); } catch (Exception $e) { @@ -628,7 +628,7 @@ $apiInstance = new OpenAPI\Client\Api\ChecksApi($config, new GuzzleHttp\Client() try { $result = $apiInstance->list( - 2, // limit + 2, // limit ); print_r($result); } catch (Exception $e) { @@ -692,7 +692,7 @@ $apiInstance = new OpenAPI\Client\Api\BankAccountsApi($config, new GuzzleHttp\Cl try { $result = $apiInstance->list( - 2, // limit + 2, // limit ); print_r($result); } catch (Exception $e) { @@ -706,9 +706,9 @@ try { ### Verify ```bash curl https://api.lob.com/v1/bank_accounts/bank_dfceb4a2a05b57e/verify \ - -u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \ - -d "amounts[]=25" \ - -d "amounts[]=63" \ + -u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \ + -d "amounts[]=25" \ + -d "amounts[]=63" \ ``` ```php @@ -821,7 +821,7 @@ $apiInstance = new OpenAPI\Client\Api\TemplatesApi($config, new GuzzleHttp\Clien try { $result = $apiInstance->list( - 2, // limit + 2, // limit ); print_r($result); } catch (Exception $e) { @@ -941,8 +941,8 @@ $apiInstance = new OpenAPI\Client\Api\TemplateVersionsApi($config, new GuzzleHtt try { $result = $apiInstance->list( - tmpl_dadaaf7b76c9f25, // tmplId - 2, // limit + tmpl_dadaaf7b76c9f25, // tmplId + 2, // limit ); print_r($result); } catch (Exception $e) { @@ -1005,6 +1005,177 @@ try { } ``` +## Uploads Api + +### List +```bash +curl -X GET "https://api.lob.com/v1/uploads?limit=2" \ + -u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: +``` + +```php +$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client()); + +try { + $result = $apiInstance->list_upload(); + print_r($result); +} catch (Exception $e) { + echo $e->getMessage(), PHP_EOL; +} +``` + + + +### Retrieve Export +```bash +curl https://api.lob.com/v1/uploads/upl_71be866e430b11e9/exports/ex_6a94fe68fd151e0f8 \ + -u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \ + -d "type=failures" +``` + +```php +$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client()); + +try { + $export = $apiInstance->get_export("upl_71be866e430b11e9", "ex_6a94fe68fd151e0f8"); + print_r($export); +} catch (Exception $e) { + echo $e->getMessage(), PHP_EOL; +} +``` + + + +### Upload File + +```bash +curl -X POST https://api.lob.com/v1/uploads/upl_71be866e430b11e9/file \ + -u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \ + -F file=@ +``` + +```php +$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client()); +$myFile = new \SplFileObject("", "r"); + +try { + $upload = $apiInstance->upload_file("upl_71be866e430b11e9", $myFile); + print_r($upload); +} catch (Exception $e) { + echo $e->getMessage(), PHP_EOL; +} +``` + +### Retrieve +```bash +curl https://api.lob.com/v1/uploads/upl_71be866e430b11e9 \ + -u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: +``` + +```php +$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client()); + +try { + $result = $apiInstance->get_upload("upl_71be866e430b11e9"); + print_r($result); +} catch (Exception $e) { + echo $e->getMessage(), PHP_EOL; +} +``` + + + + +### Create Export +```bash +curl https://api.lob.com/v1/uploads/upl_71be866e430b11e9/exports \ + -u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \ + -d "type=failures" +``` + +```php +$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client()); + +$exportModel = new ExportModel(); +$exportModel->setType("all"); + +try { + $export = $apiInstance->create_export("upl_71be866e430b11e9", $exportModel); + print_r($export); +} catch (Exception $e) { + echo $e->getMessage(), PHP_EOL; +} +``` + + + +### Update +```bash +curl -X PATCH https://api.lob.com/v1/upl_71be866e430b11e9 \ + -u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \ + -d "state=Ready for Validation" \ +``` + +```php +$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client()); + +$uploadUpdatable = new OpenAPI\Client\Model\UploadUpdatable(); + +$requiredAddressColumnMapping = new OpenAPI\Client\Model\RequiredAddressColumnMapping(); +$requiredAddressColumnMapping->setName("recipient"); +$requiredAddressColumnMapping->setAddressLine1("primary line"); +$requiredAddressColumnMapping->setAddressCity("city"); +$requiredAddressColumnMapping->setAddressState("state"); +$requiredAddressColumnMapping->setAddressZip("zip_code"); + +$uploadUpdatable->setRequiredAddressColumnMapping($requiredAddressColumnMapping); + +try { + $result = $apiInstance->update_upload("upl_71be866e430b11e9", $uploadUpdatable); + print_r($result); +} catch (Exception $e) { + echo $e->getMessage(), PHP_EOL; +} +``` + + +### Create +```bash +curl https://api.lob.com/v1/uploads \ + -u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: \ + -d "campaignId=cmp_e05ee61ff80764b" \ +``` + +```php +$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client()); +$upload_writable = new OpenAPI\Client\Model\UploadWritable(); +$upload_writable->setCampaignId("cmp_e05ee61ff80764b"); + +try { + $result = $apiInstance->create_upload($upload_writable); + print_r($result); +} catch (Exception $e) { + echo $e->getMessage(), PHP_EOL; +} +``` + + +### Delete +```bash +curl -X DELETE "https://api.lob.com/v1/uploads/upl_71be866e430b11e9" \ + -u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc: +``` + +```php +$apiInstance = new OpenAPI\Client\Api\UploadsApi($config, new GuzzleHttp\Client()); + +try { + $result = $apiInstance->delete_upload("upl_71be866e430b11e9"); + print_r($result); +} catch (Exception $e) { + echo $e->getMessage(), PHP_EOL; +} +``` ## IntlVerifications Api @@ -1056,14 +1227,14 @@ curl https://api.lob.com/v1/bulk/intl_verifications \ ```php -$verificationData0 = new OpenAPI\Client\Model\MultipleComponentsIntl(array( +$verificationData0 = new OpenAPI\Client\Model\MultipleComponentsIntl(array( 'primary_line' => '35 Tower Hill', 'city' => 'London', 'postal_code' => 'EC3N 4DR', 'country' => 'GB', )); -$verificationData1 = new OpenAPI\Client\Model\MultipleComponentsIntl(array( +$verificationData1 = new OpenAPI\Client\Model\MultipleComponentsIntl(array( 'primary_line' => '370 Water St', 'city' => 'Summerside', 'state' => 'Prince Edward Island', @@ -1105,14 +1276,14 @@ curl https://api.lob.com/v1/bulk/us_verifications \ ```php -$verificationData0 = new OpenAPI\Client\Model\MultipleComponents(array( +$verificationData0 = new OpenAPI\Client\Model\MultipleComponents(array( 'primary_line' => '210 King Street', 'city' => 'San Francisco', 'state' => 'CA', 'zip_code' => '94017', )); -$verificationData1 = new OpenAPI\Client\Model\MultipleComponents(array( +$verificationData1 = new OpenAPI\Client\Model\MultipleComponents(array( 'primary_line' => '185 BERRY ST STE 6600', 'city' => 'SAN FRANCISCO', 'state' => 'CA', diff --git a/lib/Api/UploadsApi.php b/lib/Api/UploadsApi.php index 12de2aec..fe53e1bc 100755 --- a/lib/Api/UploadsApi.php +++ b/lib/Api/UploadsApi.php @@ -811,7 +811,7 @@ public function upload_fileWithHttpInfo($upl_id, $file) [ 'multipart' => [[ 'name' => 'file', - 'contents' => Utils::tryFopen('/Users/jessica-ho/Desktop/lob-php/test/assets/lobster-family.csv', 'r') + 'contents' => Utils::tryFopen($file, 'r') ]], 'auth' => $options['auth'] ] diff --git a/test/Integration/UploadsApiSpecTest.php b/test/Integration/UploadsApiSpecTest.php index f017ac20..3140c8e6 100644 --- a/test/Integration/UploadsApiSpecTest.php +++ b/test/Integration/UploadsApiSpecTest.php @@ -192,9 +192,7 @@ public function testUploadFile() { try { $createdUpload = self::$uploadApi->create_upload(self::$uploadWritable); - $myFile = new \SplFileObject("test/assets/lobster-family.csv", "r"); - - $upload = self::$uploadApi->upload_file($createdUpload->getId(), $myFile); + $upload = self::$uploadApi->upload_file($createdUpload->getId(), "test/assets/lobster-family.csv"); $this->assertEquals("File uploaded successfully", $upload["message"]); // cleanup