|
| 1 | +/* |
| 2 | + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | + * You may not use this file except in compliance with the License. |
| 6 | + * A copy of the License is located at |
| 7 | + * |
| 8 | + * http://aws.amazon.com/apache2.0 |
| 9 | + * |
| 10 | + * or in the "license" file accompanying this file. This file is distributed |
| 11 | + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | + * express or implied. See the License for the specific language governing |
| 13 | + * permissions and limitations under the License. |
| 14 | + */ |
| 15 | + |
| 16 | +package com.amplifyframework.rx; |
| 17 | + |
| 18 | +import androidx.annotation.NonNull; |
| 19 | + |
| 20 | +import com.amplifyframework.geo.GeoCategoryBehavior; |
| 21 | +import com.amplifyframework.geo.GeoException; |
| 22 | +import com.amplifyframework.geo.models.Coordinates; |
| 23 | +import com.amplifyframework.geo.models.MapStyle; |
| 24 | +import com.amplifyframework.geo.models.MapStyleDescriptor; |
| 25 | +import com.amplifyframework.geo.options.GeoSearchByCoordinatesOptions; |
| 26 | +import com.amplifyframework.geo.options.GeoSearchByTextOptions; |
| 27 | +import com.amplifyframework.geo.options.GetMapStyleDescriptorOptions; |
| 28 | +import com.amplifyframework.geo.result.GeoSearchResult; |
| 29 | + |
| 30 | +import java.util.Collection; |
| 31 | + |
| 32 | +import io.reactivex.rxjava3.core.Single; |
| 33 | + |
| 34 | +/** |
| 35 | + * An Rx-idiomatic expression of the behaviors in {@link GeoCategoryBehavior}. |
| 36 | + */ |
| 37 | +public interface RxGeoCategoryBehavior { |
| 38 | + /** |
| 39 | + * Gets a collection of maps and their corresponding styles. |
| 40 | + * |
| 41 | + * @return An Rx {@link Single} which emits a {@link MapStyle} on success, or a |
| 42 | + * {@link GeoException} on failure |
| 43 | + */ |
| 44 | + Single<Collection<MapStyle>> getAvailableMaps(); |
| 45 | + |
| 46 | + /** |
| 47 | + * Gets the default map and style from available maps. |
| 48 | + * |
| 49 | + * @return An Rx {@link Single} which emits a {@link MapStyle} on success, or a |
| 50 | + * {@link GeoException} on failure |
| 51 | + */ |
| 52 | + Single<MapStyle> getDefaultMap(); |
| 53 | + |
| 54 | + /** |
| 55 | + * Uses default options to get map style descriptor JSON. |
| 56 | + * |
| 57 | + * @return An Rx {@link Single} which emits a {@link MapStyleDescriptor} on success, or a |
| 58 | + * {@link GeoException} on failure |
| 59 | + */ |
| 60 | + Single<MapStyleDescriptor> getMapStyleDescriptor(); |
| 61 | + |
| 62 | + /** |
| 63 | + * Uses given options to get map style descriptor JSON. |
| 64 | + * |
| 65 | + * @param options Options to specify for this operation. |
| 66 | + * @return An Rx {@link Single} which emits a {@link MapStyleDescriptor} on success, or a |
| 67 | + * {@link GeoException} on failure |
| 68 | + */ |
| 69 | + Single<MapStyleDescriptor> getMapStyleDescriptor(@NonNull GetMapStyleDescriptorOptions options); |
| 70 | + |
| 71 | + /** |
| 72 | + * Searches for locations that match text query. |
| 73 | + * |
| 74 | + * @param query Search query text. |
| 75 | + * @return An Rx {@link Single} which emits a {@link GeoSearchResult} on success, or a |
| 76 | + * {@link GeoException} on failure |
| 77 | + */ |
| 78 | + Single<GeoSearchResult> searchByText(@NonNull String query); |
| 79 | + |
| 80 | + /** |
| 81 | + * Searches for locations that match text query. |
| 82 | + * |
| 83 | + * @param query Search query text. |
| 84 | + * @param options Search options to use. |
| 85 | + * @return An Rx {@link Single} which emits a {@link GeoSearchResult} on success, or a |
| 86 | + * {@link GeoException} on failure |
| 87 | + */ |
| 88 | + Single<GeoSearchResult> searchByText( |
| 89 | + @NonNull String query, |
| 90 | + @NonNull GeoSearchByTextOptions options |
| 91 | + ); |
| 92 | + |
| 93 | + /** |
| 94 | + * Searches for location with given set of coordinates. |
| 95 | + * |
| 96 | + * @param position Coordinates to look-up. |
| 97 | + * @return An Rx {@link Single} which emits a {@link GeoSearchResult} on success, or a |
| 98 | + * {@link GeoException} on failure |
| 99 | + */ |
| 100 | + Single<GeoSearchResult> searchByCoordinates(@NonNull Coordinates position); |
| 101 | + |
| 102 | + /** |
| 103 | + * Searches for location with given set of coordinates. |
| 104 | + * |
| 105 | + * @param position Coordinates to look-up. |
| 106 | + * @param options Search options to use. |
| 107 | + * @return An Rx {@link Single} which emits a {@link GeoSearchResult} on success, or a |
| 108 | + * {@link GeoException} on failure |
| 109 | + */ |
| 110 | + Single<GeoSearchResult> searchByCoordinates( |
| 111 | + @NonNull Coordinates position, |
| 112 | + @NonNull GeoSearchByCoordinatesOptions options |
| 113 | + ); |
| 114 | +} |
0 commit comments