Documentation ¶
Index ¶
- type API
- func (api *API) AddPrintJob(filename string, options FinishingOptions) (*PrintJobItem, error)
- func (api *API) DeletePrintJobs(locations []PrintJobDeleteLocation) ([]*PrintJobDeleteStatus, error)
- func (api *API) GetDevice(deviceID int) (*Device, error)
- func (api *API) GetDevices(skip, pageSize int) (*DevicesResponseData, error)
- func (api *API) GetJSON(url string, params interface{}, successDat interface{}) (*http.Response, error)
- func (api *API) GetPrintJobs() (*PrintJobsResponseData, error)
- func (api *API) GetTransactions(skip, pageSize int) (*TransactionResponseData, error)
- func (api *API) Logon() (respData *LogonResponseData, token string, err error)
- func (api *API) PostJSON(url string, params interface{}, postBody interface{}, successDat interface{}) (*http.Response, error)
- func (api *API) SetCredential(credential string) *API
- func (api *API) SetToken(token string) *API
- func (api *API) SetUserPass(user, pass string) *API
- type Device
- type DevicesResponseData
- type FinishingOptions
- type LogonRequestData
- type LogonResponseData
- type PrintJobDeleteLocation
- type PrintJobDeleteRequestData
- type PrintJobDeleteStatus
- type PrintJobItem
- type PrintJobsResponseData
- type Transaction
- type TransactionResponseData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { UserID string // required // contains filtered or unexported fields }
API is printer API wrapper
func (*API) AddPrintJob ¶
func (api *API) AddPrintJob(filename string, options FinishingOptions) (*PrintJobItem, error)
AddPrintJob adds a printjob
func (*API) DeletePrintJobs ¶
func (api *API) DeletePrintJobs(locations []PrintJobDeleteLocation) ([]*PrintJobDeleteStatus, error)
DeletePrintJobs removes printjobs from job queue
func (*API) GetDevices ¶
func (api *API) GetDevices(skip, pageSize int) (*DevicesResponseData, error)
GetDevices gets printing devices
func (*API) GetJSON ¶
func (api *API) GetJSON(url string, params interface{}, successDat interface{}) (*http.Response, error)
GetJSON populates a struct with JSON response data
func (*API) GetPrintJobs ¶
func (api *API) GetPrintJobs() (*PrintJobsResponseData, error)
GetPrintJobs sends a request to view print jobs
func (*API) GetTransactions ¶
func (api *API) GetTransactions(skip, pageSize int) (*TransactionResponseData, error)
GetTransactions returns transaction history
func (*API) Logon ¶
func (api *API) Logon() (respData *LogonResponseData, token string, err error)
Logon sends a request to get token. Credential must be set in API object
func (*API) PostJSON ¶
func (api *API) PostJSON(url string, params interface{}, postBody interface{}, successDat interface{}) (*http.Response, error)
PostJSON posts a JSON and populates a struct with JSON response
func (*API) SetCredential ¶
SetCredential set logon credentials
func (*API) SetUserPass ¶
SetUserPass set logon credentials from username and password
type Device ¶
type Device struct { Identifier string `json:"Identifier"` Name string `json:"Name"` Description string `json:"Description"` Make string `json:"Make"` Model string `json:"Model"` Capabilities struct { DuplexSupported bool `json:"DuplexSupported"` ColorSupported bool `json:"ColorSupported"` } `json:"Capabilities"` Server string `json:"Server"` DeviceGroups []string `json:"DeviceGroups"` Active bool `json:"Active"` LastModified time.Time `json:"LastModified"` Location string `json:"Location"` }
Device a printing device
type DevicesResponseData ¶
type DevicesResponseData struct { PreviousPageLink string `json:"PreviousPageLink"` NextPageLink string `json:"NextPageLink"` Count int `json:"Count"` Items []Device `json:"Items"` }
DevicesResponseData is response of devices request
type FinishingOptions ¶
type FinishingOptions struct { Mono bool `json:"Mono"` Duplex bool `json:"Duplex"` PagesPerSide int `json:"PagesPerSide"` Copies int `json:"Copies"` DefaultPageSize string `json:"DefaultPageSize"` // Letter or something PageRange string `json:"PageRange"` }
FinishingOptions finishing options of a printjob
type LogonRequestData ¶
type LogonRequestData struct { KeepMeLoggedIn string `url:"KeepMeLoggedIn"` IncludePrintJobs string `url:"includeprintjobs"` IncludeDeviceActivity string `url:"includedeviceactivity"` IncludePrivileges string `url:"includeprivileges"` IncludeCostCenters string `url:"includecostcenters"` }
LogonRequestData is query params of logon request
type LogonResponseData ¶
type LogonResponseData struct { Identifier string `json:"Identifier"` // this is user ID! LogonID string `json:"LogonId"` DisplayName string `json:"DisplayName"` EmailAddresses []string `json:"EmailAddresses"` Roles []string `json:"Roles"` Active bool `json:"Active"` Alias string `json:"Alias"` AccountType string `json:"AccountType"` Balance struct { Amount string `json:"Amount"` Purses []struct { Name string `json:"Name"` Amount string `json:"Amount"` } `json:"Purses"` } `json:"Balance"` Location string `json:"Location"` Group string `json:"Group"` Comment string `json:"Comment"` Custom1 string `json:"Custom1"` Custom2 string `json:"Custom2"` OfflineAmount string `json:"OfflineAmount"` OfflineLimit string `json:"OfflineLimit"` ID int `json:"Id"` }
LogonResponseData is the response of logon request
type PrintJobDeleteLocation ¶
type PrintJobDeleteLocation struct {
Location string `json:"Location"`
}
PrintJobDeleteLocation is an entry in delete request array
type PrintJobDeleteRequestData ¶
type PrintJobDeleteRequestData struct {
PrintJobs []PrintJobDeleteLocation `json:"PrintJobs"`
}
PrintJobDeleteRequestData is the request data to delete printjobs
type PrintJobDeleteStatus ¶
PrintJobDeleteStatus the status response of a delete request
type PrintJobItem ¶
type PrintJobItem struct { ProtectedBy string `json:"ProtectedBy"` Owner string `json:"Owner"` Name string `json:"Name"` ApplicationName string `json:"ApplicationName"` JobFormat string `json:"JobFormat"` SubmissionTimeUtc time.Time `json:"SubmissionTimeUtc"` Stats struct { SizeInKb int `json:"SizeInKb"` TotalPages int `json:"TotalPages"` TotalBWPages int `json:"TotalBWPages"` TotalColorPages int `json:"TotalColorPages"` TotalSheets int `json:"TotalSheets"` } `json:"Stats"` FinishingOptions FinishingOptions `json:"FinishingOptions"` // SupportedFinishingOptions FinishingOptions `json:"SupportedFinishingOptions"` // its a bool map, dont need for now DeviceGroup string `json:"DeviceGroup"` PrinterName string `json:"PrinterName"` DocumentType string `json:"DocumentType"` AllowableActions string `json:"AllowableActions"` PrintState string `json:"PrintState"` // this is pretty important LastModified time.Time `json:"LastModified"` Location string `json:"Location"` RawPageCounterResult string `json:"RawPageCounterResult"` SubmissionTimeDelta float64 `json:"SubmissionTimeDelta"` Cost string `json:"Cost"` }
PrintJobItem is an item in printjobs
type PrintJobsResponseData ¶
type PrintJobsResponseData struct { PreviousPageLink string `json:"PreviousPageLink"` NextPageLink string `json:"NextPageLink"` Count int `json:"Count"` Items []PrintJobItem `json:"Items"` }
PrintJobsResponseData is the response of view printjob request
type Transaction ¶
type Transaction struct { Identifier int `json:"Identifier"` User string `json:"User"` Time time.Time `json:"Time"` Amount string `json:"Amount"` Device string `json:"Device"` TransactionType string `json:"TransactionType"` Description string `json:"Description"` Printer string `json:"Printer,omitempty"` Pages int `json:"Pages,omitempty"` Sheets int `json:"Sheets,omitempty"` Application string `json:"Application,omitempty"` JobName string `json:"JobName,omitempty"` Attributes string `json:"Attributes,omitempty"` Cashier string `json:"Cashier,omitempty"` Purse string `json:"Purse,omitempty"` }
Transaction is a tx in pharos (print, credit, etc)
type TransactionResponseData ¶
type TransactionResponseData struct { PreviousPageLink string `json:"PreviousPageLink"` NextPageLink string `json:"NextPageLink"` Count int `json:"Count"` Items []Transaction `json:"Items"` }
TransactionResponseData response to get transactions