Skip to content

Feature: add "Pull mirror API" #1227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mikaelol opened this issue Jan 15, 2025 · 1 comment
Open

Feature: add "Pull mirror API" #1227

mikaelol opened this issue Jan 15, 2025 · 1 comment

Comments

@mikaelol
Copy link

The pull mirror API is missing, only remote mirror is currently implemented (which is the push mirror).

@jmini
Copy link
Collaborator

jmini commented Jan 22, 2025

Project remote mirrors API is:

/**
* Get all remote mirrors and their statuses for the specified project.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/remote_mirrors</code></pre>
*
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
* @return a list of project's remote mirrors
* @throws GitLabApiException if any exception occurs
*/
public List<RemoteMirror> getRemoteMirrors(final Object projectIdOrPath) throws GitLabApiException {
return (getRemoteMirrors(projectIdOrPath, getDefaultPerPage()).all());
}
/**
* Get a Pager of remote mirrors and their statuses for the specified project.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/remote_mirrors</code></pre>
*
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
* @param itemsPerPage the number of items per page
* @return a Pager of project's remote mirrors
* @throws GitLabApiException if any exception occurs
*/
public Pager<RemoteMirror> getRemoteMirrors(final Object projectIdOrPath, int itemsPerPage)
throws GitLabApiException {
return (new Pager<RemoteMirror>(
this,
RemoteMirror.class,
itemsPerPage,
null,
"projects",
getProjectIdOrPath(projectIdOrPath),
"remote_mirrors"));
}
/**
* Get a Stream of all remote mirrors and their statuses for the specified project.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/remote_mirrors</code></pre>
*
* @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance
* @return a Stream of project's remote mirrors
* @throws GitLabApiException if any exception occurs
*/
public Stream<RemoteMirror> getRemoteMirrorsStream(final Object projectIdOrPath) throws GitLabApiException {
return (getRemoteMirrors(projectIdOrPath, getDefaultPerPage()).stream());
}

Indeed the pull mirror API https://docs.gitlab.com/ee/api/project_pull_mirroring.html can be contributed to this project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants