-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afdc3e7
commit beae4f9
Showing
8 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "Appwrite.hpp" | ||
#include <iostream> | ||
|
||
int main() { | ||
std::string projectId = "66fbb5a100070a3a1d19"; | ||
std::string apiKey = ""; | ||
|
||
Appwrite appwrite(projectId); | ||
Databases& database = appwrite.getDatabases(); | ||
|
||
std::string databaseId = "database123"; | ||
std::string collectionId = "test1234"; | ||
std::string key = "index_from_cpp"; | ||
|
||
// we need to use type as "key" for arrayed attributes | ||
std::string type = "key"; | ||
std::vector<std::string> attributes = {"new_enum_attribute"}; | ||
|
||
database.setup(apiKey, projectId); | ||
|
||
try { | ||
std::string response = database.createIndex( | ||
databaseId, collectionId,key, type, attributes | ||
); | ||
std::cout << "Index created successfully! \nResponse: " << response << std::endl; | ||
} catch (const AppwriteException& ex) { | ||
std::cerr << "Exception: " << ex.what() << std::endl; | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "Appwrite.hpp" | ||
#include <iostream> | ||
|
||
int main() { | ||
std::string projectId = "66fbb5a100070a3a1d19"; | ||
std::string apiKey = ""; | ||
std::string databaseId = "database123"; | ||
std::string collectionId = "test1234"; | ||
|
||
Appwrite appwrite(projectId); | ||
Databases& databases = appwrite.getDatabases(); | ||
|
||
databases.setup(apiKey, projectId); | ||
|
||
try { | ||
std::string response = databases.listIndexes(databaseId, collectionId); | ||
std::cout << "Indexes listed successfully! \nResponse: " << response << std::endl; | ||
} catch (const AppwriteException& ex) { | ||
std::cerr << "Exception: " << ex.what() << std::endl; | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.