Initial commit

This commit is contained in:
opyale
2022-03-26 21:44:02 +01:00
commit 564c3d75cf
16 changed files with 1353 additions and 0 deletions
@@ -0,0 +1,101 @@
package org.gitnex.tea4j.v2.apis.custom;
import org.gitnex.tea4j.v2.models.*;
import retrofit2.Call;
import retrofit2.http.*;
import java.util.List;
public interface CustomApi {
@GET("repos/{owner}/{repo}/contents/{filepath}")
Call<List<ContentsResponse>> repoGetContentsList(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("filepath") String filepath,
@Query("ref") String ref);
/**
* Remove a reaction from a comment of an issue
*
* @param owner owner of the repo (required)
* @param repo name of the repo (required)
* @param id id of the comment to edit (required)
* @param body (optional)
* @return Call&lt;Void&gt;
*/
@Headers({"Content-Type:application/json"})
@HTTP(
method = "DELETE",
path = "repos/{owner}/{repo}/issues/comments/{id}/reactions",
hasBody = true)
Call<Void> issueDeleteCommentReactionWithBody(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("id") Long id,
@Body EditReactionOption body);
/**
* Remove a reaction from an issue
*
* @param owner owner of the repo (required)
* @param repo name of the repo (required)
* @param index index of the issue (required)
* @param body (optional)
* @return Call&lt;Void&gt;
*/
@Headers({"Content-Type:application/json"})
@HTTP(method = "DELETE", path = "repos/{owner}/{repo}/issues/{index}/reactions", hasBody = true)
Call<Void> issueDeleteIssueReactionWithBody(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("index") Long index,
@Body EditReactionOption body);
/**
* Delete a file in a repository
*
* @param owner owner of the repo (required)
* @param repo name of the repo (required)
* @param filepath path of the file to delete (required)
* @param body (required)
* @return Call&lt;FileDeleteResponse&gt;
*/
@Headers({"Content-Type:application/json"})
@HTTP(method = "DELETE", path = "repos/{owner}/{repo}/contents/{filepath}", hasBody = true)
Call<FileDeleteResponse> repoDeleteFileWithBody(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("filepath") String filepath,
@Body DeleteFileOptions body);
/**
* Cancel review requests for a pull request
*
* @param owner owner of the repo (required)
* @param repo name of the repo (required)
* @param index index of the pull request (required)
* @param body (required)
* @return Call&lt;Void&gt;
*/
@Headers({"Content-Type:application/json"})
@HTTP(
method = "DELETE",
path = "repos/{owner}/{repo}/pulls/{index}/requested_reviewers",
hasBody = true)
Call<Void> repoDeletePullReviewRequestsWithBody(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("index") Long index,
@Body PullReviewRequestOptions body);
/**
* Delete email addresses
*
* @param body (optional)
* @return Call&lt;Void&gt;
*/
@Headers({"Content-Type:application/json"})
@HTTP(method = "DELETE", path = "user/emails", hasBody = true)
Call<Void> userDeleteEmailWithBody(@Body DeleteEmailOption body);
}
@@ -0,0 +1,43 @@
package org.gitnex.tea4j.v2.apis.custom;
import org.gitnex.tea4j.v2.models.AccessToken;
import org.gitnex.tea4j.v2.models.ContentsResponse;
import org.gitnex.tea4j.v2.models.CreateAccessTokenOption;
import org.gitnex.tea4j.v2.models.ServerVersion;
import retrofit2.Call;
import retrofit2.http.*;
import java.util.List;
public interface OTPApi {
@GET("version")
Call<ServerVersion> getVersion(@Header("X-Gitea-OTP") int otp);
@GET("users/{username}/tokens")
Call<List<AccessToken>> userGetTokens(
@Header("X-Gitea-OTP") int otp,
@Path("username") String username,
@Query("page") Integer page,
@Query("limit") Integer limit);
@DELETE("users/{username}/tokens/{token}")
Call<Void> userDeleteAccessToken(
@Header("X-Gitea-OTP") int otp,
@Path("username") String username,
@Path("token") String token);
@Headers({"Content-Type:application/json"})
@POST("users/{username}/tokens")
Call<AccessToken> userCreateToken(
@Header("X-Gitea-OTP") int otp,
@Path("username") String username,
@Body CreateAccessTokenOption body);
@GET("repos/{owner}/{repo}/contents/{filepath}")
Call<List<ContentsResponse>> repoGetContentsList(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("filepath") String filepath,
@Query("ref") String ref);
}
@@ -0,0 +1,18 @@
package org.gitnex.tea4j.v2.apis.custom;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Path;
import retrofit2.http.Streaming;
public interface StreamingApi {
@Streaming
@GET("repos/{owner}/{repo}/pulls/{index}.diff")
Call<ResponseBody> getPullDiffContent(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("index") String index);
}
@@ -0,0 +1,33 @@
package org.gitnex.tea4j.v2.apis.custom;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Path;
import retrofit2.http.Streaming;
public interface WebApi {
@Streaming
@GET("{owner}/{repo}/pulls/{index}.diff")
Call<ResponseBody> getPullDiffContent(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("index") String index);
@Streaming
@GET("{owner}/{repo}/raw/branch/{branch}/{filepath}")
Call<ResponseBody> getFileContents(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("branch") String branch,
@Path(value = "filepath", encoded = true) String filepath);
@GET("{owner}/{repo}/git/commit/{sha}.{diffType}")
Call<String> repoDownloadCommitDiffOrPatch(
@Path("owner") String owner,
@Path("repo") String repo,
@Path("sha") String sha,
@Path("diffType") String diffType);
}