Skip to content

Commit

Permalink
Merge pull request #179 from HubSpot/feature/codegen_crm_properties
Browse files Browse the repository at this point in the history
Regeneration crm properties(codegen only)
  • Loading branch information
alzheltkovskiy-hubspot authored Mar 2, 2023
2 parents f52ad06 + de8fafc commit 89e1c34
Show file tree
Hide file tree
Showing 3 changed files with 276 additions and 145 deletions.
159 changes: 84 additions & 75 deletions hubspot/crm/properties/models/model_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,84 +33,60 @@ class ModelProperty(object):
and the value is json key in definition.
"""
openapi_types = {
"updated_at": "datetime",
"created_at": "datetime",
"archived_at": "datetime",
"name": "str",
"label": "str",
"type": "str",
"field_type": "str",
"description": "str",
"group_name": "str",
"options": "list[Option]",
"created_user_id": "str",
"updated_user_id": "str",
"referenced_object_type": "str",
"display_order": "int",
"calculated": "bool",
"external_options": "bool",
"archived": "bool",
"has_unique_value": "bool",
"hidden": "bool",
"hubspot_defined": "bool",
"show_currency_symbol": "bool",
"modification_metadata": "PropertyModificationMetadata",
"form_field": "bool",
'updated_at': 'datetime',
'created_at': 'datetime',
'archived_at': 'datetime',
'name': 'str',
'label': 'str',
'type': 'str',
'field_type': 'str',
'description': 'str',
'group_name': 'str',
'options': 'list[Option]',
'created_user_id': 'str',
'updated_user_id': 'str',
'referenced_object_type': 'str',
'display_order': 'int',
'calculated': 'bool',
'external_options': 'bool',
'archived': 'bool',
'has_unique_value': 'bool',
'hidden': 'bool',
'hubspot_defined': 'bool',
'show_currency_symbol': 'bool',
'modification_metadata': 'PropertyModificationMetadata',
'form_field': 'bool',
'calculation_formula': 'str'
}

attribute_map = {
"updated_at": "updatedAt",
"created_at": "createdAt",
"archived_at": "archivedAt",
"name": "name",
"label": "label",
"type": "type",
"field_type": "fieldType",
"description": "description",
"group_name": "groupName",
"options": "options",
"created_user_id": "createdUserId",
"updated_user_id": "updatedUserId",
"referenced_object_type": "referencedObjectType",
"display_order": "displayOrder",
"calculated": "calculated",
"external_options": "externalOptions",
"archived": "archived",
"has_unique_value": "hasUniqueValue",
"hidden": "hidden",
"hubspot_defined": "hubspotDefined",
"show_currency_symbol": "showCurrencySymbol",
"modification_metadata": "modificationMetadata",
"form_field": "formField",
'updated_at': 'updatedAt',
'created_at': 'createdAt',
'archived_at': 'archivedAt',
'name': 'name',
'label': 'label',
'type': 'type',
'field_type': 'fieldType',
'description': 'description',
'group_name': 'groupName',
'options': 'options',
'created_user_id': 'createdUserId',
'updated_user_id': 'updatedUserId',
'referenced_object_type': 'referencedObjectType',
'display_order': 'displayOrder',
'calculated': 'calculated',
'external_options': 'externalOptions',
'archived': 'archived',
'has_unique_value': 'hasUniqueValue',
'hidden': 'hidden',
'hubspot_defined': 'hubspotDefined',
'show_currency_symbol': 'showCurrencySymbol',
'modification_metadata': 'modificationMetadata',
'form_field': 'formField',
'calculation_formula': 'calculationFormula'
}

def __init__(
self,
updated_at=None,
created_at=None,
archived_at=None,
name=None,
label=None,
type=None,
field_type=None,
description=None,
group_name=None,
options=None,
created_user_id=None,
updated_user_id=None,
referenced_object_type=None,
display_order=None,
calculated=None,
external_options=None,
archived=None,
has_unique_value=None,
hidden=None,
hubspot_defined=None,
show_currency_symbol=None,
modification_metadata=None,
form_field=None,
local_vars_configuration=None,
): # noqa: E501
def __init__(self, updated_at=None, created_at=None, archived_at=None, name=None, label=None, type=None, field_type=None, description=None, group_name=None, options=None, created_user_id=None, updated_user_id=None, referenced_object_type=None, display_order=None, calculated=None, external_options=None, archived=None, has_unique_value=None, hidden=None, hubspot_defined=None, show_currency_symbol=None, modification_metadata=None, form_field=None, calculation_formula=None, local_vars_configuration=None): # noqa: E501
"""ModelProperty - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration()
Expand Down Expand Up @@ -139,6 +115,7 @@ def __init__(
self._show_currency_symbol = None
self._modification_metadata = None
self._form_field = None
self._calculation_formula = None
self.discriminator = None

if updated_at is not None:
Expand Down Expand Up @@ -180,6 +157,8 @@ def __init__(
self.modification_metadata = modification_metadata
if form_field is not None:
self.form_field = form_field
if calculation_formula is not None:
self.calculation_formula = calculation_formula

@property
def updated_at(self):
Expand Down Expand Up @@ -718,18 +697,48 @@ def form_field(self, form_field):

self._form_field = form_field

@property
def calculation_formula(self):
"""Gets the calculation_formula of this ModelProperty. # noqa: E501
Represents a formula that is used to compute a calculated property. # noqa: E501
:return: The calculation_formula of this ModelProperty. # noqa: E501
:rtype: str
"""
return self._calculation_formula

@calculation_formula.setter
def calculation_formula(self, calculation_formula):
"""Sets the calculation_formula of this ModelProperty.
Represents a formula that is used to compute a calculated property. # noqa: E501
:param calculation_formula: The calculation_formula of this ModelProperty. # noqa: E501
:type: str
"""

self._calculation_formula = calculation_formula

def to_dict(self):
"""Returns the model properties as a dict"""
result = {}

for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items()))
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value

Expand Down
Loading

0 comments on commit 89e1c34

Please sign in to comment.