|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + FreeClimb API |
| 5 | +
|
| 6 | + FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request. |
| 7 | +
|
| 8 | + The version of the OpenAPI document: 1.0.0 |
| 9 | + Contact: support@freeclimb.com |
| 10 | + Generated by OpenAPI Generator (https://openapi-generator.tech) |
| 11 | +
|
| 12 | + Do not edit the class manually. |
| 13 | +""" # noqa: E501 |
| 14 | + |
| 15 | + |
| 16 | +from __future__ import annotations |
| 17 | +import pprint |
| 18 | +import re # noqa: F401 |
| 19 | +import json |
| 20 | + |
| 21 | +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator |
| 22 | +from typing import Any, ClassVar, Dict, List, Optional |
| 23 | +from typing_extensions import Annotated |
| 24 | +from freeclimb.models.sms_toll_free_campaign_registration_status import ( |
| 25 | + SMSTollFreeCampaignRegistrationStatus, |
| 26 | +) |
| 27 | +from pydantic import StrictStr |
| 28 | +from typing import Optional, Set |
| 29 | +from typing_extensions import Self |
| 30 | + |
| 31 | + |
| 32 | +class TFNCampaign( |
| 33 | + BaseModel, populate_by_name=True, validate_assignment=True, protected_namespaces=() |
| 34 | +): |
| 35 | + """ |
| 36 | + TFNCampaign |
| 37 | + """ # noqa: E501 |
| 38 | + |
| 39 | + account_id: Optional[StrictStr] = Field( |
| 40 | + description="ID of the account that created this participant.", |
| 41 | + alias="accountId", |
| 42 | + ) |
| 43 | + campaign_id: Annotated[str, Field(strict=True)] = Field( |
| 44 | + description="TFNCampaignId", alias="campaignId" |
| 45 | + ) |
| 46 | + use_case: StrictStr = Field(alias="useCase") |
| 47 | + registration_status: SMSTollFreeCampaignRegistrationStatus = Field( |
| 48 | + alias="registrationStatus" |
| 49 | + ) |
| 50 | + date_created: StrictStr = Field(alias="dateCreated") |
| 51 | + date_updated: StrictStr = Field(alias="dateUpdated") |
| 52 | + date_created_iso: StrictStr = Field(alias="dateCreatedISO") |
| 53 | + date_updated_iso: StrictStr = Field(alias="dateUpdatedISO") |
| 54 | + revision: StrictInt |
| 55 | + |
| 56 | + __properties: ClassVar[List[str]] = [ |
| 57 | + "accountId", |
| 58 | + "campaignId", |
| 59 | + "useCase", |
| 60 | + "registrationStatus", |
| 61 | + "dateCreated", |
| 62 | + "dateUpdated", |
| 63 | + "dateCreatedISO", |
| 64 | + "dateUpdatedISO", |
| 65 | + "revision", |
| 66 | + ] |
| 67 | + |
| 68 | + @field_validator("campaign_id") |
| 69 | + def campaign_id_validate_regular_expression(cls, value): |
| 70 | + """Validates the regular expression""" |
| 71 | + if not re.match(r"cmptfn_[a-fA-F0-9]{40}", value): |
| 72 | + raise ValueError( |
| 73 | + r"must validate the regular expression /cmptfn_[a-fA-F0-9]{40}/" |
| 74 | + ) |
| 75 | + return value |
| 76 | + |
| 77 | + def to_str(self) -> str: |
| 78 | + """Returns the string representation of the model using alias""" |
| 79 | + return pprint.pformat(self.model_dump(by_alias=True)) |
| 80 | + |
| 81 | + def to_json(self) -> str: |
| 82 | + """Returns the JSON representation of the model using alias""" |
| 83 | + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead |
| 84 | + return json.dumps(self.to_dict()) |
| 85 | + |
| 86 | + @classmethod |
| 87 | + def from_json(cls, json_str: str) -> Optional[Self]: |
| 88 | + """Create an instance of TFNCampaign from a JSON string""" |
| 89 | + return cls.from_dict(json.loads(json_str)) |
| 90 | + |
| 91 | + def to_dict(self) -> Dict[str, Any]: |
| 92 | + """Return the dictionary representation of the model using alias. |
| 93 | +
|
| 94 | + This has the following differences from calling pydantic's |
| 95 | + `self.model_dump(by_alias=True)`: |
| 96 | +
|
| 97 | + * `None` is only added to the output dict for nullable fields that |
| 98 | + were set at model initialization. Other fields with value `None` |
| 99 | + are ignored. |
| 100 | + """ |
| 101 | + excluded_fields: Set[str] = set([]) |
| 102 | + |
| 103 | + _dict = self.model_dump( |
| 104 | + by_alias=True, |
| 105 | + exclude=excluded_fields, |
| 106 | + exclude_none=True, |
| 107 | + ) |
| 108 | + # set to None if account_id (nullable) is None |
| 109 | + # and model_fields_set contains the field |
| 110 | + if self.account_id is None and "account_id" in self.model_fields_set: |
| 111 | + _dict["accountId"] = None |
| 112 | + |
| 113 | + return _dict |
| 114 | + |
| 115 | + @classmethod |
| 116 | + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: |
| 117 | + """Create an instance of TFNCampaign from a dict""" |
| 118 | + if obj is None: |
| 119 | + return None |
| 120 | + |
| 121 | + if not isinstance(obj, dict): |
| 122 | + return cls.model_validate(obj) |
| 123 | + |
| 124 | + _obj = cls.model_validate( |
| 125 | + { |
| 126 | + "accountId": obj.get("accountId"), |
| 127 | + "campaignId": obj.get("campaignId"), |
| 128 | + "useCase": obj.get("useCase"), |
| 129 | + "registrationStatus": obj.get("registrationStatus"), |
| 130 | + "dateCreated": obj.get("dateCreated"), |
| 131 | + "dateUpdated": obj.get("dateUpdated"), |
| 132 | + "dateCreatedISO": obj.get("dateCreatedISO"), |
| 133 | + "dateUpdatedISO": obj.get("dateUpdatedISO"), |
| 134 | + "revision": obj.get("revision"), |
| 135 | + } |
| 136 | + ) |
| 137 | + return _obj |
0 commit comments