From 14c7516bed867fca93afa6fb1bc8266ec92bda05 Mon Sep 17 00:00:00 2001 From: Richard Kooijman Date: Mon, 5 Aug 2024 16:41:27 -0500 Subject: [PATCH] initial commit --- .gitignore | 3 + Makefile | 2 +- hubspot/crm/invoices/__init__.py | 56 ++ hubspot/crm/invoices/api/__init__.py | 7 + hubspot/crm/invoices/api/basic_api.py | 740 +++++++++++++++++ hubspot/crm/invoices/api/batch_api.py | 331 ++++++++ hubspot/crm/invoices/api/search_api.py | 308 +++++++ hubspot/crm/invoices/api_client.py | 781 ++++++++++++++++++ hubspot/crm/invoices/api_response.py | 21 + hubspot/crm/invoices/configuration.py | 502 +++++++++++ hubspot/crm/invoices/exceptions.py | 199 +++++ hubspot/crm/invoices/models/__init__.py | 37 + hubspot/crm/invoices/models/associated_id.py | 89 ++ ...atch_read_input_simple_public_object_id.py | 101 +++ .../batch_response_simple_public_object.py | 113 +++ ...sponse_simple_public_object_with_errors.py | 125 +++ .../collection_response_associated_id.py | 101 +++ ...object_with_associations_forward_paging.py | 101 +++ ...tal_simple_public_object_forward_paging.py | 103 +++ hubspot/crm/invoices/models/error.py | 107 +++ hubspot/crm/invoices/models/error_detail.py | 95 +++ hubspot/crm/invoices/models/filter.py | 102 +++ hubspot/crm/invoices/models/filter_group.py | 95 +++ hubspot/crm/invoices/models/forward_paging.py | 91 ++ hubspot/crm/invoices/models/next_page.py | 89 ++ hubspot/crm/invoices/models/paging.py | 97 +++ hubspot/crm/invoices/models/previous_page.py | 89 ++ .../models/public_object_search_request.py | 105 +++ .../invoices/models/simple_public_object.py | 117 +++ .../models/simple_public_object_id.py | 87 ++ .../simple_public_object_with_associations.py | 132 +++ hubspot/crm/invoices/models/standard_error.py | 109 +++ .../invoices/models/value_with_timestamp.py | 98 +++ hubspot/crm/invoices/py.typed | 0 hubspot/crm/invoices/rest.py | 257 ++++++ hubspot/discovery/crm/discovery.py | 5 + hubspot/discovery/crm/invoices/__init__.py | 0 hubspot/discovery/crm/invoices/discovery.py | 20 + requirements.txt | 8 + requirements_dev.txt | 10 + 40 files changed, 5432 insertions(+), 1 deletion(-) create mode 100644 hubspot/crm/invoices/__init__.py create mode 100644 hubspot/crm/invoices/api/__init__.py create mode 100644 hubspot/crm/invoices/api/basic_api.py create mode 100644 hubspot/crm/invoices/api/batch_api.py create mode 100644 hubspot/crm/invoices/api/search_api.py create mode 100644 hubspot/crm/invoices/api_client.py create mode 100644 hubspot/crm/invoices/api_response.py create mode 100644 hubspot/crm/invoices/configuration.py create mode 100644 hubspot/crm/invoices/exceptions.py create mode 100644 hubspot/crm/invoices/models/__init__.py create mode 100644 hubspot/crm/invoices/models/associated_id.py create mode 100644 hubspot/crm/invoices/models/batch_read_input_simple_public_object_id.py create mode 100644 hubspot/crm/invoices/models/batch_response_simple_public_object.py create mode 100644 hubspot/crm/invoices/models/batch_response_simple_public_object_with_errors.py create mode 100644 hubspot/crm/invoices/models/collection_response_associated_id.py create mode 100644 hubspot/crm/invoices/models/collection_response_simple_public_object_with_associations_forward_paging.py create mode 100644 hubspot/crm/invoices/models/collection_response_with_total_simple_public_object_forward_paging.py create mode 100644 hubspot/crm/invoices/models/error.py create mode 100644 hubspot/crm/invoices/models/error_detail.py create mode 100644 hubspot/crm/invoices/models/filter.py create mode 100644 hubspot/crm/invoices/models/filter_group.py create mode 100644 hubspot/crm/invoices/models/forward_paging.py create mode 100644 hubspot/crm/invoices/models/next_page.py create mode 100644 hubspot/crm/invoices/models/paging.py create mode 100644 hubspot/crm/invoices/models/previous_page.py create mode 100644 hubspot/crm/invoices/models/public_object_search_request.py create mode 100644 hubspot/crm/invoices/models/simple_public_object.py create mode 100644 hubspot/crm/invoices/models/simple_public_object_id.py create mode 100644 hubspot/crm/invoices/models/simple_public_object_with_associations.py create mode 100644 hubspot/crm/invoices/models/standard_error.py create mode 100644 hubspot/crm/invoices/models/value_with_timestamp.py create mode 100644 hubspot/crm/invoices/py.typed create mode 100644 hubspot/crm/invoices/rest.py create mode 100644 hubspot/discovery/crm/invoices/__init__.py create mode 100644 hubspot/discovery/crm/invoices/discovery.py create mode 100644 requirements.txt create mode 100644 requirements_dev.txt diff --git a/.gitignore b/.gitignore index 48c3b33a..6ab733c2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ __pycache__ build dist venv +ssl +.env +test.py diff --git a/Makefile b/Makefile index 7894b579..f7ac9c4d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VENV_NAME?=venv +VENV_NAME?=.venv venv: $(VENV_NAME)/bin/activate diff --git a/hubspot/crm/invoices/__init__.py b/hubspot/crm/invoices/__init__.py new file mode 100644 index 00000000..047a7dc2 --- /dev/null +++ b/hubspot/crm/invoices/__init__.py @@ -0,0 +1,56 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "1.0.0" + +# import apis into sdk package +from hubspot.crm.invoices.api.basic_api import BasicApi +from hubspot.crm.invoices.api.batch_api import BatchApi +from hubspot.crm.invoices.api.search_api import SearchApi + +# import ApiClient +from hubspot.crm.invoices.api_response import ApiResponse +from hubspot.crm.invoices.api_client import ApiClient +from hubspot.crm.invoices.configuration import Configuration +from hubspot.crm.invoices.exceptions import OpenApiException +from hubspot.crm.invoices.exceptions import ApiTypeError +from hubspot.crm.invoices.exceptions import ApiValueError +from hubspot.crm.invoices.exceptions import ApiKeyError +from hubspot.crm.invoices.exceptions import ApiAttributeError +from hubspot.crm.invoices.exceptions import ApiException + +# import models into sdk package +from hubspot.crm.invoices.models.associated_id import AssociatedId +from hubspot.crm.invoices.models.batch_read_input_simple_public_object_id import BatchReadInputSimplePublicObjectId +from hubspot.crm.invoices.models.batch_response_simple_public_object import BatchResponseSimplePublicObject +from hubspot.crm.invoices.models.batch_response_simple_public_object_with_errors import BatchResponseSimplePublicObjectWithErrors +from hubspot.crm.invoices.models.collection_response_associated_id import CollectionResponseAssociatedId +from hubspot.crm.invoices.models.collection_response_simple_public_object_with_associations_forward_paging import CollectionResponseSimplePublicObjectWithAssociationsForwardPaging +from hubspot.crm.invoices.models.collection_response_with_total_simple_public_object_forward_paging import CollectionResponseWithTotalSimplePublicObjectForwardPaging +from hubspot.crm.invoices.models.error import Error +from hubspot.crm.invoices.models.error_detail import ErrorDetail +from hubspot.crm.invoices.models.filter import Filter +from hubspot.crm.invoices.models.filter_group import FilterGroup +from hubspot.crm.invoices.models.forward_paging import ForwardPaging +from hubspot.crm.invoices.models.next_page import NextPage +from hubspot.crm.invoices.models.paging import Paging +from hubspot.crm.invoices.models.previous_page import PreviousPage +from hubspot.crm.invoices.models.public_object_search_request import PublicObjectSearchRequest +from hubspot.crm.invoices.models.simple_public_object import SimplePublicObject +from hubspot.crm.invoices.models.simple_public_object_id import SimplePublicObjectId +from hubspot.crm.invoices.models.simple_public_object_with_associations import SimplePublicObjectWithAssociations +from hubspot.crm.invoices.models.standard_error import StandardError +from hubspot.crm.invoices.models.value_with_timestamp import ValueWithTimestamp diff --git a/hubspot/crm/invoices/api/__init__.py b/hubspot/crm/invoices/api/__init__.py new file mode 100644 index 00000000..92b89a31 --- /dev/null +++ b/hubspot/crm/invoices/api/__init__.py @@ -0,0 +1,7 @@ +# flake8: noqa + +# import apis into api package +from hubspot.crm.invoices.api.basic_api import BasicApi +from hubspot.crm.invoices.api.batch_api import BatchApi +from hubspot.crm.invoices.api.search_api import SearchApi + diff --git a/hubspot/crm/invoices/api/basic_api.py b/hubspot/crm/invoices/api/basic_api.py new file mode 100644 index 00000000..c99c1e5f --- /dev/null +++ b/hubspot/crm/invoices/api/basic_api.py @@ -0,0 +1,740 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictInt, StrictStr +from typing import List, Optional +from typing_extensions import Annotated +from hubspot.crm.invoices.models.collection_response_simple_public_object_with_associations_forward_paging import CollectionResponseSimplePublicObjectWithAssociationsForwardPaging +from hubspot.crm.invoices.models.simple_public_object_with_associations import SimplePublicObjectWithAssociations + +from hubspot.crm.invoices.api_client import ApiClient, RequestSerialized +from hubspot.crm.invoices.api_response import ApiResponse +from hubspot.crm.invoices.rest import RESTResponseType + + +class BasicApi: + """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) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_crm_v3_objects_invoices( + self, + limit: Annotated[Optional[StrictInt], Field(description="The maximum number of results to display per page.")] = None, + after: Annotated[Optional[StrictStr], Field(description="The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results.")] = None, + properties: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored.")] = None, + properties_with_history: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request.")] = None, + associations: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored.")] = None, + archived: Annotated[Optional[StrictBool], Field(description="Whether to return only results that have been archived.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CollectionResponseSimplePublicObjectWithAssociationsForwardPaging: + """List + + Read a page of invoices. Control what is returned via the `properties` query param. + + :param limit: The maximum number of results to display per page. + :type limit: int + :param after: The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. + :type after: str + :param properties: A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. + :type properties: List[str] + :param properties_with_history: A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. + :type properties_with_history: List[str] + :param associations: A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. + :type associations: List[str] + :param archived: Whether to return only results that have been archived. + :type archived: bool + :param _request_timeout: 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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_crm_v3_objects_invoices_serialize( + limit=limit, + after=after, + properties=properties, + properties_with_history=properties_with_history, + associations=associations, + archived=archived, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CollectionResponseSimplePublicObjectWithAssociationsForwardPaging", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_crm_v3_objects_invoices_with_http_info( + self, + limit: Annotated[Optional[StrictInt], Field(description="The maximum number of results to display per page.")] = None, + after: Annotated[Optional[StrictStr], Field(description="The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results.")] = None, + properties: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored.")] = None, + properties_with_history: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request.")] = None, + associations: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored.")] = None, + archived: Annotated[Optional[StrictBool], Field(description="Whether to return only results that have been archived.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CollectionResponseSimplePublicObjectWithAssociationsForwardPaging]: + """List + + Read a page of invoices. Control what is returned via the `properties` query param. + + :param limit: The maximum number of results to display per page. + :type limit: int + :param after: The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. + :type after: str + :param properties: A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. + :type properties: List[str] + :param properties_with_history: A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. + :type properties_with_history: List[str] + :param associations: A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. + :type associations: List[str] + :param archived: Whether to return only results that have been archived. + :type archived: bool + :param _request_timeout: 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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_crm_v3_objects_invoices_serialize( + limit=limit, + after=after, + properties=properties, + properties_with_history=properties_with_history, + associations=associations, + archived=archived, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CollectionResponseSimplePublicObjectWithAssociationsForwardPaging", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_crm_v3_objects_invoices_without_preload_content( + self, + limit: Annotated[Optional[StrictInt], Field(description="The maximum number of results to display per page.")] = None, + after: Annotated[Optional[StrictStr], Field(description="The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results.")] = None, + properties: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored.")] = None, + properties_with_history: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request.")] = None, + associations: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored.")] = None, + archived: Annotated[Optional[StrictBool], Field(description="Whether to return only results that have been archived.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List + + Read a page of invoices. Control what is returned via the `properties` query param. + + :param limit: The maximum number of results to display per page. + :type limit: int + :param after: The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results. + :type after: str + :param properties: A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. + :type properties: List[str] + :param properties_with_history: A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request. + :type properties_with_history: List[str] + :param associations: A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. + :type associations: List[str] + :param archived: Whether to return only results that have been archived. + :type archived: bool + :param _request_timeout: 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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_crm_v3_objects_invoices_serialize( + limit=limit, + after=after, + properties=properties, + properties_with_history=properties_with_history, + associations=associations, + archived=archived, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CollectionResponseSimplePublicObjectWithAssociationsForwardPaging", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_crm_v3_objects_invoices_serialize( + self, + limit, + after, + properties, + properties_with_history, + associations, + archived, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'properties': 'multi', + 'propertiesWithHistory': 'multi', + 'associations': 'multi', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if after is not None: + + _query_params.append(('after', after)) + + if properties is not None: + + _query_params.append(('properties', properties)) + + if properties_with_history is not None: + + _query_params.append(('propertiesWithHistory', properties_with_history)) + + if associations is not None: + + _query_params.append(('associations', associations)) + + if archived is not None: + + _query_params.append(('archived', archived)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json', + '*/*' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'oauth2', + 'private_apps' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/crm/v3/objects/invoices', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_crm_v3_objects_invoices_invoice_id( + self, + invoice_id: StrictStr, + properties: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored.")] = None, + properties_with_history: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored.")] = None, + associations: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored.")] = None, + archived: Annotated[Optional[StrictBool], Field(description="Whether to return only results that have been archived.")] = None, + id_property: Annotated[Optional[StrictStr], Field(description="The name of a property whose values are unique for this object type")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SimplePublicObjectWithAssociations: + """Read + + Read an Object identified by `{invoiceId}`. `{invoiceId}` refers to the internal object ID by default, or optionally any unique property value as specified by the `idProperty` query param. Control what is returned via the `properties` query param. + + :param invoice_id: (required) + :type invoice_id: str + :param properties: A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. + :type properties: List[str] + :param properties_with_history: A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. + :type properties_with_history: List[str] + :param associations: A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. + :type associations: List[str] + :param archived: Whether to return only results that have been archived. + :type archived: bool + :param id_property: The name of a property whose values are unique for this object type + :type id_property: str + :param _request_timeout: 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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_crm_v3_objects_invoices_invoice_id_serialize( + invoice_id=invoice_id, + properties=properties, + properties_with_history=properties_with_history, + associations=associations, + archived=archived, + id_property=id_property, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SimplePublicObjectWithAssociations", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_crm_v3_objects_invoices_invoice_id_with_http_info( + self, + invoice_id: StrictStr, + properties: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored.")] = None, + properties_with_history: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored.")] = None, + associations: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored.")] = None, + archived: Annotated[Optional[StrictBool], Field(description="Whether to return only results that have been archived.")] = None, + id_property: Annotated[Optional[StrictStr], Field(description="The name of a property whose values are unique for this object type")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SimplePublicObjectWithAssociations]: + """Read + + Read an Object identified by `{invoiceId}`. `{invoiceId}` refers to the internal object ID by default, or optionally any unique property value as specified by the `idProperty` query param. Control what is returned via the `properties` query param. + + :param invoice_id: (required) + :type invoice_id: str + :param properties: A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. + :type properties: List[str] + :param properties_with_history: A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. + :type properties_with_history: List[str] + :param associations: A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. + :type associations: List[str] + :param archived: Whether to return only results that have been archived. + :type archived: bool + :param id_property: The name of a property whose values are unique for this object type + :type id_property: str + :param _request_timeout: 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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_crm_v3_objects_invoices_invoice_id_serialize( + invoice_id=invoice_id, + properties=properties, + properties_with_history=properties_with_history, + associations=associations, + archived=archived, + id_property=id_property, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SimplePublicObjectWithAssociations", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_crm_v3_objects_invoices_invoice_id_without_preload_content( + self, + invoice_id: StrictStr, + properties: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored.")] = None, + properties_with_history: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored.")] = None, + associations: Annotated[Optional[List[StrictStr]], Field(description="A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored.")] = None, + archived: Annotated[Optional[StrictBool], Field(description="Whether to return only results that have been archived.")] = None, + id_property: Annotated[Optional[StrictStr], Field(description="The name of a property whose values are unique for this object type")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Read + + Read an Object identified by `{invoiceId}`. `{invoiceId}` refers to the internal object ID by default, or optionally any unique property value as specified by the `idProperty` query param. Control what is returned via the `properties` query param. + + :param invoice_id: (required) + :type invoice_id: str + :param properties: A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored. + :type properties: List[str] + :param properties_with_history: A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. + :type properties_with_history: List[str] + :param associations: A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored. + :type associations: List[str] + :param archived: Whether to return only results that have been archived. + :type archived: bool + :param id_property: The name of a property whose values are unique for this object type + :type id_property: str + :param _request_timeout: 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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_crm_v3_objects_invoices_invoice_id_serialize( + invoice_id=invoice_id, + properties=properties, + properties_with_history=properties_with_history, + associations=associations, + archived=archived, + id_property=id_property, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SimplePublicObjectWithAssociations", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_crm_v3_objects_invoices_invoice_id_serialize( + self, + invoice_id, + properties, + properties_with_history, + associations, + archived, + id_property, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'properties': 'multi', + 'propertiesWithHistory': 'multi', + 'associations': 'multi', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if invoice_id is not None: + _path_params['invoiceId'] = invoice_id + # process the query parameters + if properties is not None: + + _query_params.append(('properties', properties)) + + if properties_with_history is not None: + + _query_params.append(('propertiesWithHistory', properties_with_history)) + + if associations is not None: + + _query_params.append(('associations', associations)) + + if archived is not None: + + _query_params.append(('archived', archived)) + + if id_property is not None: + + _query_params.append(('idProperty', id_property)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json', + '*/*' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'oauth2', + 'private_apps' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/crm/v3/objects/invoices/{invoiceId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/hubspot/crm/invoices/api/batch_api.py b/hubspot/crm/invoices/api/batch_api.py new file mode 100644 index 00000000..eb079c54 --- /dev/null +++ b/hubspot/crm/invoices/api/batch_api.py @@ -0,0 +1,331 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool +from typing import Optional +from typing_extensions import Annotated +from hubspot.crm.invoices.models.batch_read_input_simple_public_object_id import BatchReadInputSimplePublicObjectId +from hubspot.crm.invoices.models.batch_response_simple_public_object import BatchResponseSimplePublicObject + +from hubspot.crm.invoices.api_client import ApiClient, RequestSerialized +from hubspot.crm.invoices.api_response import ApiResponse +from hubspot.crm.invoices.rest import RESTResponseType + + +class BatchApi: + """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) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def post_crm_v3_objects_invoices_batch_read( + self, + batch_read_input_simple_public_object_id: BatchReadInputSimplePublicObjectId, + archived: Annotated[Optional[StrictBool], Field(description="Whether to return only results that have been archived.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BatchResponseSimplePublicObject: + """Read a batch of invoices by internal ID, or unique property values + + + :param batch_read_input_simple_public_object_id: (required) + :type batch_read_input_simple_public_object_id: BatchReadInputSimplePublicObjectId + :param archived: Whether to return only results that have been archived. + :type archived: bool + :param _request_timeout: 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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_crm_v3_objects_invoices_batch_read_serialize( + batch_read_input_simple_public_object_id=batch_read_input_simple_public_object_id, + archived=archived, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BatchResponseSimplePublicObject", + '207': "BatchResponseSimplePublicObjectWithErrors", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def post_crm_v3_objects_invoices_batch_read_with_http_info( + self, + batch_read_input_simple_public_object_id: BatchReadInputSimplePublicObjectId, + archived: Annotated[Optional[StrictBool], Field(description="Whether to return only results that have been archived.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BatchResponseSimplePublicObject]: + """Read a batch of invoices by internal ID, or unique property values + + + :param batch_read_input_simple_public_object_id: (required) + :type batch_read_input_simple_public_object_id: BatchReadInputSimplePublicObjectId + :param archived: Whether to return only results that have been archived. + :type archived: bool + :param _request_timeout: 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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_crm_v3_objects_invoices_batch_read_serialize( + batch_read_input_simple_public_object_id=batch_read_input_simple_public_object_id, + archived=archived, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BatchResponseSimplePublicObject", + '207': "BatchResponseSimplePublicObjectWithErrors", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def post_crm_v3_objects_invoices_batch_read_without_preload_content( + self, + batch_read_input_simple_public_object_id: BatchReadInputSimplePublicObjectId, + archived: Annotated[Optional[StrictBool], Field(description="Whether to return only results that have been archived.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Read a batch of invoices by internal ID, or unique property values + + + :param batch_read_input_simple_public_object_id: (required) + :type batch_read_input_simple_public_object_id: BatchReadInputSimplePublicObjectId + :param archived: Whether to return only results that have been archived. + :type archived: bool + :param _request_timeout: 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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_crm_v3_objects_invoices_batch_read_serialize( + batch_read_input_simple_public_object_id=batch_read_input_simple_public_object_id, + archived=archived, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BatchResponseSimplePublicObject", + '207': "BatchResponseSimplePublicObjectWithErrors", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _post_crm_v3_objects_invoices_batch_read_serialize( + self, + batch_read_input_simple_public_object_id, + archived, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if archived is not None: + + _query_params.append(('archived', archived)) + + # process the header parameters + # process the form parameters + # process the body parameter + if batch_read_input_simple_public_object_id is not None: + _body_params = batch_read_input_simple_public_object_id + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json', + '*/*' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'oauth2', + 'private_apps' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/crm/v3/objects/invoices/batch/read', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/hubspot/crm/invoices/api/search_api.py b/hubspot/crm/invoices/api/search_api.py new file mode 100644 index 00000000..43710781 --- /dev/null +++ b/hubspot/crm/invoices/api/search_api.py @@ -0,0 +1,308 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from hubspot.crm.invoices.models.collection_response_with_total_simple_public_object_forward_paging import CollectionResponseWithTotalSimplePublicObjectForwardPaging +from hubspot.crm.invoices.models.public_object_search_request import PublicObjectSearchRequest + +from hubspot.crm.invoices.api_client import ApiClient, RequestSerialized +from hubspot.crm.invoices.api_response import ApiResponse +from hubspot.crm.invoices.rest import RESTResponseType + + +class SearchApi: + """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) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def post_crm_v3_objects_invoices_search( + self, + public_object_search_request: PublicObjectSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CollectionResponseWithTotalSimplePublicObjectForwardPaging: + """post_crm_v3_objects_invoices_search + + + :param public_object_search_request: (required) + :type public_object_search_request: PublicObjectSearchRequest + :param _request_timeout: 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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_crm_v3_objects_invoices_search_serialize( + public_object_search_request=public_object_search_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CollectionResponseWithTotalSimplePublicObjectForwardPaging", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def post_crm_v3_objects_invoices_search_with_http_info( + self, + public_object_search_request: PublicObjectSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CollectionResponseWithTotalSimplePublicObjectForwardPaging]: + """post_crm_v3_objects_invoices_search + + + :param public_object_search_request: (required) + :type public_object_search_request: PublicObjectSearchRequest + :param _request_timeout: 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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_crm_v3_objects_invoices_search_serialize( + public_object_search_request=public_object_search_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CollectionResponseWithTotalSimplePublicObjectForwardPaging", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def post_crm_v3_objects_invoices_search_without_preload_content( + self, + public_object_search_request: PublicObjectSearchRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """post_crm_v3_objects_invoices_search + + + :param public_object_search_request: (required) + :type public_object_search_request: PublicObjectSearchRequest + :param _request_timeout: 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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._post_crm_v3_objects_invoices_search_serialize( + public_object_search_request=public_object_search_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CollectionResponseWithTotalSimplePublicObjectForwardPaging", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _post_crm_v3_objects_invoices_search_serialize( + self, + public_object_search_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if public_object_search_request is not None: + _body_params = public_object_search_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json', + '*/*' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'oauth2', + 'private_apps' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/crm/v3/objects/invoices/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/hubspot/crm/invoices/api_client.py b/hubspot/crm/invoices/api_client.py new file mode 100644 index 00000000..c54ba895 --- /dev/null +++ b/hubspot/crm/invoices/api_client.py @@ -0,0 +1,781 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import datetime +from dateutil.parser import parse +from enum import Enum +import json +import mimetypes +import os +import re +import tempfile + +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr + +from hubspot.crm.invoices.configuration import Configuration +from hubspot.crm.invoices.api_response import ApiResponse, T as ApiResponseT +import hubspot.crm.invoices.models +from hubspot.crm.invoices import rest +from hubspot.crm.invoices.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + pass + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None or self.configuration.ignore_operation_servers: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + + def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # deserialize response data + response_text = None + return_data = None + try: + if response_type == "bytearray": + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data + ) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] + elif isinstance(obj, tuple): + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + elif isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + return { + key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items() + } + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. + + :return: deserialized object. + """ + + # fetch data from response object + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif content_type.startswith("application/json"): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif content_type.startswith("text/plain"): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(hubspot.crm.invoices.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datetime(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, str(value)) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters(self, files: Dict[str, Union[str, bytes]]): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) + return params + + def select_header_accept(self, accepts: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = m.group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/hubspot/crm/invoices/api_response.py b/hubspot/crm/invoices/api_response.py new file mode 100644 index 00000000..9bc7c11f --- /dev/null +++ b/hubspot/crm/invoices/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/hubspot/crm/invoices/configuration.py b/hubspot/crm/invoices/configuration.py new file mode 100644 index 00000000..463691c3 --- /dev/null +++ b/hubspot/crm/invoices/configuration.py @@ -0,0 +1,502 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import copy +import logging +from logging import FileHandler +import multiprocessing +import sys +from typing import Optional +import urllib3 + +import http.client as httplib + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + :param retries: Number of retries for API requests. + + :Example: + + API Key Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + cookieAuth: # name for the security scheme + type: apiKey + in: cookie + name: JSESSIONID # cookie name + + You can programmatically set the cookie: + +conf = hubspot.crm.invoices.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + + The following cookie will be added to the HTTP request: + Cookie: JSESSIONID abc123 + """ + + _default = None + + def __init__(self, host=None, + api_key=None, api_key_prefix=None, + username=None, password=None, + access_token=None, + server_index=None, server_variables=None, + server_operation_index=None, server_operation_variables=None, + ignore_operation_servers=False, + ssl_ca_cert=None, + retries=None, + *, + debug: Optional[bool] = None + ) -> None: + """Constructor + """ + self._base_path = "https://api.hubapi.com" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("hubspot.crm.invoices") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + if debug is not None: + self.debug = debug + else: + self.__debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. urllib3 uses 1 connection as default value, but this is + not the best value when you are making a lot of possibly parallel + requests to the same host, which is often the case here. + cpu_count * 5 is used as default value to increase performance. + """ + + self.proxy: Optional[str] = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = retries + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ + + self.date_format = "%Y-%m-%d" + """date format + """ + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls): + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls): + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = Configuration() + return cls._default + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier, alias=None): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth = {} + if self.access_token is not None: + auth['oauth2_legacy'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + if self.access_token is not None: + auth['oauth2'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + if 'private_apps_legacy' in self.api_key: + auth['private_apps_legacy'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'private-app-legacy', + 'value': self.get_api_key_with_prefix( + 'private_apps_legacy', + ), + } + if 'private_apps' in self.api_key: + auth['private_apps'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'private-app', + 'value': self.get_api_key_with_prefix( + 'private_apps', + ), + } + return auth + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: v3\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "https://api.hubapi.com", + 'description': "No description provided", + } + ] + + def get_host_from_settings(self, index, variables=None, servers=None): + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self): + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value): + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/hubspot/crm/invoices/exceptions.py b/hubspot/crm/invoices/exceptions.py new file mode 100644 index 00000000..a8fa8718 --- /dev/null +++ b/hubspot/crm/invoices/exceptions.py @@ -0,0 +1,199 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.getheaders() + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.data or self.body: + error_message += "HTTP response body: {0}\n".format(self.data or self.body) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/hubspot/crm/invoices/models/__init__.py b/hubspot/crm/invoices/models/__init__.py new file mode 100644 index 00000000..cbc2ace6 --- /dev/null +++ b/hubspot/crm/invoices/models/__init__.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +# flake8: noqa +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +# import models into model package +from hubspot.crm.invoices.models.associated_id import AssociatedId +from hubspot.crm.invoices.models.batch_read_input_simple_public_object_id import BatchReadInputSimplePublicObjectId +from hubspot.crm.invoices.models.batch_response_simple_public_object import BatchResponseSimplePublicObject +from hubspot.crm.invoices.models.batch_response_simple_public_object_with_errors import BatchResponseSimplePublicObjectWithErrors +from hubspot.crm.invoices.models.collection_response_associated_id import CollectionResponseAssociatedId +from hubspot.crm.invoices.models.collection_response_simple_public_object_with_associations_forward_paging import CollectionResponseSimplePublicObjectWithAssociationsForwardPaging +from hubspot.crm.invoices.models.collection_response_with_total_simple_public_object_forward_paging import CollectionResponseWithTotalSimplePublicObjectForwardPaging +from hubspot.crm.invoices.models.error import Error +from hubspot.crm.invoices.models.error_detail import ErrorDetail +from hubspot.crm.invoices.models.filter import Filter +from hubspot.crm.invoices.models.filter_group import FilterGroup +from hubspot.crm.invoices.models.forward_paging import ForwardPaging +from hubspot.crm.invoices.models.next_page import NextPage +from hubspot.crm.invoices.models.paging import Paging +from hubspot.crm.invoices.models.previous_page import PreviousPage +from hubspot.crm.invoices.models.public_object_search_request import PublicObjectSearchRequest +from hubspot.crm.invoices.models.simple_public_object import SimplePublicObject +from hubspot.crm.invoices.models.simple_public_object_id import SimplePublicObjectId +from hubspot.crm.invoices.models.simple_public_object_with_associations import SimplePublicObjectWithAssociations +from hubspot.crm.invoices.models.standard_error import StandardError +from hubspot.crm.invoices.models.value_with_timestamp import ValueWithTimestamp diff --git a/hubspot/crm/invoices/models/associated_id.py b/hubspot/crm/invoices/models/associated_id.py new file mode 100644 index 00000000..b00e4bf5 --- /dev/null +++ b/hubspot/crm/invoices/models/associated_id.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class AssociatedId(BaseModel): + """ + AssociatedId + """ # noqa: E501 + id: StrictStr + type: StrictStr + __properties: ClassVar[List[str]] = ["id", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssociatedId from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssociatedId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type") + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/batch_read_input_simple_public_object_id.py b/hubspot/crm/invoices/models/batch_read_input_simple_public_object_id.py new file mode 100644 index 00000000..629b3f63 --- /dev/null +++ b/hubspot/crm/invoices/models/batch_read_input_simple_public_object_id.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.simple_public_object_id import SimplePublicObjectId +from typing import Optional, Set +from typing_extensions import Self + +class BatchReadInputSimplePublicObjectId(BaseModel): + """ + BatchReadInputSimplePublicObjectId + """ # noqa: E501 + properties_with_history: List[StrictStr] = Field(alias="propertiesWithHistory") + id_property: Optional[StrictStr] = Field(default=None, alias="idProperty") + inputs: List[SimplePublicObjectId] + properties: List[StrictStr] + __properties: ClassVar[List[str]] = ["propertiesWithHistory", "idProperty", "inputs", "properties"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BatchReadInputSimplePublicObjectId from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in inputs (list) + _items = [] + if self.inputs: + for _item in self.inputs: + if _item: + _items.append(_item.to_dict()) + _dict['inputs'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BatchReadInputSimplePublicObjectId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "propertiesWithHistory": obj.get("propertiesWithHistory"), + "idProperty": obj.get("idProperty"), + "inputs": [SimplePublicObjectId.from_dict(_item) for _item in obj["inputs"]] if obj.get("inputs") is not None else None, + "properties": obj.get("properties") + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/batch_response_simple_public_object.py b/hubspot/crm/invoices/models/batch_response_simple_public_object.py new file mode 100644 index 00000000..84b61030 --- /dev/null +++ b/hubspot/crm/invoices/models/batch_response_simple_public_object.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.simple_public_object import SimplePublicObject +from typing import Optional, Set +from typing_extensions import Self + +class BatchResponseSimplePublicObject(BaseModel): + """ + BatchResponseSimplePublicObject + """ # noqa: E501 + completed_at: datetime = Field(alias="completedAt") + requested_at: Optional[datetime] = Field(default=None, alias="requestedAt") + started_at: datetime = Field(alias="startedAt") + links: Optional[Dict[str, StrictStr]] = None + results: List[SimplePublicObject] + status: StrictStr + __properties: ClassVar[List[str]] = ["completedAt", "requestedAt", "startedAt", "links", "results", "status"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['PENDING', 'PROCESSING', 'CANCELED', 'COMPLETE']): + raise ValueError("must be one of enum values ('PENDING', 'PROCESSING', 'CANCELED', 'COMPLETE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BatchResponseSimplePublicObject from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item in self.results: + if _item: + _items.append(_item.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BatchResponseSimplePublicObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "completedAt": obj.get("completedAt"), + "requestedAt": obj.get("requestedAt"), + "startedAt": obj.get("startedAt"), + "links": obj.get("links"), + "results": [SimplePublicObject.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "status": obj.get("status") + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/batch_response_simple_public_object_with_errors.py b/hubspot/crm/invoices/models/batch_response_simple_public_object_with_errors.py new file mode 100644 index 00000000..be1c923a --- /dev/null +++ b/hubspot/crm/invoices/models/batch_response_simple_public_object_with_errors.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.simple_public_object import SimplePublicObject +from hubspot.crm.invoices.models.standard_error import StandardError +from typing import Optional, Set +from typing_extensions import Self + +class BatchResponseSimplePublicObjectWithErrors(BaseModel): + """ + BatchResponseSimplePublicObjectWithErrors + """ # noqa: E501 + completed_at: datetime = Field(alias="completedAt") + num_errors: Optional[StrictInt] = Field(default=None, alias="numErrors") + requested_at: Optional[datetime] = Field(default=None, alias="requestedAt") + started_at: datetime = Field(alias="startedAt") + links: Optional[Dict[str, StrictStr]] = None + results: List[SimplePublicObject] + errors: Optional[List[StandardError]] = None + status: StrictStr + __properties: ClassVar[List[str]] = ["completedAt", "numErrors", "requestedAt", "startedAt", "links", "results", "errors", "status"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['PENDING', 'PROCESSING', 'CANCELED', 'COMPLETE']): + raise ValueError("must be one of enum values ('PENDING', 'PROCESSING', 'CANCELED', 'COMPLETE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BatchResponseSimplePublicObjectWithErrors from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item in self.results: + if _item: + _items.append(_item.to_dict()) + _dict['results'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item in self.errors: + if _item: + _items.append(_item.to_dict()) + _dict['errors'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BatchResponseSimplePublicObjectWithErrors from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "completedAt": obj.get("completedAt"), + "numErrors": obj.get("numErrors"), + "requestedAt": obj.get("requestedAt"), + "startedAt": obj.get("startedAt"), + "links": obj.get("links"), + "results": [SimplePublicObject.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "errors": [StandardError.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None, + "status": obj.get("status") + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/collection_response_associated_id.py b/hubspot/crm/invoices/models/collection_response_associated_id.py new file mode 100644 index 00000000..70c002f6 --- /dev/null +++ b/hubspot/crm/invoices/models/collection_response_associated_id.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.associated_id import AssociatedId +from hubspot.crm.invoices.models.paging import Paging +from typing import Optional, Set +from typing_extensions import Self + +class CollectionResponseAssociatedId(BaseModel): + """ + CollectionResponseAssociatedId + """ # noqa: E501 + paging: Optional[Paging] = None + results: List[AssociatedId] + __properties: ClassVar[List[str]] = ["paging", "results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionResponseAssociatedId from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of paging + if self.paging: + _dict['paging'] = self.paging.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item in self.results: + if _item: + _items.append(_item.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionResponseAssociatedId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "paging": Paging.from_dict(obj["paging"]) if obj.get("paging") is not None else None, + "results": [AssociatedId.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/collection_response_simple_public_object_with_associations_forward_paging.py b/hubspot/crm/invoices/models/collection_response_simple_public_object_with_associations_forward_paging.py new file mode 100644 index 00000000..a084503c --- /dev/null +++ b/hubspot/crm/invoices/models/collection_response_simple_public_object_with_associations_forward_paging.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.forward_paging import ForwardPaging +from hubspot.crm.invoices.models.simple_public_object_with_associations import SimplePublicObjectWithAssociations +from typing import Optional, Set +from typing_extensions import Self + +class CollectionResponseSimplePublicObjectWithAssociationsForwardPaging(BaseModel): + """ + CollectionResponseSimplePublicObjectWithAssociationsForwardPaging + """ # noqa: E501 + paging: Optional[ForwardPaging] = None + results: List[SimplePublicObjectWithAssociations] + __properties: ClassVar[List[str]] = ["paging", "results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionResponseSimplePublicObjectWithAssociationsForwardPaging from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of paging + if self.paging: + _dict['paging'] = self.paging.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item in self.results: + if _item: + _items.append(_item.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionResponseSimplePublicObjectWithAssociationsForwardPaging from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "paging": ForwardPaging.from_dict(obj["paging"]) if obj.get("paging") is not None else None, + "results": [SimplePublicObjectWithAssociations.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/collection_response_with_total_simple_public_object_forward_paging.py b/hubspot/crm/invoices/models/collection_response_with_total_simple_public_object_forward_paging.py new file mode 100644 index 00000000..bcd2de07 --- /dev/null +++ b/hubspot/crm/invoices/models/collection_response_with_total_simple_public_object_forward_paging.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.forward_paging import ForwardPaging +from hubspot.crm.invoices.models.simple_public_object import SimplePublicObject +from typing import Optional, Set +from typing_extensions import Self + +class CollectionResponseWithTotalSimplePublicObjectForwardPaging(BaseModel): + """ + CollectionResponseWithTotalSimplePublicObjectForwardPaging + """ # noqa: E501 + total: StrictInt + paging: Optional[ForwardPaging] = None + results: List[SimplePublicObject] + __properties: ClassVar[List[str]] = ["total", "paging", "results"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CollectionResponseWithTotalSimplePublicObjectForwardPaging from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of paging + if self.paging: + _dict['paging'] = self.paging.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item in self.results: + if _item: + _items.append(_item.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionResponseWithTotalSimplePublicObjectForwardPaging from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "paging": ForwardPaging.from_dict(obj["paging"]) if obj.get("paging") is not None else None, + "results": [SimplePublicObject.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/error.py b/hubspot/crm/invoices/models/error.py new file mode 100644 index 00000000..0cf01389 --- /dev/null +++ b/hubspot/crm/invoices/models/error.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.error_detail import ErrorDetail +from typing import Optional, Set +from typing_extensions import Self + +class Error(BaseModel): + """ + Error + """ # noqa: E501 + sub_category: Optional[StrictStr] = Field(default=None, description="A specific category that contains more specific detail about the error", alias="subCategory") + context: Optional[Dict[str, List[StrictStr]]] = Field(default=None, description="Context about the error condition") + correlation_id: StrictStr = Field(description="A unique identifier for the request. Include this value with any error reports or support tickets", alias="correlationId") + links: Optional[Dict[str, StrictStr]] = Field(default=None, description="A map of link names to associated URIs containing documentation about the error or recommended remediation steps") + message: StrictStr = Field(description="A human readable message describing the error along with remediation steps where appropriate") + category: StrictStr = Field(description="The error category") + errors: Optional[List[ErrorDetail]] = Field(default=None, description="further information about the error") + __properties: ClassVar[List[str]] = ["subCategory", "context", "correlationId", "links", "message", "category", "errors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Error from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item in self.errors: + if _item: + _items.append(_item.to_dict()) + _dict['errors'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Error from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "subCategory": obj.get("subCategory"), + "context": obj.get("context"), + "correlationId": obj.get("correlationId"), + "links": obj.get("links"), + "message": obj.get("message"), + "category": obj.get("category"), + "errors": [ErrorDetail.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/error_detail.py b/hubspot/crm/invoices/models/error_detail.py new file mode 100644 index 00000000..d4606906 --- /dev/null +++ b/hubspot/crm/invoices/models/error_detail.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ErrorDetail(BaseModel): + """ + ErrorDetail + """ # noqa: E501 + sub_category: Optional[StrictStr] = Field(default=None, description="A specific category that contains more specific detail about the error", alias="subCategory") + code: Optional[StrictStr] = Field(default=None, description="The status code associated with the error detail") + var_in: Optional[StrictStr] = Field(default=None, description="The name of the field or parameter in which the error was found.", alias="in") + context: Optional[Dict[str, List[StrictStr]]] = Field(default=None, description="Context about the error condition") + message: StrictStr = Field(description="A human readable message describing the error along with remediation steps where appropriate") + __properties: ClassVar[List[str]] = ["subCategory", "code", "in", "context", "message"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ErrorDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ErrorDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "subCategory": obj.get("subCategory"), + "code": obj.get("code"), + "in": obj.get("in"), + "context": obj.get("context"), + "message": obj.get("message") + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/filter.py b/hubspot/crm/invoices/models/filter.py new file mode 100644 index 00000000..c27ce1d1 --- /dev/null +++ b/hubspot/crm/invoices/models/filter.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class Filter(BaseModel): + """ + Filter + """ # noqa: E501 + high_value: Optional[StrictStr] = Field(default=None, alias="highValue") + property_name: StrictStr = Field(alias="propertyName") + values: Optional[List[StrictStr]] = None + value: Optional[StrictStr] = None + operator: StrictStr = Field(description="null") + __properties: ClassVar[List[str]] = ["highValue", "propertyName", "values", "value", "operator"] + + @field_validator('operator') + def operator_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['EQ', 'NEQ', 'LT', 'LTE', 'GT', 'GTE', 'BETWEEN', 'IN', 'NOT_IN', 'HAS_PROPERTY', 'NOT_HAS_PROPERTY', 'CONTAINS_TOKEN', 'NOT_CONTAINS_TOKEN']): + raise ValueError("must be one of enum values ('EQ', 'NEQ', 'LT', 'LTE', 'GT', 'GTE', 'BETWEEN', 'IN', 'NOT_IN', 'HAS_PROPERTY', 'NOT_HAS_PROPERTY', 'CONTAINS_TOKEN', 'NOT_CONTAINS_TOKEN')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Filter from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Filter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "highValue": obj.get("highValue"), + "propertyName": obj.get("propertyName"), + "values": obj.get("values"), + "value": obj.get("value"), + "operator": obj.get("operator") + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/filter_group.py b/hubspot/crm/invoices/models/filter_group.py new file mode 100644 index 00000000..5b7c1037 --- /dev/null +++ b/hubspot/crm/invoices/models/filter_group.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from hubspot.crm.invoices.models.filter import Filter +from typing import Optional, Set +from typing_extensions import Self + +class FilterGroup(BaseModel): + """ + FilterGroup + """ # noqa: E501 + filters: List[Filter] + __properties: ClassVar[List[str]] = ["filters"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FilterGroup from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in filters (list) + _items = [] + if self.filters: + for _item in self.filters: + if _item: + _items.append(_item.to_dict()) + _dict['filters'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FilterGroup from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "filters": [Filter.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/forward_paging.py b/hubspot/crm/invoices/models/forward_paging.py new file mode 100644 index 00000000..ff1a5283 --- /dev/null +++ b/hubspot/crm/invoices/models/forward_paging.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.next_page import NextPage +from typing import Optional, Set +from typing_extensions import Self + +class ForwardPaging(BaseModel): + """ + ForwardPaging + """ # noqa: E501 + next: Optional[NextPage] = None + __properties: ClassVar[List[str]] = ["next"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ForwardPaging from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of next + if self.next: + _dict['next'] = self.next.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ForwardPaging from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "next": NextPage.from_dict(obj["next"]) if obj.get("next") is not None else None + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/next_page.py b/hubspot/crm/invoices/models/next_page.py new file mode 100644 index 00000000..2d0e6c18 --- /dev/null +++ b/hubspot/crm/invoices/models/next_page.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class NextPage(BaseModel): + """ + NextPage + """ # noqa: E501 + link: Optional[StrictStr] = None + after: StrictStr + __properties: ClassVar[List[str]] = ["link", "after"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of NextPage from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of NextPage from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "link": obj.get("link"), + "after": obj.get("after") + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/paging.py b/hubspot/crm/invoices/models/paging.py new file mode 100644 index 00000000..a5f6dbfd --- /dev/null +++ b/hubspot/crm/invoices/models/paging.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.next_page import NextPage +from hubspot.crm.invoices.models.previous_page import PreviousPage +from typing import Optional, Set +from typing_extensions import Self + +class Paging(BaseModel): + """ + Paging + """ # noqa: E501 + next: Optional[NextPage] = None + prev: Optional[PreviousPage] = None + __properties: ClassVar[List[str]] = ["next", "prev"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Paging from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of next + if self.next: + _dict['next'] = self.next.to_dict() + # override the default output from pydantic by calling `to_dict()` of prev + if self.prev: + _dict['prev'] = self.prev.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Paging from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "next": NextPage.from_dict(obj["next"]) if obj.get("next") is not None else None, + "prev": PreviousPage.from_dict(obj["prev"]) if obj.get("prev") is not None else None + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/previous_page.py b/hubspot/crm/invoices/models/previous_page.py new file mode 100644 index 00000000..9f0359f0 --- /dev/null +++ b/hubspot/crm/invoices/models/previous_page.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PreviousPage(BaseModel): + """ + PreviousPage + """ # noqa: E501 + before: StrictStr + link: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["before", "link"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PreviousPage from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PreviousPage from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "before": obj.get("before"), + "link": obj.get("link") + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/public_object_search_request.py b/hubspot/crm/invoices/models/public_object_search_request.py new file mode 100644 index 00000000..81c7f3e3 --- /dev/null +++ b/hubspot/crm/invoices/models/public_object_search_request.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.filter_group import FilterGroup +from typing import Optional, Set +from typing_extensions import Self + +class PublicObjectSearchRequest(BaseModel): + """ + PublicObjectSearchRequest + """ # noqa: E501 + query: Optional[StrictStr] = None + limit: StrictInt + after: StrictStr + sorts: List[StrictStr] + properties: List[StrictStr] + filter_groups: List[FilterGroup] = Field(alias="filterGroups") + __properties: ClassVar[List[str]] = ["query", "limit", "after", "sorts", "properties", "filterGroups"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicObjectSearchRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in filter_groups (list) + _items = [] + if self.filter_groups: + for _item in self.filter_groups: + if _item: + _items.append(_item.to_dict()) + _dict['filterGroups'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicObjectSearchRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "query": obj.get("query"), + "limit": obj.get("limit"), + "after": obj.get("after"), + "sorts": obj.get("sorts"), + "properties": obj.get("properties"), + "filterGroups": [FilterGroup.from_dict(_item) for _item in obj["filterGroups"]] if obj.get("filterGroups") is not None else None + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/simple_public_object.py b/hubspot/crm/invoices/models/simple_public_object.py new file mode 100644 index 00000000..1896b46a --- /dev/null +++ b/hubspot/crm/invoices/models/simple_public_object.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.value_with_timestamp import ValueWithTimestamp +from typing import Optional, Set +from typing_extensions import Self + +class SimplePublicObject(BaseModel): + """ + SimplePublicObject + """ # noqa: E501 + created_at: datetime = Field(alias="createdAt") + archived: Optional[StrictBool] = None + archived_at: Optional[datetime] = Field(default=None, alias="archivedAt") + properties_with_history: Optional[Dict[str, List[ValueWithTimestamp]]] = Field(default=None, alias="propertiesWithHistory") + id: StrictStr + properties: Dict[str, Optional[StrictStr]] + updated_at: datetime = Field(alias="updatedAt") + __properties: ClassVar[List[str]] = ["createdAt", "archived", "archivedAt", "propertiesWithHistory", "id", "properties", "updatedAt"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimplePublicObject from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each value in properties_with_history (dict of array) + _field_dict_of_array = {} + if self.properties_with_history: + for _key in self.properties_with_history: + if self.properties_with_history[_key] is not None: + _field_dict_of_array[_key] = [ + _item.to_dict() for _item in self.properties_with_history[_key] + ] + _dict['propertiesWithHistory'] = _field_dict_of_array + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimplePublicObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "createdAt": obj.get("createdAt"), + "archived": obj.get("archived"), + "archivedAt": obj.get("archivedAt"), + "propertiesWithHistory": dict( + (_k, + [ValueWithTimestamp.from_dict(_item) for _item in _v] + if _v is not None + else None + ) + for _k, _v in obj.get("propertiesWithHistory", {}).items() + ), + "id": obj.get("id"), + "properties": obj.get("properties"), + "updatedAt": obj.get("updatedAt") + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/simple_public_object_id.py b/hubspot/crm/invoices/models/simple_public_object_id.py new file mode 100644 index 00000000..10c73443 --- /dev/null +++ b/hubspot/crm/invoices/models/simple_public_object_id.py @@ -0,0 +1,87 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class SimplePublicObjectId(BaseModel): + """ + SimplePublicObjectId + """ # noqa: E501 + id: StrictStr + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimplePublicObjectId from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimplePublicObjectId from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/simple_public_object_with_associations.py b/hubspot/crm/invoices/models/simple_public_object_with_associations.py new file mode 100644 index 00000000..007d00f9 --- /dev/null +++ b/hubspot/crm/invoices/models/simple_public_object_with_associations.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.collection_response_associated_id import CollectionResponseAssociatedId +from hubspot.crm.invoices.models.value_with_timestamp import ValueWithTimestamp +from typing import Optional, Set +from typing_extensions import Self + +class SimplePublicObjectWithAssociations(BaseModel): + """ + SimplePublicObjectWithAssociations + """ # noqa: E501 + associations: Optional[Dict[str, CollectionResponseAssociatedId]] = None + created_at: datetime = Field(alias="createdAt") + archived: Optional[StrictBool] = None + archived_at: Optional[datetime] = Field(default=None, alias="archivedAt") + properties_with_history: Optional[Dict[str, List[ValueWithTimestamp]]] = Field(default=None, alias="propertiesWithHistory") + id: StrictStr + properties: Dict[str, Optional[StrictStr]] + updated_at: datetime = Field(alias="updatedAt") + __properties: ClassVar[List[str]] = ["associations", "createdAt", "archived", "archivedAt", "propertiesWithHistory", "id", "properties", "updatedAt"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimplePublicObjectWithAssociations from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each value in associations (dict) + _field_dict = {} + if self.associations: + for _key in self.associations: + if self.associations[_key]: + _field_dict[_key] = self.associations[_key].to_dict() + _dict['associations'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in properties_with_history (dict of array) + _field_dict_of_array = {} + if self.properties_with_history: + for _key in self.properties_with_history: + if self.properties_with_history[_key] is not None: + _field_dict_of_array[_key] = [ + _item.to_dict() for _item in self.properties_with_history[_key] + ] + _dict['propertiesWithHistory'] = _field_dict_of_array + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimplePublicObjectWithAssociations from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "associations": dict( + (_k, CollectionResponseAssociatedId.from_dict(_v)) + for _k, _v in obj["associations"].items() + ) + if obj.get("associations") is not None + else None, + "createdAt": obj.get("createdAt"), + "archived": obj.get("archived"), + "archivedAt": obj.get("archivedAt"), + "propertiesWithHistory": dict( + (_k, + [ValueWithTimestamp.from_dict(_item) for _item in _v] + if _v is not None + else None + ) + for _k, _v in obj.get("propertiesWithHistory", {}).items() + ), + "id": obj.get("id"), + "properties": obj.get("properties"), + "updatedAt": obj.get("updatedAt") + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/standard_error.py b/hubspot/crm/invoices/models/standard_error.py new file mode 100644 index 00000000..cbb35107 --- /dev/null +++ b/hubspot/crm/invoices/models/standard_error.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from hubspot.crm.invoices.models.error_detail import ErrorDetail +from typing import Optional, Set +from typing_extensions import Self + +class StandardError(BaseModel): + """ + StandardError + """ # noqa: E501 + sub_category: Optional[Dict[str, Any]] = Field(default=None, alias="subCategory") + context: Dict[str, List[StrictStr]] + links: Dict[str, StrictStr] + id: Optional[StrictStr] = None + category: StrictStr + message: StrictStr + errors: List[ErrorDetail] + status: StrictStr + __properties: ClassVar[List[str]] = ["subCategory", "context", "links", "id", "category", "message", "errors", "status"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StandardError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item in self.errors: + if _item: + _items.append(_item.to_dict()) + _dict['errors'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StandardError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "subCategory": obj.get("subCategory"), + "context": obj.get("context"), + "links": obj.get("links"), + "id": obj.get("id"), + "category": obj.get("category"), + "message": obj.get("message"), + "errors": [ErrorDetail.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None, + "status": obj.get("status") + }) + return _obj + + diff --git a/hubspot/crm/invoices/models/value_with_timestamp.py b/hubspot/crm/invoices/models/value_with_timestamp.py new file mode 100644 index 00000000..829220a4 --- /dev/null +++ b/hubspot/crm/invoices/models/value_with_timestamp.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ValueWithTimestamp(BaseModel): + """ + ValueWithTimestamp + """ # noqa: E501 + source_id: Optional[StrictStr] = Field(default=None, alias="sourceId") + source_type: StrictStr = Field(alias="sourceType") + source_label: Optional[StrictStr] = Field(default=None, alias="sourceLabel") + updated_by_user_id: Optional[StrictInt] = Field(default=None, alias="updatedByUserId") + value: StrictStr + timestamp: datetime + __properties: ClassVar[List[str]] = ["sourceId", "sourceType", "sourceLabel", "updatedByUserId", "value", "timestamp"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValueWithTimestamp from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValueWithTimestamp from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sourceId": obj.get("sourceId"), + "sourceType": obj.get("sourceType"), + "sourceLabel": obj.get("sourceLabel"), + "updatedByUserId": obj.get("updatedByUserId"), + "value": obj.get("value"), + "timestamp": obj.get("timestamp") + }) + return _obj + + diff --git a/hubspot/crm/invoices/py.typed b/hubspot/crm/invoices/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/hubspot/crm/invoices/rest.py b/hubspot/crm/invoices/rest.py new file mode 100644 index 00000000..6a90f7ca --- /dev/null +++ b/hubspot/crm/invoices/rest.py @@ -0,0 +1,257 @@ +# coding: utf-8 + +""" + Invoices + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: v3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import io +import json +import re +import ssl + +import urllib3 + +from hubspot.crm.invoices.exceptions import ApiException, ApiValueError + +SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} +RESTResponseType = urllib3.HTTPResponse + + +def is_socks_proxy_url(url): + if url is None: + return False + split_section = url.split("://") + if len(split_section) < 2: + return False + else: + return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES + + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status + self.reason = resp.reason + self.data = None + + def read(self): + if self.data is None: + self.data = self.response.data + return self.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> None: + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + } + if configuration.assert_hostname is not None: + pool_args['assert_hostname'] = ( + configuration.assert_hostname + ) + + if configuration.retries is not None: + pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + pool_args['server_hostname'] = configuration.tls_server_name + + + if configuration.socket_options is not None: + pool_args['socket_options'] = configuration.socket_options + + if configuration.connection_pool_maxsize is not None: + pool_args['maxsize'] = configuration.connection_pool_maxsize + + # https pool manager + self.pool_manager: urllib3.PoolManager + + if configuration.proxy: + if is_socks_proxy_url(configuration.proxy): + from urllib3.contrib.socks import SOCKSProxyManager + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) + else: + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) + else: + self.pool_manager = urllib3.PoolManager(**pool_args) + + def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): + """Perform requests. + + :param method: http request method + :param url: http request url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _request_timeout: 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. + """ + method = method.upper() + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int, float)): + timeout = urllib3.Timeout(total=_request_timeout) + elif ( + isinstance(_request_timeout, tuple) + and len(_request_timeout) == 2 + ): + timeout = urllib3.Timeout( + connect=_request_timeout[0], + read=_request_timeout[1] + ) + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + + # no content type provided or payload is json + content_type = headers.get('Content-Type') + if ( + not content_type + or re.search('json', content_type, re.IGNORECASE) + ): + request_body = None + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, + url, + body=request_body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type == 'application/x-www-form-urlencoded': + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=False, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + # Ensures that dict objects are serialized + post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params] + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=True, + timeout=timeout, + headers=headers, + preload_content=False + ) + # Pass a `string` parameter directly in the body to support + # other content types than JSON when `body` argument is + # provided in serialized form. + elif isinstance(body, str) or isinstance(body, bytes): + r = self.pool_manager.request( + method, + url, + body=body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool): + request_body = "true" if body else "false" + r = self.pool_manager.request( + method, + url, + body=request_body, + preload_content=False, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request( + method, + url, + fields={}, + timeout=timeout, + headers=headers, + preload_content=False + ) + except urllib3.exceptions.SSLError as e: + msg = "\n".join([type(e).__name__, str(e)]) + raise ApiException(status=0, reason=msg) + + return RESTResponse(r) diff --git a/hubspot/discovery/crm/discovery.py b/hubspot/discovery/crm/discovery.py index f20a0fdf..592a96a3 100644 --- a/hubspot/discovery/crm/discovery.py +++ b/hubspot/discovery/crm/discovery.py @@ -85,3 +85,8 @@ def tickets(self): def timeline(self): from .timeline.discovery import Discovery as TimelineDiscovery return TimelineDiscovery(self.config) + + @property + def invoices(self): + from .invoices.discovery import Discovery as InvoicesDiscovery + return InvoicesDiscovery(self.config) diff --git a/hubspot/discovery/crm/invoices/__init__.py b/hubspot/discovery/crm/invoices/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/hubspot/discovery/crm/invoices/discovery.py b/hubspot/discovery/crm/invoices/discovery.py new file mode 100644 index 00000000..a84e7dd7 --- /dev/null +++ b/hubspot/discovery/crm/invoices/discovery.py @@ -0,0 +1,20 @@ +import hubspot.crm.invoices as api_client +from hubspot.utils.objects import fetch_all +from ...discovery_base import DiscoveryBase + + +class Discovery(DiscoveryBase): + @property + def basic_api(self) -> api_client.BasicApi: + return self._configure_api_client(api_client, "BasicApi") + + @property + def batch_api(self) -> api_client.BatchApi: + return self._configure_api_client(api_client, "BatchApi") + + @property + def search_api(self) -> api_client.SearchApi: + return self._configure_api_client(api_client, "SearchApi") + + def get_all(self, **kwargs): + return fetch_all(self.basic_api, **kwargs) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..2cd120e2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,8 @@ +annotated-types==0.7.0 +certifi==2024.7.4 +pydantic==2.8.2 +pydantic_core==2.20.1 +python-dateutil==2.9.0.post0 +six==1.16.0 +typing_extensions==4.12.2 +urllib3==2.2.2 diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 00000000..2dc5b475 --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,10 @@ +annotated-types==0.7.0 +certifi==2024.7.4 +pydantic==2.8.2 +pydantic_core==2.20.1 +python-dateutil==2.9.0.post0 +python-dotenv==1.0.1 +setuptools==72.1.0 +six==1.16.0 +typing_extensions==4.12.2 +urllib3==2.2.2