@bentonow/bento-node-sdk 0.2.1 → 1.0.5
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/{LICENSE → LICENSE.md} +1 -1
- package/README.md +604 -1031
- package/dist/index.d.ts +9 -9
- package/dist/index.js +1306 -5
- package/dist/sdk/batch/enums.d.ts +8 -8
- package/dist/sdk/batch/errors.d.ts +18 -18
- package/dist/sdk/batch/events.d.ts +71 -71
- package/dist/sdk/batch/index.d.ts +55 -55
- package/dist/sdk/batch/types.d.ts +37 -37
- package/dist/sdk/broadcasts/index.d.ts +26 -0
- package/dist/sdk/broadcasts/types.d.ts +32 -0
- package/dist/sdk/client/errors.d.ts +12 -6
- package/dist/sdk/client/index.d.ts +94 -64
- package/dist/sdk/client/types.d.ts +3 -3
- package/dist/sdk/commands/enums.d.ts +12 -12
- package/dist/sdk/commands/index.d.ts +79 -79
- package/dist/sdk/commands/types.d.ts +32 -32
- package/dist/sdk/email-templates/index.d.ts +21 -0
- package/dist/sdk/email-templates/types.d.ts +23 -0
- package/dist/sdk/enums.d.ts +12 -9
- package/dist/sdk/errors.d.ts +2 -2
- package/dist/sdk/experimental/index.d.ts +75 -57
- package/dist/sdk/experimental/types.d.ts +71 -41
- package/dist/sdk/fields/index.d.ts +29 -29
- package/dist/sdk/fields/types.d.ts +17 -17
- package/dist/sdk/forms/index.d.ts +14 -14
- package/dist/sdk/forms/types.d.ts +28 -28
- package/dist/sdk/index.d.ts +11 -8
- package/dist/sdk/interfaces.d.ts +17 -13
- package/dist/sdk/sequences/index.d.ts +13 -0
- package/dist/sdk/sequences/types.d.ts +18 -0
- package/dist/sdk/stats/index.d.ts +24 -0
- package/dist/sdk/stats/types.d.ts +26 -0
- package/dist/sdk/subscribers/index.d.ts +20 -20
- package/dist/sdk/subscribers/types.d.ts +25 -25
- package/dist/sdk/tags/index.d.ts +20 -20
- package/dist/sdk/tags/types.d.ts +17 -17
- package/dist/sdk/types.d.ts +41 -41
- package/dist/sdk/workflows/index.d.ts +13 -0
- package/dist/sdk/workflows/types.d.ts +18 -0
- package/dist/versions/v1/index.d.ts +168 -132
- package/dist/versions/v1/types.d.ts +31 -31
- package/package.json +31 -44
- package/src/sdk/batch/events.ts +1 -1
- package/src/sdk/batch/index.ts +15 -22
- package/src/sdk/broadcasts/index.ts +44 -0
- package/src/sdk/broadcasts/types.ts +38 -0
- package/src/sdk/client/errors.ts +14 -0
- package/src/sdk/client/index.ts +205 -49
- package/src/sdk/commands/index.ts +54 -89
- package/src/sdk/email-templates/index.ts +39 -0
- package/src/sdk/email-templates/types.ts +27 -0
- package/src/sdk/enums.ts +3 -0
- package/src/sdk/experimental/index.ts +44 -26
- package/src/sdk/experimental/types.ts +35 -0
- package/src/sdk/fields/index.ts +1 -3
- package/src/sdk/forms/index.ts +4 -9
- package/src/sdk/forms/types.ts +1 -7
- package/src/sdk/index.ts +3 -0
- package/src/sdk/interfaces.ts +4 -0
- package/src/sdk/sequences/index.ts +21 -0
- package/src/sdk/sequences/types.ts +21 -0
- package/src/sdk/stats/index.ts +37 -0
- package/src/sdk/stats/types.ts +28 -0
- package/src/sdk/subscribers/index.ts +5 -15
- package/src/sdk/tags/index.ts +1 -3
- package/src/sdk/types.ts +1 -1
- package/src/sdk/workflows/index.ts +21 -0
- package/src/sdk/workflows/types.ts +21 -0
- package/src/versions/v1/index.ts +65 -10
- package/dist/bento-node-sdk.cjs.development.js +0 -2071
- package/dist/bento-node-sdk.cjs.development.js.map +0 -1
- package/dist/bento-node-sdk.cjs.production.min.js +0 -2
- package/dist/bento-node-sdk.cjs.production.min.js.map +0 -1
- package/dist/bento-node-sdk.esm.js +0 -2063
- package/dist/bento-node-sdk.esm.js.map +0 -1
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import type { BentoClient } from '../client';
|
|
2
|
-
import type { Subscriber } from '../subscribers/types';
|
|
3
|
-
import type { AddFieldParameters, AddTagParameters, ChangeEmailParameters, RemoveFieldParameters, RemoveTagParameters, SubscribeParameters, UnsubscribeParameters } from './types';
|
|
4
|
-
export declare class BentoCommands<S> {
|
|
5
|
-
private readonly _client;
|
|
6
|
-
private readonly _url;
|
|
7
|
-
constructor(_client: BentoClient);
|
|
8
|
-
/**
|
|
9
|
-
* **This does not trigger automations!** - If you wish to trigger automations, please use the
|
|
10
|
-
* core module's `tagSubscriber` method.
|
|
11
|
-
*
|
|
12
|
-
* Adds a tag to the subscriber with the matching email.
|
|
13
|
-
*
|
|
14
|
-
* Note that both the tag and the subscriber will be created if either is missing
|
|
15
|
-
* from system.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* @param parameters \{ email: string, tagName: string \}
|
|
19
|
-
* @returns Promise\<Subscriber | null\>
|
|
20
|
-
*/
|
|
21
|
-
addTag(parameters: AddTagParameters): Promise<Subscriber<S> | null>;
|
|
22
|
-
/**
|
|
23
|
-
* Removes the specified tag from the subscriber with the matching email.
|
|
24
|
-
*
|
|
25
|
-
* @param parameters \{ email: string, tagName: string \}
|
|
26
|
-
* @returns Promise\<Subscriber | null\>
|
|
27
|
-
*/
|
|
28
|
-
removeTag(parameters: RemoveTagParameters): Promise<Subscriber<S> | null>;
|
|
29
|
-
/**
|
|
30
|
-
* **This does not trigger automations!** - If you wish to trigger automations, please use the
|
|
31
|
-
* core module's `updateFields` method.
|
|
32
|
-
*
|
|
33
|
-
* Adds a field to the subscriber with the matching email.
|
|
34
|
-
*
|
|
35
|
-
* Note that both the field and the subscriber will be created if either is missing
|
|
36
|
-
* from system.
|
|
37
|
-
*
|
|
38
|
-
* @param parameters \{ email: string, field: \{ key: string; value: string; \} \}
|
|
39
|
-
* @returns Promise\<Subscriber | null\>
|
|
40
|
-
*/
|
|
41
|
-
addField(parameters: AddFieldParameters<S>): Promise<Subscriber<S> | null>;
|
|
42
|
-
/**
|
|
43
|
-
* Removes a field to the subscriber with the matching email.
|
|
44
|
-
*
|
|
45
|
-
* @param parameters \{ email: string, fieldName: string \}
|
|
46
|
-
* @returns Promise\<Subscriber | null\>
|
|
47
|
-
*/
|
|
48
|
-
removeField(parameters: RemoveFieldParameters<S>): Promise<Subscriber<S> | null>;
|
|
49
|
-
/**
|
|
50
|
-
* **This does not trigger automations!** - If you wish to trigger automations, please use the
|
|
51
|
-
* core module's `addSubscriber` method.
|
|
52
|
-
*
|
|
53
|
-
* Subscribes the supplied email to Bento. If the email does not exist, it is created.
|
|
54
|
-
* If the subscriber had previously unsubscribed, they will be re-subscribed.
|
|
55
|
-
*
|
|
56
|
-
* @param parameters \{ email: string \}
|
|
57
|
-
* @returns Promise\<Subscriber | null\>
|
|
58
|
-
*/
|
|
59
|
-
subscribe(parameters: SubscribeParameters): Promise<Subscriber<S> | null>;
|
|
60
|
-
/**
|
|
61
|
-
* **This does not trigger automations!** - If you wish to trigger automations, please use the
|
|
62
|
-
* core module's `removeSubscriber` method.
|
|
63
|
-
*
|
|
64
|
-
* Unsubscribes the supplied email to Bento. If the email does not exist, it is created and
|
|
65
|
-
* immediately unsubscribed. If they had already unsubscribed, the `unsubscribed_at` property
|
|
66
|
-
* is updated.
|
|
67
|
-
*
|
|
68
|
-
* @param parameters \{ email: string \}
|
|
69
|
-
* @returns Promise\<Subscriber | null\>
|
|
70
|
-
*/
|
|
71
|
-
unsubscribe(parameters: UnsubscribeParameters): Promise<Subscriber<S> | null>;
|
|
72
|
-
/**
|
|
73
|
-
* Updates the email of a user in Bento.
|
|
74
|
-
*
|
|
75
|
-
* @param parameters \{ oldEmail: string, newEmail: string \}
|
|
76
|
-
* @returns Promise\<Subscriber | null\>
|
|
77
|
-
*/
|
|
78
|
-
changeEmail(parameters: ChangeEmailParameters): Promise<Subscriber<S> | null>;
|
|
79
|
-
}
|
|
1
|
+
import type { BentoClient } from '../client';
|
|
2
|
+
import type { Subscriber } from '../subscribers/types';
|
|
3
|
+
import type { AddFieldParameters, AddTagParameters, ChangeEmailParameters, RemoveFieldParameters, RemoveTagParameters, SubscribeParameters, UnsubscribeParameters } from './types';
|
|
4
|
+
export declare class BentoCommands<S> {
|
|
5
|
+
private readonly _client;
|
|
6
|
+
private readonly _url;
|
|
7
|
+
constructor(_client: BentoClient);
|
|
8
|
+
/**
|
|
9
|
+
* **This does not trigger automations!** - If you wish to trigger automations, please use the
|
|
10
|
+
* core module's `tagSubscriber` method.
|
|
11
|
+
*
|
|
12
|
+
* Adds a tag to the subscriber with the matching email.
|
|
13
|
+
*
|
|
14
|
+
* Note that both the tag and the subscriber will be created if either is missing
|
|
15
|
+
* from system.
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
* @param parameters \{ email: string, tagName: string \}
|
|
19
|
+
* @returns Promise\<Subscriber | null\>
|
|
20
|
+
*/
|
|
21
|
+
addTag(parameters: AddTagParameters): Promise<Subscriber<S> | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Removes the specified tag from the subscriber with the matching email.
|
|
24
|
+
*
|
|
25
|
+
* @param parameters \{ email: string, tagName: string \}
|
|
26
|
+
* @returns Promise\<Subscriber | null\>
|
|
27
|
+
*/
|
|
28
|
+
removeTag(parameters: RemoveTagParameters): Promise<Subscriber<S> | null>;
|
|
29
|
+
/**
|
|
30
|
+
* **This does not trigger automations!** - If you wish to trigger automations, please use the
|
|
31
|
+
* core module's `updateFields` method.
|
|
32
|
+
*
|
|
33
|
+
* Adds a field to the subscriber with the matching email.
|
|
34
|
+
*
|
|
35
|
+
* Note that both the field and the subscriber will be created if either is missing
|
|
36
|
+
* from system.
|
|
37
|
+
*
|
|
38
|
+
* @param parameters \{ email: string, field: \{ key: string; value: string; \} \}
|
|
39
|
+
* @returns Promise\<Subscriber | null\>
|
|
40
|
+
*/
|
|
41
|
+
addField(parameters: AddFieldParameters<S>): Promise<Subscriber<S> | null>;
|
|
42
|
+
/**
|
|
43
|
+
* Removes a field to the subscriber with the matching email.
|
|
44
|
+
*
|
|
45
|
+
* @param parameters \{ email: string, fieldName: string \}
|
|
46
|
+
* @returns Promise\<Subscriber | null\>
|
|
47
|
+
*/
|
|
48
|
+
removeField(parameters: RemoveFieldParameters<S>): Promise<Subscriber<S> | null>;
|
|
49
|
+
/**
|
|
50
|
+
* **This does not trigger automations!** - If you wish to trigger automations, please use the
|
|
51
|
+
* core module's `addSubscriber` method.
|
|
52
|
+
*
|
|
53
|
+
* Subscribes the supplied email to Bento. If the email does not exist, it is created.
|
|
54
|
+
* If the subscriber had previously unsubscribed, they will be re-subscribed.
|
|
55
|
+
*
|
|
56
|
+
* @param parameters \{ email: string \}
|
|
57
|
+
* @returns Promise\<Subscriber | null\>
|
|
58
|
+
*/
|
|
59
|
+
subscribe(parameters: SubscribeParameters): Promise<Subscriber<S> | null>;
|
|
60
|
+
/**
|
|
61
|
+
* **This does not trigger automations!** - If you wish to trigger automations, please use the
|
|
62
|
+
* core module's `removeSubscriber` method.
|
|
63
|
+
*
|
|
64
|
+
* Unsubscribes the supplied email to Bento. If the email does not exist, it is created and
|
|
65
|
+
* immediately unsubscribed. If they had already unsubscribed, the `unsubscribed_at` property
|
|
66
|
+
* is updated.
|
|
67
|
+
*
|
|
68
|
+
* @param parameters \{ email: string \}
|
|
69
|
+
* @returns Promise\<Subscriber | null\>
|
|
70
|
+
*/
|
|
71
|
+
unsubscribe(parameters: UnsubscribeParameters): Promise<Subscriber<S> | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Updates the email of a user in Bento.
|
|
74
|
+
*
|
|
75
|
+
* @param parameters \{ oldEmail: string, newEmail: string \}
|
|
76
|
+
* @returns Promise\<Subscriber | null\>
|
|
77
|
+
*/
|
|
78
|
+
changeEmail(parameters: ChangeEmailParameters): Promise<Subscriber<S> | null>;
|
|
79
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Command Method Parameter Types
|
|
3
|
-
*/
|
|
4
|
-
export type AddTagParameters = {
|
|
5
|
-
email: string;
|
|
6
|
-
tagName: string;
|
|
7
|
-
};
|
|
8
|
-
export type RemoveTagParameters = {
|
|
9
|
-
email: string;
|
|
10
|
-
tagName: string;
|
|
11
|
-
};
|
|
12
|
-
export type AddFieldParameters<S> = {
|
|
13
|
-
email: string;
|
|
14
|
-
field: {
|
|
15
|
-
key: keyof S;
|
|
16
|
-
value: unknown;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export type RemoveFieldParameters<S> = {
|
|
20
|
-
email: string;
|
|
21
|
-
fieldName: keyof S;
|
|
22
|
-
};
|
|
23
|
-
export type SubscribeParameters = {
|
|
24
|
-
email: string;
|
|
25
|
-
};
|
|
26
|
-
export type UnsubscribeParameters = {
|
|
27
|
-
email: string;
|
|
28
|
-
};
|
|
29
|
-
export type ChangeEmailParameters = {
|
|
30
|
-
oldEmail: string;
|
|
31
|
-
newEmail: string;
|
|
32
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Command Method Parameter Types
|
|
3
|
+
*/
|
|
4
|
+
export type AddTagParameters = {
|
|
5
|
+
email: string;
|
|
6
|
+
tagName: string;
|
|
7
|
+
};
|
|
8
|
+
export type RemoveTagParameters = {
|
|
9
|
+
email: string;
|
|
10
|
+
tagName: string;
|
|
11
|
+
};
|
|
12
|
+
export type AddFieldParameters<S> = {
|
|
13
|
+
email: string;
|
|
14
|
+
field: {
|
|
15
|
+
key: keyof S;
|
|
16
|
+
value: unknown;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type RemoveFieldParameters<S> = {
|
|
20
|
+
email: string;
|
|
21
|
+
fieldName: keyof S;
|
|
22
|
+
};
|
|
23
|
+
export type SubscribeParameters = {
|
|
24
|
+
email: string;
|
|
25
|
+
};
|
|
26
|
+
export type UnsubscribeParameters = {
|
|
27
|
+
email: string;
|
|
28
|
+
};
|
|
29
|
+
export type ChangeEmailParameters = {
|
|
30
|
+
oldEmail: string;
|
|
31
|
+
newEmail: string;
|
|
32
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BentoClient } from '../client';
|
|
2
|
+
import type { EmailTemplate, GetEmailTemplateParameters, UpdateEmailTemplateParameters } from './types';
|
|
3
|
+
export declare class BentoEmailTemplates {
|
|
4
|
+
private readonly _client;
|
|
5
|
+
private readonly _url;
|
|
6
|
+
constructor(_client: BentoClient);
|
|
7
|
+
/**
|
|
8
|
+
* Returns a single email template by ID.
|
|
9
|
+
*
|
|
10
|
+
* @param parameters GetEmailTemplateParameters
|
|
11
|
+
* @returns Promise\<EmailTemplate | null\>
|
|
12
|
+
*/
|
|
13
|
+
getEmailTemplate(parameters: GetEmailTemplateParameters): Promise<EmailTemplate | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Updates an email template's subject and/or HTML content.
|
|
16
|
+
*
|
|
17
|
+
* @param parameters UpdateEmailTemplateParameters
|
|
18
|
+
* @returns Promise\<EmailTemplate | null\>
|
|
19
|
+
*/
|
|
20
|
+
updateEmailTemplate(parameters: UpdateEmailTemplateParameters): Promise<EmailTemplate | null>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BaseEntity } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Email Template Method Parameter Types
|
|
4
|
+
*/
|
|
5
|
+
export type GetEmailTemplateParameters = {
|
|
6
|
+
id: number;
|
|
7
|
+
};
|
|
8
|
+
export type UpdateEmailTemplateParameters = {
|
|
9
|
+
id: number;
|
|
10
|
+
subject?: string;
|
|
11
|
+
html?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Core Email Template Types
|
|
15
|
+
*/
|
|
16
|
+
export type EmailTemplateAttributes = {
|
|
17
|
+
name: string;
|
|
18
|
+
subject: string;
|
|
19
|
+
html: string;
|
|
20
|
+
created_at: string;
|
|
21
|
+
stats: Record<string, unknown> | null;
|
|
22
|
+
};
|
|
23
|
+
export type EmailTemplate = BaseEntity<EmailTemplateAttributes>;
|
package/dist/sdk/enums.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core Enums
|
|
3
|
-
*/
|
|
4
|
-
export declare enum EntityType {
|
|
5
|
-
EVENTS = "events",
|
|
6
|
-
TAGS = "tags",
|
|
7
|
-
VISITORS = "visitors",
|
|
8
|
-
VISITORS_FIELDS = "visitors-fields"
|
|
9
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Core Enums
|
|
3
|
+
*/
|
|
4
|
+
export declare enum EntityType {
|
|
5
|
+
EVENTS = "events",
|
|
6
|
+
TAGS = "tags",
|
|
7
|
+
VISITORS = "visitors",
|
|
8
|
+
VISITORS_FIELDS = "visitors-fields",
|
|
9
|
+
SEQUENCES = "sequences",
|
|
10
|
+
WORKFLOWS = "workflows",
|
|
11
|
+
EMAIL_TEMPLATES = "email_templates"
|
|
12
|
+
}
|
package/dist/sdk/errors.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './batch/errors';
|
|
2
|
-
export * from './client/errors';
|
|
1
|
+
export * from './batch/errors';
|
|
2
|
+
export * from './client/errors';
|
|
@@ -1,57 +1,75 @@
|
|
|
1
|
-
import type { BentoClient } from '../client';
|
|
2
|
-
import type { LocationData } from '../types';
|
|
3
|
-
import type { BlacklistParameters, BlacklistResponse, GeolocateParameters, GuessGenderParameters, GuessGenderResponse, ValidateEmailParameters } from './types';
|
|
4
|
-
export declare class BentoExperimental {
|
|
5
|
-
private readonly _client;
|
|
6
|
-
private readonly _url;
|
|
7
|
-
constructor(_client: BentoClient);
|
|
8
|
-
/**
|
|
9
|
-
* **EXPERIMENTAL** -
|
|
10
|
-
* This functionality is experimental and may change or stop working at any time.
|
|
11
|
-
*
|
|
12
|
-
* Attempts to validate the email. You can provide additional information to further
|
|
13
|
-
* refine the validation.
|
|
14
|
-
*
|
|
15
|
-
* If a name is provided, it compares it against the US Census Data, and so the results
|
|
16
|
-
* may be biased.
|
|
17
|
-
*
|
|
18
|
-
* @param parameters
|
|
19
|
-
* @returns Promise\<boolean\>
|
|
20
|
-
*/
|
|
21
|
-
validateEmail(parameters: ValidateEmailParameters): Promise<boolean>;
|
|
22
|
-
/**
|
|
23
|
-
* **EXPERIMENTAL** -
|
|
24
|
-
* This functionality is experimental and may change or stop working at any time.
|
|
25
|
-
*
|
|
26
|
-
* Attempts to guess the gender of the person given a provided name. It compares
|
|
27
|
-
* the name against the US Census Data, and so the results may be biased.
|
|
28
|
-
*
|
|
29
|
-
* It is possible for the gender to be unknown if the system cannot confidently
|
|
30
|
-
* conclude what gender it may be.
|
|
31
|
-
*
|
|
32
|
-
* @param parameters
|
|
33
|
-
* @returns Promise\<GuessGenderResponse\>
|
|
34
|
-
*/
|
|
35
|
-
guessGender(parameters: GuessGenderParameters): Promise<GuessGenderResponse>;
|
|
36
|
-
/**
|
|
37
|
-
* **EXPERIMENTAL** -
|
|
38
|
-
* This functionality is experimental and may change or stop working at any time.
|
|
39
|
-
*
|
|
40
|
-
* Attempts to provide location data given a provided IP address.
|
|
41
|
-
*
|
|
42
|
-
* @param parameters
|
|
43
|
-
* @returns Promise\<GeolocateResponse\>
|
|
44
|
-
*/
|
|
45
|
-
geolocate(parameters: GeolocateParameters): Promise<LocationData | null>;
|
|
46
|
-
/**
|
|
47
|
-
* **EXPERIMENTAL** -
|
|
48
|
-
* This functionality is experimental and may change or stop working at any time.
|
|
49
|
-
*
|
|
50
|
-
* Looks up the provided URL or IP Address against various blacklists to see if the site has been
|
|
51
|
-
* blacklisted anywhere.
|
|
52
|
-
*
|
|
53
|
-
* @param parameters
|
|
54
|
-
* @returns Promise\<BlacklistResponse\>
|
|
55
|
-
*/
|
|
56
|
-
checkBlacklist(parameters: BlacklistParameters): Promise<BlacklistResponse>;
|
|
57
|
-
|
|
1
|
+
import type { BentoClient } from '../client';
|
|
2
|
+
import type { LocationData } from '../types';
|
|
3
|
+
import type { BlacklistCheckInput, BlacklistParameters, BlacklistResponse, BlacklistResult, ContentModerationResult, GeolocateParameters, GuessGenderParameters, GuessGenderResponse, ValidateEmailParameters } from './types';
|
|
4
|
+
export declare class BentoExperimental {
|
|
5
|
+
private readonly _client;
|
|
6
|
+
private readonly _url;
|
|
7
|
+
constructor(_client: BentoClient);
|
|
8
|
+
/**
|
|
9
|
+
* **EXPERIMENTAL** -
|
|
10
|
+
* This functionality is experimental and may change or stop working at any time.
|
|
11
|
+
*
|
|
12
|
+
* Attempts to validate the email. You can provide additional information to further
|
|
13
|
+
* refine the validation.
|
|
14
|
+
*
|
|
15
|
+
* If a name is provided, it compares it against the US Census Data, and so the results
|
|
16
|
+
* may be biased.
|
|
17
|
+
*
|
|
18
|
+
* @param parameters
|
|
19
|
+
* @returns Promise\<boolean\>
|
|
20
|
+
*/
|
|
21
|
+
validateEmail(parameters: ValidateEmailParameters): Promise<boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* **EXPERIMENTAL** -
|
|
24
|
+
* This functionality is experimental and may change or stop working at any time.
|
|
25
|
+
*
|
|
26
|
+
* Attempts to guess the gender of the person given a provided name. It compares
|
|
27
|
+
* the name against the US Census Data, and so the results may be biased.
|
|
28
|
+
*
|
|
29
|
+
* It is possible for the gender to be unknown if the system cannot confidently
|
|
30
|
+
* conclude what gender it may be.
|
|
31
|
+
*
|
|
32
|
+
* @param parameters
|
|
33
|
+
* @returns Promise\<GuessGenderResponse\>
|
|
34
|
+
*/
|
|
35
|
+
guessGender(parameters: GuessGenderParameters): Promise<GuessGenderResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* **EXPERIMENTAL** -
|
|
38
|
+
* This functionality is experimental and may change or stop working at any time.
|
|
39
|
+
*
|
|
40
|
+
* Attempts to provide location data given a provided IP address.
|
|
41
|
+
*
|
|
42
|
+
* @param parameters
|
|
43
|
+
* @returns Promise\<GeolocateResponse\>
|
|
44
|
+
*/
|
|
45
|
+
geolocate(parameters: GeolocateParameters): Promise<LocationData | null>;
|
|
46
|
+
/**
|
|
47
|
+
* **EXPERIMENTAL** -
|
|
48
|
+
* This functionality is experimental and may change or stop working at any time.
|
|
49
|
+
*
|
|
50
|
+
* Looks up the provided URL or IP Address against various blacklists to see if the site has been
|
|
51
|
+
* blacklisted anywhere.
|
|
52
|
+
*
|
|
53
|
+
* @param parameters
|
|
54
|
+
* @returns Promise\<BlacklistResponse\>
|
|
55
|
+
*/
|
|
56
|
+
checkBlacklist(parameters: BlacklistParameters): Promise<BlacklistResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a domain or IP is blacklisted
|
|
59
|
+
* @param input Domain or IP to check
|
|
60
|
+
* @returns Promise<BlacklistResult>
|
|
61
|
+
*/
|
|
62
|
+
getBlacklistStatus(input: BlacklistCheckInput): Promise<BlacklistResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Performs content moderation on provided text
|
|
65
|
+
* @param content Text content to moderate
|
|
66
|
+
* @returns Promise<ContentModerationResult>
|
|
67
|
+
*/
|
|
68
|
+
getContentModeration(content: string): Promise<ContentModerationResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Gets geolocation data for an IP address
|
|
71
|
+
* @param ipAddress IP address to geolocate
|
|
72
|
+
* @returns Promise<LocationData>
|
|
73
|
+
*/
|
|
74
|
+
geoLocateIP(ipAddress: string): Promise<LocationData>;
|
|
75
|
+
}
|
|
@@ -1,41 +1,71 @@
|
|
|
1
|
-
import type { LocationData } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Experimental Method Parameter Types
|
|
4
|
-
*/
|
|
5
|
-
export type ValidateEmailParameters = {
|
|
6
|
-
email: string;
|
|
7
|
-
ip?: string;
|
|
8
|
-
name?: string;
|
|
9
|
-
userAgent?: string;
|
|
10
|
-
};
|
|
11
|
-
export type GuessGenderParameters = {
|
|
12
|
-
name: string;
|
|
13
|
-
};
|
|
14
|
-
export type GeolocateParameters = {
|
|
15
|
-
ip: string;
|
|
16
|
-
};
|
|
17
|
-
export type BlacklistParameters = {
|
|
18
|
-
domain: string;
|
|
19
|
-
ip?: never;
|
|
20
|
-
} | {
|
|
21
|
-
domain?: never;
|
|
22
|
-
ip: string;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
export type
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
import type { LocationData } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Experimental Method Parameter Types
|
|
4
|
+
*/
|
|
5
|
+
export type ValidateEmailParameters = {
|
|
6
|
+
email: string;
|
|
7
|
+
ip?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
userAgent?: string;
|
|
10
|
+
};
|
|
11
|
+
export type GuessGenderParameters = {
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
export type GeolocateParameters = {
|
|
15
|
+
ip: string;
|
|
16
|
+
};
|
|
17
|
+
export type BlacklistParameters = {
|
|
18
|
+
domain: string;
|
|
19
|
+
ip?: never;
|
|
20
|
+
} | {
|
|
21
|
+
domain?: never;
|
|
22
|
+
ip: string;
|
|
23
|
+
};
|
|
24
|
+
export type BlacklistCheckInput = {
|
|
25
|
+
domain?: string;
|
|
26
|
+
ipAddress?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Experimental Method Response Types
|
|
30
|
+
*/
|
|
31
|
+
export type ValidateEmailResponse = {
|
|
32
|
+
valid: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type GuessGenderResponse = {
|
|
35
|
+
confidence: number | null;
|
|
36
|
+
gender: string | null;
|
|
37
|
+
};
|
|
38
|
+
export type GeolocateResponse = Partial<LocationData>;
|
|
39
|
+
export type BlacklistResponse = {
|
|
40
|
+
description: string;
|
|
41
|
+
query: string;
|
|
42
|
+
results: {
|
|
43
|
+
[key: string]: boolean;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export type BlacklistResult = {
|
|
47
|
+
description: string;
|
|
48
|
+
query: string;
|
|
49
|
+
results: Record<string, boolean>;
|
|
50
|
+
};
|
|
51
|
+
export type ContentModerationResult = {
|
|
52
|
+
flagged: boolean;
|
|
53
|
+
categories: {
|
|
54
|
+
hate: boolean;
|
|
55
|
+
'hate/threatening': boolean;
|
|
56
|
+
'self-harm': boolean;
|
|
57
|
+
sexual: boolean;
|
|
58
|
+
'sexual/minors': boolean;
|
|
59
|
+
violence: boolean;
|
|
60
|
+
'violence/graphic': boolean;
|
|
61
|
+
};
|
|
62
|
+
category_scores: {
|
|
63
|
+
hate: number;
|
|
64
|
+
'hate/threatening': number;
|
|
65
|
+
'self-harm': number;
|
|
66
|
+
sexual: number;
|
|
67
|
+
'sexual/minors': number;
|
|
68
|
+
violence: number;
|
|
69
|
+
'violence/graphic': number;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import type { BentoClient } from '../client';
|
|
2
|
-
import type { CreateFieldParameters, Field } from './types';
|
|
3
|
-
export declare class BentoFields {
|
|
4
|
-
private readonly _client;
|
|
5
|
-
private readonly _url;
|
|
6
|
-
constructor(_client: BentoClient);
|
|
7
|
-
/**
|
|
8
|
-
* Returns all of the fields for the site.
|
|
9
|
-
*
|
|
10
|
-
* @returns Promise<Field[]>
|
|
11
|
-
*/
|
|
12
|
-
getFields(): Promise<Field[] | null>;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a field inside of Bento. The name of the field is automatically generated
|
|
15
|
-
* from the key that is passed in upon creation. For example
|
|
16
|
-
* - Key: `thisIsAKey`
|
|
17
|
-
* Name: `This Is A Key`
|
|
18
|
-
* - Key: `this is a key`
|
|
19
|
-
* Name: `This Is A Key`
|
|
20
|
-
* - Key: `this-is-a-key`
|
|
21
|
-
* Name: `This Is A Key`
|
|
22
|
-
* - Key: `this_is_a_key`
|
|
23
|
-
* Name: `This Is A Key`
|
|
24
|
-
*
|
|
25
|
-
* @param parameters \{ key: string \}
|
|
26
|
-
* @returns Promise<Field[]>
|
|
27
|
-
*/
|
|
28
|
-
createField(parameters: CreateFieldParameters): Promise<Field[] | null>;
|
|
29
|
-
}
|
|
1
|
+
import type { BentoClient } from '../client';
|
|
2
|
+
import type { CreateFieldParameters, Field } from './types';
|
|
3
|
+
export declare class BentoFields {
|
|
4
|
+
private readonly _client;
|
|
5
|
+
private readonly _url;
|
|
6
|
+
constructor(_client: BentoClient);
|
|
7
|
+
/**
|
|
8
|
+
* Returns all of the fields for the site.
|
|
9
|
+
*
|
|
10
|
+
* @returns Promise<Field[]>
|
|
11
|
+
*/
|
|
12
|
+
getFields(): Promise<Field[] | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a field inside of Bento. The name of the field is automatically generated
|
|
15
|
+
* from the key that is passed in upon creation. For example
|
|
16
|
+
* - Key: `thisIsAKey`
|
|
17
|
+
* Name: `This Is A Key`
|
|
18
|
+
* - Key: `this is a key`
|
|
19
|
+
* Name: `This Is A Key`
|
|
20
|
+
* - Key: `this-is-a-key`
|
|
21
|
+
* Name: `This Is A Key`
|
|
22
|
+
* - Key: `this_is_a_key`
|
|
23
|
+
* Name: `This Is A Key`
|
|
24
|
+
*
|
|
25
|
+
* @param parameters \{ key: string \}
|
|
26
|
+
* @returns Promise<Field[]>
|
|
27
|
+
*/
|
|
28
|
+
createField(parameters: CreateFieldParameters): Promise<Field[] | null>;
|
|
29
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { BaseEntity } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Field Method Parameter Types
|
|
4
|
-
*/
|
|
5
|
-
export type CreateFieldParameters = {
|
|
6
|
-
key: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Core Field Types
|
|
10
|
-
*/
|
|
11
|
-
export type FieldAttributes = {
|
|
12
|
-
created_at: string;
|
|
13
|
-
key: string;
|
|
14
|
-
name: string;
|
|
15
|
-
whitelisted: boolean | null;
|
|
16
|
-
};
|
|
17
|
-
export type Field = BaseEntity<FieldAttributes>;
|
|
1
|
+
import type { BaseEntity } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Field Method Parameter Types
|
|
4
|
+
*/
|
|
5
|
+
export type CreateFieldParameters = {
|
|
6
|
+
key: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Core Field Types
|
|
10
|
+
*/
|
|
11
|
+
export type FieldAttributes = {
|
|
12
|
+
created_at: string;
|
|
13
|
+
key: string;
|
|
14
|
+
name: string;
|
|
15
|
+
whitelisted: boolean | null;
|
|
16
|
+
};
|
|
17
|
+
export type Field = BaseEntity<FieldAttributes>;
|