mirror of
https://github.com/hanzo-cpp/sdk.git
synced 2026-11-20 19:55:32 +00:00
The projection these were generated from was a month old and predated the compute migration, so every one of them described /v1/visor — which the API serves at zero paths now. That is why a hand-written console client and a generated one had drifted the same way at the same time. No /v1/visor path survives here. The word still appears as a source-plane value and inside gvisor and supervisor, which are not this rename.
531 lines
37 KiB
C++
531 lines
37 KiB
C++
/**
|
|
* Hanzo Cloud API
|
|
* The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
*
|
|
* The version of the OpenAPI document: v1
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI-Generator 7.14.0.
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
/*
|
|
* GitApi.h
|
|
*
|
|
*
|
|
*/
|
|
|
|
#ifndef HANZO_API_GitApi_H_
|
|
#define HANZO_API_GitApi_H_
|
|
|
|
|
|
|
|
#include "hanzo/ApiClient.h"
|
|
|
|
#include "hanzo/model/BlobJSON.h"
|
|
#include "hanzo/model/CommitsJSON.h"
|
|
#include "hanzo/model/CreateReq.h"
|
|
#include "hanzo/model/FilesJSON.h"
|
|
#include "hanzo/model/GcOut.h"
|
|
#include "hanzo/HttpContent.h"
|
|
#include "hanzo/model/KeyList.h"
|
|
#include "hanzo/model/KeyView.h"
|
|
#include "hanzo/model/MirrorList.h"
|
|
#include "hanzo/model/MirrorReq.h"
|
|
#include "hanzo/model/MirrorTargetReq.h"
|
|
#include "hanzo/model/MirrorTargetView.h"
|
|
#include "hanzo/model/OpenReq.h"
|
|
#include "hanzo/model/PatchIn.h"
|
|
#include "hanzo/model/PullList.h"
|
|
#include "hanzo/model/PullView.h"
|
|
#include "hanzo/model/PushReq.h"
|
|
#include "hanzo/model/PushResp.h"
|
|
#include "hanzo/model/ReadmeJSON.h"
|
|
#include "hanzo/model/RefsJSON.h"
|
|
#include "hanzo/model/RegisterKeyReq.h"
|
|
#include "hanzo/model/RepoList.h"
|
|
#include "hanzo/model/RepoView.h"
|
|
#include "hanzo/model/SubscribeReq.h"
|
|
#include "hanzo/model/SubscriptionList.h"
|
|
#include "hanzo/model/SubscriptionView.h"
|
|
#include "hanzo/model/TreeJSON.h"
|
|
#include "hanzo/model/UsageView.h"
|
|
#include <cpprest/details/basic_types.h>
|
|
#include <boost/optional.hpp>
|
|
|
|
namespace hanzo {
|
|
namespace api {
|
|
|
|
using namespace hanzo::model;
|
|
|
|
|
|
|
|
class GitApi
|
|
{
|
|
public:
|
|
|
|
explicit GitApi( std::shared_ptr<const ApiClient> apiClient );
|
|
|
|
virtual ~GitApi();
|
|
|
|
/// <summary>
|
|
/// Removes a registered SSH key, scoped to the caller's org: an org can only delete its own, and a key id it does not own is not found.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Removes a registered SSH key, scoped to the caller's org: an org can only delete its own, and a key id it does not own is not found. Answers 204 with no body. Once removed the key no longer authenticates any SSH git access.
|
|
/// </remarks>
|
|
/// <param name="id">ID is the key's identifier (\"gitkey_…\"), from the :id path segment.</param>
|
|
pplx::task<void> deleteGitKeysById(
|
|
utility::string_t id
|
|
) const;
|
|
/// <summary>
|
|
/// Removes a repo's metadata and purges its storage.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Removes a repo's metadata and purges its storage. Answers 204 with no body. The metadata row is the source of truth for existence, so a storage purge that fails is logged and the delete still succeeds — and a second call is a 404, not a second delete.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo's org-unique handle, from the :name path segment. A trailing \".git\" is stripped.</param>
|
|
pplx::task<void> deleteGitReposByName(
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Removes one Slack subscription from a repo; the notifier stops posting that repo's events to that channel.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Removes one Slack subscription from a repo; the notifier stops posting that repo's events to that channel. Answers 204 with no body. An id that is not this repo's subscription is not found.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo, from the :name path segment.</param>
|
|
/// <param name="id">ID is the row to remove, from the :id path segment.</param>
|
|
pplx::task<void> deleteGitReposByNameSubscriptionsById(
|
|
utility::string_t name,
|
|
utility::string_t id
|
|
) const;
|
|
/// <summary>
|
|
/// Removes one outbound mirror target; later pushes stop being forwarded to it.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Removes one outbound mirror target; later pushes stop being forwarded to it. Answers 204 with no body. Nothing is done to the downstream remote itself — only this repo's intent to push there is dropped.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo, from the :name path segment.</param>
|
|
/// <param name="id">ID is the row to remove, from the :id path segment.</param>
|
|
pplx::task<void> deleteGitReposByNameTargetsById(
|
|
utility::string_t name,
|
|
utility::string_t id
|
|
) const;
|
|
/// <summary>
|
|
/// Browse your org's repositories
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The repository list for the signed-in caller's org — each repo with its description, default branch, size and last update. SIGNED OUT it renders the public explore page instead of refusing, because most Hanzo repos are open source and the open face is the default one; signed in, the caller's own org shows its private repositories alongside its public ones. This is a server-rendered browser page, not JSON — the console repo-browser reads the same repository through the JSON ops under /v1/git/repos. Repository names, paths and file contents all render through auto-escaping templates rather than being concatenated into HTML.
|
|
/// </remarks>
|
|
pplx::task<void> getGit(
|
|
) const;
|
|
/// <summary>
|
|
/// Advertise a repository's refs to a git client
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The ref-advertisement phase of git's smart-HTTP protocol — the first request a clone, a fetch and a push all make. `?service=` selects which: `git-upload-pack` advertises for a fetch, `git-receive-pack` for a push, and any other value is 400. ANONYMOUS ONLY FOR FETCH, AND ONLY ON A PUBLIC REPOSITORY. The push advertisement always requires an authenticated org, and where a path org is present it must equal the authenticated one. A private repository reached without its org is 404, indistinguishable from one that does not exist. Addressed under the API prefix, with the PROJECT as a middle path segment: project scope otherwise rides a header a git client cannot send, so this path is the only usable remote for a project-scoped repository. This is git's own wire protocol, not an API call to make by hand: point a git client at the clone URL and it makes this request itself.
|
|
/// </remarks>
|
|
/// <param name="org"></param>
|
|
/// <param name="project"></param>
|
|
/// <param name="repo"></param>
|
|
pplx::task<void> getGitByOrgByProjectByRepoInfoRefs(
|
|
utility::string_t org,
|
|
utility::string_t project,
|
|
utility::string_t repo
|
|
) const;
|
|
/// <summary>
|
|
/// Open a repository's home page
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// A repository at a glance: its branches, the tree at the tip, its most recent commits, its README rendered, and the HTTPS and SSH clone URLs. `?ref=` selects a branch, tag or commit; the default branch is used when it is omitted. A repository with no commits yet renders its clone instructions rather than an error, which is what a caller who has just created one needs to see. A public repository is readable by anyone; a private one only by its own org. A repository that does not exist and one belonging to another org answer the SAME 404, so the page is never an existence oracle. This is a server-rendered browser page, not JSON — the console repo-browser reads the same repository through the JSON ops under /v1/git/repos. Repository names, paths and file contents all render through auto-escaping templates rather than being concatenated into HTML.
|
|
/// </remarks>
|
|
/// <param name="org"></param>
|
|
/// <param name="repo"></param>
|
|
pplx::task<void> getGitByOrgByRepo(
|
|
utility::string_t org,
|
|
utility::string_t repo
|
|
) const;
|
|
/// <summary>
|
|
/// Read a repository's commit log
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The hundred most recent commits on one ref, each with its author, message and date. `?ref=` selects the branch, tag or commit, defaulting to the repository's default branch; an unknown one is 404. A public repository is readable by anyone; a private one only by its own org. A repository that does not exist and one belonging to another org answer the SAME 404, so the page is never an existence oracle. This is a server-rendered browser page, not JSON — the console repo-browser reads the same repository through the JSON ops under /v1/git/repos. Repository names, paths and file contents all render through auto-escaping templates rather than being concatenated into HTML.
|
|
/// </remarks>
|
|
/// <param name="org"></param>
|
|
/// <param name="repo"></param>
|
|
pplx::task<void> getGitByOrgByRepoCommits(
|
|
utility::string_t org,
|
|
utility::string_t repo
|
|
) const;
|
|
/// <summary>
|
|
/// Advertise a repository's refs to a git client
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The ref-advertisement phase of git's smart-HTTP protocol — the first request a clone, a fetch and a push all make. `?service=` selects which: `git-upload-pack` advertises for a fetch, `git-receive-pack` for a push, and any other value is 400. ANONYMOUS ONLY FOR FETCH, AND ONLY ON A PUBLIC REPOSITORY. The push advertisement always requires an authenticated org, and where a path org is present it must equal the authenticated one. A private repository reached without its org is 404, indistinguishable from one that does not exist. Addressed under the API prefix, so `git clone https://<host>/v1/git/<org>/<repo>.git` works on any host the binary serves. This is git's own wire protocol, not an API call to make by hand: point a git client at the clone URL and it makes this request itself.
|
|
/// </remarks>
|
|
/// <param name="org"></param>
|
|
/// <param name="repo"></param>
|
|
pplx::task<void> getGitByOrgByRepoInfoRefs(
|
|
utility::string_t org,
|
|
utility::string_t repo
|
|
) const;
|
|
/// <summary>
|
|
/// Discover public repositories across every org
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The open, unauthenticated face of the git host: every PUBLIC repository in the fleet, org-qualified, so a project can be found and cloned with no account at all — signing in is for private repos and for writes. Repositories live in per-org stores with no global index, so this unions each org's public rows and is bounded to a fixed number of stores per request, keeping discovery quick however many orgs exist. A fleet with no orgs yet is an empty page, not an error. This is a server-rendered browser page, not JSON — the console repo-browser reads the same repository through the JSON ops under /v1/git/repos. Repository names, paths and file contents all render through auto-escaping templates rather than being concatenated into HTML.
|
|
/// </remarks>
|
|
pplx::task<void> getGitExplore(
|
|
) const;
|
|
/// <summary>
|
|
/// Returns the SSH public keys registered to the caller's org — the keys that authenticate `git clone git@<host>:<org>/<repo>.git`.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns the SSH public keys registered to the caller's org — the keys that authenticate `git clone git@<host>:<org>/<repo>.git`. Keys are org-scoped on read even though the fingerprint index is global, so one org never sees another's.
|
|
/// </remarks>
|
|
pplx::task<std::shared_ptr<KeyList>> getGitKeys(
|
|
) const;
|
|
/// <summary>
|
|
/// Returns the repos in the caller's scope, most recently updated first.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns the repos in the caller's scope, most recently updated first. The scope is the request principal's — the gateway-minted org and its optional project — never anything off the wire, so a caller only ever sees its own. Rows carry no branches or HEAD; read one repo for those.
|
|
/// </remarks>
|
|
pplx::task<std::shared_ptr<RepoList>> getGitRepos(
|
|
) const;
|
|
/// <summary>
|
|
/// Returns one repo with its live ref state: every branch name and the resolved HEAD commit.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns one repo with its live ref state: every branch name and the resolved HEAD commit. Both are read from the object store on each call, so an empty repo reports no branches and an empty head rather than failing. A repo outside the caller's scope is not found.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo's org-unique handle, from the :name path segment. A trailing \".git\" is stripped.</param>
|
|
pplx::task<std::shared_ptr<RepoView>> getGitReposByName(
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Returns one file's bytes at one revision.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns one file's bytes at one revision. Text comes back verbatim, binary comes back base64, and a file past the 1 MiB view cap comes back marked truncated with NO content — the client is expected to clone instead.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo to read, from the :name path segment.</param>
|
|
/// <param name="ref">Ref is a branch, tag or commit; empty means the repo's HEAD. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="path">Path is repo-relative; empty is the tree root. Traversal is stripped. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<BlobJSON>> getGitReposByNameBlob(
|
|
utility::string_t name,
|
|
boost::optional<utility::string_t> ref,
|
|
boost::optional<utility::string_t> path
|
|
) const;
|
|
/// <summary>
|
|
/// Walks a ref's history newest first, or one path's history when a path is given.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Walks a ref's history newest first, or one path's history when a path is given. There is no cursor: the page is the newest `limit` commits.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo to read, from the :name path segment.</param>
|
|
/// <param name="ref">Ref is the branch, tag or commit to walk back from; empty means HEAD. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="path">Path narrows the history to commits touching it; empty walks the whole ref. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="limit">Limit caps the page. Anything not positive means 50; the cap is 100. (optional, default to 0L)</param>
|
|
pplx::task<std::shared_ptr<CommitsJSON>> getGitReposByNameCommits(
|
|
utility::string_t name,
|
|
boost::optional<utility::string_t> ref,
|
|
boost::optional<utility::string_t> path,
|
|
boost::optional<int64_t> limit
|
|
) const;
|
|
/// <summary>
|
|
/// Returns every file a glob selects at one revision, WITH its bytes and the revision they came from.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns every file a glob selects at one revision, WITH its bytes and the revision they came from. It is the read a delivery generator makes: one call answers \"what is the inventory at this commit, and what does it say\", where listing and then fetching would be a request per file. Returning the resolved revision matters as much as the bytes. A generator that lists at `main` and then reads at `main` can straddle a push and assemble half its inventory from one commit and half from the next; resolving once makes the whole read consistent by construction. A file past the read cap comes back Truncated with no content rather than being dropped. A caller building a desired set has to know the difference between \"this file is empty\" and \"this file was not read\" — silently omitting it is how a pruning reconcile deletes what the missing file declared.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo to read, from the :name path segment.</param>
|
|
/// <param name="ref">Ref is a branch, tag or commit; empty means the repo's HEAD. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="glob">Glob selects files, matched segment by segment so `*` never crosses a `/`. `**` matches zero or more whole segments. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<FilesJSON>> getGitReposByNameFiles(
|
|
utility::string_t name,
|
|
boost::optional<utility::string_t> ref,
|
|
boost::optional<utility::string_t> glob
|
|
) const;
|
|
/// <summary>
|
|
/// Returns a repo's pull requests, newest number first — what is waiting to be reviewed, and what has already landed.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns a repo's pull requests, newest number first — what is waiting to be reviewed, and what has already landed. Narrow it with ?state=open or ?state=merged; omit state for every proposal.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo, from the :name path segment.</param>
|
|
/// <param name="state">State narrows the list to \"open\" or \"merged\". Omit it for every proposal. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<PullList>> getGitReposByNamePulls(
|
|
utility::string_t name,
|
|
boost::optional<utility::string_t> state
|
|
) const;
|
|
/// <summary>
|
|
/// Returns one pull request by its per-repo number.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns one pull request by its per-repo number. A number belonging to another tenant's repo is not found, exactly as the repo itself is not.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo, from the :name path segment.</param>
|
|
/// <param name="number">Number is the proposal's per-repo number, from the :number path segment.</param>
|
|
pplx::task<std::shared_ptr<PullView>> getGitReposByNamePullsByNumber(
|
|
utility::string_t name,
|
|
int64_t number
|
|
) const;
|
|
/// <summary>
|
|
/// Returns the README at the tree root as plain text — unrendered, so the caller decides how to present it.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns the README at the tree root as plain text — unrendered, so the caller decides how to present it. A repo with no README is not found.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo to read, from the :name path segment.</param>
|
|
/// <param name="ref">Ref is a branch, tag or commit; empty means the repo's HEAD. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<ReadmeJSON>> getGitReposByNameReadme(
|
|
utility::string_t name,
|
|
boost::optional<utility::string_t> ref
|
|
) const;
|
|
/// <summary>
|
|
/// Lists a repo's branches, tags and default branch — what a branch picker needs in one call.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Lists a repo's branches, tags and default branch — what a branch picker needs in one call. Unlike the other read ops it tolerates a repo with no commits: the ref sets come back empty and the default branch is still named.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo's org-unique handle, from the :name path segment. A trailing \".git\" is stripped.</param>
|
|
pplx::task<std::shared_ptr<RefsJSON>> getGitReposByNameRefs(
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Returns a repo's Slack subscriptions — which channels the lifecycle notifier posts this repo's push and deploy events to.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns a repo's Slack subscriptions — which channels the lifecycle notifier posts this repo's push and deploy events to.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo's org-unique handle, from the :name path segment. A trailing \".git\" is stripped.</param>
|
|
pplx::task<std::shared_ptr<SubscriptionList>> getGitReposByNameSubscriptions(
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Returns a repo's outbound mirror targets — the downstream remotes the mirror reactor pushes to whenever a push lands here.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns a repo's outbound mirror targets — the downstream remotes the mirror reactor pushes to whenever a push lands here.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo's org-unique handle, from the :name path segment. A trailing \".git\" is stripped.</param>
|
|
pplx::task<std::shared_ptr<MirrorList>> getGitReposByNameTargets(
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Lists the immediate children of one directory at one revision, directories before files.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Lists the immediate children of one directory at one revision, directories before files. It does not recurse — walk down a level at a time.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo to read, from the :name path segment.</param>
|
|
/// <param name="ref">Ref is a branch, tag or commit; empty means the repo's HEAD. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="path">Path is repo-relative; empty is the tree root. Traversal is stripped. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<TreeJSON>> getGitReposByNameTree(
|
|
utility::string_t name,
|
|
boost::optional<utility::string_t> ref,
|
|
boost::optional<utility::string_t> path
|
|
) const;
|
|
/// <summary>
|
|
/// Returns per-repo and total storage bytes for the caller's org — the queryable, per-tenant number commerce and o11y meter on.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns per-repo and total storage bytes for the caller's org — the queryable, per-tenant number commerce and o11y meter on. It spans EVERY project sub-scope, unlike the repo list, so a billing consumer sees the whole tenant footprint in one call. Sizes are last-measured values (create, push, mirror and gc each re-measure), not a live walk of the disk.
|
|
/// </remarks>
|
|
pplx::task<std::shared_ptr<UsageView>> getGitUsage(
|
|
) const;
|
|
/// <summary>
|
|
/// Flips a repo's public bit, the one mutable repo setting today.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Flips a repo's public bit, the one mutable repo setting today. Public grants ANONYMOUS fetch only; push and the whole control plane stay org-authed. Returns the updated repo.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo to update, from the :name path segment.</param>
|
|
/// <param name="patchIn"></param>
|
|
pplx::task<std::shared_ptr<RepoView>> patchGitReposByName(
|
|
utility::string_t name,
|
|
std::shared_ptr<PatchIn> patchIn
|
|
) const;
|
|
/// <summary>
|
|
/// Accept a push, and turn it into a build
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The pack-transfer phase of a push, and the point at which a push becomes an EVENT. NEVER ANONYMOUS: a push always requires an authenticated org, and the org in the path must equal it. Once the pack is on disk the repository's storage usage is metered and a build is fired for every branch whose tip actually moved, computed from the before/after branch diff rather than from what the client claimed. That runs on a cancel-immune context, so a client that hangs up the moment its push lands still gets its build, and it runs even when git itself exited non-zero — the refs on disk are the ground truth. Repacking housekeeping is detached and never blocks the response. A Content-Type other than `application/x-git-receive-pack-request` is 400. Addressed under the API prefix, with the PROJECT as a middle path segment: project scope otherwise rides a header a git client cannot send, so this path is the only usable remote for a project-scoped repository. This is git's own wire protocol, not an API call to make by hand: point a git client at the clone URL and it makes this request itself.
|
|
/// </remarks>
|
|
/// <param name="org"></param>
|
|
/// <param name="project"></param>
|
|
/// <param name="repo"></param>
|
|
/// <param name="body"> (optional)</param>
|
|
pplx::task<void> postGitByOrgByProjectByRepoGitReceivePack(
|
|
utility::string_t org,
|
|
utility::string_t project,
|
|
utility::string_t repo,
|
|
boost::optional<std::shared_ptr<HttpContent>> body
|
|
) const;
|
|
/// <summary>
|
|
/// Serve a clone or fetch
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The pack-transfer phase of a clone or fetch: the request and the response are git's binary pack protocol, streamed straight through git itself — request body to git's stdin, git's stdout to the response — so a multi-gigabyte clone never lands in this process's memory. A PUBLIC repository is fetched anonymously; a private one requires its own org, and a wrong or absent org is 404 rather than a hint that the repository exists. A Content-Type other than `application/x-git-upload-pack-request` is 400. Addressed under the API prefix, with the PROJECT as a middle path segment: project scope otherwise rides a header a git client cannot send, so this path is the only usable remote for a project-scoped repository. This is git's own wire protocol, not an API call to make by hand: point a git client at the clone URL and it makes this request itself.
|
|
/// </remarks>
|
|
/// <param name="org"></param>
|
|
/// <param name="project"></param>
|
|
/// <param name="repo"></param>
|
|
/// <param name="body"> (optional)</param>
|
|
pplx::task<void> postGitByOrgByProjectByRepoGitUploadPack(
|
|
utility::string_t org,
|
|
utility::string_t project,
|
|
utility::string_t repo,
|
|
boost::optional<std::shared_ptr<HttpContent>> body
|
|
) const;
|
|
/// <summary>
|
|
/// Accept a push, and turn it into a build
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The pack-transfer phase of a push, and the point at which a push becomes an EVENT. NEVER ANONYMOUS: a push always requires an authenticated org, and the org in the path must equal it. Once the pack is on disk the repository's storage usage is metered and a build is fired for every branch whose tip actually moved, computed from the before/after branch diff rather than from what the client claimed. That runs on a cancel-immune context, so a client that hangs up the moment its push lands still gets its build, and it runs even when git itself exited non-zero — the refs on disk are the ground truth. Repacking housekeeping is detached and never blocks the response. A Content-Type other than `application/x-git-receive-pack-request` is 400. Addressed under the API prefix, so `git clone https://<host>/v1/git/<org>/<repo>.git` works on any host the binary serves. This is git's own wire protocol, not an API call to make by hand: point a git client at the clone URL and it makes this request itself.
|
|
/// </remarks>
|
|
/// <param name="org"></param>
|
|
/// <param name="repo"></param>
|
|
/// <param name="body"> (optional)</param>
|
|
pplx::task<void> postGitByOrgByRepoGitReceivePack(
|
|
utility::string_t org,
|
|
utility::string_t repo,
|
|
boost::optional<std::shared_ptr<HttpContent>> body
|
|
) const;
|
|
/// <summary>
|
|
/// Serve a clone or fetch
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The pack-transfer phase of a clone or fetch: the request and the response are git's binary pack protocol, streamed straight through git itself — request body to git's stdin, git's stdout to the response — so a multi-gigabyte clone never lands in this process's memory. A PUBLIC repository is fetched anonymously; a private one requires its own org, and a wrong or absent org is 404 rather than a hint that the repository exists. A Content-Type other than `application/x-git-upload-pack-request` is 400. Addressed under the API prefix, so `git clone https://<host>/v1/git/<org>/<repo>.git` works on any host the binary serves. This is git's own wire protocol, not an API call to make by hand: point a git client at the clone URL and it makes this request itself.
|
|
/// </remarks>
|
|
/// <param name="org"></param>
|
|
/// <param name="repo"></param>
|
|
/// <param name="body"> (optional)</param>
|
|
pplx::task<void> postGitByOrgByRepoGitUploadPack(
|
|
utility::string_t org,
|
|
utility::string_t repo,
|
|
boost::optional<std::shared_ptr<HttpContent>> body
|
|
) const;
|
|
/// <summary>
|
|
/// Registers an SSH public key so it can authenticate `git clone git@<host>:<org>/<repo>.git` for the caller's org.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Registers an SSH public key so it can authenticate `git clone git@<host>:<org>/<repo>.git` for the caller's org. The key line is parsed and canonicalized before storage, its SHA256 fingerprint becomes the auth lookup handle, and the full public key round-trips (it is public). Answers 201. Fingerprints are globally unique, so a key already registered — to this org or any other — is a 409: one key belongs to exactly one org.
|
|
/// </remarks>
|
|
/// <param name="registerKeyReq"></param>
|
|
pplx::task<std::shared_ptr<KeyView>> postGitKeys(
|
|
std::shared_ptr<RegisterKeyReq> registerKeyReq
|
|
) const;
|
|
/// <summary>
|
|
/// Provisions an empty bare repository in the caller's scope and returns it with its clone URLs.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Provisions an empty bare repository in the caller's scope and returns it with its clone URLs. Answers 201. The name must be unique within the scope — a repeat is a 409, never a silent overwrite of an existing repo. The org comes from the validated principal, so a repo is always born owned by the caller's own tenant.
|
|
/// </remarks>
|
|
/// <param name="createReq"></param>
|
|
pplx::task<std::shared_ptr<RepoView>> postGitRepos(
|
|
std::shared_ptr<CreateReq> createReq
|
|
) const;
|
|
/// <summary>
|
|
/// Repacks a repo into one bitmapped pack and rewrites its commit-graph, so the next clone reuses the bitmap instead of walking the whole object graph.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Repacks a repo into one bitmapped pack and rewrites its commit-graph, so the next clone reuses the bitmap instead of walking the whole object graph. Idempotent, and safe to interrupt — git swaps both artifacts atomically. It runs under one pack slot with the same memory bounds as a clone, so it can block behind heavy pack traffic rather than compete with it. Storage usage is re-measured afterwards, since a repack reclaims space.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo's org-unique handle, from the :name path segment. A trailing \".git\" is stripped.</param>
|
|
pplx::task<std::shared_ptr<GcOut>> postGitReposByNameGc(
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Imports an external git repository into the caller's repo, provisioning it on first use.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Imports an external git repository into the caller's repo, provisioning it on first use. Fetch is FORCED and covers every ref, so a first call clones the source and a repeat call re-syncs it — the endpoint is idempotent by mirror semantics. Mirrored bytes are metered exactly like a push, and a push.landed event is emitted for the default branch so the code index picks the repo up.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the local repo to mirror into, from the :name path segment. It is CREATED on first use.</param>
|
|
/// <param name="mirrorReq"></param>
|
|
pplx::task<std::shared_ptr<RepoView>> postGitReposByNameMirror(
|
|
utility::string_t name,
|
|
std::shared_ptr<MirrorReq> mirrorReq
|
|
) const;
|
|
/// <summary>
|
|
/// Proposes a branch for merging and returns it with its number.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Proposes a branch for merging and returns it with its number. Answers 201. Both branches must already exist — a proposal naming a branch nobody pushed is a typo, not a plan — and base defaults to the repo's default branch. Proposing the same head into the same base twice is a 409 while the first proposal is still open, so a retried agent run leaves ONE thing to review rather than a pile of identical ones. A repo outside the caller's scope is a 404, exactly as reading it is.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo the proposal belongs to, from the :name path segment.</param>
|
|
/// <param name="openReq"></param>
|
|
pplx::task<std::shared_ptr<PullView>> postGitReposByNamePulls(
|
|
utility::string_t name,
|
|
std::shared_ptr<OpenReq> openReq
|
|
) const;
|
|
/// <summary>
|
|
/// Merges an open pull request by FAST-FORWARDING base to head, and answers the proposal in its merged state with the revision base now points at.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Merges an open pull request by FAST-FORWARDING base to head, and answers the proposal in its merged state with the revision base now points at. It merges only when base is already an ancestor of head — the case where head contains every commit base has, so moving the branch loses nothing and invents nothing. When base has moved on independently, this REFUSES with 409 and says so: a real three-way merge is not implemented here, and reporting one would claim a result these bytes do not produce. Rebase head onto base and merge again. The move is judged by the same ref policy a `git push` of it would face, and fires the same build and notify reactions, so merging is not a way around either. Merging an already-merged proposal is a 409.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo, from the :name path segment.</param>
|
|
/// <param name="number">Number is the proposal's per-repo number, from the :number path segment.</param>
|
|
pplx::task<std::shared_ptr<PullView>> postGitReposByNamePullsByNumberMerge(
|
|
utility::string_t name,
|
|
int64_t number
|
|
) const;
|
|
/// <summary>
|
|
/// Lands a set of files as one commit without a git client — the hanzo.app builder's push.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Lands a set of files as one commit without a git client — the hanzo.app builder's push. The repo is CREATED on first push, the files are merged onto the branch tip (unlisted files survive), and the same push-to-deploy hook a real receive-pack fires is fired, so downstream this is indistinguishable from a `git push`.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo to push into, from the :name path segment. It is CREATED on first push if it does not exist.</param>
|
|
/// <param name="pushReq"></param>
|
|
pplx::task<std::shared_ptr<PushResp>> postGitReposByNamePush(
|
|
utility::string_t name,
|
|
std::shared_ptr<PushReq> pushReq
|
|
) const;
|
|
/// <summary>
|
|
/// Binds a Slack channel to a repo, so the lifecycle notifier posts that repo's push and deploy events there.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Binds a Slack channel to a repo, so the lifecycle notifier posts that repo's push and deploy events there. Answers 201. The same channel twice on one repo is a 409; a repo outside the caller's scope is a 404, exactly as reading it is.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo to subscribe, from the :name path segment.</param>
|
|
/// <param name="subscribeReq"></param>
|
|
pplx::task<std::shared_ptr<SubscriptionView>> postGitReposByNameSubscriptions(
|
|
utility::string_t name,
|
|
std::shared_ptr<SubscribeReq> subscribeReq
|
|
) const;
|
|
/// <summary>
|
|
/// Registers a downstream remote the repo's advanced refs are pushed to whenever a push lands here.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Registers a downstream remote the repo's advanced refs are pushed to whenever a push lands here. Answers 201. The URL must be https to a host on the mirror allowlist (github.com / gitlab.com): the same set the mirror credential may be sent to, so a target can never capture the shared token or point the push at an internal service. Any embedded userinfo is stripped — credentials ride env-only at push time and never enter the stored URL. One mirror per host per repo; a second is a 409.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the repo whose advanced refs are pushed downstream, from the :name path segment.</param>
|
|
/// <param name="mirrorTargetReq"></param>
|
|
pplx::task<std::shared_ptr<MirrorTargetView>> postGitReposByNameTargets(
|
|
utility::string_t name,
|
|
std::shared_ptr<MirrorTargetReq> mirrorTargetReq
|
|
) const;
|
|
/// <summary>
|
|
/// Retired — push-to-deploy has no inbound webhook
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// GONE (410). Push-to-deploy is not triggered by an inbound webhook. A push into this host's own git server fires the builder in-process, and a repository whose canonical home is GitHub is delivered by the Hanzo Platform GitHub App to POST /v1/integration/github/webhook. The forge does not report a push over HTTP. Every delivery answers 410 whatever it carries — this endpoint reads no body and authenticates nothing. 410 rather than 404, because the address was real and its meaning moved, which is the distinction 410 carries. A 404 from this estate is ambiguous: Hanzo Git serves /v1, so /api/v1 404s too and reads as \"the API is switched off\". A retired endpoint says it is retired and names its replacement, so the answer carries its own fix.
|
|
/// </remarks>
|
|
pplx::task<void> postGitWebhook(
|
|
) const;
|
|
|
|
protected:
|
|
std::shared_ptr<const ApiClient> m_ApiClient;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif /* HANZO_API_GitApi_H_ */
|
|
|