AppleMaps class is the single entry point for all Apple Maps Server API operations. It implements AutoCloseable, so you can use it in a try-with-resources block to release the underlying HTTP client when you are done.
AppleMaps delegates to an AppleMapsGateway. See Custom Gateway below.
Constructors
AppleMaps(String authToken)
AppleMaps(String authToken)
Origin header. This is the simplest constructor for most server-side use cases.| Parameter | Type | Description |
|---|---|---|
authToken | String | Long-lived Apple Maps authorization token (JWT) |
AppleMaps(String authToken, String origin)
AppleMaps(String authToken, String origin)
Origin header value. Required when your JWT was issued with an origin claim.| Parameter | Type | Description |
|---|---|---|
authToken | String | Long-lived Apple Maps authorization token (JWT) |
origin | String | Value sent as the HTTP Origin header (for example, https://api.example.com) |
AppleMaps(String authToken, Duration timeout)
AppleMaps(String authToken, Duration timeout)
Origin header.| Parameter | Type | Description |
|---|---|---|
authToken | String | Long-lived Apple Maps authorization token (JWT) |
timeout | Duration | Per-request timeout; must not be null |
AppleMaps(String authToken, Duration timeout, String origin)
AppleMaps(String authToken, Duration timeout, String origin)
Origin header.| Parameter | Type | Description |
|---|---|---|
authToken | String | Long-lived Apple Maps authorization token (JWT) |
timeout | Duration | Per-request timeout; must not be null |
origin | String | Value sent as the HTTP Origin header, or null to omit |
AppleMaps(AppleMapsGateway gateway)
AppleMaps(AppleMapsGateway gateway)
AppleMapsGateway implementation. Use this constructor to inject a test stub, mock, or alternative HTTP backend.| Parameter | Type | Description |
|---|---|---|
gateway | AppleMapsGateway | Custom gateway; must not be null |
Geocoding
geocode
PlaceResults containing zero or more Place records.See GeocodeInput for all available options.reverseGeocode (default language)
en-US as the response language.language is null or blank, the SDK falls back to en-US.
| Parameter | Type | Description |
|---|---|---|
latitude | double | Latitude in decimal degrees |
longitude | double | Longitude in decimal degrees |
language | String | BCP 47 language tag, or null to use en-US |
Search
search
SearchResponse with an array of SearchResponsePlace records and an optional display region.See SearchInput for filtering and pagination options.autocomplete
completionUrl that you resolve with resolveCompletionUrl.See SearchAutocompleteInput.Resolving completion URLs
After callingautocomplete, use one of two methods to fetch full search results for each suggestion:
resolveCompletionUrls fires all requests concurrently using CompletableFuture and returns results in the same order as the input list. Each call counts against your daily quota — see Quota.
Routing
directions
etas
EtaResponse with one EtaEstimate per destination.See EtaInput.Place Lookup
lookupPlace (default language)
en-US as the response language.lookupPlace (with language)
language is null or blank, falls back to en-US.lookupPlaces
PlacesResponse with both successful results and per-ID errors.See PlaceLookupInput.lookupAlternateIds
AlternateIdsResponse.See AlternateIdsInput.Custom Gateway
AppleMapsGateway is a domain port interface in com.williamcallahan.applemaps.domain.port. You can implement it to provide a test stub, a caching layer, or an alternative HTTP backend:
default void close() method on the interface is a no-op, so you only need to override it if your implementation owns closeable resources.