memobird

package
v0.0.0-...-52bb2e6 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIPrefix = "https://open.memobird.cn/home"
)

Default API endpoints, according to http://open.memobird.cn/upload/webapi.pdf

View Source
const MemobirdTimeZone = "Asia/Shanghai"

Variables

View Source
var TZShanghai *time.Location

Functions

func UTF8ToGBK

func UTF8ToGBK(s []byte) ([]byte, error)

UTF8ToGBK converts UTF8 text to GBK.

Types

type APIResult

type APIResult struct {
	IsSuccess bool
	Err       error
}

APIResult contains the result of every API request.

type App

type App struct {
	*AppConfig
	// contains filtered or unexported fields
}

App is an memobird application.

func NewApp

func NewApp(config *AppConfig) *App

NewApp creates an App with given accessKey.

func (*App) BindDevice

func (a *App) BindDevice(deviceID string) (*BindResult, error)

BindDevice binds given device for further use.

func (*App) PrintText

func (a *App) PrintText(txt string, deviceID string) (*PrintResult, error)

PrintText prints txt to membird of given deviceID.

type AppConfig

type AppConfig struct {
	AccessKey string
	Timeout   time.Duration

	// CustomizedAPIPrefix is an optional configuration where an alternative APIPrefix should be used.
	CustomizedAPIPrefix string
}

AppConfig contains all configurations of an App.

func (AppConfig) APIPrefix

func (a AppConfig) APIPrefix() string

APIPrefix returns the APIPrefix.

type BindResult

type BindResult struct {
	APIResult
	UserID uint64
}

BindResult contains the result of a bind request.

type PrintResult

type PrintResult struct {
	APIResult
	IsPrinted bool
	ContentID int64
	DeviceID  string
}

PrintResult contains the result of a print request.

Jump to

Keyboard shortcuts

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