-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsubscriptions.models.ts
More file actions
104 lines (100 loc) · 3.7 KB
/
Copy pathsubscriptions.models.ts
File metadata and controls
104 lines (100 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/**
* Subscription service model — public response shapes and the ServiceModel interface
* that drives generated API documentation.
*/
import type {
SubscriptionGetAllOptions,
SubscriptionGetPublishersOptions,
SubscriptionGetPublishersResponse,
SubscriptionGetResponse,
SubscriptionGetSupportedChannelsResponse,
} from './subscriptions.types';
/**
* Public surface of the Subscriptions service. JSDoc on this interface drives
* the generated API reference documentation.
*
* Every method takes the tenant GUID as the first argument, which the SDK
* forwards to the subscription API on each call.
*/
export interface SubscriptionServiceModel {
/**
* Gets the current user's subscription preferences, optionally filtered to a set of
* publisher names.
*
* Returns the full list of publishers (their topics, channels, and current subscription
* state) the user has access to. Use {@link SubscriptionGetAllOptions.publishers} to
* narrow to specific publishers.
*
* @param tenantId - Tenant GUID
* @param options - Optional publisher-name filter
* @returns Full subscription state for the matched publishers
* {@link SubscriptionGetResponse}
*
* @example Basic usage
* ```typescript
* import { Subscriptions } from '@uipath/uipath-typescript/notifications';
*
* const subscriptions = new Subscriptions(sdk);
* const { publishers } = await subscriptions.getAll('<tenantId>');
* ```
*
* @example Filter to specific publishers
* ```typescript
* const { publishers } = await subscriptions.getAll('<tenantId>', {
* publishers: ['Orchestrator', 'Actions'],
* });
* ```
* @internal
*/
getAll(tenantId: string, options?: SubscriptionGetAllOptions): Promise<SubscriptionGetResponse>;
/**
* Lists available publishers and their topics, regardless of the user's current subscription.
*
* Used for discovery — pair with {@link getAll} to inspect what's subscribable.
*
* Note: the response from this endpoint carries only identity/discovery fields on
* publishers and topics (no subscription state). Use {@link getAll} to inspect state.
*
* @param tenantId - Tenant GUID
* @param options - Optional publisher-name filter
* @returns Publishers and their full topic catalogue (discovery fields only)
* {@link SubscriptionGetPublishersResponse}
*
* @example Basic usage
* ```typescript
* const { publishers } = await subscriptions.getPublishers('<tenantId>');
* ```
*
* @example Filter to a single publisher
* ```typescript
* const { publishers } = await subscriptions.getPublishers('<tenantId>', { name: 'Orchestrator' });
* ```
* @internal
*/
getPublishers(tenantId: string, options?: SubscriptionGetPublishersOptions): Promise<SubscriptionGetPublishersResponse>;
/**
* Gets the notification channels supported in the current tenant.
*
* Check the `isEnabled` field on each {@link SupportedChannel} before attempting to subscribe to a
* channel — disabled channels will be rejected by the server.
*
* Note: `InApp` is always available and is not included in the response.
*
* @param tenantId - Tenant GUID
* @returns Supported channels with enabled status
* {@link SubscriptionGetSupportedChannelsResponse}
*
* @example
* ```typescript
* import { NotificationMode } from '@uipath/uipath-typescript/notifications';
*
* const { channels } = await subscriptions.getSupportedChannels('<tenantId>');
* const slack = channels.find(c => c.name === NotificationMode.Slack);
* if (slack?.isEnabled) {
* // safe to subscribe to Slack
* }
* ```
* @internal
*/
getSupportedChannels(tenantId: string): Promise<SubscriptionGetSupportedChannelsResponse>;
}