From f298f3dc73601a094870d06adb9ed412fcad01b9 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Fri, 4 Oct 2024 18:17:37 +0530 Subject: [PATCH] chore: update readme and upgrade guide --- CHANGELOG.md | 4 ++++ README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ UPGRADE.md | 11 +++++++++++ base_interface.go | 2 +- 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 UPGRADE.md diff --git a/CHANGELOG.md b/CHANGELOG.md index ad1db81f..7a49f3ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Change Log All notable changes to this project will be documented in this file. +[2024-10-04] Version 4.0.0-rc.1 +--------------------------- +Release Candidate Preparation + [2024-08-26] Version 3.16.0 --------------------------- **Library - Chore** diff --git a/README.md b/README.md index 6a2130cd..e18e28f3 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,49 @@ source ./sendgrid.env The following is the minimum needed code to send an email with the [/mail/send Helper](helpers/mail) ([here](examples/helpers/mail/example.go#L32) is a full example): +### Using Autogenerated Code +```go +package main + +import ( + "encoding/json" + "fmt" + "github.com/sendgrid/sendgrid-go" + MailV3 "github.com/sendgrid/sendgrid-go/rest/api/v3/mail" + "net/http" + "os" +) + +func main() { + client := sendgrid.NewRestClientWithParams(sendgrid.ClientParams{ + ApiKey: os.Getenv("SENDGRID_API_KEY"), + }) + name := "John Doe" + subject := "Sending with Twilio SendGrid is Fun" + mailTo := &MailV3.MailTo{Email: "test@example.com"} + to := []MailV3.MailTo{*mailTo} + sendMailRequest := MailV3.SendMailRequest{ + From: MailV3.MailFrom{Name: &name, Email: VERIFIED_EMAIL}, + ReplyTo: mailTo, + Subject: &subject, + Personalizations: []MailV3.SendMailRequestPersonalizationsInner{{To: to}}, + Content: &[]MailV3.SendMailRequestContentInner{{Type: "text/plain", Value: "Abc"}}, + } + sendMailParam := &MailV3.SendMailParam{SendMailRequest: &sendMailRequest} + resp, err := client.MailV3.SendMail(sendMailParam) + if err != nil { + fmt.Println("Error sending mail: " + err.Error()) + } else { + response, _ := json.Marshal(resp) + var ps http.Response + json.Unmarshal(response, &ps) + fmt.Println(ps.StatusCode) + fmt.Println(ps.Body) + fmt.Println(ps.Header) + } +} +``` + ### With Mail Helper Class ```go diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 00000000..82751aa6 --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,11 @@ +# Upgrade Guide + +_`MAJOR` version bumps will have upgrade notes posted here._ + +[2024-10-04] 3.x.x to 4.x.x-rc.x +-------------------------------- +### Overview + +#### Sendgrid Go Helper Library's version 4.0.0-rc.x is now available. + +Behind the scenes Go Helper is now auto-generated via OpenAPI with this release. This enables us to rapidly add new features and enhance consistency across versions and languages. diff --git a/base_interface.go b/base_interface.go index 6fdaf3cf..cb76514e 100644 --- a/base_interface.go +++ b/base_interface.go @@ -15,7 +15,7 @@ import ( // Version is this client library's current version const ( - Version = "3.16.0" + Version = "4.0.0-rc.1" rateLimitRetry = 5 rateLimitSleep = 1100 )