ZLMediaKit/server/WebHook.h

44 lines
1.1 KiB
C++
Raw Normal View History

2019-08-08 19:01:45 +08:00
/*
2020-04-04 20:30:09 +08:00
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
2019-06-24 14:50:50 +08:00
*
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
2019-06-24 14:50:50 +08:00
*
2020-04-04 20:30:09 +08:00
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree.
2019-06-24 14:50:50 +08:00
*/
#ifndef ZLMEDIAKIT_WEBHOOK_H
#define ZLMEDIAKIT_WEBHOOK_H
#include <string>
2020-12-27 22:14:59 +08:00
#include <functional>
#include "jsoncpp/json.h"
2019-06-24 14:50:50 +08:00
using namespace std;
2020-12-27 22:14:59 +08:00
using namespace Json;
//支持json或urlencoded方式传输参数
#define JSON_ARGS
#ifdef JSON_ARGS
typedef Value ArgsType;
#else
typedef HttpArgs ArgsType;
#endif
2019-06-24 14:50:50 +08:00
namespace Hook {
2020-12-27 22:14:59 +08:00
//web hook回复最大超时时间
2019-06-24 14:50:50 +08:00
extern const string kTimeoutSec;
}//namespace Hook
2019-06-24 14:58:56 +08:00
void installWebHook();
void unInstallWebHook();
2020-12-27 22:14:59 +08:00
/**
* 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);
2019-06-24 14:50:50 +08:00
#endif //ZLMEDIAKIT_WEBHOOK_H