about summary refs log blame commit diff stats
path: root/include/invapi.hpp
blob: bcd5eefa39c704a26c4de68e8bcf100b218cb221 (plain) (tree)
1
2
3
4
5
6
7
8

                

                 
                    


                              


                    
                         
 







                                                                   
                                                              
                                                                        

                                                    

                    


                                
                             
  
 

     
#ifndef INVAPI_H
#define INVAPI_H
#include <string>
#include <vector>
#include <cpr/cpr.h>

#include "sqliteinterface.hpp"

class InvidiousApi {

    public:
        struct instance {

            std::string url;
            float health;
            std::string location;
        };

        InvidiousApi(const std::string& url) : instanceUrl(url) {};
        static std::vector<std::string> getInstancesUrls();
        static std::vector<instance> getInstances();
        static void saveInstancesToDb(SqliteInterface& sqldb);
        static std::string getInstanceUrlFromDb(SqliteInterface& sqldb);
        std::string getInstance();
        void setInstance(const std::string& newUrl);

        void test();
    private:

        std::string instanceUrl;
        cpr::Session session;
};


#endif