@@ -61,18 +61,18 @@ func FinderResponse(data models.Finder) Model {
61
61
Blocks : []Block {
62
62
{
63
63
Type : "section" ,
64
- Text : Text {
64
+ Text : & Text {
65
65
Type : "mrkdwn" ,
66
66
Text : fmt .Sprintf ("Email *%s* \n \n <https://app.tomba.io/|Tomba web app>\n \n " , email ),
67
67
},
68
- Fields : fields ,
68
+ Fields : & fields ,
69
69
},
70
70
{
71
71
Type : "divider" ,
72
72
},
73
73
{
74
74
Type : "section" ,
75
- Text : Text {
75
+ Text : & Text {
76
76
Type : "mrkdwn" ,
77
77
Text : fmt .Sprintf ("We found `%d` sources for *%s* on the web.\n %s" , len (data .Data .Sources ), email , sources ),
78
78
},
@@ -87,25 +87,199 @@ func FinderResponse(data models.Finder) Model {
87
87
}
88
88
89
89
// SearchResponse
90
- func SearchResponse (data models.Search ) [] Model {
90
+ func SearchResponse (data models.Search ) Model {
91
91
92
- attachment := make ([]Attachment , 0 , 5 )
92
+ block := make ([]Block , 0 , 5 )
93
93
emails := data .Data .Emails
94
+ block = append (block , Block {
95
+ Type : "section" ,
96
+ Text : & Text {
97
+ Type : "mrkdwn" ,
98
+ Text : fmt .Sprintf ("%d results for your search %s\n " , len (emails ), * data .Data .Organization .WebsiteURL ),
99
+ },
100
+ })
101
+
94
102
for i := 0 ; i < len (emails ); i ++ {
95
- attachment = append (attachment , Attachment {
96
- Color : "" ,
97
- Blocks : []Block {},
103
+ fields := make ([]Text , 0 , 5 )
104
+ if emails [i ].FullName != nil {
105
+ fields = append (fields , Text {
106
+ Type : "mrkdwn" ,
107
+ Text : fmt .Sprintf ("\n \n *Name*\n \n %s at \n \n " , * emails [i ].FullName ),
108
+ })
109
+ }
110
+ if emails [i ].Email != "" {
111
+ fields = append (fields , Text {
112
+ Type : "mrkdwn" ,
113
+ Text : fmt .Sprintf ("\n \n *Email*\n \n %s \n \n " , emails [i ].Email ),
114
+ })
115
+ }
116
+ if emails [i ].Position != nil {
117
+ fields = append (fields , Text {
118
+ Type : "mrkdwn" ,
119
+ Text : fmt .Sprintf ("\n \n *Bio*\n \n %s at %s \n \n " , * emails [i ].Position , data .Data .Organization .Organization ),
120
+ })
121
+ }
122
+
123
+ if emails [i ].Country != nil {
124
+ fields = append (fields , Text {
125
+ Type : "mrkdwn" ,
126
+ Text : fmt .Sprintf ("\n \n *Location*\n \n %s \n \n " , * emails [i ].Country ),
127
+ })
128
+ }
129
+
130
+ if emails [i ].Linkedin != nil {
131
+ fields = append (fields , Text {
132
+ Type : "mrkdwn" ,
133
+ Text : fmt .Sprintf ("\n \n *Linkedin*\n \n %s \n \n " , * emails [i ].Linkedin ),
134
+ })
135
+ }
136
+
137
+ if emails [i ].Twitter != nil {
138
+ fields = append (fields , Text {
139
+ Type : "mrkdwn" ,
140
+ Text : fmt .Sprintf ("\n \n *Twitter*\n \n %s \n \n " , emails [i ].Twitter ),
141
+ })
142
+ }
143
+ sources := ""
144
+ if len (emails [i ].Sources ) > 0 {
145
+ for i := 0 ; i < len (emails [i ].Sources ); i ++ {
146
+ sources += emails [i ].Sources [i ].URI + "\n "
147
+ }
148
+ }
149
+ block = append (block , Block {Type : "divider" })
150
+ block = append (block , Block {
151
+ Type : "section" ,
152
+ Text : & Text {
153
+ Type : "mrkdwn" ,
154
+ Text : fmt .Sprintf ("Email *%s* \n \n <https://app.tomba.io/|Tomba web app>\n \n " , emails [i ].Email ),
155
+ },
156
+ Fields : & fields ,
98
157
})
158
+ block = append (block , Block {
159
+ Type : "section" ,
160
+ Text : & Text {
161
+ Type : "mrkdwn" ,
162
+ Text : fmt .Sprintf ("We found `%d` sources for *%s* on the web.\n %s" , len (emails [i ].Sources ), emails [i ].Email , sources ),
163
+ },
164
+ })
165
+ block = append (block , Block {Type : "divider" })
99
166
}
100
167
101
- return [] Model {
168
+ return Model { Attachments : [] Attachment {
102
169
{
103
- Attachments : [] Attachment {} ,
104
- } ,
105
- }
170
+ Color : "#3f77e8" ,
171
+ Blocks : block ,
172
+ }} }
106
173
}
107
174
108
175
// VerifyResponse
109
176
func VerifyResponse (data models.Verifier ) Model {
110
- return Model {}
177
+ email := data .Data .Email .Email
178
+ fields := make ([]Text , 0 , 5 )
179
+
180
+ fields = append (fields , Text {
181
+ Type : "mrkdwn" ,
182
+ Text : fmt .Sprintf ("\n \n *Email*\n \n %s \n \n " , email ),
183
+ })
184
+
185
+ Format := "Invalid"
186
+ if data .Data .Email .Regex && ! data .Data .Email .Gibberish {
187
+ Format = "Valid"
188
+ }
189
+ if data .Data .Email .Gibberish {
190
+ Format = "Gibberish"
191
+ }
192
+ fields = append (fields , Text {
193
+ Type : "mrkdwn" ,
194
+ Text : fmt .Sprintf ("\n \n *Format*\n \n %s \n \n " , Format ),
195
+ })
196
+ ServerStatus := "Invalid"
197
+ if data .Data .Email .MXRecords {
198
+ ServerStatus = "Valid"
199
+ }
200
+ fields = append (fields , Text {
201
+ Type : "mrkdwn" ,
202
+ Text : fmt .Sprintf ("\n \n *Server status*\n \n %s \n \n " , ServerStatus ),
203
+ })
204
+ Type := "Professional"
205
+ if data .Data .Email .Webmail {
206
+ Type = "Webmail"
207
+ }
208
+ if data .Data .Email .Disposable {
209
+ Type = "Disposable"
210
+ }
211
+ fields = append (fields , Text {
212
+ Type : "mrkdwn" ,
213
+ Text : fmt .Sprintf ("\n \n *Email Type*\n \n %s \n \n " , Type ),
214
+ })
215
+ EmailStatus := "Invalid"
216
+ if data .Data .Email .Result == "deliverable" {
217
+ EmailStatus = "Valid"
218
+ }
219
+ if data .Data .Email .AcceptAll {
220
+ EmailStatus = "Accept all"
221
+ }
222
+ if data .Data .Email .Block {
223
+ EmailStatus = "Blocked"
224
+ }
225
+ fields = append (fields , Text {
226
+ Type : "mrkdwn" ,
227
+ Text : fmt .Sprintf ("\n \n *Email status*\n \n %s \n \n " , EmailStatus ),
228
+ })
229
+
230
+ if data .Data .Email .Whois .CreatedDate != "" {
231
+ fields = append (fields , Text {
232
+ Type : "mrkdwn" ,
233
+ Text : fmt .Sprintf ("\n \n *Whois Creation Date*\n \n %s \n \n " , data .Data .Email .Whois .CreatedDate ),
234
+ })
235
+ }
236
+ if data .Data .Email .Whois .ReferralURL != "" {
237
+ fields = append (fields , Text {
238
+ Type : "mrkdwn" ,
239
+ Text : fmt .Sprintf ("\n \n *RWhois*\n \n %s \n \n " , data .Data .Email .Whois .ReferralURL ),
240
+ })
241
+ }
242
+ if data .Data .Email .Whois .RegistrarName != "" {
243
+ fields = append (fields , Text {
244
+ Type : "mrkdwn" ,
245
+ Text : fmt .Sprintf ("\n \n *Whois Name*\n \n %s \n \n " , data .Data .Email .Whois .RegistrarName ),
246
+ })
247
+ }
248
+ sources := ""
249
+ if len (data .Data .Sources ) > 0 {
250
+ for i := 0 ; i < len (data .Data .Sources ); i ++ {
251
+ sources += data .Data .Sources [i ].URI + "\n "
252
+ }
253
+ }
254
+
255
+ return Model {
256
+ Attachments : []Attachment {
257
+ {
258
+ Color : "#3f77e8" ,
259
+ Blocks : []Block {
260
+ {
261
+ Type : "section" ,
262
+ Text : & Text {
263
+ Type : "mrkdwn" ,
264
+ Text : fmt .Sprintf ("Email *%s* \n \n <https://app.tomba.io/|Tomba web app>\n \n " , email ),
265
+ },
266
+ Fields : & fields ,
267
+ },
268
+ {
269
+ Type : "divider" ,
270
+ },
271
+ {
272
+ Type : "section" ,
273
+ Text : & Text {
274
+ Type : "mrkdwn" ,
275
+ Text : fmt .Sprintf ("We found `%d` sources for *%s* on the web.\n %s" , len (data .Data .Sources ), email , sources ),
276
+ },
277
+ },
278
+ {
279
+ Type : "divider" ,
280
+ },
281
+ },
282
+ },
283
+ },
284
+ }
111
285
}
0 commit comments