resonance 1.0.1
Loading...
Searching...
No Matches
githubclient.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <expected>
5#include <string>
6#include <vector>
7
8#include <nlohmann/json.hpp>
9
10#include "error.h"
11
12namespace Tools::BuildImage {
13
16public:
23 GitHubClient(std::string repo, std::string token);
24
30 [[nodiscard]] std::expected<std::uint64_t, Error> latestSuccessfulRun() const;
31
40 [[nodiscard]] std::expected<std::vector<std::uint8_t>, Error>
41 downloadArtifact(std::uint64_t runId, const std::string &artifact) const;
42
43private:
44 [[nodiscard]] std::expected<std::string, Error> readUrl(const std::string &url) const;
45 [[nodiscard]] std::expected<nlohmann::json, Error> apiJson(const std::string &url) const;
46
47 std::string repo_;
48 std::string token_;
49};
50
51} // namespace Tools::BuildImage
std::expected< std::vector< std::uint8_t >, Error > downloadArtifact(std::uint64_t runId, const std::string &artifact) const
Fetch one artifact archive from a run.
GitHubClient(std::string repo, std::string token)
Create a client.
std::expected< std::uint64_t, Error > latestSuccessfulRun() const
Identify the latest successful run of the build workflow.
Writer of a FreQuency disc image with the built executable and module in place.
Definition byteorder.h:7
Failure returned through std::expected.
Definition error.h:17