Skip to content

Commit affd0cc

Browse files
authored
Merge pull request #32 from pooranjoyb/sristy17-patch-1
Refactoring Health Class
2 parents 717f596 + e79b4c6 commit affd0cc

23 files changed

+48
-121
lines changed

examples/health/getAntivirus.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
int main() {
55
std::string projectId = "66fbb5a100070a3a1d19";
66
std::string apiKey = "";
7-
8-
Appwrite appwrite(projectId);
9-
Health& health = appwrite.getHealth();
10-
11-
health.setup(apiKey, projectId);
12-
7+
Appwrite appwrite(projectId, apiKey);
8+
139
try {
14-
std::string response = health.getAntivirus();
10+
std::string response = appwrite.getHealth().getAntivirus();
1511
std::cout << "Health Check Done! \nResponse: " << response << std::endl;
1612
} catch (const AppwriteException& ex) {
1713
std::cerr << "Exception: " << ex.what() << std::endl;

examples/health/getCache.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
int main() {
55
std::string projectId = "66fbb5a100070a3a1d19";
66
std::string apiKey = "";
7-
8-
Appwrite appwrite(projectId);
9-
Health& health = appwrite.getHealth();
7+
Appwrite appwrite(projectId, apiKey);
108

11-
health.setup(apiKey, projectId);
12-
139
try {
14-
std::string response = health.getCache();
10+
std::string response = appwrite.getHealth().getCache();
1511
std::cout << "Health Check Done! \nResponse: " << response << std::endl;
1612
} catch (const AppwriteException& ex) {
1713
std::cerr << "Exception: " << ex.what() << std::endl;

examples/health/getDB.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
int main() {
55
std::string projectId = "66fbb5a100070a3a1d19";
66
std::string apiKey = "";
7-
8-
Appwrite appwrite(projectId);
9-
Health& health = appwrite.getHealth();
7+
Appwrite appwrite(projectId, apiKey);
108

11-
health.setup(apiKey, projectId);
12-
139
try {
14-
std::string response = health.getDB();
10+
std::string response = appwrite.getHealth().getDB();
1511
std::cout << "Health Check Done! \nResponse: " << response << std::endl;
1612
} catch (const AppwriteException& ex) {
1713
std::cerr << "Exception: " << ex.what() << std::endl;

examples/health/getHealth.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
int main() {
55
std::string projectId = "66fbb5a100070a3a1d19";
66
std::string apiKey = "";
7-
8-
Appwrite appwrite(projectId);
9-
Health& health = appwrite.getHealth();
7+
Appwrite appwrite(projectId, apiKey);
108

11-
health.setup(apiKey, projectId);
12-
139
try {
14-
std::string response = health.getHealth();
10+
std::string response = appwrite.getHealth().getHealthStatus();
1511
std::cout << "Health Check Done! \nResponse: " << response << std::endl;
1612
} catch (const AppwriteException& ex) {
1713
std::cerr << "Exception: " << ex.what() << std::endl;

examples/health/getPubSub.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
int main() {
55
std::string projectId = "66fbb5a100070a3a1d19";
66
std::string apiKey = "";
7-
8-
Appwrite appwrite(projectId);
9-
Health& health = appwrite.getHealth();
7+
Appwrite appwrite(projectId, apiKey);
108

11-
health.setup(apiKey, projectId);
12-
139
try {
14-
std::string response = health.getPubSub();
10+
std::string response = appwrite.getHealth().getPubSub();
1511
std::cout << "Health Check Done! \nResponse: " << response << std::endl;
1612
} catch (const AppwriteException& ex) {
1713
std::cerr << "Exception: " << ex.what() << std::endl;

examples/health/getQueue.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
int main() {
55
std::string projectId = "66fbb5a100070a3a1d19";
66
std::string apiKey = "";
7-
8-
Appwrite appwrite(projectId);
9-
Health& health = appwrite.getHealth();
7+
Appwrite appwrite(projectId, apiKey);
108

11-
health.setup(apiKey, projectId);
12-
139
try {
14-
std::string response = health.getQueue();
10+
std::string response = appwrite.getHealth().getQueue();
1511
std::cout << "Health Check Done! \nResponse: " << response << std::endl;
1612
} catch (const AppwriteException& ex) {
1713
std::cerr << "Exception: " << ex.what() << std::endl;

examples/health/getStorage.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
int main() {
55
std::string projectId = "66fbb5a100070a3a1d19";
66
std::string apiKey = "";
7-
8-
Appwrite appwrite(projectId);
9-
Health& health = appwrite.getHealth();
7+
Appwrite appwrite(projectId, apiKey);
108

11-
health.setup(apiKey, projectId);
12-
139
try {
14-
std::string response = health.getStorage();
10+
std::string response = appwrite.getHealth().getStorage();
1511
std::cout << "Health Check Done! \nResponse: " << response << std::endl;
1612
} catch (const AppwriteException& ex) {
1713
std::cerr << "Exception: " << ex.what() << std::endl;

examples/health/getStorageLocal.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44
int main() {
55
std::string projectId = "66fbb5a100070a3a1d19";
66
std::string apiKey = "";
7-
8-
Appwrite appwrite(projectId);
9-
Health& health = appwrite.getHealth();
7+
Appwrite appwrite(projectId, apiKey);
108

11-
health.setup(apiKey, projectId);
12-
139
try {
14-
std::string response = health.getStorageLocal();
10+
std::string response = appwrite.getHealth().getStorageLocal();
1511
std::cout << "Health Check Done! \nResponse: " << response << std::endl;
1612
} catch (const AppwriteException& ex) {
1713
std::cerr << "Exception: " << ex.what() << std::endl;

examples/health/getTime.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,10 @@
33

44
int main() {
55
std::string projectId = "66fbb5a100070a3a1d19";
6-
std::string apiKey = "";
7-
86
Appwrite appwrite(projectId);
9-
Health& health = appwrite.getHealth();
10-
11-
health.setup(apiKey, projectId);
12-
7+
138
try {
14-
std::string response = health.getTime();
9+
std::string response = appwrite.getHealth().getTime();
1510
std::cout << "Health Check Done! \nResponse: " << response << std::endl;
1611
} catch (const AppwriteException& ex) {
1712
std::cerr << "Exception: " << ex.what() << std::endl;

examples/health/params/getCertificate.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@
33

44
int main() {
55
std::string projectId = "66fbb5a100070a3a1d19";
6-
std::string apiKey = "";
76
std::string domain = "pooranjoyb.tech";
8-
9-
Appwrite appwrite(projectId);
10-
Health& health = appwrite.getHealth();
11-
12-
health.setup(apiKey, projectId);
7+
std::string apiKey = "";
8+
Appwrite appwrite(projectId, apiKey);
139

1410
try {
15-
std::string response = health.getCertificate(domain);
11+
std::string response = appwrite.getHealth().getCertificate(domain);
1612
std::cout << "Health Check Done! \nResponse: " << response << std::endl;
1713
} catch (const AppwriteException& ex) {
1814
std::cerr << "Exception: " << ex.what() << std::endl;

0 commit comments

Comments
 (0)