forked from pooranjoyb/cpp-sdk-appwrite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateSms.cpp
More file actions
39 lines (30 loc) · 1.13 KB
/
updateSms.cpp
File metadata and controls
39 lines (30 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "Appwrite.hpp"
#include <chrono>
#include <iostream>
int main() {
std::string projectId = "";
std::string apiKey = "";
Appwrite appwrite(projectId, apiKey);
std::string messageId = "msg001";
std::string content = "Testing SMS message updation.";
std::vector<std::string> topics = {};
std::vector<std::string> users = {};
std::vector<std::string> targets = {};
auto now = std::chrono::system_clock::now();
auto future_time = now + std::chrono::minutes(5);
auto time_t = std::chrono::system_clock::to_time_t(future_time);
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(
future_time.time_since_epoch()) %
1000;
std::string scheduled_at = "";
bool draft = true;
try {
std::string response = appwrite.getMessaging().updateSms(
messageId, topics, users, targets, content, draft, scheduled_at);
std::cout << "SMS Message updated!\nResponse: " << response
<< std::endl;
} catch (const AppwriteException &ex) {
std::cerr << "Exception: " << ex.what() << std::endl;
}
return 0;
}