1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#ifndef GITHUBAPI_H #define GITHUBAPI_H 1 #include <string> #include <vector> typedef void CURL; class GithubAPI { public: GithubAPI(std::string username); ~GithubAPI(); bool DownloadAvatar(); size_t GetAvatarBuffer(std::vector<unsigned char> &avatar_buffer); bool AvatarToFile(std::string filename); std::string GetUsername() { return username; } private: bool ResetCURL(); bool GetAvatarURL(); bool GetAvatarImage(); std::string username; std::string avatar_url; std::vector<unsigned char> avatar_buffer; CURL *curl; }; #endif