Skip to content

flc1125/go-sms

Repository files navigation

Go SMS

Go Version GoDoc codecov Go Report Card lint test MIT license

Installation

go get github.com/flc1125/go-sms

Usage

sms with driver

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/flc1125/go-sms"
	"github.com/flc1125/go-sms/driver/writer"
)

func main() {
	s := sms.New(
		writer.NewDriver(os.Stdout),
	)
	resp, err := s.Send(context.Background(), &sms.Request{
		Phone:   "1234567890",
		Content: "test",
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(resp.Status, resp.Message)

	// Output: writer: send sms {1234567890 test <nil>}
}

Drivers

License

The MIT License (MIT). Please see License File for more information.