|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + DataForSEO API documentation |
| 5 | +
|
| 6 | + DataForSEO API is the starting point on your journey towards building powerful SEO software. With DataForSEO you can get all the data you need to build an efficient application while also saving your time and budget. DataForSEO API is using the REST technology for interchanging data between your application and our service. The data exchange is made through the widely used HTTP protocol, which allows applying our API to almost all programming languages. |
| 7 | +
|
| 8 | + The version of the OpenAPI document: 1.0.0 |
| 9 | + Generated by OpenAPI Generator (https://openapi-generator.tech) |
| 10 | +
|
| 11 | + Do not edit the class manually. |
| 12 | +""" # noqa: E501 |
| 13 | + |
| 14 | + |
| 15 | +from __future__ import annotations |
| 16 | +import pprint |
| 17 | +import re # noqa: F401 |
| 18 | +import json |
| 19 | + |
| 20 | +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr |
| 21 | +from typing import Any, ClassVar, Dict, List, Optional |
| 22 | +from typing import Optional, Set |
| 23 | +from typing_extensions import Self |
| 24 | + |
| 25 | +class AbsoluteItems(BaseModel): |
| 26 | + """ |
| 27 | + AbsoluteItems |
| 28 | + """ # noqa: E501 |
| 29 | + geo_id: Optional[StrictStr] = Field(default=None, description="location identifier you can use this field for matching obtained results with location parameters specified in the request see the full list of available locations with their geo_id here or by making a separate request to https://api.dataforseo.com/v3/keywords_data/dataforseo_trends/locations example: US-NY") |
| 30 | + geo_name: Optional[StrictStr] = Field(default=None, description="location name you can use this field for matching obtained results with location parameters specified in the request see the full list of available locations with their geo_name here or by making a separate request to https://api.dataforseo.com/v3/keywords_data/dataforseo_trends/locations example: Andorra") |
| 31 | + values: Optional[List[Optional[StrictInt]]] = Field(default=None, description="keyword popularity rates within a given location represents location-specific keyword popularity rate over the specified time range; using these values, you can understand which of the specified keywords is more popular in the related location; the first value in the array is provided for the first term from the keywords array, the second value is provided for the second keyword, and so on; calculation: we determine the highest popularity value across all specified keywords within a given location, and then express the popularity values of each keyword as a percentage of the highest value (100); a value of 100 is the peak popularity for the term a value of 50 means that the term is half as popular a value of 0 means there was not enough data for this term") |
| 32 | + __properties: ClassVar[List[str]] = ["geo_id", "geo_name", "values"] |
| 33 | + |
| 34 | + model_config = ConfigDict( |
| 35 | + populate_by_name=True, |
| 36 | + validate_assignment=True, |
| 37 | + protected_namespaces=(), |
| 38 | + ) |
| 39 | + |
| 40 | + |
| 41 | + def to_str(self) -> str: |
| 42 | + """Returns the string representation of the model using alias""" |
| 43 | + return pprint.pformat(self.model_dump(by_alias=True)) |
| 44 | + |
| 45 | + def to_json(self) -> str: |
| 46 | + """Returns the JSON representation of the model using alias""" |
| 47 | + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead |
| 48 | + return json.dumps(self.to_dict()) |
| 49 | + |
| 50 | + @classmethod |
| 51 | + def from_json(cls, json_str: str) -> Optional[Self]: |
| 52 | + """Create an instance of AbsoluteItems from a JSON string""" |
| 53 | + return cls.from_dict(json.loads(json_str)) |
| 54 | + |
| 55 | + def to_dict(self) -> Dict[str, Any]: |
| 56 | + """Return the dictionary representation of the model using alias. |
| 57 | +
|
| 58 | + This has the following differences from calling pydantic's |
| 59 | + `self.model_dump(by_alias=True)`: |
| 60 | +
|
| 61 | + * `None` is only added to the output dict for nullable fields that |
| 62 | + were set at model initialization. Other fields with value `None` |
| 63 | + are ignored. |
| 64 | + """ |
| 65 | + excluded_fields: Set[str] = set([ |
| 66 | + ]) |
| 67 | + |
| 68 | + _dict = self.model_dump( |
| 69 | + by_alias=True, |
| 70 | + exclude=excluded_fields, |
| 71 | + exclude_none=True, |
| 72 | + ) |
| 73 | + # set to None if geo_id (nullable) is None |
| 74 | + # and model_fields_set contains the field |
| 75 | + if self.geo_id is None and "geo_id" in self.model_fields_set: |
| 76 | + _dict['geo_id'] = None |
| 77 | + |
| 78 | + # set to None if geo_name (nullable) is None |
| 79 | + # and model_fields_set contains the field |
| 80 | + if self.geo_name is None and "geo_name" in self.model_fields_set: |
| 81 | + _dict['geo_name'] = None |
| 82 | + |
| 83 | + # set to None if values (nullable) is None |
| 84 | + # and model_fields_set contains the field |
| 85 | + if self.values is None and "values" in self.model_fields_set: |
| 86 | + _dict['values'] = None |
| 87 | + |
| 88 | + return _dict |
| 89 | + |
| 90 | + @classmethod |
| 91 | + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: |
| 92 | + """Create an instance of AbsoluteItems from a dict""" |
| 93 | + if obj is None: |
| 94 | + return None |
| 95 | + |
| 96 | + if not isinstance(obj, dict): |
| 97 | + return cls.model_validate(obj) |
| 98 | + |
| 99 | + _obj = cls.model_validate({ |
| 100 | + "geo_id": obj.get("geo_id"), |
| 101 | + "geo_name": obj.get("geo_name"), |
| 102 | + "values": obj.get("values") |
| 103 | + }) |
| 104 | + return _obj |
| 105 | + |
| 106 | + |
0 commit comments