22// for details. All rights reserved. Use of this source code is governed by a
33// BSD-style license that can be found in the LICENSE file.
44
5- /// Service name for the DTD-hosted file system service.
6- const String kFileSystemServiceName = 'FileSystem' ;
5+ /// Constants used by the DTD-hosted file system service.
6+ extension FileSystemServiceConstants on Never {
7+ /// Service name for the DTD-hosted file system service.
8+ static const serviceName = 'FileSystem' ;
9+
10+ /// Service method name for the method that returns the IDE workspace roots.
11+ static const getIDEWorkspaceRoots = 'getIDEWorkspaceRoots' ;
12+
13+ /// Service method name for the method that returns the project roots
14+ /// contained within the current set of IDE workspace roots.
15+ static const getProjectRoots = 'getProjectRoots' ;
16+
17+ /// Service method name for the method that lists the contents of a directory.
18+ static const listDirectoryContents = 'listDirectoryContents' ;
19+
20+ /// Service method name for the method that reads a file as a string.
21+ static const readFileAsString = 'readFileAsString' ;
22+
23+ /// Service method name for the method that sets the IDE workspace roots.
24+ static const setIDEWorkspaceRoots = 'setIDEWorkspaceRoots' ;
25+
26+ /// Service method name for the method that writes a file as a string.
27+ static const writeFileAsString = 'writeFileAsString' ;
28+ }
729
830/// The default value for the `depth` parameter in the
931/// `DartToolingDaemon.getProjectRoots` API.
@@ -14,18 +36,62 @@ const String kFileSystemServiceName = 'FileSystem';
1436/// a user opened their home directory in their IDE.
1537const int defaultGetProjectRootsDepth = 4 ;
1638
17- /// Service name for the DTD-hosted unified analytics service.
18- const String kUnifiedAnalyticsServiceName = 'UnifiedAnalytics' ;
39+ /// Constants used by the DTD-hosted unified analytics service.
40+ ///
41+ /// This service is intentionally not exposed by package:dtd and should not be
42+ /// used by arbitrary clients.
43+ extension UnifiedAnalyticsServiceConstants on Never {
44+ /// Service name for the DTD-hosted unified analytics service.
45+ static const serviceName = 'UnifiedAnalytics' ;
46+
47+ /// Service method name for the method that confirms that a unified analytics
48+ /// client showed the required consent message.
49+ static const clientShowedMessage = 'clientShowedMessage' ;
50+
51+ /// Service method name for the method that returns the unified analytics
52+ /// consent message to prompt users with.
53+ static const getConsentMessage = 'getConsentMessage' ;
54+
55+ /// Service method name for the method that sends an event to unified
56+ /// analytics.
57+ static const send = 'send' ;
58+
59+ /// Service method name for the method that sets the enabled status of
60+ /// unified analytics telemetry.
61+ static const setTelemetry = 'setTelemetry' ;
62+
63+ /// Service method name for the method that determines whether the unified
64+ /// analytics client should display the consent message.
65+ static const shouldShowMessage = 'shouldShowMessage' ;
66+
67+ /// Service method name for the method that returns whether unified analytics
68+ /// telemetry is enabled.
69+ static const telemetryEnabled = 'telemetryEnabled' ;
70+ }
1971
2072/// Constants used as parameter names across various DTD APIs.
21- extension EventParameters on Never {
73+ extension DtdParameters on Never {
74+ static const capabilities = 'capabilities' ;
75+ static const contents = 'contents' ;
76+ static const data = 'data' ;
77+ static const depth = 'depth' ;
78+ static const enable = 'enable' ;
79+ static const encoding = 'encoding' ;
80+ static const event = 'event' ;
2281 static const eventData = 'eventData' ;
2382 static const eventKind = 'eventKind' ;
2483 static const exposedUri = 'exposedUri' ;
84+ static const kind = 'kind' ;
85+ static const method = 'method' ;
2586 static const name = 'name' ;
87+ static const roots = 'roots' ;
2688 static const secret = 'secret' ;
89+ static const service = 'service' ;
90+ static const stream = 'stream' ;
2791 static const streamId = 'streamId' ;
2892 static const timestamp = 'timestamp' ;
93+ static const tool = 'tool' ;
94+ static const type = 'type' ;
2995 static const uri = 'uri' ;
3096}
3197
@@ -58,3 +124,43 @@ extension ConnectedAppServiceConstants on Never {
58124 /// service shuts down.
59125 static const vmServiceUnregistered = 'VmServiceUnregistered' ;
60126}
127+
128+ /// Constants used by the core services provided by DTD.
129+ extension CoreDtdServiceConstants on Never {
130+ /// Service method name for the method that returns all the currently
131+ /// registered services available on this DTD instance.
132+ static const getRegisteredServices = 'getRegisteredServices' ;
133+
134+ /// Service method name for the method that posts an event to a stream.
135+ static const postEvent = 'postEvent' ;
136+
137+ /// Service method name for the method that a DTD client can call to register
138+ /// a handler for a service method.
139+ static const registerService = 'registerService' ;
140+
141+ /// The name of the stream for events related to new services/methods being
142+ /// added and removed.
143+ ///
144+ /// This stream is not part of the VM service protocol.
145+ static const servicesStreamId = 'Service' ;
146+
147+ /// The kind of the event sent over the [servicesStreamId] stream when a new
148+ /// service method is registered.
149+ static const serviceRegisteredKind = 'ServiceRegistered' ;
150+
151+ /// The kind of the event sent over the [servicesStreamId] stream when a
152+ /// service method is unregistered.
153+ static const serviceUnregisteredKind = 'ServiceUnregistered' ;
154+
155+ /// Service method name for the method that cancels a DTD client's
156+ /// subscription to a stream.
157+ static const streamCancel = 'streamCancel' ;
158+
159+ /// Service method name for the method that a DTD client can call to subscribe
160+ /// to a stream.
161+ static const streamListen = 'streamListen' ;
162+
163+ /// Service method name that for the method that notifies any stream
164+ /// subscriptions that an event was posted to a stream.
165+ static const streamNotify = 'streamNotify' ;
166+ }
0 commit comments