# coding: utf-8 """ easybill REST API The first version of the easybill REST API. [CHANGELOG](https://api.easybill.de/rest/v1/CHANGELOG.md) ## Authentication You can choose between two available methods: `Basic Auth` or `Bearer Token`. In each HTTP request, one of the following HTTP headers is required: ``` # Basic Auth Authorization: Basic base64_encode(':') # Bearer Token Authorization: Bearer ``` ## Limitations ### Request Limit * PLUS: 10 requests per minute * BUSINESS: 60 requests per minute If the limit is exceeded, you will receive the HTTP error: `429 Too Many Requests` ### Result Limit All result lists are limited to 100 by default. This limit can be increased by the query parameter `limit` to a maximum of 1000. ## Query filter Many list resources can be filtered. In `/documents` you can filter e.g. by number with `/documents?number=111028654`. If you want to filter multiple numbers, you can either enter them separated by commas `/documents?number=111028654,222006895` or as an array `/documents?number[]=111028654&number[]=222006895`. **Warning**: The maximum size of an HTTP request line in bytes is 4094. If this limit is exceeded, you will receive the HTTP error: `414 Request-URI Too Large` ### Escape commas in query You can escape commans in query `name=Patrick\\, Peter` if you submit the header `X-Easybill-Escape: true` in your request. ## Property login_id This is the login of your admin or employee account. ## Date and Date-Time format Please use the timezone `Europe/Berlin`. * **date** = *Y-m-d* = `2016-12-31` * **date-time** = *Y-m-d H:i:s* = `2016-12-31 03:13:37` Date or datetime can be `null` because the attributes have been added later and the entry is older. The version of the OpenAPI document: 1.96.0 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 date 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 from pydantic_core import to_jsonable_python class ServiceDate(BaseModel): """ This object is only available in document type INVOICE or CREDIT. """ # noqa: E501 type: Optional[StrictStr] = Field(default=None, description="With DEFAULT no other fields are required and this message will be printed: 'Invoice date coincides with the time of supply'.
For SERVICE or DELIVERY exactly one of the following fields must be set: date, date_from and date_to or text.") var_date: Optional[date] = Field(default=None, alias="date") date_from: Optional[date] = None date_to: Optional[date] = None text: Optional[StrictStr] = 'null' __properties: ClassVar[List[str]] = ["type", "date", "date_from", "date_to", "text"] @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value if value not in set(['DEFAULT', 'SERVICE', 'DELIVERY']): raise ValueError("must be one of enum values ('DEFAULT', 'SERVICE', 'DELIVERY')") return value model_config = ConfigDict( validate_by_name=True, validate_by_alias=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""" return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ServiceDate 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, ) # set to None if var_date (nullable) is None # and model_fields_set contains the field if self.var_date is None and "var_date" in self.model_fields_set: _dict['date'] = None # set to None if date_from (nullable) is None # and model_fields_set contains the field if self.date_from is None and "date_from" in self.model_fields_set: _dict['date_from'] = None # set to None if date_to (nullable) is None # and model_fields_set contains the field if self.date_to is None and "date_to" in self.model_fields_set: _dict['date_to'] = None # set to None if text (nullable) is None # and model_fields_set contains the field if self.text is None and "text" in self.model_fields_set: _dict['text'] = None return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of ServiceDate from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) _obj = cls.model_validate({ "type": obj.get("type"), "date": obj.get("date"), "date_from": obj.get("date_from"), "date_to": obj.get("date_to"), "text": obj.get("text") if obj.get("text") is not None else 'null' }) return _obj