post method
Posts a request to the OpenAI API.
Implementation
Future<http.Response> post(
String path, {
required Map<String, dynamic> data,
}) async {
final url = Uri.parse('$endpoint$path/?api-version=2024-08-01-preview');
print(url);
final headers = {
'Content-Type': 'application/json',
'api-key': apiKey,
};
final body = jsonEncode(data);
final response = await http.post(url, headers: headers, body: body);
_checkResponse(response);
return response;
}