|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + Segment Public API |
| 5 | +
|
| 6 | + The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API. |
| 7 | +
|
| 8 | + The version of the OpenAPI document: 58.0.1 |
| 9 | + |
| 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 | + |
| 22 | + |
| 23 | +from pydantic import BaseModel, Field, StrictStr, validator |
| 24 | + |
| 25 | +class AudienceDefinitionBeta(BaseModel): |
| 26 | + """ |
| 27 | + Defines an audience definition. # noqa: E501 |
| 28 | + """ |
| 29 | + query: StrictStr = Field(..., description="The query language string defining the audience segmentation criteria.") |
| 30 | + type: StrictStr = Field(..., description="The underlying data type being segmented for this audience. Possible values: users, accounts.") |
| 31 | + __properties = ["query", "type"] |
| 32 | + |
| 33 | + @validator('type') |
| 34 | + def type_validate_enum(cls, value): |
| 35 | + """Validates the enum""" |
| 36 | + if value not in ('ACCOUNTS', 'USERS'): |
| 37 | + raise ValueError("must be one of enum values ('ACCOUNTS', 'USERS')") |
| 38 | + return value |
| 39 | + |
| 40 | + class Config: |
| 41 | + """Pydantic configuration""" |
| 42 | + allow_population_by_field_name = True |
| 43 | + validate_assignment = True |
| 44 | + |
| 45 | + def to_str(self) -> str: |
| 46 | + """Returns the string representation of the model using alias""" |
| 47 | + return pprint.pformat(self.dict(by_alias=True)) |
| 48 | + |
| 49 | + def to_json(self) -> str: |
| 50 | + """Returns the JSON representation of the model using alias""" |
| 51 | + return json.dumps(self.to_dict()) |
| 52 | + |
| 53 | + @classmethod |
| 54 | + def from_json(cls, json_str: str) -> AudienceDefinitionBeta: |
| 55 | + """Create an instance of AudienceDefinitionBeta from a JSON string""" |
| 56 | + return cls.from_dict(json.loads(json_str)) |
| 57 | + |
| 58 | + def to_dict(self): |
| 59 | + """Returns the dictionary representation of the model using alias""" |
| 60 | + _dict = self.dict(by_alias=True, |
| 61 | + exclude={ |
| 62 | + }, |
| 63 | + exclude_none=True) |
| 64 | + return _dict |
| 65 | + |
| 66 | + @classmethod |
| 67 | + def from_dict(cls, obj: dict) -> AudienceDefinitionBeta: |
| 68 | + """Create an instance of AudienceDefinitionBeta from a dict""" |
| 69 | + if obj is None: |
| 70 | + return None |
| 71 | + |
| 72 | + if not isinstance(obj, dict): |
| 73 | + return AudienceDefinitionBeta.parse_obj(obj) |
| 74 | + |
| 75 | + _obj = AudienceDefinitionBeta.parse_obj({ |
| 76 | + "query": obj.get("query"), |
| 77 | + "type": obj.get("type") |
| 78 | + }) |
| 79 | + return _obj |
| 80 | + |
| 81 | + |
0 commit comments