get function
Makes a GET request to the Coinbase Advanced Trade API.
endpoint - The API endpoint to make the request to.
queryParameters - Optional query parameters to include in the request.
client - Optional http.Client to use for the request.
isSandbox - Whether to use the sandbox environment.
Returns an http.Response object.
Implementation
Future<http.Response> get(String endpoint,
{Map<String, dynamic>? queryParameters,
http.Client? client,
bool isSandbox = false}) async {
String coinbaseApi = isSandbox ? coinbaseApiSandbox : coinbaseApiProduction;
client ??= http.Client();
String fullEndpoint = '/api/v3/brokerage$endpoint';
var url = Uri.https(coinbaseApi, fullEndpoint, queryParameters);
Map<String, String> requestHeaders = {
HttpHeaders.acceptHeader: 'application/json',
};
return await client.get(url, headers: requestHeaders);
}