@knocklabs/node 0.4.11 → 0.4.13
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/dist/package.json +1 -1
- package/dist/src/resources/objects/index.d.ts +2 -1
- package/dist/src/resources/objects/index.js +6 -0
- package/dist/src/resources/objects/interfaces.d.ts +5 -1
- package/dist/src/resources/users/index.d.ts +2 -1
- package/dist/src/resources/users/index.js +6 -0
- package/dist/src/resources/users/interfaces.d.ts +7 -0
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChannelData, CommonMetadata, SetChannelDataProperties, PaginatedResponse, ChannelType } from "../../common/interfaces";
|
|
2
2
|
import { Knock } from "../../knock";
|
|
3
|
-
import { BulkSetObjectOption, Object, SetObjectProperties } from "./interfaces";
|
|
3
|
+
import { BulkSetObjectOption, ListObjectOptions, Object, SetObjectProperties } from "./interfaces";
|
|
4
4
|
import { BulkOperation } from "../bulk_operations/interfaces";
|
|
5
5
|
import { ListMessagesOptions, Message } from "../messages/interfaces";
|
|
6
6
|
import { ChannelTypePreferences, PreferenceOptions, PreferenceSet, SetPreferencesProperties, WorkflowPreferences, WorkflowPreferenceSetting } from "../preferences/interfaces";
|
|
@@ -9,6 +9,7 @@ export declare class Objects {
|
|
|
9
9
|
constructor(knock: Knock);
|
|
10
10
|
get<T = CommonMetadata>(collection: string, id: string): Promise<Object<T>>;
|
|
11
11
|
set<T = CommonMetadata>(collection: string, id: string, properties: SetObjectProperties): Promise<Object<T>>;
|
|
12
|
+
list<T = CommonMetadata>(collection: string, filteringOptions?: ListObjectOptions): Promise<PaginatedResponse<Object<T>>>;
|
|
12
13
|
bulkSet(collection: string, objects: BulkSetObjectOption[]): Promise<BulkOperation>;
|
|
13
14
|
delete(collection: string, id: string): Promise<null>;
|
|
14
15
|
bulkDelete(collection: string, objectIds: string[]): Promise<BulkOperation>;
|
|
@@ -27,6 +27,12 @@ class Objects {
|
|
|
27
27
|
return data;
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
list(collection, filteringOptions = {}) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const { data } = yield this.knock.get(`/v1/objects/${collection}`, filteringOptions);
|
|
33
|
+
return data;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
30
36
|
bulkSet(collection, objects) {
|
|
31
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
38
|
const attrs = { objects };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommonMetadata } from "../../common/interfaces";
|
|
1
|
+
import { CommonMetadata, PaginationOptions } from "../../common/interfaces";
|
|
2
2
|
export interface ObjectRef {
|
|
3
3
|
collection: string;
|
|
4
4
|
id: string;
|
|
@@ -19,3 +19,7 @@ export interface BulkSetObjectOption {
|
|
|
19
19
|
name?: string;
|
|
20
20
|
[key: string]: any;
|
|
21
21
|
}
|
|
22
|
+
export interface ListObjectOptions extends PaginationOptions {
|
|
23
|
+
object_id?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
}
|
|
@@ -3,13 +3,14 @@ import { BulkOperation } from "../bulk_operations/interfaces";
|
|
|
3
3
|
import { ChannelTypePreferences, PreferenceOptions, PreferenceSet, SetPreferencesProperties, WorkflowPreferences, WorkflowPreferenceSetting } from "../preferences/interfaces";
|
|
4
4
|
import { ListMessagesOptions, Message } from "../messages/interfaces";
|
|
5
5
|
import { Knock } from "../../knock";
|
|
6
|
-
import { BulkIdentifyUser, IdentifyProperties, User, UserFeedOptions } from "./interfaces";
|
|
6
|
+
import { BulkIdentifyUser, IdentifyProperties, ListUserOptions, User, UserFeedOptions } from "./interfaces";
|
|
7
7
|
export declare class Users {
|
|
8
8
|
readonly knock: Knock;
|
|
9
9
|
constructor(knock: Knock);
|
|
10
10
|
identify(userId: string, properties?: IdentifyProperties): Promise<User>;
|
|
11
11
|
bulkIdentify(users: BulkIdentifyUser[]): Promise<BulkOperation>;
|
|
12
12
|
get(userId: string): Promise<User>;
|
|
13
|
+
list(filteringOptions?: ListUserOptions): Promise<PaginatedResponse<User>>;
|
|
13
14
|
delete(userId: string): Promise<null>;
|
|
14
15
|
bulkDelete(userIds: string[]): Promise<BulkOperation>;
|
|
15
16
|
merge(toUserId: string, fromUserId: string): Promise<User>;
|
|
@@ -43,6 +43,12 @@ class Users {
|
|
|
43
43
|
return data;
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
+
list(filteringOptions = {}) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const { data } = yield this.knock.get(`/v1/users`, filteringOptions);
|
|
49
|
+
return data;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
46
52
|
delete(userId) {
|
|
47
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
54
|
if (!userId) {
|
|
@@ -20,5 +20,12 @@ export interface BulkIdentifyUser extends IdentifyProperties {
|
|
|
20
20
|
export interface UserFeedOptions extends PaginationOptions {
|
|
21
21
|
source?: string;
|
|
22
22
|
tenant?: string;
|
|
23
|
+
has_tenant?: boolean;
|
|
24
|
+
archived?: "include" | "exclude" | "only";
|
|
23
25
|
status?: "unread" | "unseen" | "all";
|
|
24
26
|
}
|
|
27
|
+
export interface ListUserOptions extends PaginationOptions {
|
|
28
|
+
name?: string;
|
|
29
|
+
email?: string;
|
|
30
|
+
user_id?: string;
|
|
31
|
+
}
|