Skip to content

Commit d050684

Browse files
authored
Update README.md
readme:update
1 parent 2f20162 commit d050684

File tree

1 file changed

+75
-7
lines changed

1 file changed

+75
-7
lines changed

README.md

Lines changed: 75 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,86 @@
11
# Appwrite C++ SDK
22

3+
![C++](https://img.shields.io/badge/c++-%2300599C.svg?style=flat-square&logo=c%2B%2B&logoColor=white)
4+
![Appwrite](https://img.shields.io/badge/Appwrite-%23FD366E.svg?style=flat-square&logo=appwrite&logoColor=white)
5+
![GitHub License](https://img.shields.io/github/license/pooranjoyb/cpp-sdk-appwrite)
6+
![Version](https://img.shields.io/badge/api%20version-0.0.1-blue.svg?style=flat-square)
7+
38
![banner-appwrite](https://github.com/user-attachments/assets/63e7dbad-6a49-4b80-bee2-8e0a46601eec)
49

510
## Overview
611

7-
This C++ SDK is built from scratch as a prototype for interacting with Appwrite's backend services. It allows users to perform a limited set of functionalities, including the creation of databases, collections, and documents, while also enabling the retrieval of usage statistics and management of storage and account health.
12+
This **C++ SDK** is built from scratch as a **prototype** for interacting with Appwrite's backend services.
13+
- It allows users to perform a limited set of functionalities as of now,
14+
- including the **creation of databases, collections, and documents**,
15+
- while also enabling the **retrieval of usage statistics** and
16+
- management of **storage** and **account health**.
817

9-
## Features
18+
**This SDK is compatible with Appwrite server version 1.6.x.**
1019

11-
The SDK offers essential features for database management, including the ability to create databases with authentication checks. Users can create collections within these databases and define various attributes for each collection. Additionally, the SDK supports the creation of document indexes, which facilitate efficient querying. Users can retrieve usage statistics for both databases and collections, enabling them to monitor performance and resource utilization. Moreover, the SDK includes functionalities for managing storage classes and checking the health status of the application, along with basic account management capabilities.
20+
![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png)
1221

13-
For a more detailed view of the implementation, please check out the example directory. [Example](/examples/)
1422

15-
## License
23+
## Getting Started
24+
25+
### Make Your First Request
26+
27+
Set the neccessary header files.
28+
```cpp
29+
#include "Appwrite.hpp"
30+
```
31+
Once your SDK header is set, create the Appwrite service objects and choose the request to send.
32+
```cpp
33+
std::string projectId = "<your-project-id>";
34+
std::string apiKey = "<your-api-key>";
35+
36+
Appwrite appwrite(projectId);
37+
38+
// for the Databases instance
39+
Databases& databases = appwrite.getDatabases();
40+
databases.setup(apiKey, projectId);
41+
```
42+
43+
### Full Example
44+
```cpp
45+
#include "Appwrite.hpp"
46+
#include <iostream>
47+
48+
int main() {
49+
std::string projectId = "<your-project-id>";
50+
std::string apiKey = "<your-api-key>";
51+
std::string databaseId = "<unique-database-id>";
52+
std::string name = "<unique-database-name>";
53+
bool enabled = true;
54+
55+
Appwrite appwrite(projectId);
56+
Databases& databases = appwrite.getDatabases();
57+
58+
databases.setup(apiKey, projectId);
59+
std::string response = databases.create(databaseId, name, enabled);
1660
17-
This project is licensed under the MIT License, and further details can be found in the LICENSE file.
18-
[MIT LICENSE](LICENSE)
61+
return 0;
62+
}
63+
64+
```
65+
### Error Handling
66+
67+
The Appwrite C++ SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.
68+
69+
```cpp
70+
try {
71+
// Send some request here
72+
} catch (const AppwriteException& ex) {
73+
std::cerr << "Exception: " << ex.what() << std::endl;
74+
}
75+
```
76+
77+
For a more detailed view of the implementations, please check out the example directory. [Example](/examples/)
78+
79+
### Learn more
80+
You can use the following resources to learn more and get help
81+
- 🚀 [Getting Started Tutorial](youtube-link)
82+
- 📜 [C++ SDK Docs](/docs)
83+
84+
85+
## License
86+
This project is licensed under the MIT License, and further details can be found in the [LICENSE](LICENSE) file.

0 commit comments

Comments
 (0)