Skip to content

Commit 92bff85

Browse files
docs: improve documentation in types
1 parent a67c529 commit 92bff85

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

src/web3mail/types.ts

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ export type Address = string;
1212

1313
export type TimeStamp = string;
1414

15+
/**
16+
* request to send email in bulk
17+
*
18+
* use `prepareEmailCampaign()` to create a `CampaignRequest`
19+
*
20+
* then use `sendEmailCampaign()` to send the campaign
21+
*/
22+
export type CampaignRequest = BulkRequest;
23+
24+
/**
25+
* authorization signed by the data owner granting access to this contact
26+
*
27+
* `GrantedAccess` are obtained by fetching contacts (e.g. `fetchMyContacts()` or `fetchUserContacts()`)
28+
*
29+
* `GrantedAccess` can be consumed for email campaigns (e.g. `prepareEmailCampaign()` then `sendEmailCampaign()`)
30+
*/
1531
export type GrantedAccess = {
1632
dataset: string;
1733
datasetprice: string;
@@ -139,14 +155,19 @@ export type PrepareEmailCampaignParams = {
139155
};
140156

141157
export type PrepareEmailCampaignResponse = {
142-
campaignRequest: BulkRequest;
158+
/**
159+
* The prepared campaign request
160+
*
161+
* Use this in `sendEmailCampaign()` to start or continue sending the campaign
162+
*/
163+
campaignRequest: CampaignRequest;
143164
};
144165

145166
export type SendEmailCampaignParams = {
146167
/**
147168
* The prepared campaign request from prepareEmailCampaign
148169
*/
149-
campaignRequest: PrepareEmailCampaignResponse['campaignRequest'];
170+
campaignRequest: CampaignRequest;
150171
/**
151172
* Workerpool address or ENS to use for processing
152173
*/
@@ -162,9 +183,21 @@ export type SendEmailCampaignParams = {
162183
};
163184

164185
export type SendEmailCampaignResponse = {
186+
/**
187+
* List of tasks created for the campaign
188+
*/
165189
tasks: Array<{
190+
/**
191+
* ID of the task
192+
*/
166193
taskId: string;
194+
/**
195+
* ID of the deal containing the task
196+
*/
167197
dealId: string;
198+
/**
199+
* Index of the task in the bulk request
200+
*/
168201
bulkIndex: number;
169202
}>;
170203
};

0 commit comments

Comments
 (0)