/
dto.go
107 lines (90 loc) · 1.9 KB
/
dto.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package models
import (
"io"
"time"
"github.com/ItsNotGoodName/smtpbridge/pkg/pagination"
)
type DTOMessageCreate struct {
Date time.Time
Subject string
From string
To []string
Text string
HTML string
}
type DTOAttachmentCreate struct {
Name string
Data io.Reader
}
type DTOEnvelopeListRequest struct {
Search string
SearchSubject bool
SearchText bool
Ascending bool
Order dtoEnvelopeField
}
type dtoEnvelopeField string
func NewDTOEnvelopeField(s string) dtoEnvelopeField {
switch s {
case DTOEnvelopeFieldFrom:
return DTOEnvelopeFieldFrom
case DTOEnvelopeFieldSubject:
return DTOEnvelopeFieldSubject
default:
return DTOEnvelopeFieldCreatedAt
}
}
const (
DTOEnvelopeFieldCreatedAt = "created_at"
DTOEnvelopeFieldFrom = "from"
DTOEnvelopeFieldSubject = "subject"
)
type DTOEnvelopeListResult struct {
PageResult pagination.PageResult
Envelopes []Envelope
}
type DTOAttachmentListRequest struct {
Ascending bool
}
type DTOAttachmentListResult struct {
PageResult pagination.PageResult
Attachments []Attachment
}
type DTOTraceListRequest struct {
Ascending bool
}
type DTOTraceListResult struct {
PageResult pagination.PageResult
Traces [][]Trace
}
type DTORuleCreate struct {
Name string
Expression string
Endpoints []int64
}
type DTORuleUpdate struct {
ID int64
Name *string
Expression *string
Enable *bool
Endpoints *[]int64
}
type DTOEndpointCreate struct {
Name string
AttachmentDisable bool
TextDisable bool
TitleTemplate string
BodyTemplate string
Kind string
Config map[string]string
}
type DTOEndpointUpdate struct {
ID int64
Name *string
AttachmentDisable *bool
TextDisable *bool
TitleTemplate *string
BodyTemplate *string
Kind *string
Config *map[string]string
}