From e00798229f0c6f2b316acd8c807da083803e3cf8 Mon Sep 17 00:00:00 2001 From: Jordon de Hoog Date: Fri, 29 Mar 2024 12:16:53 -0400 Subject: [PATCH] Fix: Package names (#24) --- ...mpass-autocomplete-geocoder-googlemaps.api | 6 +- ...mpass-autocomplete-geocoder-googlemaps.api | 6 +- .../{web => }/GoogleMapsAutocomplete.kt | 59 ++++++++++++++++--- .../compass-autocomplete-geocoder-mapbox.api | 6 +- .../compass-autocomplete-geocoder-mapbox.api | 6 +- .../{web => }/MapboxAutocomplete.kt | 49 ++++++++++++++- .../api/compass-autocomplete-mobile.api | 2 +- .../Autocomplete.kt => MobileAutocomplete.kt} | 6 +- .../api/android/compass-autocomplete-web.api | 2 +- .../api/jvm/compass-autocomplete-web.api | 2 +- .../{web => }/HttpAutocomplete.kt | 6 +- .../api/compass-geocoder-mobile.api | 10 ++-- .../{mobile/Geocoder.kt => MobileGeocoder.kt} | 4 +- .../compass-geocoder-web-googlemaps.api | 22 +++---- .../jvm/compass-geocoder-web-googlemaps.api | 22 +++---- .../geocoder/{web => }/GoogleMapsGeocoder.kt | 24 +++++++- .../android/compass-geocoder-web-mapbox.api | 22 +++---- .../api/jvm/compass-geocoder-web-mapbox.api | 22 +++---- .../geocoder/{web => }/MapboxGeocoder.kt | 26 +++++++- .../android/compass-geocoder-web-template.api | 22 +++---- .../api/jvm/compass-geocoder-web-template.api | 22 +++---- .../geocoder/{web => }/TemplateGeocoder.kt | 26 +++++++- .../api/android/compass-geocoder-web.api | 16 ++--- .../api/jvm/compass-geocoder-web.api | 16 ++--- .../compass/geocoder/{web => }/Geocoder.kt | 10 ++-- .../Geolocator.kt => BrowserGeolocator.kt} | 5 +- .../api/compass-geolocation-mobile.api | 2 +- .../Geolocator.kt => MobileGeolocator.kt} | 6 +- .../geolocation/mobile/MobileLocator.kt | 2 +- .../api/compass-permissions-mobile.api | 11 ++-- .../PermissionController.android.kt | 4 +- ...oller.kt => MobilePermissionController.kt} | 14 ++++- .../{mobile => }/PermissionController.ios.kt | 4 +- .../geocoder/GoogleMapsGeocoderScreen.kt | 2 +- .../kotlin/geocoder/MapboxGeocoderScreen.kt | 2 +- 35 files changed, 326 insertions(+), 140 deletions(-) rename compass-autocomplete-geocoder-googlemaps/src/commonMain/kotlin/dev/jordond/compass/autocomplete/{web => }/GoogleMapsAutocomplete.kt (65%) rename compass-autocomplete-geocoder-mapbox/src/commonMain/kotlin/dev/jordond/compass/autocomplete/{web => }/MapboxAutocomplete.kt (69%) rename compass-autocomplete-mobile/src/commonMain/kotlin/dev/jordond/compass/autocomplete/{mobile/Autocomplete.kt => MobileAutocomplete.kt} (79%) rename compass-autocomplete-web/src/commonMain/kotlin/dev/jordond/compass/autocomplete/{web => }/HttpAutocomplete.kt (91%) rename compass-geocoder-mobile/src/commonMain/kotlin/dev/jordond/compass/geocoder/{mobile/Geocoder.kt => MobileGeocoder.kt} (91%) rename compass-geocoder-web-googlemaps/src/commonMain/kotlin/dev/jordond/compass/geocoder/{web => }/GoogleMapsGeocoder.kt (80%) rename compass-geocoder-web-mapbox/src/commonMain/kotlin/dev/jordond/compass/geocoder/{web => }/MapboxGeocoder.kt (80%) rename compass-geocoder-web-template/src/commonMain/kotlin/dev/jordond/compass/geocoder/{web => }/TemplateGeocoder.kt (80%) rename compass-geocoder-web/src/commonMain/kotlin/dev/jordond/compass/geocoder/{web => }/Geocoder.kt (90%) rename compass-geolocation-browser/src/commonMain/kotlin/dev/jordond/compass/geolocation/{browser/Geolocator.kt => BrowserGeolocator.kt} (89%) rename compass-geolocation-mobile/src/commonMain/kotlin/dev/jordond/compass/geolocation/{mobile/Geolocator.kt => MobileGeolocator.kt} (94%) rename compass-permissions-mobile/src/androidMain/kotlin/dev/jordond/compass/permissions/{mobile => }/PermissionController.android.kt (93%) rename compass-permissions-mobile/src/commonMain/kotlin/dev/jordond/compass/permissions/{mobile/PermissionController.kt => MobilePermissionController.kt} (64%) rename compass-permissions-mobile/src/iosMain/kotlin/dev/jordond/compass/permissions/{mobile => }/PermissionController.ios.kt (91%) diff --git a/compass-autocomplete-geocoder-googlemaps/api/android/compass-autocomplete-geocoder-googlemaps.api b/compass-autocomplete-geocoder-googlemaps/api/android/compass-autocomplete-geocoder-googlemaps.api index 3dce391..516f80d 100644 --- a/compass-autocomplete-geocoder-googlemaps/api/android/compass-autocomplete-geocoder-googlemaps.api +++ b/compass-autocomplete-geocoder-googlemaps/api/android/compass-autocomplete-geocoder-googlemaps.api @@ -1,4 +1,8 @@ -public final class dev/jordond/compass/autocomplete/web/GoogleMapsAutocompleteKt { +public final class dev/jordond/compass/autocomplete/GoogleMapsAutocompleteKt { + public static final fun Autocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; + public static final fun Autocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/autocomplete/Autocomplete; + public static synthetic fun Autocomplete$default (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; + public static synthetic fun Autocomplete$default (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; public static final fun GoogleMapsGeocoderAutocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; public static final fun GoogleMapsGeocoderAutocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/autocomplete/Autocomplete; public static synthetic fun GoogleMapsGeocoderAutocomplete$default (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; diff --git a/compass-autocomplete-geocoder-googlemaps/api/jvm/compass-autocomplete-geocoder-googlemaps.api b/compass-autocomplete-geocoder-googlemaps/api/jvm/compass-autocomplete-geocoder-googlemaps.api index 3dce391..516f80d 100644 --- a/compass-autocomplete-geocoder-googlemaps/api/jvm/compass-autocomplete-geocoder-googlemaps.api +++ b/compass-autocomplete-geocoder-googlemaps/api/jvm/compass-autocomplete-geocoder-googlemaps.api @@ -1,4 +1,8 @@ -public final class dev/jordond/compass/autocomplete/web/GoogleMapsAutocompleteKt { +public final class dev/jordond/compass/autocomplete/GoogleMapsAutocompleteKt { + public static final fun Autocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; + public static final fun Autocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/autocomplete/Autocomplete; + public static synthetic fun Autocomplete$default (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; + public static synthetic fun Autocomplete$default (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; public static final fun GoogleMapsGeocoderAutocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; public static final fun GoogleMapsGeocoderAutocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/autocomplete/Autocomplete; public static synthetic fun GoogleMapsGeocoderAutocomplete$default (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; diff --git a/compass-autocomplete-geocoder-googlemaps/src/commonMain/kotlin/dev/jordond/compass/autocomplete/web/GoogleMapsAutocomplete.kt b/compass-autocomplete-geocoder-googlemaps/src/commonMain/kotlin/dev/jordond/compass/autocomplete/GoogleMapsAutocomplete.kt similarity index 65% rename from compass-autocomplete-geocoder-googlemaps/src/commonMain/kotlin/dev/jordond/compass/autocomplete/web/GoogleMapsAutocomplete.kt rename to compass-autocomplete-geocoder-googlemaps/src/commonMain/kotlin/dev/jordond/compass/autocomplete/GoogleMapsAutocomplete.kt index 3daf83a..b4c41ff 100644 --- a/compass-autocomplete-geocoder-googlemaps/src/commonMain/kotlin/dev/jordond/compass/autocomplete/web/GoogleMapsAutocomplete.kt +++ b/compass-autocomplete-geocoder-googlemaps/src/commonMain/kotlin/dev/jordond/compass/autocomplete/GoogleMapsAutocomplete.kt @@ -1,10 +1,9 @@ @file:Suppress("FunctionName") -package dev.jordond.compass.autocomplete.web +package dev.jordond.compass.autocomplete import dev.jordond.compass.Place -import dev.jordond.compass.autocomplete.Autocomplete -import dev.jordond.compass.autocomplete.AutocompleteOptions +import dev.jordond.compass.autocomplete.web.GoogleMapsGeocoderAutocompleteService import dev.jordond.compass.geocoder.web.parameter.GoogleMapsParameters import dev.jordond.compass.geocoder.web.parameter.GoogleMapsParametersBuilder import dev.jordond.compass.geocoder.web.parameter.googleMapsParameters @@ -14,6 +13,50 @@ import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers import kotlinx.serialization.json.Json +/** + * Creates a new [Autocomplete] instance that uses the Google Maps Geocoding API. + * + * @param apiKey The Google Maps API key. + * @param options The autocomplete options. + * @param parameters The Google Maps geocoder parameters. + * @param json The JSON serializer. + * @param client The HTTP client to make the requests with. + * @param dispatcher The coroutine dispatcher. + * @return A new [Autocomplete] instance. + */ +public fun Autocomplete( + apiKey: String, + options: AutocompleteOptions = AutocompleteOptions(), + parameters: GoogleMapsParameters = GoogleMapsParameters(), + json: Json = HttpApiEndpoint.json(), + client: HttpClient = HttpApiEndpoint.httpClient(json), + dispatcher: CoroutineDispatcher = Dispatchers.Default, +): Autocomplete { + return GoogleMapsGeocoderAutocomplete(apiKey, options, parameters, json, client, dispatcher) +} + +/** + * Creates a new [Autocomplete] instance that uses the Google Maps Geocoding API. + * + * @param apiKey The Google Maps API key. + * @param options The autocomplete options. + * @param json The JSON serializer. + * @param client The HTTP client to make the requests with. + * @param dispatcher The coroutine dispatcher. + * @param block The builder block to configure the Google Maps geocoder parameters. + * @return A new [Autocomplete] instance. + */ +public fun Autocomplete( + apiKey: String, + options: AutocompleteOptions = AutocompleteOptions(), + json: Json = HttpApiEndpoint.json(), + client: HttpClient = HttpApiEndpoint.httpClient(json), + dispatcher: CoroutineDispatcher = Dispatchers.Default, + block: GoogleMapsParametersBuilder.() -> Unit, +): Autocomplete { + return GoogleMapsGeocoderAutocomplete(apiKey, options, json, client, dispatcher, block) +} + /** * Creates a new [Autocomplete] instance that uses the Google Maps Geocoding API. * @@ -82,8 +125,9 @@ public fun Autocomplete.Companion.googleMapsGeocoder( json: Json = HttpApiEndpoint.json(), client: HttpClient = HttpApiEndpoint.httpClient(json), dispatcher: CoroutineDispatcher = Dispatchers.Default, -): Autocomplete = - GoogleMapsGeocoderAutocomplete(apiKey, options, parameters, json, client, dispatcher) +): Autocomplete { + return GoogleMapsGeocoderAutocomplete(apiKey, options, parameters, json, client, dispatcher) +} /** * Creates a new [Autocomplete] instance that uses the Google Maps Geocoding API. @@ -103,5 +147,6 @@ public fun Autocomplete.Companion.googleMapsGeocoder( client: HttpClient = HttpApiEndpoint.httpClient(json), dispatcher: CoroutineDispatcher = Dispatchers.Default, block: GoogleMapsParametersBuilder.() -> Unit, -): Autocomplete = - GoogleMapsGeocoderAutocomplete(apiKey, options, json, client, dispatcher, block) \ No newline at end of file +): Autocomplete { + return GoogleMapsGeocoderAutocomplete(apiKey, options, json, client, dispatcher, block) +} \ No newline at end of file diff --git a/compass-autocomplete-geocoder-mapbox/api/android/compass-autocomplete-geocoder-mapbox.api b/compass-autocomplete-geocoder-mapbox/api/android/compass-autocomplete-geocoder-mapbox.api index 9ff8a9d..dc1795b 100644 --- a/compass-autocomplete-geocoder-mapbox/api/android/compass-autocomplete-geocoder-mapbox.api +++ b/compass-autocomplete-geocoder-mapbox/api/android/compass-autocomplete-geocoder-mapbox.api @@ -1,4 +1,8 @@ -public final class dev/jordond/compass/autocomplete/web/MapboxAutocompleteKt { +public final class dev/jordond/compass/autocomplete/MapboxAutocompleteKt { + public static final fun Autocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; + public static final fun Autocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/autocomplete/Autocomplete; + public static synthetic fun Autocomplete$default (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; + public static synthetic fun Autocomplete$default (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; public static final fun MapboxGeocoderAutocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; public static final fun MapboxGeocoderAutocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/autocomplete/Autocomplete; public static synthetic fun MapboxGeocoderAutocomplete$default (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; diff --git a/compass-autocomplete-geocoder-mapbox/api/jvm/compass-autocomplete-geocoder-mapbox.api b/compass-autocomplete-geocoder-mapbox/api/jvm/compass-autocomplete-geocoder-mapbox.api index 9ff8a9d..dc1795b 100644 --- a/compass-autocomplete-geocoder-mapbox/api/jvm/compass-autocomplete-geocoder-mapbox.api +++ b/compass-autocomplete-geocoder-mapbox/api/jvm/compass-autocomplete-geocoder-mapbox.api @@ -1,4 +1,8 @@ -public final class dev/jordond/compass/autocomplete/web/MapboxAutocompleteKt { +public final class dev/jordond/compass/autocomplete/MapboxAutocompleteKt { + public static final fun Autocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; + public static final fun Autocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/autocomplete/Autocomplete; + public static synthetic fun Autocomplete$default (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; + public static synthetic fun Autocomplete$default (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; public static final fun MapboxGeocoderAutocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; public static final fun MapboxGeocoderAutocomplete (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/autocomplete/Autocomplete; public static synthetic fun MapboxGeocoderAutocomplete$default (Ljava/lang/String;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; diff --git a/compass-autocomplete-geocoder-mapbox/src/commonMain/kotlin/dev/jordond/compass/autocomplete/web/MapboxAutocomplete.kt b/compass-autocomplete-geocoder-mapbox/src/commonMain/kotlin/dev/jordond/compass/autocomplete/MapboxAutocomplete.kt similarity index 69% rename from compass-autocomplete-geocoder-mapbox/src/commonMain/kotlin/dev/jordond/compass/autocomplete/web/MapboxAutocomplete.kt rename to compass-autocomplete-geocoder-mapbox/src/commonMain/kotlin/dev/jordond/compass/autocomplete/MapboxAutocomplete.kt index d0da401..382e65e 100644 --- a/compass-autocomplete-geocoder-mapbox/src/commonMain/kotlin/dev/jordond/compass/autocomplete/web/MapboxAutocomplete.kt +++ b/compass-autocomplete-geocoder-mapbox/src/commonMain/kotlin/dev/jordond/compass/autocomplete/MapboxAutocomplete.kt @@ -1,10 +1,9 @@ @file:Suppress("FunctionName") -package dev.jordond.compass.autocomplete.web +package dev.jordond.compass.autocomplete import dev.jordond.compass.Place -import dev.jordond.compass.autocomplete.Autocomplete -import dev.jordond.compass.autocomplete.AutocompleteOptions +import dev.jordond.compass.autocomplete.web.MapboxGeocoderAutocompleteService import dev.jordond.compass.geocoder.web.parameter.MapboxParameters import dev.jordond.compass.geocoder.web.parameter.MapboxParametersBuilder import dev.jordond.compass.geocoder.web.parameter.mapboxParameters @@ -14,6 +13,50 @@ import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers import kotlinx.serialization.json.Json +/** + * Creates a new [Autocomplete] instance that uses the Mapbox Geocoding API. + * + * @param apiKey The Mapbox API key. + * @param options The autocomplete options. + * @param parameters The Mapbox geocoder parameters. + * @param json The JSON serializer. + * @param client The HTTP client to make the requests with. + * @param dispatcher The coroutine dispatcher. + * @return A new [Autocomplete] instance. + */ +public fun Autocomplete( + apiKey: String, + options: AutocompleteOptions = AutocompleteOptions(), + parameters: MapboxParameters = MapboxParameters(), + json: Json = HttpApiEndpoint.json(), + client: HttpClient = HttpApiEndpoint.httpClient(json), + dispatcher: CoroutineDispatcher = Dispatchers.Default, +): Autocomplete { + return MapboxGeocoderAutocomplete(apiKey, options, parameters, json, client, dispatcher) +} + +/** + * Creates a new [Autocomplete] instance that uses the Mapbox Geocoding API. + * + * @param apiKey The Mapbox API key. + * @param options The autocomplete options. + * @param json The JSON serializer. + * @param client The HTTP client to make the requests with. + * @param dispatcher The coroutine dispatcher. + * @param block The builder block to configure the Mapbox geocoder parameters. + * @return A new [Autocomplete] instance. + */ +public fun Autocomplete( + apiKey: String, + options: AutocompleteOptions = AutocompleteOptions(), + json: Json = HttpApiEndpoint.json(), + client: HttpClient = HttpApiEndpoint.httpClient(json), + dispatcher: CoroutineDispatcher = Dispatchers.Default, + block: MapboxParametersBuilder.() -> Unit, +): Autocomplete { + return MapboxGeocoderAutocomplete(apiKey, options, json, client, dispatcher, block) +} + /** * Creates a new [Autocomplete] instance that uses the Mapbox Geocoding API. * diff --git a/compass-autocomplete-mobile/api/compass-autocomplete-mobile.api b/compass-autocomplete-mobile/api/compass-autocomplete-mobile.api index 35d56f9..ae14ba1 100644 --- a/compass-autocomplete-mobile/api/compass-autocomplete-mobile.api +++ b/compass-autocomplete-mobile/api/compass-autocomplete-mobile.api @@ -1,4 +1,4 @@ -public final class dev/jordond/compass/autocomplete/mobile/AutocompleteKt { +public final class dev/jordond/compass/autocomplete/MobileAutocompleteKt { public static final fun Autocomplete (Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; public static synthetic fun Autocomplete$default (Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; public static final fun MobileAutocomplete (Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; diff --git a/compass-autocomplete-mobile/src/commonMain/kotlin/dev/jordond/compass/autocomplete/mobile/Autocomplete.kt b/compass-autocomplete-mobile/src/commonMain/kotlin/dev/jordond/compass/autocomplete/MobileAutocomplete.kt similarity index 79% rename from compass-autocomplete-mobile/src/commonMain/kotlin/dev/jordond/compass/autocomplete/mobile/Autocomplete.kt rename to compass-autocomplete-mobile/src/commonMain/kotlin/dev/jordond/compass/autocomplete/MobileAutocomplete.kt index 9e0694b..374034f 100644 --- a/compass-autocomplete-mobile/src/commonMain/kotlin/dev/jordond/compass/autocomplete/mobile/Autocomplete.kt +++ b/compass-autocomplete-mobile/src/commonMain/kotlin/dev/jordond/compass/autocomplete/MobileAutocomplete.kt @@ -1,9 +1,7 @@ -package dev.jordond.compass.autocomplete.mobile +package dev.jordond.compass.autocomplete import dev.jordond.compass.Place -import dev.jordond.compass.autocomplete.Autocomplete -import dev.jordond.compass.autocomplete.AutocompleteOptions -import dev.jordond.compass.autocomplete.AutocompleteService +import dev.jordond.compass.autocomplete.mobile.mobile import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers diff --git a/compass-autocomplete-web/api/android/compass-autocomplete-web.api b/compass-autocomplete-web/api/android/compass-autocomplete-web.api index e637c92..db0e4f6 100644 --- a/compass-autocomplete-web/api/android/compass-autocomplete-web.api +++ b/compass-autocomplete-web/api/android/compass-autocomplete-web.api @@ -1,4 +1,4 @@ -public final class dev/jordond/compass/autocomplete/web/HttpAutocompleteKt { +public final class dev/jordond/compass/autocomplete/HttpAutocompleteKt { public static final fun Autocomplete (Ldev/jordond/compass/autocomplete/web/HttpAutocompleteService;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; public static final fun Autocomplete (Ldev/jordond/compass/tools/web/HttpApiEndpoint;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; public static synthetic fun Autocomplete$default (Ldev/jordond/compass/autocomplete/web/HttpAutocompleteService;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; diff --git a/compass-autocomplete-web/api/jvm/compass-autocomplete-web.api b/compass-autocomplete-web/api/jvm/compass-autocomplete-web.api index e637c92..db0e4f6 100644 --- a/compass-autocomplete-web/api/jvm/compass-autocomplete-web.api +++ b/compass-autocomplete-web/api/jvm/compass-autocomplete-web.api @@ -1,4 +1,4 @@ -public final class dev/jordond/compass/autocomplete/web/HttpAutocompleteKt { +public final class dev/jordond/compass/autocomplete/HttpAutocompleteKt { public static final fun Autocomplete (Ldev/jordond/compass/autocomplete/web/HttpAutocompleteService;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; public static final fun Autocomplete (Ldev/jordond/compass/tools/web/HttpApiEndpoint;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/autocomplete/Autocomplete; public static synthetic fun Autocomplete$default (Ldev/jordond/compass/autocomplete/web/HttpAutocompleteService;Ldev/jordond/compass/autocomplete/AutocompleteOptions;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/autocomplete/Autocomplete; diff --git a/compass-autocomplete-web/src/commonMain/kotlin/dev/jordond/compass/autocomplete/web/HttpAutocomplete.kt b/compass-autocomplete-web/src/commonMain/kotlin/dev/jordond/compass/autocomplete/HttpAutocomplete.kt similarity index 91% rename from compass-autocomplete-web/src/commonMain/kotlin/dev/jordond/compass/autocomplete/web/HttpAutocomplete.kt rename to compass-autocomplete-web/src/commonMain/kotlin/dev/jordond/compass/autocomplete/HttpAutocomplete.kt index f67a9da..cbc0837 100644 --- a/compass-autocomplete-web/src/commonMain/kotlin/dev/jordond/compass/autocomplete/web/HttpAutocomplete.kt +++ b/compass-autocomplete-web/src/commonMain/kotlin/dev/jordond/compass/autocomplete/HttpAutocomplete.kt @@ -1,7 +1,7 @@ -package dev.jordond.compass.autocomplete.web +package dev.jordond.compass.autocomplete -import dev.jordond.compass.autocomplete.Autocomplete -import dev.jordond.compass.autocomplete.AutocompleteOptions +import dev.jordond.compass.autocomplete.web.HttpAutocompleteService +import dev.jordond.compass.autocomplete.web.SearchEndpoint import dev.jordond.compass.tools.web.HttpApiEndpoint import io.ktor.client.HttpClient import kotlinx.coroutines.CoroutineDispatcher diff --git a/compass-geocoder-mobile/api/compass-geocoder-mobile.api b/compass-geocoder-mobile/api/compass-geocoder-mobile.api index 4e0682d..66261fb 100644 --- a/compass-geocoder-mobile/api/compass-geocoder-mobile.api +++ b/compass-geocoder-mobile/api/compass-geocoder-mobile.api @@ -1,8 +1,4 @@ -public final class dev/jordond/compass/geocoder/mobile/ExtensionsKt { - public static final fun placesOrNull (Ldev/jordond/compass/geocoder/Geocoder;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; -} - -public final class dev/jordond/compass/geocoder/mobile/GeocoderKt { +public final class dev/jordond/compass/geocoder/MobileGeocoderKt { public static final fun Geocoder (Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; public static synthetic fun Geocoder$default (Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun MobileGeocoder (Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; @@ -11,6 +7,10 @@ public final class dev/jordond/compass/geocoder/mobile/GeocoderKt { public static synthetic fun mobile$default (Ldev/jordond/compass/geocoder/Geocoder$Companion;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; } +public final class dev/jordond/compass/geocoder/mobile/ExtensionsKt { + public static final fun placesOrNull (Ldev/jordond/compass/geocoder/Geocoder;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; +} + public abstract interface class dev/jordond/compass/geocoder/mobile/MobilePlatformGeocoder : dev/jordond/compass/geocoder/PlatformGeocoder { public abstract fun placeFromAddress (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } diff --git a/compass-geocoder-mobile/src/commonMain/kotlin/dev/jordond/compass/geocoder/mobile/Geocoder.kt b/compass-geocoder-mobile/src/commonMain/kotlin/dev/jordond/compass/geocoder/MobileGeocoder.kt similarity index 91% rename from compass-geocoder-mobile/src/commonMain/kotlin/dev/jordond/compass/geocoder/mobile/Geocoder.kt rename to compass-geocoder-mobile/src/commonMain/kotlin/dev/jordond/compass/geocoder/MobileGeocoder.kt index b3b994e..ffa6f44 100644 --- a/compass-geocoder-mobile/src/commonMain/kotlin/dev/jordond/compass/geocoder/mobile/Geocoder.kt +++ b/compass-geocoder-mobile/src/commonMain/kotlin/dev/jordond/compass/geocoder/MobileGeocoder.kt @@ -1,6 +1,6 @@ -package dev.jordond.compass.geocoder.mobile +package dev.jordond.compass.geocoder -import dev.jordond.compass.geocoder.Geocoder +import dev.jordond.compass.geocoder.mobile.MobilePlatformGeocoder import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers diff --git a/compass-geocoder-web-googlemaps/api/android/compass-geocoder-web-googlemaps.api b/compass-geocoder-web-googlemaps/api/android/compass-geocoder-web-googlemaps.api index e194b45..fa69f92 100644 --- a/compass-geocoder-web-googlemaps/api/android/compass-geocoder-web-googlemaps.api +++ b/compass-geocoder-web-googlemaps/api/android/compass-geocoder-web-googlemaps.api @@ -1,13 +1,6 @@ -public final class dev/jordond/compass/geocoder/web/GoogleMapsForwardEndpoint : dev/jordond/compass/tools/web/HttpApiEndpoint { - public fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;)V - public synthetic fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V - public fun mapResponse (Lio/ktor/client/statement/HttpResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun url (Ljava/lang/Object;)Ljava/lang/String; - public fun url (Ljava/lang/String;)Ljava/lang/String; -} - -public final class dev/jordond/compass/geocoder/web/GoogleMapsGeocoderKt { +public final class dev/jordond/compass/geocoder/GoogleMapsGeocoderKt { + public static final fun Geocoder (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; + public static synthetic fun Geocoder$default (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun GoogleMapsGeocoder (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun GoogleMapsGeocoder (Ljava/lang/String;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/geocoder/Geocoder; public static synthetic fun GoogleMapsGeocoder$default (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; @@ -18,6 +11,15 @@ public final class dev/jordond/compass/geocoder/web/GoogleMapsGeocoderKt { public static synthetic fun googleMaps$default (Ldev/jordond/compass/geocoder/Geocoder$Companion;Ljava/lang/String;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; } +public final class dev/jordond/compass/geocoder/web/GoogleMapsForwardEndpoint : dev/jordond/compass/tools/web/HttpApiEndpoint { + public fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;)V + public synthetic fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V + public fun mapResponse (Lio/ktor/client/statement/HttpResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun url (Ljava/lang/Object;)Ljava/lang/String; + public fun url (Ljava/lang/String;)Ljava/lang/String; +} + public abstract interface class dev/jordond/compass/geocoder/web/GoogleMapsPlatformGeocoder : dev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder { public static final field Companion Ldev/jordond/compass/geocoder/web/GoogleMapsPlatformGeocoder$Companion; } diff --git a/compass-geocoder-web-googlemaps/api/jvm/compass-geocoder-web-googlemaps.api b/compass-geocoder-web-googlemaps/api/jvm/compass-geocoder-web-googlemaps.api index e194b45..fa69f92 100644 --- a/compass-geocoder-web-googlemaps/api/jvm/compass-geocoder-web-googlemaps.api +++ b/compass-geocoder-web-googlemaps/api/jvm/compass-geocoder-web-googlemaps.api @@ -1,13 +1,6 @@ -public final class dev/jordond/compass/geocoder/web/GoogleMapsForwardEndpoint : dev/jordond/compass/tools/web/HttpApiEndpoint { - public fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;)V - public synthetic fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V - public fun mapResponse (Lio/ktor/client/statement/HttpResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun url (Ljava/lang/Object;)Ljava/lang/String; - public fun url (Ljava/lang/String;)Ljava/lang/String; -} - -public final class dev/jordond/compass/geocoder/web/GoogleMapsGeocoderKt { +public final class dev/jordond/compass/geocoder/GoogleMapsGeocoderKt { + public static final fun Geocoder (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; + public static synthetic fun Geocoder$default (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun GoogleMapsGeocoder (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun GoogleMapsGeocoder (Ljava/lang/String;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/geocoder/Geocoder; public static synthetic fun GoogleMapsGeocoder$default (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; @@ -18,6 +11,15 @@ public final class dev/jordond/compass/geocoder/web/GoogleMapsGeocoderKt { public static synthetic fun googleMaps$default (Ldev/jordond/compass/geocoder/Geocoder$Companion;Ljava/lang/String;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; } +public final class dev/jordond/compass/geocoder/web/GoogleMapsForwardEndpoint : dev/jordond/compass/tools/web/HttpApiEndpoint { + public fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;)V + public synthetic fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/GoogleMapsParameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V + public fun mapResponse (Lio/ktor/client/statement/HttpResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun url (Ljava/lang/Object;)Ljava/lang/String; + public fun url (Ljava/lang/String;)Ljava/lang/String; +} + public abstract interface class dev/jordond/compass/geocoder/web/GoogleMapsPlatformGeocoder : dev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder { public static final field Companion Ldev/jordond/compass/geocoder/web/GoogleMapsPlatformGeocoder$Companion; } diff --git a/compass-geocoder-web-googlemaps/src/commonMain/kotlin/dev/jordond/compass/geocoder/web/GoogleMapsGeocoder.kt b/compass-geocoder-web-googlemaps/src/commonMain/kotlin/dev/jordond/compass/geocoder/GoogleMapsGeocoder.kt similarity index 80% rename from compass-geocoder-web-googlemaps/src/commonMain/kotlin/dev/jordond/compass/geocoder/web/GoogleMapsGeocoder.kt rename to compass-geocoder-web-googlemaps/src/commonMain/kotlin/dev/jordond/compass/geocoder/GoogleMapsGeocoder.kt index d62b8ed..0e85192 100644 --- a/compass-geocoder-web-googlemaps/src/commonMain/kotlin/dev/jordond/compass/geocoder/web/GoogleMapsGeocoder.kt +++ b/compass-geocoder-web-googlemaps/src/commonMain/kotlin/dev/jordond/compass/geocoder/GoogleMapsGeocoder.kt @@ -1,8 +1,8 @@ @file:Suppress("FunctionName") -package dev.jordond.compass.geocoder.web +package dev.jordond.compass.geocoder -import dev.jordond.compass.geocoder.Geocoder +import dev.jordond.compass.geocoder.web.GoogleMapsPlatformGeocoder import dev.jordond.compass.geocoder.web.parameter.GoogleMapsParameters import dev.jordond.compass.geocoder.web.parameter.GoogleMapsParametersBuilder import dev.jordond.compass.geocoder.web.parameter.googleMapsParameters @@ -12,6 +12,26 @@ import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers import kotlinx.serialization.json.Json +/** + * Creates a new [Geocoder] using the Google Maps HTTP API geocoding service. + * + * See [Google Maps](https://developers.google.com/maps/documentation/geocoding) for more information. + * + * @param apiKey The Google Maps API key. + * @param parameters The parameters to use for the geocoder. + * @param json The JSON implementation to use for serialization. + * @param client The HTTP client to use for requests. + * @param dispatcher The coroutine dispatcher to use for requests. + * @return A new [Geocoder] using the Google Maps HTTP API geocoding service. + */ +public fun Geocoder( + apiKey: String, + parameters: GoogleMapsParameters = GoogleMapsParameters(), + json: Json = HttpApiEndpoint.json(), + client: HttpClient = HttpApiEndpoint.httpClient(json), + dispatcher: CoroutineDispatcher = Dispatchers.Default, +): Geocoder = GoogleMapsGeocoder(apiKey, parameters, json, client, dispatcher) + /** * Creates a new [Geocoder] using the Google Maps HTTP API geocoding service. * diff --git a/compass-geocoder-web-mapbox/api/android/compass-geocoder-web-mapbox.api b/compass-geocoder-web-mapbox/api/android/compass-geocoder-web-mapbox.api index 44df105..4d6d6ca 100644 --- a/compass-geocoder-web-mapbox/api/android/compass-geocoder-web-mapbox.api +++ b/compass-geocoder-web-mapbox/api/android/compass-geocoder-web-mapbox.api @@ -1,13 +1,6 @@ -public final class dev/jordond/compass/geocoder/web/MapboxForwardEndpoint : dev/jordond/compass/tools/web/HttpApiEndpoint { - public fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;)V - public synthetic fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V - public fun mapResponse (Lio/ktor/client/statement/HttpResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun url (Ljava/lang/Object;)Ljava/lang/String; - public fun url (Ljava/lang/String;)Ljava/lang/String; -} - -public final class dev/jordond/compass/geocoder/web/MapboxGeocoderKt { +public final class dev/jordond/compass/geocoder/MapboxGeocoderKt { + public static final fun Geocoder (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; + public static synthetic fun Geocoder$default (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun MapboxGeocoder (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun MapboxGeocoder (Ljava/lang/String;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/geocoder/Geocoder; public static synthetic fun MapboxGeocoder$default (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; @@ -18,6 +11,15 @@ public final class dev/jordond/compass/geocoder/web/MapboxGeocoderKt { public static synthetic fun mapbox$default (Ldev/jordond/compass/geocoder/Geocoder$Companion;Ljava/lang/String;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; } +public final class dev/jordond/compass/geocoder/web/MapboxForwardEndpoint : dev/jordond/compass/tools/web/HttpApiEndpoint { + public fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;)V + public synthetic fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V + public fun mapResponse (Lio/ktor/client/statement/HttpResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun url (Ljava/lang/Object;)Ljava/lang/String; + public fun url (Ljava/lang/String;)Ljava/lang/String; +} + public abstract interface class dev/jordond/compass/geocoder/web/MapboxPlatformGeocoder : dev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder { public static final field Companion Ldev/jordond/compass/geocoder/web/MapboxPlatformGeocoder$Companion; } diff --git a/compass-geocoder-web-mapbox/api/jvm/compass-geocoder-web-mapbox.api b/compass-geocoder-web-mapbox/api/jvm/compass-geocoder-web-mapbox.api index 44df105..4d6d6ca 100644 --- a/compass-geocoder-web-mapbox/api/jvm/compass-geocoder-web-mapbox.api +++ b/compass-geocoder-web-mapbox/api/jvm/compass-geocoder-web-mapbox.api @@ -1,13 +1,6 @@ -public final class dev/jordond/compass/geocoder/web/MapboxForwardEndpoint : dev/jordond/compass/tools/web/HttpApiEndpoint { - public fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;)V - public synthetic fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V - public fun mapResponse (Lio/ktor/client/statement/HttpResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun url (Ljava/lang/Object;)Ljava/lang/String; - public fun url (Ljava/lang/String;)Ljava/lang/String; -} - -public final class dev/jordond/compass/geocoder/web/MapboxGeocoderKt { +public final class dev/jordond/compass/geocoder/MapboxGeocoderKt { + public static final fun Geocoder (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; + public static synthetic fun Geocoder$default (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun MapboxGeocoder (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun MapboxGeocoder (Ljava/lang/String;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/geocoder/Geocoder; public static synthetic fun MapboxGeocoder$default (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; @@ -18,6 +11,15 @@ public final class dev/jordond/compass/geocoder/web/MapboxGeocoderKt { public static synthetic fun mapbox$default (Ldev/jordond/compass/geocoder/Geocoder$Companion;Ljava/lang/String;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; } +public final class dev/jordond/compass/geocoder/web/MapboxForwardEndpoint : dev/jordond/compass/tools/web/HttpApiEndpoint { + public fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;)V + public synthetic fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/MapboxParameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V + public fun mapResponse (Lio/ktor/client/statement/HttpResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun url (Ljava/lang/Object;)Ljava/lang/String; + public fun url (Ljava/lang/String;)Ljava/lang/String; +} + public abstract interface class dev/jordond/compass/geocoder/web/MapboxPlatformGeocoder : dev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder { public static final field Companion Ldev/jordond/compass/geocoder/web/MapboxPlatformGeocoder$Companion; } diff --git a/compass-geocoder-web-mapbox/src/commonMain/kotlin/dev/jordond/compass/geocoder/web/MapboxGeocoder.kt b/compass-geocoder-web-mapbox/src/commonMain/kotlin/dev/jordond/compass/geocoder/MapboxGeocoder.kt similarity index 80% rename from compass-geocoder-web-mapbox/src/commonMain/kotlin/dev/jordond/compass/geocoder/web/MapboxGeocoder.kt rename to compass-geocoder-web-mapbox/src/commonMain/kotlin/dev/jordond/compass/geocoder/MapboxGeocoder.kt index bf50cf5..c03da67 100644 --- a/compass-geocoder-web-mapbox/src/commonMain/kotlin/dev/jordond/compass/geocoder/web/MapboxGeocoder.kt +++ b/compass-geocoder-web-mapbox/src/commonMain/kotlin/dev/jordond/compass/geocoder/MapboxGeocoder.kt @@ -1,8 +1,8 @@ @file:Suppress("FunctionName") -package dev.jordond.compass.geocoder.web +package dev.jordond.compass.geocoder -import dev.jordond.compass.geocoder.Geocoder +import dev.jordond.compass.geocoder.web.MapboxPlatformGeocoder import dev.jordond.compass.geocoder.web.parameter.MapboxParameters import dev.jordond.compass.geocoder.web.parameter.MapboxParametersBuilder import dev.jordond.compass.geocoder.web.parameter.mapboxParameters @@ -12,6 +12,28 @@ import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers import kotlinx.serialization.json.Json +/** + * Creates a new [Geocoder] using the Mapbox HTTP API geocoding service. + * + * See [Mapbox](https://www.mapbox.com/) for more information. + * + * @param apiKey The Mapbox API key. + * @param parameters The parameters to use for the geocoder. + * @param json The JSON implementation to use for serialization. + * @param client The HTTP client to use for requests. + * @param dispatcher The coroutine dispatcher to use for requests. + * @return A new [Geocoder] using the Mapbox HTTP API geocoding service. + */ +public fun Geocoder( + apiKey: String, + parameters: MapboxParameters = MapboxParameters(), + json: Json = HttpApiEndpoint.json(), + client: HttpClient = HttpApiEndpoint.httpClient(json), + dispatcher: CoroutineDispatcher = Dispatchers.Default, +): Geocoder { + return MapboxGeocoder(apiKey, parameters, json, client, dispatcher) +} + /** * Creates a new [Geocoder] using the Mapbox HTTP API geocoding service. * diff --git a/compass-geocoder-web-template/api/android/compass-geocoder-web-template.api b/compass-geocoder-web-template/api/android/compass-geocoder-web-template.api index cbecbf5..97598d0 100644 --- a/compass-geocoder-web-template/api/android/compass-geocoder-web-template.api +++ b/compass-geocoder-web-template/api/android/compass-geocoder-web-template.api @@ -1,13 +1,6 @@ -public final class dev/jordond/compass/geocoder/web/TemplateForwardEndpoint : dev/jordond/compass/tools/web/HttpApiEndpoint { - public fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;)V - public synthetic fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V - public fun mapResponse (Lio/ktor/client/statement/HttpResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun url (Ljava/lang/Object;)Ljava/lang/String; - public fun url (Ljava/lang/String;)Ljava/lang/String; -} - -public final class dev/jordond/compass/geocoder/web/TemplateGeocoderKt { +public final class dev/jordond/compass/geocoder/TemplateGeocoderKt { + public static final fun Geocoder (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; + public static synthetic fun Geocoder$default (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun TemplateGeocoder (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun TemplateGeocoder (Ljava/lang/String;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/geocoder/Geocoder; public static synthetic fun TemplateGeocoder$default (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; @@ -18,6 +11,15 @@ public final class dev/jordond/compass/geocoder/web/TemplateGeocoderKt { public static synthetic fun template$default (Ldev/jordond/compass/geocoder/Geocoder$Companion;Ljava/lang/String;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; } +public final class dev/jordond/compass/geocoder/web/TemplateForwardEndpoint : dev/jordond/compass/tools/web/HttpApiEndpoint { + public fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;)V + public synthetic fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V + public fun mapResponse (Lio/ktor/client/statement/HttpResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun url (Ljava/lang/Object;)Ljava/lang/String; + public fun url (Ljava/lang/String;)Ljava/lang/String; +} + public abstract interface class dev/jordond/compass/geocoder/web/TemplatePlatformGeocoder : dev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder { public static final field Companion Ldev/jordond/compass/geocoder/web/TemplatePlatformGeocoder$Companion; } diff --git a/compass-geocoder-web-template/api/jvm/compass-geocoder-web-template.api b/compass-geocoder-web-template/api/jvm/compass-geocoder-web-template.api index cbecbf5..97598d0 100644 --- a/compass-geocoder-web-template/api/jvm/compass-geocoder-web-template.api +++ b/compass-geocoder-web-template/api/jvm/compass-geocoder-web-template.api @@ -1,13 +1,6 @@ -public final class dev/jordond/compass/geocoder/web/TemplateForwardEndpoint : dev/jordond/compass/tools/web/HttpApiEndpoint { - public fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;)V - public synthetic fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V - public fun mapResponse (Lio/ktor/client/statement/HttpResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public synthetic fun url (Ljava/lang/Object;)Ljava/lang/String; - public fun url (Ljava/lang/String;)Ljava/lang/String; -} - -public final class dev/jordond/compass/geocoder/web/TemplateGeocoderKt { +public final class dev/jordond/compass/geocoder/TemplateGeocoderKt { + public static final fun Geocoder (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; + public static synthetic fun Geocoder$default (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun TemplateGeocoder (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; public static final fun TemplateGeocoder (Ljava/lang/String;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;)Ldev/jordond/compass/geocoder/Geocoder; public static synthetic fun TemplateGeocoder$default (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; @@ -18,6 +11,15 @@ public final class dev/jordond/compass/geocoder/web/TemplateGeocoderKt { public static synthetic fun template$default (Ldev/jordond/compass/geocoder/Geocoder$Companion;Ljava/lang/String;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/Geocoder; } +public final class dev/jordond/compass/geocoder/web/TemplateForwardEndpoint : dev/jordond/compass/tools/web/HttpApiEndpoint { + public fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;)V + public synthetic fun (Ljava/lang/String;Ldev/jordond/compass/geocoder/web/parameter/TemplateParameters;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V + public fun mapResponse (Lio/ktor/client/statement/HttpResponse;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public synthetic fun url (Ljava/lang/Object;)Ljava/lang/String; + public fun url (Ljava/lang/String;)Ljava/lang/String; +} + public abstract interface class dev/jordond/compass/geocoder/web/TemplatePlatformGeocoder : dev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder { public static final field Companion Ldev/jordond/compass/geocoder/web/TemplatePlatformGeocoder$Companion; } diff --git a/compass-geocoder-web-template/src/commonMain/kotlin/dev/jordond/compass/geocoder/web/TemplateGeocoder.kt b/compass-geocoder-web-template/src/commonMain/kotlin/dev/jordond/compass/geocoder/TemplateGeocoder.kt similarity index 80% rename from compass-geocoder-web-template/src/commonMain/kotlin/dev/jordond/compass/geocoder/web/TemplateGeocoder.kt rename to compass-geocoder-web-template/src/commonMain/kotlin/dev/jordond/compass/geocoder/TemplateGeocoder.kt index 733a905..9eebbaa 100644 --- a/compass-geocoder-web-template/src/commonMain/kotlin/dev/jordond/compass/geocoder/web/TemplateGeocoder.kt +++ b/compass-geocoder-web-template/src/commonMain/kotlin/dev/jordond/compass/geocoder/TemplateGeocoder.kt @@ -1,8 +1,8 @@ @file:Suppress("FunctionName") -package dev.jordond.compass.geocoder.web +package dev.jordond.compass.geocoder -import dev.jordond.compass.geocoder.Geocoder +import dev.jordond.compass.geocoder.web.TemplatePlatformGeocoder import dev.jordond.compass.geocoder.web.parameter.TemplateParameters import dev.jordond.compass.geocoder.web.parameter.TemplateParametersBuilder import dev.jordond.compass.geocoder.web.parameter.templateParameters @@ -12,6 +12,28 @@ import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers import kotlinx.serialization.json.Json +/** + * Creates a new [Geocoder] using the TEMPLATE HTTP API geocoding service. + * + * See [TEMPLATE]() for more information. + * + * @param apiKey The TEMPLATE API key. + * @param parameters The parameters to use for the geocoder. + * @param json The JSON implementation to use for serialization. + * @param client The HTTP client to use for requests. + * @param dispatcher The coroutine dispatcher to use for requests. + * @return A new [Geocoder] using the TEMPLATE HTTP API geocoding service. + */ +public fun Geocoder( + apiKey: String, + parameters: TemplateParameters = TemplateParameters(), + json: Json = HttpApiEndpoint.json(), + client: HttpClient = HttpApiEndpoint.httpClient(json), + dispatcher: CoroutineDispatcher = Dispatchers.Default, +): Geocoder { + return TemplateGeocoder(apiKey, parameters, json, client, dispatcher) +} + /** * Creates a new [Geocoder] using the TEMPLATE HTTP API geocoding service. * diff --git a/compass-geocoder-web/api/android/compass-geocoder-web.api b/compass-geocoder-web/api/android/compass-geocoder-web.api index cbb925a..f28ff0f 100644 --- a/compass-geocoder-web/api/android/compass-geocoder-web.api +++ b/compass-geocoder-web/api/android/compass-geocoder-web.api @@ -1,11 +1,4 @@ -public final class dev/jordond/compass/geocoder/web/ForwardHttpApiPlatformGeocoder : dev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder { - public fun (Ldev/jordond/compass/tools/web/HttpApiEndpoint;Lio/ktor/client/HttpClient;)V - public fun forward (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun isAvailable ()Z - public fun reverse (DDLkotlin/coroutines/Continuation;)Ljava/lang/Object; -} - -public final class dev/jordond/compass/geocoder/web/GeocoderKt { +public final class dev/jordond/compass/geocoder/GeocoderKt { public static final fun ForwardGeocoder (Ldev/jordond/compass/tools/web/HttpApiEndpoint;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/ForwardGeocoder; public static synthetic fun ForwardGeocoder$default (Ldev/jordond/compass/tools/web/HttpApiEndpoint;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/ForwardGeocoder; public static final fun Geocoder (Ldev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; @@ -16,6 +9,13 @@ public final class dev/jordond/compass/geocoder/web/GeocoderKt { public static synthetic fun ReverseGeocoder$default (Ldev/jordond/compass/tools/web/HttpApiEndpoint;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/ReverseGeocoder; } +public final class dev/jordond/compass/geocoder/web/ForwardHttpApiPlatformGeocoder : dev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder { + public fun (Ldev/jordond/compass/tools/web/HttpApiEndpoint;Lio/ktor/client/HttpClient;)V + public fun forward (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun isAvailable ()Z + public fun reverse (DDLkotlin/coroutines/Continuation;)Ljava/lang/Object; +} + public abstract interface class dev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder : dev/jordond/compass/geocoder/PlatformGeocoder { public static final field Companion Ldev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder$Companion; } diff --git a/compass-geocoder-web/api/jvm/compass-geocoder-web.api b/compass-geocoder-web/api/jvm/compass-geocoder-web.api index cbb925a..f28ff0f 100644 --- a/compass-geocoder-web/api/jvm/compass-geocoder-web.api +++ b/compass-geocoder-web/api/jvm/compass-geocoder-web.api @@ -1,11 +1,4 @@ -public final class dev/jordond/compass/geocoder/web/ForwardHttpApiPlatformGeocoder : dev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder { - public fun (Ldev/jordond/compass/tools/web/HttpApiEndpoint;Lio/ktor/client/HttpClient;)V - public fun forward (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public fun isAvailable ()Z - public fun reverse (DDLkotlin/coroutines/Continuation;)Ljava/lang/Object; -} - -public final class dev/jordond/compass/geocoder/web/GeocoderKt { +public final class dev/jordond/compass/geocoder/GeocoderKt { public static final fun ForwardGeocoder (Ldev/jordond/compass/tools/web/HttpApiEndpoint;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/ForwardGeocoder; public static synthetic fun ForwardGeocoder$default (Ldev/jordond/compass/tools/web/HttpApiEndpoint;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/ForwardGeocoder; public static final fun Geocoder (Ldev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geocoder/Geocoder; @@ -16,6 +9,13 @@ public final class dev/jordond/compass/geocoder/web/GeocoderKt { public static synthetic fun ReverseGeocoder$default (Ldev/jordond/compass/tools/web/HttpApiEndpoint;Lkotlinx/serialization/json/Json;Lio/ktor/client/HttpClient;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geocoder/ReverseGeocoder; } +public final class dev/jordond/compass/geocoder/web/ForwardHttpApiPlatformGeocoder : dev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder { + public fun (Ldev/jordond/compass/tools/web/HttpApiEndpoint;Lio/ktor/client/HttpClient;)V + public fun forward (Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun isAvailable ()Z + public fun reverse (DDLkotlin/coroutines/Continuation;)Ljava/lang/Object; +} + public abstract interface class dev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder : dev/jordond/compass/geocoder/PlatformGeocoder { public static final field Companion Ldev/jordond/compass/geocoder/web/HttpApiPlatformGeocoder$Companion; } diff --git a/compass-geocoder-web/src/commonMain/kotlin/dev/jordond/compass/geocoder/web/Geocoder.kt b/compass-geocoder-web/src/commonMain/kotlin/dev/jordond/compass/geocoder/Geocoder.kt similarity index 90% rename from compass-geocoder-web/src/commonMain/kotlin/dev/jordond/compass/geocoder/web/Geocoder.kt rename to compass-geocoder-web/src/commonMain/kotlin/dev/jordond/compass/geocoder/Geocoder.kt index 6961966..f156625 100644 --- a/compass-geocoder-web/src/commonMain/kotlin/dev/jordond/compass/geocoder/web/Geocoder.kt +++ b/compass-geocoder-web/src/commonMain/kotlin/dev/jordond/compass/geocoder/Geocoder.kt @@ -1,8 +1,10 @@ -package dev.jordond.compass.geocoder.web +package dev.jordond.compass.geocoder -import dev.jordond.compass.geocoder.ForwardGeocoder -import dev.jordond.compass.geocoder.Geocoder -import dev.jordond.compass.geocoder.ReverseGeocoder +import dev.jordond.compass.geocoder.web.ForwardEndpoint +import dev.jordond.compass.geocoder.web.ForwardHttpApiPlatformGeocoder +import dev.jordond.compass.geocoder.web.HttpApiPlatformGeocoder +import dev.jordond.compass.geocoder.web.ReverseEndpoint +import dev.jordond.compass.geocoder.web.ReverseHttpApiPlatformGeocoder import dev.jordond.compass.tools.web.HttpApiEndpoint import io.ktor.client.HttpClient import kotlinx.coroutines.CoroutineDispatcher diff --git a/compass-geolocation-browser/src/commonMain/kotlin/dev/jordond/compass/geolocation/browser/Geolocator.kt b/compass-geolocation-browser/src/commonMain/kotlin/dev/jordond/compass/geolocation/BrowserGeolocator.kt similarity index 89% rename from compass-geolocation-browser/src/commonMain/kotlin/dev/jordond/compass/geolocation/browser/Geolocator.kt rename to compass-geolocation-browser/src/commonMain/kotlin/dev/jordond/compass/geolocation/BrowserGeolocator.kt index 7b2b189..f3c157d 100644 --- a/compass-geolocation-browser/src/commonMain/kotlin/dev/jordond/compass/geolocation/browser/Geolocator.kt +++ b/compass-geolocation-browser/src/commonMain/kotlin/dev/jordond/compass/geolocation/BrowserGeolocator.kt @@ -1,6 +1,7 @@ -package dev.jordond.compass.geolocation.browser +package dev.jordond.compass.geolocation -import dev.jordond.compass.geolocation.Geolocator +import dev.jordond.compass.geolocation.browser.BrowserLocator +import dev.jordond.compass.geolocation.browser.createBrowserLocator import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers diff --git a/compass-geolocation-mobile/api/compass-geolocation-mobile.api b/compass-geolocation-mobile/api/compass-geolocation-mobile.api index c95ac97..5f097b2 100644 --- a/compass-geolocation-mobile/api/compass-geolocation-mobile.api +++ b/compass-geolocation-mobile/api/compass-geolocation-mobile.api @@ -1,4 +1,4 @@ -public final class dev/jordond/compass/geolocation/mobile/GeolocatorKt { +public final class dev/jordond/compass/geolocation/MobileGeolocatorKt { public static final fun Geolocator (Ldev/jordond/compass/permissions/LocationPermissionController;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geolocation/Geolocator; public static synthetic fun Geolocator$default (Ldev/jordond/compass/permissions/LocationPermissionController;Lkotlinx/coroutines/CoroutineDispatcher;ILjava/lang/Object;)Ldev/jordond/compass/geolocation/Geolocator; public static final fun MobileGeolocator (Ldev/jordond/compass/permissions/LocationPermissionController;Lkotlinx/coroutines/CoroutineDispatcher;)Ldev/jordond/compass/geolocation/Geolocator; diff --git a/compass-geolocation-mobile/src/commonMain/kotlin/dev/jordond/compass/geolocation/mobile/Geolocator.kt b/compass-geolocation-mobile/src/commonMain/kotlin/dev/jordond/compass/geolocation/MobileGeolocator.kt similarity index 94% rename from compass-geolocation-mobile/src/commonMain/kotlin/dev/jordond/compass/geolocation/mobile/Geolocator.kt rename to compass-geolocation-mobile/src/commonMain/kotlin/dev/jordond/compass/geolocation/MobileGeolocator.kt index 3e8b64a..e3230d2 100644 --- a/compass-geolocation-mobile/src/commonMain/kotlin/dev/jordond/compass/geolocation/mobile/Geolocator.kt +++ b/compass-geolocation-mobile/src/commonMain/kotlin/dev/jordond/compass/geolocation/MobileGeolocator.kt @@ -1,8 +1,8 @@ -package dev.jordond.compass.geolocation.mobile +package dev.jordond.compass.geolocation -import dev.jordond.compass.geolocation.Geolocator +import dev.jordond.compass.geolocation.mobile.MobileLocator import dev.jordond.compass.permissions.LocationPermissionController -import dev.jordond.compass.permissions.mobile.mobile +import dev.jordond.compass.permissions.mobile import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers diff --git a/compass-geolocation-mobile/src/commonMain/kotlin/dev/jordond/compass/geolocation/mobile/MobileLocator.kt b/compass-geolocation-mobile/src/commonMain/kotlin/dev/jordond/compass/geolocation/mobile/MobileLocator.kt index a060669..9c5138d 100644 --- a/compass-geolocation-mobile/src/commonMain/kotlin/dev/jordond/compass/geolocation/mobile/MobileLocator.kt +++ b/compass-geolocation-mobile/src/commonMain/kotlin/dev/jordond/compass/geolocation/mobile/MobileLocator.kt @@ -3,7 +3,7 @@ package dev.jordond.compass.geolocation.mobile import dev.jordond.compass.geolocation.Locator import dev.jordond.compass.geolocation.PermissionLocator import dev.jordond.compass.permissions.LocationPermissionController -import dev.jordond.compass.permissions.mobile.mobile +import dev.jordond.compass.permissions.mobile /** * A locator that provides geolocation services on Android and iOS. diff --git a/compass-permissions-mobile/api/compass-permissions-mobile.api b/compass-permissions-mobile/api/compass-permissions-mobile.api index bc38c2f..02f9192 100644 --- a/compass-permissions-mobile/api/compass-permissions-mobile.api +++ b/compass-permissions-mobile/api/compass-permissions-mobile.api @@ -1,9 +1,10 @@ -public final class dev/jordond/compass/permissions/mobile/ExtensionsKt { - public static final fun openSettings (Ldev/jordond/compass/permissions/LocationPermissionController$Companion;)V -} - -public final class dev/jordond/compass/permissions/mobile/PermissionControllerKt { +public final class dev/jordond/compass/permissions/MobilePermissionControllerKt { public static final fun LocationPermissionController ()Ldev/jordond/compass/permissions/LocationPermissionController; + public static final fun MobileLocationPermissionController ()Ldev/jordond/compass/permissions/LocationPermissionController; public static final fun mobile (Ldev/jordond/compass/permissions/LocationPermissionController$Companion;)Ldev/jordond/compass/permissions/LocationPermissionController; } +public final class dev/jordond/compass/permissions/mobile/ExtensionsKt { + public static final fun openSettings (Ldev/jordond/compass/permissions/LocationPermissionController$Companion;)V +} + diff --git a/compass-permissions-mobile/src/androidMain/kotlin/dev/jordond/compass/permissions/mobile/PermissionController.android.kt b/compass-permissions-mobile/src/androidMain/kotlin/dev/jordond/compass/permissions/PermissionController.android.kt similarity index 93% rename from compass-permissions-mobile/src/androidMain/kotlin/dev/jordond/compass/permissions/mobile/PermissionController.android.kt rename to compass-permissions-mobile/src/androidMain/kotlin/dev/jordond/compass/permissions/PermissionController.android.kt index 69d6d0f..59a958e 100644 --- a/compass-permissions-mobile/src/androidMain/kotlin/dev/jordond/compass/permissions/mobile/PermissionController.android.kt +++ b/compass-permissions-mobile/src/androidMain/kotlin/dev/jordond/compass/permissions/PermissionController.android.kt @@ -1,12 +1,10 @@ -package dev.jordond.compass.permissions.mobile +package dev.jordond.compass.permissions import android.Manifest import android.content.Context import android.content.pm.PackageManager import androidx.core.content.ContextCompat import dev.jordond.compass.Priority -import dev.jordond.compass.permissions.LocationPermissionController -import dev.jordond.compass.permissions.PermissionState import dev.jordond.compass.permissions.mobile.internal.activity.ActivityProvider import dev.jordond.compass.tools.ContextProvider import kotlinx.coroutines.sync.Mutex diff --git a/compass-permissions-mobile/src/commonMain/kotlin/dev/jordond/compass/permissions/mobile/PermissionController.kt b/compass-permissions-mobile/src/commonMain/kotlin/dev/jordond/compass/permissions/MobilePermissionController.kt similarity index 64% rename from compass-permissions-mobile/src/commonMain/kotlin/dev/jordond/compass/permissions/mobile/PermissionController.kt rename to compass-permissions-mobile/src/commonMain/kotlin/dev/jordond/compass/permissions/MobilePermissionController.kt index 10e60d8..60a2a02 100644 --- a/compass-permissions-mobile/src/commonMain/kotlin/dev/jordond/compass/permissions/mobile/PermissionController.kt +++ b/compass-permissions-mobile/src/commonMain/kotlin/dev/jordond/compass/permissions/MobilePermissionController.kt @@ -1,6 +1,4 @@ -package dev.jordond.compass.permissions.mobile - -import dev.jordond.compass.permissions.LocationPermissionController +package dev.jordond.compass.permissions /** * Creates a new [LocationPermissionController] for Android and iOS. @@ -11,6 +9,16 @@ public fun LocationPermissionController(): LocationPermissionController { return createPermissionController() } +/** + * Creates a new [LocationPermissionController] for Android and iOS. + * + * @return A new [LocationPermissionController]. + */ +@Suppress("FunctionName") +public fun MobileLocationPermissionController(): LocationPermissionController { + return LocationPermissionController() +} + /** * Creates a new [LocationPermissionController] for Android and iOS. * diff --git a/compass-permissions-mobile/src/iosMain/kotlin/dev/jordond/compass/permissions/mobile/PermissionController.ios.kt b/compass-permissions-mobile/src/iosMain/kotlin/dev/jordond/compass/permissions/PermissionController.ios.kt similarity index 91% rename from compass-permissions-mobile/src/iosMain/kotlin/dev/jordond/compass/permissions/mobile/PermissionController.ios.kt rename to compass-permissions-mobile/src/iosMain/kotlin/dev/jordond/compass/permissions/PermissionController.ios.kt index 3e01aac..bbaee00 100644 --- a/compass-permissions-mobile/src/iosMain/kotlin/dev/jordond/compass/permissions/mobile/PermissionController.ios.kt +++ b/compass-permissions-mobile/src/iosMain/kotlin/dev/jordond/compass/permissions/PermissionController.ios.kt @@ -1,8 +1,6 @@ -package dev.jordond.compass.permissions.mobile +package dev.jordond.compass.permissions import dev.jordond.compass.Priority -import dev.jordond.compass.permissions.LocationPermissionController -import dev.jordond.compass.permissions.PermissionState import dev.jordond.compass.permissions.mobile.internal.LocationPermissionManagerDelegate import dev.jordond.compass.permissions.mobile.internal.toPermissionState import kotlinx.coroutines.flow.MutableStateFlow diff --git a/demo/composeApp/src/commonMain/kotlin/geocoder/GoogleMapsGeocoderScreen.kt b/demo/composeApp/src/commonMain/kotlin/geocoder/GoogleMapsGeocoderScreen.kt index 9303425..6a53637 100644 --- a/demo/composeApp/src/commonMain/kotlin/geocoder/GoogleMapsGeocoderScreen.kt +++ b/demo/composeApp/src/commonMain/kotlin/geocoder/GoogleMapsGeocoderScreen.kt @@ -8,7 +8,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import cafe.adriel.voyager.core.screen.Screen -import dev.jordond.compass.geocoder.web.GoogleMapsGeocoder +import dev.jordond.compass.geocoder.GoogleMapsGeocoder import dev.jordond.compass.geocoder.web.parameter.GoogleMapsLocationType import dev.jordond.compass.tools.web.HttpApiEndpoint diff --git a/demo/composeApp/src/commonMain/kotlin/geocoder/MapboxGeocoderScreen.kt b/demo/composeApp/src/commonMain/kotlin/geocoder/MapboxGeocoderScreen.kt index 81c1f95..8404563 100644 --- a/demo/composeApp/src/commonMain/kotlin/geocoder/MapboxGeocoderScreen.kt +++ b/demo/composeApp/src/commonMain/kotlin/geocoder/MapboxGeocoderScreen.kt @@ -8,7 +8,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import cafe.adriel.voyager.core.screen.Screen -import dev.jordond.compass.geocoder.web.MapboxGeocoder +import dev.jordond.compass.geocoder.MapboxGeocoder import dev.jordond.compass.tools.web.HttpApiEndpoint /**