API Reference
Provider api/v1/providers views.
Providers are created and updated by applying manifests, with smarter apply, so these
views only read them:
GET providers/: the active Providers that the user may read.GET providers/<name>/: an active Provider that the user may read.GET providers/<name>/models/: the active models of that Provider.GET providers/<name>/models/<model_name>/: one active model of that Provider.
A Provider or model that does not exist, is inactive, or belongs to another account answers 404, so that the Providers of other accounts are not disclosed.
The responses are built from the models of smarter.apps.provider.contract.models, which the
Smarter api’s OpenAPI document publishes.
- class smarter.apps.provider.api.v1.views.provider.ProviderApiViewSet(*args, **kwargs)[source]
Bases:
ProviderViewBaseAn active Provider that the user may read.
- get(request, *args, name, **kwargs)[source]
Return the Provider.
- Parameters:
request (
Request) – The api request.name (
str) – The Provider’s name.
- Returns:
A 200 response whose body is the Provider, as a
ProviderApiProvider.- Raises:
Http404 – If no active Provider with this name is readable by the user.
- serializer_class
alias of
ProviderSerializer
- class smarter.apps.provider.api.v1.views.provider.ProviderModelApiViewSet(*args, **kwargs)[source]
Bases:
ProviderViewBaseAn active model of an active Provider that the user may read.
- serializer_class
alias of
ProviderModelSerializer
- class smarter.apps.provider.api.v1.views.provider.ProviderModelsApiViewSet(*args, **kwargs)[source]
Bases:
ProviderViewBaseThe active models of an active Provider that the user may read.
- get(request, *args, name, **kwargs)[source]
Return the Provider’s active models, ordered by name.
- Parameters:
request (
Request) – The api request.name (
str) – The Provider’s name.
- Returns:
A 200 response whose body is a list of
ProviderApiModel.- Raises:
Http404 – If no active Provider with this name is readable by the user.
- serializer_class
alias of
ProviderModelSerializer
- class smarter.apps.provider.api.v1.views.provider.ProviderViewBase(*args, **kwargs)[source]
Bases:
SmarterAuthenticatedAPIViewBase class for views of one Provider, identified by its
name.get_provider()returns the Provider only if it is active and the user may read it. Otherwise it raisesHttp404. Provider names are unique per account, so when the user may read several Providers of that name, their own account’s wins.
- class smarter.apps.provider.api.v1.views.provider.ProvidersApiViewSet(*args, **kwargs)[source]
Bases:
ContractListMixin,SmarterAuthenticatedListAPIViewThe active Providers that the user may read.
- contract_model
alias of
ProviderApiProvider
- get_queryset(*args, **kwargs)[source]
Return the active Providers that the requesting user may read.
- Return type:
- Returns:
The readable Providers queryset.
- serializer_class
alias of
ProviderSerializer