From 35ee36802c50d053df31dbda286db1805034878b Mon Sep 17 00:00:00 2001 From: BennyKitchell Date: Fri, 4 Nov 2022 21:06:42 -0500 Subject: [PATCH 1/2] feat: remove cmp, creative, upld until stable --- lob_python/api/campaigns_api.py | 736 ----------- lob_python/api/creatives_api.py | 458 ------- lob_python/api/uploads_api.py | 1124 ----------------- lob_python/model/campaign.py | 4 +- .../{upload_list.py => campaign_creative.py} | 111 +- ...pload_deletion.py => campaign_deletion.py} | 12 +- lob_python/model/campaign_updatable.py | 0 lob_python/model/campaign_writable.py | 0 lob_python/model/campaigns_list.py | 0 lob_python/model/cmp_id.py | 0 lob_python/model/cmp_schedule_type.py | 0 lob_python/model/cmp_use_type.py | 0 lob_python/model/creative_patch.py | 0 lob_python/model/creative_response.py | 0 lob_python/model/creative_writable.py | 0 lob_python/model/crv_id.py | 0 lob_python/model/upl_id.py | 289 ----- lob_python/model/upload.py | 350 ----- lob_python/model/upload_create_export.py | 273 ---- lob_python/model/upload_file.py | 273 ---- lob_python/model/upload_state.py | 286 ----- lob_python/model/upload_updatable.py | 270 ---- lob_python/model/upload_writable.py | 270 ---- test/Integration/test_campaigns_api.py | 227 ---- test/Integration/test_creatives_api.py | 216 ---- test/Integration/test_exports_api.py | 90 -- test/Integration/test_uploads_api.py | 260 ---- test/Integration/test_us_verifications_api.py | 140 -- test/Unit/test_campaigns_api.py | 414 +++--- test/Unit/test_creatives_api.py | 274 ++-- test/Unit/test_exports_api.py | 194 ++- test/Unit/test_uploads_api.py | 416 +++--- 32 files changed, 720 insertions(+), 5967 deletions(-) delete mode 100755 lob_python/api/campaigns_api.py delete mode 100755 lob_python/api/creatives_api.py delete mode 100755 lob_python/api/uploads_api.py mode change 100755 => 100644 lob_python/model/campaign.py rename lob_python/model/{upload_list.py => campaign_creative.py} (65%) mode change 100755 => 100644 rename lob_python/model/{upload_deletion.py => campaign_deletion.py} (95%) mode change 100755 => 100644 mode change 100755 => 100644 lob_python/model/campaign_updatable.py mode change 100755 => 100644 lob_python/model/campaign_writable.py mode change 100755 => 100644 lob_python/model/campaigns_list.py mode change 100755 => 100644 lob_python/model/cmp_id.py mode change 100755 => 100644 lob_python/model/cmp_schedule_type.py mode change 100755 => 100644 lob_python/model/cmp_use_type.py mode change 100755 => 100644 lob_python/model/creative_patch.py mode change 100755 => 100644 lob_python/model/creative_response.py mode change 100755 => 100644 lob_python/model/creative_writable.py mode change 100755 => 100644 lob_python/model/crv_id.py delete mode 100755 lob_python/model/upl_id.py delete mode 100755 lob_python/model/upload.py delete mode 100755 lob_python/model/upload_create_export.py delete mode 100755 lob_python/model/upload_file.py delete mode 100755 lob_python/model/upload_state.py delete mode 100755 lob_python/model/upload_updatable.py delete mode 100755 lob_python/model/upload_writable.py delete mode 100644 test/Integration/test_campaigns_api.py delete mode 100644 test/Integration/test_creatives_api.py delete mode 100644 test/Integration/test_exports_api.py delete mode 100644 test/Integration/test_uploads_api.py delete mode 100644 test/Integration/test_us_verifications_api.py diff --git a/lob_python/api/campaigns_api.py b/lob_python/api/campaigns_api.py deleted file mode 100755 index 06a44af..0000000 --- a/lob_python/api/campaigns_api.py +++ /dev/null @@ -1,736 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from lob_python.api_client import ApiClient, Endpoint as _Endpoint -from lob_python.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from lob_python.model.campaign import Campaign -from lob_python.model.campaign_updatable import CampaignUpdatable -from lob_python.model.campaign_writable import CampaignWritable -from lob_python.model.campaigns_list import CampaignsList -from lob_python.model.cmp_id import CmpId -from lob_python.model.include_model import IncludeModel -from lob_python.model.lob_error import LobError - - -class CampaignsApi(object): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - self.create_endpoint = _Endpoint( - settings={ - 'response_type': (Campaign,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/campaigns', - 'operation_id': 'create', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'campaign_writable', - 'x_lang_output', - ], - 'required': [ - 'campaign_writable', - ], - 'nullable': [ - ], - 'enum': [ - 'x_lang_output', - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - ('x_lang_output',): { - - "NATIVE": "native", - "MATCH": "match" - }, - }, - 'openapi_types': { - 'campaign_writable': - (CampaignWritable,), - 'x_lang_output': - (str,), - }, - 'attribute_map': { - 'x_lang_output': 'x-lang-output', - }, - 'location_map': { - 'campaign_writable': 'body', - 'x_lang_output': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json', - 'application/x-www-form-urlencoded', - 'multipart/form-data' - ] - }, - api_client=api_client - ) - self.delete_endpoint = _Endpoint( - settings={ - 'response_type': (dict,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/campaigns/{cmp_id}', - 'operation_id': 'delete', - 'http_method': 'DELETE', - 'servers': None, - }, - params_map={ - 'all': [ - 'cmp_id', - ], - 'required': [ - 'cmp_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'cmp_id': - (CmpId,), - }, - 'attribute_map': { - 'cmp_id': 'cmp_id', - }, - 'location_map': { - 'cmp_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.get_endpoint = _Endpoint( - settings={ - 'response_type': (Campaign,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/campaigns/{cmp_id}', - 'operation_id': 'get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'cmp_id', - ], - 'required': [ - 'cmp_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'cmp_id': - (CmpId,), - }, - 'attribute_map': { - 'cmp_id': 'cmp_id', - }, - 'location_map': { - 'cmp_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.update_endpoint = _Endpoint( - settings={ - 'response_type': (Campaign,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/campaigns/{cmp_id}', - 'operation_id': 'update', - 'http_method': 'PATCH', - 'servers': None, - }, - params_map={ - 'all': [ - 'cmp_id', - 'campaign_updatable', - ], - 'required': [ - 'cmp_id', - 'campaign_updatable', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'cmp_id': - (CmpId,), - 'campaign_updatable': - (CampaignUpdatable,), - }, - 'attribute_map': { - 'cmp_id': 'cmp_id', - }, - 'location_map': { - 'cmp_id': 'path', - 'campaign_updatable': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json', - 'application/x-www-form-urlencoded', - 'multipart/form-data' - ] - }, - api_client=api_client - ) - self.list_endpoint = _Endpoint( - settings={ - 'response_type': (CampaignsList,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/campaigns', - 'operation_id': 'list', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'limit', - 'include', - 'before', - 'after', - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - 'limit', - ] - }, - root_map={ - 'validations': { - ('limit',): { - - 'inclusive_maximum': 100, - 'inclusive_minimum': 1, - }, - }, - 'allowed_values': { - }, - 'openapi_types': { - 'limit': - (int,), - 'include': - (IncludeModel,), - 'before': - (str,), - 'after': - (str,), - }, - 'attribute_map': { - 'limit': 'limit', - 'include': 'include', - 'before': 'before', - 'after': 'after', - }, - 'location_map': { - 'limit': 'query', - 'include': 'query', - 'before': 'query', - 'after': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - - def create( - self, - campaign_writable, - **kwargs - ): - """create # noqa: E501 - - Creates a new campaign with the provided properties. See how to launch your first campaign [here](https://help.lob.com/best-practices/launching-your-first-campaign). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create(campaign_writable, async_req=True) - >>> result = thread.get() - - Args: - campaign_writable (CampaignWritable): - - Keyword Args: - x_lang_output (str): * `native` - Translate response to the native language of the country in the request * `match` - match the response to the language in the request Default response is in English. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Campaign - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['campaign_writable'] = \ - campaign_writable - return self.create_endpoint.call_with_http_info(**kwargs) - - def delete( - self, - cmp_id, - **kwargs - ): - """delete # noqa: E501 - - Delete an existing campaign. You need only supply the unique identifier that was returned upon campaign creation. Deleting a campaign also deletes any associated mail pieces that have been created but not sent. A campaign's `send_date` matches its associated mail pieces' `send_date`s. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete(cmp_id, async_req=True) - >>> result = thread.get() - - Args: - cmp_id (CmpId): id of the campaign - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - dict - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['cmp_id'] = \ - cmp_id - return self.delete_endpoint.call_with_http_info(**kwargs) - - def get( - self, - cmp_id, - **kwargs - ): - """get # noqa: E501 - - Retrieves the details of an existing campaign. You need only supply the unique campaign identifier that was returned upon campaign creation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get(cmp_id, async_req=True) - >>> result = thread.get() - - Args: - cmp_id (CmpId): id of the campaign - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Campaign - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['cmp_id'] = \ - cmp_id - return self.get_endpoint.call_with_http_info(**kwargs) - - def update( - self, - cmp_id, - campaign_updatable, - **kwargs - ): - """update # noqa: E501 - - Update the details of an existing campaign. You need only supply the unique identifier that was returned upon campaign creation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update(cmp_id, campaign_updatable, async_req=True) - >>> result = thread.get() - - Args: - cmp_id (CmpId): id of the campaign - campaign_updatable (CampaignUpdatable): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Campaign - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['cmp_id'] = \ - cmp_id - kwargs['campaign_updatable'] = \ - campaign_updatable - return self.update_endpoint.call_with_http_info(**kwargs) - - def list( - self, - **kwargs - ): - """list # noqa: E501 - - Returns a list of your campaigns. The campaigns are returned sorted by creation date, with the most recently created campaigns appearing first. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list(async_req=True) - >>> result = thread.get() - - - Keyword Args: - limit (int): How many results to return.. [optional] if omitted the server will use the default value of 10 - include (IncludeModel): Request that the response include the total count by specifying `include[]=total_count`. . [optional] - before (str): A reference to a list entry used for paginating to the previous set of entries. This field is pre-populated in the `previous_url` field in the return response. . [optional] - after (str): A reference to a list entry used for paginating to the next set of entries. This field is pre-populated in the `next_url` field in the return response. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - CampaignsList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.list_endpoint.call_with_http_info(**kwargs) - diff --git a/lob_python/api/creatives_api.py b/lob_python/api/creatives_api.py deleted file mode 100755 index 8776fc6..0000000 --- a/lob_python/api/creatives_api.py +++ /dev/null @@ -1,458 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from lob_python.api_client import ApiClient, Endpoint as _Endpoint -from lob_python.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from lob_python.model.creative_patch import CreativePatch -from lob_python.model.creative_response import CreativeResponse -from lob_python.model.creative_writable import CreativeWritable -from lob_python.model.crv_id import CrvId -from lob_python.model.lob_error import LobError - - -class CreativesApi(object): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - self.create_endpoint = _Endpoint( - settings={ - 'response_type': (CreativeResponse,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/creatives', - 'operation_id': 'create', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'creative_writable', - 'x_lang_output', - ], - 'required': [ - 'creative_writable', - ], - 'nullable': [ - ], - 'enum': [ - 'x_lang_output', - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - ('x_lang_output',): { - - "NATIVE": "native", - "MATCH": "match" - }, - }, - 'openapi_types': { - 'creative_writable': - (CreativeWritable,), - 'x_lang_output': - (str,), - }, - 'attribute_map': { - 'x_lang_output': 'x-lang-output', - }, - 'location_map': { - 'creative_writable': 'body', - 'x_lang_output': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json', - 'application/x-www-form-urlencoded', - 'multipart/form-data' - ] - }, - api_client=api_client - ) - self.get_endpoint = _Endpoint( - settings={ - 'response_type': (CreativeResponse,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/creatives/{crv_id}', - 'operation_id': 'get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'crv_id', - ], - 'required': [ - 'crv_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'crv_id': - (CrvId,), - }, - 'attribute_map': { - 'crv_id': 'crv_id', - }, - 'location_map': { - 'crv_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.update_endpoint = _Endpoint( - settings={ - 'response_type': (CreativeResponse,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/creatives/{crv_id}', - 'operation_id': 'update', - 'http_method': 'PATCH', - 'servers': None, - }, - params_map={ - 'all': [ - 'crv_id', - 'creative_patch', - ], - 'required': [ - 'crv_id', - 'creative_patch', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'crv_id': - (CrvId,), - 'creative_patch': - (CreativePatch,), - }, - 'attribute_map': { - 'crv_id': 'crv_id', - }, - 'location_map': { - 'crv_id': 'path', - 'creative_patch': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json', - 'application/x-www-form-urlencoded', - 'multipart/form-data' - ] - }, - api_client=api_client - ) - - def create( - self, - creative_writable, - **kwargs - ): - """create # noqa: E501 - - Creates a new creative with the provided properties # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create(creative_writable, async_req=True) - >>> result = thread.get() - - Args: - creative_writable (CreativeWritable): - - Keyword Args: - x_lang_output (str): * `native` - Translate response to the native language of the country in the request * `match` - match the response to the language in the request Default response is in English. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - CreativeResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['creative_writable'] = \ - creative_writable - return self.create_endpoint.call_with_http_info(**kwargs) - - def get( - self, - crv_id, - **kwargs - ): - """get # noqa: E501 - - Retrieves the details of an existing creative. You need only supply the unique creative identifier that was returned upon creative creation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get(crv_id, async_req=True) - >>> result = thread.get() - - Args: - crv_id (CrvId): id of the creative - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - CreativeResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['crv_id'] = \ - crv_id - return self.get_endpoint.call_with_http_info(**kwargs) - - def update( - self, - crv_id, - creative_patch, - **kwargs - ): - """update # noqa: E501 - - Update the details of an existing creative. You need only supply the unique identifier that was returned upon creative creation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update(crv_id, creative_patch, async_req=True) - >>> result = thread.get() - - Args: - crv_id (CrvId): id of the creative - creative_patch (CreativePatch): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - CreativeResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['crv_id'] = \ - crv_id - kwargs['creative_patch'] = \ - creative_patch - return self.update_endpoint.call_with_http_info(**kwargs) - diff --git a/lob_python/api/uploads_api.py b/lob_python/api/uploads_api.py deleted file mode 100755 index f5423c3..0000000 --- a/lob_python/api/uploads_api.py +++ /dev/null @@ -1,1124 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from lob_python.api_client import ApiClient, Endpoint as _Endpoint -from lob_python.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from lob_python.model.cmp_id import CmpId -from lob_python.model.ex_id import ExId -from lob_python.model.export import Export -from lob_python.model.export_model import ExportModel -from lob_python.model.http_validation_error import HTTPValidationError -from lob_python.model.lob_error import LobError -from lob_python.model.upl_id import UplId -from lob_python.model.upload import Upload -from lob_python.model.upload_create_export import UploadCreateExport -from lob_python.model.upload_file import UploadFile -from lob_python.model.upload_list import UploadList -from lob_python.model.upload_updatable import UploadUpdatable -from lob_python.model.upload_writable import UploadWritable -import io - - -class UploadsApi(object): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - self.get_export_endpoint = _Endpoint( - settings={ - 'response_type': (Export,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/uploads/{upl_id}/exports/{ex_id}', - 'operation_id': 'get_export', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'upl_id', - 'ex_id', - ], - 'required': [ - 'upl_id', - 'ex_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'upl_id': - (UplId,), - 'ex_id': - (ExId,), - }, - 'attribute_map': { - 'upl_id': 'upl_id', - 'ex_id': 'ex_id', - }, - 'location_map': { - 'upl_id': 'path', - 'ex_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.create_upload_endpoint = _Endpoint( - settings={ - 'response_type': (Upload,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/uploads', - 'operation_id': 'create_upload', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'upload_writable', - ], - 'required': [ - 'upload_writable', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'upload_writable': - (UploadWritable,), - }, - 'attribute_map': { - }, - 'location_map': { - 'upload_writable': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.delete_upload_endpoint = _Endpoint( - settings={ - 'response_type': None, - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/uploads/{upl_id}', - 'operation_id': 'delete_upload', - 'http_method': 'DELETE', - 'servers': None, - }, - params_map={ - 'all': [ - 'upl_id', - ], - 'required': [ - 'upl_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'upl_id': - (UplId,), - }, - 'attribute_map': { - 'upl_id': 'upl_id', - }, - 'location_map': { - 'upl_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.create_export_endpoint = _Endpoint( - settings={ - 'response_type': (UploadCreateExport,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/uploads/{upl_id}/exports', - 'operation_id': 'create_export', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'upl_id', - 'export_model', - ], - 'required': [ - 'upl_id', - 'export_model', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'upl_id': - (UplId,), - 'export_model': - (ExportModel,), - }, - 'attribute_map': { - 'upl_id': 'upl_id', - }, - 'location_map': { - 'upl_id': 'path', - 'export_model': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.upload_file_endpoint = _Endpoint( - settings={ - 'response_type': (UploadFile,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/uploads/{upl_id}/file', - 'operation_id': 'upload_file', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'upl_id', - 'file', - ], - 'required': [ - 'upl_id', - 'file', - ], - 'nullable': [ - 'file', - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'upl_id': - (UplId,), - 'file': - (io.IOBase,), - }, - 'attribute_map': { - 'upl_id': 'upl_id', - 'file': 'file', - }, - 'location_map': { - 'upl_id': 'path', - 'file': 'form', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'multipart/form-data' - ] - }, - api_client=api_client - ) - self.get_upload_endpoint = _Endpoint( - settings={ - 'response_type': (Upload,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/uploads/{upl_id}', - 'operation_id': 'get_upload', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'upl_id', - ], - 'required': [ - 'upl_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'upl_id': - (UplId,), - }, - 'attribute_map': { - 'upl_id': 'upl_id', - }, - 'location_map': { - 'upl_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.update_upload_endpoint = _Endpoint( - settings={ - 'response_type': (Upload,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/uploads/{upl_id}', - 'operation_id': 'update_upload', - 'http_method': 'PATCH', - 'servers': None, - }, - params_map={ - 'all': [ - 'upl_id', - 'upload_updatable', - ], - 'required': [ - 'upl_id', - 'upload_updatable', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'upl_id': - (UplId,), - 'upload_updatable': - (UploadUpdatable,), - }, - 'attribute_map': { - 'upl_id': 'upl_id', - }, - 'location_map': { - 'upl_id': 'path', - 'upload_updatable': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.list_upload_endpoint = _Endpoint( - settings={ - 'response_type': (UploadList,), - 'auth': [ - 'basicAuth' - ], - 'endpoint_path': '/uploads', - 'operation_id': 'list_upload', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'campaign_id', - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'campaign_id': - (CmpId,), - }, - 'attribute_map': { - 'campaign_id': 'campaignId', - }, - 'location_map': { - 'campaign_id': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - - def get_export( - self, - upl_id, - ex_id, - **kwargs - ): - """get_export # noqa: E501 - - Retrieves the details of an existing export. You need only supply the unique export identifier that was returned upon export creation. If you try retrieving an export immediately after creating one (i.e., before we're done processing the export), you will get back an export object with `state = in_progress`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_export(upl_id, ex_id, async_req=True) - >>> result = thread.get() - - Args: - upl_id (UplId): ID of the upload - ex_id (ExId): ID of the export - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Export - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['upl_id'] = \ - upl_id - kwargs['ex_id'] = \ - ex_id - return self.get_export_endpoint.call_with_http_info(**kwargs) - - def create_upload( - self, - upload_writable, - **kwargs - ): - """create_upload # noqa: E501 - - Creates a new upload with the provided properties. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_upload(upload_writable, async_req=True) - >>> result = thread.get() - - Args: - upload_writable (UploadWritable): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Upload - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['upload_writable'] = \ - upload_writable - return self.create_upload_endpoint.call_with_http_info(**kwargs) - - def delete_upload( - self, - upl_id, - **kwargs - ): - """delete_upload # noqa: E501 - - Delete an existing upload. You need only supply the unique identifier that was returned upon upload creation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_upload(upl_id, async_req=True) - >>> result = thread.get() - - Args: - upl_id (UplId): id of the upload - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['upl_id'] = \ - upl_id - return self.delete_upload_endpoint.call_with_http_info(**kwargs) - - def create_export( - self, - upl_id, - export_model, - **kwargs - ): - """create_export # noqa: E501 - - Campaign Exports can help you understand exactly which records in a campaign could not be created. By initiating and retrieving an export, you will get row-by-row errors for your campaign. For a step-by-step walkthrough of creating a campaign and exporting failures, see our [Campaigns Guide](https://help.lob.com/best-practices/launching-your-first-campaign). Create an export file associated with an upload. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_export(upl_id, export_model, async_req=True) - >>> result = thread.get() - - Args: - upl_id (UplId): ID of the upload - export_model (ExportModel): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UploadCreateExport - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['upl_id'] = \ - upl_id - kwargs['export_model'] = \ - export_model - return self.create_export_endpoint.call_with_http_info(**kwargs) - - def upload_file( - self, - upl_id, - file, - **kwargs - ): - """upload_file # noqa: E501 - - Upload an [audience file](https://help.lob.com/best-practices/campaign-audience-guide) and associate it with an upload. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.upload_file(upl_id, file, async_req=True) - >>> result = thread.get() - - Args: - upl_id (UplId): ID of the upload - file (bool, date, datetime, dict, float, int, list, str, none_type): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UploadFile - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['upl_id'] = \ - upl_id - kwargs['file'] = \ - file - return self.upload_file_endpoint.call_with_http_info(**kwargs) - - def get_upload( - self, - upl_id, - **kwargs - ): - """get_upload # noqa: E501 - - Retrieves the details of an existing upload. You need only supply the unique upload identifier that was returned upon upload creation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.get_upload(upl_id, async_req=True) - >>> result = thread.get() - - Args: - upl_id (UplId): id of the upload - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Upload - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['upl_id'] = \ - upl_id - return self.get_upload_endpoint.call_with_http_info(**kwargs) - - def update_upload( - self, - upl_id, - upload_updatable, - **kwargs - ): - """update_upload # noqa: E501 - - Update the details of an existing upload. You need only supply the unique identifier that was returned upon upload creation. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_upload(upl_id, upload_updatable, async_req=True) - >>> result = thread.get() - - Args: - upl_id (UplId): id of the upload - upload_updatable (UploadUpdatable): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Upload - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['upl_id'] = \ - upl_id - kwargs['upload_updatable'] = \ - upload_updatable - return self.update_upload_endpoint.call_with_http_info(**kwargs) - - def list_upload( - self, - **kwargs - ): - """list_upload # noqa: E501 - - Returns a list of your uploads. Optionally, filter uploads by campaign. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_upload(async_req=True) - >>> result = thread.get() - - - Keyword Args: - campaign_id (CmpId): id of the campaign. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UploadList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.list_upload_endpoint.call_with_http_info(**kwargs) - diff --git a/lob_python/model/campaign.py b/lob_python/model/campaign.py old mode 100755 new mode 100644 index 25c8dec..7153e94 --- a/lob_python/model/campaign.py +++ b/lob_python/model/campaign.py @@ -29,11 +29,13 @@ ) from lob_python.exceptions import ApiAttributeError +from lob_python.model.campaign_creative import CampaignCreative from lob_python.model.cmp_id import CmpId from lob_python.model.cmp_schedule_type import CmpScheduleType from lob_python.model.cmp_use_type import CmpUseType from lob_python.model.metadata_model import MetadataModel from lob_python.model.resource_description import ResourceDescription +globals()['CampaignCreative'] = CampaignCreative globals()['CmpId'] = CmpId globals()['CmpScheduleType'] = CmpScheduleType globals()['CmpUseType'] = CmpUseType @@ -273,7 +275,7 @@ def __init__(self, name, schedule_type, auto_cancel_if_ncoa, id, creatives, date schedule_type (CmpScheduleType): auto_cancel_if_ncoa (bool): Whether or not a mail piece should be automatically canceled and not sent if the address is updated via NCOA. id (CmpId): - creatives (list): An array of creatives that have been associated with this campaign. + creatives ([CampaignCreative]): An array of creatives that have been associated with this campaign. date_created (datetime): A timestamp in ISO 8601 format of the date the resource was created. date_modified (datetime): A timestamp in ISO 8601 format of the date the resource was last modified. diff --git a/lob_python/model/upload_list.py b/lob_python/model/campaign_creative.py old mode 100755 new mode 100644 similarity index 65% rename from lob_python/model/upload_list.py rename to lob_python/model/campaign_creative.py index 5466d97..b1d61cb --- a/lob_python/model/upload_list.py +++ b/lob_python/model/campaign_creative.py @@ -29,11 +29,17 @@ ) from lob_python.exceptions import ApiAttributeError -from lob_python.model.upload import Upload -globals()['Upload'] = Upload +from lob_python.model.campaign import Campaign +from lob_python.model.crv_id import CrvId +from lob_python.model.metadata_model import MetadataModel +from lob_python.model.resource_description import ResourceDescription +globals()['Campaign'] = Campaign +globals()['CrvId'] = CrvId +globals()['MetadataModel'] = MetadataModel +globals()['ResourceDescription'] = ResourceDescription -class UploadList(ModelNormal): +class CampaignCreative(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -58,9 +64,20 @@ class UploadList(ModelNormal): """ allowed_values = { + ('resource_type',): { + 'LETTER': "letter", + 'POSTCARD': "postcard", + }, + ('object',): { + 'CREATIVE': "creative", + }, } validations = { + ('campaigns',): { + 'max_items': 0, + 'min_items': 0, + }, } @cached_property @@ -75,6 +92,9 @@ def additional_properties_type(): @cached_property def openapi_types(): + from lob_python.model.address_editable import AddressEditable + from lob_python.model.postcard_details_writable import PostcardDetailsWritable + from lob_python.model.letter_details_writable import LetterDetailsWritable """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded @@ -84,35 +104,40 @@ def openapi_types(): and the value is attribute type. """ return { - 'data': (list, type(None)), # noqa: E501 + 'id': (str, type(None)), # noqa: E501 + 'description': (str, type(None)), # noqa: E501 + '_from': (str, AddressEditable, type(None)), # noqa: E501 + 'resource_type': (str, type(None)), # noqa: E501 + 'details': (PostcardDetailsWritable, LetterDetailsWritable, type(None)), # noqa: E501 + 'metadata': (MetadataModel, type(None)), # noqa: E501 + 'template_preview_urls': (dict, type(None)), # noqa: E501 + 'template_previews': (list, type(None)), # noqa: E501 + 'deleted': (bool, type(None)), # noqa: E501 + 'campaigns': (list, type(None)), # noqa: E501 + 'date_created': (datetime, type(None)), # noqa: E501 + 'date_modified': (datetime, type(None)), # noqa: E501 'object': (str, type(None)), # noqa: E501 - 'next_url': (str, type(None)), # noqa: E501 - 'previous_url': (str, type(None)), # noqa: E501 - 'count': (int, type(None)), # noqa: E501 - 'total_count': (int, type(None)), # noqa: E501 } @cached_property def discriminator(): return None - def getNextPageToken(self): - if (self.next_url): - after_index = self.next_url.find("after=") - return self.next_url[after_index+6:] - def getPreviousPageToken(self): - if (self.previous_url): - before_index = self.previous_url.find("before=") - return self.previous_url[before_index+7:] - attribute_map = { - 'data': 'data', # noqa: E501 + 'id': 'id', # noqa: E501 + 'description': 'description', # noqa: E501 + '_from': 'from', # noqa: E501 + 'resource_type': 'resource_type', # noqa: E501 + 'details': 'details', # noqa: E501 + 'metadata': 'metadata', # noqa: E501 + 'template_preview_urls': 'template_preview_urls', # noqa: E501 + 'template_previews': 'template_previews', # noqa: E501 + 'deleted': 'deleted', # noqa: E501 + 'campaigns': 'campaigns', # noqa: E501 + 'date_created': 'date_created', # noqa: E501 + 'date_modified': 'date_modified', # noqa: E501 'object': 'object', # noqa: E501 - 'next_url': 'next_url', # noqa: E501 - 'previous_url': 'previous_url', # noqa: E501 - 'count': 'count', # noqa: E501 - 'total_count': 'total_count', # noqa: E501 } read_only_vars = { @@ -123,7 +148,7 @@ def getPreviousPageToken(self): @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UploadList - a model defined in OpenAPI + """CampaignCreative - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -156,12 +181,19 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - data (list, type(None)): list of uploads. [optional] # noqa: E501 - object (str, type(None)): Value is type of resource.. [optional] # noqa: E501 - next_url (str, type(None)): url of next page of items in list.. [optional] # noqa: E501 - previous_url (str, type(None)): url of previous page of items in list.. [optional] # noqa: E501 - count (int, type(None)): number of resources in a set. [optional] # noqa: E501 - total_count (int, type(None)): indicates the total number of records. Provided when the request specifies an \"include\" query parameter. [optional] # noqa: E501 + id (str, type(None)): [optional] # noqa: E501 + description (str, type(None)): [optional] # noqa: E501 + _from (str, AddressEditable, type(None)): Must either be an address ID or an inline object with correct address parameters.. [optional] # noqa: E501 + resource_type (str, type(None)): Mailpiece type for the creative. [optional] # noqa: E501 + details (PostcardDetailsWritable, LetterDetailsWritable, type(None)): Either PostcardDetailsReturned or LetterDetailsReturned. [optional] # noqa: E501 + metadata (MetadataModel, type(None)): [optional] # noqa: E501 + template_preview_urls (dict, type(None)): Preview URLs associated with a creative's artwork asset(s) if the creative uses HTML templates as assets.. [optional] # noqa: E501 + template_previews (list, type(None)): A list of template preview objects if the creative uses HTML template(s) as artwork asset(s).. [optional] # noqa: E501 + deleted (bool, type(None)): Only returned if the resource has been successfully deleted.. [optional] # noqa: E501 + campaigns (list, type(None)): [optional] # noqa: E501 + date_created (datetime, type(None)): A timestamp in ISO 8601 format of the date the resource was created.. [optional] # noqa: E501 + date_modified (datetime, type(None)): A timestamp in ISO 8601 format of the date the resource was last modified.. [optional] # noqa: E501 + object (str, type(None)): Value is resource type.. [optional] if omitted the server will use the default value of "creative" # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) @@ -210,7 +242,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 @convert_js_args_to_python_args def __init__(self, *args, **kwargs): # noqa: E501 - """UploadList - a model defined in OpenAPI + """CampaignCreative - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -243,12 +275,19 @@ def __init__(self, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - data (list, type(None)): list of uploads. [optional] # noqa: E501 - object (str, type(None)): Value is type of resource.. [optional] # noqa: E501 - next_url (str, type(None)): url of next page of items in list.. [optional] # noqa: E501 - previous_url (str, type(None)): url of previous page of items in list.. [optional] # noqa: E501 - count (int, type(None)): number of resources in a set. [optional] # noqa: E501 - total_count (int, type(None)): indicates the total number of records. Provided when the request specifies an \"include\" query parameter. [optional] # noqa: E501 + id (str, type(None)): [optional] # noqa: E501 + description (str, type(None)): [optional] # noqa: E501 + _from (str, AddressEditable, type(None)): Must either be an address ID or an inline object with correct address parameters.. [optional] # noqa: E501 + resource_type (str, type(None)): Mailpiece type for the creative. [optional] # noqa: E501 + details (PostcardDetailsWritable, LetterDetailsWritable, type(None)): Either PostcardDetailsReturned or LetterDetailsReturned. [optional] # noqa: E501 + metadata (MetadataModel, type(None)): [optional] # noqa: E501 + template_preview_urls (dict, type(None)): Preview URLs associated with a creative's artwork asset(s) if the creative uses HTML templates as assets.. [optional] # noqa: E501 + template_previews (list, type(None)): A list of template preview objects if the creative uses HTML template(s) as artwork asset(s).. [optional] # noqa: E501 + deleted (bool, type(None)): Only returned if the resource has been successfully deleted.. [optional] # noqa: E501 + campaigns (list, type(None)): [optional] # noqa: E501 + date_created (datetime, type(None)): A timestamp in ISO 8601 format of the date the resource was created.. [optional] # noqa: E501 + date_modified (datetime, type(None)): A timestamp in ISO 8601 format of the date the resource was last modified.. [optional] # noqa: E501 + object (str, type(None)): Value is resource type.. [optional] if omitted the server will use the default value of "creative" # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/lob_python/model/upload_deletion.py b/lob_python/model/campaign_deletion.py old mode 100755 new mode 100644 similarity index 95% rename from lob_python/model/upload_deletion.py rename to lob_python/model/campaign_deletion.py index febae85..895296f --- a/lob_python/model/upload_deletion.py +++ b/lob_python/model/campaign_deletion.py @@ -29,9 +29,11 @@ ) from lob_python.exceptions import ApiAttributeError +from lob_python.model.cmp_id import CmpId +globals()['CmpId'] = CmpId -class UploadDeletion(ModelNormal): +class CampaignDeletion(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -83,6 +85,7 @@ def openapi_types(): """ return { 'id': (str, type(None)), # noqa: E501 + 'deleted': (bool, type(None)), # noqa: E501 } @cached_property @@ -92,6 +95,7 @@ def discriminator(): attribute_map = { 'id': 'id', # noqa: E501 + 'deleted': 'deleted', # noqa: E501 } read_only_vars = { @@ -102,7 +106,7 @@ def discriminator(): @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UploadDeletion - a model defined in OpenAPI + """CampaignDeletion - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -136,6 +140,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) id (str, type(None)): [optional] # noqa: E501 + deleted (bool, type(None)): True if the resource has been successfully deleted.. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) @@ -184,7 +189,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 @convert_js_args_to_python_args def __init__(self, *args, **kwargs): # noqa: E501 - """UploadDeletion - a model defined in OpenAPI + """CampaignDeletion - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -218,6 +223,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 through its discriminator because we passed in _visited_composed_classes = (Animal,) id (str, type(None)): [optional] # noqa: E501 + deleted (bool, type(None)): True if the resource has been successfully deleted.. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/lob_python/model/campaign_updatable.py b/lob_python/model/campaign_updatable.py old mode 100755 new mode 100644 diff --git a/lob_python/model/campaign_writable.py b/lob_python/model/campaign_writable.py old mode 100755 new mode 100644 diff --git a/lob_python/model/campaigns_list.py b/lob_python/model/campaigns_list.py old mode 100755 new mode 100644 diff --git a/lob_python/model/cmp_id.py b/lob_python/model/cmp_id.py old mode 100755 new mode 100644 diff --git a/lob_python/model/cmp_schedule_type.py b/lob_python/model/cmp_schedule_type.py old mode 100755 new mode 100644 diff --git a/lob_python/model/cmp_use_type.py b/lob_python/model/cmp_use_type.py old mode 100755 new mode 100644 diff --git a/lob_python/model/creative_patch.py b/lob_python/model/creative_patch.py old mode 100755 new mode 100644 diff --git a/lob_python/model/creative_response.py b/lob_python/model/creative_response.py old mode 100755 new mode 100644 diff --git a/lob_python/model/creative_writable.py b/lob_python/model/creative_writable.py old mode 100755 new mode 100644 diff --git a/lob_python/model/crv_id.py b/lob_python/model/crv_id.py old mode 100755 new mode 100644 diff --git a/lob_python/model/upl_id.py b/lob_python/model/upl_id.py deleted file mode 100755 index e5ea6aa..0000000 --- a/lob_python/model/upl_id.py +++ /dev/null @@ -1,289 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from lob_python.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from lob_python.exceptions import ApiAttributeError - - - -class UplId(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - ('value',): { - 'regex': { - 'pattern': r'', # noqa: E501 - }, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': (str,), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """UplId - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Unique identifier prefixed with `upl_`.. # noqa: E501 - Keyword Args: - value (): Unique identifier prefixed with `upl_`.. # noqa: E501 - - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """UplId - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Unique identifier prefixed with `upl_`.. # noqa: E501 - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/lob_python/model/upload.py b/lob_python/model/upload.py deleted file mode 100755 index 654467e..0000000 --- a/lob_python/model/upload.py +++ /dev/null @@ -1,350 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from lob_python.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from lob_python.exceptions import ApiAttributeError - -from lob_python.model.cmp_id import CmpId -from lob_python.model.upl_id import UplId -from lob_python.model.upload_state import UploadState -globals()['CmpId'] = CmpId -globals()['UplId'] = UplId -globals()['UploadState'] = UploadState - - -class Upload(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('mode',): { - 'TEST': "test", - 'LIVE': "live", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str,), # noqa: E501 - 'account_id': (str,), # noqa: E501 - 'campaign_id': (str,), # noqa: E501 - 'column_mapping': (dict,), # noqa: E501 - 'mode': (str,), # noqa: E501 - 'state': (UploadState,), # noqa: E501 - 'total_mailpieces': (int,), # noqa: E501 - 'failed_mailpieces': (int,), # noqa: E501 - 'validated_mailpieces': (int,), # noqa: E501 - 'bytes_processed': (int,), # noqa: E501 - 'date_created': (datetime,), # noqa: E501 - 'date_modified': (datetime,), # noqa: E501 - 'failures_url': (str, type(None)), # noqa: E501 - 'original_filename': (str, type(None)), # noqa: E501 - 'deleted': (bool, type(None)), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'account_id': 'accountId', # noqa: E501 - 'campaign_id': 'campaignId', # noqa: E501 - 'column_mapping': 'columnMapping', # noqa: E501 - 'mode': 'mode', # noqa: E501 - 'state': 'state', # noqa: E501 - 'total_mailpieces': 'totalMailpieces', # noqa: E501 - 'failed_mailpieces': 'failedMailpieces', # noqa: E501 - 'validated_mailpieces': 'validatedMailpieces', # noqa: E501 - 'bytes_processed': 'bytesProcessed', # noqa: E501 - 'date_created': 'dateCreated', # noqa: E501 - 'date_modified': 'dateModified', # noqa: E501 - 'failures_url': 'failuresUrl', # noqa: E501 - 'original_filename': 'originalFilename', # noqa: E501 - 'deleted': 'deleted', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, id, account_id, campaign_id, column_mapping, mode, state, total_mailpieces, failed_mailpieces, validated_mailpieces, bytes_processed, date_created, date_modified, *args, **kwargs): # noqa: E501 - """Upload - a model defined in OpenAPI - - Args: - id (str): - account_id (str): Account ID that made the request - campaign_id (str): - column_mapping (dict): The mapping of column headers in your file to Lob-required fields for the resource created. See our Campaign Audience Guide for additional details. - mode (str): The environment in which the mailpieces were created. Today, will only be `live`. - state (UploadState): - total_mailpieces (int): Total number of recipients for the campaign - failed_mailpieces (int): Number of mailpieces that failed to create - validated_mailpieces (int): Number of mailpieces that were successfully created - bytes_processed (int): Number of bytes processed in your CSV - date_created (datetime): A timestamp in ISO 8601 format of the date the upload was created - date_modified (datetime): A timestamp in ISO 8601 format of the date the upload was last modified - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - failures_url (str, type(None)): Url where your campaign mailpiece failures can be retrieved. [optional] # noqa: E501 - original_filename (str, type(None)): Filename of the upload. [optional] # noqa: E501 - deleted (bool, type(None)): Only returned if the resource has been successfully deleted.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.id = id - self.account_id = account_id - self.campaign_id = campaign_id - self.column_mapping = column_mapping - self.mode = mode - self.state = state - self.total_mailpieces = total_mailpieces - self.failed_mailpieces = failed_mailpieces - self.validated_mailpieces = validated_mailpieces - self.bytes_processed = bytes_processed - self.date_created = date_created - self.date_modified = date_modified - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, id, account_id, campaign_id, column_mapping, mode, state, total_mailpieces, failed_mailpieces, validated_mailpieces, bytes_processed, date_created, date_modified, *args, **kwargs): # noqa: E501 - """Upload - a model defined in OpenAPI - - Args: - id (UplId): - account_id (str): Account ID that made the request - campaign_id (CmpId): - column_mapping ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): The mapping of column headers in your file to Lob-required fields for the resource created. See our Campaign Audience Guide for additional details. - mode (str): The environment in which the mailpieces were created. Today, will only be `live`. - state (UploadState): - total_mailpieces (int): Total number of recipients for the campaign - failed_mailpieces (int): Number of mailpieces that failed to create - validated_mailpieces (int): Number of mailpieces that were successfully created - bytes_processed (int): Number of bytes processed in your CSV - date_created (datetime): A timestamp in ISO 8601 format of the date the upload was created - date_modified (datetime): A timestamp in ISO 8601 format of the date the upload was last modified - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - failures_url (str, type(None)): Url where your campaign mailpiece failures can be retrieved. [optional] # noqa: E501 - original_filename (str, type(None)): Filename of the upload. [optional] # noqa: E501 - deleted (bool, type(None)): Only returned if the resource has been successfully deleted.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.id = id - self.account_id = account_id - self.campaign_id = campaign_id - self.column_mapping = column_mapping - self.mode = mode - self.state = state - self.total_mailpieces = total_mailpieces - self.failed_mailpieces = failed_mailpieces - self.validated_mailpieces = validated_mailpieces - self.bytes_processed = bytes_processed - self.date_created = date_created - self.date_modified = date_modified - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/lob_python/model/upload_create_export.py b/lob_python/model/upload_create_export.py deleted file mode 100755 index a0ffe60..0000000 --- a/lob_python/model/upload_create_export.py +++ /dev/null @@ -1,273 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from lob_python.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from lob_python.exceptions import ApiAttributeError - - - -class UploadCreateExport(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('message',): { - 'EXPORT_IS_PROCESSING.': "Export is processing.", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (str,), # noqa: E501 - 'export_id': (str,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message': 'message', # noqa: E501 - 'export_id': 'exportId', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, export_id, *args, **kwargs): # noqa: E501 - """UploadCreateExport - a model defined in OpenAPI - - Args: - export_id (str): - - Keyword Args: - message (str): defaults to "Export is processing.", must be one of ["Export is processing.", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - message = kwargs.get('message', "Export is processing.") - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.message = message - self.export_id = export_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, export_id, *args, **kwargs): # noqa: E501 - """UploadCreateExport - a model defined in OpenAPI - - Args: - export_id (str): - - Keyword Args: - message (str): defaults to "Export is processing.", must be one of ["Export is processing.", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - message = kwargs.get('message', "Export is processing.") - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.message = message - self.export_id = export_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/lob_python/model/upload_file.py b/lob_python/model/upload_file.py deleted file mode 100755 index 837e0a4..0000000 --- a/lob_python/model/upload_file.py +++ /dev/null @@ -1,273 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from lob_python.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from lob_python.exceptions import ApiAttributeError - - - -class UploadFile(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('message',): { - 'FILE_UPLOADED_SUCCESSFULLY': "File uploaded successfully", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (str,), # noqa: E501 - 'filename': (str,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message': 'message', # noqa: E501 - 'filename': 'filename', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, filename, *args, **kwargs): # noqa: E501 - """UploadFile - a model defined in OpenAPI - - Args: - filename (str): - - Keyword Args: - message (str): defaults to "File uploaded successfully", must be one of ["File uploaded successfully", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - message = kwargs.get('message', "File uploaded successfully") - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.message = message - self.filename = filename - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, filename, *args, **kwargs): # noqa: E501 - """UploadFile - a model defined in OpenAPI - - Args: - filename (str): - - Keyword Args: - message (str): defaults to "File uploaded successfully", must be one of ["File uploaded successfully", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - message = kwargs.get('message', "File uploaded successfully") - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.message = message - self.filename = filename - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/lob_python/model/upload_state.py b/lob_python/model/upload_state.py deleted file mode 100755 index c17972f..0000000 --- a/lob_python/model/upload_state.py +++ /dev/null @@ -1,286 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from lob_python.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from lob_python.exceptions import ApiAttributeError - - - -class UploadState(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('value',): { - 'PREPROCESSING': "Preprocessing", - 'DRAFT': "Draft", - 'READY_FOR_VALIDATION': "Ready for Validation", - 'VALIDATING': "Validating", - 'SCHEDULED': "Scheduled", - 'CANCELLED': "Cancelled", - 'ERRORED': "Errored", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': (str,), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """UploadState - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): The `state` property on the `upload` object. As the file is processed, the `state` will change from `Ready for Validation` to `Validating` and then will be either `Scheduled` (successfully processed) or `Errored` (Unsuccessfully processed).. if omitted defaults to "Draft", must be one of ["Preprocessing", "Draft", "Ready for Validation", "Validating", "Scheduled", "Cancelled", "Errored", ] # noqa: E501 - Keyword Args: - value (): The `state` property on the `upload` object. As the file is processed, the `state` will change from `Ready for Validation` to `Validating` and then will be either `Scheduled` (successfully processed) or `Errored` (Unsuccessfully processed).. if omitted defaults to "Draft", must be one of ["Preprocessing", "Draft", "Ready for Validation", "Validating", "Scheduled", "Cancelled", "Errored", ] # noqa: E501 - - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - value = "Draft" - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """UploadState - a model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): The `state` property on the `upload` object. As the file is processed, the `state` will change from `Ready for Validation` to `Validating` and then will be either `Scheduled` (successfully processed) or `Errored` (Unsuccessfully processed).. if omitted defaults to "Draft", must be one of ["Preprocessing", "Draft", "Ready for Validation", "Validating", "Scheduled", "Cancelled", "Errored", ] # noqa: E501 - - Keyword Args: - upload_state (): The `state` property on the `upload` object. As the file is processed, the `state` will change from `Ready for Validation` to `Validating` and then will be either `Scheduled` (successfully processed) or `Errored` (Unsuccessfully processed).. defaults to "Draft", must be one of ["Preprocessing", "Draft", "Ready for Validation", "Validating", "Scheduled", "Cancelled", "Errored", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - value = "Draft" - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/lob_python/model/upload_updatable.py b/lob_python/model/upload_updatable.py deleted file mode 100755 index ac5e9e7..0000000 --- a/lob_python/model/upload_updatable.py +++ /dev/null @@ -1,270 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from lob_python.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from lob_python.exceptions import ApiAttributeError - -from lob_python.model.upload_state import UploadState -globals()['UploadState'] = UploadState - - -class UploadUpdatable(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'column_mapping': (dict, type(None)), # noqa: E501 - 'state': (UploadState, type(None)), # noqa: E501 - 'original_filename': (str, type(None)), # noqa: E501 - 'overwrite_column_mapping': (bool, type(None)), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'column_mapping': 'columnMapping', # noqa: E501 - 'state': 'state', # noqa: E501 - 'original_filename': 'originalFilename', # noqa: E501 - 'overwrite_column_mapping': 'overwriteColumnMapping', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UploadUpdatable - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - column_mapping (dict, type(None)): The mapping of column headers in your file to Lob-required fields for the resource created. See our Campaign Audience Guide for additional details.. [optional] # noqa: E501 - state (UploadState, type(None)): [optional] # noqa: E501 - original_filename (str, type(None)): Original filename provided when the upload is created.. [optional] # noqa: E501 - overwrite_column_mapping (bool, type(None)): Properties in `columnMapping` will be appended to the existing `columnMapping` object if set to `false`. If set to `true`, the existing `columnMapping` object will be overwritten with the data supplied in `columnMapping` property. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UploadUpdatable - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - column_mapping (dict, type(None)): The mapping of column headers in your file to Lob-required fields for the resource created. See our Campaign Audience Guide for additional details.. [optional] # noqa: E501 - state (UploadState, type(None)): [optional] # noqa: E501 - original_filename (str, type(None)): Original filename provided when the upload is created.. [optional] # noqa: E501 - overwrite_column_mapping (bool, type(None)): Properties in `columnMapping` will be appended to the existing `columnMapping` object if set to `false`. If set to `true`, the existing `columnMapping` object will be overwritten with the data supplied in `columnMapping` property. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/lob_python/model/upload_writable.py b/lob_python/model/upload_writable.py deleted file mode 100755 index 15ff913..0000000 --- a/lob_python/model/upload_writable.py +++ /dev/null @@ -1,270 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from lob_python.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from lob_python.exceptions import ApiAttributeError - -from lob_python.model.cmp_id import CmpId -globals()['CmpId'] = CmpId - - -class UploadWritable(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'campaign_id': (str,), # noqa: E501 - 'column_mapping': (dict,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'campaign_id': 'campaignId', # noqa: E501 - 'column_mapping': 'columnMapping', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, campaign_id, column_mapping, *args, **kwargs): # noqa: E501 - """UploadWritable - a model defined in OpenAPI - - Args: - campaign_id (str): - column_mapping (dict): The mapping of column headers in your file to Lob-required fields for the resource created. See our Campaign Audience Guide for additional details. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.campaign_id = campaign_id - self.column_mapping = column_mapping - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, campaign_id, column_mapping, *args, **kwargs): # noqa: E501 - """UploadWritable - a model defined in OpenAPI - - Args: - campaign_id (CmpId): - column_mapping ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): The mapping of column headers in your file to Lob-required fields for the resource created. See our Campaign Audience Guide for additional details. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.campaign_id = campaign_id - self.column_mapping = column_mapping - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/test/Integration/test_campaigns_api.py b/test/Integration/test_campaigns_api.py deleted file mode 100644 index 3488117..0000000 --- a/test/Integration/test_campaigns_api.py +++ /dev/null @@ -1,227 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -from email.headerregistry import Address -import string -from tkinter.messagebox import NO -import unittest -import warnings -import datetime -import uuid - -import lob_python -import os -from dotenv import load_dotenv -from dateutil.parser import * -from lob_python.api.billing_groups_api import BillingGroupsApi # noqa: E501 -from lob_python.model.billing_group_editable import BillingGroupEditable # noqa: E501 -from lob_python.api.campaigns_api import CampaignsApi # noqa: E501 -from lob_python.model.campaign_writable import CampaignWritable # noqa: E501 -from lob_python.model.campaign_updatable import CampaignUpdatable -from lob_python.model.metadata_model import MetadataModel # noqa: E501 -from lob_python.model.cmp_schedule_type import CmpScheduleType -from lob_python.model.cmp_use_type import CmpUseType - - -class TestCampaignsApi(unittest.TestCase): - """CampaignsApi unit test stubs""" - - @classmethod - def setUpClass(self): - load_dotenv() - now = datetime.datetime.now() - warnings.simplefilter("ignore", ResourceWarning) - self.campaign_ids = [] - self.configuration = lob_python.Configuration( - username = os.getenv('LOB_API_TEST_KEY') - ) - with lob_python.ApiClient(self.configuration) as self.api_client: - self.bg_api = BillingGroupsApi(self.api_client) # noqa: E501 - self.bg_editable = BillingGroupEditable( - name = "Test Billing Group for Campaigns" - ) - self.bg_id = self.bg_api.create(self.bg_editable).id - with lob_python.ApiClient(self.configuration) as self.api_client: - self.api = CampaignsApi(self.api_client) # noqa: E501 - - @classmethod - def tearDownClass(self): - for i in self.campaign_ids: - self.api.delete(i) - del self.api - del self.configuration - del self.campaign_ids - del self.bg_id - del self.bg_editable - - def test_create200(self): - """Test case for create - - create # noqa: E501 - """ - - campaign_writable = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - ) - created_campaign = self.api.create(campaign_writable) - self.campaign_ids.append(created_campaign.id) - self.assertIsNotNone(created_campaign.id) - - def test_create_full200(self): - """Test case for create - - create # noqa: E501 - """ - full_editable = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - billing_group_id = self.bg_id, - description = "lob-openapi Campaign description", - target_delivery_date = None, - send_date = None, - cancel_window_campaign_minutes = 60, - metadata = MetadataModel(name = "Laurits Hummer"), - use_type = CmpUseType("operational"), - auto_cancel_if_ncoa = False, - ) - created_campaign = self.api.create(full_editable) - self.campaign_ids.append(created_campaign.id) - self.assertIsNotNone(created_campaign.id) - - def test_get200(self): - """Test case for get - - get # noqa: E501 - """ - campaign_writable = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - ) - created_campaign = self.api.create(campaign_writable) - retrieved_campaign = self.api.get(created_campaign.id) - self.campaign_ids.append(created_campaign.id) - self.assertIsNotNone(retrieved_campaign.id) - self.assertEqual(retrieved_campaign.id, created_campaign.id) - - def test_get404(self): - """Test case for get - - get # noqa: E501 - """ - with self.assertRaises(Exception) as context: - self.api.get("campaign_fake") - self.assertTrue("campaign not found" in context.exception.__str__()) - - def test_update200(self): - """Test case for get - - get # noqa: E501 - """ - campaign_writable = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - ) - updatable_campaign = CampaignUpdatable( - description = "Updated campaign" - ) - created_campaign = self.api.create(campaign_writable) - updated = self.api.update(created_campaign.id, updatable_campaign) - self.campaign_ids.append(updated.id) - self.assertIsNotNone(updated.id) - self.assertEqual(updated.description, "Updated campaign") - - def test_list200(self): - """Test case for list - - list # noqa: E501 - """ - campaign_writable = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - ) - writable_campaign2 = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - ) - writable_campaign3 = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - ) - - campaign_1 = self.api.create(campaign_writable) - campaign_2 = self.api.create(writable_campaign2) - campaign_3 = self.api.create(writable_campaign3) - self.campaign_ids.append(campaign_1.id) - self.campaign_ids.append(campaign_2.id) - self.campaign_ids.append(campaign_3.id) - listed_campaigns = self.api.list(limit=2) - self.assertLessEqual(len(listed_campaigns.data), 2) - self.assertIsNotNone(listed_campaigns.data[0]['id']) - next = listed_campaigns.getNextPageToken() - - # perform test with after query param - if next: - listed_campaigns_after = self.api.list(limit=2, after=next) - self.assertEqual(len(listed_campaigns_after.data), 2) - self.assertIsNotNone(listed_campaigns_after.data[0]['id']) - prev = listed_campaigns_after.getPreviousPageToken() - if prev: - listed_campaigns_before = self.api.list(limit=2, before=prev) - self.assertLessEqual(len(listed_campaigns_before.data), 2) - self.assertIsNotNone(listed_campaigns_before.data[0]['id']) - - def test_list422(self): - """Test case for list - - list # noqa: E501 - """ - campaign_writable = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - ) - writable_campaign2 = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - ) - campaign_1 = self.api.create(campaign_writable) - campaign_2 = self.api.create(writable_campaign2) - self.campaign_ids.append(campaign_1.id) - self.campaign_ids.append(campaign_2.id) - with self.assertRaises(Exception) as context: - self.api.list(limit=101) - self.assertTrue("Invalid value for `limit`" in context.exception.__str__()) - - def test_delete200(self): - """Test case for delete - - delete # noqa: E501 - """ - campaign_writable = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - ) - created_campaign = self.api.create(campaign_writable) - deleted_campaign = self.api.delete(created_campaign.id) - self.assertEqual(deleted_campaign['deleted'], True) - - def test_delete404(self): - """Test case for delete - - delete # noqa: E501 - """ - with self.assertRaises(Exception) as context: - self.api.delete("campaign_fake") - self.assertTrue("campaign not found" in context.exception.__str__()) - - -if __name__ == '__main__': - unittest.main() diff --git a/test/Integration/test_creatives_api.py b/test/Integration/test_creatives_api.py deleted file mode 100644 index b80295f..0000000 --- a/test/Integration/test_creatives_api.py +++ /dev/null @@ -1,216 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -from email.headerregistry import Address -import string -from tkinter.messagebox import NO -import unittest -import warnings -import datetime -import uuid - -import lob_python -import os -from dotenv import load_dotenv -from dateutil.parser import * -from lob_python.api.creatives_api import CreativesApi # noqa: E501 -from lob_python.api.campaigns_api import CampaignsApi # noqa: E501 -from lob_python.model.campaign_writable import CampaignWritable # noqa: E501 -from lob_python.model.creative_writable import CreativeWritable # noqa: E501 -from lob_python.model.creative_patch import CreativePatch -from lob_python.model.mail_type import MailType -from lob_python.model.postcard_details_writable import PostcardDetailsWritable -from lob_python.model.letter_details_writable import LetterDetailsWritable -from lob_python.model.metadata_model import MetadataModel # noqa: E501 -from lob_python.model.cmp_schedule_type import CmpScheduleType -from lob_python.model.address_editable import AddressEditable # noqa: E501 - -from lob_python.api.templates_api import TemplatesApi # noqa: E501 -from lob_python.model.template_writable import TemplateWritable # noqa: E501 - - -class TestCreativesApi(unittest.TestCase): - """CreativesApi unit test stubs""" - - @classmethod - def setUpClass(self): - load_dotenv() - now = datetime.datetime.now() - warnings.simplefilter("ignore", ResourceWarning) - self.campaign_ids = [] - self.configuration = lob_python.Configuration( - username = os.getenv('LOB_API_TEST_KEY') - ) - with lob_python.ApiClient(self.configuration) as self.api_client: - self.api = CreativesApi(self.api_client) # noqa: E501 - - with lob_python.ApiClient(self.configuration) as self.api_client: - self.camp_api = CampaignsApi(self.api_client) # noqa: E501 - self.campaign_writable = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - ) - self.camp_id = self.camp_api.create(self.campaign_writable).id - - with lob_python.ApiClient(self.configuration) as self.api_client: - self.temp_api = TemplatesApi(self.api_client) # noqa: E501 - - self.template_writable = TemplateWritable( - description = "Test Template 1", - html = "Updated HTML for template 1" - ) - - self.temp_id = self.temp_api.create(self.template_writable).id - - self._from = AddressEditable( - name = "FESTER", - address_line1 = "001 CEMETERY LN", - address_line2 = "SUITE 666", - address_city = "WESTFIELD", - address_state = "NJ", - address_zip = "07000" - ) - - @classmethod - def tearDownClass(self): - del self.api - del self.configuration - del self.campaign_ids - del self.campaign_writable - del self.template_writable - - self.camp_api.delete(self.camp_id) - del self.camp_id - del self.camp_api - self.temp_api.delete(self.temp_id) - del self.temp_id - del self.temp_api - - def test_create_postcard_creative200(self): - """Test case for create postcard creative - - create # noqa: E501 - """ - - creative_writable = CreativeWritable( - _from = self._from, - campaign_id = self.camp_id, - resource_type = "postcard", - details = PostcardDetailsWritable(), - front = self.temp_id, - back = self.temp_id - ) - - created_crv = self.api.create(creative_writable) - self.assertIsNotNone(created_crv.id) - - def test_create_letter_creative200(self): - """Test case for create letter creative - - create # noqa: E501 - """ - creative_writable = CreativeWritable( - _from = self._from, - campaign_id = self.camp_id, - resource_type = "letter", - details = LetterDetailsWritable( - cards = ["card_fake"], - color = True - ), - file = self.temp_id - ) - - created_crv = self.api.create(creative_writable) - self.assertIsNotNone(created_crv.id) - - - def test_create_full_letter200(self): - """Test case for create - - create # noqa: E501 - """ - full_editable = CreativeWritable( - _from = self._from, - description = "Full letter creative", - metadata=MetadataModel( - key="key_example", - ), - campaign_id = self.camp_id, - resource_type = "letter", - details = LetterDetailsWritable( - cards = ["card_fake"], - color = True, - mail_type=MailType("usps_first_class"), - address_placement = "top_first_page", - double_sided = False, - return_envelope = True - ), - file = self.temp_id - ) - created_crv = self.api.create(full_editable) - self.assertIsNotNone(created_crv.id) - - def test_get200(self): - """Test case for get - - get # noqa: E501 - """ - creative_writable = CreativeWritable( - _from = self._from, - campaign_id = self.camp_id, - resource_type = "letter", - details = LetterDetailsWritable( - cards = ["card_fake"], - color = True - ), - file = self.temp_id - ) - created_crv = self.api.create(creative_writable) - retrieved_crv = self.api.get(created_crv.id) - self.assertIsNotNone(retrieved_crv.id) - self.assertEqual(retrieved_crv.id, created_crv.id) - - - def test_get404(self): - """Test case for get - - get # noqa: E501 - """ - with self.assertRaises(Exception) as context: - self.api.get("crv_fake") - self.assertTrue("creative not found" in context.exception.__str__()) - - def test_update200(self): - """Test case for get - - get # noqa: E501 - """ - creative_writable = CreativeWritable( - _from = self._from, - campaign_id = self.camp_id, - resource_type = "postcard", - details = PostcardDetailsWritable(), - front = self.temp_id, - back = self.temp_id - ) - - updatable_creative = CreativePatch( - description = "Updated creative" - ) - created_crv = self.api.create(creative_writable) - updated = self.api.update(created_crv.id, updatable_creative) - self.campaign_ids.append(updated.id) - self.assertIsNotNone(updated.id) - self.assertEqual(updated.description, "Updated creative") - - -if __name__ == '__main__': - unittest.main() diff --git a/test/Integration/test_exports_api.py b/test/Integration/test_exports_api.py deleted file mode 100644 index d31e65d..0000000 --- a/test/Integration/test_exports_api.py +++ /dev/null @@ -1,90 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -from distutils.command.upload import upload -from email.headerregistry import Address -import string -from tkinter.messagebox import NO -import unittest -import warnings -import datetime -import uuid - -import lob_python -import os -from dotenv import load_dotenv -from dateutil.parser import * - -from lob_python.api.uploads_api import UploadsApi -from lob_python.model.export_model import ExportModel -from lob_python.model.upload_writable import UploadWritable - - -class TestCampaignsApi(unittest.TestCase): - """CampaignsApi unit test stubs""" - - @classmethod - def setUpClass(self): - load_dotenv() - warnings.simplefilter("ignore", ResourceWarning) - self.upload_ids = [] - self.configuration = lob_python.Configuration( - username = os.getenv('LOB_API_TEST_KEY') - ) - with lob_python.ApiClient(self.configuration) as self.api_client: - self.api = UploadsApi(self.api_client) # noqa: E501 - self.upload_writable = UploadWritable( - campaign_id = "campaign_fake", - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - self.upl_id = self.api.create_upload(self.upload_writable).id - - @classmethod - def tearDownClass(self): - del self.api - del self.configuration - del self.upload_writable - - def test_create200(self): - """Test case for create - - create # noqa: E501 - """ - - export_writable = ExportModel( - type = "all" - ) - created_export = self.api.create_export(self.upl_id, export_writable) - self.assertIsNotNone(created_export.export_id) - - def test_get200(self): - """Test case for get - - get # noqa: E501 - """ - export_writable = ExportModel( - type = "all" - ) - created_export = self.api.create_export(self.upl_id, export_writable) - retrieved_export = self.api.get_export(self.upl_id, created_export.export_id) - self.assertIsNotNone(retrieved_export.id) - self.assertEqual(retrieved_export.id, created_export.export_id) - - -if __name__ == '__main__': - unittest.main() diff --git a/test/Integration/test_uploads_api.py b/test/Integration/test_uploads_api.py deleted file mode 100644 index 21f6f93..0000000 --- a/test/Integration/test_uploads_api.py +++ /dev/null @@ -1,260 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - -import unittest -import warnings -import uuid - -import lob_python -import os -from dotenv import load_dotenv -from dateutil.parser import * -from lob_python.api.campaigns_api import CampaignsApi # noqa: E501 -from lob_python.model.campaign_writable import CampaignWritable # noqa: E501 -from lob_python.model.cmp_schedule_type import CmpScheduleType - -from lob_python.api.uploads_api import UploadsApi # noqa: E501 -from lob_python.model.upload_writable import UploadWritable -from lob_python.model.upload_updatable import UploadUpdatable - - -class TestCampaignsApi(unittest.TestCase): - """CampaignsApi unit test stubs""" - - @classmethod - def setUpClass(self): - load_dotenv() - warnings.simplefilter("ignore", ResourceWarning) - self.upload_ids = [] - self.configuration = lob_python.Configuration( - username = os.getenv('LOB_API_TEST_KEY') - ) - with lob_python.ApiClient(self.configuration) as self.api_client: - self.camp_api = CampaignsApi(self.api_client) # noqa: E501 - self.campaign_writable = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - ) - self.camp_id = self.camp_api.create(self.campaign_writable).id - with lob_python.ApiClient(self.configuration) as self.api_client: - self.api = UploadsApi(self.api_client) # noqa: E501 - - @classmethod - def tearDownClass(self): - for i in self.upload_ids: - self.api.delete_upload(i) - self.camp_api.delete(self.camp_id) - del self.api - del self.configuration - del self.upload_ids - - def test_create200(self): - """Test case for create - - create # noqa: E501 - """ - - upload_writable = UploadWritable( - campaign_id = self.camp_id, - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - created_upload = self.api.create_upload(upload_writable) - self.upload_ids.append(created_upload.id) - self.assertIsNotNone(created_upload.id) - - def test_get200(self): - """Test case for get - - get # noqa: E501 - """ - upload_writable = UploadWritable( - campaign_id = self.camp_id, - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - created_upload = self.api.create_upload(upload_writable) - retrieved_upload = self.api.get_upload(created_upload.id) - self.upload_ids.append(created_upload.id) - self.assertIsNotNone(retrieved_upload.id) - self.assertEqual(retrieved_upload.id, created_upload.id) - - def test_get404(self): - """Test case for get - - get # noqa: E501 - """ - with self.assertRaises(Exception) as context: - self.api.get_upload("upl_fake") - self.assertTrue("Upload not found" in context.exception.__str__()) - - def test_update200(self): - """Test case for get - - get # noqa: E501 - """ - upload_writable = UploadWritable( - campaign_id = self.camp_id, - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - new_mapping = { - "name": "name", - "address_line1": "address_line2", - "address_line2": "address_line1", - "address_city": "address_state", - "address_state": "address_city", - "address_zip": "address_zip", - } - updatable_upload = UploadUpdatable( - column_mapping = new_mapping - ) - created_upload = self.api.create_upload(upload_writable) - updated = self.api.update_upload(created_upload.id, updatable_upload) - self.upload_ids.append(updated.id) - self.assertIsNotNone(updated.id) - self.assertEqual(updated.column_mapping, new_mapping) - - def test_list200(self): - """Test case for list - - list # noqa: E501 - """ - upload_writable = UploadWritable( - campaign_id = self.camp_id, - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - writable_upload2 = UploadWritable( - campaign_id = self.camp_id, - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - writable_upload3 = UploadWritable( - campaign_id = self.camp_id, - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - - upload_1 = self.api.create_upload(upload_writable) - upload_2 = self.api.create_upload(writable_upload2) - upload_3 = self.api.create_upload(writable_upload3) - self.upload_ids.append(upload_1.id) - self.upload_ids.append(upload_2.id) - self.upload_ids.append(upload_3.id) - listed_uploads = self.api.list_upload() - self.assertGreaterEqual(len(listed_uploads.data), 3) - self.assertIsNotNone(listed_uploads.data[0]['id']) - - def test_delete200(self): - """Test case for delete - - delete # noqa: E501 - """ - upload_writable = UploadWritable( - campaign_id = self.camp_id, - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - writable_upload2 = UploadWritable( - campaign_id = self.camp_id, - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - writable_upload3 = UploadWritable( - campaign_id = self.camp_id, - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - - upload_1 = self.api.create_upload(upload_writable) - upload_2 = self.api.create_upload(writable_upload2) - upload_3 = self.api.create_upload(writable_upload3) - self.upload_ids.append(upload_1.id) - self.upload_ids.append(upload_2.id) - self.upload_ids.append(upload_3.id) - listed_uploads = self.api.list_upload() - self.assertGreaterEqual(len(listed_uploads.data), 3) - self.assertIsNotNone(listed_uploads.data[0]['id']) - - def test_upload_file(self): - upload_writable = UploadWritable( - campaign_id = self.camp_id, - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - created_upload = self.api.create_upload(upload_writable) - self.upload_ids.append(created_upload.id) - - res = self.api.upload_file(created_upload.id, open('test/assets/lobster-family.csv', 'rb')) - self.assertTrue("File uploaded successfully" in res["message"]) - -if __name__ == '__main__': - unittest.main() diff --git a/test/Integration/test_us_verifications_api.py b/test/Integration/test_us_verifications_api.py deleted file mode 100644 index 0bd7415..0000000 --- a/test/Integration/test_us_verifications_api.py +++ /dev/null @@ -1,140 +0,0 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - - -import unittest -import warnings - -import lob_python -import os -from dotenv import load_dotenv -from lob_python.api.us_verifications_api import UsVerificationsApi -from lob_python.model.address import Address # noqa: E501 -from lob_python.model.us_verifications_writable import UsVerificationsWritable # noqa: E501 -from lob_python.model.multiple_components import MultipleComponents # noqa: E501 -from lob_python.model.multiple_components_list import MultipleComponentsList # noqa: E501 - -class TestUsVerificationsApi(unittest.TestCase): - """UsVerificationsApi unit test stubs""" - - @classmethod - def setUpClass(self): - self.api = UsVerificationsApi() # noqa: E501 - load_dotenv() - warnings.simplefilter("ignore", ResourceWarning) - self.configuration = lob_python.Configuration( - username = os.getenv('LOB_API_LIVE_KEY') - ) - with lob_python.ApiClient(self.configuration) as self.api_client: - self.api = UsVerificationsApi(self.api_client) # noqa: E501 - self.valid_address = UsVerificationsWritable( - primary_line = "210 KING ST", - city = "SAN FRANCISCO", - state = "CA", - zip_code = "94107" - ) - self.invalid_address = UsVerificationsWritable( - primary_line = "1 CEMETERY ST", - city = "POTATOFIELD", - state = "NJ", - zip_code = "07000" - ) - self.mc1 = MultipleComponents( - primary_line = "210 KING ST", - city = "SAN FRANCISCO", - state = "CA", - zip_code = "94107" - ) - self.mc2 = MultipleComponents( - primary_line = "001 CEMETERY LN", - secondary_line = "SUITE 666", - city = "WESTFIELD", - state = "NJ", - zip_code = "07000" - ) - self.mc_error = MultipleComponents( - primary_line = "210 KING ST", - zip_code = "ABCDE" - ) - self.address_list = MultipleComponentsList( - addresses = [self.mc1, self.mc2] - ) - - self.error_address_list = MultipleComponentsList( - addresses = [self.mc1, self.mc_error] - ) - - @classmethod - def tearDownClass(self): - del self.valid_address - del self.mc1 - del self.mc2 - del self.mc_error - del self.address_list - del self.error_address_list - del self.api - del self.configuration - - def test_401(self): - """Test case for bulk verify with status code 401""" - configuration = lob_python.Configuration( - username = "Totally fake key" - ) - with lob_python.ApiClient(configuration) as api_client: - invalid_api = UsVerificationsApi(api_client) # noqa: E501 - - with self.assertRaises(Exception) as context: - invalid_api.verifyBulk(self.address_list) - self.assertTrue("Your API key is not valid" in context.exception.__str__()) - - def test_verifyBulk200(self): - """Test case for verifyBulk - - verifyBulk # noqa: E501 - """ - verified_list = self.api.verifyBulk(self.address_list) - self.assertEqual(len(verified_list.addresses), 2) - self.assertEqual(verified_list.addresses[0]['deliverability'], "deliverable") - self.assertEqual(verified_list.addresses[1]['deliverability'], "undeliverable") - - def test_verifyBulk_error(self): - """Test case for verifyBulk - - verifyBulk # noqa: E501 - """ - expected_error = { - 'error': { - 'message': 'zip_code must be in a valid zip or zip+4 format', - 'status_code': 422 - } - } - verified_list = self.api.verifyBulk(self.error_address_list) - self.assertEqual(len(verified_list.addresses), 2) - self.assertEqual(verified_list.addresses[1], expected_error) - self.assertEqual(verified_list.errors, True) - - def test_verifySingle_deliverable(self): - """Test case for verifySingle - - verifySingle # noqa: E501 - """ - verified_address = self.api.verifySingle(self.valid_address) - self.assertEqual(verified_address.deliverability, "deliverable") - - def test_verifySingle_undeliverable(self): - """Test case for verifySingle - - verifySingle # noqa: E501 - """ - verified_address = self.api.verifySingle(self.invalid_address) - self.assertEqual(verified_address.deliverability, "undeliverable") - -if __name__ == '__main__': - unittest.main() diff --git a/test/Unit/test_campaigns_api.py b/test/Unit/test_campaigns_api.py index d53c496..194b8ac 100644 --- a/test/Unit/test_campaigns_api.py +++ b/test/Unit/test_campaigns_api.py @@ -1,207 +1,207 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - -import string -import unittest -import warnings -import uuid - -import lob_python -from lob_python.api.campaigns_api import CampaignsApi # noqa: E501 -from lob_python.model.campaign_writable import CampaignWritable # noqa: E501 -from lob_python.model.campaign_updatable import CampaignUpdatable -from lob_python.model.cmp_schedule_type import CmpScheduleType -from unittest.mock import Mock, MagicMock -from lob_python.model.sort_by5 import SortBy5 -from lob_python.exceptions import UnauthorizedException, NotFoundException, ApiException - - -class TestCampaignsApi(unittest.TestCase): - """CampaignsApi unit test stubs""" - - def setUp(self): - warnings.simplefilter("ignore", ResourceWarning) - self.config_for_unit = lob_python.Configuration( - username = "Totally Fake Key" - ) - with lob_python.ApiClient(self.config_for_unit) as self.api_client: - self.mock_api = CampaignsApi(self.api_client) - - self.campaign_writable = CampaignWritable( - name = uuid.uuid4().hex[:6].upper(), - schedule_type = CmpScheduleType("immediate"), - ) - - self.campaign_updatable = CampaignUpdatable( - description = "Updated campaign" - ) - - self.mock_list_of_campaigns = MagicMock(return_value={ - "data": [{ "id": "fake 1" }, { "id": "fake 2" }] - }) - - def test_campaign_create_error_handle(self): - """Test case for handling create error""" - self.mock_api.campaign_create = Mock(side_effect=UnauthorizedException(status=401, reason="Unauthorized")) - - with self.assertRaises(Exception) as context: - self.mock_api.campaign_create(self.campaign_writable) - self.assertTrue("Unauthorized" in context.exception.__str__()) - - def test_campaign_create(self): - """Test case for creating new campaign""" - self.mock_api.campaign_create = MagicMock(return_value={ - "id": "campaign_fakeId" - }) - created_campaign = self.mock_api.campaign_create(self.campaign_writable) - self.assertIsNotNone(created_campaign) - self.assertIsNotNone(created_campaign["id"]) - - def test_campaign_create_with_custom_headers(self): - """Test case for creating new campaign with custom headers""" - self.mock_api.campaign_create = MagicMock(return_value={ - "id": "campaign_fakeId" - }) - created_campaign = self.mock_api.campaign_create(self.campaign_writable, _content_type="application/json") - self.assertIsNotNone(created_campaign) - self.assertIsNotNone(created_campaign["id"]) - - def test_campaign_retrieve(self): - """Test case for retrieving campaign""" - self.mock_api.campaign_retrieve = MagicMock(return_value={ - "id": "campaign_differentFakeId" - }) - retrieved_campaign = self.mock_api.campaign_retrieve("campaign_fakeId") - self.assertEqual(retrieved_campaign["id"], "campaign_differentFakeId") - - def test_campaign_retrieve_with_custom_headers(self): - """Test case for retrieving campaign with custom headers""" - self.mock_api.campaign_retrieve = MagicMock(return_value={ - "id": "campaign_differentFakeId" - }) - retrieved_campaign = self.mock_api.campaign_retrieve("campaign_fakeId", _content_type="application/json") - self.assertEqual(retrieved_campaign["id"], "campaign_differentFakeId") - - def test_campaign_retrieve_error_handle(self): - """Test case for handling retrieve error""" - self.mock_api.campaign_retrieve = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) - - with self.assertRaises(Exception) as context: - self.mock_api.campaign_retrieve("campaign_fakeId") - self.assertTrue("Not Found" in context.exception.__str__()) - - def test_campaigns_list(self): - """Test case for listing campaigns""" - self.mock_api.campaigns_list = self.mock_list_of_campaigns - campaigns = self.mock_api.campaigns_list() - self.assertIsNotNone(campaigns) - self.assertIsNotNone(campaigns["data"], 2) - - def test_campaigns_list_with_custom_headers(self): - """Test case for listing campaigns with custom headers""" - self.mock_api.campaigns_list = self.mock_list_of_campaigns - campaigns = self.mock_api.campaigns_list(_content_type="application/json") - self.assertIsNotNone(campaigns) - self.assertIsNotNone(campaigns["data"], 2) - - def test_campaigns_list_error_handle(self): - """Test case for handling list error""" - msg = """Cannot prepare a request message for provided - arguments. Please check that your arguments match - declared content type.""" - self.mock_api.campaigns_list = Mock(side_effect=ApiException(status=0, reason=msg)) - - with self.assertRaises(Exception) as context: - self.mock_api.campaigns_list() - self.assertTrue("Cannot prepare a request message" in context.exception.__str__()) - - def test_campaigns_list_with_limit_param(self): - """Test case for listing campaign with limit parameter""" - self.mock_api.campaigns_list = self.mock_list_of_campaigns - campaigns = self.mock_api.campaigns_list(limit=10) - self.assertIsNotNone(campaigns) - self.assertIsNotNone(campaigns["data"], 2) - - def test_campaigns_list_with_before_param(self): - """Test case for listing campaign with before parameter""" - self.mock_api.campaigns_list = self.mock_list_of_campaigns - campaigns = self.mock_api.campaigns_list(before="before") - self.assertIsNotNone(campaigns) - self.assertIsNotNone(campaigns["data"], 2) - - def test_campaigns_list_with_after_param(self): - """Test case for listing campaign with after parameter""" - self.mock_api.campaigns_list = self.mock_list_of_campaigns - campaigns = self.mock_api.campaigns_list(after="after") - self.assertIsNotNone(campaigns) - self.assertIsNotNone(campaigns["data"], 2) - - def test_campaigns_list_with_sortby_param(self): - """Test case for listing campaign with sort_by parameter""" - self.mock_api.campaigns_list = self.mock_list_of_campaigns - campaigns = self.mock_api.campaigns_list(sort_by=SortBy5(date_created = 'asc')) - self.assertIsNotNone(campaigns) - self.assertIsNotNone(campaigns["data"], 2) - - def test_campaign_update(self): - """Test case for updating campaign""" - self.mock_api.campaign_update = MagicMock(return_value={ - "id": "campaign_fakeId", - "description": self.campaign_updatable["description"], - }) - - updated_campaign = self.mock_api.campaign_update("campaign_fakeId", self.campaign_updatable) - self.assertIsNotNone(updated_campaign) - self.assertEqual(updated_campaign["description"], self.campaign_updatable["description"]) - - def test_campaign_update_with_custom_headers(self): - """Test case for updating campaign with custom headers""" - self.mock_api.campaign_update = MagicMock(return_value={ - "id": "campaign_fakeId", - "description": self.campaign_updatable["description"] - }) - - updated_campaign = self.mock_api.campaign_update("campaign_fakeId", self.campaign_updatable, _content_type="application/json") - self.assertIsNotNone(updated_campaign) - self.assertEqual(updated_campaign["description"], self.campaign_updatable["description"]) - - def test_campaign_update_error_handle(self): - """Test case for handling update error""" - self.mock_api.campaign_update = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) - with self.assertRaises(Exception) as context: - self.mock_api.campaign_update("campaign_fakeId", self.mock_api.campaign_update) - self.assertTrue("Not Found" in context.exception.__str__()) - - def test_campaign_delete(self): - """Test case for deleting campaign""" - self.mock_api.campaign_delete = MagicMock(return_value={ - "id": "campaign_fakeId", "deleted": True - }) - deleted_campaign = self.mock_api.campaign_delete("campaign_fakeId") - self.assertTrue(deleted_campaign["deleted"]) - - def test_campaign_delete_with_custom_headers(self): - """Test case for deleting campaign""" - self.mock_api.campaign_delete = MagicMock(return_value={ - "id": "campaign_fakeId", "deleted": True - }) - deleted_campaign = self.mock_api.campaign_delete("campaign_fakeId", _content_type="application/json") - self.assertTrue(deleted_campaign["deleted"]) - - def test_campaign_delete_error_handle(self): - """Test case for handling delete error""" - self.mock_api.campaign_delete = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) - - with self.assertRaises(Exception) as context: - self.mock_api.campaign_delete("campaign_fakeId") - self.assertTrue("Not Found" in context.exception.__str__()) - -if __name__ == '__main__': - unittest.main() +# """ +# Lob + +# The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 + +# The version of the OpenAPI document: 1.3.0 +# Contact: lob-openapi@lob.com +# Generated by: https://openapi-generator.tech +# """ + +# import string +# import unittest +# import warnings +# import uuid + +# import lob_python +# from lob_python.api.campaigns_api import CampaignsApi # noqa: E501 +# from lob_python.model.campaign_writable import CampaignWritable # noqa: E501 +# from lob_python.model.campaign_updatable import CampaignUpdatable +# from lob_python.model.cmp_schedule_type import CmpScheduleType +# from unittest.mock import Mock, MagicMock +# from lob_python.model.sort_by5 import SortBy5 +# from lob_python.exceptions import UnauthorizedException, NotFoundException, ApiException + + +# class TestCampaignsApi(unittest.TestCase): +# """CampaignsApi unit test stubs""" + +# def setUp(self): +# warnings.simplefilter("ignore", ResourceWarning) +# self.config_for_unit = lob_python.Configuration( +# username = "Totally Fake Key" +# ) +# with lob_python.ApiClient(self.config_for_unit) as self.api_client: +# self.mock_api = CampaignsApi(self.api_client) + +# self.campaign_writable = CampaignWritable( +# name = uuid.uuid4().hex[:6].upper(), +# schedule_type = CmpScheduleType("immediate"), +# ) + +# self.campaign_updatable = CampaignUpdatable( +# description = "Updated campaign" +# ) + +# self.mock_list_of_campaigns = MagicMock(return_value={ +# "data": [{ "id": "fake 1" }, { "id": "fake 2" }] +# }) + +# def test_campaign_create_error_handle(self): +# """Test case for handling create error""" +# self.mock_api.campaign_create = Mock(side_effect=UnauthorizedException(status=401, reason="Unauthorized")) + +# with self.assertRaises(Exception) as context: +# self.mock_api.campaign_create(self.campaign_writable) +# self.assertTrue("Unauthorized" in context.exception.__str__()) + +# def test_campaign_create(self): +# """Test case for creating new campaign""" +# self.mock_api.campaign_create = MagicMock(return_value={ +# "id": "campaign_fakeId" +# }) +# created_campaign = self.mock_api.campaign_create(self.campaign_writable) +# self.assertIsNotNone(created_campaign) +# self.assertIsNotNone(created_campaign["id"]) + +# def test_campaign_create_with_custom_headers(self): +# """Test case for creating new campaign with custom headers""" +# self.mock_api.campaign_create = MagicMock(return_value={ +# "id": "campaign_fakeId" +# }) +# created_campaign = self.mock_api.campaign_create(self.campaign_writable, _content_type="application/json") +# self.assertIsNotNone(created_campaign) +# self.assertIsNotNone(created_campaign["id"]) + +# def test_campaign_retrieve(self): +# """Test case for retrieving campaign""" +# self.mock_api.campaign_retrieve = MagicMock(return_value={ +# "id": "campaign_differentFakeId" +# }) +# retrieved_campaign = self.mock_api.campaign_retrieve("campaign_fakeId") +# self.assertEqual(retrieved_campaign["id"], "campaign_differentFakeId") + +# def test_campaign_retrieve_with_custom_headers(self): +# """Test case for retrieving campaign with custom headers""" +# self.mock_api.campaign_retrieve = MagicMock(return_value={ +# "id": "campaign_differentFakeId" +# }) +# retrieved_campaign = self.mock_api.campaign_retrieve("campaign_fakeId", _content_type="application/json") +# self.assertEqual(retrieved_campaign["id"], "campaign_differentFakeId") + +# def test_campaign_retrieve_error_handle(self): +# """Test case for handling retrieve error""" +# self.mock_api.campaign_retrieve = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) + +# with self.assertRaises(Exception) as context: +# self.mock_api.campaign_retrieve("campaign_fakeId") +# self.assertTrue("Not Found" in context.exception.__str__()) + +# def test_campaigns_list(self): +# """Test case for listing campaigns""" +# self.mock_api.campaigns_list = self.mock_list_of_campaigns +# campaigns = self.mock_api.campaigns_list() +# self.assertIsNotNone(campaigns) +# self.assertIsNotNone(campaigns["data"], 2) + +# def test_campaigns_list_with_custom_headers(self): +# """Test case for listing campaigns with custom headers""" +# self.mock_api.campaigns_list = self.mock_list_of_campaigns +# campaigns = self.mock_api.campaigns_list(_content_type="application/json") +# self.assertIsNotNone(campaigns) +# self.assertIsNotNone(campaigns["data"], 2) + +# def test_campaigns_list_error_handle(self): +# """Test case for handling list error""" +# msg = """Cannot prepare a request message for provided +# arguments. Please check that your arguments match +# declared content type.""" +# self.mock_api.campaigns_list = Mock(side_effect=ApiException(status=0, reason=msg)) + +# with self.assertRaises(Exception) as context: +# self.mock_api.campaigns_list() +# self.assertTrue("Cannot prepare a request message" in context.exception.__str__()) + +# def test_campaigns_list_with_limit_param(self): +# """Test case for listing campaign with limit parameter""" +# self.mock_api.campaigns_list = self.mock_list_of_campaigns +# campaigns = self.mock_api.campaigns_list(limit=10) +# self.assertIsNotNone(campaigns) +# self.assertIsNotNone(campaigns["data"], 2) + +# def test_campaigns_list_with_before_param(self): +# """Test case for listing campaign with before parameter""" +# self.mock_api.campaigns_list = self.mock_list_of_campaigns +# campaigns = self.mock_api.campaigns_list(before="before") +# self.assertIsNotNone(campaigns) +# self.assertIsNotNone(campaigns["data"], 2) + +# def test_campaigns_list_with_after_param(self): +# """Test case for listing campaign with after parameter""" +# self.mock_api.campaigns_list = self.mock_list_of_campaigns +# campaigns = self.mock_api.campaigns_list(after="after") +# self.assertIsNotNone(campaigns) +# self.assertIsNotNone(campaigns["data"], 2) + +# def test_campaigns_list_with_sortby_param(self): +# """Test case for listing campaign with sort_by parameter""" +# self.mock_api.campaigns_list = self.mock_list_of_campaigns +# campaigns = self.mock_api.campaigns_list(sort_by=SortBy5(date_created = 'asc')) +# self.assertIsNotNone(campaigns) +# self.assertIsNotNone(campaigns["data"], 2) + +# def test_campaign_update(self): +# """Test case for updating campaign""" +# self.mock_api.campaign_update = MagicMock(return_value={ +# "id": "campaign_fakeId", +# "description": self.campaign_updatable["description"], +# }) + +# updated_campaign = self.mock_api.campaign_update("campaign_fakeId", self.campaign_updatable) +# self.assertIsNotNone(updated_campaign) +# self.assertEqual(updated_campaign["description"], self.campaign_updatable["description"]) + +# def test_campaign_update_with_custom_headers(self): +# """Test case for updating campaign with custom headers""" +# self.mock_api.campaign_update = MagicMock(return_value={ +# "id": "campaign_fakeId", +# "description": self.campaign_updatable["description"] +# }) + +# updated_campaign = self.mock_api.campaign_update("campaign_fakeId", self.campaign_updatable, _content_type="application/json") +# self.assertIsNotNone(updated_campaign) +# self.assertEqual(updated_campaign["description"], self.campaign_updatable["description"]) + +# def test_campaign_update_error_handle(self): +# """Test case for handling update error""" +# self.mock_api.campaign_update = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) +# with self.assertRaises(Exception) as context: +# self.mock_api.campaign_update("campaign_fakeId", self.mock_api.campaign_update) +# self.assertTrue("Not Found" in context.exception.__str__()) + +# def test_campaign_delete(self): +# """Test case for deleting campaign""" +# self.mock_api.campaign_delete = MagicMock(return_value={ +# "id": "campaign_fakeId", "deleted": True +# }) +# deleted_campaign = self.mock_api.campaign_delete("campaign_fakeId") +# self.assertTrue(deleted_campaign["deleted"]) + +# def test_campaign_delete_with_custom_headers(self): +# """Test case for deleting campaign""" +# self.mock_api.campaign_delete = MagicMock(return_value={ +# "id": "campaign_fakeId", "deleted": True +# }) +# deleted_campaign = self.mock_api.campaign_delete("campaign_fakeId", _content_type="application/json") +# self.assertTrue(deleted_campaign["deleted"]) + +# def test_campaign_delete_error_handle(self): +# """Test case for handling delete error""" +# self.mock_api.campaign_delete = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) + +# with self.assertRaises(Exception) as context: +# self.mock_api.campaign_delete("campaign_fakeId") +# self.assertTrue("Not Found" in context.exception.__str__()) + +# if __name__ == '__main__': +# unittest.main() diff --git a/test/Unit/test_creatives_api.py b/test/Unit/test_creatives_api.py index 9567ed5..a311670 100644 --- a/test/Unit/test_creatives_api.py +++ b/test/Unit/test_creatives_api.py @@ -1,137 +1,137 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - -import unittest -import warnings - -import lob_python -from lob_python.api.creatives_api import CreativesApi # noqa: E501 -from lob_python.model.creative_writable import CreativeWritable # noqa: E501 -from lob_python.model.creative_patch import CreativePatch -from lob_python.model.postcard_details_writable import PostcardDetailsWritable -from lob_python.model.address_editable import AddressEditable # noqa: E501 -from unittest.mock import Mock, MagicMock -from lob_python.exceptions import UnauthorizedException, NotFoundException - - -class TestCreativesApi(unittest.TestCase): - """CreativesApi unit test stubs""" - - def setUp(self): - warnings.simplefilter("ignore", ResourceWarning) - self.config_for_unit = lob_python.Configuration( - username = "Totally Fake Key" - ) - with lob_python.ApiClient(self.config_for_unit) as self.api_client: - self.mock_api = CreativesApi(self.api_client) - - _from = AddressEditable( - name = "FESTER", - address_line1 = "001 CEMETERY LN", - address_line2 = "SUITE 666", - address_city = "WESTFIELD", - address_state = "NJ", - address_zip = "07000" - ) - - self.creative_writable = CreativeWritable( - _from = _from, - campaign_id = "campaign_fake", - resource_type = "postcard", - details = PostcardDetailsWritable(), - front = "tmpl_fake", - back = "tmpl_fake" - ) - - self.creative_updatable = CreativePatch( - description = "Updated creative" - ) - - def test_creative_create_error_handle(self): - """Test case for handling create error""" - self.mock_api.creative_create = Mock(side_effect=UnauthorizedException(status=401, reason="Unauthorized")) - - with self.assertRaises(Exception) as context: - self.mock_api.creative_create(self.creative_writable) - self.assertTrue("Unauthorized" in context.exception.__str__()) - - def test_creative_create(self): - """Test case for creating new campaign""" - self.mock_api.creative_create = MagicMock(return_value={ - "id": "campaign_fakeId" - }) - created_creative = self.mock_api.creative_create(self.creative_writable) - self.assertIsNotNone(created_creative) - self.assertIsNotNone(created_creative["id"]) - - def test_creative_create_with_custom_headers(self): - """Test case for creating new campaign with custom headers""" - self.mock_api.creative_create = MagicMock(return_value={ - "id": "campaign_fakeId" - }) - created_creative = self.mock_api.creative_create(self.creative_writable, _content_type="application/json") - self.assertIsNotNone(created_creative) - self.assertIsNotNone(created_creative["id"]) - - def test_creative_retrieve(self): - """Test case for retrieving campaign""" - self.mock_api.creative_retrieve = MagicMock(return_value={ - "id": "campaign_differentFakeId" - }) - retrieved_creative = self.mock_api.creative_retrieve("campaign_fakeId") - self.assertEqual(retrieved_creative["id"], "campaign_differentFakeId") - - def test_creative_retrieve_with_custom_headers(self): - """Test case for retrieving campaign with custom headers""" - self.mock_api.creative_retrieve = MagicMock(return_value={ - "id": "campaign_differentFakeId" - }) - retrieved_creative = self.mock_api.creative_retrieve("campaign_fakeId", _content_type="application/json") - self.assertEqual(retrieved_creative["id"], "campaign_differentFakeId") - - def test_creative_retrieve_error_handle(self): - """Test case for handling retrieve error""" - self.mock_api.creative_retrieve = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) - - with self.assertRaises(Exception) as context: - self.mock_api.creative_retrieve("campaign_fakeId") - self.assertTrue("Not Found" in context.exception.__str__()) - - def test_creative_update(self): - """Test case for updating campaign""" - self.mock_api.creative_update = MagicMock(return_value={ - "id": "campaign_fakeId", - "description": self.creative_updatable["description"], - }) - - updated_creative = self.mock_api.creative_update("campaign_fakeId", self.creative_updatable) - self.assertIsNotNone(updated_creative) - self.assertEqual(updated_creative["description"], self.creative_updatable["description"]) - - def test_creative_update_with_custom_headers(self): - """Test case for updating campaign with custom headers""" - self.mock_api.creative_update = MagicMock(return_value={ - "id": "campaign_fakeId", - "description": self.creative_updatable["description"] - }) - - updated_creative = self.mock_api.creative_update("campaign_fakeId", self.creative_updatable, _content_type="application/json") - self.assertIsNotNone(updated_creative) - self.assertEqual(updated_creative["description"], self.creative_updatable["description"]) - - def test_creative_update_error_handle(self): - """Test case for handling update error""" - self.mock_api.creative_update = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) - with self.assertRaises(Exception) as context: - self.mock_api.creative_update("campaign_fakeId", self.mock_api.creative_update) - self.assertTrue("Not Found" in context.exception.__str__()) - -if __name__ == '__main__': - unittest.main() +# """ +# Lob + +# The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 + +# The version of the OpenAPI document: 1.3.0 +# Contact: lob-openapi@lob.com +# Generated by: https://openapi-generator.tech +# """ + +# import unittest +# import warnings + +# import lob_python +# from lob_python.api.creatives_api import CreativesApi # noqa: E501 +# from lob_python.model.creative_writable import CreativeWritable # noqa: E501 +# from lob_python.model.creative_patch import CreativePatch +# from lob_python.model.postcard_details_writable import PostcardDetailsWritable +# from lob_python.model.address_editable import AddressEditable # noqa: E501 +# from unittest.mock import Mock, MagicMock +# from lob_python.exceptions import UnauthorizedException, NotFoundException + + +# class TestCreativesApi(unittest.TestCase): +# """CreativesApi unit test stubs""" + +# def setUp(self): +# warnings.simplefilter("ignore", ResourceWarning) +# self.config_for_unit = lob_python.Configuration( +# username = "Totally Fake Key" +# ) +# with lob_python.ApiClient(self.config_for_unit) as self.api_client: +# self.mock_api = CreativesApi(self.api_client) + +# _from = AddressEditable( +# name = "FESTER", +# address_line1 = "001 CEMETERY LN", +# address_line2 = "SUITE 666", +# address_city = "WESTFIELD", +# address_state = "NJ", +# address_zip = "07000" +# ) + +# self.creative_writable = CreativeWritable( +# _from = _from, +# campaign_id = "campaign_fake", +# resource_type = "postcard", +# details = PostcardDetailsWritable(), +# front = "tmpl_fake", +# back = "tmpl_fake" +# ) + +# self.creative_updatable = CreativePatch( +# description = "Updated creative" +# ) + +# def test_creative_create_error_handle(self): +# """Test case for handling create error""" +# self.mock_api.creative_create = Mock(side_effect=UnauthorizedException(status=401, reason="Unauthorized")) + +# with self.assertRaises(Exception) as context: +# self.mock_api.creative_create(self.creative_writable) +# self.assertTrue("Unauthorized" in context.exception.__str__()) + +# def test_creative_create(self): +# """Test case for creating new campaign""" +# self.mock_api.creative_create = MagicMock(return_value={ +# "id": "campaign_fakeId" +# }) +# created_creative = self.mock_api.creative_create(self.creative_writable) +# self.assertIsNotNone(created_creative) +# self.assertIsNotNone(created_creative["id"]) + +# def test_creative_create_with_custom_headers(self): +# """Test case for creating new campaign with custom headers""" +# self.mock_api.creative_create = MagicMock(return_value={ +# "id": "campaign_fakeId" +# }) +# created_creative = self.mock_api.creative_create(self.creative_writable, _content_type="application/json") +# self.assertIsNotNone(created_creative) +# self.assertIsNotNone(created_creative["id"]) + +# def test_creative_retrieve(self): +# """Test case for retrieving campaign""" +# self.mock_api.creative_retrieve = MagicMock(return_value={ +# "id": "campaign_differentFakeId" +# }) +# retrieved_creative = self.mock_api.creative_retrieve("campaign_fakeId") +# self.assertEqual(retrieved_creative["id"], "campaign_differentFakeId") + +# def test_creative_retrieve_with_custom_headers(self): +# """Test case for retrieving campaign with custom headers""" +# self.mock_api.creative_retrieve = MagicMock(return_value={ +# "id": "campaign_differentFakeId" +# }) +# retrieved_creative = self.mock_api.creative_retrieve("campaign_fakeId", _content_type="application/json") +# self.assertEqual(retrieved_creative["id"], "campaign_differentFakeId") + +# def test_creative_retrieve_error_handle(self): +# """Test case for handling retrieve error""" +# self.mock_api.creative_retrieve = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) + +# with self.assertRaises(Exception) as context: +# self.mock_api.creative_retrieve("campaign_fakeId") +# self.assertTrue("Not Found" in context.exception.__str__()) + +# def test_creative_update(self): +# """Test case for updating campaign""" +# self.mock_api.creative_update = MagicMock(return_value={ +# "id": "campaign_fakeId", +# "description": self.creative_updatable["description"], +# }) + +# updated_creative = self.mock_api.creative_update("campaign_fakeId", self.creative_updatable) +# self.assertIsNotNone(updated_creative) +# self.assertEqual(updated_creative["description"], self.creative_updatable["description"]) + +# def test_creative_update_with_custom_headers(self): +# """Test case for updating campaign with custom headers""" +# self.mock_api.creative_update = MagicMock(return_value={ +# "id": "campaign_fakeId", +# "description": self.creative_updatable["description"] +# }) + +# updated_creative = self.mock_api.creative_update("campaign_fakeId", self.creative_updatable, _content_type="application/json") +# self.assertIsNotNone(updated_creative) +# self.assertEqual(updated_creative["description"], self.creative_updatable["description"]) + +# def test_creative_update_error_handle(self): +# """Test case for handling update error""" +# self.mock_api.creative_update = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) +# with self.assertRaises(Exception) as context: +# self.mock_api.creative_update("campaign_fakeId", self.mock_api.creative_update) +# self.assertTrue("Not Found" in context.exception.__str__()) + +# if __name__ == '__main__': +# unittest.main() diff --git a/test/Unit/test_exports_api.py b/test/Unit/test_exports_api.py index 9f89f2b..6bbf60d 100644 --- a/test/Unit/test_exports_api.py +++ b/test/Unit/test_exports_api.py @@ -1,101 +1,93 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - -import unittest -import warnings - -import lob_python -from lob_python.api.uploads_api import UploadsApi # noqa: E501 -from lob_python.model.export_model import ExportModel -from lob_python.model.upload_writable import UploadWritable -from unittest.mock import Mock, MagicMock -from lob_python.exceptions import UnauthorizedException, NotFoundException - - -class TestExportsApi(unittest.TestCase): - """UploadsApi unit test stubs""" - - def setUp(self): - warnings.simplefilter("ignore", ResourceWarning) - self.config_for_unit = lob_python.Configuration( - username = "Totally Fake Key" - ) - with lob_python.ApiClient(self.config_for_unit) as self.api_client: - self.mock_api = UploadsApi(self.api_client) - - upload_writable = UploadWritable( - campaign_id = "campaign_fake", - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - - self.export_writable = ExportModel( - type = "all" - ) - - def test_export_create_error_handle(self): - """Test case for handling create error""" - self.mock_api.export_create = Mock(side_effect=UnauthorizedException(status=401, reason="Unauthorized")) - - with self.assertRaises(Exception) as context: - self.mock_api.export_create("upl_fake", self.export_writable) - self.assertTrue("Unauthorized" in context.exception.__str__()) - - def test_export_create(self): - """Test case for creating new campaign""" - self.mock_api.export_create = MagicMock(return_value={ - "id": "ex_fakeId" - }) - created_creative = self.mock_api.export_create("upl_fake", self.export_writable) - self.assertIsNotNone(created_creative) - self.assertIsNotNone(created_creative["id"]) - - def test_export_create_with_custom_headers(self): - """Test case for creating new campaign with custom headers""" - self.mock_api.export_create = MagicMock(return_value={ - "id": "ex_fakeId" - }) - created_creative = self.mock_api.export_create("upl_fake", self.export_writable, _content_type="application/json") - self.assertIsNotNone(created_creative) - self.assertIsNotNone(created_creative["id"]) - - def test_export_retrieve(self): - """Test case for retrieving campaign""" - self.mock_api.export_retrieve = MagicMock(return_value={ - "id": "ex_differentFakeId" - }) - retrieved_creative = self.mock_api.export_retrieve("ex_fakeId") - self.assertEqual(retrieved_creative["id"], "ex_differentFakeId") - - def test_export_retrieve_with_custom_headers(self): - """Test case for retrieving campaign with custom headers""" - self.mock_api.export_retrieve = MagicMock(return_value={ - "id": "ex_differentFakeId" - }) - retrieved_creative = self.mock_api.export_retrieve("ex_fakeId", _content_type="application/json") - self.assertEqual(retrieved_creative["id"], "ex_differentFakeId") - - def test_export_retrieve_error_handle(self): - """Test case for handling retrieve error""" - self.mock_api.export_retrieve = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) - - with self.assertRaises(Exception) as context: - self.mock_api.export_retrieve("ex_fakeId") - self.assertTrue("Not Found" in context.exception.__str__()) - - -if __name__ == '__main__': - unittest.main() +# """ +# Lob + +# The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 + +# The version of the OpenAPI document: 1.3.0 +# Contact: lob-openapi@lob.com +# Generated by: https://openapi-generator.tech +# """ + +# import unittest +# import warnings + +# import lob_python +# from lob_python.api.uploads_api import UploadsApi # noqa: E501 +# from lob_python.model.export_model import ExportModel +# from lob_python.model.upload_writable import UploadWritable +# from unittest.mock import Mock, MagicMock +# from lob_python.exceptions import UnauthorizedException, NotFoundException + + +# class TestExportsApi(unittest.TestCase): +# """UploadsApi unit test stubs""" + +# def setUp(self): +# warnings.simplefilter("ignore", ResourceWarning) +# self.config_for_unit = lob_python.Configuration( +# username = "Totally Fake Key" +# ) +# with lob_python.ApiClient(self.config_for_unit) as self.api_client: +# self.mock_api = UploadsApi(self.api_client) + +# upload_writable = UploadWritable( +# campaign_id = "campaign_fake" +# ) + +# self.export_writable = ExportModel( +# type = "all" +# ) + +# def test_export_create_error_handle(self): +# """Test case for handling create error""" +# self.mock_api.export_create = Mock(side_effect=UnauthorizedException(status=401, reason="Unauthorized")) + +# with self.assertRaises(Exception) as context: +# self.mock_api.export_create("upl_fake", self.export_writable) +# self.assertTrue("Unauthorized" in context.exception.__str__()) + +# def test_export_create(self): +# """Test case for creating new campaign""" +# self.mock_api.export_create = MagicMock(return_value={ +# "id": "ex_fakeId" +# }) +# created_creative = self.mock_api.export_create("upl_fake", self.export_writable) +# self.assertIsNotNone(created_creative) +# self.assertIsNotNone(created_creative["id"]) + +# def test_export_create_with_custom_headers(self): +# """Test case for creating new campaign with custom headers""" +# self.mock_api.export_create = MagicMock(return_value={ +# "id": "ex_fakeId" +# }) +# created_creative = self.mock_api.export_create("upl_fake", self.export_writable, _content_type="application/json") +# self.assertIsNotNone(created_creative) +# self.assertIsNotNone(created_creative["id"]) + +# def test_export_retrieve(self): +# """Test case for retrieving campaign""" +# self.mock_api.export_retrieve = MagicMock(return_value={ +# "id": "ex_differentFakeId" +# }) +# retrieved_creative = self.mock_api.export_retrieve("ex_fakeId") +# self.assertEqual(retrieved_creative["id"], "ex_differentFakeId") + +# def test_export_retrieve_with_custom_headers(self): +# """Test case for retrieving campaign with custom headers""" +# self.mock_api.export_retrieve = MagicMock(return_value={ +# "id": "ex_differentFakeId" +# }) +# retrieved_creative = self.mock_api.export_retrieve("ex_fakeId", _content_type="application/json") +# self.assertEqual(retrieved_creative["id"], "ex_differentFakeId") + +# def test_export_retrieve_error_handle(self): +# """Test case for handling retrieve error""" +# self.mock_api.export_retrieve = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) + +# with self.assertRaises(Exception) as context: +# self.mock_api.export_retrieve("ex_fakeId") +# self.assertTrue("Not Found" in context.exception.__str__()) + + +# if __name__ == '__main__': +# unittest.main() diff --git a/test/Unit/test_uploads_api.py b/test/Unit/test_uploads_api.py index 82ef4cd..cad0570 100644 --- a/test/Unit/test_uploads_api.py +++ b/test/Unit/test_uploads_api.py @@ -1,220 +1,196 @@ -""" - Lob - - The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 - - The version of the OpenAPI document: 1.3.0 - Contact: lob-openapi@lob.com - Generated by: https://openapi-generator.tech -""" - -import unittest -import warnings - -import lob_python - -from lob_python.api.uploads_api import UploadsApi # noqa: E501 -from lob_python.model.upload_writable import UploadWritable -from lob_python.model.upload_updatable import UploadUpdatable -from unittest.mock import Mock, MagicMock -from lob_python.model.sort_by5 import SortBy5 -from lob_python.exceptions import UnauthorizedException, NotFoundException, ApiException - - -class TestUploadsApi(unittest.TestCase): - """UploadsApi unit test stubs""" - - def setUp(self): - warnings.simplefilter("ignore", ResourceWarning) - self.config_for_unit = lob_python.Configuration( - username = "Totally Fake Key" - ) - with lob_python.ApiClient(self.config_for_unit) as self.api_client: - self.mock_api = UploadsApi(self.api_client) - - self.upload_writable = UploadWritable( - campaign_id = "campaign_fake", - column_mapping = { - "name": "name", - "address_line1": "address_line1", - "address_line2": "address_line2", - "address_city": "address_city", - "address_state": "address_state", - "address_zip": "address_zip", - }, - ) - - new_mapping = { - "name": "name", - "address_line1": "address_line2", - "address_line2": "address_line1", - "address_city": "address_state", - "address_state": "address_city", - "address_zip": "address_zip", - } - self.upload_updatable = UploadUpdatable( - column_mapping = new_mapping - ) - - self.mock_list_of_uploads = MagicMock(return_value={ - "data": [{ "id": "fake 1" }, { "id": "fake 2" }] - }) - - def test_upload_create_error_handle(self): - """Test case for handling create error""" - self.mock_api.upload_create = Mock(side_effect=UnauthorizedException(status=401, reason="Unauthorized")) - - with self.assertRaises(Exception) as context: - self.mock_api.upload_create(self.upload_writable) - self.assertTrue("Unauthorized" in context.exception.__str__()) - - def test_upload_create(self): - """Test case for creating new upload""" - self.mock_api.upload_create = MagicMock(return_value={ - "id": "upload_fakeId" - }) - created_upload = self.mock_api.upload_create(self.upload_writable) - self.assertIsNotNone(created_upload) - self.assertIsNotNone(created_upload["id"]) - - def test_upload_create_with_custom_headers(self): - """Test case for creating new upload with custom headers""" - self.mock_api.upload_create = MagicMock(return_value={ - "id": "upload_fakeId" - }) - created_upload = self.mock_api.upload_create(self.upload_writable, _content_type="application/json") - self.assertIsNotNone(created_upload) - self.assertIsNotNone(created_upload["id"]) - - def test_upload_retrieve(self): - """Test case for retrieving upload""" - self.mock_api.upload_retrieve = MagicMock(return_value={ - "id": "upload_differentFakeId" - }) - retrieved_upload = self.mock_api.upload_retrieve("upl_fakeId") - self.assertEqual(retrieved_upload["id"], "upload_differentFakeId") - - def test_upload_retrieve_with_custom_headers(self): - """Test case for retrieving upload with custom headers""" - self.mock_api.upload_retrieve = MagicMock(return_value={ - "id": "upload_differentFakeId" - }) - retrieved_upload = self.mock_api.upload_retrieve("upl_fakeId", _content_type="application/json") - self.assertEqual(retrieved_upload["id"], "upload_differentFakeId") - - def test_upload_retrieve_error_handle(self): - """Test case for handling retrieve error""" - self.mock_api.upload_retrieve = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) - - with self.assertRaises(Exception) as context: - self.mock_api.upload_retrieve("upl_fakeId") - self.assertTrue("Not Found" in context.exception.__str__()) - - def test_uploads_list(self): - """Test case for listing uploads""" - self.mock_api.uploads_list = self.mock_list_of_uploads - uploads = self.mock_api.uploads_list() - self.assertIsNotNone(uploads) - self.assertIsNotNone(uploads["data"], 2) - - def test_uploads_list_with_custom_headers(self): - """Test case for listing uploads with custom headers""" - self.mock_api.uploads_list = self.mock_list_of_uploads - uploads = self.mock_api.uploads_list(_content_type="application/json") - self.assertIsNotNone(uploads) - self.assertIsNotNone(uploads["data"], 2) - - def test_uploads_list_error_handle(self): - """Test case for handling list error""" - msg = """Cannot prepare a request message for provided - arguments. Please check that your arguments match - declared content type.""" - self.mock_api.uploads_list = Mock(side_effect=ApiException(status=0, reason=msg)) - - with self.assertRaises(Exception) as context: - self.mock_api.uploads_list() - self.assertTrue("Cannot prepare a request message" in context.exception.__str__()) - - def test_uploads_list_with_limit_param(self): - """Test case for listing upload with limit parameter""" - self.mock_api.uploads_list = self.mock_list_of_uploads - uploads = self.mock_api.uploads_list(limit=10) - self.assertIsNotNone(uploads) - self.assertIsNotNone(uploads["data"], 2) - - def test_uploads_list_with_before_param(self): - """Test case for listing upload with before parameter""" - self.mock_api.uploads_list = self.mock_list_of_uploads - uploads = self.mock_api.uploads_list(before="before") - self.assertIsNotNone(uploads) - self.assertIsNotNone(uploads["data"], 2) - - def test_uploads_list_with_after_param(self): - """Test case for listing upload with after parameter""" - self.mock_api.uploads_list = self.mock_list_of_uploads - uploads = self.mock_api.uploads_list(after="after") - self.assertIsNotNone(uploads) - self.assertIsNotNone(uploads["data"], 2) - - def test_uploads_list_with_sortby_param(self): - """Test case for listing upload with sort_by parameter""" - self.mock_api.uploads_list = self.mock_list_of_uploads - uploads = self.mock_api.uploads_list(sort_by=SortBy5(date_created = 'asc')) - self.assertIsNotNone(uploads) - self.assertIsNotNone(uploads["data"], 2) - - def test_upload_update(self): - """Test case for updating upload""" - self.mock_api.upload_update = MagicMock(return_value={ - "id": "upload_fakeId", - "columnMapping": self.upload_updatable["column_mapping"] - }) - - updated_upload = self.mock_api.upload_update("upload_fakeId", self.upload_updatable) - self.assertIsNotNone(updated_upload) - self.assertEqual(updated_upload["columnMapping"], self.upload_updatable["column_mapping"]) - - def test_upload_update_with_custom_headers(self): - """Test case for updating upload with custom headers""" - self.mock_api.upload_update = MagicMock(return_value={ - "id": "upload_fakeId", - "columnMapping": self.upload_updatable["column_mapping"] - }) - - updated_upload = self.mock_api.upload_update("upload_fakeId", self.upload_updatable, _content_type="application/json") - self.assertIsNotNone(updated_upload) - self.assertEqual(updated_upload["columnMapping"], self.upload_updatable["column_mapping"]) - - def test_upload_update_error_handle(self): - """Test case for handling update error""" - self.mock_api.upload_update = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) - with self.assertRaises(Exception) as context: - self.mock_api.upload_update("upload_fakeId", self.mock_api.upload_update) - self.assertTrue("Not Found" in context.exception.__str__()) - - def test_upload_delete(self): - """Test case for deleting upload""" - self.mock_api.upload_delete = MagicMock(return_value={ - "id": "upload_fakeId", "deleted": True - }) - deleted_upload = self.mock_api.upload_delete("upload_fakeId") - self.assertTrue(deleted_upload["deleted"]) - - def test_upload_delete_with_custom_headers(self): - """Test case for deleting upload""" - self.mock_api.upload_delete = MagicMock(return_value={ - "id": "upload_fakeId", "deleted": True - }) - deleted_upload = self.mock_api.upload_delete("upload_fakeId", _content_type="application/json") - self.assertTrue(deleted_upload["deleted"]) - - def test_upload_delete_error_handle(self): - """Test case for handling delete error""" - self.mock_api.upload_delete = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) - - with self.assertRaises(Exception) as context: - self.mock_api.upload_delete("upload_fakeId") - self.assertTrue("Not Found" in context.exception.__str__()) - -if __name__ == '__main__': - unittest.main() +# """ +# Lob + +# The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? # noqa: E501 + +# The version of the OpenAPI document: 1.3.0 +# Contact: lob-openapi@lob.com +# Generated by: https://openapi-generator.tech +# """ + +# import unittest +# import warnings + +# import lob_python + +# from lob_python.api.uploads_api import UploadsApi # noqa: E501 +# from lob_python.model.upload_writable import UploadWritable +# from lob_python.model.upload_updatable import UploadUpdatable +# from unittest.mock import Mock, MagicMock +# from lob_python.model.sort_by5 import SortBy5 +# from lob_python.exceptions import UnauthorizedException, NotFoundException, ApiException + + +# class TestUploadsApi(unittest.TestCase): +# """UploadsApi unit test stubs""" + +# def setUp(self): +# warnings.simplefilter("ignore", ResourceWarning) +# self.config_for_unit = lob_python.Configuration( +# username = "Totally Fake Key" +# ) +# with lob_python.ApiClient(self.config_for_unit) as self.api_client: +# self.mock_api = UploadsApi(self.api_client) + +# self.upload_writable = UploadWritable( +# campaign_id = "campaign_fake" +# ) + +# self.mock_list_of_uploads = MagicMock(return_value={ +# "data": [{ "id": "fake 1" }, { "id": "fake 2" }] +# }) + +# def test_upload_create_error_handle(self): +# """Test case for handling create error""" +# self.mock_api.upload_create = Mock(side_effect=UnauthorizedException(status=401, reason="Unauthorized")) + +# with self.assertRaises(Exception) as context: +# self.mock_api.upload_create(self.upload_writable) +# self.assertTrue("Unauthorized" in context.exception.__str__()) + +# def test_upload_create(self): +# """Test case for creating new upload""" +# self.mock_api.upload_create = MagicMock(return_value={ +# "id": "upload_fakeId" +# }) +# created_upload = self.mock_api.upload_create(self.upload_writable) +# self.assertIsNotNone(created_upload) +# self.assertIsNotNone(created_upload["id"]) + +# def test_upload_create_with_custom_headers(self): +# """Test case for creating new upload with custom headers""" +# self.mock_api.upload_create = MagicMock(return_value={ +# "id": "upload_fakeId" +# }) +# created_upload = self.mock_api.upload_create(self.upload_writable, _content_type="application/json") +# self.assertIsNotNone(created_upload) +# self.assertIsNotNone(created_upload["id"]) + +# def test_upload_retrieve(self): +# """Test case for retrieving upload""" +# self.mock_api.upload_retrieve = MagicMock(return_value={ +# "id": "upload_differentFakeId" +# }) +# retrieved_upload = self.mock_api.upload_retrieve("upl_fakeId") +# self.assertEqual(retrieved_upload["id"], "upload_differentFakeId") + +# def test_upload_retrieve_with_custom_headers(self): +# """Test case for retrieving upload with custom headers""" +# self.mock_api.upload_retrieve = MagicMock(return_value={ +# "id": "upload_differentFakeId" +# }) +# retrieved_upload = self.mock_api.upload_retrieve("upl_fakeId", _content_type="application/json") +# self.assertEqual(retrieved_upload["id"], "upload_differentFakeId") + +# def test_upload_retrieve_error_handle(self): +# """Test case for handling retrieve error""" +# self.mock_api.upload_retrieve = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) + +# with self.assertRaises(Exception) as context: +# self.mock_api.upload_retrieve("upl_fakeId") +# self.assertTrue("Not Found" in context.exception.__str__()) + +# def test_uploads_list(self): +# """Test case for listing uploads""" +# self.mock_api.uploads_list = self.mock_list_of_uploads +# uploads = self.mock_api.uploads_list() +# self.assertIsNotNone(uploads) +# self.assertIsNotNone(uploads["data"], 2) + +# def test_uploads_list_with_custom_headers(self): +# """Test case for listing uploads with custom headers""" +# self.mock_api.uploads_list = self.mock_list_of_uploads +# uploads = self.mock_api.uploads_list(_content_type="application/json") +# self.assertIsNotNone(uploads) +# self.assertIsNotNone(uploads["data"], 2) + +# def test_uploads_list_error_handle(self): +# """Test case for handling list error""" +# msg = """Cannot prepare a request message for provided +# arguments. Please check that your arguments match +# declared content type.""" +# self.mock_api.uploads_list = Mock(side_effect=ApiException(status=0, reason=msg)) + +# with self.assertRaises(Exception) as context: +# self.mock_api.uploads_list() +# self.assertTrue("Cannot prepare a request message" in context.exception.__str__()) + +# def test_uploads_list_with_limit_param(self): +# """Test case for listing upload with limit parameter""" +# self.mock_api.uploads_list = self.mock_list_of_uploads +# uploads = self.mock_api.uploads_list(limit=10) +# self.assertIsNotNone(uploads) +# self.assertIsNotNone(uploads["data"], 2) + +# def test_uploads_list_with_before_param(self): +# """Test case for listing upload with before parameter""" +# self.mock_api.uploads_list = self.mock_list_of_uploads +# uploads = self.mock_api.uploads_list(before="before") +# self.assertIsNotNone(uploads) +# self.assertIsNotNone(uploads["data"], 2) + +# def test_uploads_list_with_after_param(self): +# """Test case for listing upload with after parameter""" +# self.mock_api.uploads_list = self.mock_list_of_uploads +# uploads = self.mock_api.uploads_list(after="after") +# self.assertIsNotNone(uploads) +# self.assertIsNotNone(uploads["data"], 2) + +# def test_uploads_list_with_sortby_param(self): +# """Test case for listing upload with sort_by parameter""" +# self.mock_api.uploads_list = self.mock_list_of_uploads +# uploads = self.mock_api.uploads_list(sort_by=SortBy5(date_created = 'asc')) +# self.assertIsNotNone(uploads) +# self.assertIsNotNone(uploads["data"], 2) + +# def test_upload_update(self): +# """Test case for updating upload""" +# self.mock_api.upload_update = MagicMock(return_value={ +# "id": "upload_fakeId", +# }) + +# updated_upload = self.mock_api.upload_update("upload_fakeId", self.upload_updatable) +# self.assertIsNotNone(updated_upload) + +# def test_upload_update_with_custom_headers(self): +# """Test case for updating upload with custom headers""" +# self.mock_api.upload_update = MagicMock(return_value={ +# "id": "upload_fakeId", +# }) + +# updated_upload = self.mock_api.upload_update("upload_fakeId", self.upload_updatable, _content_type="application/json") +# self.assertIsNotNone(updated_upload) + +# def test_upload_update_error_handle(self): +# """Test case for handling update error""" +# self.mock_api.upload_update = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) +# with self.assertRaises(Exception) as context: +# self.mock_api.upload_update("upload_fakeId", self.mock_api.upload_update) +# self.assertTrue("Not Found" in context.exception.__str__()) + +# def test_upload_delete(self): +# """Test case for deleting upload""" +# self.mock_api.upload_delete = MagicMock(return_value={ +# "id": "upload_fakeId", "deleted": True +# }) +# deleted_upload = self.mock_api.upload_delete("upload_fakeId") +# self.assertTrue(deleted_upload["deleted"]) + +# def test_upload_delete_with_custom_headers(self): +# """Test case for deleting upload""" +# self.mock_api.upload_delete = MagicMock(return_value={ +# "id": "upload_fakeId", "deleted": True +# }) +# deleted_upload = self.mock_api.upload_delete("upload_fakeId", _content_type="application/json") +# self.assertTrue(deleted_upload["deleted"]) + +# def test_upload_delete_error_handle(self): +# """Test case for handling delete error""" +# self.mock_api.upload_delete = Mock(side_effect=NotFoundException(status=404, reason="Not Found")) + +# with self.assertRaises(Exception) as context: +# self.mock_api.upload_delete("upload_fakeId") +# self.assertTrue("Not Found" in context.exception.__str__()) + +# if __name__ == '__main__': +# unittest.main() From 149db925c67c61db1bf9ab884028143b411ba3f3 Mon Sep 17 00:00:00 2001 From: BennyKitchell Date: Fri, 4 Nov 2022 22:35:30 -0500 Subject: [PATCH 2/2] fix: remove thumb requirement for asset fetch --- lob_python/model/bank_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lob_python/model/bank_account.py b/lob_python/model/bank_account.py index 4a3e65d..fd4d3f9 100755 --- a/lob_python/model/bank_account.py +++ b/lob_python/model/bank_account.py @@ -84,7 +84,7 @@ class BankAccount(ModelNormal): }, ('signature_url',): { 'regex': { - 'pattern': r'^https:\/\/lob-assets\.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(\.pdf|_thumb_[a-z]+_[0-9]+\.png)\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+$', # noqa: E501 + 'pattern': r'^https:\/\/lob-assets\.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(\.pdf|[a-z]+_[0-9]+\.png)\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+$', # noqa: E501 }, }, }