from typing import List, Dict, Any
from charts_push_messages.client.user_data_api import UserDataClient
from charts_push_messages.constants import PostServiceMessagesListInclude
def get_feed_messages_data(message_ids: List[int]) -> List[Dict[str, Any]]:
"""Get Feed Message(es) with included and fields from User-Data API
by list of Feed Message Created id(s)
Args:
message_ids: List of Feed Message Created id(s)
Returns:
List of Feed Messages
"""
client = UserDataClient()
include = [
PostServiceMessagesListInclude.DATA.value,
PostServiceMessagesListInclude.META.value,
PostServiceMessagesListInclude.ALL.value
]
response = client.get_feed_messages(feed_messages=message_ids, include=include)
return response.get("data", [])
def post_push_messages(push_messages: List[Dict[str, Any]]) -> Dict[str, List[Dict[str, Any]]]:
"""Post created Push Messages to User Data Api
Args:
push_messages: List of created Push Messages
Returns:
Dictionary with every message status whether it was success or failure
"""
client = UserDataClient()
return client.post_push_messages(push_messages=push_messages)