Skip to content

Commit 7f6558d

Browse files
committed
fix: sealed Query interfaces
Without sealed interfaces we cannot use kotlinx-serialization-properties.
1 parent dd7ee25 commit 7f6558d

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

  • lib/src/main/kotlin/com/openmeteo/apix

lib/src/main/kotlin/com/openmeteo/apix/Query.kt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ import com.openmeteo.api.common.time.Date
44
import com.openmeteo.api.common.time.TimeFormat.UnixTime
55
import kotlinx.serialization.ExperimentalSerializationApi
66
import kotlinx.serialization.SerialName
7-
import kotlinx.serialization.Serializable
87
import kotlinx.serialization.properties.Properties
98
import kotlinx.serialization.properties.encodeToStringMap
109
import java.net.URLEncoder.encode
1110

12-
@Serializable
1311
sealed interface Query {
1412

1513
/**
@@ -45,7 +43,7 @@ sealed interface Query {
4543
/**
4644
* Query for resources that have a timezone field.
4745
*/
48-
interface TimeZone : Query {
46+
sealed interface TimeZone : Query {
4947
/**
5048
* The timezone to optionally use.
5149
*/
@@ -56,7 +54,7 @@ sealed interface Query {
5654
/**
5755
* Query for resources that have (formatted) time fields.
5856
*/
59-
interface TimeFormat : Query {
57+
sealed interface TimeFormat : Query {
6058
/**
6159
* The time format that should be used in the response.
6260
*
@@ -69,7 +67,7 @@ sealed interface Query {
6967
/**
7068
* Query for resources that have daily fields.
7169
*/
72-
interface Daily : TimeFormat {
70+
sealed interface Daily : TimeFormat {
7371
/**
7472
* The daily fields queried.
7573
*/
@@ -84,7 +82,7 @@ sealed interface Query {
8482
/**
8583
* Query for resources that have hourly fields.
8684
*/
87-
interface Hourly : TimeFormat {
85+
sealed interface Hourly : TimeFormat {
8886
/**
8987
* The hourly fields queried.
9088
*/
@@ -99,7 +97,7 @@ sealed interface Query {
9997
/**
10098
* Query for resources that can be retrieved in a specific date range.
10199
*/
102-
interface DateRange : Query {
100+
sealed interface DateRange : Query {
103101

104102
/**
105103
* The start date of the range.
@@ -117,7 +115,7 @@ sealed interface Query {
117115
/**
118116
* Query for resources that may pick the content format.
119117
*/
120-
interface ContentFormat : Query {
118+
sealed interface ContentFormat : Query {
121119
/**
122120
* The requested content format.
123121
*/
@@ -127,12 +125,12 @@ sealed interface Query {
127125
/**
128126
* Query for location-based resources.
129127
*/
130-
interface Coordinate : com.openmeteo.apix.Coordinate, Query
128+
sealed interface Coordinate : com.openmeteo.apix.Coordinate, Query
131129

132130
/**
133131
* Query for resources that may include the current weather in the response.
134132
*/
135-
interface CurrentWeather : Query {
133+
sealed interface CurrentWeather : Query {
136134
/**
137135
* Whether to include the current weather in the response or not.
138136
*/

0 commit comments

Comments
 (0)