get method
HTTPS GET with optional params
Implementation
Future<Response> get({
/// The endpoint to call
///
/// If the endpoint has path parameters, build the string first
/// before sending it here.
///
/// eg. /v1/some/endpoint/
/// eg. v1/another/endpoint
/// eg. v1/another/endpoint?filtered=true
required String endpoint,
/// A map of query params
///
/// eg.
/// ```dart
/// {
/// "some": "thing",
/// "another": "thing,
/// }
/// ```
Map<String, dynamic>? params,
/// Headers for this particular call.
///
/// If no headers are provided, will fall back to default headers.
///
/// If no default headers are provided, will not send headers.
Map<String, String>? headers,
}) async {
Map<String, String>? instanceHeaders = headers ?? defaultHeaders;
try {
final response = await _client.get(
Uri.https(authority, endpoint, params),
headers: instanceHeaders,
);
return Response(response.statusCode, response.body);
} catch (e) {
rethrow;
}
}