Views

ChatBot api/v1/chatbots CRUD views.

class smarter.apps.chatbot.api.v1.views.views.ChatBotDeployView(*args, **kwargs)[source]

Bases: ViewBase

ChatBot deployment view for smarter api.

post(request, chatbot_id)[source]
serializer_class

alias of ChatBotSerializer

class smarter.apps.chatbot.api.v1.views.views.ChatBotFunctionsListView(*args, **kwargs)[source]

Bases: ListViewBase

ChatBotFunctions list view for smarter api.

get_queryset(*args, **kwargs)[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of ChatBotFunctionsSerializer

class smarter.apps.chatbot.api.v1.views.views.ChatbotAPIKeyListView(*args, **kwargs)[source]

Bases: ListViewBase

ChatBotAPIKey list view for smarter api.

get_queryset(*args, **kwargs)[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of ChatBotAPIKeySerializer

class smarter.apps.chatbot.api.v1.views.views.ChatbotAPIKeyView(*args, **kwargs)[source]

Bases: ViewBase

ChatBotAPIKey view for smarter api.

delete(request, chatbot_id, api_key_id)[source]
get(request, chatbot_id, api_key_id)[source]
post(request, chatbot_id, api_key_id=None)[source]
serializer_class

alias of ChatBotAPIKeySerializer

class smarter.apps.chatbot.api.v1.views.views.ChatbotCustomDomainListView(*args, **kwargs)[source]

Bases: ListViewBase

ChatBotCustomDomain list view for smarter api.

get_queryset(*args, **kwargs)[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of ChatBotCustomDomainSerializer

class smarter.apps.chatbot.api.v1.views.views.ChatbotCustomDomainView(*args, **kwargs)[source]

Bases: ViewBase

ChatBotCustomDomain view for smarter api.

delete(request, chatbot_id, custom_domain_id)[source]
get(request, chatbot_id, custom_domain_id)[source]
post(request, chatbot_id, custom_domain_id=None)[source]
serializer_class

alias of ChatBotCustomDomainSerializer

class smarter.apps.chatbot.api.v1.views.views.ChatbotFunctionsView(*args, **kwargs)[source]

Bases: ViewBase

ChatBotFunctions view for smarter api.

delete(request, chatbot_id, function_id)[source]
get(request, chatbot_id, function_id)[source]
patch(request, chatbot_id, function_id)[source]
post(request, chatbot_id)[source]
serializer_class

alias of ChatBotFunctionsSerializer

class smarter.apps.chatbot.api.v1.views.views.ChatbotListView(*args, **kwargs)[source]

Bases: ListViewBase

ChatBot list view for smarter api.

chatbots: Optional[QuerySet]
dispatch(request, *args, **kwargs)[source]

Extend DRF dispatch() to add authentication checks and logging.

Parameters:

request (HttpRequest) – The incoming HTTP request.

Returns:

The HTTP response generated by the view.

Return type:

HttpResponse

Raises:
  • AuthenticationFailed – Raised when authentication fails.

  • SmarterTokenAuthenticationError – Raised for errors specific to SmarterTokenAuthentication.

get_queryset(*args, **kwargs)[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of ChatBotSerializer

class smarter.apps.chatbot.api.v1.views.views.ChatbotPluginListView(*args, **kwargs)[source]

Bases: ListViewBase

ChatBotPlugin list view for smarter api.

get_queryset(*args, **kwargs)[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

serializer_class

alias of ChatBotPluginSerializer

class smarter.apps.chatbot.api.v1.views.views.ChatbotPluginView(*args, **kwargs)[source]

Bases: ViewBase

ChatBotPlugin view for smarter api.

delete(request, chatbot_id, plugin_id)[source]
get(request, chatbot_id, plugin_meta_id)[source]
patch(request, chatbot_id, plugin_id)[source]
post(request, chatbot_id)[source]
serializer_class

alias of ChatBotPluginSerializer

class smarter.apps.chatbot.api.v1.views.views.ChatbotView(*args, **kwargs)[source]

Bases: ViewBase

ChatBot view for smarter api.

chatbot: Optional[ChatBot] = None
delete(request, *args, chatbot_id=None, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]

Extend DRF dispatch() to add authentication check.

Parameters:

request (HttpRequest) – The incoming HTTP request.

Raises:
  • AuthenticationFailed – Raised when authentication fails.

  • SmarterTokenAuthenticationError – Raised for errors specific to SmarterTokenAuthentication.

get(request, chatbot_id)[source]
get_queryset(*args, **kwargs)[source]
patch(request, *args, chatbot_id=None, **kwargs)[source]
post(request, *args, **kwargs)[source]
serializer_class

alias of ChatBotSerializer

class smarter.apps.chatbot.api.v1.views.views.ListViewBase(*args, **kwargs)[source]

Bases: SmarterAdminListAPIView

Base class for all chatbot list views.

dispatch(request, *args, **kwargs)[source]

Extend DRF dispatch() to add authentication checks and logging.

Parameters:

request (HttpRequest) – The incoming HTTP request.

Returns:

The HTTP response generated by the view.

Return type:

HttpResponse

Raises:
  • AuthenticationFailed – Raised when authentication fails.

  • SmarterTokenAuthenticationError – Raised for errors specific to SmarterTokenAuthentication.

class smarter.apps.chatbot.api.v1.views.views.ViewBase(*args, **kwargs)[source]

Bases: SmarterAdminAPIView

Base class for all chatbot detail views.

dispatch(request, *args, **kwargs)[source]

Extend DRF dispatch() to add authentication check.

Parameters:

request (HttpRequest) – The incoming HTTP request.

Raises:
  • AuthenticationFailed – Raised when authentication fails.

  • SmarterTokenAuthenticationError – Raised for errors specific to SmarterTokenAuthentication.

smarter.apps.chatbot.api.v1.views.views.should_log(level)[source]

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