resend

package module
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2023 License: MIT Imports: 8 Imported by: 18

README

Resend is the email platform for developers.

SDK Installation

go get github.com/resendlabs/resend-go

Authentication

To authenticate you need to add an Authorization header with the contents of the header being Bearer re_123456789 where re_123456789 is your API Key. First, you need to get an API key, which is available in the Resend Dashboard.

Authorization: Bearer re_123

SDK Example Usage

package main

import (
    "context"
    "log"
    "github.com/resendlabs/resend-go"
    "github.com/resendlabs/resend-go/pkg/models/shared"
    "github.com/resendlabs/resend-go/pkg/models/operations"
)

func main() {
    s := resend.New(resend.WithSecurity(
        shared.Security{
            BearerAuth: "Bearer YOUR_BEARER_TOKEN_HERE",
        },
    ))
    
    req := operations.SendEmailRequest{
        Request: shared.Email{
            From: "hello@resend.com",
            To: "thefuture@yourcompany.com",
            Subject: "Welcome to Resend!",
            Text: "Hello, World!",
        },
    }

    ctx := context.Background()
    res, err := s.Email.SendEmail(ctx, req)
    if err != nil {
        log.Fatal(err)
    }

    if res.SendEmailResponse != nil {
        // handle response
    }
}

SDK Available Operations

Email

  • SendEmail - Send an email

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release !

SDK Generated by Speakeasy

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerList = []string{
	"https://api.resend.com",
}

Functions

func String

func String(s string) *string

String provides a helper function to return a pointer to a string

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Resend

type Resend struct {
	Email *email
	// contains filtered or unexported fields
}

SDK Documentation: Resend is the email platform for developers.

func New

func New(opts ...SDKOption) *Resend

type SDKOption

type SDKOption func(*Resend)

func WithClient

func WithClient(client HTTPClient) SDKOption

func WithSecurity

func WithSecurity(security shared.Security) SDKOption

func WithServerURL

func WithServerURL(serverURL string) SDKOption

func WithTemplatedServerURL

func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL