Files
Sean Chittenden a5c927b1c9 Mostly complete consul_kv, now with PUT/DELETE
Round out consul_kv with GET, PUT, and DELETE support.  Recursive works with DELETE.  Both PUT and DELETE support the cas argument, -C.
2015-11-17 02:30:06 -08:00

36 lines
791 B
C++

#ifndef CPR_PAYLOAD_H
#define CPR_PAYLOAD_H
#include <memory>
#include <string>
#include <initializer_list>
#include "defines.h"
namespace cpr {
struct Pair {
template <typename KeyType, typename ValueType,
typename std::enable_if<!std::is_integral<ValueType>::value, bool>::type = true>
Pair(KeyType&& p_key, ValueType&& p_value)
: key{CPR_FWD(p_key)}, value{CPR_FWD(p_value)} {}
template <typename KeyType>
Pair(KeyType&& p_key, const int& p_value)
: key{CPR_FWD(p_key)}, value{std::to_string(p_value)} {}
std::string key;
std::string value;
};
class Payload {
public:
Payload(const std::initializer_list<Pair>& pairs);
Payload(const std::string& data);
std::string content;
};
} // namespace cpr
#endif