← ClaudeAtlas

python-modelslisted

Build and read the non-obvious model shapes of the PayPal Server SDK Python SDK — optionals, enums, oneOf/anyOf unions, dates, collections, `additional_properties`. Load when a field is anything but a plain string or number, or when an attribute you expected is missing. The class body won't tell you an omitted optional is *absent* from the instance, not `None` — `hasattr`, not `is None`, is the check.
MuHamza30/paypal-api-plugin · ★ 0 · AI & Automation · score 70
Install: claude install-skill MuHamza30/paypal-api-plugin
# Working with models in an APIMatic Python SDK Most request/response data are plain Python objects under `paypalserversdk/models/` (covered in `python-calling-endpoints`). This skill covers the **non-obvious model shapes** that trip integrations up. The patterns are generic across APIMatic Python SDKs; take the real names from your SDK source. > `doc/models/*.md` carries one page per model — field table, types, and a **Default** column. Read it > alongside the class body; `doc/models/containers/` covers union types. ## Anatomy of a generated model Each model class carries two or three class-level tables that tell you everything about its wire behaviour — `_nullables` is generated only for models that have a nullable attribute: - `_names` — maps the Python attribute name to the **API property name**. When the two differ (`mtype` for a property called `type`, `person_type` for `personType`), this is the mapping that explains it. - `_optionals` — the attributes that may be omitted. Plus a `from_dictionary(dictionary)` classmethod, which is how the SDK deserializes responses. You rarely call it directly, but it is the definitive answer to how a given field is parsed. ## Optional attributes: absent, not `None` An attribute in `_optionals` defaults to `APIHelper.SKIP`, and the constructor **only assigns it when you pass something else**. So on both the request and the response side: ```python model = {Model}({required_attr}=1) # {optional_attr} never assigned — un