Documentation ¶
Overview ¶
Package gcp is the Google Cloud Print API client.
Index ¶
- Constants
- type GoogleCloudPrint
- func (gcp *GoogleCloudPrint) CanShare() bool
- func (gcp *GoogleCloudPrint) Control(jobID string, state *cdd.PrintJobStateDiff) error
- func (gcp *GoogleCloudPrint) Delete(gcpID string) error
- func (gcp *GoogleCloudPrint) DeleteJob(gcpJobID string) error
- func (gcp *GoogleCloudPrint) Download(dst io.Writer, url string) error
- func (gcp *GoogleCloudPrint) FcmSubscribe(subscribeUrl string) (interface{}, error)
- func (gcp *GoogleCloudPrint) Fetch(gcpID string) ([]Job, error)
- func (gcp *GoogleCloudPrint) GetRobotAccessToken() (string, error)
- func (gcp *GoogleCloudPrint) HandleJobs(printer *lib.Printer, reportJobFailed func())
- func (gcp *GoogleCloudPrint) Jobs(gcpID string) ([]Job, error)
- func (gcp *GoogleCloudPrint) List() (map[string]string, error)
- func (gcp *GoogleCloudPrint) ListPrinters() ([]lib.Printer, map[string]uint, error)
- func (gcp *GoogleCloudPrint) Printer(gcpID string) (*lib.Printer, uint, error)
- func (gcp *GoogleCloudPrint) ProximityToken(gcpID, user string) ([]byte, int, error)
- func (gcp *GoogleCloudPrint) Register(printer *lib.Printer) error
- func (gcp *GoogleCloudPrint) Share(gcpID, shareScope string, role Role, skip_notification bool, public bool) error
- func (gcp *GoogleCloudPrint) Ticket(gcpJobID string) (*cdd.CloudJobTicket, error)
- func (gcp *GoogleCloudPrint) Unshare(gcpID, shareScope string, public bool) error
- func (gcp *GoogleCloudPrint) Update(diff *lib.PrinterDiff) error
- type Job
- type Role
Constants ¶
const ( // OAuth constants. RedirectURL = "oob" ScopeCloudPrint = "https://www.googleapis.com/auth/cloudprint" ScopeGoogleTalk = "https://www.googleapis.com/auth/googletalk" AccessType = "offline" // Printer Notification channel constants. FCP_CHANNEL = "FCM_CHANNEL" XMPP_CHANNEL = "XMPP_CHANNEL" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoogleCloudPrint ¶
type GoogleCloudPrint struct {
// contains filtered or unexported fields
}
GoogleCloudPrint is the interface between Go and the Google Cloud Print API.
func NewGoogleCloudPrint ¶
func NewGoogleCloudPrint(baseURL, robotRefreshToken, userRefreshToken, proxyName, oauthClientID, oauthClientSecret, oauthAuthURL, oauthTokenURL string, maxConcurrentDownload uint, jobs chan<- *lib.Job, useFcm bool) (*GoogleCloudPrint, error)
NewGoogleCloudPrint establishes a connection with GCP, returns a new GoogleCloudPrint object.
func (*GoogleCloudPrint) CanShare ¶
func (gcp *GoogleCloudPrint) CanShare() bool
CanShare answers the question "can we share printers when they are registered?"
func (*GoogleCloudPrint) Control ¶
func (gcp *GoogleCloudPrint) Control(jobID string, state *cdd.PrintJobStateDiff) error
Control calls google.com/cloudprint/control to set the state of a GCP print job.
func (*GoogleCloudPrint) Delete ¶
func (gcp *GoogleCloudPrint) Delete(gcpID string) error
Delete calls google.com/cloudprint/delete to delete a printer from GCP.
func (*GoogleCloudPrint) DeleteJob ¶
func (gcp *GoogleCloudPrint) DeleteJob(gcpJobID string) error
DeleteJob calls google.com/cloudprint/deletejob to delete a print job.
func (*GoogleCloudPrint) Download ¶
func (gcp *GoogleCloudPrint) Download(dst io.Writer, url string) error
Download downloads a URL (a print job data file) directly to a Writer.
func (*GoogleCloudPrint) FcmSubscribe ¶
func (gcp *GoogleCloudPrint) FcmSubscribe(subscribeUrl string) (interface{}, error)
FCM Subscribe.
func (*GoogleCloudPrint) Fetch ¶
func (gcp *GoogleCloudPrint) Fetch(gcpID string) ([]Job, error)
Fetch calls google.com/cloudprint/fetch to get the outstanding print jobs for a GCP printer.
func (*GoogleCloudPrint) GetRobotAccessToken ¶
func (gcp *GoogleCloudPrint) GetRobotAccessToken() (string, error)
func (*GoogleCloudPrint) HandleJobs ¶
func (gcp *GoogleCloudPrint) HandleJobs(printer *lib.Printer, reportJobFailed func())
HandleJobs gets and processes jobs waiting on a printer.
func (*GoogleCloudPrint) Jobs ¶
func (gcp *GoogleCloudPrint) Jobs(gcpID string) ([]Job, error)
Jobs calls google.com/cloudprint/jobs to get print jobs for a GCP printer.
func (*GoogleCloudPrint) List ¶
func (gcp *GoogleCloudPrint) List() (map[string]string, error)
List calls google.com/cloudprint/list to get all GCP printers assigned to this connector.
Returns map of GCPID => printer name. GCPID is unique to GCP; printer name should be unique to CUPS. Use Printer to get details about each printer.
func (*GoogleCloudPrint) ListPrinters ¶
ListPrinters calls gcp.List, then calls gcp.Printer, one goroutine per printer. This is a fast way to fetch all printers with corresponding CDD info, which the List API does not provide.
The second return value is a map of GCPID -> queued print job quantity.
func (*GoogleCloudPrint) Printer ¶
Printer gets the printer identified by it's GCPID.
The second return value is queued print job quantity.
func (*GoogleCloudPrint) ProximityToken ¶
func (gcp *GoogleCloudPrint) ProximityToken(gcpID, user string) ([]byte, int, error)
ProximityToken gets a proximity token for Privet users to access a printer through the cloud.
Returns byte array of raw JSON to preserve any/all returned fields and returned HTTP status code.
func (*GoogleCloudPrint) Register ¶
func (gcp *GoogleCloudPrint) Register(printer *lib.Printer) error
Register calls google.com/cloudprint/register to register a GCP printer.
Sets the GCPID field in the printer arg.
func (*GoogleCloudPrint) Share ¶
func (gcp *GoogleCloudPrint) Share(gcpID, shareScope string, role Role, skip_notification bool, public bool) error
Share calls google.com/cloudprint/share to share a registered GCP printer.
func (*GoogleCloudPrint) Ticket ¶
func (gcp *GoogleCloudPrint) Ticket(gcpJobID string) (*cdd.CloudJobTicket, error)
Ticket gets a ticket, aka print job options.
func (*GoogleCloudPrint) Unshare ¶
func (gcp *GoogleCloudPrint) Unshare(gcpID, shareScope string, public bool) error
Unshare calls google.com/cloudprint/unshare to unshare a registered GCP printer.
func (*GoogleCloudPrint) Update ¶
func (gcp *GoogleCloudPrint) Update(diff *lib.PrinterDiff) error
Update calls google.com/cloudprint/update to update a GCP printer.