fixed request and response structs

This commit is contained in:
Fabian 2020-03-05 16:31:05 +01:00 committed by GitHub
parent 49be0016e3
commit 166c30bdd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -147,11 +147,11 @@ func (c *IPPClient) PrintDocuments(docs []Document, printer string, jobAttribute
return -1, err
}
if len(resp.Jobs) == 0 {
if len(resp.JobAttributes) == 0 {
return 0, errors.New("server doesn't returned a job id")
}
jobID := resp.Jobs[0][OperationAttributeJobID][0].Value.(int)
jobID := resp.JobAttributes[0][OperationAttributeJobID][0].Value.(int)
documentCount := len(docs) - 1
@ -217,11 +217,11 @@ func (c *IPPClient) PrintJob(doc Document, printer string, jobAttributes map[str
return -1, err
}
if len(resp.Jobs) == 0 {
if len(resp.JobAttributes) == 0 {
return 0, errors.New("server doesn't returned a job id")
}
jobID := resp.Jobs[0][OperationAttributeJobID][0].Value.(int)
jobID := resp.JobAttributes[0][OperationAttributeJobID][0].Value.(int)
return jobID, nil
}
@ -268,11 +268,11 @@ func (c *IPPClient) GetPrinterAttributes(printer string, attributes []string) (A
return nil, err
}
if len(resp.Printers) == 0 {
if len(resp.PrinterAttributes) == 0 {
return nil, errors.New("server doesn't return any printer attributes")
}
return resp.Printers[0], nil
return resp.PrinterAttributes[0], nil
}
func (c *IPPClient) ResumePrinter(printer string) error {
@ -306,11 +306,11 @@ func (c *IPPClient) GetJobAttributes(jobID int, attributes []string) (Attributes
return nil, err
}
if len(resp.Printers) == 0 {
if len(resp.PrinterAttributes) == 0 {
return nil, errors.New("server doesn't return any job attributes")
}
return resp.Printers[0], nil
return resp.PrinterAttributes[0], nil
}
func (c *IPPClient) GetJobs(printer, class string, whichJobs JobStateFilter, myJobs bool, firstJobId, limit int, attributes []string) (map[int]Attributes, error) {
@ -351,7 +351,7 @@ func (c *IPPClient) GetJobs(printer, class string, whichJobs JobStateFilter, myJ
jobIDMap := make(map[int]Attributes)
for _, jobAttributes := range resp.Jobs {
for _, jobAttributes := range resp.JobAttributes {
jobIDMap[jobAttributes[OperationAttributeJobID][0].Value.(int)] = jobAttributes
}