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

com.gitee.sdk.gitee5j.api.MilestonesApi Maven / Gradle / Ivy

The newest version!
/*
 * Gitee Open API
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: 5.4.83
 * 
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package com.gitee.sdk.gitee5j.api;

import com.gitee.sdk.gitee5j.ApiCallback;
import com.gitee.sdk.gitee5j.ApiClient;
import com.gitee.sdk.gitee5j.ApiException;
import com.gitee.sdk.gitee5j.ApiResponse;
import com.gitee.sdk.gitee5j.Configuration;
import com.gitee.sdk.gitee5j.Pair;
import com.gitee.sdk.gitee5j.ProgressRequestBody;
import com.gitee.sdk.gitee5j.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.gitee.sdk.gitee5j.model.Milestone;
import com.gitee.sdk.gitee5j.model.MilestonesNumberBody;
import com.gitee.sdk.gitee5j.model.RepoMilestonesBody;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MilestonesApi {
    private ApiClient apiClient;

    public MilestonesApi() {
        this(Configuration.getDefaultApiClient());
    }

    public MilestonesApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Build call for deleteReposOwnerRepoMilestonesNumber
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param number 里程碑序号(id) (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call deleteReposOwnerRepoMilestonesNumberCall(String owner, String repo, Integer number, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/repos/{owner}/{repo}/milestones/{number}"
            .replaceAll("\\{" + "owner" + "\\}", apiClient.escapeString(owner.toString()))
            .replaceAll("\\{" + "repo" + "\\}", apiClient.escapeString(repo.toString()))
            .replaceAll("\\{" + "number" + "\\}", apiClient.escapeString(number.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "OAuth2" };
        return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call deleteReposOwnerRepoMilestonesNumberValidateBeforeCall(String owner, String repo, Integer number, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'owner' is set
        if (owner == null) {
            throw new ApiException("Missing the required parameter 'owner' when calling deleteReposOwnerRepoMilestonesNumber(Async)");
        }
        // verify the required parameter 'repo' is set
        if (repo == null) {
            throw new ApiException("Missing the required parameter 'repo' when calling deleteReposOwnerRepoMilestonesNumber(Async)");
        }
        // verify the required parameter 'number' is set
        if (number == null) {
            throw new ApiException("Missing the required parameter 'number' when calling deleteReposOwnerRepoMilestonesNumber(Async)");
        }

        okhttp3.Call call = deleteReposOwnerRepoMilestonesNumberCall(owner, repo, number, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 删除仓库单个里程碑
     * 删除仓库单个里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param number 里程碑序号(id) (required)
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public void deleteReposOwnerRepoMilestonesNumber(String owner, String repo, Integer number) throws ApiException {
        deleteReposOwnerRepoMilestonesNumberWithHttpInfo(owner, repo, number);
    }

    /**
     * 删除仓库单个里程碑
     * 删除仓库单个里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param number 里程碑序号(id) (required)
     * @return ApiResponse<Void>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse deleteReposOwnerRepoMilestonesNumberWithHttpInfo(String owner, String repo, Integer number) throws ApiException {
        okhttp3.Call call = deleteReposOwnerRepoMilestonesNumberValidateBeforeCall(owner, repo, number, null, null);
        return apiClient.execute(call);
    }

    /**
     * 删除仓库单个里程碑 (asynchronously)
     * 删除仓库单个里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param number 里程碑序号(id) (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call deleteReposOwnerRepoMilestonesNumberAsync(String owner, String repo, Integer number, final ApiCallback callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = deleteReposOwnerRepoMilestonesNumberValidateBeforeCall(owner, repo, number, progressListener, progressRequestListener);
        apiClient.executeAsync(call, callback);
        return call;
    }
    /**
     * Build call for getReposOwnerRepoMilestones
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param state 里程碑状态: open, closed, all。默认: open (optional, default to open)
     * @param sort 排序方式: due_on (optional, default to due_on)
     * @param direction 升序(asc)或是降序(desc)。默认: asc (optional)
     * @param page 当前的页码 (optional, default to 1)
     * @param perPage 每页的数量,最大为 100 (optional, default to 20)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call getReposOwnerRepoMilestonesCall(String owner, String repo, String state, String sort, String direction, Integer page, Integer perPage, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/repos/{owner}/{repo}/milestones"
            .replaceAll("\\{" + "owner" + "\\}", apiClient.escapeString(owner.toString()))
            .replaceAll("\\{" + "repo" + "\\}", apiClient.escapeString(repo.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        if (state != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("state", state));
        if (sort != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("sort", sort));
        if (direction != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("direction", direction));
        if (page != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("page", page));
        if (perPage != null)
        localVarQueryParams.addAll(apiClient.parameterToPair("per_page", perPage));

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "OAuth2" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getReposOwnerRepoMilestonesValidateBeforeCall(String owner, String repo, String state, String sort, String direction, Integer page, Integer perPage, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'owner' is set
        if (owner == null) {
            throw new ApiException("Missing the required parameter 'owner' when calling getReposOwnerRepoMilestones(Async)");
        }
        // verify the required parameter 'repo' is set
        if (repo == null) {
            throw new ApiException("Missing the required parameter 'repo' when calling getReposOwnerRepoMilestones(Async)");
        }

        okhttp3.Call call = getReposOwnerRepoMilestonesCall(owner, repo, state, sort, direction, page, perPage, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 获取仓库所有里程碑
     * 获取仓库所有里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param state 里程碑状态: open, closed, all。默认: open (optional, default to open)
     * @param sort 排序方式: due_on (optional, default to due_on)
     * @param direction 升序(asc)或是降序(desc)。默认: asc (optional)
     * @param page 当前的页码 (optional, default to 1)
     * @param perPage 每页的数量,最大为 100 (optional, default to 20)
     * @return List<Milestone>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public List getReposOwnerRepoMilestones(String owner, String repo, String state, String sort, String direction, Integer page, Integer perPage) throws ApiException {
        ApiResponse> resp = getReposOwnerRepoMilestonesWithHttpInfo(owner, repo, state, sort, direction, page, perPage);
        return resp.getData();
    }

    /**
     * 获取仓库所有里程碑
     * 获取仓库所有里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param state 里程碑状态: open, closed, all。默认: open (optional, default to open)
     * @param sort 排序方式: due_on (optional, default to due_on)
     * @param direction 升序(asc)或是降序(desc)。默认: asc (optional)
     * @param page 当前的页码 (optional, default to 1)
     * @param perPage 每页的数量,最大为 100 (optional, default to 20)
     * @return ApiResponse<List<Milestone>>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse> getReposOwnerRepoMilestonesWithHttpInfo(String owner, String repo, String state, String sort, String direction, Integer page, Integer perPage) throws ApiException {
        okhttp3.Call call = getReposOwnerRepoMilestonesValidateBeforeCall(owner, repo, state, sort, direction, page, perPage, null, null);
        Type localVarReturnType = new TypeToken>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * 获取仓库所有里程碑 (asynchronously)
     * 获取仓库所有里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param state 里程碑状态: open, closed, all。默认: open (optional, default to open)
     * @param sort 排序方式: due_on (optional, default to due_on)
     * @param direction 升序(asc)或是降序(desc)。默认: asc (optional)
     * @param page 当前的页码 (optional, default to 1)
     * @param perPage 每页的数量,最大为 100 (optional, default to 20)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call getReposOwnerRepoMilestonesAsync(String owner, String repo, String state, String sort, String direction, Integer page, Integer perPage, final ApiCallback> callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = getReposOwnerRepoMilestonesValidateBeforeCall(owner, repo, state, sort, direction, page, perPage, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken>(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for getReposOwnerRepoMilestonesNumber
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param number 里程碑序号(id) (required)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call getReposOwnerRepoMilestonesNumberCall(String owner, String repo, Integer number, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/repos/{owner}/{repo}/milestones/{number}"
            .replaceAll("\\{" + "owner" + "\\}", apiClient.escapeString(owner.toString()))
            .replaceAll("\\{" + "repo" + "\\}", apiClient.escapeString(repo.toString()))
            .replaceAll("\\{" + "number" + "\\}", apiClient.escapeString(number.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "OAuth2" };
        return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getReposOwnerRepoMilestonesNumberValidateBeforeCall(String owner, String repo, Integer number, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'owner' is set
        if (owner == null) {
            throw new ApiException("Missing the required parameter 'owner' when calling getReposOwnerRepoMilestonesNumber(Async)");
        }
        // verify the required parameter 'repo' is set
        if (repo == null) {
            throw new ApiException("Missing the required parameter 'repo' when calling getReposOwnerRepoMilestonesNumber(Async)");
        }
        // verify the required parameter 'number' is set
        if (number == null) {
            throw new ApiException("Missing the required parameter 'number' when calling getReposOwnerRepoMilestonesNumber(Async)");
        }

        okhttp3.Call call = getReposOwnerRepoMilestonesNumberCall(owner, repo, number, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 获取仓库单个里程碑
     * 获取仓库单个里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param number 里程碑序号(id) (required)
     * @return Milestone
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public Milestone getReposOwnerRepoMilestonesNumber(String owner, String repo, Integer number) throws ApiException {
        ApiResponse resp = getReposOwnerRepoMilestonesNumberWithHttpInfo(owner, repo, number);
        return resp.getData();
    }

    /**
     * 获取仓库单个里程碑
     * 获取仓库单个里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param number 里程碑序号(id) (required)
     * @return ApiResponse<Milestone>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse getReposOwnerRepoMilestonesNumberWithHttpInfo(String owner, String repo, Integer number) throws ApiException {
        okhttp3.Call call = getReposOwnerRepoMilestonesNumberValidateBeforeCall(owner, repo, number, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * 获取仓库单个里程碑 (asynchronously)
     * 获取仓库单个里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param number 里程碑序号(id) (required)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call getReposOwnerRepoMilestonesNumberAsync(String owner, String repo, Integer number, final ApiCallback callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = getReposOwnerRepoMilestonesNumberValidateBeforeCall(owner, repo, number, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for patchReposOwnerRepoMilestonesNumber
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param number 里程碑序号(id) (required)
     * @param body  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call patchReposOwnerRepoMilestonesNumberCall(String owner, String repo, Integer number, MilestonesNumberBody body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/repos/{owner}/{repo}/milestones/{number}"
            .replaceAll("\\{" + "owner" + "\\}", apiClient.escapeString(owner.toString()))
            .replaceAll("\\{" + "repo" + "\\}", apiClient.escapeString(repo.toString()))
            .replaceAll("\\{" + "number" + "\\}", apiClient.escapeString(number.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "*/*"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "OAuth2" };
        return apiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call patchReposOwnerRepoMilestonesNumberValidateBeforeCall(String owner, String repo, Integer number, MilestonesNumberBody body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'owner' is set
        if (owner == null) {
            throw new ApiException("Missing the required parameter 'owner' when calling patchReposOwnerRepoMilestonesNumber(Async)");
        }
        // verify the required parameter 'repo' is set
        if (repo == null) {
            throw new ApiException("Missing the required parameter 'repo' when calling patchReposOwnerRepoMilestonesNumber(Async)");
        }
        // verify the required parameter 'number' is set
        if (number == null) {
            throw new ApiException("Missing the required parameter 'number' when calling patchReposOwnerRepoMilestonesNumber(Async)");
        }

        okhttp3.Call call = patchReposOwnerRepoMilestonesNumberCall(owner, repo, number, body, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 更新仓库里程碑
     * 更新仓库里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param number 里程碑序号(id) (required)
     * @param body  (optional)
     * @return Milestone
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public Milestone patchReposOwnerRepoMilestonesNumber(String owner, String repo, Integer number, MilestonesNumberBody body) throws ApiException {
        ApiResponse resp = patchReposOwnerRepoMilestonesNumberWithHttpInfo(owner, repo, number, body);
        return resp.getData();
    }

    /**
     * 更新仓库里程碑
     * 更新仓库里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param number 里程碑序号(id) (required)
     * @param body  (optional)
     * @return ApiResponse<Milestone>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse patchReposOwnerRepoMilestonesNumberWithHttpInfo(String owner, String repo, Integer number, MilestonesNumberBody body) throws ApiException {
        okhttp3.Call call = patchReposOwnerRepoMilestonesNumberValidateBeforeCall(owner, repo, number, body, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * 更新仓库里程碑 (asynchronously)
     * 更新仓库里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param number 里程碑序号(id) (required)
     * @param body  (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call patchReposOwnerRepoMilestonesNumberAsync(String owner, String repo, Integer number, MilestonesNumberBody body, final ApiCallback callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = patchReposOwnerRepoMilestonesNumberValidateBeforeCall(owner, repo, number, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
    /**
     * Build call for postReposOwnerRepoMilestones
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param body  (optional)
     * @param progressListener Progress listener
     * @param progressRequestListener Progress request listener
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     */
    public okhttp3.Call postReposOwnerRepoMilestonesCall(String owner, String repo, RepoMilestonesBody body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        Object localVarPostBody = body;

        // create path and map variables
        String localVarPath = "/repos/{owner}/{repo}/milestones"
            .replaceAll("\\{" + "owner" + "\\}", apiClient.escapeString(owner.toString()))
            .replaceAll("\\{" + "repo" + "\\}", apiClient.escapeString(repo.toString()));

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();

        Map localVarHeaderParams = new HashMap();

        Map localVarFormParams = new HashMap();

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
        localVarHeaderParams.put("Content-Type", localVarContentType);

        if(progressListener != null) {
            apiClient.getHttpClient().networkInterceptors().add(new okhttp3.Interceptor() {
                @Override
                public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException {
                    okhttp3.Response originalResponse = chain.proceed(chain.request());
                    return originalResponse.newBuilder()
                    .body(new ProgressResponseBody(originalResponse.body(), progressListener))
                    .build();
                }
            });
        }

        String[] localVarAuthNames = new String[] { "OAuth2" };
        return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call postReposOwnerRepoMilestonesValidateBeforeCall(String owner, String repo, RepoMilestonesBody body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
        // verify the required parameter 'owner' is set
        if (owner == null) {
            throw new ApiException("Missing the required parameter 'owner' when calling postReposOwnerRepoMilestones(Async)");
        }
        // verify the required parameter 'repo' is set
        if (repo == null) {
            throw new ApiException("Missing the required parameter 'repo' when calling postReposOwnerRepoMilestones(Async)");
        }

        okhttp3.Call call = postReposOwnerRepoMilestonesCall(owner, repo, body, progressListener, progressRequestListener);
        return call;

    }

    /**
     * 创建仓库里程碑
     * 创建仓库里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param body  (optional)
     * @return Milestone
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public Milestone postReposOwnerRepoMilestones(String owner, String repo, RepoMilestonesBody body) throws ApiException {
        ApiResponse resp = postReposOwnerRepoMilestonesWithHttpInfo(owner, repo, body);
        return resp.getData();
    }

    /**
     * 创建仓库里程碑
     * 创建仓库里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param body  (optional)
     * @return ApiResponse<Milestone>
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     */
    public ApiResponse postReposOwnerRepoMilestonesWithHttpInfo(String owner, String repo, RepoMilestonesBody body) throws ApiException {
        okhttp3.Call call = postReposOwnerRepoMilestonesValidateBeforeCall(owner, repo, body, null, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }

    /**
     * 创建仓库里程碑 (asynchronously)
     * 创建仓库里程碑
     * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
     * @param repo 仓库路径(path) (required)
     * @param body  (optional)
     * @param callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     */
    public okhttp3.Call postReposOwnerRepoMilestonesAsync(String owner, String repo, RepoMilestonesBody body, final ApiCallback callback) throws ApiException {

        ProgressResponseBody.ProgressListener progressListener = null;
        ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

        if (callback != null) {
            progressListener = new ProgressResponseBody.ProgressListener() {
                @Override
                public void update(long bytesRead, long contentLength, boolean done) {
                    callback.onDownloadProgress(bytesRead, contentLength, done);
                }
            };

            progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
                @Override
                public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                    callback.onUploadProgress(bytesWritten, contentLength, done);
                }
            };
        }

        okhttp3.Call call = postReposOwnerRepoMilestonesValidateBeforeCall(owner, repo, body, progressListener, progressRequestListener);
        Type localVarReturnType = new TypeToken(){}.getType();
        apiClient.executeAsync(call, localVarReturnType, callback);
        return call;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy