Use traits and enums instead of types for the API.