smsprovider

package module
v0.0.0-...-cff7a81 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

README

smsprovider

GoDoc build status coverage report

Package jckimble/smsprovider implements providers for sms services. Made to make sms bots/gateways easier. Pull Requests welcome for new providers that you like.



Install

go get -u github.com/jckimble/smsprovider

Providers

  • TextNow
  • Signal

Examples

Look under the examples directory right now we have two examples. A bot and gateway

License

Copyright 2018 James Kimble

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment interface {
	GetMimeType() string
	GetReader() (io.ReadCloser, error)
}

Attachment is a central interface to get attachments from a message

type AttachmentProvider

type AttachmentProvider interface {
	SendAttachment(string, string, io.Reader) error
}

AttachmentProvider is a provider type that shows that you can send attachments from it, it is not required but recommended.

type Message

type Message interface {
	Source() string
	Message() string
	Attachments() []Attachment
	Time() time.Time
	Read() bool
}

Message is a central interface messages from providers should implement it provides everything required from a message

type Provider

type Provider interface {
	SendMessage(string, string) error
	DeleteMessage(Message) error
	GetPhoneNumber() (string, error)

	Setup() error
	Shutdown() error
}

All Providers must implement this interface, it has the required functions for a provider to be useful

type SMSAttachment

type SMSAttachment struct {
	URL string
}

SMSAttachment is an struct for sms attachments, standard sms sends an url for an attachment. This is here as an convenience struct for new sms providers.

func (SMSAttachment) GetMimeType

func (a SMSAttachment) GetMimeType() string

func (SMSAttachment) GetReader

func (a SMSAttachment) GetReader() (io.ReadCloser, error)

Directories

Path Synopsis
examples
bot

Jump to

Keyboard shortcuts

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