@message_router.get("/{channel_url}", summary="列出message")
async def get_message(channel_url: str):
configuration = get_configuration()
# Enter a context with an instance of the API client
with sendbird_platform_sdk.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = message_api.MessageApi(api_client)
# api_instance = sendbird_config.message_api
channel_type = "GROUP" # str |
# example passing only required values which don't have defaults set
try:
# List messages
api_response = api_instance.list_messages(channel_type=channel_type, channel_url=channel_url,
api_token=get_api_token())
return {"data": api_response.data}
except sendbird_platform_sdk.ApiException as e:
print("Exception when calling MessageApi->list_messages: %s\n" % e)
return {
"error": {
"status_code": e.status,
"message": e.body,
}
}
return
Exception when calling MessageApi->list_messages: Status Code: 400
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'content-type': 'application/json', 'request-id': 'e0bcc41c-979a-4f52-b954-80dff1f8f1e8', 'x-frame-options': 'SAMEORIGIN', 'content-length': '59', 'x-ratelimit-limit': '60;w=1', 'x-ratelimit-remaining': '59', 'x-ratelimit-reset': '0.016666650772095', 'x-ratelimit-retryafter': '0.0', 'x-envoy-upstream-service-time': '11', 'date': 'Sun, 26 Jan 2025 18:23:22 GMT', 'server': 'istio-envoy', 'strict-transport-security': 'max-age=31536000; includeSubDomains'})
HTTP response body: {"error":true,"message":"Platform API Error","code":400404}