Coverage for fingerprint_server_sdk/models/plugins_inner.py: 64%
39 statements
« prev ^ index » next coverage.py v7.14.3, created at 2026-07-14 10:45 +0000
« prev ^ index » next coverage.py v7.14.3, created at 2026-07-14 10:45 +0000
1"""
2Server API
3Fingerprint Server API allows you to get, search, and update Events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios.
4Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.
5The API also supports collection of Automation Intelligence for requests to your server in edge, pre-origin, or middleware contexts.
7The version of the OpenAPI document: 4
8Contact: support@fingerprint.com
9Generated by OpenAPI Generator (https://openapi-generator.tech)
11Do not edit the class manually.
12""" # noqa: E501
14from __future__ import annotations
16import json
17import pprint
18import re # noqa: F401
19from typing import Any, ClassVar, Optional
21from pydantic import BaseModel, ConfigDict, Field, StrictStr
22from typing_extensions import Self
24from fingerprint_server_sdk.models.plugins_inner_mime_types_inner import PluginsInnerMimeTypesInner
27class PluginsInner(BaseModel):
28 """
29 PluginsInner
30 """
32 name: StrictStr
33 description: Optional[StrictStr] = None
34 mime_types: Optional[list[PluginsInnerMimeTypesInner]] = Field(default=None, alias='mimeTypes')
35 __properties: ClassVar[list[str]] = ['name', 'description', 'mimeTypes']
37 model_config = ConfigDict(
38 populate_by_name=True,
39 validate_assignment=True,
40 protected_namespaces=(),
41 )
43 def to_str(self) -> str:
44 """Returns the string representation of the model using alias"""
45 return pprint.pformat(self.model_dump(by_alias=True))
47 def to_json(self) -> str:
48 """Returns the JSON representation of the model using alias"""
49 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50 return json.dumps(self.to_dict())
52 @classmethod
53 def from_json(cls, json_str: str) -> Optional[Self]:
54 """Create an instance of PluginsInner from a JSON string"""
55 return cls.from_dict(json.loads(json_str))
57 def to_dict(self) -> dict[str, Any]:
58 """Return the dictionary representation of the model using alias.
60 This has the following differences from calling pydantic's
61 `self.model_dump(by_alias=True)`:
63 * `None` is only added to the output dict for nullable fields that
64 were set at model initialization. Other fields with value `None`
65 are ignored.
66 """
67 excluded_fields: set[str] = set([])
69 _dict = self.model_dump(
70 by_alias=True,
71 exclude=excluded_fields,
72 exclude_none=True,
73 )
74 # override the default output from pydantic by calling `to_dict()` of each item in mime_types (list)
75 _items = []
76 if self.mime_types:
77 for _item_mime_types in self.mime_types:
78 if _item_mime_types:
79 _items.append(_item_mime_types.to_dict())
80 _dict['mimeTypes'] = _items
81 return _dict
83 @classmethod
84 def from_dict(cls, obj: Optional[dict[str, Any]]) -> Optional[Self]:
85 """Create an instance of PluginsInner from a dict"""
86 if obj is None:
87 return None
89 if not isinstance(obj, dict):
90 return cls.model_validate(obj)
92 _obj = cls.model_validate(
93 {
94 'name': obj.get('name'),
95 'description': obj.get('description'),
96 'mimeTypes': [
97 PluginsInnerMimeTypesInner.from_dict(_item) for _item in obj['mimeTypes']
98 ]
99 if obj.get('mimeTypes') is not None
100 else None,
101 }
102 )
103 return _obj