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
|
package proton
import (
"encoding/json"
"fmt"
"github.com/ProtonMail/gluon/rfc822"
)
type ClientType int
const (
ClientTypeEmail ClientType = iota + 1
ClientTypeVPN
ClientTypeCalendar
ClientTypeDrive
)
type ReportBugReq struct {
OS string
OSVersion string
Browser string
BrowserVersion string
BrowserExtensions string
Resolution string
DisplayMode string
Client string
ClientVersion string
ClientType ClientType
Title string
Description string
Username string
Email string
Country string
ISP string
}
func (req ReportBugReq) toFormData() map[string]string {
b, err := json.Marshal(req)
if err != nil {
panic(err)
}
var raw map[string]any
if err := json.Unmarshal(b, &raw); err != nil {
panic(err)
}
res := make(map[string]string)
for key := range raw {
if val := fmt.Sprint(raw[key]); val != "" {
res[key] = val
}
}
return res
}
type ReportBugAttachment struct {
Name string
Filename string
MIMEType rfc822.MIMEType
Body []byte
}
|