docstr: Bulk delete annotation layers.
  ---
  delete:
    summary: Bulk delete annotation layers
    parameters:
    - in: path
      schema:
        type: integer
      name: pk
      description: The annotation layer pk for this annotation
    - in: query
      name: q
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/get_delete_ids_schema'
    responses:
      200:
        description: Annotations 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","annotation","layers",".","--","-","delete",":","summary",":","Bulk","delete","annotation","layers","parameters",":","-","in",":","path","schema",":","type",":","integer","name",":","pk","description",":","The","annotation","layer","pk","for","this","annotation","-","in",":","query","name",":","q","content",":","application\/json",":","schema",":","$","ref",":","'","#","\/components\/schemas\/get_delete_ids_schema'","responses",":","200",":","description",":","Annotations","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 annotation layers.
      ---
      delete:
        summary: Bulk delete annotation layers
        parameters:
        - in: path
          schema:
            type: integer
          name: pk
          description: The annotation layer pk for this annotation
        - in: query
          name: q
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get_delete_ids_schema'
        responses:
          200:
            description: Annotations 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:
          DeleteAnnotationCommand(item_ids).run()
          return self.response(
              200,
              message=ngettext(
                  "Deleted %(num)d annotation",
                  "Deleted %(num)d annotations",
                  num=len(item_ids),
              ),
          )
      except AnnotationNotFoundError:
          return self.response_404()
      except AnnotationDeleteFailedError as ex:
          return self.response_422(message=str(ex))
  
imports: import logging
  from typing import Any
  from flask import request, Response
  from flask_appbuilder.api import expose, permission_name, protect, rison, safe
  from flask_appbuilder.api.schemas import get_item_schema, get_list_schema
  from flask_appbuilder.models.sqla.interface import SQLAInterface
  from flask_babel import ngettext
  from marshmallow import ValidationError
  from superset.annotation_layers.annotations.filters import AnnotationAllTextFilter
  from superset.annotation_layers.annotations.schemas import AnnotationPostSchema, AnnotationPutSchema, get_delete_ids_schema, openapi_spec_methods_override
  from superset.commands.annotation_layer.annotation.create import CreateAnnotationCommand
  from superset.commands.annotation_layer.annotation.delete import DeleteAnnotationCommand
  from superset.commands.annotation_layer.annotation.exceptions import AnnotationCreateFailedError, AnnotationDeleteFailedError, AnnotationInvalidError, AnnotationNotFoundError, AnnotationUpdateFailedError
  from superset.commands.annotation_layer.annotation.update import UpdateAnnotationCommand
  from superset.commands.annotation_layer.exceptions import AnnotationLayerNotFoundError
  from superset.constants import MODEL_API_RW_METHOD_PERMISSION_MAP, RouteMethod
  from superset.models.annotations import Annotation
  from superset.views.base_api import BaseSupersetModelRestApi, requires_json, statsd_metrics
label_desc: Use image node_id 7 for calling the AnnotationRestApi obj's underlying member method code with example usage: obj.bulk_delete() and returns: self, self, self