Appwrite C++ SDK
Auto-generated API documentation for the Appwrite C++ SDK
Loading...
Searching...
No Matches
Messaging Class Reference

Provides APIs to manage messaging: messages, topics, subscribers. More...

#include <Messaging.hpp>

Collaboration diagram for Messaging:

Public Member Functions

std::string createMessage (const std::string &messageId, const std::string &subject, const std::string &content, const std::vector< std::string > &topics={}, const std::vector< std::string > &targets={})
 Create a new email message.
 
std::string createPush (const std::string &messageId, const std::string &title, const std::string &body, const std::vector< std::string > &topicId={}, const std::vector< std::string > &userId={}, bool draft=false)
 Creates a new push notification message.
 
std::string createSubscribers (const std::string &topicId, const std::string &name, const std::string &targetId, const std::string &subscriberId)
 Add a subscriber to a topic.
 
std::string createTopic (const std::string &topicId, const std::string &name, const std::vector< std::string > &subscribe)
 Create a new topic.
 
std::string deleteMessages (const std::string &messageId)
 Delete a message by its ID.
 
std::string deleteSubscribers (const std::string &topicId, const std::string &subscriberId)
 Delete a subscriber from a topic.
 
std::string deleteTopic (const std::string &topicId)
 Delete a topic by its ID.
 
std::string getMessages (const std::string &messageId)
 Get a specific message by ID.
 
std::string getSubscriber (const std::string &topicId, const std::string &subscriberId)
 Get details of a subscriber to a topic.
 
std::string getTopic (const std::string &topicId)
 Get details of a topic by ID.
 
std::string listMessageLogs (const std::string &messageId, Queries &queries)
 List all message logs with optional filters.
 
std::string listMessages (Queries &queries)
 List all messages with optional filters.
 
std::string listSubscribers (const std::string &topicId, Queries &queries)
 List all subscribers of a topic.
 
std::string listTargets (const std::string &messageId, const std::vector< std::string > &queries={})
 List all targets for a given message.
 
std::string listTopics (Queries &queries)
 List all topics with optional filters.
 
 Messaging (const std::string &projectId, const std::string &apiKey)
 Constructor for Messaging service.
 
std::string updatePush (const std::string &messageId, const std::string &title, const std::string &body, const std::vector< std::string > &topicId={}, const std::vector< std::string > &userId={})
 Updates an existing push notification message.
 
std::string updateTopic (const std::string &topicId, const std::string &name, const std::vector< std::string > &subscribe={})
 Update an existing topic.
 

Detailed Description

Provides APIs to manage messaging: messages, topics, subscribers.

Definition at line 17 of file Messaging.hpp.

Constructor & Destructor Documentation

◆ Messaging()

Messaging::Messaging ( const std::string &  projectId,
const std::string &  apiKey 
)

Constructor for Messaging service.

Parameters
projectIdAppwrite project ID
apiKeyAppwrite API key

Member Function Documentation

◆ createMessage()

std::string Messaging::createMessage ( const std::string &  messageId,
const std::string &  subject,
const std::string &  content,
const std::vector< std::string > &  topics = {},
const std::vector< std::string > &  targets = {} 
)

Create a new email message.

Sends a new email message to specific topics and/or target recipients. At least one of topics or targets must be provided.

Parameters
messageIdUnique ID for the message.
subjectSubject line of the email.
contentBody content of the email.
topicsList of topic IDs to send the message to (optional).
targetsList of target recipients (e.g., email:userId) (optional).
Returns
JSON response.

◆ createPush()

std::string Messaging::createPush ( const std::string &  messageId,
const std::string &  title,
const std::string &  body,
const std::vector< std::string > &  topicId = {},
const std::vector< std::string > &  userId = {},
bool  draft = false 
)

Creates a new push notification message.

Sends a push notification to specified users, topics, or both.

Parameters
messageIdA unique Id for the message.
titleTitle of the push notification.
bodyBody content of the push notification.
topicIdA list of topic IDs to which the notification should be sent.
userIdA list of user IDs to which the notification should be sent.
draftIf true, saves the message as a draft.
Returns
JSON response.

◆ createSubscribers()

std::string Messaging::createSubscribers ( const std::string &  topicId,
const std::string &  name,
const std::string &  targetId,
const std::string &  subscriberId 
)

Add a subscriber to a topic.

Parameters
topicIdID of the topic
nameName of the subscriber
targetIdTarget platform/device
subscriberIdUnique ID for the subscriber
Returns
JSON response

◆ createTopic()

std::string Messaging::createTopic ( const std::string &  topicId,
const std::string &  name,
const std::vector< std::string > &  subscribe 
)

Create a new topic.

Parameters
topicIdUnique topic ID
nameName of the topic
subscribeList of subscriber IDs
Returns
JSON response

◆ deleteMessages()

std::string Messaging::deleteMessages ( const std::string &  messageId)

Delete a message by its ID.

Parameters
messageIdID of the message.
Returns
JSON response.

◆ deleteSubscribers()

std::string Messaging::deleteSubscribers ( const std::string &  topicId,
const std::string &  subscriberId 
)

Delete a subscriber from a topic.

Parameters
topicIdID of the topic
subscriberIdID of the subscriber to remove
Returns
JSON response

◆ deleteTopic()

std::string Messaging::deleteTopic ( const std::string &  topicId)

Delete a topic by its ID.

Parameters
topicIdID of the topic
Returns
JSON response

◆ getMessages()

std::string Messaging::getMessages ( const std::string &  messageId)

Get a specific message by ID.

Parameters
messageIdID of the message
Returns
JSON string of the message details

◆ getSubscriber()

std::string Messaging::getSubscriber ( const std::string &  topicId,
const std::string &  subscriberId 
)

Get details of a subscriber to a topic.

Parameters
topicIdID of the topic
subscriberIdID of the subscriber
Returns
JSON string of the subscriber

◆ getTopic()

std::string Messaging::getTopic ( const std::string &  topicId)

Get details of a topic by ID.

Parameters
topicIdID of the topic
Returns
JSON string of the topic

◆ listMessageLogs()

std::string Messaging::listMessageLogs ( const std::string &  messageId,
Queries queries 
)

List all message logs with optional filters.

Parameters
messageIdID of the message
queriesQuery parameters for filtering
Returns
JSON string of messageLog list

◆ listMessages()

std::string Messaging::listMessages ( Queries queries)

List all messages with optional filters.

Parameters
queriesQuery parameters for filtering results
Returns
JSON string of message list

◆ listSubscribers()

std::string Messaging::listSubscribers ( const std::string &  topicId,
Queries queries 
)

List all subscribers of a topic.

Parameters
topicIdID of the topic
queriesOptional query filters
Returns
JSON string of subscriber list

◆ listTargets()

std::string Messaging::listTargets ( const std::string &  messageId,
const std::vector< std::string > &  queries = {} 
)

List all targets for a given message.

Parameters
messageIdID of the message.
queriesOptional query filters.
Returns
JSON response.

◆ listTopics()

std::string Messaging::listTopics ( Queries queries)

List all topics with optional filters.

Parameters
queriesQuery parameters for filtering
Returns
JSON string of topic list

◆ updatePush()

std::string Messaging::updatePush ( const std::string &  messageId,
const std::string &  title,
const std::string &  body,
const std::vector< std::string > &  topicId = {},
const std::vector< std::string > &  userId = {} 
)

Updates an existing push notification message.

Modifies the title and body of an existing push message.

Parameters
messageIdThe ID of the message to update.
titleNew title of the push notification.
bodyNew body content of the push notification.
topicIdList of topic IDs to update the message.
userIdList of user IDs to update the message.
Returns
JSON response

◆ updateTopic()

std::string Messaging::updateTopic ( const std::string &  topicId,
const std::string &  name,
const std::vector< std::string > &  subscribe = {} 
)

Update an existing topic.

Parameters
topicIdID of the topic to update
nameNew name for the topic
subscribeUpdated list of subscribers (optional)
Returns
JSON response

The documentation for this class was generated from the following file: