Skip to content

houseme/feie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FeiE Printer SDK for Golang

Go Reference FEIE-CI GitHub GitHub go.mod Go version (branch)

Flying Goose Cloud print go language sdk

Installation

go get -u -v github.com/houseme/feie@main 

Usage

package main

import (
    "context"
    "fmt"
    
    "github.com/houseme/feie"
)

func main() {
    ctx := context.Background()
    c := feie.New(ctx, feie.WithUser("xxxxx"), feie.WithUserKey("xxxxx"))
    
    // 通过SetUserKey设置用户key 和 操作方法中user参数覆盖new方法传入的 User和UserKey
    // 设置用户key 
    c.SetUserKey("xxxxx")
    // 添加打印机
    printerAddResp, err := c.OpenPrinterAddList(ctx, &feie.PrinterAddReq{
        PrinterContent: "xxxxxx",
        User:           "xxxxx",
    })
    
    if err != nil {
        panic(err)
    }
    fmt.Println("PrinterAddResp:", printerAddResp)
    // Reset 重置 User和UserKey 前提是new方法传入的 User和UserKey不为空
    c.Reset()
    
    // 执行打印
    printMsgReq, err := c.OpenPrintMsg(ctx, &feie.PrintMsgReq{
        SN:      "xxxxx",
        Content: "xxxxx",
        User:    "xxxxx",
    })
    if err != nil {
        panic(err)
    }
    fmt.Println("PrintMsgResp:", printMsgReq)
}

License

FeiE is primarily distributed under the terms of both the Apache License (Version 2.0)