Skip to content

Email Client should be enhanced for instances specific to it's key #1282

Open
@aimythgit

Description

@aimythgit

Issue Summary

The email client should allow instances of client as opposed to a singleton to facilitate multiple keys
Almost every SaaS provider client has instances and this client too should provide an option while the current simpler one can be used by those who do not have this use case. The whole purpose of a client is for the statefulness else the corresponding stateless REST API can be used directly without the clients.

Code Snippet

const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);

paste code here

const SgMailClient = require('@sendgrid/mailClient');

const client1 = new SgMailClient();
client1.setApiKey(process.env.SENDGRIDClient1_API_KEY);

const client2 = new SgMailClient();
client2.setApiKey(process.env.SENDGRIDClient2_API_KEY);

// logic for using client 1 or client 2 to send mail

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions