dotnet-models

Construct and read models in APIMatic-generated .NET SDKs using C#.

Updated Jun 9, 2026
One-click install
npx skills add https://github.com/apimatic/plugin-marketplace --skill dotnet-models-apimatic
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-models
Source: https://github.com/apimatic/plugin-marketplace/tree/main/plugins/maxio-sdk/skills/dotnet-models
Command: npx skills add https://github.com/apimatic/plugin-marketplace --skill dotnet-models-apimatic

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Working with APIMatic-generated .NET SDK models involves non-obvious shapes—union types without object-initializers, string/int enums with inconsistent FromValue support, and nullability rules—that cause compile errors and incorrect request payloads when developers guess at the API surface. ## Core Features & Use Cases - Union Type Handling: Construct OneOf/AnyOf unions via static factory methods and read them back with TryGet variant accessors, including implicit conversions for primitive AnyOf variants. - Enum Guidance: Use type-safe StringEnum/IntEnum constants, FromValue for unknown values, and TryGetKnownValue guards, with warnings about enums that lack the public FromValue helper. - Collections, Dates & Nullability: Assign IReadOnlyList/IReadOnlyDictionary properties, work with DateTimeOffset for ISO-8601 wire formats, and understand null-versus-empty serialization semantics. - Use Case: When building a request payload for a payments endpoint whose amount field is a string-or-decimal AnyOf union, use the generated factory methods and confirm exact CLR types from the contract sheet instead of assuming double. ## Quick Start Ask the agent to build a request model for an APIMatic .NET SDK endpoint, constructing any union fields with their static factory methods and setting enum properties from the generated constants.

Frequently Asked Questions about dotnet-models

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I construct a OneOf or AnyOf union type in an APIMatic .NET SDK?▼

Union types in APIMatic .NET SDKs are immutable records built with static factory methods, one per variant, such as Union.String(value) or Union.Variant(model). Read them back with TryGet methods like TryGetString(out var s); object-initializers are not supported on unions.

How do I convert a string to an enum value in a generated C# SDK?▼

Use the enum's static constants for known values or EnumType.FromValue(string) for runtime values. Note that FromValue is not emitted on every enum—some selectors expose only constants—so verify it exists before relying on it.

Does a null collection property get serialized in the request JSON?▼

A null collection is omitted from the JSON entirely, while an empty collection is serialized as an empty array. Optional properties use JsonIgnoreCondition.WhenWritingNull, so leaving them unset differs from sending an explicit null.

What C# type should I use for date and numeric model fields?▼

Date/time fields are DateTimeOffset serialized as ISO-8601/RFC-3339. Numeric types vary per SDK (int, long, double, decimal, or string-or-number AnyOf unions), so take the exact type from the contract sheet rather than assuming double.

What happens to unknown JSON fields when deserializing SDK responses?▼

Unknown fields are captured only if the model has an additional-properties map; otherwise they are dropped during deserialization. To read an unmodeled field, regenerate the SDK or parse that response manually.