docstr: Bulk delete saved queries.
  ---
  delete:
    summary: Bulk delete saved queries
    parameters:
    - in: query
      name: q
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/get_delete_ids_schema'
    responses:
      200:
        description: Saved queries bulk delete
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
      401:
        $ref: '#/components/responses/401'
      404:
        $ref: '#/components/responses/404'
      422:
        $ref: '#/components/responses/422'
      500:
        $ref: '#/components/responses/500'
docstr_tok: ["Bulk","delete","saved","queries",".","--","-","delete",":","summary",":","Bulk","delete","saved","queries","parameters",":","-","in",":","query","name",":","q","content",":","application\/json",":","schema",":","$","ref",":","'","#","\/components\/schemas\/get_delete_ids_schema'","responses",":","200",":","description",":","Saved","queries","bulk","delete","content",":","application\/json",":","schema",":","type",":","object","properties",":","message",":","type",":","string","401",":","$","ref",":","'","#","\/components\/responses\/401'","404",":","$","ref",":","'","#","\/components\/responses\/404'","422",":","$","ref",":","'","#","\/components\/responses\/422'","500",":","$","ref",":","'","#","\/components\/responses\/500","'"]
code: def bulk_delete(self, **kwargs: Any) -> Response:
      """Bulk delete saved queries.
      ---
      delete:
        summary: Bulk delete saved queries
        parameters:
        - in: query
          name: q
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get_delete_ids_schema'
        responses:
          200:
            description: Saved queries bulk delete
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    message:
                      type: string
          401:
            $ref: '#/components/responses/401'
          404:
            $ref: '#/components/responses/404'
          422:
            $ref: '#/components/responses/422'
          500:
            $ref: '#/components/responses/500'
      """
      item_ids = kwargs["rison"]
      try:
          DeleteSavedQueryCommand(item_ids).run()
          return self.response(
              200,
              message=ngettext(
                  "Deleted %(num)d saved query",
                  "Deleted %(num)d saved queries",
                  num=len(item_ids),
              ),
          )
      except SavedQueryNotFoundError:
          return self.response_404()
      except SavedQueryDeleteFailedError as ex:
          return self.response_422(message=str(ex))
  
imports: import json
  import logging
  from datetime import datetime
  from io import BytesIO
  from typing import Any
  from zipfile import is_zipfile, ZipFile
  from flask import g, request, Response, send_file
  from flask_appbuilder.api import expose, protect, rison, safe
  from flask_appbuilder.models.sqla.interface import SQLAInterface
  from flask_babel import ngettext
  from superset import is_feature_enabled
  from superset.commands.importers.exceptions import IncorrectFormatError, NoValidFilesFoundError
  from superset.commands.importers.v1.utils import get_contents_from_bundle
  from superset.commands.query.delete import DeleteSavedQueryCommand
  from superset.commands.query.exceptions import SavedQueryDeleteFailedError, SavedQueryNotFoundError
  from superset.commands.query.export import ExportSavedQueriesCommand
  from superset.commands.query.importers.dispatcher import ImportSavedQueriesCommand
  from superset.constants import MODEL_API_RW_METHOD_PERMISSION_MAP, RouteMethod
  from superset.databases.filters import DatabaseFilter
  from superset.extensions import event_logger
  from superset.models.sql_lab import SavedQuery
  from superset.queries.saved_queries.filters import SavedQueryAllTextFilter, SavedQueryFavoriteFilter, SavedQueryFilter, SavedQueryTagFilter
  from superset.queries.saved_queries.schemas import get_delete_ids_schema, get_export_ids_schema, openapi_spec_methods_override
  from superset.views.base_api import BaseSupersetModelRestApi, requires_form_data, statsd_metrics
label_desc: Use image node_id 3 for calling the SavedQueryRestApi obj's underlying member method code with example usage: obj.bulk_delete() and returns: self, self, self