All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cloud.chain.git.api.service.GitApiService Maven / Gradle / Ivy

The newest version!
package cloud.chain.git.api.service;

import cloud.chain.git.api.dto.*;
import cloud.chain.git.api.http.HttpClient;
import lombok.SneakyThrows;
import okhttp3.Request;
import okhttp3.Response;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 *  wuXiaoMing
 *  2023/2/19 11:20
 */
public interface GitApiService {

    /**
     * 获取仓库内容信息
     */
    Res getRepositoryContent(ReposInfo reposInfo);

    /**
     * 获取仓库内容信息
     */
    Res getRepositoryContent(ReposInfo reposInfo, Map headers);

    /**
     * 创建仓库
     */
    Res createARepositoryForTheAuthenticatedUser(Repos repos);

    /**
     * Create or update file contents
     */
    Res createOrUpdateFileContents(ReposFileInfo reposFileInfo, ReposInfo reposInfo);

    /**
     * Delete a file
     *
     * @return
     */
    Res deleteAFile(ReposDeleteInfo reposDeleteInfo, ReposInfo reposInfo);

    void proxy(String path, HttpServletRequest request, HttpServletResponse response);


    /**
     * 获取文件内容
     */
    @SneakyThrows
    default Res getFileContent(String url) {
        Request request = new Request.Builder()
                .url(url).build();
        Response response = HttpClient.getClient().newCall(request).execute();
        return new Res(response);
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy