cloudprint

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

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

Go to latest
Published: May 7, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrinterStatusOffline    = "0"
	PrinterStatusOnline     = "1"
	PrinterStatusOutofpaper = "2"
)

Variables

This section is empty.

Functions

func RequestID

func RequestID() string

func TimestampStr

func TimestampStr() string

Types

type APIClient

type APIClient struct {
	// contains filtered or unexported fields
}

func NewAPIClient

func NewAPIClient(clientID, clientSecret string, tokenStore TokenStore) *APIClient

func (*APIClient) AddPrinter

func (c *APIClient) AddPrinter(machineCode, msign string) (apiResp *APIResponse, err error)

func (*APIClient) Authorize

func (c *APIClient) Authorize() (err error)

func (*APIClient) DeletePrinter

func (c *APIClient) DeletePrinter(machineCode string) (apiResp *APIResponse, err error)

func (*APIClient) GetPrinterStatus

func (c *APIClient) GetPrinterStatus(machineCode string) (apiResp *APIResponse, err error)

func (*APIClient) PostForm

func (c *APIClient) PostForm(url string, data url.Values) (apiResp *APIResponse, err error)

func (*APIClient) Print

func (c *APIClient) Print(machineCode, content string) (apiResp *APIResponse, err error)

func (*APIClient) Sign

func (c *APIClient) Sign(timestamp string) string

type APIResponse

type APIResponse struct {
	Error            string          `json:"error"`
	ErrorDescription string          `json:"error_description"`
	Body             json.RawMessage `json:"body"`
}

type GormModel

type GormModel struct {
	ClientID string `gorm:"primaryKey"`
	Token    string
}

type GormStore

type GormStore struct {
	// contains filtered or unexported fields
}

func NewGormStore

func NewGormStore(db *gorm.DB, tableName string) *GormStore

func (*GormStore) Get

func (s *GormStore) Get(clientID string) (token string, err error)

func (*GormStore) Set

func (s *GormStore) Set(clientID, token string) (err error)

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Get

func (s *MemoryStore) Get(clientID string) (token string, err error)

func (*MemoryStore) Set

func (s *MemoryStore) Set(clientID, token string) (err error)

type TokenStore

type TokenStore interface {
	Get(clientID string) (token string, err error)
	Set(clientID, token string) (err error)
}

Jump to

Keyboard shortcuts

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