Skip to content

Commit bd74046

Browse files
committed
refactor(scripting_api): move DirectoryPayloadFormat to its own file
1 parent 0191f0d commit bd74046

File tree

3 files changed

+36
-29
lines changed

3 files changed

+36
-29
lines changed

lib/src/core/scripting_api.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ library scripting_api;
1212

1313
export "scripting_api/consumed_thing.dart";
1414
export "scripting_api/data_schema_value.dart";
15+
export "scripting_api/discovery/directory_payload_format.dart";
1516
export "scripting_api/discovery/thing_discovery.dart";
1617
export "scripting_api/discovery/thing_filter.dart";
1718
export "scripting_api/exposed_thing.dart";
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2024 Contributors to the Eclipse Foundation. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
//
5+
// SPDX-License-Identifier: BSD-3-Clause
6+
7+
/// Enumeration for specifying the value of the `format` query parameter when
8+
/// using the `exploreDirectory` discovery method.
9+
///
10+
/// See [section 7.3.2.1.5] of the [WoT Discovery] specification for more
11+
/// information.
12+
///
13+
/// [WoT Discovery]: https://www.w3.org/TR/2023/REC-wot-discovery-20231205
14+
/// [section 7.3.2.1.5]: https://www.w3.org/TR/2023/REC-wot-discovery-20231205/#exploration-directory-api-things-listing
15+
enum DirectoryPayloadFormat {
16+
/// Indicates that an array of Thing Descriptions should be returned.
17+
///
18+
/// This is the default value.
19+
array,
20+
21+
/// Indicates that an collection of Thing Descriptions should be returned.
22+
collection,
23+
;
24+
25+
@override
26+
String toString() {
27+
switch (this) {
28+
case array:
29+
return "array";
30+
case collection:
31+
return "collection";
32+
}
33+
}
34+
}

lib/src/core/scripting_api/wot.dart

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,12 @@
77
import "../definitions.dart";
88

99
import "consumed_thing.dart";
10+
import "discovery/directory_payload_format.dart";
1011
import "discovery/thing_discovery.dart";
1112
import "discovery/thing_filter.dart";
1213
import "exposed_thing.dart";
1314
import "types.dart";
1415

15-
/// Enumeration for specifying the value of the `format` query parameter when
16-
/// using the `exploreDirectory` discovery method.
17-
///
18-
/// See [section 7.3.2.1.5] of the [WoT Discovery] specification for more
19-
/// information.
20-
///
21-
/// [WoT Discovery]: https://www.w3.org/TR/2023/REC-wot-discovery-20231205
22-
/// [section 7.3.2.1.5]: https://www.w3.org/TR/2023/REC-wot-discovery-20231205/#exploration-directory-api-things-listing
23-
enum DirectoryPayloadFormat {
24-
/// Indicates that an array of Thing Descriptions should be returned.
25-
///
26-
/// This is the default value.
27-
array,
28-
29-
/// Indicates that an collection of Thing Descriptions should be returned.
30-
collection,
31-
;
32-
33-
@override
34-
String toString() {
35-
switch (this) {
36-
case array:
37-
return "array";
38-
case collection:
39-
return "collection";
40-
}
41-
}
42-
}
43-
4416
/// Interface for a [WoT] runtime.
4517
///
4618
/// See WoT Scripting API specification,

0 commit comments

Comments
 (0)