Add json::pull_request_body().
This commit is contained in:
parent
119d304164
commit
772d982ea8
|
@ -33,4 +33,13 @@ string to_json(const cgi::entry_type &entry)
|
|||
return json.dump(4);
|
||||
}
|
||||
|
||||
string pull_request_body(string_view branch, const cgi::entry_type &entry)
|
||||
{
|
||||
const nlohmann::json json{{"base", "main"},
|
||||
{"head", branch},
|
||||
{"title", "From web: " + entry.instance},
|
||||
{"body", entry.description}};
|
||||
return json.dump();
|
||||
}
|
||||
|
||||
} // namespace FediBlock::json
|
||||
|
|
|
@ -20,15 +20,20 @@
|
|||
#include "cgi.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace FediBlock::json
|
||||
{
|
||||
|
||||
using std::string;
|
||||
using std::string_view;
|
||||
|
||||
// Convert an entry_type into a JSON string.
|
||||
[[nodiscard]] string to_json(const cgi::entry_type &entry);
|
||||
|
||||
[[nodiscard]] string pull_request_body(string_view branch,
|
||||
const cgi::entry_type &entry);
|
||||
|
||||
} // namespace FediBlock::json
|
||||
|
||||
#endif // FEDIBLOCK_BACKEND_JSON_HPP
|
||||
|
|
Reference in New Issue
Block a user