← ClaudeAtlas

typescript-modelslisted

Work with models from the PayPal Server SDK TypeScript SDK. Load before building a request payload or mapping a response onto your own types. The interface won't tell you each model has a paired runtime schema, how unions are read back, that date fields are plain strings, or where unknown JSON survives.
MuHamza30/paypal-api-plugin · ★ 0 · AI & Automation · score 70
Install: claude install-skill MuHamza30/paypal-api-plugin
# Working with models in an APIMatic TypeScript SDK Most request/response data are plain TypeScript objects conforming to interfaces (covered in `typescript-calling-endpoints`). This skill covers the **non-obvious model shapes** that trip integrations up. The patterns are generic across APIMatic TypeScript SDKs; take the real type names from your SDK source. ## Union types (oneOf / anyOf) When a field can be one of several types, APIMatic generates a union type in `src/models/containers/`: a TypeScript union of the variant interfaces, plus a runtime schema built with either `oneOf([...])` or `anyOf([...])`. **The two behave differently and you must tell them apart.** The only reliable signals are the container file's doc comment (`This is a container type for one-of types` / `... for any-of types`) and the literal `oneOf([...])` / `anyOf([...])` call in its source. Do **not** infer it from the schema's runtime `type()` string or from the error text — an `anyOf` container also reports itself as `OneOf<...>`. ### Construct — a plain object literal There are **no factory helpers**. Assign the variant's own shape directly: ```typescript const body: {RequestType} = { {field}: { // typed as {Union} type: '{variantTag}', // the variant's discriminating value, if it has one someField: 'value', }, }; ``` ### Read — narrow with the generated type guards The union's namespace exports one `is{Variant}` guard per variant. These are **read-side only*