-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathresponse.go
83 lines (75 loc) · 2.55 KB
/
response.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package intacct
import (
"encoding/xml"
"time"
)
func NewResponse() Response {
return Response{
Control: ResponseControl{
ControlID: "",
UniqueID: true,
DTDVersion: "3.0",
},
Operation: ResponseOperation{
Authentication: ResponseAuthentication{},
Result: ResponseResult{},
},
}
}
type Response struct {
XMLName xml.Name `xml:"response" json:"-"`
Control ResponseControl `xml:"control"`
Operation ResponseOperation `xml:"operation"`
}
type ResponseControl struct {
Status string `xml:"status"`
SenderID string `xml:"senderid"`
ControlID string `xml:"controlid"`
UniqueID bool `xml:"uniqueid"`
DTDVersion string `xml:"dtdversion"`
}
type ResponseOperation struct {
Authentication ResponseAuthentication `xml:"authentication"`
Result ResponseResult `xml:"result"`
ErrorMessage ErrorMessage `xml:"errormessage"`
}
type ResponseAuthentication struct {
Status string `xml:"status"`
UserID string `xml:"userid"`
CompanyID string `xml:"companyid"`
LocationID string `xml:"locationid"`
SessionTimestamp time.Time `xml:"sessiontimestamp"`
SessionTimeout time.Time `xml:"sessiontimeout"`
}
type ResponseResult struct {
Status string `xml:"status"`
Function string `xml:"function"`
ControlID string `xml:"controlid"`
// Data interface{} `xml:"data"`
Data struct {
Listtype string `xml:"listtype,attr"`
Count int `xml:"count"`
TotalCount int `xml:"totalcount,attr"`
NumRemaining int `xml:"numremaining,attr"`
ResultID string `xml:"resultId,attr"`
API struct {
SessionID string `xml:"sessionid"`
Endpoint string `xml:"endpoint"`
LocationID string `xml:"locationid"`
} `xml:"api"`
GLAccounts GLAccounts `xml:"glaccount"`
Classes Classes `xml:"class"`
Customers Customers `xml:"CUSTOMER"`
Departments Departments `xml:"department"`
Type ObjectDefinitionType `xml:"Type"`
Locations Locations `xml:"location"`
LocationEntities LocationEntities `xml:"locationentity"`
Projects Projects `xml:"project"`
TaxDetails TaxDetails `xml:"TAXDETAIL"`
Invoices Invoices `xml:"ARINVOICE"`
InvoiceItems InvoiceItems `xml:"ARINVOICEITEM"`
SupDoc SupDoc `xml:"supdoc"`
GLBatches GLBatches `xml:"glbatch"`
} `xml:"data"`
ErrorMessage ErrorMessage `xml:"errormessage"`
}