pcloud_go_sdk

package module
v0.0.0-...-9ee3cbb Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

README

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:

Documentation

Index

Constants

View Source
const Version = "1.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ApiUrl string
	Key    string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(url string, key string) *Client

func (*Client) GetSend

func (s *Client) GetSend(api api.Api) (data string, err error)

func (*Client) PostSend

func (s *Client) PostSend(api api.Api) (data string, err error)

func (*Client) WithTimeout

func (s *Client) WithTimeout(d time.Duration)

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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