// // Copyright Amazon.com Inc. or its affiliates. // All Rights Reserved. // // SPDX-License-Identifier: Apache-2.0 // extension GeoCategory: GeoCategoryBehavior { // MARK: - Search /// Search for places or points of interest. /// - Parameters: /// - text: The place name or address to be used in the search. (case insensitive) /// - options: Optional parameters when searching for text. /// - Returns: /// It returns a Geo.Place array. /// - Throws: /// `Geo.Error.accessDenied` if request authorization issue /// `Geo.Error.serviceError` if service is down/resource not found/throttling/validation error /// `Geo.Error.invalidConfiguration` if invalid configuration /// `Geo.Error.networkError` if request failed or network unavailable /// `Geo.Error.pluginError` if encapsulated error received by a dependent plugin /// `Geo.Error.unknown` if error is unknown public func search(for text: String, options: Geo.SearchForTextOptions? = nil) async throws -> [Geo.Place] { return try await plugin.search(for: text, options: options) } /// Reverse geocodes a given pair of coordinates and returns a list of Places /// closest to the specified position. /// - Parameters: /// - coordinates: Specifies a coordinate for the query. /// - options: Optional parameters when searching for coordinates. /// - Returns: /// It returns a Geo.Place array. /// - Throws: /// `Geo.Error.accessDenied` if request authorization issue /// `Geo.Error.serviceError` if service is down/resource not found/throttling/validation error /// `Geo.Error.invalidConfiguration` if invalid configuration /// `Geo.Error.networkError` if request failed or network unavailable /// `Geo.Error.pluginError` if encapsulated error received by a dependent plugin /// `Geo.Error.unknown` if error is unknown public func search(for coordinates: Geo.Coordinates, options: Geo.SearchForCoordinatesOptions? = nil) async throws -> [Geo.Place] { return try await plugin.search(for: coordinates, options: options) } // MARK: - Maps /// Retrieves metadata for available Map resources. /// - Returns: /// It returns an array of available Map resources. /// - Throws: /// `Geo.Error.accessDenied` if request authorization issue /// `Geo.Error.serviceError` if service is down/resource not found/throttling/validation error /// `Geo.Error.invalidConfiguration` if invalid configuration /// `Geo.Error.networkError` if request failed or network unavailable /// `Geo.Error.pluginError` if encapsulated error received by a dependent plugin /// `Geo.Error.unknown` if error is unknown public func availableMaps() async throws -> [Geo.MapStyle] { return try await plugin.availableMaps() } /// Retrieves metadata for the default Map resource. /// - Returns: /// It returns the default Map resource. /// - Throws: /// `Geo.Error.accessDenied` if request authorization issue /// `Geo.Error.serviceError` if service is down/resource not found/throttling/validation error /// `Geo.Error.invalidConfiguration` if invalid configuration /// `Geo.Error.networkError` if request failed or network unavailable /// `Geo.Error.pluginError` if encapsulated error received by a dependent plugin /// `Geo.Error.unknown` if error is unknown public func defaultMap() async throws -> Geo.MapStyle { return try await plugin.defaultMap() } }