@emailsherlock/node 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -31
- package/dist/client.d.ts +26 -12
- package/dist/client.js +75 -55
- package/dist/errors.d.ts +8 -10
- package/dist/errors.js +37 -2
- package/dist/generated/apis/AccountApi.d.ts +30 -0
- package/dist/generated/apis/AccountApi.js +51 -0
- package/dist/generated/apis/GuardApi.d.ts +33 -0
- package/dist/generated/apis/GuardApi.js +55 -0
- package/dist/generated/apis/VerifyApi.d.ts +84 -0
- package/dist/generated/apis/VerifyApi.js +172 -0
- package/dist/generated/apis/index.d.ts +3 -0
- package/dist/generated/apis/index.js +5 -0
- package/dist/generated/index.d.ts +3 -0
- package/dist/generated/index.js +5 -0
- package/dist/generated/models/index.d.ts +574 -0
- package/dist/generated/models/index.js +87 -0
- package/dist/generated/runtime.d.ts +181 -0
- package/dist/generated/runtime.js +341 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -2
- package/dist/types.d.ts +8 -82
- package/dist/types.js +5 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EmailSherlock API
|
|
3
|
+
* Verify one email address or a batch over HTTPS with an API key. Authenticate with the X-API-Key header. Billing is user-level credits; each call returns the remaining balance in the X-Credits-Remaining header. Sandbox: a key that starts with es_test_ runs in sandbox mode. It returns deterministic fixtured data on the same endpoints and response shape, never spends credits, and marks every response with X-Sandbox: true. The local part drives the verdict so you can test each branch: valid@, invalid@, catch-all@, disposable@, role@, unknown@ and pending@ pin a result (pending@ yields reason verification_pending, the deferred-batch outcome to retry later); ratelimit@ returns 429 and servererror@ returns 503 so you can exercise error handling. On the async jobs endpoint (POST /v1/verify/jobs), put async@ or slowjob@ in the batch and the sandbox reproduces the real submit-poll-complete lifecycle: the submit returns processing and the job completes after a few seconds, so you can build and test your polling loop before going live; without it, sandbox jobs complete immediately. Any other address maps to a stable result. Live keys start with es_live_. Full reference at https://emailsherlock.com/api/docs
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import * as runtime from '../runtime.js';
|
|
13
|
+
import type { VerifyBatchRequest, VerifyBatchResponse, VerifyJobRequest, VerifyJobResponse, VerifyResultResponse, VerifySingleRequest } from '../models/index.js';
|
|
14
|
+
export interface GetVerifyJobRequest {
|
|
15
|
+
id: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SubmitVerifyJobRequest {
|
|
18
|
+
verifyJobRequest: VerifyJobRequest;
|
|
19
|
+
}
|
|
20
|
+
export interface VerifyBatchOperationRequest {
|
|
21
|
+
verifyBatchRequest: VerifyBatchRequest;
|
|
22
|
+
}
|
|
23
|
+
export interface VerifySingleOperationRequest {
|
|
24
|
+
verifySingleRequest: VerifySingleRequest;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export declare class VerifyApi extends runtime.BaseAPI {
|
|
30
|
+
/**
|
|
31
|
+
* Creates request options for getVerifyJob without sending the request
|
|
32
|
+
*/
|
|
33
|
+
getVerifyJobRequestOpts(requestParameters: GetVerifyJobRequest): Promise<runtime.RequestOpts>;
|
|
34
|
+
/**
|
|
35
|
+
* results is present once the status is completed: one entry per submitted address, in submit order. Results are retained for 7 days after submit.
|
|
36
|
+
* Read the status and results of a verification job.
|
|
37
|
+
*/
|
|
38
|
+
getVerifyJobRaw(requestParameters: GetVerifyJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<VerifyJobResponse>>;
|
|
39
|
+
/**
|
|
40
|
+
* results is present once the status is completed: one entry per submitted address, in submit order. Results are retained for 7 days after submit.
|
|
41
|
+
* Read the status and results of a verification job.
|
|
42
|
+
*/
|
|
43
|
+
getVerifyJob(requestParameters: GetVerifyJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VerifyJobResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Creates request options for submitVerifyJob without sending the request
|
|
46
|
+
*/
|
|
47
|
+
submitVerifyJobRequestOpts(requestParameters: SubmitVerifyJobRequest): Promise<runtime.RequestOpts>;
|
|
48
|
+
/**
|
|
49
|
+
* Every address runs the full pipeline including the SMTP probe, so the results carry definitive inbox verdicts. Poll GET /v1/verify/jobs/{id} until the status is completed. Credits are charged per address at submit; addresses that cannot be processed are refunded automatically.
|
|
50
|
+
* Submit a list of addresses for asynchronous verification.
|
|
51
|
+
*/
|
|
52
|
+
submitVerifyJobRaw(requestParameters: SubmitVerifyJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<VerifyJobResponse>>;
|
|
53
|
+
/**
|
|
54
|
+
* Every address runs the full pipeline including the SMTP probe, so the results carry definitive inbox verdicts. Poll GET /v1/verify/jobs/{id} until the status is completed. Credits are charged per address at submit; addresses that cannot be processed are refunded automatically.
|
|
55
|
+
* Submit a list of addresses for asynchronous verification.
|
|
56
|
+
*/
|
|
57
|
+
submitVerifyJob(requestParameters: SubmitVerifyJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VerifyJobResponse>;
|
|
58
|
+
/**
|
|
59
|
+
* Creates request options for verifyBatch without sending the request
|
|
60
|
+
*/
|
|
61
|
+
verifyBatchRequestOpts(requestParameters: VerifyBatchOperationRequest): Promise<runtime.RequestOpts>;
|
|
62
|
+
/**
|
|
63
|
+
* Each address is processed independently: one bad address yields a per-item error rather than failing the whole call.
|
|
64
|
+
* Verify up to a batch of email addresses in one call.
|
|
65
|
+
*/
|
|
66
|
+
verifyBatchRaw(requestParameters: VerifyBatchOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<VerifyBatchResponse>>;
|
|
67
|
+
/**
|
|
68
|
+
* Each address is processed independently: one bad address yields a per-item error rather than failing the whole call.
|
|
69
|
+
* Verify up to a batch of email addresses in one call.
|
|
70
|
+
*/
|
|
71
|
+
verifyBatch(requestParameters: VerifyBatchOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VerifyBatchResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* Creates request options for verifySingle without sending the request
|
|
74
|
+
*/
|
|
75
|
+
verifySingleRequestOpts(requestParameters: VerifySingleOperationRequest): Promise<runtime.RequestOpts>;
|
|
76
|
+
/**
|
|
77
|
+
* Verify one email address.
|
|
78
|
+
*/
|
|
79
|
+
verifySingleRaw(requestParameters: VerifySingleOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<VerifyResultResponse>>;
|
|
80
|
+
/**
|
|
81
|
+
* Verify one email address.
|
|
82
|
+
*/
|
|
83
|
+
verifySingle(requestParameters: VerifySingleOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VerifyResultResponse>;
|
|
84
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* EmailSherlock API
|
|
5
|
+
* Verify one email address or a batch over HTTPS with an API key. Authenticate with the X-API-Key header. Billing is user-level credits; each call returns the remaining balance in the X-Credits-Remaining header. Sandbox: a key that starts with es_test_ runs in sandbox mode. It returns deterministic fixtured data on the same endpoints and response shape, never spends credits, and marks every response with X-Sandbox: true. The local part drives the verdict so you can test each branch: valid@, invalid@, catch-all@, disposable@, role@, unknown@ and pending@ pin a result (pending@ yields reason verification_pending, the deferred-batch outcome to retry later); ratelimit@ returns 429 and servererror@ returns 503 so you can exercise error handling. On the async jobs endpoint (POST /v1/verify/jobs), put async@ or slowjob@ in the batch and the sandbox reproduces the real submit-poll-complete lifecycle: the submit returns processing and the job completes after a few seconds, so you can build and test your polling loop before going live; without it, sandbox jobs complete immediately. Any other address maps to a stable result. Live keys start with es_live_. Full reference at https://emailsherlock.com/api/docs
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
import * as runtime from '../runtime.js';
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export class VerifyApi extends runtime.BaseAPI {
|
|
19
|
+
/**
|
|
20
|
+
* Creates request options for getVerifyJob without sending the request
|
|
21
|
+
*/
|
|
22
|
+
async getVerifyJobRequestOpts(requestParameters) {
|
|
23
|
+
if (requestParameters['id'] == null) {
|
|
24
|
+
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getVerifyJob().');
|
|
25
|
+
}
|
|
26
|
+
const queryParameters = {};
|
|
27
|
+
const headerParameters = {};
|
|
28
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
29
|
+
headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
|
|
30
|
+
}
|
|
31
|
+
let urlPath = `/v1/verify/jobs/{id}`;
|
|
32
|
+
urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
|
|
33
|
+
return {
|
|
34
|
+
path: urlPath,
|
|
35
|
+
method: 'GET',
|
|
36
|
+
headers: headerParameters,
|
|
37
|
+
query: queryParameters,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* results is present once the status is completed: one entry per submitted address, in submit order. Results are retained for 7 days after submit.
|
|
42
|
+
* Read the status and results of a verification job.
|
|
43
|
+
*/
|
|
44
|
+
async getVerifyJobRaw(requestParameters, initOverrides) {
|
|
45
|
+
const requestOptions = await this.getVerifyJobRequestOpts(requestParameters);
|
|
46
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
47
|
+
return new runtime.JSONApiResponse(response);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* results is present once the status is completed: one entry per submitted address, in submit order. Results are retained for 7 days after submit.
|
|
51
|
+
* Read the status and results of a verification job.
|
|
52
|
+
*/
|
|
53
|
+
async getVerifyJob(requestParameters, initOverrides) {
|
|
54
|
+
const response = await this.getVerifyJobRaw(requestParameters, initOverrides);
|
|
55
|
+
return await response.value();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Creates request options for submitVerifyJob without sending the request
|
|
59
|
+
*/
|
|
60
|
+
async submitVerifyJobRequestOpts(requestParameters) {
|
|
61
|
+
if (requestParameters['verifyJobRequest'] == null) {
|
|
62
|
+
throw new runtime.RequiredError('verifyJobRequest', 'Required parameter "verifyJobRequest" was null or undefined when calling submitVerifyJob().');
|
|
63
|
+
}
|
|
64
|
+
const queryParameters = {};
|
|
65
|
+
const headerParameters = {};
|
|
66
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
67
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
68
|
+
headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
|
|
69
|
+
}
|
|
70
|
+
let urlPath = `/v1/verify/jobs`;
|
|
71
|
+
return {
|
|
72
|
+
path: urlPath,
|
|
73
|
+
method: 'POST',
|
|
74
|
+
headers: headerParameters,
|
|
75
|
+
query: queryParameters,
|
|
76
|
+
body: requestParameters['verifyJobRequest'],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Every address runs the full pipeline including the SMTP probe, so the results carry definitive inbox verdicts. Poll GET /v1/verify/jobs/{id} until the status is completed. Credits are charged per address at submit; addresses that cannot be processed are refunded automatically.
|
|
81
|
+
* Submit a list of addresses for asynchronous verification.
|
|
82
|
+
*/
|
|
83
|
+
async submitVerifyJobRaw(requestParameters, initOverrides) {
|
|
84
|
+
const requestOptions = await this.submitVerifyJobRequestOpts(requestParameters);
|
|
85
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
86
|
+
return new runtime.JSONApiResponse(response);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Every address runs the full pipeline including the SMTP probe, so the results carry definitive inbox verdicts. Poll GET /v1/verify/jobs/{id} until the status is completed. Credits are charged per address at submit; addresses that cannot be processed are refunded automatically.
|
|
90
|
+
* Submit a list of addresses for asynchronous verification.
|
|
91
|
+
*/
|
|
92
|
+
async submitVerifyJob(requestParameters, initOverrides) {
|
|
93
|
+
const response = await this.submitVerifyJobRaw(requestParameters, initOverrides);
|
|
94
|
+
return await response.value();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Creates request options for verifyBatch without sending the request
|
|
98
|
+
*/
|
|
99
|
+
async verifyBatchRequestOpts(requestParameters) {
|
|
100
|
+
if (requestParameters['verifyBatchRequest'] == null) {
|
|
101
|
+
throw new runtime.RequiredError('verifyBatchRequest', 'Required parameter "verifyBatchRequest" was null or undefined when calling verifyBatch().');
|
|
102
|
+
}
|
|
103
|
+
const queryParameters = {};
|
|
104
|
+
const headerParameters = {};
|
|
105
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
106
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
107
|
+
headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
|
|
108
|
+
}
|
|
109
|
+
let urlPath = `/v1/verify/batch`;
|
|
110
|
+
return {
|
|
111
|
+
path: urlPath,
|
|
112
|
+
method: 'POST',
|
|
113
|
+
headers: headerParameters,
|
|
114
|
+
query: queryParameters,
|
|
115
|
+
body: requestParameters['verifyBatchRequest'],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Each address is processed independently: one bad address yields a per-item error rather than failing the whole call.
|
|
120
|
+
* Verify up to a batch of email addresses in one call.
|
|
121
|
+
*/
|
|
122
|
+
async verifyBatchRaw(requestParameters, initOverrides) {
|
|
123
|
+
const requestOptions = await this.verifyBatchRequestOpts(requestParameters);
|
|
124
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
125
|
+
return new runtime.JSONApiResponse(response);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Each address is processed independently: one bad address yields a per-item error rather than failing the whole call.
|
|
129
|
+
* Verify up to a batch of email addresses in one call.
|
|
130
|
+
*/
|
|
131
|
+
async verifyBatch(requestParameters, initOverrides) {
|
|
132
|
+
const response = await this.verifyBatchRaw(requestParameters, initOverrides);
|
|
133
|
+
return await response.value();
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Creates request options for verifySingle without sending the request
|
|
137
|
+
*/
|
|
138
|
+
async verifySingleRequestOpts(requestParameters) {
|
|
139
|
+
if (requestParameters['verifySingleRequest'] == null) {
|
|
140
|
+
throw new runtime.RequiredError('verifySingleRequest', 'Required parameter "verifySingleRequest" was null or undefined when calling verifySingle().');
|
|
141
|
+
}
|
|
142
|
+
const queryParameters = {};
|
|
143
|
+
const headerParameters = {};
|
|
144
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
145
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
146
|
+
headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
|
|
147
|
+
}
|
|
148
|
+
let urlPath = `/v1/verify/single`;
|
|
149
|
+
return {
|
|
150
|
+
path: urlPath,
|
|
151
|
+
method: 'POST',
|
|
152
|
+
headers: headerParameters,
|
|
153
|
+
query: queryParameters,
|
|
154
|
+
body: requestParameters['verifySingleRequest'],
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Verify one email address.
|
|
159
|
+
*/
|
|
160
|
+
async verifySingleRaw(requestParameters, initOverrides) {
|
|
161
|
+
const requestOptions = await this.verifySingleRequestOpts(requestParameters);
|
|
162
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
163
|
+
return new runtime.JSONApiResponse(response);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Verify one email address.
|
|
167
|
+
*/
|
|
168
|
+
async verifySingle(requestParameters, initOverrides) {
|
|
169
|
+
const response = await this.verifySingleRaw(requestParameters, initOverrides);
|
|
170
|
+
return await response.value();
|
|
171
|
+
}
|
|
172
|
+
}
|