整理webapi、webhook框架代码

This commit is contained in:
xiongziliang
2020-12-27 22:14:59 +08:00
parent 781708f0a1
commit f9f9cde2b4
4 changed files with 229 additions and 162 deletions

21
server/WebHook.h Normal file → Executable file
View File

@@ -12,13 +12,32 @@
#define ZLMEDIAKIT_WEBHOOK_H
#include <string>
#include <functional>
#include "jsoncpp/json.h"
using namespace std;
using namespace Json;
//支持json或urlencoded方式传输参数
#define JSON_ARGS
#ifdef JSON_ARGS
typedef Value ArgsType;
#else
typedef HttpArgs ArgsType;
#endif
namespace Hook {
//web hook回复最大超时时间
extern const string kTimeoutSec;
}//namespace Hook
void installWebHook();
void unInstallWebHook();
/**
* 触发http hook请求
* @param url 请求地址
* @param body 请求body
* @param func 回调
*/
void do_http_hook(const string &url, const ArgsType &body, const function<void(const Value &, const string &)> &func = nullptr);
#endif //ZLMEDIAKIT_WEBHOOK_H