-
Notifications
You must be signed in to change notification settings - Fork 21
feat: updateEmail #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
feat: updateEmail #101
Conversation
Can you rename the method to updateEmailMessage or can please check the existing naming convention for this api in python/js sdk ? |
Snapshots are provided above |
In python SDK the function is defined as update_email, In Javascript SDK it is defined as update-email |
Yes so we'll have to maintain the convention, rename it as it is. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makefile
Outdated
@@ -249,7 +249,9 @@ listMessages: $(SRCS) $(EXAMPLES_DIR)/messaging/messages/listMessages.cpp | |||
getMessages: $(SRCS) $(EXAMPLES_DIR)/messaging/messages/getMessages.cpp | |||
@mkdir -p ./$(TESTS_DIR) | |||
$(CXX) $(CXXFLAGS) -o ./$(TESTS_DIR)/getMessages $(SRCS) $(EXAMPLES_DIR)/messaging/messages/getMessages.cpp $(LDFLAGS) | |||
|
|||
updateMessage: $(SRCS) $(EXAMPLES_DIR)/messaging/messages/updateEmail.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename it to updateEmail
Please resolve the conflicts :// |
Update? @aritracodes-69 |
Will get it done by Tommorow |
update? |
Doing it now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sristy17 we cant update the messages that have been failed, only drafted messages can be twiked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Feature: Add updateMessage API to Messaging Module
β Summary
This PR introduces the updateMessage method in the Messaging class, allowing users to update an existing email message using Appwrite's Messaging API. It aligns with the structure of other official Appwrite SDKs and provides full parameter validation, error handling, and testing via an example.
π Description
β¨ Public Method Added in Messaging.hpp
cpp
Copy
Edit
/**
*/
std::string updateMessage(
const std::string& messageId,
const std::string& subject,
const std::string& content
);
π§ Implementation in Messaging.cpp
Validates parameters (messageId, subject, content)
Constructs the JSON payload manually
Makes a PATCH request to the endpoint:
swift
Copy
Edit
/messaging/messages/email/{messageId}
Handles response and throws exception with details if request fails
π‘ Example Added
examples/messaging/messages/updateMessage.cpp
Demonstrates:
Creating an Appwrite instance
Calling updateMessage(...) with real inputs
Proper error catching and output
π οΈ Makefile Updated
Added target to build and run updateMessage.cpp:
bash
Copy
Edit
make updateMessage
make run-updateMessage
π§ͺ Tested With
β Valid messageId (success)
β Windows/Linux curl compatibility
β Handles failure if message is already delivered/failed (per Appwrite docs)
π Reference
Appwrite Messaging API Docs