getMapStyleDescriptor method
Retrieves the map style descriptor from a map resource.
The style descriptor contains speciļ¬cations on how features render on a map. For example, what data to display, what order to display the data in, and the style for the data. Style descriptors follow the Mapbox Style Specification.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter mapName :
The map resource to retrieve the style descriptor from.
Parameter key :
The optional API
key to authorize the request.
Implementation
Future<GetMapStyleDescriptorResponse> getMapStyleDescriptor({
required String mapName,
String? key,
}) async {
final $query = <String, List<String>>{
if (key != null) 'key': [key],
};
final response = await _protocol.sendRaw(
payload: null,
method: 'GET',
requestUri:
'/maps/v0/maps/${Uri.encodeComponent(mapName)}/style-descriptor',
queryParams: $query,
hostPrefix: 'maps.',
exceptionFnMap: _exceptionFns,
);
return GetMapStyleDescriptorResponse(
blob: await response.stream.toBytes(),
cacheControl:
_s.extractHeaderStringValue(response.headers, 'Cache-Control'),
contentType:
_s.extractHeaderStringValue(response.headers, 'Content-Type'),
);
}