API
This module contains views to implement the React AuthToken list view in the Smarter Dashboard.
- class smarter.lib.drf.views.listview.api.AuthTokenListApiCloneView(*args, **kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewClone a authtoken for the authenticated user.
- post(request, *args, **kwargs)[source]
Handle POST requests to clone an existing AuthToken. Validates input parameters, checks for the existence of the AuthToken to be cloned, and creates a new AuthToken with the specified name. Invalidates the cache for the user’s ChatBots after cloning.
- Parameters:
request (
HttpRequest) – The HTTP request object containing the parameters for cloning.args – Additional positional arguments (not used).
kwargs –
Additional keyword arguments, including:
authtoken_id (str): The ID of the AuthToken to be cloned.
new_name (str): The new name for the cloned AuthToken.
- Returns:
A JsonResponse containing the serialized data of the newly cloned AuthToken if successful, or an error message if the cloning fails.
- Return type:
- class smarter.lib.drf.views.listview.api.AuthTokenListApiDeleteView(*args, **kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewDelete a authtoken for the authenticated user.
- post(request, *args, **kwargs)[source]
Handle POST requests to delete an existing AuthToken. Validates input parameters, checks for the existence of the AuthToken to be deleted, and deletes the AuthToken if it exists. Invalidates the cache for the user’s ChatBots after deletion.
- Parameters:
request (
HttpRequest) – The HTTP request object containing the parameters for deletion.args – Additional positional arguments (not used).
kwargs –
Additional keyword arguments, including:
authtoken_id (str): The ID of the AuthToken to be deleted.
- Returns:
A JsonResponse indicating the success or failure of the deletion.
- Return type:
- class smarter.lib.drf.views.listview.api.AuthTokenListApiRenameView(*args, **kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewRename a authtoken for the authenticated user.
- post(request, *args, **kwargs)[source]
Handle POST requests to rename an existing AuthToken. Validates input parameters, checks for the existence of the AuthToken to be renamed, and renames the AuthToken if it exists. Invalidates the cache for the user’s ChatBots after renaming.
- Parameters:
request (
HttpRequest) – The HTTP request object containing the parameters for renaming.args – Additional positional arguments (not used).
kwargs –
Additional keyword arguments, including:
authtoken_id (str): The ID of the AuthToken to be renamed.
new_name (str): The new name for the AuthToken.
- Returns:
A JsonResponse indicating the success or failure of the renaming.
- Return type:
- class smarter.lib.drf.views.listview.api.AuthTokenListApiView(*args, **kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewRender the authtoken list view for the Smarter Workbench web console.
This view displays all authtokens available to the authenticated user as cards, providing a quick overview and access to authtoken details.
- Parameters:
- Returns:
Rendered HTML page with a card for each authtoken, or a 404 error page if the user is not authenticated.
- Return type:
HttpResponse