Git Product home page Git Product logo

Comments (6)

0sc avatar 0sc commented on August 23, 2024 1

This is much more helpful. Thank you for providing more details

from sendgrid-go.

0sc avatar 0sc commented on August 23, 2024

What's the status of this issue? I'll like to work on it if it's still open.

from sendgrid-go.

thinkingserious avatar thinkingserious commented on August 23, 2024

@andela-ooranagwa,

This issue is still available. My comments on a similar issue in our Java library may be helpful: sendgrid/sendgrid-java#150

Also, we will need a signed CLA in order to merge your work. Please sign that for us here: https://github.com/sendgrid/sendgrid-go/blob/master/CONTRIBUTING.md#cla

Thank you!

With Best Regards,

Elmer

from sendgrid-go.

0sc avatar 0sc commented on August 23, 2024

@thinkingserious

I will appreciate if can you provide some more details? Similar to what was pointed out in the Java library, sendgrid-go already has a NewEmail that is used to compose and send email to a single recipient.
Your comment implies that this issue is merely a refactor, if so what implementation behavior do you desire? A single object that bundles and encapsulates both setting up and send the email or rewrite of the existing method?

More details about A email object that represents the response body payload could help

from sendgrid-go.

thinkingserious avatar thinkingserious commented on August 23, 2024

Hello @andela-ooranagwa,

Thanks for reaching out!

I'm thinking that the end result would be something like:

package main

import (
    "fmt"
    "github.com/sendgrid/sendgrid-go"
    "github.com/sendgrid/sendgrid-go/helpers/mail"
    "log"
    "os"
)

func main() {
    client := sendgrid.NewClient(os.Getenv("SENDGRID_API_KEY")) // This lives in sendgrid-go
    email := sendgrid.NewEmail() // Or you could pass the following directly into the contructor
    email.SetFrom("Example User", "[email protected]")
    email.SetSubject("Hello World from the SendGrid Go Library")
    email.AddTo("Example User", "[email protected]")
    email.AddContent("text/plain", "some text here")
    response, err := client.Send(email)
    if err != nil {
      log.Println(err)
    }

Behind the scenes the Email class handles the verifications and building the request body.

from sendgrid-go.

thinkingserious avatar thinkingserious commented on August 23, 2024

Some additional notes:

  • The content body should take a IO.Reader
  • The response should be custom and strongly typed

from sendgrid-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.