Skip to content
Ivanenko Danil edited this page Apr 3, 2019 · 2 revisions

How to add new service

If you use services with OAuth2, don't forget to register your application and get client_id for it. Use "http://localhost:3359/get_token" as redirect url. 3359 is the default port, you can use any port number you want, but don't forget save it on 'Connection settings' window, 'OAuth setting' tab.

All service clients are located in service_clients folder, and derived from ServiceClient class. You can check, for example, DropboxClient class.

In constructor create http_client with API url:

m_http_client = new httplib::SSLClient("api.dropboxapi.com");

and define oauth client_id (it could be overriden by connection configs) :

m_client_id = "ovy1encsqm627kl";

Add your get_auth_page_url() implementation. Return authorization url string, and you are ready with oauth now.

Add your new client to ServiceFactory class:

  • add {"client_string_id", "client name"} to std::vector<std::pair<std::string, std::string> > names. This will be used in "Create new connection" dialog box
  • Add changes to constructor, destructor and getClient() function

And don't forget to add your .h/.cpp files to CMakeLists.txt:

list(APPEND CLOUD_SERVICES
         service_clients/service_client.h
         service_clients/service_client.cpp
         service_clients/service_factory.h
         ...
         # add here your clients
)
Clone this wiki locally