eschutho commented on code in PR #29264:
URL: https://github.com/apache/superset/pull/29264#discussion_r1681575906
##########
superset/reports/api.py:
##########
@@ -513,3 +517,68 @@ def bulk_delete(self, **kwargs: Any) -> Response:
return self.response_403()
except ReportScheduleDeleteFailedError as ex:
return self.response_422(message=str(ex))
+
+ @expose("/slack_channels/", methods=("GET",))
+ @protect()
+ @rison(get_slack_channels_schema)
+ @safe
+ @statsd_metrics
+ @event_logger.log_this_with_context(
+ action=lambda self,
+ *args,
+ **kwargs: f"{self.__class__.__name__}.slack_channels",
+ log_to_statsd=False,
+ )
+ def slack_channels(self, **kwargs: Any) -> Response:
+ """Get slack channels.
+ ---
+ get:
+ summary: Get slack channels
+ description: Get slack channels
+ parameters:
+ - in: query
+ name: q
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/get_slack_channels_schema'
+ responses:
+ 200:
+ description: Slack channels
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ result:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ 401:
+ $ref: '#/components/responses/401'
+ 403:
+ $ref: '#/components/responses/403'
+ 404:
+ $ref: '#/components/responses/404'
+ 422:
+ $ref: '#/components/responses/422'
+ 500:
+ $ref: '#/components/responses/500'
+ """
+ try:
+ params = kwargs.get("rison", {})
+ search_string = params.get("search_string")
+ types = params.get("types", [])
+ exact_match = params.get("exact_match", False)
+ channels = get_channels_with_search(
+ search_string=search_string, types=types,
exact_match=exact_match
+ )
+ return self.response(200, result=channels)
+ except SupersetException as ex:
+ logger.error("Error fetching slack channels %s", str(ex))
+ return self.response_422(message=str(ex))
Review Comment:
Yes, because it gives information about how to fix the slack issue. Whether
it's missing a scope or the channel doesn't exist. Otherwise, it's difficult to
know how to unblock the error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]