54 lines
1.5 KiB
C++
54 lines
1.5 KiB
C++
/* This file is part of FediBlock-backend.
|
|
* Copyright © 2020 tastytea <tastytea@tastytea.de>
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, version 3.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef FEDIBLOCK_BACKEND_GITEA_HPP
|
|
#define FEDIBLOCK_BACKEND_GITEA_HPP
|
|
|
|
#include "types.hpp"
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
namespace FediBlock::gitea
|
|
{
|
|
|
|
using std::string;
|
|
using std::string_view;
|
|
using std::uint64_t;
|
|
|
|
// Initialize the curl connection handle.
|
|
void init();
|
|
|
|
// Clean up the curl connection handle.
|
|
void cleanup();
|
|
|
|
// Write HTTP response to string.
|
|
size_t writer_body(char *data, size_t size, size_t nmemb);
|
|
|
|
// Make a HTTP POST request to the Gitea API.
|
|
string api_request(http_method method, string_view path, string_view body);
|
|
|
|
// Make a pull request.
|
|
void pull_request(string_view branch, const entry_type &entry);
|
|
|
|
// Get number of last pull request.
|
|
[[nodiscard]] uint64_t get_last_pr_number();
|
|
|
|
} // namespace FediBlock::gitea
|
|
|
|
#endif // FEDIBLOCK_BACKEND_GITEA_HPP
|