docstr: Delete a report schedule.
  ---
  delete:
    summary: Delete a report schedule
    parameters:
    - in: path
      schema:
        type: integer
      name: pk
      description: The report schedule pk
    responses:
      200:
        description: Item deleted
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
      403:
        $ref: '#/components/responses/403'
      404:
        $ref: '#/components/responses/404'
      422:
        $ref: '#/components/responses/422'
      500:
        $ref: '#/components/responses/500'
docstr_tok: ["Delete","a","report","schedule",".","--","-","delete",":","summary",":","Delete","a","report","schedule","parameters",":","-","in",":","path","schema",":","type",":","integer","name",":","pk","description",":","The","report","schedule","pk","responses",":","200",":","description",":","Item","deleted","content",":","application\/json",":","schema",":","type",":","object","properties",":","message",":","type",":","string","403",":","$","ref",":","'","#","\/components\/responses\/403'","404",":","$","ref",":","'","#","\/components\/responses\/404'","422",":","$","ref",":","'","#","\/components\/responses\/422'","500",":","$","ref",":","'","#","\/components\/responses\/500","'"]
code: def delete(self, pk: int) -> Response:
      """Delete a report schedule.
      ---
      delete:
        summary: Delete a report schedule
        parameters:
        - in: path
          schema:
            type: integer
          name: pk
          description: The report schedule pk
        responses:
          200:
            description: Item deleted
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    message:
                      type: string
          403:
            $ref: '#/components/responses/403'
          404:
            $ref: '#/components/responses/404'
          422:
            $ref: '#/components/responses/422'
          500:
            $ref: '#/components/responses/500'
      """
      try:
          DeleteReportScheduleCommand([pk]).run()
          return self.response(200, message="OK")
      except ReportScheduleNotFoundError:
          return self.response_404()
      except ReportScheduleForbiddenError:
          return self.response_403()
      except ReportScheduleDeleteFailedError as ex:
          logger.error(
              "Error deleting report schedule %s: %s",
              self.__class__.__name__,
              str(ex),
              exc_info=True,
          )
          return self.response_422(message=str(ex))
  
imports: import logging
  from typing import Any, Optional
  from flask import request, Response
  from flask_appbuilder.api import expose, permission_name, protect, rison, safe
  from flask_appbuilder.hooks import before_request
  from flask_appbuilder.models.sqla.interface import SQLAInterface
  from flask_babel import ngettext
  from marshmallow import ValidationError
  from superset import is_feature_enabled
  from superset.charts.filters import ChartFilter
  from superset.commands.report.create import CreateReportScheduleCommand
  from superset.commands.report.delete import DeleteReportScheduleCommand
  from superset.commands.report.exceptions import ReportScheduleCreateFailedError, ReportScheduleDeleteFailedError, ReportScheduleForbiddenError, ReportScheduleInvalidError, ReportScheduleNotFoundError, ReportScheduleUpdateFailedError
  from superset.commands.report.update import UpdateReportScheduleCommand
  from superset.constants import MODEL_API_RW_METHOD_PERMISSION_MAP, RouteMethod
  from superset.dashboards.filters import DashboardAccessFilter
  from superset.databases.filters import DatabaseFilter
  from superset.extensions import event_logger
  from superset.reports.filters import ReportScheduleAllTextFilter, ReportScheduleFilter
  from superset.reports.models import ReportSchedule
  from superset.reports.schemas import get_delete_ids_schema, openapi_spec_methods_override, ReportSchedulePostSchema, ReportSchedulePutSchema
  from superset.views.base_api import BaseSupersetModelRestApi, RelatedFieldFilter, requires_json, statsd_metrics
  from superset.views.filters import BaseFilterRelatedUsers, FilterRelatedOwners
label_desc: Use image node_id 2 for calling the ReportScheduleRestApi obj's underlying member method code with example usage: obj.delete(pk) and returns: self, self, self, self