class LogoutResource(AccountViewMixin, GenericAPIResource): """ API View for logging in to the App""" request_object_cls = LogoutRequestObject usecase_cls = LogoutUseCase decorators = [is_authenticated()] def post(self): """Logout of the application """ return self._process_request(self.usecase_cls, self.request_object_cls, payload={'account': context.account}, no_serialization=True)
class ChangePasswordResource(AccountViewMixin, GenericAPIResource): """ API View for updating the account password """ request_object_cls = ChangeAccountPasswordRequestObject usecase_cls = ChangeAccountPasswordUseCase decorators = [is_authenticated()] def post(self): """Change the password for the account """ payload = {'identifier': context.account.id, 'data': request.payload} return self._process_request(self.usecase_cls, self.request_object_cls, payload=payload, no_serialization=True)
class SomeProtectedView(ShowAPIResource): """ A simple protected class based view """ entity_cls = get_account_entity() serializer_cls = AccountSerializer decorators = [is_authenticated()]
class DeleteAccountResource(AccountViewMixin, DeleteAPIResource): """ API View for deleting an account """ decorators = [is_authenticated()]
class ShowAccountResource(AccountViewMixin, ShowAPIResource): """ API View for showing an account """ decorators = [is_authenticated()]
class ListAccountResource(AccountViewMixin, ListAPIResource): """ API View for list an accounts """ decorators = [is_authenticated()]
class UpdateAccountResource(AccountViewMixin, UpdateAPIResource): """ API View for updating an account """ request_object_cls = UpdateAccountRequestObject usecase_cls = UpdateAccountUseCase decorators = [is_authenticated()]