-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
241 lines (213 loc) · 8.99 KB
/
types.go
File metadata and controls
241 lines (213 loc) · 8.99 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
package billionverify
import "time"
// VerificationStatus represents the status of email verification.
type VerificationStatus string
const (
StatusValid VerificationStatus = "valid"
StatusInvalid VerificationStatus = "invalid"
StatusUnknown VerificationStatus = "unknown"
StatusRisky VerificationStatus = "risky"
StatusDisposable VerificationStatus = "disposable"
StatusCatchall VerificationStatus = "catchall"
StatusRole VerificationStatus = "role"
)
// JobStatus represents the status of a file verification job.
type JobStatus string
const (
JobStatusPending JobStatus = "pending"
JobStatusProcessing JobStatus = "processing"
JobStatusCompleted JobStatus = "completed"
JobStatusFailed JobStatus = "failed"
)
// WebhookEvent represents a webhook event type.
type WebhookEvent string
const (
EventFileCompleted WebhookEvent = "file.completed"
EventFileFailed WebhookEvent = "file.failed"
)
// VerifyOptions contains options for single email verification.
type VerifyOptions struct {
CheckSMTP bool `json:"check_smtp"`
}
// DomainReputation contains domain reputation information.
type DomainReputation struct {
MxIP string `json:"mx_ip,omitempty"`
IsListed bool `json:"is_listed"`
Blacklists []string `json:"blacklists,omitempty"`
Checked bool `json:"checked"`
}
// VerificationResult contains detailed verification results.
type VerificationResult struct {
IsDeliverable bool `json:"is_deliverable"`
IsDisposable bool `json:"is_disposable"`
IsCatchall bool `json:"is_catchall"`
IsRole bool `json:"is_role"`
IsFree bool `json:"is_free"`
SMTPCheck bool `json:"smtp_check"`
Domain string `json:"domain,omitempty"`
DomainAge int `json:"domain_age,omitempty"`
MXRecords []string `json:"mx_records,omitempty"`
DomainReputation *DomainReputation `json:"domain_reputation,omitempty"`
Suggestion string `json:"suggestion,omitempty"`
ResponseTime int `json:"response_time,omitempty"`
}
// VerifyResponse is the response from single email verification.
type VerifyResponse struct {
Email string `json:"email"`
Status VerificationStatus `json:"status"`
Score float64 `json:"score"`
IsDeliverable bool `json:"is_deliverable"`
IsDisposable bool `json:"is_disposable"`
IsCatchall bool `json:"is_catchall"`
IsRole bool `json:"is_role"`
IsFree bool `json:"is_free"`
Domain string `json:"domain,omitempty"`
DomainAge int `json:"domain_age,omitempty"`
MXRecords []string `json:"mx_records,omitempty"`
DomainReputation *DomainReputation `json:"domain_reputation,omitempty"`
SMTPCheck bool `json:"smtp_check"`
Reason string `json:"reason,omitempty"`
Suggestion string `json:"suggestion,omitempty"`
ResponseTime int `json:"response_time,omitempty"`
CreditsUsed int `json:"credits_used"`
}
// BatchVerifyOptions contains options for batch verification.
type BatchVerifyOptions struct {
CheckSMTP bool `json:"check_smtp"`
}
// BatchResultItem represents a single result from batch verification.
type BatchResultItem struct {
Email string `json:"email"`
Status VerificationStatus `json:"status"`
Score float64 `json:"score"`
IsDeliverable bool `json:"is_deliverable"`
IsDisposable bool `json:"is_disposable"`
IsCatchall bool `json:"is_catchall"`
IsRole bool `json:"is_role"`
IsFree bool `json:"is_free"`
CreditsUsed int `json:"credits_used"`
}
// BatchVerifyResponse is the response from batch verification (synchronous).
type BatchVerifyResponse struct {
Results []BatchResultItem `json:"results"`
TotalEmails int `json:"total_emails"`
ValidEmails int `json:"valid_emails"`
InvalidEmails int `json:"invalid_emails"`
CreditsUsed int `json:"credits_used"`
ProcessTime int `json:"process_time"`
}
// FileUploadOptions contains options for file upload verification.
type FileUploadOptions struct {
CheckSMTP bool `json:"check_smtp"`
EmailColumn string `json:"email_column,omitempty"`
PreserveOriginal bool `json:"preserve_original"`
}
// FileUploadResponse is the response from file upload.
type FileUploadResponse struct {
TaskID string `json:"task_id"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
FileName string `json:"file_name"`
FileSize int64 `json:"file_size"`
EstimatedCount int `json:"estimated_count,omitempty"`
UniqueEmails int `json:"unique_emails,omitempty"`
TotalRows int `json:"total_rows,omitempty"`
EmailColumn string `json:"email_column,omitempty"`
StatusURL string `json:"status_url,omitempty"`
CreatedAt string `json:"created_at"`
}
// FileJobStatusOptions contains options for getting file job status.
type FileJobStatusOptions struct {
Timeout int `json:"timeout,omitempty"` // Long-polling timeout in seconds (0-300)
}
// FileJobResponse is the response from file verification job status.
type FileJobResponse struct {
JobID string `json:"job_id"`
Status JobStatus `json:"status"`
FileName string `json:"file_name,omitempty"`
TotalEmails int `json:"total_emails"`
ProcessedEmails int `json:"processed_emails"`
ProgressPercent int `json:"progress_percent"`
ValidEmails int `json:"valid_emails"`
InvalidEmails int `json:"invalid_emails"`
UnknownEmails int `json:"unknown_emails"`
RoleEmails int `json:"role_emails"`
CatchallEmails int `json:"catchall_emails"`
DisposableEmails int `json:"disposable_emails"`
CreditsUsed int `json:"credits_used"`
ProcessTimeSeconds float64 `json:"process_time_seconds,omitempty"`
ResultFilePath string `json:"result_file_path,omitempty"`
DownloadURL string `json:"download_url,omitempty"`
CreatedAt string `json:"created_at"`
CompletedAt string `json:"completed_at,omitempty"`
}
// FileResultsOptions contains options for downloading file results.
type FileResultsOptions struct {
Valid *bool `json:"valid,omitempty"`
Invalid *bool `json:"invalid,omitempty"`
Catchall *bool `json:"catchall,omitempty"`
Role *bool `json:"role,omitempty"`
Unknown *bool `json:"unknown,omitempty"`
Disposable *bool `json:"disposable,omitempty"`
Risky *bool `json:"risky,omitempty"`
}
// RateLimit contains rate limit information.
type RateLimit struct {
RequestsPerHour int `json:"requests_per_hour"`
Remaining int `json:"remaining"`
}
// CreditsResponse is the response from credits endpoint.
type CreditsResponse struct {
AccountID string `json:"account_id"`
APIKeyID string `json:"api_key_id"`
APIKeyName string `json:"api_key_name"`
CreditsBalance int `json:"credits_balance"`
CreditsConsumed int `json:"credits_consumed"`
CreditsAdded int `json:"credits_added"`
LastUpdated string `json:"last_updated"`
}
// WebhookConfig contains webhook configuration for creating webhooks.
type WebhookConfig struct {
URL string `json:"url"`
Events []WebhookEvent `json:"events"`
}
// Webhook represents a webhook.
type Webhook struct {
ID string `json:"id"`
URL string `json:"url"`
Events []WebhookEvent `json:"events"`
Secret string `json:"secret,omitempty"` // Only returned on creation
IsActive bool `json:"is_active"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
// WebhooksListResponse is the response from listing webhooks.
type WebhooksListResponse struct {
Webhooks []Webhook `json:"webhooks"`
Total int `json:"total"`
}
// WebhookPayload is the payload sent to webhook endpoints.
type WebhookPayload struct {
Event WebhookEvent `json:"event"`
Timestamp time.Time `json:"timestamp"`
Data map[string]interface{} `json:"data"`
}
// HealthResponse is the response from health check endpoint.
type HealthResponse struct {
Status string `json:"status"`
Time int64 `json:"time"`
}
// APIError represents an API error.
type APIError struct {
Code string `json:"code"`
Message string `json:"message"`
Details string `json:"details,omitempty"`
}
// APIResponse is the generic API response wrapper.
type APIResponse struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
Error *APIError `json:"error,omitempty"`
}