This repository has been archived on 2021-03-22. You can view files and clone it, but cannot push or open issues or pull requests.
backend/src/gitea.hpp

52 lines
1.4 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 "cgi.hpp"
#include <cstdint>
#include <string_view>
namespace FediBlock::gitea
{
using std::uint64_t;
using std::string_view;
// Initialize the curl connection handle.
void init();
// Clean up the curl connection handle.
void cleanup();
// No-op write function. Discards HTTP response bodies.
size_t noop_cb(void *ptr, size_t size, size_t nmemb, void *data);
// Make a HTTP POST request to the Gitea API.
void api_request(string_view path, string_view body);
// Make a pull request.
void pull_request(string_view branch, const cgi::entry_type &entry);
[[nodiscard]] uint64_t get_last_pr_id();
} // namespace FediBlock::gitea
#endif // FEDIBLOCK_BACKEND_GITEA_HPP