27 lines
479 B
C++
27 lines
479 B
C++
#ifndef API_H
|
|
#define API_H
|
|
|
|
#include <curl/curl.h>
|
|
#include <string>
|
|
|
|
class COpenAI
|
|
{
|
|
public:
|
|
COpenAI();
|
|
~COpenAI();
|
|
|
|
public:
|
|
void set_base(const std::string& api_url, const std::string& key);
|
|
bool post(const std::string& json, std::string& out);
|
|
|
|
private:
|
|
static size_t recv_call(void* contents, size_t size, size_t nmemb, std::string* output);
|
|
|
|
private:
|
|
std::string api_key_;
|
|
std::string api_url_;
|
|
std::string recv_;
|
|
CURL* curl_;
|
|
};
|
|
|
|
#endif |