{
+
+ private DateFormat dateFormat;
+
+ public DateTypeAdapter() {
+ }
+
+ public DateTypeAdapter(DateFormat dateFormat) {
+ this.dateFormat = dateFormat;
+ }
+
+ public void setFormat(DateFormat dateFormat) {
+ this.dateFormat = dateFormat;
+ }
+
+ @Override
+ public void write(JsonWriter out, Date date) throws IOException {
+ if (date == null) {
+ out.nullValue();
+ } else {
+ String value;
+ if (dateFormat != null) {
+ value = dateFormat.format(date);
+ } else {
+ value = ISO8601Utils.format(date, true);
+ }
+ out.value(value);
+ }
+ }
+
+ @Override
+ public Date read(JsonReader in) throws IOException {
+ try {
+ switch (in.peek()) {
+ case NULL:
+ in.nextNull();
+ return null;
+ default:
+ String date = in.nextString();
+ try {
+ if (dateFormat != null) {
+ return dateFormat.parse(date);
+ }
+ return ISO8601Utils.parse(date, new ParsePosition(0));
+ } catch (ParseException e) {
+ throw new JsonParseException(e);
+ }
+ }
+ } catch (IllegalArgumentException e) {
+ throw new JsonParseException(e);
+ }
+ }
+ }
+
+ public JSON setDateFormat(DateFormat dateFormat) {
+ dateTypeAdapter.setFormat(dateFormat);
+ return this;
+ }
+
+ public JSON setSqlDateFormat(DateFormat dateFormat) {
+ sqlDateTypeAdapter.setFormat(dateFormat);
+ return this;
+ }
+
+}
diff --git a/java-gitee/src/main/java/com/gitee/Pair.java b/java-gitee/src/main/java/com/gitee/Pair.java
new file mode 100644
index 0000000000000000000000000000000000000000..16460744f4e4cf8cf1078bbff1dbcf164b7ad3af
--- /dev/null
+++ b/java-gitee/src/main/java/com/gitee/Pair.java
@@ -0,0 +1,52 @@
+/*
+ * 码云 Open API
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * OpenAPI spec version: 5.3.2
+ *
+ *
+ * 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;
+
+@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-01-07T17:52:56.944+08:00")
+public class Pair {
+ private String name = "";
+ private String value = "";
+
+ public Pair (String name, String value) {
+ setName(name);
+ setValue(value);
+ }
+
+ private void setName(String name) {
+ if (!isValidString(name)) return;
+
+ this.name = name;
+ }
+
+ private void setValue(String value) {
+ if (!isValidString(value)) return;
+
+ this.value = value;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ private boolean isValidString(String arg) {
+ if (arg == null) return false;
+ if (arg.trim().isEmpty()) return false;
+
+ return true;
+ }
+}
diff --git a/java-gitee/src/main/java/com/gitee/ProgressRequestBody.java b/java-gitee/src/main/java/com/gitee/ProgressRequestBody.java
new file mode 100644
index 0000000000000000000000000000000000000000..614abdd0b380a99676d261ec62939e25d075ff05
--- /dev/null
+++ b/java-gitee/src/main/java/com/gitee/ProgressRequestBody.java
@@ -0,0 +1,77 @@
+/*
+ * 码云 Open API
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * OpenAPI spec version: 5.3.2
+ *
+ *
+ * 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;
+
+import com.squareup.okhttp.MediaType;
+import com.squareup.okhttp.RequestBody;
+
+import java.io.IOException;
+
+import okio.Buffer;
+import okio.BufferedSink;
+import okio.ForwardingSink;
+import okio.Okio;
+import okio.Sink;
+
+public class ProgressRequestBody extends RequestBody {
+
+ public interface ProgressRequestListener {
+ void onRequestProgress(long bytesWritten, long contentLength, boolean done);
+ }
+
+ private final RequestBody requestBody;
+
+ private final ProgressRequestListener progressListener;
+
+ public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) {
+ this.requestBody = requestBody;
+ this.progressListener = progressListener;
+ }
+
+ @Override
+ public MediaType contentType() {
+ return requestBody.contentType();
+ }
+
+ @Override
+ public long contentLength() throws IOException {
+ return requestBody.contentLength();
+ }
+
+ @Override
+ public void writeTo(BufferedSink sink) throws IOException {
+ BufferedSink bufferedSink = Okio.buffer(sink(sink));
+ requestBody.writeTo(bufferedSink);
+ bufferedSink.flush();
+ }
+
+ private Sink sink(Sink sink) {
+ return new ForwardingSink(sink) {
+
+ long bytesWritten = 0L;
+ long contentLength = 0L;
+
+ @Override
+ public void write(Buffer source, long byteCount) throws IOException {
+ super.write(source, byteCount);
+ if (contentLength == 0) {
+ contentLength = contentLength();
+ }
+
+ bytesWritten += byteCount;
+ progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength);
+ }
+ };
+ }
+}
diff --git a/java-gitee/src/main/java/com/gitee/ProgressResponseBody.java b/java-gitee/src/main/java/com/gitee/ProgressResponseBody.java
new file mode 100644
index 0000000000000000000000000000000000000000..ceccbb4eee0acc3c624f366b52de8dcfab4e1cf5
--- /dev/null
+++ b/java-gitee/src/main/java/com/gitee/ProgressResponseBody.java
@@ -0,0 +1,76 @@
+/*
+ * 码云 Open API
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * OpenAPI spec version: 5.3.2
+ *
+ *
+ * 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;
+
+import com.squareup.okhttp.MediaType;
+import com.squareup.okhttp.ResponseBody;
+
+import java.io.IOException;
+
+import okio.Buffer;
+import okio.BufferedSource;
+import okio.ForwardingSource;
+import okio.Okio;
+import okio.Source;
+
+public class ProgressResponseBody extends ResponseBody {
+
+ public interface ProgressListener {
+ void update(long bytesRead, long contentLength, boolean done);
+ }
+
+ private final ResponseBody responseBody;
+ private final ProgressListener progressListener;
+ private BufferedSource bufferedSource;
+
+ public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
+ this.responseBody = responseBody;
+ this.progressListener = progressListener;
+ }
+
+ @Override
+ public MediaType contentType() {
+ return responseBody.contentType();
+ }
+
+ @Override
+ public long contentLength() throws IOException {
+ return responseBody.contentLength();
+ }
+
+ @Override
+ public BufferedSource source() throws IOException {
+ if (bufferedSource == null) {
+ bufferedSource = Okio.buffer(source(responseBody.source()));
+ }
+ return bufferedSource;
+ }
+
+ private Source source(Source source) {
+ return new ForwardingSource(source) {
+ long totalBytesRead = 0L;
+
+ @Override
+ public long read(Buffer sink, long byteCount) throws IOException {
+ long bytesRead = super.read(sink, byteCount);
+ // read() returns the number of bytes read, or -1 if this source is exhausted.
+ totalBytesRead += bytesRead != -1 ? bytesRead : 0;
+ progressListener.update(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
+ return bytesRead;
+ }
+ };
+ }
+}
+
+
diff --git a/java-gitee/src/main/java/com/gitee/StringUtil.java b/java-gitee/src/main/java/com/gitee/StringUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..5a301e34b0335f02a5724cf497d96d6f8265c672
--- /dev/null
+++ b/java-gitee/src/main/java/com/gitee/StringUtil.java
@@ -0,0 +1,55 @@
+/*
+ * 码云 Open API
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * OpenAPI spec version: 5.3.2
+ *
+ *
+ * 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;
+
+@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-01-07T17:52:56.944+08:00")
+public class StringUtil {
+ /**
+ * Check if the given array contains the given value (with case-insensitive comparison).
+ *
+ * @param array The array
+ * @param value The value to search
+ * @return true if the array contains the value
+ */
+ public static boolean containsIgnoreCase(String[] array, String value) {
+ for (String str : array) {
+ if (value == null && str == null) return true;
+ if (value != null && value.equalsIgnoreCase(str)) return true;
+ }
+ return false;
+ }
+
+ /**
+ * Join an array of strings with the given separator.
+ *
+ * Note: This might be replaced by utility method from commons-lang or guava someday
+ * if one of those libraries is added as dependency.
+ *
+ *
+ * @param array The array of strings
+ * @param separator The separator
+ * @return the resulting string
+ */
+ public static String join(String[] array, String separator) {
+ int len = array.length;
+ if (len == 0) return "";
+
+ StringBuilder out = new StringBuilder();
+ out.append(array[0]);
+ for (int i = 1; i < len; i++) {
+ out.append(separator).append(array[i]);
+ }
+ return out.toString();
+ }
+}
diff --git a/java-gitee/src/main/java/com/gitee/api/ActivityApi.java b/java-gitee/src/main/java/com/gitee/api/ActivityApi.java
new file mode 100644
index 0000000000000000000000000000000000000000..304da98b1e9d07ff037b33adc04f75a66a587ecb
--- /dev/null
+++ b/java-gitee/src/main/java/com/gitee/api/ActivityApi.java
@@ -0,0 +1,4734 @@
+/*
+ * 码云 Open API
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * OpenAPI spec version: 5.3.2
+ *
+ *
+ * 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.api;
+
+import com.gitee.ApiCallback;
+import com.gitee.ApiClient;
+import com.gitee.ApiException;
+import com.gitee.ApiResponse;
+import com.gitee.Configuration;
+import com.gitee.Pair;
+import com.gitee.ProgressRequestBody;
+import com.gitee.ProgressResponseBody;
+
+import com.google.gson.reflect.TypeToken;
+
+import java.io.IOException;
+
+
+import com.gitee.model.Event;
+import com.gitee.model.Project;
+import com.gitee.model.UserBasic;
+import com.gitee.model.UserMessage;
+import com.gitee.model.UserMessageList;
+import com.gitee.model.UserNotification;
+import com.gitee.model.UserNotificationCount;
+import com.gitee.model.UserNotificationList;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ActivityApi {
+ private ApiClient apiClient;
+
+ public ActivityApi() {
+ this(Configuration.getDefaultApiClient());
+ }
+
+ public ActivityApi(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ public ApiClient getApiClient() {
+ return apiClient;
+ }
+
+ public void setApiClient(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ /**
+ * Build call for deleteV5UserStarredOwnerRepo
+ * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
+ * @param repo 仓库路径(path) (required)
+ * @param accessToken 用户授权码 (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 com.squareup.okhttp.Call deleteV5UserStarredOwnerRepoCall(String owner, String repo, String accessToken, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath = "/v5/user/starred/{owner}/{repo}"
+ .replaceAll("\\{" + "owner" + "\\}", apiClient.escapeString(owner.toString()))
+ .replaceAll("\\{" + "repo" + "\\}", apiClient.escapeString(repo.toString()));
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ if (accessToken != null)
+ localVarQueryParams.addAll(apiClient.parameterToPair("access_token", accessToken));
+
+ 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", "multipart/form-data"
+ };
+ final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ if(progressListener != null) {
+ apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
+ return originalResponse.newBuilder()
+ .body(new ProgressResponseBody(originalResponse.body(), progressListener))
+ .build();
+ }
+ });
+ }
+
+ String[] localVarAuthNames = new String[] { };
+ return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private com.squareup.okhttp.Call deleteV5UserStarredOwnerRepoValidateBeforeCall(String owner, String repo, String accessToken, 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 deleteV5UserStarredOwnerRepo(Async)");
+ }
+
+ // verify the required parameter 'repo' is set
+ if (repo == null) {
+ throw new ApiException("Missing the required parameter 'repo' when calling deleteV5UserStarredOwnerRepo(Async)");
+ }
+
+
+ com.squareup.okhttp.Call call = deleteV5UserStarredOwnerRepoCall(owner, repo, accessToken, progressListener, progressRequestListener);
+ return call;
+
+ }
+
+ /**
+ * 取消 star 一个仓库
+ * 取消 star 一个仓库
+ * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
+ * @param repo 仓库路径(path) (required)
+ * @param accessToken 用户授权码 (optional)
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public void deleteV5UserStarredOwnerRepo(String owner, String repo, String accessToken) throws ApiException {
+ deleteV5UserStarredOwnerRepoWithHttpInfo(owner, repo, accessToken);
+ }
+
+ /**
+ * 取消 star 一个仓库
+ * 取消 star 一个仓库
+ * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
+ * @param repo 仓库路径(path) (required)
+ * @param accessToken 用户授权码 (optional)
+ * @return ApiResponse<Void>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse deleteV5UserStarredOwnerRepoWithHttpInfo(String owner, String repo, String accessToken) throws ApiException {
+ com.squareup.okhttp.Call call = deleteV5UserStarredOwnerRepoValidateBeforeCall(owner, repo, accessToken, null, null);
+ return apiClient.execute(call);
+ }
+
+ /**
+ * 取消 star 一个仓库 (asynchronously)
+ * 取消 star 一个仓库
+ * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
+ * @param repo 仓库路径(path) (required)
+ * @param accessToken 用户授权码 (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 com.squareup.okhttp.Call deleteV5UserStarredOwnerRepoAsync(String owner, String repo, String accessToken, 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);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = deleteV5UserStarredOwnerRepoValidateBeforeCall(owner, repo, accessToken, progressListener, progressRequestListener);
+ apiClient.executeAsync(call, callback);
+ return call;
+ }
+ /**
+ * Build call for deleteV5UserSubscriptionsOwnerRepo
+ * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
+ * @param repo 仓库路径(path) (required)
+ * @param accessToken 用户授权码 (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 com.squareup.okhttp.Call deleteV5UserSubscriptionsOwnerRepoCall(String owner, String repo, String accessToken, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath = "/v5/user/subscriptions/{owner}/{repo}"
+ .replaceAll("\\{" + "owner" + "\\}", apiClient.escapeString(owner.toString()))
+ .replaceAll("\\{" + "repo" + "\\}", apiClient.escapeString(repo.toString()));
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ if (accessToken != null)
+ localVarQueryParams.addAll(apiClient.parameterToPair("access_token", accessToken));
+
+ 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", "multipart/form-data"
+ };
+ final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ if(progressListener != null) {
+ apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
+ return originalResponse.newBuilder()
+ .body(new ProgressResponseBody(originalResponse.body(), progressListener))
+ .build();
+ }
+ });
+ }
+
+ String[] localVarAuthNames = new String[] { };
+ return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private com.squareup.okhttp.Call deleteV5UserSubscriptionsOwnerRepoValidateBeforeCall(String owner, String repo, String accessToken, 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 deleteV5UserSubscriptionsOwnerRepo(Async)");
+ }
+
+ // verify the required parameter 'repo' is set
+ if (repo == null) {
+ throw new ApiException("Missing the required parameter 'repo' when calling deleteV5UserSubscriptionsOwnerRepo(Async)");
+ }
+
+
+ com.squareup.okhttp.Call call = deleteV5UserSubscriptionsOwnerRepoCall(owner, repo, accessToken, progressListener, progressRequestListener);
+ return call;
+
+ }
+
+ /**
+ * 取消 watch 一个仓库
+ * 取消 watch 一个仓库
+ * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
+ * @param repo 仓库路径(path) (required)
+ * @param accessToken 用户授权码 (optional)
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public void deleteV5UserSubscriptionsOwnerRepo(String owner, String repo, String accessToken) throws ApiException {
+ deleteV5UserSubscriptionsOwnerRepoWithHttpInfo(owner, repo, accessToken);
+ }
+
+ /**
+ * 取消 watch 一个仓库
+ * 取消 watch 一个仓库
+ * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
+ * @param repo 仓库路径(path) (required)
+ * @param accessToken 用户授权码 (optional)
+ * @return ApiResponse<Void>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse deleteV5UserSubscriptionsOwnerRepoWithHttpInfo(String owner, String repo, String accessToken) throws ApiException {
+ com.squareup.okhttp.Call call = deleteV5UserSubscriptionsOwnerRepoValidateBeforeCall(owner, repo, accessToken, null, null);
+ return apiClient.execute(call);
+ }
+
+ /**
+ * 取消 watch 一个仓库 (asynchronously)
+ * 取消 watch 一个仓库
+ * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
+ * @param repo 仓库路径(path) (required)
+ * @param accessToken 用户授权码 (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 com.squareup.okhttp.Call deleteV5UserSubscriptionsOwnerRepoAsync(String owner, String repo, String accessToken, 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);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = deleteV5UserSubscriptionsOwnerRepoValidateBeforeCall(owner, repo, accessToken, progressListener, progressRequestListener);
+ apiClient.executeAsync(call, callback);
+ return call;
+ }
+ /**
+ * Build call for getV5Events
+ * @param accessToken 用户授权码 (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 com.squareup.okhttp.Call getV5EventsCall(String accessToken, Integer page, Integer perPage, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath = "/v5/events";
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ if (accessToken != null)
+ localVarQueryParams.addAll(apiClient.parameterToPair("access_token", accessToken));
+ 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 = {
+ "application/json", "multipart/form-data"
+ };
+ final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ if(progressListener != null) {
+ apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
+ return originalResponse.newBuilder()
+ .body(new ProgressResponseBody(originalResponse.body(), progressListener))
+ .build();
+ }
+ });
+ }
+
+ String[] localVarAuthNames = new String[] { };
+ return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private com.squareup.okhttp.Call getV5EventsValidateBeforeCall(String accessToken, Integer page, Integer perPage, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+
+
+ com.squareup.okhttp.Call call = getV5EventsCall(accessToken, page, perPage, progressListener, progressRequestListener);
+ return call;
+
+ }
+
+ /**
+ * 获取站内所有公开动态
+ * 获取站内所有公开动态
+ * @param accessToken 用户授权码 (optional)
+ * @param page 当前的页码 (optional, default to 1)
+ * @param perPage 每页的数量,最大为 100 (optional, default to 20)
+ * @return List<Event>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public List getV5Events(String accessToken, Integer page, Integer perPage) throws ApiException {
+ ApiResponse> resp = getV5EventsWithHttpInfo(accessToken, page, perPage);
+ return resp.getData();
+ }
+
+ /**
+ * 获取站内所有公开动态
+ * 获取站内所有公开动态
+ * @param accessToken 用户授权码 (optional)
+ * @param page 当前的页码 (optional, default to 1)
+ * @param perPage 每页的数量,最大为 100 (optional, default to 20)
+ * @return ApiResponse<List<Event>>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse> getV5EventsWithHttpInfo(String accessToken, Integer page, Integer perPage) throws ApiException {
+ com.squareup.okhttp.Call call = getV5EventsValidateBeforeCall(accessToken, page, perPage, null, null);
+ Type localVarReturnType = new TypeToken>(){}.getType();
+ return apiClient.execute(call, localVarReturnType);
+ }
+
+ /**
+ * 获取站内所有公开动态 (asynchronously)
+ * 获取站内所有公开动态
+ * @param accessToken 用户授权码 (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 com.squareup.okhttp.Call getV5EventsAsync(String accessToken, 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);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = getV5EventsValidateBeforeCall(accessToken, page, perPage, progressListener, progressRequestListener);
+ Type localVarReturnType = new TypeToken>(){}.getType();
+ apiClient.executeAsync(call, localVarReturnType, callback);
+ return call;
+ }
+ /**
+ * Build call for getV5NetworksOwnerRepoEvents
+ * @param owner 仓库所属空间地址(企业、组织或个人的地址path) (required)
+ * @param repo 仓库路径(path) (required)
+ * @param accessToken 用户授权码 (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 com.squareup.okhttp.Call getV5NetworksOwnerRepoEventsCall(String owner, String repo, String accessToken, Integer page, Integer perPage, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath = "/v5/networks/{owner}/{repo}/events"
+ .replaceAll("\\{" + "owner" + "\\}", apiClient.escapeString(owner.toString()))
+ .replaceAll("\\{" + "repo" + "\\}", apiClient.escapeString(repo.toString()));
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ if (accessToken != null)
+ localVarQueryParams.addAll(apiClient.parameterToPair("access_token", accessToken));
+ if (page != null)
+ localVarQueryParams.addAll(apiClient.parameterToPair("page", page));
+ if (perPage != null)
+ localVarQueryParams.addAll(apiClient.parameterToPair("per_page", perPage));
+
+ Map