package com.atlassian.bitbucket.mirroring.mirror.client;

import com.atlassian.httpclient.api.Request;

import javax.annotation.Nonnull;

/**
 * Client for making calls to an upstream server (master) from a mirror server.
 *
 * @since 4.5
 */
public interface UpstreamClient {

    /**
     * Creates a new JWT signed request to the upstream server
     *
     * @param relativePath the request path, relative to the upstream server's base URL. This should start with a /
     * @return a request builder that adds a JWT token to the outgoing request
     */
    @Nonnull
    Request.Builder newRequest(@Nonnull String relativePath);

    /**
     * Creates a new signed request to the upstream server with credentials to access the SCM API
     *
     * @param relativePath the request path, relative to the upstream server's base URL. This should start with a /
     * @return a request builder that adds authorization to the outgoing request
     */
    @Nonnull
    Request.Builder newScmHttpRequest(@Nonnull String relativePath);
}
