doover-js 0.4.7 → 0.5.0-alpha.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.
Files changed (63) hide show
  1. package/README.md +31 -0
  2. package/dist/apis/_args.d.ts +16 -0
  3. package/dist/apis/_args.js +26 -0
  4. package/dist/apis/agents-api.d.ts +4 -1
  5. package/dist/apis/agents-api.js +139 -1
  6. package/dist/apis/aggregates-api.d.ts +23 -3
  7. package/dist/apis/aggregates-api.js +33 -4
  8. package/dist/apis/alarms-api.d.ts +30 -0
  9. package/dist/apis/alarms-api.js +51 -6
  10. package/dist/apis/channels-api.d.ts +40 -3
  11. package/dist/apis/channels-api.js +50 -5
  12. package/dist/apis/connections-api.d.ts +21 -5
  13. package/dist/apis/connections-api.js +26 -10
  14. package/dist/apis/messages-api.d.ts +55 -9
  15. package/dist/apis/messages-api.js +96 -11
  16. package/dist/apis/notifications-api.d.ts +52 -0
  17. package/dist/apis/notifications-api.js +99 -13
  18. package/dist/apis/permissions-api.d.ts +8 -0
  19. package/dist/apis/permissions-api.js +11 -2
  20. package/dist/apis/processors-api.d.ts +35 -0
  21. package/dist/apis/processors-api.js +64 -8
  22. package/dist/apis/users-api.d.ts +8 -0
  23. package/dist/apis/users-api.js +13 -0
  24. package/dist/client/doover-client.d.ts +4 -8
  25. package/dist/client/doover-client.js +16 -28
  26. package/dist/client/stats.d.ts +24 -0
  27. package/dist/client/stats.js +62 -0
  28. package/dist/gateway/gateway-client.d.ts +13 -1
  29. package/dist/gateway/gateway-client.js +54 -0
  30. package/dist/index.d.ts +6 -0
  31. package/dist/index.js +13 -7
  32. package/dist/react/index.d.ts +2 -0
  33. package/dist/react/index.js +4 -1
  34. package/dist/react/useChannelAggregate.js +8 -1
  35. package/dist/react/useChannelMessages.js +5 -2
  36. package/dist/react/useChannelSubscription.js +8 -18
  37. package/dist/react/useInvocationLogs.d.ts +23 -0
  38. package/dist/react/useInvocationLogs.js +41 -0
  39. package/dist/react/useMultiAgentAggregates.js +8 -14
  40. package/dist/react/useMultiAgentChannelMessages.js +8 -13
  41. package/dist/react/useSendMessage.js +6 -1
  42. package/dist/react/useSendRpc.js +4 -1
  43. package/dist/react/useUpdateAggregate.js +9 -3
  44. package/dist/rpc/errors.d.ts +10 -0
  45. package/dist/rpc/errors.js +23 -0
  46. package/dist/rpc/rpc-dispatcher.d.ts +28 -0
  47. package/dist/rpc/rpc-dispatcher.js +129 -0
  48. package/dist/test/api-args.test.d.ts +1 -0
  49. package/dist/test/api-args.test.js +48 -0
  50. package/dist/test/api-overloads.test.d.ts +9 -0
  51. package/dist/test/api-overloads.test.js +276 -0
  52. package/dist/test/gateway-subscriptions.test.d.ts +1 -0
  53. package/dist/test/gateway-subscriptions.test.js +95 -0
  54. package/dist/test/react.test.js +36 -0
  55. package/dist/test/rpc-dispatcher.test.d.ts +1 -0
  56. package/dist/test/rpc-dispatcher.test.js +190 -0
  57. package/dist/test/stats-rpc.test.d.ts +1 -0
  58. package/dist/test/stats-rpc.test.js +69 -0
  59. package/dist/test/users-api.test.d.ts +1 -0
  60. package/dist/test/users-api.test.js +19 -0
  61. package/dist/viewer/doover-data-provider.d.ts +30 -34
  62. package/dist/viewer/doover-data-provider.js +82 -316
  63. package/package.json +1 -1
@@ -1,31 +1,47 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectionsApi = void 0;
4
+ const _args_1 = require("./_args");
4
5
  class ConnectionsApi {
5
6
  constructor(rest) {
6
7
  this.rest = rest;
7
8
  }
8
- getAgentConnections(agentId) {
9
+ getAgentConnections(...args) {
10
+ const { agentId } = (0, _args_1.resolveAgentArgs)(args);
11
+ return this._getAgentConnections(agentId);
12
+ }
13
+ _getAgentConnections(agentId) {
9
14
  return this.rest.get(`/agents/${agentId}/wss_connections`);
10
15
  }
11
- getAgentConnectionHistory(agentId, params) {
16
+ getAgentConnectionHistory(...args) {
17
+ const { agentId, options } = (0, _args_1.resolveAgentArgs)(args);
18
+ return this._getAgentConnectionHistory(agentId, options);
19
+ }
20
+ _getAgentConnectionHistory(agentId, params) {
12
21
  return this.rest.get(`/agents/${agentId}/wss_connections/history`, params);
13
22
  }
14
- getAgentSubscriptionHistory(agentId, params) {
23
+ getAgentSubscriptionHistory(...args) {
24
+ const { agentId, options } = (0, _args_1.resolveAgentArgs)(args);
25
+ return this._getAgentSubscriptionHistory(agentId, options);
26
+ }
27
+ _getAgentSubscriptionHistory(agentId, params) {
15
28
  return this.rest.get(`/agents/${agentId}/wss_connections/subscriptions/history`, params);
16
29
  }
17
30
  getConnection(connectionId) {
18
31
  return this.rest.get(`/connections/${connectionId}`);
19
32
  }
20
- getChannelSubscriptions(agentId, channelName) {
33
+ getChannelSubscriptions(...args) {
34
+ const { agentId, channelName } = (0, _args_1.resolveChannelArgs)(args);
35
+ return this._getChannelSubscriptions(agentId, channelName);
36
+ }
37
+ _getChannelSubscriptions(agentId, channelName) {
21
38
  return this.rest.get(`/agents/${agentId}/channels/${channelName}/subscriptions`);
22
39
  }
23
- /**
24
- * Ask the server to push the latest state of all channels this agent
25
- * owns to every active WSS connection. Used to recover from missed updates
26
- * after a gap in connectivity.
27
- */
28
- syncConnection(agentId) {
40
+ syncConnection(...args) {
41
+ const { agentId } = (0, _args_1.resolveAgentArgs)(args);
42
+ return this._syncConnection(agentId);
43
+ }
44
+ _syncConnection(agentId) {
29
45
  return this.rest.post(`/agents/${agentId}/connection_sync`, {});
30
46
  }
31
47
  }
@@ -5,6 +5,12 @@ export interface ListMessagesParams {
5
5
  after?: string;
6
6
  limit?: number;
7
7
  field_name?: string[];
8
+ /**
9
+ * Result order. `"desc"` (default) returns the server's native newest-first
10
+ * order; `"asc"` reverses the array client-side so the oldest message is at
11
+ * index 0.
12
+ */
13
+ order?: "asc" | "desc";
8
14
  }
9
15
  export interface MessageMutationParams {
10
16
  suppress_response?: boolean;
@@ -14,19 +20,59 @@ export type MessageBody = CreateMessageRequest | UpdateMessageRequest | FormData
14
20
  export declare class MessagesApi {
15
21
  private readonly rest;
16
22
  constructor(rest: RestClient);
17
- listMessages(agentId: string, channelName: string, params?: ListMessagesParams): Promise<(Omit<MessageStructure<import("..").JSONValue>, "timestamp"> & {
18
- timestamp: number;
19
- })[]>;
20
- postMessage(agentId: string, channelName: string, body: MessageBody): Promise<Omit<MessageStructure<import("..").JSONValue>, "timestamp"> & {
21
- timestamp: number;
22
- }>;
23
+ listMessages(agentId: string, channelName: string, params?: ListMessagesParams): Promise<MessageStructure[]>;
24
+ listMessages(identifier: {
25
+ agentId: string;
26
+ channelName: string;
27
+ }, params?: ListMessagesParams): Promise<MessageStructure[]>;
28
+ private _listMessages;
29
+ postMessage(agentId: string, channelName: string, body: MessageBody): Promise<MessageStructure>;
30
+ postMessage(identifier: {
31
+ agentId: string;
32
+ channelName: string;
33
+ }, body: MessageBody): Promise<MessageStructure>;
34
+ private _postMessage;
23
35
  getTimeseries(agentId: string, channelName: string, params: ListMessagesParams): Promise<DataSeries>;
24
- getMessage(agentId: string, channelName: string, messageId: string): Promise<Omit<MessageStructure<import("..").JSONValue>, "timestamp"> & {
25
- timestamp: number;
26
- }>;
36
+ getTimeseries(identifier: {
37
+ agentId: string;
38
+ channelName: string;
39
+ }, params: ListMessagesParams): Promise<DataSeries>;
40
+ private _getTimeseries;
41
+ getMessage(agentId: string, channelName: string, messageId: string): Promise<MessageStructure>;
42
+ getMessage(identifier: {
43
+ agentId: string;
44
+ channelName: string;
45
+ }, messageId: string): Promise<MessageStructure>;
46
+ private _getMessage;
27
47
  putMessage(agentId: string, channelName: string, messageId: string, body: MessageBody, params?: MessageMutationParams): Promise<unknown>;
48
+ putMessage(identifier: {
49
+ agentId: string;
50
+ channelName: string;
51
+ }, messageId: string, body: MessageBody, params?: MessageMutationParams): Promise<unknown>;
52
+ private _putMessage;
28
53
  patchMessage(agentId: string, channelName: string, messageId: string, body: MessageBody, params?: MessageMutationParams): Promise<unknown>;
54
+ patchMessage(identifier: {
55
+ agentId: string;
56
+ channelName: string;
57
+ }, messageId: string, body: MessageBody, params?: MessageMutationParams): Promise<unknown>;
58
+ private _patchMessage;
29
59
  deleteMessage(agentId: string, channelName: string, messageId: string): Promise<unknown>;
60
+ deleteMessage(identifier: {
61
+ agentId: string;
62
+ channelName: string;
63
+ }, messageId: string): Promise<unknown>;
64
+ private _deleteMessage;
30
65
  getMessageAttachment(agentId: string, channelName: string, messageId: string, attachmentId: string): Promise<Blob>;
66
+ getMessageAttachment(identifier: {
67
+ agentId: string;
68
+ channelName: string;
69
+ }, messageId: string, attachmentId: string): Promise<Blob>;
70
+ private _getMessageAttachment;
71
+ getInvocationLogs<TLog = unknown>(agentId: string, channelName: string, messageId: string): Promise<TLog[]>;
72
+ getInvocationLogs<TLog = unknown>(identifier: {
73
+ agentId: string;
74
+ channelName: string;
75
+ }, messageId: string): Promise<TLog[]>;
76
+ private _getInvocationLogs;
31
77
  createMultipartPayload(jsonPayload: Record<string, unknown>, attachments: Array<Blob | File>): FormData;
32
78
  }
@@ -2,37 +2,122 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MessagesApi = void 0;
4
4
  const snowflake_1 = require("../utils/snowflake");
5
+ const _args_1 = require("./_args");
6
+ function resolveListMessagesParams(params) {
7
+ const order = params?.order ?? "desc";
8
+ const query = {
9
+ before: params?.before ?? (0, snowflake_1.generateSnowflakeIdAtTime)(new Date()),
10
+ limit: params?.limit ?? 10,
11
+ };
12
+ if (params?.after !== undefined)
13
+ query.after = params.after;
14
+ if (params?.field_name !== undefined)
15
+ query.field_name = params.field_name;
16
+ return { query, order };
17
+ }
5
18
  class MessagesApi {
6
19
  constructor(rest) {
7
20
  this.rest = rest;
8
21
  }
9
- async listMessages(agentId, channelName, params) {
10
- const response = await this.rest.get(`/agents/${agentId}/channels/${channelName}/messages`, params);
11
- return response.map(snowflake_1.addTimestampToMessage);
22
+ async listMessages(...args) {
23
+ const { agentId, channelName, options } = (0, _args_1.resolveChannelArgs)(args);
24
+ return this._listMessages(agentId, channelName, options);
25
+ }
26
+ async _listMessages(agentId, channelName, params) {
27
+ const { query, order } = resolveListMessagesParams(params);
28
+ const response = await this.rest.get(`/agents/${agentId}/channels/${channelName}/messages`, query);
29
+ const stamped = response.map(snowflake_1.addTimestampToMessage);
30
+ return order === "asc" ? [...stamped].reverse() : stamped;
31
+ }
32
+ async postMessage(...args) {
33
+ if (typeof args[0] === "string") {
34
+ const [agentId, channelName, body] = args;
35
+ return this._postMessage(agentId, channelName, body);
36
+ }
37
+ const id = args[0];
38
+ const body = args[1];
39
+ return this._postMessage(id.agentId, id.channelName, body);
12
40
  }
13
- async postMessage(agentId, channelName, body) {
41
+ async _postMessage(agentId, channelName, body) {
14
42
  const response = await this.rest.post(`/agents/${agentId}/channels/${channelName}/messages`, body);
15
43
  return (0, snowflake_1.addTimestampToMessage)(response);
16
44
  }
17
- getTimeseries(agentId, channelName, params) {
18
- return this.rest.get(`/agents/${agentId}/channels/${channelName}/messages/timeseries`, params);
45
+ getTimeseries(...args) {
46
+ const { agentId, channelName, options } = (0, _args_1.resolveChannelArgs)(args);
47
+ return this._getTimeseries(agentId, channelName, options);
19
48
  }
20
- async getMessage(agentId, channelName, messageId) {
49
+ _getTimeseries(agentId, channelName, params) {
50
+ const { order: _order, ...rest } = params;
51
+ return this.rest.get(`/agents/${agentId}/channels/${channelName}/messages/timeseries`, rest);
52
+ }
53
+ async getMessage(...args) {
54
+ if (typeof args[0] === "string") {
55
+ const [agentId, channelName, messageId] = args;
56
+ return this._getMessage(agentId, channelName, messageId);
57
+ }
58
+ const id = args[0];
59
+ const messageId = args[1];
60
+ return this._getMessage(id.agentId, id.channelName, messageId);
61
+ }
62
+ async _getMessage(agentId, channelName, messageId) {
21
63
  const response = await this.rest.get(`/agents/${agentId}/channels/${channelName}/messages/${messageId}`);
22
64
  return (0, snowflake_1.addTimestampToMessage)(response);
23
65
  }
24
- putMessage(agentId, channelName, messageId, body, params) {
66
+ putMessage(...args) {
67
+ if (typeof args[0] === "string") {
68
+ const [agentId, channelName, messageId, body, params] = args;
69
+ return this._putMessage(agentId, channelName, messageId, body, params);
70
+ }
71
+ const id = args[0];
72
+ return this._putMessage(id.agentId, id.channelName, args[1], args[2], args[3]);
73
+ }
74
+ _putMessage(agentId, channelName, messageId, body, params) {
25
75
  return this.rest.put(`/agents/${agentId}/channels/${channelName}/messages/${messageId}`, body, params);
26
76
  }
27
- patchMessage(agentId, channelName, messageId, body, params) {
77
+ patchMessage(...args) {
78
+ if (typeof args[0] === "string") {
79
+ const [agentId, channelName, messageId, body, params] = args;
80
+ return this._patchMessage(agentId, channelName, messageId, body, params);
81
+ }
82
+ const id = args[0];
83
+ return this._patchMessage(id.agentId, id.channelName, args[1], args[2], args[3]);
84
+ }
85
+ _patchMessage(agentId, channelName, messageId, body, params) {
28
86
  return this.rest.patch(`/agents/${agentId}/channels/${channelName}/messages/${messageId}`, body, params);
29
87
  }
30
- deleteMessage(agentId, channelName, messageId) {
88
+ deleteMessage(...args) {
89
+ if (typeof args[0] === "string") {
90
+ const [agentId, channelName, messageId] = args;
91
+ return this._deleteMessage(agentId, channelName, messageId);
92
+ }
93
+ const id = args[0];
94
+ return this._deleteMessage(id.agentId, id.channelName, args[1]);
95
+ }
96
+ _deleteMessage(agentId, channelName, messageId) {
31
97
  return this.rest.delete(`/agents/${agentId}/channels/${channelName}/messages/${messageId}`);
32
98
  }
33
- getMessageAttachment(agentId, channelName, messageId, attachmentId) {
99
+ getMessageAttachment(...args) {
100
+ if (typeof args[0] === "string") {
101
+ const [agentId, channelName, messageId, attachmentId] = args;
102
+ return this._getMessageAttachment(agentId, channelName, messageId, attachmentId);
103
+ }
104
+ const id = args[0];
105
+ return this._getMessageAttachment(id.agentId, id.channelName, args[1], args[2]);
106
+ }
107
+ _getMessageAttachment(agentId, channelName, messageId, attachmentId) {
34
108
  return this.rest.get(`/agents/${agentId}/channels/${channelName}/messages/${messageId}/attachments/${attachmentId}`);
35
109
  }
110
+ getInvocationLogs(...args) {
111
+ if (typeof args[0] === "string") {
112
+ const [agentId, channelName, messageId] = args;
113
+ return this._getInvocationLogs(agentId, channelName, messageId);
114
+ }
115
+ const id = args[0];
116
+ return this._getInvocationLogs(id.agentId, id.channelName, args[1]);
117
+ }
118
+ _getInvocationLogs(agentId, channelName, messageId) {
119
+ return this.rest.get(`/agents/${agentId}/channels/${channelName}/messages/${messageId}/logs`);
120
+ }
36
121
  createMultipartPayload(jsonPayload, attachments) {
37
122
  const formData = new FormData();
38
123
  formData.set("json_payload", JSON.stringify(jsonPayload));
@@ -4,18 +4,70 @@ export declare class NotificationsApi {
4
4
  private readonly rest;
5
5
  constructor(rest: RestClient);
6
6
  getAgentNotifications(agentId: string): Promise<NotificationDataResponse>;
7
+ getAgentNotifications(identifier: {
8
+ agentId: string;
9
+ }): Promise<NotificationDataResponse>;
10
+ private _getAgentNotifications;
7
11
  getAgentNotificationEndpoints(agentId: string, name?: string): Promise<NotificationEndpointsResponse>;
12
+ getAgentNotificationEndpoints(identifier: {
13
+ agentId: string;
14
+ }, name?: string): Promise<NotificationEndpointsResponse>;
15
+ private _getAgentNotificationEndpoints;
8
16
  createNotificationEndpoint(agentId: string, body: CreateEndpointRequest): Promise<NotificationEndpoint>;
17
+ createNotificationEndpoint(identifier: {
18
+ agentId: string;
19
+ }, body: CreateEndpointRequest): Promise<NotificationEndpoint>;
20
+ private _createNotificationEndpoint;
9
21
  updateNotificationEndpoint(agentId: string, endpointId: string, body: UpdateEndpointRequest): Promise<NotificationEndpoint>;
22
+ updateNotificationEndpoint(identifier: {
23
+ agentId: string;
24
+ }, endpointId: string, body: UpdateEndpointRequest): Promise<NotificationEndpoint>;
25
+ private _updateNotificationEndpoint;
10
26
  deleteNotificationEndpoint(agentId: string, endpointId: string): Promise<unknown>;
27
+ deleteNotificationEndpoint(identifier: {
28
+ agentId: string;
29
+ }, endpointId: string): Promise<unknown>;
30
+ private _deleteNotificationEndpoint;
11
31
  testNotificationEndpoint(agentId: string, endpointId: string): Promise<unknown>;
32
+ testNotificationEndpoint(identifier: {
33
+ agentId: string;
34
+ }, endpointId: string): Promise<unknown>;
35
+ private _testNotificationEndpoint;
12
36
  getAgentNotificationSubscriptions(agentId: string, subscribed_to?: string): Promise<NotificationSubscriptionsResponse>;
37
+ getAgentNotificationSubscriptions(identifier: {
38
+ agentId: string;
39
+ }, subscribed_to?: string): Promise<NotificationSubscriptionsResponse>;
40
+ private _getAgentNotificationSubscriptions;
13
41
  createNotificationSubscription(agentId: string, body: CreateNotificationSubscriptionRequest): Promise<NotificationSubscriptionCreateResponse>;
42
+ createNotificationSubscription(identifier: {
43
+ agentId: string;
44
+ }, body: CreateNotificationSubscriptionRequest): Promise<NotificationSubscriptionCreateResponse>;
45
+ private _createNotificationSubscription;
14
46
  getAgentDefaultNotificationSubscriptions(agentId: string, subscribed_to?: string): Promise<NotificationSubscriptionsResponse>;
47
+ getAgentDefaultNotificationSubscriptions(identifier: {
48
+ agentId: string;
49
+ }, subscribed_to?: string): Promise<NotificationSubscriptionsResponse>;
50
+ private _getAgentDefaultNotificationSubscriptions;
15
51
  deleteDefaultNotificationSubscription(agentId: string, subscribedTo: string): Promise<unknown>;
52
+ deleteDefaultNotificationSubscription(identifier: {
53
+ agentId: string;
54
+ }, subscribedTo: string): Promise<unknown>;
55
+ private _deleteDefaultNotificationSubscription;
16
56
  updateNotificationSubscription(agentId: string, subscriptionId: string, body: UpdateNotificationSubscriptionRequest): Promise<unknown>;
57
+ updateNotificationSubscription(identifier: {
58
+ agentId: string;
59
+ }, subscriptionId: string, body: UpdateNotificationSubscriptionRequest): Promise<unknown>;
60
+ private _updateNotificationSubscription;
17
61
  deleteNotificationSubscription(agentId: string, subscriptionId: string): Promise<unknown>;
62
+ deleteNotificationSubscription(identifier: {
63
+ agentId: string;
64
+ }, subscriptionId: string): Promise<unknown>;
65
+ private _deleteNotificationSubscription;
18
66
  getAgentNotificationSubscribers(agentId: string): Promise<NotificationSubscribersResponse>;
67
+ getAgentNotificationSubscribers(identifier: {
68
+ agentId: string;
69
+ }): Promise<NotificationSubscribersResponse>;
70
+ private _getAgentNotificationSubscribers;
19
71
  updateMeWebPushEndpoint(body: UpdateMeWebPushEndpointRequest): Promise<unknown>;
20
72
  getWebPushPublicKey(): Promise<{
21
73
  key: string;
@@ -1,47 +1,133 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotificationsApi = void 0;
4
+ const _args_1 = require("./_args");
4
5
  class NotificationsApi {
5
6
  constructor(rest) {
6
7
  this.rest = rest;
7
8
  }
8
- getAgentNotifications(agentId) {
9
+ getAgentNotifications(...args) {
10
+ const { agentId } = (0, _args_1.resolveAgentArgs)(args);
11
+ return this._getAgentNotifications(agentId);
12
+ }
13
+ _getAgentNotifications(agentId) {
9
14
  return this.rest.get(`/agents/${agentId}/notifications`);
10
15
  }
11
- getAgentNotificationEndpoints(agentId, name) {
16
+ getAgentNotificationEndpoints(...args) {
17
+ if (typeof args[0] === "string") {
18
+ return this._getAgentNotificationEndpoints(args[0], args[1]);
19
+ }
20
+ const id = args[0];
21
+ return this._getAgentNotificationEndpoints(id.agentId, args[1]);
22
+ }
23
+ _getAgentNotificationEndpoints(agentId, name) {
12
24
  return this.rest.get(`/agents/${agentId}/notifications/endpoints`, { name });
13
25
  }
14
- createNotificationEndpoint(agentId, body) {
26
+ createNotificationEndpoint(...args) {
27
+ if (typeof args[0] === "string") {
28
+ return this._createNotificationEndpoint(args[0], args[1]);
29
+ }
30
+ const id = args[0];
31
+ return this._createNotificationEndpoint(id.agentId, args[1]);
32
+ }
33
+ _createNotificationEndpoint(agentId, body) {
15
34
  return this.rest.post(`/agents/${agentId}/notifications/endpoints`, body);
16
35
  }
17
- updateNotificationEndpoint(agentId, endpointId, body) {
36
+ updateNotificationEndpoint(...args) {
37
+ if (typeof args[0] === "string") {
38
+ return this._updateNotificationEndpoint(args[0], args[1], args[2]);
39
+ }
40
+ const id = args[0];
41
+ return this._updateNotificationEndpoint(id.agentId, args[1], args[2]);
42
+ }
43
+ _updateNotificationEndpoint(agentId, endpointId, body) {
18
44
  return this.rest.patch(`/agents/${agentId}/notifications/endpoints/${endpointId}`, body);
19
45
  }
20
- deleteNotificationEndpoint(agentId, endpointId) {
46
+ deleteNotificationEndpoint(...args) {
47
+ if (typeof args[0] === "string") {
48
+ return this._deleteNotificationEndpoint(args[0], args[1]);
49
+ }
50
+ const id = args[0];
51
+ return this._deleteNotificationEndpoint(id.agentId, args[1]);
52
+ }
53
+ _deleteNotificationEndpoint(agentId, endpointId) {
21
54
  return this.rest.delete(`/agents/${agentId}/notifications/endpoints/${endpointId}`);
22
55
  }
23
- testNotificationEndpoint(agentId, endpointId) {
56
+ testNotificationEndpoint(...args) {
57
+ if (typeof args[0] === "string") {
58
+ return this._testNotificationEndpoint(args[0], args[1]);
59
+ }
60
+ const id = args[0];
61
+ return this._testNotificationEndpoint(id.agentId, args[1]);
62
+ }
63
+ _testNotificationEndpoint(agentId, endpointId) {
24
64
  return this.rest.post(`/agents/${agentId}/notifications/endpoints/${endpointId}/test`, {});
25
65
  }
26
- getAgentNotificationSubscriptions(agentId, subscribed_to) {
66
+ getAgentNotificationSubscriptions(...args) {
67
+ if (typeof args[0] === "string") {
68
+ return this._getAgentNotificationSubscriptions(args[0], args[1]);
69
+ }
70
+ const id = args[0];
71
+ return this._getAgentNotificationSubscriptions(id.agentId, args[1]);
72
+ }
73
+ _getAgentNotificationSubscriptions(agentId, subscribed_to) {
27
74
  return this.rest.get(`/agents/${agentId}/notifications/subscriptions`, { subscribed_to });
28
75
  }
29
- createNotificationSubscription(agentId, body) {
76
+ createNotificationSubscription(...args) {
77
+ if (typeof args[0] === "string") {
78
+ return this._createNotificationSubscription(args[0], args[1]);
79
+ }
80
+ const id = args[0];
81
+ return this._createNotificationSubscription(id.agentId, args[1]);
82
+ }
83
+ _createNotificationSubscription(agentId, body) {
30
84
  return this.rest.post(`/agents/${agentId}/notifications/subscriptions`, body);
31
85
  }
32
- getAgentDefaultNotificationSubscriptions(agentId, subscribed_to) {
86
+ getAgentDefaultNotificationSubscriptions(...args) {
87
+ if (typeof args[0] === "string") {
88
+ return this._getAgentDefaultNotificationSubscriptions(args[0], args[1]);
89
+ }
90
+ const id = args[0];
91
+ return this._getAgentDefaultNotificationSubscriptions(id.agentId, args[1]);
92
+ }
93
+ _getAgentDefaultNotificationSubscriptions(agentId, subscribed_to) {
33
94
  return this.rest.get(`/agents/${agentId}/notifications/subscriptions/default`, { subscribed_to });
34
95
  }
35
- deleteDefaultNotificationSubscription(agentId, subscribedTo) {
96
+ deleteDefaultNotificationSubscription(...args) {
97
+ if (typeof args[0] === "string") {
98
+ return this._deleteDefaultNotificationSubscription(args[0], args[1]);
99
+ }
100
+ const id = args[0];
101
+ return this._deleteDefaultNotificationSubscription(id.agentId, args[1]);
102
+ }
103
+ _deleteDefaultNotificationSubscription(agentId, subscribedTo) {
36
104
  return this.rest.delete(`/agents/${agentId}/notifications/subscriptions/default/${subscribedTo}`);
37
105
  }
38
- updateNotificationSubscription(agentId, subscriptionId, body) {
106
+ updateNotificationSubscription(...args) {
107
+ if (typeof args[0] === "string") {
108
+ return this._updateNotificationSubscription(args[0], args[1], args[2]);
109
+ }
110
+ const id = args[0];
111
+ return this._updateNotificationSubscription(id.agentId, args[1], args[2]);
112
+ }
113
+ _updateNotificationSubscription(agentId, subscriptionId, body) {
39
114
  return this.rest.patch(`/agents/${agentId}/notifications/subscriptions/${subscriptionId}`, body);
40
115
  }
41
- deleteNotificationSubscription(agentId, subscriptionId) {
116
+ deleteNotificationSubscription(...args) {
117
+ if (typeof args[0] === "string") {
118
+ return this._deleteNotificationSubscription(args[0], args[1]);
119
+ }
120
+ const id = args[0];
121
+ return this._deleteNotificationSubscription(id.agentId, args[1]);
122
+ }
123
+ _deleteNotificationSubscription(agentId, subscriptionId) {
42
124
  return this.rest.delete(`/agents/${agentId}/notifications/subscriptions/${subscriptionId}`);
43
125
  }
44
- getAgentNotificationSubscribers(agentId) {
126
+ getAgentNotificationSubscribers(...args) {
127
+ const { agentId } = (0, _args_1.resolveAgentArgs)(args);
128
+ return this._getAgentNotificationSubscribers(agentId);
129
+ }
130
+ _getAgentNotificationSubscribers(agentId) {
45
131
  return this.rest.get(`/agents/${agentId}/notifications/subscribers`);
46
132
  }
47
133
  updateMeWebPushEndpoint(body) {
@@ -4,6 +4,14 @@ export declare class PermissionsApi {
4
4
  private readonly rest;
5
5
  constructor(rest: RestClient);
6
6
  getAgentPermission(agentId: string): Promise<AgentPermission>;
7
+ getAgentPermission(identifier: {
8
+ agentId: string;
9
+ }): Promise<AgentPermission>;
10
+ private _getAgentPermission;
7
11
  getAgentPermissionDebug(agentId: string): Promise<PermissionDebugResponse>;
12
+ getAgentPermissionDebug(identifier: {
13
+ agentId: string;
14
+ }): Promise<PermissionDebugResponse>;
15
+ private _getAgentPermissionDebug;
8
16
  syncPermissions(body: SyncPermissionRequest): Promise<SuccessListResponse<string>>;
9
17
  }
@@ -1,14 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PermissionsApi = void 0;
4
+ const _args_1 = require("./_args");
4
5
  class PermissionsApi {
5
6
  constructor(rest) {
6
7
  this.rest = rest;
7
8
  }
8
- getAgentPermission(agentId) {
9
+ getAgentPermission(...args) {
10
+ const { agentId } = (0, _args_1.resolveAgentArgs)(args);
11
+ return this._getAgentPermission(agentId);
12
+ }
13
+ _getAgentPermission(agentId) {
9
14
  return this.rest.get(`/agents/${agentId}/permissions`);
10
15
  }
11
- getAgentPermissionDebug(agentId) {
16
+ getAgentPermissionDebug(...args) {
17
+ const { agentId } = (0, _args_1.resolveAgentArgs)(args);
18
+ return this._getAgentPermissionDebug(agentId);
19
+ }
20
+ _getAgentPermissionDebug(agentId) {
12
21
  return this.rest.get(`/agents/${agentId}/permissions/debug`);
13
22
  }
14
23
  syncPermissions(body) {
@@ -4,18 +4,53 @@ export declare class ProcessorsApi {
4
4
  private readonly rest;
5
5
  constructor(rest: RestClient);
6
6
  createProcessorSchedule(agentId: string, scheduleId: string, body: PutScheduleRequest): Promise<unknown>;
7
+ createProcessorSchedule(identifier: {
8
+ agentId: string;
9
+ }, scheduleId: string, body: PutScheduleRequest): Promise<unknown>;
10
+ private _createProcessorSchedule;
7
11
  deleteProcessorSchedule(agentId: string, scheduleId: string): Promise<unknown>;
12
+ deleteProcessorSchedule(identifier: {
13
+ agentId: string;
14
+ }, scheduleId: string): Promise<unknown>;
15
+ private _deleteProcessorSchedule;
8
16
  regenerateScheduleToken(agentId: string, scheduleId: string): Promise<unknown>;
17
+ regenerateScheduleToken(identifier: {
18
+ agentId: string;
19
+ }, scheduleId: string): Promise<unknown>;
20
+ private _regenerateScheduleToken;
9
21
  getScheduleInfo(scheduleId: string): Promise<ScheduleInfo>;
10
22
  getScheduleInfoAlias(scheduleId: string): Promise<ScheduleInfo>;
11
23
  createProcessorSubscription(agentId: string, subscriptionId: string, body: PutSubscriptionRequest): Promise<unknown>;
24
+ createProcessorSubscription(identifier: {
25
+ agentId: string;
26
+ }, subscriptionId: string, body: PutSubscriptionRequest): Promise<unknown>;
27
+ private _createProcessorSubscription;
12
28
  deleteProcessorSubscription(agentId: string, subscriptionId: string): Promise<unknown>;
29
+ deleteProcessorSubscription(identifier: {
30
+ agentId: string;
31
+ }, subscriptionId: string): Promise<unknown>;
32
+ private _deleteProcessorSubscription;
13
33
  getProcessorSubscriptionInfo(subscriptionName: string): Promise<SubscriptionInfo>;
14
34
  getProcessorSubscriptionInfoAlias(subscriptionArn: string): Promise<SubscriptionInfo>;
15
35
  createIngestionEndpoint(agentId: string, ingestionId: string, body: CreateIngestionRequest): Promise<unknown>;
36
+ createIngestionEndpoint(identifier: {
37
+ agentId: string;
38
+ }, ingestionId: string, body: CreateIngestionRequest): Promise<unknown>;
39
+ private _createIngestionEndpoint;
16
40
  deleteIngestionEndpoint(agentId: string, ingestionId: string): Promise<unknown>;
41
+ deleteIngestionEndpoint(identifier: {
42
+ agentId: string;
43
+ }, ingestionId: string): Promise<unknown>;
44
+ private _deleteIngestionEndpoint;
17
45
  invokeIngestionEndpoint(agentId: string, ingestionId: string, body: unknown, params?: {
18
46
  wait?: boolean;
19
47
  json_response?: boolean;
20
48
  }): Promise<unknown>;
49
+ invokeIngestionEndpoint(identifier: {
50
+ agentId: string;
51
+ }, ingestionId: string, body: unknown, params?: {
52
+ wait?: boolean;
53
+ json_response?: boolean;
54
+ }): Promise<unknown>;
55
+ private _invokeIngestionEndpoint;
21
56
  }