@@ -530,6 +530,20 @@ std::string Messaging::updatePush(const std::string &messageId,
530530 }
531531}
532532
533+ std::string Messaging::listProviders (Queries &queries) {
534+ std::string url = Config::API_BASE_URL + " /messaging/providers" ;
535+ std::vector<std::string> headers = Config::getHeaders (projectId);
536+ headers.push_back (" X-Appwrite-Key: " + apiKey);
537+ std::string response;
538+ int statusCode = Utils::getRequest (url, headers, response);
539+ if (statusCode == HttpStatus::OK ) {
540+ return response;
541+ } else {
542+ throw AppwriteException (" Error listing providers . Status code: " +
543+ std::to_string (statusCode) +
544+ " \n Response: " + response);
545+ }
546+ }
533547
534548std::string Messaging::listMessageLogs (const std::string &messageId,
535549 Queries &queries) {
@@ -566,6 +580,7 @@ std::string Messaging::deleteMessages(const std::string &messageId) {
566580 " \n Response: " + response);
567581 }
568582}
583+
569584 std::string Messaging::updateEmail (
570585 const std::string& messageId,
571586 const std::string& subject,
@@ -593,10 +608,40 @@ std::string Messaging::deleteMessages(const std::string &messageId) {
593608 std::string response;
594609 int statusCode = Utils::patchRequest (url, payload, headers, response);
595610
611+ std::string Messaging::listTargets (const std::string &messageId,
612+ const std::vector<std::string> &queries) {
613+ if (messageId.empty ()) {
614+ throw AppwriteException (" Missing required parameter: 'messageId'" );
615+ }
616+
617+ std::string url = Config::API_BASE_URL + " /messaging/messages/" + messageId + " /targets" ;
618+ std::string queryParam = " " ;
619+ if (!queries.empty ()) {
620+ queryParam += " ?queries[]=" + Utils::urlEncode (queries[0 ]);
621+ for (size_t i = 1 ; i < queries.size (); ++i) {
622+ queryParam += " &queries[]=" + Utils::urlEncode (queries[i]);
623+ }
624+ }
625+
626+ url += queryParam;
627+
628+ std::vector<std::string> headers = Config::getHeaders (projectId);
629+ headers.push_back (" X-Appwrite-Key: " + apiKey);
630+
631+ std::string response;
632+ int statusCode = Utils::getRequest (url, headers, response);
633+
634+
596635 if (statusCode == HttpStatus::OK ) {
597636 return response;
598637 } else {
599638 throw AppwriteException (" Error updating message. Status code: " + std::to_string (statusCode) +
600639 " \n\n Response: " + response);
601640 }
602641}
642+ throw AppwriteException (
643+ " Error fetching message targets. Status code: " + std::to_string (statusCode) +
644+ " \n\n Response: " + response);
645+ }
646+ }
647+
0 commit comments