|
| 1 | +// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file |
| 2 | +// for details. All rights reserved. Use of this source code is governed by a |
| 3 | +// BSD-style license that can be found in the LICENSE file. |
| 4 | + |
| 5 | +import 'package:built_collection/built_collection.dart'; |
| 6 | +import 'package:built_value/built_value.dart'; |
| 7 | +import 'package:built_value/serializer.dart'; |
| 8 | + |
| 9 | +part 'extension_request.g.dart'; |
| 10 | + |
| 11 | +/// A request to run a command in the Dart Debug Extension. |
| 12 | +abstract class ExtensionRequest |
| 13 | + implements Built<ExtensionRequest, ExtensionRequestBuilder> { |
| 14 | + static Serializer<ExtensionRequest> get serializer => |
| 15 | + _$extensionRequestSerializer; |
| 16 | + |
| 17 | + factory ExtensionRequest([Function(ExtensionRequestBuilder) updates]) = |
| 18 | + _$ExtensionRequest; |
| 19 | + |
| 20 | + ExtensionRequest._(); |
| 21 | + |
| 22 | + /// Used to associate a request with an [ExtensionResponse]. |
| 23 | + int get id; |
| 24 | + |
| 25 | + String get command; |
| 26 | + |
| 27 | + BuiltMap<String, Object> get commandParams; |
| 28 | +} |
| 29 | + |
| 30 | +/// A response to an [ExtensionRequest]. |
| 31 | +abstract class ExtensionResponse |
| 32 | + implements Built<ExtensionResponse, ExtensionResponseBuilder> { |
| 33 | + static Serializer<ExtensionResponse> get serializer => |
| 34 | + _$extensionResponseSerializer; |
| 35 | + |
| 36 | + factory ExtensionResponse([Function(ExtensionResponseBuilder) updates]) = |
| 37 | + _$ExtensionResponse; |
| 38 | + |
| 39 | + ExtensionResponse._(); |
| 40 | + |
| 41 | + /// Used to associate a response with an [ExtensionRequest]. |
| 42 | + int get id; |
| 43 | + |
| 44 | + bool get success; |
| 45 | + |
| 46 | + /// Contains a JSON-encoded payload. |
| 47 | + String get result; |
| 48 | + |
| 49 | + @nullable |
| 50 | + String get error; |
| 51 | +} |
0 commit comments