-
Notifications
You must be signed in to change notification settings - Fork 65
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
Re-Design the gmail connector APIs #4928
Comments
During the initial design process, I found out that gmail REST API includes users in the resource path,
This is a special case as the userId is constant for an authenticated user. For instance, If a user However this approach is not yet supported by our openapi to ballerina tool as tracked in #5056. If we were to follow this approach, we have to write the client by hand, which will lead to high maintenance. After this discussion offline, we have decided to keep the |
I have noticed visible drop in usability in generated clients. For instance looking at a common scenario of processing mail details, v3.5.0 gmail:MessageRequest message = {
recipient: recipient, // Recipient's email address
sender: sender, // Sender's email address
subject: "Gmail Connector Revamp",
messageBody: "Test sending mails!!!! ",
contentType: "text/plain"
};
gmail:Message _ = check gmailClient->sendMessage(message); Full Code - https://gist.github.com/niveathika/adde8c1304d3e3ed31a4f253fb2b3cb2 v4.0.0 (Generated from OAS) string rawMessage = string
`To:${message.recipient}
Subject:${message.subject}
From:${message.sender ?: "me"}
Content-Type:text/plain;charset="UTF-8"
${message.messageBody}`;
string encodedMessage = array:toBase64(rawMessage.toBytes());
encodedMessage = re `\+`.replaceAll(encodedMessage, "-");
encodedMessage = re `/`.replaceAll(encodedMessage, "_");
gmail:Message _ = check gmailClient->sendMessage("me", {raw: encodedMessage}); Full Code - https://gist.github.com/niveathika/b65e40744ca3354e7b651c7e9fda3bdc As you can see from the above code, users need to know how to create a message(mail) in RFC822 format before invoking the API. This is a common problem seen across multiple APIs. |
POC to solve the usability drop is tracked in #5103 |
As per the PoC, we can go ahead with wrapper client to the OAS generated client. |
The design document can be found in https://docs.google.com/document/d/1AP8TbXXwrKSsruvllGDiCmt5zndmCzEukxwtM6DKCh4/edit#heading=h.qeyhtzaqlx4s |
Closing as the design is accepted and we will move to implementation |
Currently the connector supports remote method.
In this redesign we have to look into designing the connector with resource method. There are many advantages to this,
The text was updated successfully, but these errors were encountered: