-
Notifications
You must be signed in to change notification settings - Fork 0
/
technicalSupport.go
62 lines (54 loc) · 2.12 KB
/
technicalSupport.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
package connect
import "encoding/json"
// UserInfo - A contact to user
type UserInfo struct {
Name string `json:"name"`
Email string `json:"email"`
}
// SupportProductInfo - Product identification
type SupportProductInfo struct {
ProductVersion string `json:"productVersion"`
ProductName string `json:"productName"`
OperatingSystem string `json:"operatingSystem"`
LicenseNumber string `json:"licenseNumber"` // first 11 chars only
}
// AdditionalFiles - List of files attached to the ticket
type AdditionalFiles []string
type SystemInfo struct {
Files AdditionalFiles `json:"files"`
Description string `json:"description"`
}
// Interface for support incidents
// TechnicalSupportGetInfo - @return (void)
// Return
// userInfo (out UserInfo) User information
// productInfo (out ProductInfo) Product information
// systemInfo (out SystemInfo) System information
// isUploadServerAvailable (out boolean) Is possible to upload attachment ?
func (s *ServerConnection) TechnicalSupportGetInfo() (*UserInfo, *SupportProductInfo, *SystemInfo, bool, error) {
data, err := s.CallRaw("TechnicalSupport.getInfo", nil)
if err != nil {
return nil, nil, nil, false, err
}
userInfo := struct {
Result struct {
UserInfo UserInfo `json:"userInfo"`
ProductInfo SupportProductInfo `json:"productInfo"`
SystemInfo SystemInfo `json:"systemInfo"`
IsUploadServerAvailable bool `json:"isUploadServerAvailable"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &userInfo)
return &userInfo.Result.UserInfo, &userInfo.Result.ProductInfo, &userInfo.Result.SystemInfo, userInfo.Result.IsUploadServerAvailable, err
}
// TechnicalSupportAddSystemInfoToTicket - @return (void)
// ticketId (in string) tickedId of target ticket
// email (in string) email of the customer
func (s *ServerConnection) TechnicalSupportAddSystemInfoToTicket(ticketId string, email string) error {
params := struct {
TicketId string `json:"ticketId"`
Email string `json:"email"`
}{ticketId, email}
_, err := s.CallRaw("TechnicalSupport.addSystemInfoToTicket", params)
return err
}