Pydantic Models

Smarter API PluginData Sql Connection Manifest Constants.

Smarter API Manifest - User.metadata

class smarter.apps.provider.manifest.models.provider.metadata.SAMProviderMetadata(*, name, description, version, tags=<factory>, annotations=<factory>)[source]

Bases: AbstractSAMMetadataBase

Smarter API Provider Manifest - Metadata class.

class_identifier: ClassVar[str] = 'Provider.metadata'
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

Smarter API Manifest - Plugin.spec.

class smarter.apps.provider.manifest.models.provider.spec.SAMProviderSpec(*, provider)[source]

Bases: AbstractSAMSpecBase

Smarter API Api Connection Manifest ApiConnection.spec.

class_identifier: ClassVar[str] = 'Provider.spec'
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

provider: SAMProviderSpecProvider
class smarter.apps.provider.manifest.models.provider.spec.SAMProviderSpecProvider(*, name, description=None, base_url=None, api_key=None, connectivity_test_path='', logo=None, website_url=None, contact_email=None, support_email=None, terms_of_service_url=None, docs_url=None, privacy_policy_url=None)[source]

Bases: SmarterBasePydanticModel

Smarter API - generic API Connection class.

api_key: str | None
base_url: str | None
connectivity_test_path: str | None
contact_email: EmailStr | None
description: str | None
docs_url: str | None
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

name: str
privacy_policy_url: str | None
support_email: EmailStr | None
terms_of_service_url: str | None
classmethod validate_api_key(v)[source]

Accept api_key unchanged.

Parameters:

v – The name of the Secret that holds the api key.

Returns:

The value, unchanged.

classmethod validate_api_url(v)[source]

Require base_url, when set, to be a valid URL.

Parameters:

v – The API URL, or None.

Returns:

The value, unchanged.

Raises:

SAMValidationError – If the value is not a valid URL.

classmethod validate_connectivity_test_path(v)[source]

Give connectivity_test_path leading and trailing slashes, and require a valid URL path.

Parameters:

v – The connectivity test path.

Returns:

The path, with leading and trailing slashes, or None if it is empty.

Raises:

SAMValidationError – If the path is not a valid URL path.

classmethod validate_contact_email(v)[source]

Require contact_email, when set, to be a valid email address.

Parameters:

v – The email address, or None.

Returns:

The value, unchanged.

Raises:

SAMValidationError – If the value is not a valid email address.

classmethod validate_docs_url(v)[source]

Require docs_url, when set, to be a valid URL.

Parameters:

v – The documentation URL, or None.

Returns:

The value, unchanged.

Raises:

SAMValidationError – If the value is not a valid URL.

Require logo, when set, to be a valid URL.

Parameters:

v – The logo URL, or None.

Returns:

The value, unchanged.

Raises:

SAMValidationError – If the value is not a valid URL.

classmethod validate_name(v)[source]

Strip the Provider name, and require it to be non-empty snake case.

Parameters:

v – The name.

Returns:

The stripped name.

Raises:

SAMValidationError – If the name is empty or not snake case.

classmethod validate_privacy_policy_url(v)[source]

Require privacy_policy_url, when set, to be a valid URL.

Parameters:

v – The privacy policy URL, or None.

Returns:

The value, unchanged.

Raises:

SAMValidationError – If the value is not a valid URL.

classmethod validate_support_email(v)[source]

Require support_email, when set, to be a valid email address.

Parameters:

v – The email address, or None.

Returns:

The value, unchanged.

Raises:

SAMValidationError – If the value is not a valid email address.

classmethod validate_terms_of_service_url(v)[source]

Require terms_of_service_url, when set, to be a valid URL.

Parameters:

v – The terms of service URL, or None.

Returns:

The value, unchanged.

Raises:

SAMValidationError – If the value is not a valid URL.

classmethod validate_website(v)[source]

Require website_url, when set, to be a valid URL.

Parameters:

v – The website URL, or None.

Returns:

The value, unchanged.

Raises:

SAMValidationError – If the value is not a valid URL.

website_url: str | None
smarter.apps.provider.manifest.models.provider.spec.should_log(level)[source]

Check if logging should be done based on the waffle switch.

Smarter API Manifest - Account.status

class smarter.apps.provider.manifest.models.provider.status.SAMProviderStatus(*, recordLocator, created, modified, dependencies=None, is_active, is_flagged, is_deprecated, is_suspended, is_verified, ownership_requested=None, contact_email_verified=None, support_email_verified=None, tos_accepted_at=None, tos_accepted_by=None, can_activate=True)[source]

Bases: AbstractSAMStatusBase

Smarter API Provider Manifest - Status class.

can_activate: bool
class_identifier: ClassVar[str] = 'Provider.status'
contact_email_verified: datetime | None
is_active: bool
is_deprecated: bool
is_flagged: bool
is_suspended: bool
is_verified: bool
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

ownership_requested: EmailStr | None
support_email_verified: datetime | None
tos_accepted_at: datetime | None
tos_accepted_by: EmailStr | None

Smarter API Account Manifest

class smarter.apps.provider.manifest.models.provider.model.SAMProvider(*, apiVersion, kind, metadata, spec, status=None)[source]

Bases: AbstractSAMBase

Smarter API Manifest - Account

class_identifier: ClassVar[str] = 'Provider'
metadata: SAMProviderMetadata
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

spec: SAMProviderSpec
status: SAMProviderStatus | None