mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 03:31:45 +08:00
整理webapi、webhook框架代码
This commit is contained in:
21
server/WebHook.h
Normal file → Executable file
21
server/WebHook.h
Normal file → Executable 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
|
||||
|
||||
Reference in New Issue
Block a user