From 4c86f97a389657b0ba1de7cbfbcdf56f73cf5821 Mon Sep 17 00:00:00 2001 From: Dzmitry Fomchyn <5161509+DzmitryFomchyn@users.noreply.github.com> Date: Fri, 13 May 2022 10:25:43 +0300 Subject: [PATCH] External IDs; 1.0.0-beta.29.1 release. (#38) * External IDs; 1.0.0-beta.29.1 release. * Update public API --- CHANGELOG.md | 5 ++++- MapboxSearch/gradle.properties | 2 +- MapboxSearch/sdk/api/api-metalava.txt | 4 ++++ MapboxSearch/sdk/api/sdk.api | 2 ++ .../main/java/com/mapbox/search/result/BaseSearchResult.kt | 5 +++++ .../java/com/mapbox/search/result/BaseSearchSuggestion.kt | 5 +++++ .../src/main/java/com/mapbox/search/result/SearchResult.kt | 6 ++++++ .../main/java/com/mapbox/search/result/SearchSuggestion.kt | 6 ++++++ 8 files changed, 33 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d4bd7d6f..89b5b3ea8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Internal changelog for the Mapbox Search SDK for Android -## 1.0.0-beta.30-SNAPSHOT +## 1.0.0-beta.29.1 + +### New features +- [CORE] `SearchResult` and `SearchSuggestion` now provide `externalIDs` property. ### Mapbox dependencies - Search Native SDK `0.52.0` diff --git a/MapboxSearch/gradle.properties b/MapboxSearch/gradle.properties index 62554f9d5..fd143de4d 100644 --- a/MapboxSearch/gradle.properties +++ b/MapboxSearch/gradle.properties @@ -21,7 +21,7 @@ android.enableJetifier=false kotlin.code.style=official # SDK version attributes -VERSION_NAME=1.0.0-beta.29 +VERSION_NAME=1.0.0-beta.29.1 # Artifact attributes mapboxArtifactUserOrg=mapbox diff --git a/MapboxSearch/sdk/api/api-metalava.txt b/MapboxSearch/sdk/api/api-metalava.txt index 12bd5d54e..5299f25eb 100644 --- a/MapboxSearch/sdk/api/api-metalava.txt +++ b/MapboxSearch/sdk/api/api-metalava.txt @@ -1322,6 +1322,7 @@ package com.mapbox.search.result { method public String? getDescriptionText(); method public Double? getDistanceMeters(); method public Double? getEtaMinutes(); + method public java.util.Map getExternalIDs(); method public String getId(); method public String? getMakiIcon(); method public String? getMatchingName(); @@ -1337,6 +1338,7 @@ package com.mapbox.search.result { property public abstract String? descriptionText; property public abstract Double? distanceMeters; property public abstract Double? etaMinutes; + property public abstract java.util.Map externalIDs; property public abstract String id; property public abstract String? makiIcon; property public abstract String? matchingName; @@ -1373,6 +1375,7 @@ package com.mapbox.search.result { method public String? getDescriptionText(); method public Double? getDistanceMeters(); method public Double? getEtaMinutes(); + method public java.util.Map getExternalIDs(); method public String getId(); method public String? getMakiIcon(); method public String? getMatchingName(); @@ -1387,6 +1390,7 @@ package com.mapbox.search.result { property public abstract String? descriptionText; property public abstract Double? distanceMeters; property public abstract Double? etaMinutes; + property public abstract java.util.Map externalIDs; property public abstract String id; property public abstract boolean isBatchResolveSupported; property public abstract String? makiIcon; diff --git a/MapboxSearch/sdk/api/sdk.api b/MapboxSearch/sdk/api/sdk.api index bf4460b6b..23f8cec27 100644 --- a/MapboxSearch/sdk/api/sdk.api +++ b/MapboxSearch/sdk/api/sdk.api @@ -1433,6 +1433,7 @@ public abstract interface class com/mapbox/search/result/SearchResult : android/ public abstract fun getDescriptionText ()Ljava/lang/String; public abstract fun getDistanceMeters ()Ljava/lang/Double; public abstract fun getEtaMinutes ()Ljava/lang/Double; + public abstract fun getExternalIDs ()Ljava/util/Map; public abstract fun getId ()Ljava/lang/String; public abstract fun getMakiIcon ()Ljava/lang/String; public abstract fun getMatchingName ()Ljava/lang/String; @@ -1465,6 +1466,7 @@ public abstract interface class com/mapbox/search/result/SearchSuggestion : andr public abstract fun getDescriptionText ()Ljava/lang/String; public abstract fun getDistanceMeters ()Ljava/lang/Double; public abstract fun getEtaMinutes ()Ljava/lang/Double; + public abstract fun getExternalIDs ()Ljava/util/Map; public abstract fun getId ()Ljava/lang/String; public abstract fun getMakiIcon ()Ljava/lang/String; public abstract fun getMatchingName ()Ljava/lang/String; diff --git a/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/BaseSearchResult.kt b/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/BaseSearchResult.kt index 439d0d60c..098095fd3 100644 --- a/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/BaseSearchResult.kt +++ b/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/BaseSearchResult.kt @@ -1,6 +1,7 @@ package com.mapbox.search.result import com.mapbox.search.SearchResultMetadata +import java.util.Collections internal abstract class BaseSearchResult( @Transient @@ -38,6 +39,9 @@ internal abstract class BaseSearchResult( override val metadata: SearchResultMetadata? get() = originalSearchResult.metadata + override val externalIDs: Map + get() = Collections.unmodifiableMap(originalSearchResult.externalIDs ?: emptyMap()) + override val distanceMeters: Double? get() = originalSearchResult.distanceMeters @@ -58,6 +62,7 @@ internal abstract class BaseSearchResult( "types='$types', " + "etaMinutes='$etaMinutes', " + "metadata='$metadata', " + + "externalIDs='$externalIDs`, " + "distanceMeters='$distanceMeters', " + "serverIndex='$serverIndex', " + "requestOptions='$requestOptions'" + diff --git a/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/BaseSearchSuggestion.kt b/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/BaseSearchSuggestion.kt index 4f44701e1..d6572c6b4 100644 --- a/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/BaseSearchSuggestion.kt +++ b/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/BaseSearchSuggestion.kt @@ -1,6 +1,7 @@ package com.mapbox.search.result import com.mapbox.search.SearchResultMetadata +import java.util.Collections internal sealed class BaseSearchSuggestion( @Transient @@ -37,6 +38,9 @@ internal sealed class BaseSearchSuggestion( override val metadata: SearchResultMetadata? get() = originalSearchResult.metadata + override val externalIDs: Map + get() = Collections.unmodifiableMap(originalSearchResult.externalIDs ?: emptyMap()) + override val isBatchResolveSupported: Boolean get() = originalSearchResult.action?.multiRetrievable == true @@ -55,6 +59,7 @@ internal sealed class BaseSearchSuggestion( "type='$type', " + "etaMinutes='$etaMinutes', " + "metadata='$metadata', " + + "externalIDs='$externalIDs`, " + "isBatchResolveSupported='$isBatchResolveSupported', " + "serverIndex='$serverIndex', " + "requestOptions='$requestOptions'" diff --git a/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/SearchResult.kt b/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/SearchResult.kt index 3bf50468b..955fcca1f 100644 --- a/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/SearchResult.kt +++ b/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/SearchResult.kt @@ -81,6 +81,12 @@ public sealed interface SearchResult : Parcelable { */ public val metadata: SearchResultMetadata? + /** + * Experimental API, can be changed or removed in the next SDK releases. + * Map of external ids. Returned Map instance is unmodifiable. + */ + public val externalIDs: Map + /** * Distance in meters from result to requested origin (for forward geocoding and category search) or provided point (for reverse geocoding). * For provided point always returns non-null distance. diff --git a/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/SearchSuggestion.kt b/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/SearchSuggestion.kt index c2779bfef..cf41f0810 100644 --- a/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/SearchSuggestion.kt +++ b/MapboxSearch/sdk/src/main/java/com/mapbox/search/result/SearchSuggestion.kt @@ -71,6 +71,12 @@ public sealed interface SearchSuggestion : Parcelable { */ public val metadata: SearchResultMetadata? + /** + * Experimental API, can be changed or removed in the next SDK releases. + * Map of external ids. Returned Map instance is unmodifiable. + */ + public val externalIDs: Map + /** * Denotes whether this suggestion can be passed as a parameter to a batch selection method of the [com.mapbox.search.SearchEngine]. */