mirror of
https://github.com/polybar/polybar.git
synced 2024-11-18 13:55:11 -05:00
b417c9f812
Module used to query the GitHub API for information. Currently only supports notification count. Ref #84
30 lines
554 B
C++
30 lines
554 B
C++
#pragma once
|
|
|
|
#include "common.hpp"
|
|
#include "utils/factory.hpp"
|
|
|
|
POLYBAR_NS
|
|
|
|
class http_downloader {
|
|
public:
|
|
http_downloader(int connection_timeout = 5);
|
|
~http_downloader();
|
|
|
|
string get(const string& url);
|
|
long response_code();
|
|
|
|
protected:
|
|
static size_t write(void* p, size_t size, size_t bytes, void* stream);
|
|
|
|
private:
|
|
void* m_curl;
|
|
};
|
|
|
|
namespace http_util {
|
|
template <typename... Args>
|
|
decltype(auto) make_downloader(Args&&... args) {
|
|
return factory_util::unique<http_downloader>(forward<Args>(args)...);
|
|
}
|
|
}
|
|
|
|
POLYBAR_NS_END
|