Cloud Print Service (CPS) SDK for Go
Introduction
- Cloud Print Service (CPS) Go SDK (API: V3.2)
Requirements
- installing a Go environment which is new than 1.10.x.
Install
go get -u github.com/print-cloud/pcloud-go-sdk
Usage
func main() {
// Necessary steps:
// Instantiating a client object requires passing in the print cloud address, Key APIUrl, Key.
client := sdk.NewClient(APIUrl,Key)
// Necessary steps:
// Instantiate a request object by passing in the printer number and what you want to print.
request := api.NewPrintMsg(100000000, "Hello,Cloud Print.")
// Necessary steps:
// GET GetSend or POST PostSend
// To invoke the interface you want to access through the Client object, you pass in the request object
response, _err := client.GetSend(request)
// Non-sdk exception, direct failure.Additional processing can be added to the actual code.
if _err != nil {
panic(_err)
}
// Prints the returned JSON string
fmt.Println(response)
}
All API have corresponding usage examples in the Example directory.
Service API: