Flying Goose Cloud print go language sdk
go get -u -v github.com/houseme/feie@main
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)
}
FeiE is primarily distributed under the terms of both the Apache License (Version 2.0)