wxc_sdk.base module

wxc_sdk.base.webex_id_to_uuid(webex_id: str | None) str | None[source]

Convert a webex id as used by the public APIs to a UUID

Parameters:

webex_id (str) – base 64 encoded id as used by public APIs

Returns:

ID in uuid format

wxc_sdk.base.to_camel(s: str) str[source]

Convert snake case variable name to camel case log_id -> logId

Parameters:

s – snake case variable name

Returns:

Camel case name

class wxc_sdk.base.ApiModel[source]

Bases: BaseModel

Base for all models used by the APIs

class Config[source]

Bases: object

alias_generator() str

Convert snake case variable name to camel case log_id -> logId

Parameters:

s – snake case variable name

Returns:

Camel case name

populate_by_name = True
extra = 'forbid'

set to ‘forbid’ if run in unittest to catch schema issues during tests else set to ‘allow’

use_enum_values = True
model_dump_json(*args, exclude_none=True, by_alias=True, **kwargs) str[source]

Usage docs: https://docs.pydantic.dev/2.7/concepts/serialization/#modelmodel_dump_json

Generates a JSON representation of the model using Pydantic’s to_json method.

Parameters:
  • indent – Indentation to use in the JSON output. If None is passed, the output will be compact.

  • include – Field(s) to include in the JSON output.

  • exclude – Field(s) to exclude from the JSON output.

  • context – Additional context to pass to the serializer.

  • by_alias – Whether to serialize using field aliases.

  • exclude_unset – Whether to exclude fields that have not been explicitly set.

  • exclude_defaults – Whether to exclude fields that are set to their default value.

  • exclude_none – Whether to exclude fields that have a value of None.

  • round_trip – If True, dumped values should be valid as input for non-idempotent types such as Json[T].

  • warnings – How to handle serialization errors. False/”none” ignores them, True/”warn” logs errors, “error” raises a [PydanticSerializationError][pydantic_core.PydanticSerializationError].

  • serialize_as_any – Whether to serialize fields with duck-typing serialization behavior.

Returns:

A JSON string representation of the model.

classmethod model_validate(obj)[source]

Validate a pydantic model instance.

Parameters:
  • obj – The object to validate.

  • strict – Whether to enforce types strictly.

  • from_attributes – Whether to extract data from object attributes.

  • context – Additional context to pass to the validator.

Raises:

ValidationError – If the object could not be validated.

Returns:

The validated model instance.

class wxc_sdk.base.CodeAndReason(*, code: str, reason: str)[source]

Bases: ApiModel

code: str
reason: str
class wxc_sdk.base.ApiModelWithErrors(*, errors: dict[str, CodeAndReason] | None = None)[source]

Bases: ApiModel

errors: dict[str, CodeAndReason] | None
wxc_sdk.base.plus1(v: str | None) str[source]

Convert 10D number to +E.164. Can be used as validator :param v: :return:

wxc_sdk.base.dt_iso_str(dt: datetime) str[source]

ISO format datetime as used by Webex API (no time zone, milliseconds) :param dt: :return:

class wxc_sdk.base.SafeEnum(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

A replacement for the standard Enum class which allows dynamic enhancements of enums

wxc_sdk.base.enum_str(enum_or_str: Enum | str) str[source]

return str value of enum or string

Parameters:

enum_or_str – value to be converted to string

Returns:

str representation