From 1fba5bdce4f9922766d98cc51577529c5f5b353c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=82=85=E4=B8=9C=E6=B5=B7?= <296322762@qq.com> Date: Mon, 19 Feb 2024 15:18:48 +0800 Subject: [PATCH] Add push & presence & reaction api --- .../java/com/easemob/im/api/PresenceApi.java | 945 ++++++++++ src/main/java/com/easemob/im/api/PushApi.java | 1586 +++++++++++++++++ .../java/com/easemob/im/api/ReactionApi.java | 710 ++++++++ .../model/EMCreateOfflinePushTemplate.java | 270 +++ .../EMCreateOfflinePushTemplateResult.java | 210 +++ .../EMDeleteOfflinePushTemplateResult.java | 210 +++ .../im/api/model/EMDeleteReactionResult.java | 208 +++ .../EMGetGroupOnlineMemberCountResult.java | 205 +++ .../EMGetMultipleUsersPresenceStatus.java | 219 +++ ...etMultipleUsersPresenceStatusResource.java | 296 +++ ...MGetMultipleUsersPresenceStatusResult.java | 230 +++ .../im/api/model/EMGetOfflinePushResult.java | 210 +++ .../model/EMGetOfflinePushTemplateResult.java | 210 +++ .../api/model/EMGetPushBindingInfoResult.java | 230 +++ .../EMGetPushPreferredLanguageResult.java | 210 +++ .../api/model/EMGetReactionDetailResult.java | 241 +++ .../api/model/EMGetReactionListResource.java | 261 +++ .../im/api/model/EMGetReactionResult.java | 261 +++ .../EMGetUserSubscriptionListResource.java | 258 +++ .../EMGetUserSubscriptionListResult.java | 210 +++ .../api/model/EMOfflinePushNewResource.java | 268 +++ .../model/EMOfflinePushTemplateResource.java | 327 ++++ .../api/model/EMPushBindingInfoResource.java | 270 +++ .../EMPushPreferredLanguageResource.java | 208 +++ .../im/api/model/EMReactionResource.java | 368 ++++ .../EMReceiverConfigurationTemplateName.java | 208 +++ ...iverConfigurationTemplateNameResource.java | 208 +++ ...ceiverConfigurationTemplateNameResult.java | 210 +++ .../im/api/model/EMSetOfflinePushNew.java | 268 +++ .../api/model/EMSetOfflinePushNewResult.java | 210 +++ .../im/api/model/EMSetOfflinePushOld.java | 326 ++++ .../im/api/model/EMSetPushBindingInfo.java | 270 +++ .../api/model/EMSetPushBindingInfoResult.java | 230 +++ .../api/model/EMSetPushPreferredLanguage.java | 208 +++ .../EMSetPushPreferredLanguageResult.java | 210 +++ .../easemob/im/api/model/EMSetReaction.java | 239 +++ .../im/api/model/EMSetReactionResult.java | 208 +++ .../im/api/model/EMSetUserPresenceStatus.java | 208 +++ .../model/EMSetUserPresenceStatusResult.java | 208 +++ ...MSubscribeMultipleUsersPresenceStatus.java | 219 +++ ...beMultipleUsersPresenceStatusResource.java | 324 ++++ ...ribeMultipleUsersPresenceStatusResult.java | 230 +++ ...ribeMultipleUsersPresenceStatusResult.java | 208 +++ .../api/model/EMUserSubscriptionResource.java | 239 +++ .../com/easemob/im/api/MessageApiTest.java | 6 - .../com/easemob/im/api/PresenceApiTest.java | 206 +++ .../java/com/easemob/im/api/PushApiTest.java | 456 +++++ .../com/easemob/im/api/ReactionApiTest.java | 294 +++ 48 files changed, 14008 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/easemob/im/api/PresenceApi.java create mode 100644 src/main/java/com/easemob/im/api/PushApi.java create mode 100644 src/main/java/com/easemob/im/api/ReactionApi.java create mode 100644 src/main/java/com/easemob/im/api/model/EMCreateOfflinePushTemplate.java create mode 100644 src/main/java/com/easemob/im/api/model/EMCreateOfflinePushTemplateResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMDeleteOfflinePushTemplateResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMDeleteReactionResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetGroupOnlineMemberCountResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetMultipleUsersPresenceStatus.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetMultipleUsersPresenceStatusResource.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetMultipleUsersPresenceStatusResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetOfflinePushResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetOfflinePushTemplateResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetPushBindingInfoResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetPushPreferredLanguageResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetReactionDetailResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetReactionListResource.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetReactionResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetUserSubscriptionListResource.java create mode 100644 src/main/java/com/easemob/im/api/model/EMGetUserSubscriptionListResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMOfflinePushNewResource.java create mode 100644 src/main/java/com/easemob/im/api/model/EMOfflinePushTemplateResource.java create mode 100644 src/main/java/com/easemob/im/api/model/EMPushBindingInfoResource.java create mode 100644 src/main/java/com/easemob/im/api/model/EMPushPreferredLanguageResource.java create mode 100644 src/main/java/com/easemob/im/api/model/EMReactionResource.java create mode 100644 src/main/java/com/easemob/im/api/model/EMReceiverConfigurationTemplateName.java create mode 100644 src/main/java/com/easemob/im/api/model/EMReceiverConfigurationTemplateNameResource.java create mode 100644 src/main/java/com/easemob/im/api/model/EMReceiverConfigurationTemplateNameResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSetOfflinePushNew.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSetOfflinePushNewResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSetOfflinePushOld.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSetPushBindingInfo.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSetPushBindingInfoResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSetPushPreferredLanguage.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSetPushPreferredLanguageResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSetReaction.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSetReactionResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSetUserPresenceStatus.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSetUserPresenceStatusResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSubscribeMultipleUsersPresenceStatus.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSubscribeMultipleUsersPresenceStatusResource.java create mode 100644 src/main/java/com/easemob/im/api/model/EMSubscribeMultipleUsersPresenceStatusResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMUnsubscribeMultipleUsersPresenceStatusResult.java create mode 100644 src/main/java/com/easemob/im/api/model/EMUserSubscriptionResource.java create mode 100644 src/test/java/com/easemob/im/api/PresenceApiTest.java create mode 100644 src/test/java/com/easemob/im/api/PushApiTest.java create mode 100644 src/test/java/com/easemob/im/api/ReactionApiTest.java diff --git a/src/main/java/com/easemob/im/api/PresenceApi.java b/src/main/java/com/easemob/im/api/PresenceApi.java new file mode 100644 index 000000000..e7b8df2aa --- /dev/null +++ b/src/main/java/com/easemob/im/api/PresenceApi.java @@ -0,0 +1,945 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api; + +import com.easemob.im.ApiCallback; +import com.easemob.im.ApiClient; +import com.easemob.im.ApiException; +import com.easemob.im.ApiResponse; +import com.easemob.im.Configuration; +import com.easemob.im.Pair; +import com.easemob.im.ProgressRequestBody; +import com.easemob.im.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.easemob.im.api.model.EMGetGroupOnlineMemberCountResult; +import com.easemob.im.api.model.EMGetMultipleUsersPresenceStatus; +import com.easemob.im.api.model.EMGetMultipleUsersPresenceStatusResult; +import com.easemob.im.api.model.EMGetUserSubscriptionListResult; +import com.easemob.im.api.model.EMSetUserPresenceStatus; +import com.easemob.im.api.model.EMSetUserPresenceStatusResult; +import com.easemob.im.api.model.EMSubscribeMultipleUsersPresenceStatus; +import com.easemob.im.api.model.EMSubscribeMultipleUsersPresenceStatusResult; +import com.easemob.im.api.model.EMUnsubscribeMultipleUsersPresenceStatusResult; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PresenceApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PresenceApi() { + this(Configuration.getDefaultApiClient()); + } + + public PresenceApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getGroupOnlineMemberCount + * @param groupId 群组 ID (required) + * @param queryType 查询类型,查询群组的在线成员数量,传 1 即可 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getGroupOnlineMemberCountCall(String groupId, Integer queryType, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/presence/online/{group_id}/type/{query_type}" + .replace("{" + "group_id" + "}", localVarApiClient.escapeString(groupId.toString())) + .replace("{" + "query_type" + "}", localVarApiClient.escapeString(queryType.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGroupOnlineMemberCountValidateBeforeCall(String groupId, Integer queryType, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'groupId' is set + if (groupId == null) { + throw new ApiException("Missing the required parameter 'groupId' when calling getGroupOnlineMemberCount(Async)"); + } + + // verify the required parameter 'queryType' is set + if (queryType == null) { + throw new ApiException("Missing the required parameter 'queryType' when calling getGroupOnlineMemberCount(Async)"); + } + + return getGroupOnlineMemberCountCall(groupId, queryType, _callback); + + } + + /** + * 查询单个群组的在线成员数量 + * 你可以查询单个群组的在线成员数量。如需使用该 API,需要联系环信商务开通。这里的在线状态指用户的 app 与服务器成功建立连接,不包括用户的自定义在线状态,如忙碌、马上回来等。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%9F%A5%E8%AF%A2%E5%8D%95%E4%B8%AA%E7%BE%A4%E7%BB%84%E7%9A%84%E5%9C%A8%E7%BA%BF%E6%88%90%E5%91%98%E6%95%B0%E9%87%8F + * @param groupId 群组 ID (required) + * @param queryType 查询类型,查询群组的在线成员数量,传 1 即可 (required) + * @return EMGetGroupOnlineMemberCountResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMGetGroupOnlineMemberCountResult getGroupOnlineMemberCount(String groupId, Integer queryType) throws ApiException { + ApiResponse localVarResp = getGroupOnlineMemberCountWithHttpInfo(groupId, queryType); + return localVarResp.getData(); + } + + /** + * 查询单个群组的在线成员数量 + * 你可以查询单个群组的在线成员数量。如需使用该 API,需要联系环信商务开通。这里的在线状态指用户的 app 与服务器成功建立连接,不包括用户的自定义在线状态,如忙碌、马上回来等。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%9F%A5%E8%AF%A2%E5%8D%95%E4%B8%AA%E7%BE%A4%E7%BB%84%E7%9A%84%E5%9C%A8%E7%BA%BF%E6%88%90%E5%91%98%E6%95%B0%E9%87%8F + * @param groupId 群组 ID (required) + * @param queryType 查询类型,查询群组的在线成员数量,传 1 即可 (required) + * @return ApiResponse<EMGetGroupOnlineMemberCountResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse getGroupOnlineMemberCountWithHttpInfo(String groupId, Integer queryType) throws ApiException { + okhttp3.Call localVarCall = getGroupOnlineMemberCountValidateBeforeCall(groupId, queryType, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 查询单个群组的在线成员数量 (asynchronously) + * 你可以查询单个群组的在线成员数量。如需使用该 API,需要联系环信商务开通。这里的在线状态指用户的 app 与服务器成功建立连接,不包括用户的自定义在线状态,如忙碌、马上回来等。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%9F%A5%E8%AF%A2%E5%8D%95%E4%B8%AA%E7%BE%A4%E7%BB%84%E7%9A%84%E5%9C%A8%E7%BA%BF%E6%88%90%E5%91%98%E6%95%B0%E9%87%8F + * @param groupId 群组 ID (required) + * @param queryType 查询类型,查询群组的在线成员数量,传 1 即可 (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getGroupOnlineMemberCountAsync(String groupId, Integer queryType, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGroupOnlineMemberCountValidateBeforeCall(groupId, queryType, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getMultipleUserPresenceStatus + * @param username (required) + * @param emGetMultipleUsersPresenceStatus (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getMultipleUserPresenceStatusCall(String username, EMGetMultipleUsersPresenceStatus emGetMultipleUsersPresenceStatus, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = emGetMultipleUsersPresenceStatus; + + // create path and map variables + String localVarPath = "/users/{username}/presence" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getMultipleUserPresenceStatusValidateBeforeCall(String username, EMGetMultipleUsersPresenceStatus emGetMultipleUsersPresenceStatus, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getMultipleUserPresenceStatus(Async)"); + } + + return getMultipleUserPresenceStatusCall(username, emGetMultipleUsersPresenceStatus, _callback); + + } + + /** + * 批量获取在线状态信息 + * 你一次可获取多个用户的在线状态信息。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%89%B9%E9%87%8F%E8%8E%B7%E5%8F%96%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81%E4%BF%A1%E6%81%AF + * @param username (required) + * @param emGetMultipleUsersPresenceStatus (optional) + * @return EMGetMultipleUsersPresenceStatusResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMGetMultipleUsersPresenceStatusResult getMultipleUserPresenceStatus(String username, EMGetMultipleUsersPresenceStatus emGetMultipleUsersPresenceStatus) throws ApiException { + ApiResponse localVarResp = getMultipleUserPresenceStatusWithHttpInfo(username, emGetMultipleUsersPresenceStatus); + return localVarResp.getData(); + } + + /** + * 批量获取在线状态信息 + * 你一次可获取多个用户的在线状态信息。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%89%B9%E9%87%8F%E8%8E%B7%E5%8F%96%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81%E4%BF%A1%E6%81%AF + * @param username (required) + * @param emGetMultipleUsersPresenceStatus (optional) + * @return ApiResponse<EMGetMultipleUsersPresenceStatusResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse getMultipleUserPresenceStatusWithHttpInfo(String username, EMGetMultipleUsersPresenceStatus emGetMultipleUsersPresenceStatus) throws ApiException { + okhttp3.Call localVarCall = getMultipleUserPresenceStatusValidateBeforeCall(username, emGetMultipleUsersPresenceStatus, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 批量获取在线状态信息 (asynchronously) + * 你一次可获取多个用户的在线状态信息。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%89%B9%E9%87%8F%E8%8E%B7%E5%8F%96%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81%E4%BF%A1%E6%81%AF + * @param username (required) + * @param emGetMultipleUsersPresenceStatus (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getMultipleUserPresenceStatusAsync(String username, EMGetMultipleUsersPresenceStatus emGetMultipleUsersPresenceStatus, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getMultipleUserPresenceStatusValidateBeforeCall(username, emGetMultipleUsersPresenceStatus, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getUserSubscriptionList + * @param username (required) + * @param pageNum 要查询的页码。该参数的值须大于等于 1。若不传,默认值为 1 (optional) + * @param pageSize 每页显示的订阅用户数量。取值范围为 [1,500],若不传默认值为 1 (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getUserSubscriptionListCall(String username, Integer pageNum, Integer pageSize, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/users/{username}/presence/sublist" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pageNum != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pageNum", pageNum)); + } + + if (pageSize != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pageSize", pageSize)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserSubscriptionListValidateBeforeCall(String username, Integer pageNum, Integer pageSize, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getUserSubscriptionList(Async)"); + } + + return getUserSubscriptionListCall(username, pageNum, pageSize, _callback); + + } + + /** + * 查询订阅列表 + * 查询当前用户已订阅在线状态的用户列表。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E9%98%85%E5%88%97%E8%A1%A8 + * @param username (required) + * @param pageNum 要查询的页码。该参数的值须大于等于 1。若不传,默认值为 1 (optional) + * @param pageSize 每页显示的订阅用户数量。取值范围为 [1,500],若不传默认值为 1 (optional) + * @return EMGetUserSubscriptionListResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMGetUserSubscriptionListResult getUserSubscriptionList(String username, Integer pageNum, Integer pageSize) throws ApiException { + ApiResponse localVarResp = getUserSubscriptionListWithHttpInfo(username, pageNum, pageSize); + return localVarResp.getData(); + } + + /** + * 查询订阅列表 + * 查询当前用户已订阅在线状态的用户列表。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E9%98%85%E5%88%97%E8%A1%A8 + * @param username (required) + * @param pageNum 要查询的页码。该参数的值须大于等于 1。若不传,默认值为 1 (optional) + * @param pageSize 每页显示的订阅用户数量。取值范围为 [1,500],若不传默认值为 1 (optional) + * @return ApiResponse<EMGetUserSubscriptionListResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse getUserSubscriptionListWithHttpInfo(String username, Integer pageNum, Integer pageSize) throws ApiException { + okhttp3.Call localVarCall = getUserSubscriptionListValidateBeforeCall(username, pageNum, pageSize, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 查询订阅列表 (asynchronously) + * 查询当前用户已订阅在线状态的用户列表。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E9%98%85%E5%88%97%E8%A1%A8 + * @param username (required) + * @param pageNum 要查询的页码。该参数的值须大于等于 1。若不传,默认值为 1 (optional) + * @param pageSize 每页显示的订阅用户数量。取值范围为 [1,500],若不传默认值为 1 (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getUserSubscriptionListAsync(String username, Integer pageNum, Integer pageSize, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserSubscriptionListValidateBeforeCall(username, pageNum, pageSize, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for setUserPresenceStatus + * @param username (required) + * @param resource 要设置用户在哪个设备的在线状态信息,即传入服务器分配给每个设备资源的唯一标识符,格式为 {device type}_{resource ID},其中设备类型 device type 可以是 android、ios 或 web,资源 ID resource ID 由 SDK 分配。例如,android_123423453246 (required) + * @param status 用户的在线状态: - 0:离线; - 1:在线; - 其它数字字符串:自定义在线状态 (required) + * @param emSetUserPresenceStatus (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call setUserPresenceStatusCall(String username, String resource, String status, EMSetUserPresenceStatus emSetUserPresenceStatus, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = emSetUserPresenceStatus; + + // create path and map variables + String localVarPath = "/users/{username}/presence/{resource}/{status}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())) + .replace("{" + "resource" + "}", localVarApiClient.escapeString(resource.toString())) + .replace("{" + "status" + "}", localVarApiClient.escapeString(status.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call setUserPresenceStatusValidateBeforeCall(String username, String resource, String status, EMSetUserPresenceStatus emSetUserPresenceStatus, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling setUserPresenceStatus(Async)"); + } + + // verify the required parameter 'resource' is set + if (resource == null) { + throw new ApiException("Missing the required parameter 'resource' when calling setUserPresenceStatus(Async)"); + } + + // verify the required parameter 'status' is set + if (status == null) { + throw new ApiException("Missing the required parameter 'status' when calling setUserPresenceStatus(Async)"); + } + + return setUserPresenceStatusCall(username, resource, status, emSetUserPresenceStatus, _callback); + + } + + /** + * 设置用户在线状态信息 + * 可以设置用户在指定设备的在线状态信息。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E8%AE%BE%E7%BD%AE%E7%94%A8%E6%88%B7%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81%E4%BF%A1%E6%81%AF + * @param username (required) + * @param resource 要设置用户在哪个设备的在线状态信息,即传入服务器分配给每个设备资源的唯一标识符,格式为 {device type}_{resource ID},其中设备类型 device type 可以是 android、ios 或 web,资源 ID resource ID 由 SDK 分配。例如,android_123423453246 (required) + * @param status 用户的在线状态: - 0:离线; - 1:在线; - 其它数字字符串:自定义在线状态 (required) + * @param emSetUserPresenceStatus (optional) + * @return EMSetUserPresenceStatusResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMSetUserPresenceStatusResult setUserPresenceStatus(String username, String resource, String status, EMSetUserPresenceStatus emSetUserPresenceStatus) throws ApiException { + ApiResponse localVarResp = setUserPresenceStatusWithHttpInfo(username, resource, status, emSetUserPresenceStatus); + return localVarResp.getData(); + } + + /** + * 设置用户在线状态信息 + * 可以设置用户在指定设备的在线状态信息。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E8%AE%BE%E7%BD%AE%E7%94%A8%E6%88%B7%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81%E4%BF%A1%E6%81%AF + * @param username (required) + * @param resource 要设置用户在哪个设备的在线状态信息,即传入服务器分配给每个设备资源的唯一标识符,格式为 {device type}_{resource ID},其中设备类型 device type 可以是 android、ios 或 web,资源 ID resource ID 由 SDK 分配。例如,android_123423453246 (required) + * @param status 用户的在线状态: - 0:离线; - 1:在线; - 其它数字字符串:自定义在线状态 (required) + * @param emSetUserPresenceStatus (optional) + * @return ApiResponse<EMSetUserPresenceStatusResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse setUserPresenceStatusWithHttpInfo(String username, String resource, String status, EMSetUserPresenceStatus emSetUserPresenceStatus) throws ApiException { + okhttp3.Call localVarCall = setUserPresenceStatusValidateBeforeCall(username, resource, status, emSetUserPresenceStatus, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 设置用户在线状态信息 (asynchronously) + * 可以设置用户在指定设备的在线状态信息。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E8%AE%BE%E7%BD%AE%E7%94%A8%E6%88%B7%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81%E4%BF%A1%E6%81%AF + * @param username (required) + * @param resource 要设置用户在哪个设备的在线状态信息,即传入服务器分配给每个设备资源的唯一标识符,格式为 {device type}_{resource ID},其中设备类型 device type 可以是 android、ios 或 web,资源 ID resource ID 由 SDK 分配。例如,android_123423453246 (required) + * @param status 用户的在线状态: - 0:离线; - 1:在线; - 其它数字字符串:自定义在线状态 (required) + * @param emSetUserPresenceStatus (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call setUserPresenceStatusAsync(String username, String resource, String status, EMSetUserPresenceStatus emSetUserPresenceStatus, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = setUserPresenceStatusValidateBeforeCall(username, resource, status, emSetUserPresenceStatus, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for subscribeMultipleUsersPresenceStatus + * @param username (required) + * @param expiry 订阅时长,单位为秒,最大值为 2,592,000,即 30 天 (required) + * @param emSubscribeMultipleUsersPresenceStatus (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call subscribeMultipleUsersPresenceStatusCall(String username, String expiry, EMSubscribeMultipleUsersPresenceStatus emSubscribeMultipleUsersPresenceStatus, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = emSubscribeMultipleUsersPresenceStatus; + + // create path and map variables + String localVarPath = "/users/{username}/presence/{expiry}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())) + .replace("{" + "expiry" + "}", localVarApiClient.escapeString(expiry.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call subscribeMultipleUsersPresenceStatusValidateBeforeCall(String username, String expiry, EMSubscribeMultipleUsersPresenceStatus emSubscribeMultipleUsersPresenceStatus, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling subscribeMultipleUsersPresenceStatus(Async)"); + } + + // verify the required parameter 'expiry' is set + if (expiry == null) { + throw new ApiException("Missing the required parameter 'expiry' when calling subscribeMultipleUsersPresenceStatus(Async)"); + } + + return subscribeMultipleUsersPresenceStatusCall(username, expiry, emSubscribeMultipleUsersPresenceStatus, _callback); + + } + + /** + * 批量订阅在线状态 + * 一次可订阅多个用户的在线状态。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%89%B9%E9%87%8F%E8%AE%A2%E9%98%85%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81 + * @param username (required) + * @param expiry 订阅时长,单位为秒,最大值为 2,592,000,即 30 天 (required) + * @param emSubscribeMultipleUsersPresenceStatus (optional) + * @return EMSubscribeMultipleUsersPresenceStatusResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMSubscribeMultipleUsersPresenceStatusResult subscribeMultipleUsersPresenceStatus(String username, String expiry, EMSubscribeMultipleUsersPresenceStatus emSubscribeMultipleUsersPresenceStatus) throws ApiException { + ApiResponse localVarResp = subscribeMultipleUsersPresenceStatusWithHttpInfo(username, expiry, emSubscribeMultipleUsersPresenceStatus); + return localVarResp.getData(); + } + + /** + * 批量订阅在线状态 + * 一次可订阅多个用户的在线状态。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%89%B9%E9%87%8F%E8%AE%A2%E9%98%85%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81 + * @param username (required) + * @param expiry 订阅时长,单位为秒,最大值为 2,592,000,即 30 天 (required) + * @param emSubscribeMultipleUsersPresenceStatus (optional) + * @return ApiResponse<EMSubscribeMultipleUsersPresenceStatusResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse subscribeMultipleUsersPresenceStatusWithHttpInfo(String username, String expiry, EMSubscribeMultipleUsersPresenceStatus emSubscribeMultipleUsersPresenceStatus) throws ApiException { + okhttp3.Call localVarCall = subscribeMultipleUsersPresenceStatusValidateBeforeCall(username, expiry, emSubscribeMultipleUsersPresenceStatus, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 批量订阅在线状态 (asynchronously) + * 一次可订阅多个用户的在线状态。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%89%B9%E9%87%8F%E8%AE%A2%E9%98%85%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81 + * @param username (required) + * @param expiry 订阅时长,单位为秒,最大值为 2,592,000,即 30 天 (required) + * @param emSubscribeMultipleUsersPresenceStatus (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call subscribeMultipleUsersPresenceStatusAsync(String username, String expiry, EMSubscribeMultipleUsersPresenceStatus emSubscribeMultipleUsersPresenceStatus, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = subscribeMultipleUsersPresenceStatusValidateBeforeCall(username, expiry, emSubscribeMultipleUsersPresenceStatus, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for unsubscribeMultipleUsersPresenceStatus + * @param username (required) + * @param requestBody (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call unsubscribeMultipleUsersPresenceStatusCall(String username, List requestBody, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/users/{username}/presence" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call unsubscribeMultipleUsersPresenceStatusValidateBeforeCall(String username, List requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling unsubscribeMultipleUsersPresenceStatus(Async)"); + } + + return unsubscribeMultipleUsersPresenceStatusCall(username, requestBody, _callback); + + } + + /** + * 取消订阅多个用户的在线状态 + * 取消订阅多个用户的在线状态。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E5%8F%96%E6%B6%88%E8%AE%A2%E9%98%85%E5%A4%9A%E4%B8%AA%E7%94%A8%E6%88%B7%E7%9A%84%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81 + * @param username (required) + * @param requestBody (optional) + * @return EMUnsubscribeMultipleUsersPresenceStatusResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMUnsubscribeMultipleUsersPresenceStatusResult unsubscribeMultipleUsersPresenceStatus(String username, List requestBody) throws ApiException { + ApiResponse localVarResp = unsubscribeMultipleUsersPresenceStatusWithHttpInfo(username, requestBody); + return localVarResp.getData(); + } + + /** + * 取消订阅多个用户的在线状态 + * 取消订阅多个用户的在线状态。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E5%8F%96%E6%B6%88%E8%AE%A2%E9%98%85%E5%A4%9A%E4%B8%AA%E7%94%A8%E6%88%B7%E7%9A%84%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81 + * @param username (required) + * @param requestBody (optional) + * @return ApiResponse<EMUnsubscribeMultipleUsersPresenceStatusResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse unsubscribeMultipleUsersPresenceStatusWithHttpInfo(String username, List requestBody) throws ApiException { + okhttp3.Call localVarCall = unsubscribeMultipleUsersPresenceStatusValidateBeforeCall(username, requestBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 取消订阅多个用户的在线状态 (asynchronously) + * 取消订阅多个用户的在线状态。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E5%8F%96%E6%B6%88%E8%AE%A2%E9%98%85%E5%A4%9A%E4%B8%AA%E7%94%A8%E6%88%B7%E7%9A%84%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81 + * @param username (required) + * @param requestBody (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call unsubscribeMultipleUsersPresenceStatusAsync(String username, List requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = unsubscribeMultipleUsersPresenceStatusValidateBeforeCall(username, requestBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/easemob/im/api/PushApi.java b/src/main/java/com/easemob/im/api/PushApi.java new file mode 100644 index 000000000..e51fe4353 --- /dev/null +++ b/src/main/java/com/easemob/im/api/PushApi.java @@ -0,0 +1,1586 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api; + +import com.easemob.im.ApiCallback; +import com.easemob.im.ApiClient; +import com.easemob.im.ApiException; +import com.easemob.im.ApiResponse; +import com.easemob.im.Configuration; +import com.easemob.im.Pair; +import com.easemob.im.ProgressRequestBody; +import com.easemob.im.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.easemob.im.api.model.EMCreateOfflinePushTemplate; +import com.easemob.im.api.model.EMCreateOfflinePushTemplateResult; +import com.easemob.im.api.model.EMDeleteOfflinePushTemplateResult; +import com.easemob.im.api.model.EMGetOfflinePushResult; +import com.easemob.im.api.model.EMGetOfflinePushTemplateResult; +import com.easemob.im.api.model.EMGetPushBindingInfoResult; +import com.easemob.im.api.model.EMGetPushPreferredLanguageResult; +import com.easemob.im.api.model.EMReceiverConfigurationTemplateName; +import com.easemob.im.api.model.EMReceiverConfigurationTemplateNameResult; +import com.easemob.im.api.model.EMSetOfflinePushNew; +import com.easemob.im.api.model.EMSetOfflinePushNewResult; +import com.easemob.im.api.model.EMSetOfflinePushOld; +import com.easemob.im.api.model.EMSetPushBindingInfo; +import com.easemob.im.api.model.EMSetPushBindingInfoResult; +import com.easemob.im.api.model.EMSetPushPreferredLanguage; +import com.easemob.im.api.model.EMSetPushPreferredLanguageResult; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PushApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PushApi() { + this(Configuration.getDefaultApiClient()); + } + + public PushApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createOfflinePushTemplate + * @param emCreateOfflinePushTemplate (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call createOfflinePushTemplateCall(EMCreateOfflinePushTemplate emCreateOfflinePushTemplate, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = emCreateOfflinePushTemplate; + + // create path and map variables + String localVarPath = "/notification/template"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createOfflinePushTemplateValidateBeforeCall(EMCreateOfflinePushTemplate emCreateOfflinePushTemplate, final ApiCallback _callback) throws ApiException { + return createOfflinePushTemplateCall(emCreateOfflinePushTemplate, _callback); + + } + + /** + * 创建离线推送模板 + * 创建离线推送消息模板,包括默认模板 default 和自定模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E5%88%9B%E5%BB%BA%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%A8%A1%E6%9D%BF + * @param emCreateOfflinePushTemplate (optional) + * @return EMCreateOfflinePushTemplateResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMCreateOfflinePushTemplateResult createOfflinePushTemplate(EMCreateOfflinePushTemplate emCreateOfflinePushTemplate) throws ApiException { + ApiResponse localVarResp = createOfflinePushTemplateWithHttpInfo(emCreateOfflinePushTemplate); + return localVarResp.getData(); + } + + /** + * 创建离线推送模板 + * 创建离线推送消息模板,包括默认模板 default 和自定模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E5%88%9B%E5%BB%BA%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%A8%A1%E6%9D%BF + * @param emCreateOfflinePushTemplate (optional) + * @return ApiResponse<EMCreateOfflinePushTemplateResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse createOfflinePushTemplateWithHttpInfo(EMCreateOfflinePushTemplate emCreateOfflinePushTemplate) throws ApiException { + okhttp3.Call localVarCall = createOfflinePushTemplateValidateBeforeCall(emCreateOfflinePushTemplate, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 创建离线推送模板 (asynchronously) + * 创建离线推送消息模板,包括默认模板 default 和自定模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E5%88%9B%E5%BB%BA%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%A8%A1%E6%9D%BF + * @param emCreateOfflinePushTemplate (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call createOfflinePushTemplateAsync(EMCreateOfflinePushTemplate emCreateOfflinePushTemplate, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createOfflinePushTemplateValidateBeforeCall(emCreateOfflinePushTemplate, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteOfflinePushTemplate + * @param name 要查询的推送模板的名称 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call deleteOfflinePushTemplateCall(String name, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/notification/template/{name}" + .replace("{" + "name" + "}", localVarApiClient.escapeString(name.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteOfflinePushTemplateValidateBeforeCall(String name, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling deleteOfflinePushTemplate(Async)"); + } + + return deleteOfflinePushTemplateCall(name, _callback); + + } + + /** + * 删除离线推送模板 + * 删除离线消息推送模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E5%88%A0%E9%99%A4%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%A8%A1%E6%9D%BF + * @param name 要查询的推送模板的名称 (required) + * @return EMDeleteOfflinePushTemplateResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMDeleteOfflinePushTemplateResult deleteOfflinePushTemplate(String name) throws ApiException { + ApiResponse localVarResp = deleteOfflinePushTemplateWithHttpInfo(name); + return localVarResp.getData(); + } + + /** + * 删除离线推送模板 + * 删除离线消息推送模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E5%88%A0%E9%99%A4%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%A8%A1%E6%9D%BF + * @param name 要查询的推送模板的名称 (required) + * @return ApiResponse<EMDeleteOfflinePushTemplateResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse deleteOfflinePushTemplateWithHttpInfo(String name) throws ApiException { + okhttp3.Call localVarCall = deleteOfflinePushTemplateValidateBeforeCall(name, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 删除离线推送模板 (asynchronously) + * 删除离线消息推送模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E5%88%A0%E9%99%A4%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%A8%A1%E6%9D%BF + * @param name 要查询的推送模板的名称 (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call deleteOfflinePushTemplateAsync(String name, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteOfflinePushTemplateValidateBeforeCall(name, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOfflinePush + * @param username (required) + * @param chattype 对象类型,即会话类型: - user:用户,表示单聊; - chatgroup:群组,表示群聊 (required) + * @param key 对象名称: - 单聊时为对端用户的用户 ID; - 群聊时为群组 ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getOfflinePushCall(String username, String chattype, String key, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/users/{username}/notification/{chattype}/{key}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())) + .replace("{" + "chattype" + "}", localVarApiClient.escapeString(chattype.toString())) + .replace("{" + "key" + "}", localVarApiClient.escapeString(key.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOfflinePushValidateBeforeCall(String username, String chattype, String key, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getOfflinePush(Async)"); + } + + // verify the required parameter 'chattype' is set + if (chattype == null) { + throw new ApiException("Missing the required parameter 'chattype' when calling getOfflinePush(Async)"); + } + + // verify the required parameter 'key' is set + if (key == null) { + throw new ApiException("Missing the required parameter 'key' when calling getOfflinePush(Async)"); + } + + return getOfflinePushCall(username, chattype, key, _callback); + + } + + /** + * 查询离线推送设置 + * 查询指定单聊、指定群聊或全局的离线推送设置。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%9F%A5%E8%AF%A2%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E8%AE%BE%E7%BD%AE + * @param username (required) + * @param chattype 对象类型,即会话类型: - user:用户,表示单聊; - chatgroup:群组,表示群聊 (required) + * @param key 对象名称: - 单聊时为对端用户的用户 ID; - 群聊时为群组 ID (required) + * @return EMGetOfflinePushResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMGetOfflinePushResult getOfflinePush(String username, String chattype, String key) throws ApiException { + ApiResponse localVarResp = getOfflinePushWithHttpInfo(username, chattype, key); + return localVarResp.getData(); + } + + /** + * 查询离线推送设置 + * 查询指定单聊、指定群聊或全局的离线推送设置。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%9F%A5%E8%AF%A2%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E8%AE%BE%E7%BD%AE + * @param username (required) + * @param chattype 对象类型,即会话类型: - user:用户,表示单聊; - chatgroup:群组,表示群聊 (required) + * @param key 对象名称: - 单聊时为对端用户的用户 ID; - 群聊时为群组 ID (required) + * @return ApiResponse<EMGetOfflinePushResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse getOfflinePushWithHttpInfo(String username, String chattype, String key) throws ApiException { + okhttp3.Call localVarCall = getOfflinePushValidateBeforeCall(username, chattype, key, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 查询离线推送设置 (asynchronously) + * 查询指定单聊、指定群聊或全局的离线推送设置。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%9F%A5%E8%AF%A2%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E8%AE%BE%E7%BD%AE + * @param username (required) + * @param chattype 对象类型,即会话类型: - user:用户,表示单聊; - chatgroup:群组,表示群聊 (required) + * @param key 对象名称: - 单聊时为对端用户的用户 ID; - 群聊时为群组 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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getOfflinePushAsync(String username, String chattype, String key, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOfflinePushValidateBeforeCall(username, chattype, key, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getOfflinePushTemplate + * @param name 要查询的推送模板的名称 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getOfflinePushTemplateCall(String name, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/notification/template/{name}" + .replace("{" + "name" + "}", localVarApiClient.escapeString(name.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getOfflinePushTemplateValidateBeforeCall(String name, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling getOfflinePushTemplate(Async)"); + } + + return getOfflinePushTemplateCall(name, _callback); + + } + + /** + * 查询离线推送模板 + * 查询离线推送消息使用的模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%9F%A5%E8%AF%A2%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%A8%A1%E6%9D%BF + * @param name 要查询的推送模板的名称 (required) + * @return EMGetOfflinePushTemplateResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMGetOfflinePushTemplateResult getOfflinePushTemplate(String name) throws ApiException { + ApiResponse localVarResp = getOfflinePushTemplateWithHttpInfo(name); + return localVarResp.getData(); + } + + /** + * 查询离线推送模板 + * 查询离线推送消息使用的模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%9F%A5%E8%AF%A2%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%A8%A1%E6%9D%BF + * @param name 要查询的推送模板的名称 (required) + * @return ApiResponse<EMGetOfflinePushTemplateResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse getOfflinePushTemplateWithHttpInfo(String name) throws ApiException { + okhttp3.Call localVarCall = getOfflinePushTemplateValidateBeforeCall(name, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 查询离线推送模板 (asynchronously) + * 查询离线推送消息使用的模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%9F%A5%E8%AF%A2%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%A8%A1%E6%9D%BF + * @param name 要查询的推送模板的名称 (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getOfflinePushTemplateAsync(String name, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getOfflinePushTemplateValidateBeforeCall(name, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPushBindingInfo + * @param username (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getPushBindingInfoCall(String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/users/{username}/push/binding" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPushBindingInfoValidateBeforeCall(String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getPushBindingInfo(Async)"); + } + + return getPushBindingInfoCall(username, _callback); + + } + + /** + * 查询推送绑定信息 + * 查询当前用户的所有设备的推送绑定信息。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%9F%A5%E8%AF%A2%E6%8E%A8%E9%80%81%E7%BB%91%E5%AE%9A%E4%BF%A1%E6%81%AF + * @param username (required) + * @return EMGetPushBindingInfoResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMGetPushBindingInfoResult getPushBindingInfo(String username) throws ApiException { + ApiResponse localVarResp = getPushBindingInfoWithHttpInfo(username); + return localVarResp.getData(); + } + + /** + * 查询推送绑定信息 + * 查询当前用户的所有设备的推送绑定信息。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%9F%A5%E8%AF%A2%E6%8E%A8%E9%80%81%E7%BB%91%E5%AE%9A%E4%BF%A1%E6%81%AF + * @param username (required) + * @return ApiResponse<EMGetPushBindingInfoResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse getPushBindingInfoWithHttpInfo(String username) throws ApiException { + okhttp3.Call localVarCall = getPushBindingInfoValidateBeforeCall(username, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 查询推送绑定信息 (asynchronously) + * 查询当前用户的所有设备的推送绑定信息。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%9F%A5%E8%AF%A2%E6%8E%A8%E9%80%81%E7%BB%91%E5%AE%9A%E4%BF%A1%E6%81%AF + * @param username (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getPushBindingInfoAsync(String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPushBindingInfoValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getPushPreferredLanguage + * @param username (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getPushPreferredLanguageCall(String username, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/users/{username}/notification/language" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPushPreferredLanguageValidateBeforeCall(String username, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getPushPreferredLanguage(Async)"); + } + + return getPushPreferredLanguageCall(username, _callback); + + } + + /** + * 获取推送通知的首选语言 + * 获取推送通知的首选语言。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%8E%B7%E5%8F%96%E6%8E%A8%E9%80%81%E9%80%9A%E7%9F%A5%E7%9A%84%E9%A6%96%E9%80%89%E8%AF%AD%E8%A8%80 + * @param username (required) + * @return EMGetPushPreferredLanguageResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMGetPushPreferredLanguageResult getPushPreferredLanguage(String username) throws ApiException { + ApiResponse localVarResp = getPushPreferredLanguageWithHttpInfo(username); + return localVarResp.getData(); + } + + /** + * 获取推送通知的首选语言 + * 获取推送通知的首选语言。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%8E%B7%E5%8F%96%E6%8E%A8%E9%80%81%E9%80%9A%E7%9F%A5%E7%9A%84%E9%A6%96%E9%80%89%E8%AF%AD%E8%A8%80 + * @param username (required) + * @return ApiResponse<EMGetPushPreferredLanguageResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse getPushPreferredLanguageWithHttpInfo(String username) throws ApiException { + okhttp3.Call localVarCall = getPushPreferredLanguageValidateBeforeCall(username, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 获取推送通知的首选语言 (asynchronously) + * 获取推送通知的首选语言。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%8E%B7%E5%8F%96%E6%8E%A8%E9%80%81%E9%80%9A%E7%9F%A5%E7%9A%84%E9%A6%96%E9%80%89%E8%AF%AD%E8%A8%80 + * @param username (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getPushPreferredLanguageAsync(String username, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPushPreferredLanguageValidateBeforeCall(username, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for receiverConfigurationTemplateName + * @param username (required) + * @param emReceiverConfigurationTemplateName (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call receiverConfigurationTemplateNameCall(String username, EMReceiverConfigurationTemplateName emReceiverConfigurationTemplateName, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = emReceiverConfigurationTemplateName; + + // create path and map variables + String localVarPath = "/users/{username}/notification/template" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call receiverConfigurationTemplateNameValidateBeforeCall(String username, EMReceiverConfigurationTemplateName emReceiverConfigurationTemplateName, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling receiverConfigurationTemplateName(Async)"); + } + + return receiverConfigurationTemplateNameCall(username, emReceiverConfigurationTemplateName, _callback); + + } + + /** + * 接收方配置模板名称 + * 接收方可以调用该 API 设置推送模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%8E%A5%E6%94%B6%E6%96%B9%E9%85%8D%E7%BD%AE%E6%A8%A1%E6%9D%BF%E5%90%8D%E7%A7%B0 + * @param username (required) + * @param emReceiverConfigurationTemplateName (optional) + * @return EMReceiverConfigurationTemplateNameResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMReceiverConfigurationTemplateNameResult receiverConfigurationTemplateName(String username, EMReceiverConfigurationTemplateName emReceiverConfigurationTemplateName) throws ApiException { + ApiResponse localVarResp = receiverConfigurationTemplateNameWithHttpInfo(username, emReceiverConfigurationTemplateName); + return localVarResp.getData(); + } + + /** + * 接收方配置模板名称 + * 接收方可以调用该 API 设置推送模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%8E%A5%E6%94%B6%E6%96%B9%E9%85%8D%E7%BD%AE%E6%A8%A1%E6%9D%BF%E5%90%8D%E7%A7%B0 + * @param username (required) + * @param emReceiverConfigurationTemplateName (optional) + * @return ApiResponse<EMReceiverConfigurationTemplateNameResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse receiverConfigurationTemplateNameWithHttpInfo(String username, EMReceiverConfigurationTemplateName emReceiverConfigurationTemplateName) throws ApiException { + okhttp3.Call localVarCall = receiverConfigurationTemplateNameValidateBeforeCall(username, emReceiverConfigurationTemplateName, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 接收方配置模板名称 (asynchronously) + * 接收方可以调用该 API 设置推送模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%8E%A5%E6%94%B6%E6%96%B9%E9%85%8D%E7%BD%AE%E6%A8%A1%E6%9D%BF%E5%90%8D%E7%A7%B0 + * @param username (required) + * @param emReceiverConfigurationTemplateName (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call receiverConfigurationTemplateNameAsync(String username, EMReceiverConfigurationTemplateName emReceiverConfigurationTemplateName, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = receiverConfigurationTemplateNameValidateBeforeCall(username, emReceiverConfigurationTemplateName, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for setOfflinePushNew + * @param username (required) + * @param chattype 对象类型,即会话类型: - user:用户,表示单聊; - chatgroup:群组,表示群聊 (required) + * @param key 对象名称: - 单聊时为对端用户的用户 ID; - 群聊时为群组 ID (required) + * @param emSetOfflinePushNew (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call setOfflinePushNewCall(String username, String chattype, String key, EMSetOfflinePushNew emSetOfflinePushNew, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = emSetOfflinePushNew; + + // create path and map variables + String localVarPath = "/users/{username}/notification/{chattype}/{key}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())) + .replace("{" + "chattype" + "}", localVarApiClient.escapeString(chattype.toString())) + .replace("{" + "key" + "}", localVarApiClient.escapeString(key.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call setOfflinePushNewValidateBeforeCall(String username, String chattype, String key, EMSetOfflinePushNew emSetOfflinePushNew, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling setOfflinePushNew(Async)"); + } + + // verify the required parameter 'chattype' is set + if (chattype == null) { + throw new ApiException("Missing the required parameter 'chattype' when calling setOfflinePushNew(Async)"); + } + + // verify the required parameter 'key' is set + if (key == null) { + throw new ApiException("Missing the required parameter 'key' when calling setOfflinePushNew(Async)"); + } + + return setOfflinePushNewCall(username, chattype, key, emSetOfflinePushNew, _callback); + + } + + /** + * 设置离线推送(新) + * 你可以设置全局离线推送的通知方式和免打扰模式以及单个单聊或群聊会话的离线推送设置。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81 + * @param username (required) + * @param chattype 对象类型,即会话类型: - user:用户,表示单聊; - chatgroup:群组,表示群聊 (required) + * @param key 对象名称: - 单聊时为对端用户的用户 ID; - 群聊时为群组 ID (required) + * @param emSetOfflinePushNew (optional) + * @return EMSetOfflinePushNewResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMSetOfflinePushNewResult setOfflinePushNew(String username, String chattype, String key, EMSetOfflinePushNew emSetOfflinePushNew) throws ApiException { + ApiResponse localVarResp = setOfflinePushNewWithHttpInfo(username, chattype, key, emSetOfflinePushNew); + return localVarResp.getData(); + } + + /** + * 设置离线推送(新) + * 你可以设置全局离线推送的通知方式和免打扰模式以及单个单聊或群聊会话的离线推送设置。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81 + * @param username (required) + * @param chattype 对象类型,即会话类型: - user:用户,表示单聊; - chatgroup:群组,表示群聊 (required) + * @param key 对象名称: - 单聊时为对端用户的用户 ID; - 群聊时为群组 ID (required) + * @param emSetOfflinePushNew (optional) + * @return ApiResponse<EMSetOfflinePushNewResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse setOfflinePushNewWithHttpInfo(String username, String chattype, String key, EMSetOfflinePushNew emSetOfflinePushNew) throws ApiException { + okhttp3.Call localVarCall = setOfflinePushNewValidateBeforeCall(username, chattype, key, emSetOfflinePushNew, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 设置离线推送(新) (asynchronously) + * 你可以设置全局离线推送的通知方式和免打扰模式以及单个单聊或群聊会话的离线推送设置。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81 + * @param username (required) + * @param chattype 对象类型,即会话类型: - user:用户,表示单聊; - chatgroup:群组,表示群聊 (required) + * @param key 对象名称: - 单聊时为对端用户的用户 ID; - 群聊时为群组 ID (required) + * @param emSetOfflinePushNew (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call setOfflinePushNewAsync(String username, String chattype, String key, EMSetOfflinePushNew emSetOfflinePushNew, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = setOfflinePushNewValidateBeforeCall(username, chattype, key, emSetOfflinePushNew, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for setOfflinePushOld + * @param username 用户 ID (required) + * @param emSetOfflinePushOld (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call setOfflinePushOldCall(String username, EMSetOfflinePushOld emSetOfflinePushOld, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = emSetOfflinePushOld; + + // create path and map variables + String localVarPath = "/users/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call setOfflinePushOldValidateBeforeCall(String username, EMSetOfflinePushOld emSetOfflinePushOld, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling setOfflinePushOld(Async)"); + } + + return setOfflinePushOldCall(username, emSetOfflinePushOld, _callback); + + } + + /** + * 离线推送设置。包括设置离线推送时显示的昵称、设置离线推送通知的展示方式、设置免打扰模式 + * 离线推送设置。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%97%B6%E6%98%BE%E7%A4%BA%E7%9A%84%E6%98%B5%E7%A7%B0、https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E9%80%9A%E7%9F%A5%E7%9A%84%E5%B1%95%E7%A4%BA%E6%96%B9%E5%BC%8F、https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E5%85%8D%E6%89%93%E6%89%B0%E6%A8%A1%E5%BC%8F + * @param username 用户 ID (required) + * @param emSetOfflinePushOld (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public void setOfflinePushOld(String username, EMSetOfflinePushOld emSetOfflinePushOld) throws ApiException { + setOfflinePushOldWithHttpInfo(username, emSetOfflinePushOld); + } + + /** + * 离线推送设置。包括设置离线推送时显示的昵称、设置离线推送通知的展示方式、设置免打扰模式 + * 离线推送设置。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%97%B6%E6%98%BE%E7%A4%BA%E7%9A%84%E6%98%B5%E7%A7%B0、https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E9%80%9A%E7%9F%A5%E7%9A%84%E5%B1%95%E7%A4%BA%E6%96%B9%E5%BC%8F、https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E5%85%8D%E6%89%93%E6%89%B0%E6%A8%A1%E5%BC%8F + * @param username 用户 ID (required) + * @param emSetOfflinePushOld (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse setOfflinePushOldWithHttpInfo(String username, EMSetOfflinePushOld emSetOfflinePushOld) throws ApiException { + okhttp3.Call localVarCall = setOfflinePushOldValidateBeforeCall(username, emSetOfflinePushOld, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * 离线推送设置。包括设置离线推送时显示的昵称、设置离线推送通知的展示方式、设置免打扰模式 (asynchronously) + * 离线推送设置。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%97%B6%E6%98%BE%E7%A4%BA%E7%9A%84%E6%98%B5%E7%A7%B0、https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E9%80%9A%E7%9F%A5%E7%9A%84%E5%B1%95%E7%A4%BA%E6%96%B9%E5%BC%8F、https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E5%85%8D%E6%89%93%E6%89%B0%E6%A8%A1%E5%BC%8F + * @param username 用户 ID (required) + * @param emSetOfflinePushOld (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call setOfflinePushOldAsync(String username, EMSetOfflinePushOld emSetOfflinePushOld, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = setOfflinePushOldValidateBeforeCall(username, emSetOfflinePushOld, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for setPushBindingInfo + * @param username (required) + * @param emSetPushBindingInfo (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call setPushBindingInfoCall(String username, EMSetPushBindingInfo emSetPushBindingInfo, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = emSetPushBindingInfo; + + // create path and map variables + String localVarPath = "/users/{username}/push/binding" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call setPushBindingInfoValidateBeforeCall(String username, EMSetPushBindingInfo emSetPushBindingInfo, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling setPushBindingInfo(Async)"); + } + + return setPushBindingInfoCall(username, emSetPushBindingInfo, _callback); + + } + + /** + * 绑定和解绑推送信息 + * 推送消息时,设备与推送信息会进行绑定,包括设备 ID、推送证书和 device token。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E7%BB%91%E5%AE%9A%E5%92%8C%E8%A7%A3%E7%BB%91%E6%8E%A8%E9%80%81%E4%BF%A1%E6%81%AF + * @param username (required) + * @param emSetPushBindingInfo (optional) + * @return EMSetPushBindingInfoResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMSetPushBindingInfoResult setPushBindingInfo(String username, EMSetPushBindingInfo emSetPushBindingInfo) throws ApiException { + ApiResponse localVarResp = setPushBindingInfoWithHttpInfo(username, emSetPushBindingInfo); + return localVarResp.getData(); + } + + /** + * 绑定和解绑推送信息 + * 推送消息时,设备与推送信息会进行绑定,包括设备 ID、推送证书和 device token。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E7%BB%91%E5%AE%9A%E5%92%8C%E8%A7%A3%E7%BB%91%E6%8E%A8%E9%80%81%E4%BF%A1%E6%81%AF + * @param username (required) + * @param emSetPushBindingInfo (optional) + * @return ApiResponse<EMSetPushBindingInfoResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse setPushBindingInfoWithHttpInfo(String username, EMSetPushBindingInfo emSetPushBindingInfo) throws ApiException { + okhttp3.Call localVarCall = setPushBindingInfoValidateBeforeCall(username, emSetPushBindingInfo, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 绑定和解绑推送信息 (asynchronously) + * 推送消息时,设备与推送信息会进行绑定,包括设备 ID、推送证书和 device token。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E7%BB%91%E5%AE%9A%E5%92%8C%E8%A7%A3%E7%BB%91%E6%8E%A8%E9%80%81%E4%BF%A1%E6%81%AF + * @param username (required) + * @param emSetPushBindingInfo (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call setPushBindingInfoAsync(String username, EMSetPushBindingInfo emSetPushBindingInfo, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = setPushBindingInfoValidateBeforeCall(username, emSetPushBindingInfo, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for setPushPreferredLanguage + * @param username (required) + * @param emSetPushPreferredLanguage (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call setPushPreferredLanguageCall(String username, EMSetPushPreferredLanguage emSetPushPreferredLanguage, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = emSetPushPreferredLanguage; + + // create path and map variables + String localVarPath = "/users/{username}/notification/language" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call setPushPreferredLanguageValidateBeforeCall(String username, EMSetPushPreferredLanguage emSetPushPreferredLanguage, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling setPushPreferredLanguage(Async)"); + } + + return setPushPreferredLanguageCall(username, emSetPushPreferredLanguage, _callback); + + } + + /** + * 设置推送通知的首选语言 + * 设置离线推送消息的首选语言。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E6%8E%A8%E9%80%81%E9%80%9A%E7%9F%A5%E7%9A%84%E9%A6%96%E9%80%89%E8%AF%AD%E8%A8%80 + * @param username (required) + * @param emSetPushPreferredLanguage (optional) + * @return EMSetPushPreferredLanguageResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMSetPushPreferredLanguageResult setPushPreferredLanguage(String username, EMSetPushPreferredLanguage emSetPushPreferredLanguage) throws ApiException { + ApiResponse localVarResp = setPushPreferredLanguageWithHttpInfo(username, emSetPushPreferredLanguage); + return localVarResp.getData(); + } + + /** + * 设置推送通知的首选语言 + * 设置离线推送消息的首选语言。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E6%8E%A8%E9%80%81%E9%80%9A%E7%9F%A5%E7%9A%84%E9%A6%96%E9%80%89%E8%AF%AD%E8%A8%80 + * @param username (required) + * @param emSetPushPreferredLanguage (optional) + * @return ApiResponse<EMSetPushPreferredLanguageResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse setPushPreferredLanguageWithHttpInfo(String username, EMSetPushPreferredLanguage emSetPushPreferredLanguage) throws ApiException { + okhttp3.Call localVarCall = setPushPreferredLanguageValidateBeforeCall(username, emSetPushPreferredLanguage, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 设置推送通知的首选语言 (asynchronously) + * 设置离线推送消息的首选语言。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E6%8E%A8%E9%80%81%E9%80%9A%E7%9F%A5%E7%9A%84%E9%A6%96%E9%80%89%E8%AF%AD%E8%A8%80 + * @param username (required) + * @param emSetPushPreferredLanguage (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call setPushPreferredLanguageAsync(String username, EMSetPushPreferredLanguage emSetPushPreferredLanguage, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = setPushPreferredLanguageValidateBeforeCall(username, emSetPushPreferredLanguage, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/easemob/im/api/ReactionApi.java b/src/main/java/com/easemob/im/api/ReactionApi.java new file mode 100644 index 000000000..6eba3f39d --- /dev/null +++ b/src/main/java/com/easemob/im/api/ReactionApi.java @@ -0,0 +1,710 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api; + +import com.easemob.im.ApiCallback; +import com.easemob.im.ApiClient; +import com.easemob.im.ApiException; +import com.easemob.im.ApiResponse; +import com.easemob.im.Configuration; +import com.easemob.im.Pair; +import com.easemob.im.ProgressRequestBody; +import com.easemob.im.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.easemob.im.api.model.EMDeleteReactionResult; +import com.easemob.im.api.model.EMGetReactionDetailResult; +import com.easemob.im.api.model.EMGetReactionResult; +import com.easemob.im.api.model.EMSetReaction; +import com.easemob.im.api.model.EMSetReactionResult; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ReactionApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ReactionApi() { + this(Configuration.getDefaultApiClient()); + } + + public ReactionApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteReaction + * @param username (required) + * @param msgId 消息 ID (required) + * @param message 表情 ID。长度不可超过 128 个字符。该参数的值必须与客户端一致 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call deleteReactionCall(String username, String msgId, String message, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/reaction/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (msgId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("msgId", msgId)); + } + + if (message != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("message", message)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteReactionValidateBeforeCall(String username, String msgId, String message, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling deleteReaction(Async)"); + } + + // verify the required parameter 'msgId' is set + if (msgId == null) { + throw new ApiException("Missing the required parameter 'msgId' when calling deleteReaction(Async)"); + } + + // verify the required parameter 'message' is set + if (message == null) { + throw new ApiException("Missing the required parameter 'message' when calling deleteReaction(Async)"); + } + + return deleteReactionCall(username, msgId, message, _callback); + + } + + /** + * 删除 Reaction + * 删除当前用户追加的 Reaction。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E5%88%A0%E9%99%A4-reaction + * @param username (required) + * @param msgId 消息 ID (required) + * @param message 表情 ID。长度不可超过 128 个字符。该参数的值必须与客户端一致 (required) + * @return EMDeleteReactionResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMDeleteReactionResult deleteReaction(String username, String msgId, String message) throws ApiException { + ApiResponse localVarResp = deleteReactionWithHttpInfo(username, msgId, message); + return localVarResp.getData(); + } + + /** + * 删除 Reaction + * 删除当前用户追加的 Reaction。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E5%88%A0%E9%99%A4-reaction + * @param username (required) + * @param msgId 消息 ID (required) + * @param message 表情 ID。长度不可超过 128 个字符。该参数的值必须与客户端一致 (required) + * @return ApiResponse<EMDeleteReactionResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse deleteReactionWithHttpInfo(String username, String msgId, String message) throws ApiException { + okhttp3.Call localVarCall = deleteReactionValidateBeforeCall(username, msgId, message, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 删除 Reaction (asynchronously) + * 删除当前用户追加的 Reaction。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E5%88%A0%E9%99%A4-reaction + * @param username (required) + * @param msgId 消息 ID (required) + * @param message 表情 ID。长度不可超过 128 个字符。该参数的值必须与客户端一致 (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call deleteReactionAsync(String username, String msgId, String message, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteReactionValidateBeforeCall(username, msgId, message, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getReaction + * @param username (required) + * @param msgIdList 需要查询的消息 ID 列表,最多可传 20 个消息 ID (required) + * @param msgType 消息的会话类型: - chat:单聊; - groupchat:群聊 (required) + * @param groupId 群组 ID。如果 msgType 设置为 groupchat,即拉取群中的 Reaction,必须指定群组 ID (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getReactionCall(String username, List msgIdList, String msgType, String groupId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/reaction/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (msgIdList != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "msgIdList", msgIdList)); + } + + if (msgType != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("msgType", msgType)); + } + + if (groupId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("groupId", groupId)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getReactionValidateBeforeCall(String username, List msgIdList, String msgType, String groupId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getReaction(Async)"); + } + + // verify the required parameter 'msgIdList' is set + if (msgIdList == null) { + throw new ApiException("Missing the required parameter 'msgIdList' when calling getReaction(Async)"); + } + + // verify the required parameter 'msgType' is set + if (msgType == null) { + throw new ApiException("Missing the required parameter 'msgType' when calling getReaction(Async)"); + } + + return getReactionCall(username, msgIdList, msgType, groupId, _callback); + + } + + /** + * 根据消息 ID 获取 Reaction + * 该方法根据单聊或群聊中的消息 ID 获取单个或多个消息的 Reaction 信息,包括 Reaction ID、使用的表情 ID、以及使用该 Reaction 的用户 ID 及用户人数。获取的 Reaction 的用户列表只展示最早三个添加 Reaction 的用户。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E6%A0%B9%E6%8D%AE%E6%B6%88%E6%81%AF-id-%E8%8E%B7%E5%8F%96-reaction + * @param username (required) + * @param msgIdList 需要查询的消息 ID 列表,最多可传 20 个消息 ID (required) + * @param msgType 消息的会话类型: - chat:单聊; - groupchat:群聊 (required) + * @param groupId 群组 ID。如果 msgType 设置为 groupchat,即拉取群中的 Reaction,必须指定群组 ID (optional) + * @return EMGetReactionResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMGetReactionResult getReaction(String username, List msgIdList, String msgType, String groupId) throws ApiException { + ApiResponse localVarResp = getReactionWithHttpInfo(username, msgIdList, msgType, groupId); + return localVarResp.getData(); + } + + /** + * 根据消息 ID 获取 Reaction + * 该方法根据单聊或群聊中的消息 ID 获取单个或多个消息的 Reaction 信息,包括 Reaction ID、使用的表情 ID、以及使用该 Reaction 的用户 ID 及用户人数。获取的 Reaction 的用户列表只展示最早三个添加 Reaction 的用户。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E6%A0%B9%E6%8D%AE%E6%B6%88%E6%81%AF-id-%E8%8E%B7%E5%8F%96-reaction + * @param username (required) + * @param msgIdList 需要查询的消息 ID 列表,最多可传 20 个消息 ID (required) + * @param msgType 消息的会话类型: - chat:单聊; - groupchat:群聊 (required) + * @param groupId 群组 ID。如果 msgType 设置为 groupchat,即拉取群中的 Reaction,必须指定群组 ID (optional) + * @return ApiResponse<EMGetReactionResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse getReactionWithHttpInfo(String username, List msgIdList, String msgType, String groupId) throws ApiException { + okhttp3.Call localVarCall = getReactionValidateBeforeCall(username, msgIdList, msgType, groupId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 根据消息 ID 获取 Reaction (asynchronously) + * 该方法根据单聊或群聊中的消息 ID 获取单个或多个消息的 Reaction 信息,包括 Reaction ID、使用的表情 ID、以及使用该 Reaction 的用户 ID 及用户人数。获取的 Reaction 的用户列表只展示最早三个添加 Reaction 的用户。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E6%A0%B9%E6%8D%AE%E6%B6%88%E6%81%AF-id-%E8%8E%B7%E5%8F%96-reaction + * @param username (required) + * @param msgIdList 需要查询的消息 ID 列表,最多可传 20 个消息 ID (required) + * @param msgType 消息的会话类型: - chat:单聊; - groupchat:群聊 (required) + * @param groupId 群组 ID。如果 msgType 设置为 groupchat,即拉取群中的 Reaction,必须指定群组 ID (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getReactionAsync(String username, List msgIdList, String msgType, String groupId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getReactionValidateBeforeCall(username, msgIdList, msgType, groupId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getReactionDetail + * @param username (required) + * @param msgId 消息 ID (required) + * @param message 表情 ID。长度不可超过 128 个字符。该参数的值必须与客户端一致 (required) + * @param limit 每页显示添加 Reaction 的用户数量。取值范围为 [1,50],默认值为 50 (optional) + * @param cursor 查询游标,指定数据查询的起始位置,分页获取时使用 (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getReactionDetailCall(String username, String msgId, String message, Integer limit, String cursor, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/reaction/user/{username}/detail" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (msgId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("msgId", msgId)); + } + + if (message != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("message", message)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (cursor != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("cursor", cursor)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getReactionDetailValidateBeforeCall(String username, String msgId, String message, Integer limit, String cursor, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling getReactionDetail(Async)"); + } + + // verify the required parameter 'msgId' is set + if (msgId == null) { + throw new ApiException("Missing the required parameter 'msgId' when calling getReactionDetail(Async)"); + } + + // verify the required parameter 'message' is set + if (message == null) { + throw new ApiException("Missing the required parameter 'message' when calling getReactionDetail(Async)"); + } + + return getReactionDetailCall(username, msgId, message, limit, cursor, _callback); + + } + + /** + * 根据消息 ID 和表情 ID 获取 Reaction 信息 + * 在单聊或群聊场景中对单条消息创建或追加 Reaction。创建 Reaction 指对消息添加第一条 Reaction,后续的 Reaction 添加称为追加。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E5%88%9B%E5%BB%BA-%E8%BF%BD%E5%8A%A0-reaction + * @param username (required) + * @param msgId 消息 ID (required) + * @param message 表情 ID。长度不可超过 128 个字符。该参数的值必须与客户端一致 (required) + * @param limit 每页显示添加 Reaction 的用户数量。取值范围为 [1,50],默认值为 50 (optional) + * @param cursor 查询游标,指定数据查询的起始位置,分页获取时使用 (optional) + * @return EMGetReactionDetailResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMGetReactionDetailResult getReactionDetail(String username, String msgId, String message, Integer limit, String cursor) throws ApiException { + ApiResponse localVarResp = getReactionDetailWithHttpInfo(username, msgId, message, limit, cursor); + return localVarResp.getData(); + } + + /** + * 根据消息 ID 和表情 ID 获取 Reaction 信息 + * 在单聊或群聊场景中对单条消息创建或追加 Reaction。创建 Reaction 指对消息添加第一条 Reaction,后续的 Reaction 添加称为追加。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E5%88%9B%E5%BB%BA-%E8%BF%BD%E5%8A%A0-reaction + * @param username (required) + * @param msgId 消息 ID (required) + * @param message 表情 ID。长度不可超过 128 个字符。该参数的值必须与客户端一致 (required) + * @param limit 每页显示添加 Reaction 的用户数量。取值范围为 [1,50],默认值为 50 (optional) + * @param cursor 查询游标,指定数据查询的起始位置,分页获取时使用 (optional) + * @return ApiResponse<EMGetReactionDetailResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse getReactionDetailWithHttpInfo(String username, String msgId, String message, Integer limit, String cursor) throws ApiException { + okhttp3.Call localVarCall = getReactionDetailValidateBeforeCall(username, msgId, message, limit, cursor, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 根据消息 ID 和表情 ID 获取 Reaction 信息 (asynchronously) + * 在单聊或群聊场景中对单条消息创建或追加 Reaction。创建 Reaction 指对消息添加第一条 Reaction,后续的 Reaction 添加称为追加。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E5%88%9B%E5%BB%BA-%E8%BF%BD%E5%8A%A0-reaction + * @param username (required) + * @param msgId 消息 ID (required) + * @param message 表情 ID。长度不可超过 128 个字符。该参数的值必须与客户端一致 (required) + * @param limit 每页显示添加 Reaction 的用户数量。取值范围为 [1,50],默认值为 50 (optional) + * @param cursor 查询游标,指定数据查询的起始位置,分页获取时使用 (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call getReactionDetailAsync(String username, String msgId, String message, Integer limit, String cursor, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getReactionDetailValidateBeforeCall(username, msgId, message, limit, cursor, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for setReaction + * @param username (required) + * @param emSetReaction (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call setReactionCall(String username, EMSetReaction emSetReaction, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = emSetReaction; + + // create path and map variables + String localVarPath = "/reaction/user/{username}" + .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call setReactionValidateBeforeCall(String username, EMSetReaction emSetReaction, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'username' is set + if (username == null) { + throw new ApiException("Missing the required parameter 'username' when calling setReaction(Async)"); + } + + return setReactionCall(username, emSetReaction, _callback); + + } + + /** + * 创建/追加 Reaction + * 在单聊或群聊场景中对单条消息创建或追加 Reaction。创建 Reaction 指对消息添加第一条 Reaction,后续的 Reaction 添加称为追加。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E5%88%9B%E5%BB%BA-%E8%BF%BD%E5%8A%A0-reaction + * @param username (required) + * @param emSetReaction (optional) + * @return EMSetReactionResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public EMSetReactionResult setReaction(String username, EMSetReaction emSetReaction) throws ApiException { + ApiResponse localVarResp = setReactionWithHttpInfo(username, emSetReaction); + return localVarResp.getData(); + } + + /** + * 创建/追加 Reaction + * 在单聊或群聊场景中对单条消息创建或追加 Reaction。创建 Reaction 指对消息添加第一条 Reaction,后续的 Reaction 添加称为追加。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E5%88%9B%E5%BB%BA-%E8%BF%BD%E5%8A%A0-reaction + * @param username (required) + * @param emSetReaction (optional) + * @return ApiResponse<EMSetReactionResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public ApiResponse setReactionWithHttpInfo(String username, EMSetReaction emSetReaction) throws ApiException { + okhttp3.Call localVarCall = setReactionValidateBeforeCall(username, emSetReaction, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * 创建/追加 Reaction (asynchronously) + * 在单聊或群聊场景中对单条消息创建或追加 Reaction。创建 Reaction 指对消息添加第一条 Reaction,后续的 Reaction 添加称为追加。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E5%88%9B%E5%BB%BA-%E8%BF%BD%E5%8A%A0-reaction + * @param username (required) + * @param emSetReaction (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 + * @http.response.details + + + + + +
Status Code Description Response Headers
200 OK -
4xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
5xx 错误码:https://docs-im-beta.easemob.com/document/server-side/error.html -
+ */ + public okhttp3.Call setReactionAsync(String username, EMSetReaction emSetReaction, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = setReactionValidateBeforeCall(username, emSetReaction, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/easemob/im/api/model/EMCreateOfflinePushTemplate.java b/src/main/java/com/easemob/im/api/model/EMCreateOfflinePushTemplate.java new file mode 100644 index 000000000..9d61ac1b8 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMCreateOfflinePushTemplate.java @@ -0,0 +1,270 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMCreateOfflinePushTemplate + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMCreateOfflinePushTemplate { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_TITLE_PATTERN = "title_pattern"; + @SerializedName(SERIALIZED_NAME_TITLE_PATTERN) + private String titlePattern; + + public static final String SERIALIZED_NAME_CONTENT_PATTERN = "content_pattern"; + @SerializedName(SERIALIZED_NAME_CONTENT_PATTERN) + private String contentPattern; + + public EMCreateOfflinePushTemplate() { + } + + public EMCreateOfflinePushTemplate name(String name) { + + this.name = name; + return this; + } + + /** + * 要添加的推送模板的名称。模板名称最多可包含 64 个字符,支持以下字符集: - 26 个小写英文字母 a-z; - 26 个大写英文字母 A-Z; - 10 个数字 0-9 + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public EMCreateOfflinePushTemplate titlePattern(String titlePattern) { + + this.titlePattern = titlePattern; + return this; + } + + /** + * 自定义推送标题,例如: 标题 {0} + * @return titlePattern + **/ + @javax.annotation.Nullable + public String getTitlePattern() { + return titlePattern; + } + + + public void setTitlePattern(String titlePattern) { + this.titlePattern = titlePattern; + } + + + public EMCreateOfflinePushTemplate contentPattern(String contentPattern) { + + this.contentPattern = contentPattern; + return this; + } + + /** + * 自定义推送内容,例如:内容 {0}, {1} + * @return contentPattern + **/ + @javax.annotation.Nullable + public String getContentPattern() { + return contentPattern; + } + + + public void setContentPattern(String contentPattern) { + this.contentPattern = contentPattern; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMCreateOfflinePushTemplate createOfflinePushTemplate = (EMCreateOfflinePushTemplate) o; + return Objects.equals(this.name, createOfflinePushTemplate.name) && + Objects.equals(this.titlePattern, createOfflinePushTemplate.titlePattern) && + Objects.equals(this.contentPattern, createOfflinePushTemplate.contentPattern); + } + + @Override + public int hashCode() { + return Objects.hash(name, titlePattern, contentPattern); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMCreateOfflinePushTemplate {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" titlePattern: ").append(toIndentedString(titlePattern)).append("\n"); + sb.append(" contentPattern: ").append(toIndentedString(contentPattern)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("title_pattern"); + openapiFields.add("content_pattern"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMCreateOfflinePushTemplate + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMCreateOfflinePushTemplate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMCreateOfflinePushTemplate is not found in the empty JSON string", EMCreateOfflinePushTemplate.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMCreateOfflinePushTemplate.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMCreateOfflinePushTemplate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("title_pattern") != null && !jsonObj.get("title_pattern").isJsonNull()) && !jsonObj.get("title_pattern").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `title_pattern` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title_pattern").toString())); + } + if ((jsonObj.get("content_pattern") != null && !jsonObj.get("content_pattern").isJsonNull()) && !jsonObj.get("content_pattern").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `content_pattern` to be a primitive type in the JSON string but got `%s`", jsonObj.get("content_pattern").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMCreateOfflinePushTemplate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMCreateOfflinePushTemplate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMCreateOfflinePushTemplate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMCreateOfflinePushTemplate value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMCreateOfflinePushTemplate read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMCreateOfflinePushTemplate given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMCreateOfflinePushTemplate + * @throws IOException if the JSON string is invalid with respect to EMCreateOfflinePushTemplate + */ + public static EMCreateOfflinePushTemplate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMCreateOfflinePushTemplate.class); + } + + /** + * Convert an instance of EMCreateOfflinePushTemplate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMCreateOfflinePushTemplateResult.java b/src/main/java/com/easemob/im/api/model/EMCreateOfflinePushTemplateResult.java new file mode 100644 index 000000000..c2f7b5530 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMCreateOfflinePushTemplateResult.java @@ -0,0 +1,210 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMOfflinePushTemplateResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMCreateOfflinePushTemplateResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMCreateOfflinePushTemplateResult { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private EMOfflinePushTemplateResource data; + + public EMCreateOfflinePushTemplateResult() { + } + + public EMCreateOfflinePushTemplateResult data(EMOfflinePushTemplateResource data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public EMOfflinePushTemplateResource getData() { + return data; + } + + + public void setData(EMOfflinePushTemplateResource data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMCreateOfflinePushTemplateResult createOfflinePushTemplateResult = (EMCreateOfflinePushTemplateResult) o; + return Objects.equals(this.data, createOfflinePushTemplateResult.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMCreateOfflinePushTemplateResult {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMCreateOfflinePushTemplateResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMCreateOfflinePushTemplateResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMCreateOfflinePushTemplateResult is not found in the empty JSON string", EMCreateOfflinePushTemplateResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMCreateOfflinePushTemplateResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMCreateOfflinePushTemplateResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + EMOfflinePushTemplateResource.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMCreateOfflinePushTemplateResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMCreateOfflinePushTemplateResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMCreateOfflinePushTemplateResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMCreateOfflinePushTemplateResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMCreateOfflinePushTemplateResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMCreateOfflinePushTemplateResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMCreateOfflinePushTemplateResult + * @throws IOException if the JSON string is invalid with respect to EMCreateOfflinePushTemplateResult + */ + public static EMCreateOfflinePushTemplateResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMCreateOfflinePushTemplateResult.class); + } + + /** + * Convert an instance of EMCreateOfflinePushTemplateResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMDeleteOfflinePushTemplateResult.java b/src/main/java/com/easemob/im/api/model/EMDeleteOfflinePushTemplateResult.java new file mode 100644 index 000000000..c6df88d5a --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMDeleteOfflinePushTemplateResult.java @@ -0,0 +1,210 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMOfflinePushTemplateResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMDeleteOfflinePushTemplateResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMDeleteOfflinePushTemplateResult { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private EMOfflinePushTemplateResource data; + + public EMDeleteOfflinePushTemplateResult() { + } + + public EMDeleteOfflinePushTemplateResult data(EMOfflinePushTemplateResource data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public EMOfflinePushTemplateResource getData() { + return data; + } + + + public void setData(EMOfflinePushTemplateResource data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMDeleteOfflinePushTemplateResult deleteOfflinePushTemplateResult = (EMDeleteOfflinePushTemplateResult) o; + return Objects.equals(this.data, deleteOfflinePushTemplateResult.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMDeleteOfflinePushTemplateResult {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMDeleteOfflinePushTemplateResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMDeleteOfflinePushTemplateResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMDeleteOfflinePushTemplateResult is not found in the empty JSON string", EMDeleteOfflinePushTemplateResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMDeleteOfflinePushTemplateResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMDeleteOfflinePushTemplateResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + EMOfflinePushTemplateResource.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMDeleteOfflinePushTemplateResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMDeleteOfflinePushTemplateResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMDeleteOfflinePushTemplateResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMDeleteOfflinePushTemplateResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMDeleteOfflinePushTemplateResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMDeleteOfflinePushTemplateResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMDeleteOfflinePushTemplateResult + * @throws IOException if the JSON string is invalid with respect to EMDeleteOfflinePushTemplateResult + */ + public static EMDeleteOfflinePushTemplateResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMDeleteOfflinePushTemplateResult.class); + } + + /** + * Convert an instance of EMDeleteOfflinePushTemplateResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMDeleteReactionResult.java b/src/main/java/com/easemob/im/api/model/EMDeleteReactionResult.java new file mode 100644 index 000000000..001f2ee3f --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMDeleteReactionResult.java @@ -0,0 +1,208 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMDeleteReactionResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMDeleteReactionResult { + public static final String SERIALIZED_NAME_REQUEST_STATUS_CODE = "requestStatusCode"; + @SerializedName(SERIALIZED_NAME_REQUEST_STATUS_CODE) + private String requestStatusCode; + + public EMDeleteReactionResult() { + } + + public EMDeleteReactionResult requestStatusCode(String requestStatusCode) { + + this.requestStatusCode = requestStatusCode; + return this; + } + + /** + * Get requestStatusCode + * @return requestStatusCode + **/ + @javax.annotation.Nullable + public String getRequestStatusCode() { + return requestStatusCode; + } + + + public void setRequestStatusCode(String requestStatusCode) { + this.requestStatusCode = requestStatusCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMDeleteReactionResult deleteReactionResult = (EMDeleteReactionResult) o; + return Objects.equals(this.requestStatusCode, deleteReactionResult.requestStatusCode); + } + + @Override + public int hashCode() { + return Objects.hash(requestStatusCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMDeleteReactionResult {\n"); + sb.append(" requestStatusCode: ").append(toIndentedString(requestStatusCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("requestStatusCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMDeleteReactionResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMDeleteReactionResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMDeleteReactionResult is not found in the empty JSON string", EMDeleteReactionResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMDeleteReactionResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMDeleteReactionResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("requestStatusCode") != null && !jsonObj.get("requestStatusCode").isJsonNull()) && !jsonObj.get("requestStatusCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `requestStatusCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("requestStatusCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMDeleteReactionResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMDeleteReactionResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMDeleteReactionResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMDeleteReactionResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMDeleteReactionResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMDeleteReactionResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMDeleteReactionResult + * @throws IOException if the JSON string is invalid with respect to EMDeleteReactionResult + */ + public static EMDeleteReactionResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMDeleteReactionResult.class); + } + + /** + * Convert an instance of EMDeleteReactionResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetGroupOnlineMemberCountResult.java b/src/main/java/com/easemob/im/api/model/EMGetGroupOnlineMemberCountResult.java new file mode 100644 index 000000000..05665d9fa --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetGroupOnlineMemberCountResult.java @@ -0,0 +1,205 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetGroupOnlineMemberCountResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetGroupOnlineMemberCountResult { + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + private Integer result; + + public EMGetGroupOnlineMemberCountResult() { + } + + public EMGetGroupOnlineMemberCountResult result(Integer result) { + + this.result = result; + return this; + } + + /** + * Get result + * @return result + **/ + @javax.annotation.Nullable + public Integer getResult() { + return result; + } + + + public void setResult(Integer result) { + this.result = result; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetGroupOnlineMemberCountResult getGroupOnlineMemberCountResult = (EMGetGroupOnlineMemberCountResult) o; + return Objects.equals(this.result, getGroupOnlineMemberCountResult.result); + } + + @Override + public int hashCode() { + return Objects.hash(result); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetGroupOnlineMemberCountResult {\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("result"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetGroupOnlineMemberCountResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetGroupOnlineMemberCountResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetGroupOnlineMemberCountResult is not found in the empty JSON string", EMGetGroupOnlineMemberCountResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetGroupOnlineMemberCountResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetGroupOnlineMemberCountResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetGroupOnlineMemberCountResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetGroupOnlineMemberCountResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetGroupOnlineMemberCountResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetGroupOnlineMemberCountResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetGroupOnlineMemberCountResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetGroupOnlineMemberCountResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetGroupOnlineMemberCountResult + * @throws IOException if the JSON string is invalid with respect to EMGetGroupOnlineMemberCountResult + */ + public static EMGetGroupOnlineMemberCountResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetGroupOnlineMemberCountResult.class); + } + + /** + * Convert an instance of EMGetGroupOnlineMemberCountResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetMultipleUsersPresenceStatus.java b/src/main/java/com/easemob/im/api/model/EMGetMultipleUsersPresenceStatus.java new file mode 100644 index 000000000..ef2e11500 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetMultipleUsersPresenceStatus.java @@ -0,0 +1,219 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetMultipleUsersPresenceStatus + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetMultipleUsersPresenceStatus { + public static final String SERIALIZED_NAME_USERNAMES = "usernames"; + @SerializedName(SERIALIZED_NAME_USERNAMES) + private List usernames; + + public EMGetMultipleUsersPresenceStatus() { + } + + public EMGetMultipleUsersPresenceStatus usernames(List usernames) { + + this.usernames = usernames; + return this; + } + + public EMGetMultipleUsersPresenceStatus addUsernamesItem(String usernamesItem) { + if (this.usernames == null) { + this.usernames = new ArrayList<>(); + } + this.usernames.add(usernamesItem); + return this; + } + + /** + * 需要获取其在线状态的用户列表,例如 [\"user1\", \"user2\"],最多可传 100 个用户 ID + * @return usernames + **/ + @javax.annotation.Nullable + public List getUsernames() { + return usernames; + } + + + public void setUsernames(List usernames) { + this.usernames = usernames; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetMultipleUsersPresenceStatus getMultipleUsersPresenceStatus = (EMGetMultipleUsersPresenceStatus) o; + return Objects.equals(this.usernames, getMultipleUsersPresenceStatus.usernames); + } + + @Override + public int hashCode() { + return Objects.hash(usernames); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetMultipleUsersPresenceStatus {\n"); + sb.append(" usernames: ").append(toIndentedString(usernames)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("usernames"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetMultipleUsersPresenceStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetMultipleUsersPresenceStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetMultipleUsersPresenceStatus is not found in the empty JSON string", EMGetMultipleUsersPresenceStatus.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetMultipleUsersPresenceStatus.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetMultipleUsersPresenceStatus` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("usernames") != null && !jsonObj.get("usernames").isJsonNull() && !jsonObj.get("usernames").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `usernames` to be an array in the JSON string but got `%s`", jsonObj.get("usernames").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetMultipleUsersPresenceStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetMultipleUsersPresenceStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetMultipleUsersPresenceStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetMultipleUsersPresenceStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetMultipleUsersPresenceStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetMultipleUsersPresenceStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetMultipleUsersPresenceStatus + * @throws IOException if the JSON string is invalid with respect to EMGetMultipleUsersPresenceStatus + */ + public static EMGetMultipleUsersPresenceStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetMultipleUsersPresenceStatus.class); + } + + /** + * Convert an instance of EMGetMultipleUsersPresenceStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetMultipleUsersPresenceStatusResource.java b/src/main/java/com/easemob/im/api/model/EMGetMultipleUsersPresenceStatusResource.java new file mode 100644 index 000000000..a31ed225e --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetMultipleUsersPresenceStatusResource.java @@ -0,0 +1,296 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetMultipleUsersPresenceStatusResource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetMultipleUsersPresenceStatusResource { + public static final String SERIALIZED_NAME_UID = "uid"; + @SerializedName(SERIALIZED_NAME_UID) + private String uid; + + public static final String SERIALIZED_NAME_LAST_TIME = "last_time"; + @SerializedName(SERIALIZED_NAME_LAST_TIME) + private BigDecimal lastTime; + + public static final String SERIALIZED_NAME_EXT = "ext"; + @SerializedName(SERIALIZED_NAME_EXT) + private String ext; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private Object status; + + public EMGetMultipleUsersPresenceStatusResource() { + } + + public EMGetMultipleUsersPresenceStatusResource uid(String uid) { + + this.uid = uid; + return this; + } + + /** + * 用户在即时通讯服务器的唯一 ID + * @return uid + **/ + @javax.annotation.Nullable + public String getUid() { + return uid; + } + + + public void setUid(String uid) { + this.uid = uid; + } + + + public EMGetMultipleUsersPresenceStatusResource lastTime(BigDecimal lastTime) { + + this.lastTime = lastTime; + return this; + } + + /** + * 用户的最近在线时间,Unix 时间戳,单位为秒 + * @return lastTime + **/ + @javax.annotation.Nullable + public BigDecimal getLastTime() { + return lastTime; + } + + + public void setLastTime(BigDecimal lastTime) { + this.lastTime = lastTime; + } + + + public EMGetMultipleUsersPresenceStatusResource ext(String ext) { + + this.ext = ext; + return this; + } + + /** + * 用户的在线状态扩展信息 + * @return ext + **/ + @javax.annotation.Nullable + public String getExt() { + return ext; + } + + + public void setExt(String ext) { + this.ext = ext; + } + + + public EMGetMultipleUsersPresenceStatusResource status(Object status) { + + this.status = status; + return this; + } + + /** + * 用户在多个设备上的在线状态: - 0: 离线。 - 1: 在线。 - 其他值:用户自定义的在线状态 + * @return status + **/ + @javax.annotation.Nullable + public Object getStatus() { + return status; + } + + + public void setStatus(Object status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetMultipleUsersPresenceStatusResource getMultipleUsersPresenceStatusResource = (EMGetMultipleUsersPresenceStatusResource) o; + return Objects.equals(this.uid, getMultipleUsersPresenceStatusResource.uid) && + Objects.equals(this.lastTime, getMultipleUsersPresenceStatusResource.lastTime) && + Objects.equals(this.ext, getMultipleUsersPresenceStatusResource.ext) && + Objects.equals(this.status, getMultipleUsersPresenceStatusResource.status); + } + + @Override + public int hashCode() { + return Objects.hash(uid, lastTime, ext, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetMultipleUsersPresenceStatusResource {\n"); + sb.append(" uid: ").append(toIndentedString(uid)).append("\n"); + sb.append(" lastTime: ").append(toIndentedString(lastTime)).append("\n"); + sb.append(" ext: ").append(toIndentedString(ext)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("uid"); + openapiFields.add("last_time"); + openapiFields.add("ext"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetMultipleUsersPresenceStatusResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetMultipleUsersPresenceStatusResource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetMultipleUsersPresenceStatusResource is not found in the empty JSON string", EMGetMultipleUsersPresenceStatusResource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetMultipleUsersPresenceStatusResource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetMultipleUsersPresenceStatusResource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("uid") != null && !jsonObj.get("uid").isJsonNull()) && !jsonObj.get("uid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uid").toString())); + } + if ((jsonObj.get("ext") != null && !jsonObj.get("ext").isJsonNull()) && !jsonObj.get("ext").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ext` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ext").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetMultipleUsersPresenceStatusResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetMultipleUsersPresenceStatusResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetMultipleUsersPresenceStatusResource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetMultipleUsersPresenceStatusResource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetMultipleUsersPresenceStatusResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetMultipleUsersPresenceStatusResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetMultipleUsersPresenceStatusResource + * @throws IOException if the JSON string is invalid with respect to EMGetMultipleUsersPresenceStatusResource + */ + public static EMGetMultipleUsersPresenceStatusResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetMultipleUsersPresenceStatusResource.class); + } + + /** + * Convert an instance of EMGetMultipleUsersPresenceStatusResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetMultipleUsersPresenceStatusResult.java b/src/main/java/com/easemob/im/api/model/EMGetMultipleUsersPresenceStatusResult.java new file mode 100644 index 000000000..68493be49 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetMultipleUsersPresenceStatusResult.java @@ -0,0 +1,230 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMGetMultipleUsersPresenceStatusResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetMultipleUsersPresenceStatusResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetMultipleUsersPresenceStatusResult { + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + private List result; + + public EMGetMultipleUsersPresenceStatusResult() { + } + + public EMGetMultipleUsersPresenceStatusResult result(List result) { + + this.result = result; + return this; + } + + public EMGetMultipleUsersPresenceStatusResult addResultItem(EMGetMultipleUsersPresenceStatusResource resultItem) { + if (this.result == null) { + this.result = new ArrayList<>(); + } + this.result.add(resultItem); + return this; + } + + /** + * Get result + * @return result + **/ + @javax.annotation.Nullable + public List getResult() { + return result; + } + + + public void setResult(List result) { + this.result = result; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetMultipleUsersPresenceStatusResult getMultipleUsersPresenceStatusResult = (EMGetMultipleUsersPresenceStatusResult) o; + return Objects.equals(this.result, getMultipleUsersPresenceStatusResult.result); + } + + @Override + public int hashCode() { + return Objects.hash(result); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetMultipleUsersPresenceStatusResult {\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("result"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetMultipleUsersPresenceStatusResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetMultipleUsersPresenceStatusResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetMultipleUsersPresenceStatusResult is not found in the empty JSON string", EMGetMultipleUsersPresenceStatusResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetMultipleUsersPresenceStatusResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetMultipleUsersPresenceStatusResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) { + JsonArray jsonArrayresult = jsonObj.getAsJsonArray("result"); + if (jsonArrayresult != null) { + // ensure the json data is an array + if (!jsonObj.get("result").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `result` to be an array in the JSON string but got `%s`", jsonObj.get("result").toString())); + } + + // validate the optional field `result` (array) + for (int i = 0; i < jsonArrayresult.size(); i++) { + EMGetMultipleUsersPresenceStatusResource.validateJsonElement(jsonArrayresult.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetMultipleUsersPresenceStatusResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetMultipleUsersPresenceStatusResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetMultipleUsersPresenceStatusResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetMultipleUsersPresenceStatusResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetMultipleUsersPresenceStatusResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetMultipleUsersPresenceStatusResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetMultipleUsersPresenceStatusResult + * @throws IOException if the JSON string is invalid with respect to EMGetMultipleUsersPresenceStatusResult + */ + public static EMGetMultipleUsersPresenceStatusResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetMultipleUsersPresenceStatusResult.class); + } + + /** + * Convert an instance of EMGetMultipleUsersPresenceStatusResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetOfflinePushResult.java b/src/main/java/com/easemob/im/api/model/EMGetOfflinePushResult.java new file mode 100644 index 000000000..68985ebba --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetOfflinePushResult.java @@ -0,0 +1,210 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMOfflinePushNewResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetOfflinePushResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetOfflinePushResult { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private EMOfflinePushNewResource data; + + public EMGetOfflinePushResult() { + } + + public EMGetOfflinePushResult data(EMOfflinePushNewResource data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public EMOfflinePushNewResource getData() { + return data; + } + + + public void setData(EMOfflinePushNewResource data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetOfflinePushResult getOfflinePushResult = (EMGetOfflinePushResult) o; + return Objects.equals(this.data, getOfflinePushResult.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetOfflinePushResult {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetOfflinePushResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetOfflinePushResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetOfflinePushResult is not found in the empty JSON string", EMGetOfflinePushResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetOfflinePushResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetOfflinePushResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + EMOfflinePushNewResource.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetOfflinePushResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetOfflinePushResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetOfflinePushResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetOfflinePushResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetOfflinePushResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetOfflinePushResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetOfflinePushResult + * @throws IOException if the JSON string is invalid with respect to EMGetOfflinePushResult + */ + public static EMGetOfflinePushResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetOfflinePushResult.class); + } + + /** + * Convert an instance of EMGetOfflinePushResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetOfflinePushTemplateResult.java b/src/main/java/com/easemob/im/api/model/EMGetOfflinePushTemplateResult.java new file mode 100644 index 000000000..7ac97458a --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetOfflinePushTemplateResult.java @@ -0,0 +1,210 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMOfflinePushTemplateResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetOfflinePushTemplateResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetOfflinePushTemplateResult { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private EMOfflinePushTemplateResource data; + + public EMGetOfflinePushTemplateResult() { + } + + public EMGetOfflinePushTemplateResult data(EMOfflinePushTemplateResource data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public EMOfflinePushTemplateResource getData() { + return data; + } + + + public void setData(EMOfflinePushTemplateResource data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetOfflinePushTemplateResult getOfflinePushTemplateResult = (EMGetOfflinePushTemplateResult) o; + return Objects.equals(this.data, getOfflinePushTemplateResult.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetOfflinePushTemplateResult {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetOfflinePushTemplateResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetOfflinePushTemplateResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetOfflinePushTemplateResult is not found in the empty JSON string", EMGetOfflinePushTemplateResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetOfflinePushTemplateResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetOfflinePushTemplateResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + EMOfflinePushTemplateResource.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetOfflinePushTemplateResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetOfflinePushTemplateResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetOfflinePushTemplateResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetOfflinePushTemplateResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetOfflinePushTemplateResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetOfflinePushTemplateResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetOfflinePushTemplateResult + * @throws IOException if the JSON string is invalid with respect to EMGetOfflinePushTemplateResult + */ + public static EMGetOfflinePushTemplateResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetOfflinePushTemplateResult.class); + } + + /** + * Convert an instance of EMGetOfflinePushTemplateResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetPushBindingInfoResult.java b/src/main/java/com/easemob/im/api/model/EMGetPushBindingInfoResult.java new file mode 100644 index 000000000..47e746ab0 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetPushBindingInfoResult.java @@ -0,0 +1,230 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMPushBindingInfoResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetPushBindingInfoResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetPushBindingInfoResult { + public static final String SERIALIZED_NAME_ENTITIES = "entities"; + @SerializedName(SERIALIZED_NAME_ENTITIES) + private List entities; + + public EMGetPushBindingInfoResult() { + } + + public EMGetPushBindingInfoResult entities(List entities) { + + this.entities = entities; + return this; + } + + public EMGetPushBindingInfoResult addEntitiesItem(EMPushBindingInfoResource entitiesItem) { + if (this.entities == null) { + this.entities = new ArrayList<>(); + } + this.entities.add(entitiesItem); + return this; + } + + /** + * Get entities + * @return entities + **/ + @javax.annotation.Nullable + public List getEntities() { + return entities; + } + + + public void setEntities(List entities) { + this.entities = entities; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetPushBindingInfoResult getPushBindingInfoResult = (EMGetPushBindingInfoResult) o; + return Objects.equals(this.entities, getPushBindingInfoResult.entities); + } + + @Override + public int hashCode() { + return Objects.hash(entities); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetPushBindingInfoResult {\n"); + sb.append(" entities: ").append(toIndentedString(entities)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("entities"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetPushBindingInfoResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetPushBindingInfoResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetPushBindingInfoResult is not found in the empty JSON string", EMGetPushBindingInfoResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetPushBindingInfoResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetPushBindingInfoResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("entities") != null && !jsonObj.get("entities").isJsonNull()) { + JsonArray jsonArrayentities = jsonObj.getAsJsonArray("entities"); + if (jsonArrayentities != null) { + // ensure the json data is an array + if (!jsonObj.get("entities").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `entities` to be an array in the JSON string but got `%s`", jsonObj.get("entities").toString())); + } + + // validate the optional field `entities` (array) + for (int i = 0; i < jsonArrayentities.size(); i++) { + EMPushBindingInfoResource.validateJsonElement(jsonArrayentities.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetPushBindingInfoResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetPushBindingInfoResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetPushBindingInfoResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetPushBindingInfoResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetPushBindingInfoResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetPushBindingInfoResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetPushBindingInfoResult + * @throws IOException if the JSON string is invalid with respect to EMGetPushBindingInfoResult + */ + public static EMGetPushBindingInfoResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetPushBindingInfoResult.class); + } + + /** + * Convert an instance of EMGetPushBindingInfoResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetPushPreferredLanguageResult.java b/src/main/java/com/easemob/im/api/model/EMGetPushPreferredLanguageResult.java new file mode 100644 index 000000000..677ff2142 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetPushPreferredLanguageResult.java @@ -0,0 +1,210 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMPushPreferredLanguageResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetPushPreferredLanguageResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetPushPreferredLanguageResult { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private EMPushPreferredLanguageResource data; + + public EMGetPushPreferredLanguageResult() { + } + + public EMGetPushPreferredLanguageResult data(EMPushPreferredLanguageResource data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public EMPushPreferredLanguageResource getData() { + return data; + } + + + public void setData(EMPushPreferredLanguageResource data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetPushPreferredLanguageResult getPushPreferredLanguageResult = (EMGetPushPreferredLanguageResult) o; + return Objects.equals(this.data, getPushPreferredLanguageResult.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetPushPreferredLanguageResult {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetPushPreferredLanguageResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetPushPreferredLanguageResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetPushPreferredLanguageResult is not found in the empty JSON string", EMGetPushPreferredLanguageResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetPushPreferredLanguageResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetPushPreferredLanguageResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + EMPushPreferredLanguageResource.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetPushPreferredLanguageResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetPushPreferredLanguageResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetPushPreferredLanguageResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetPushPreferredLanguageResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetPushPreferredLanguageResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetPushPreferredLanguageResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetPushPreferredLanguageResult + * @throws IOException if the JSON string is invalid with respect to EMGetPushPreferredLanguageResult + */ + public static EMGetPushPreferredLanguageResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetPushPreferredLanguageResult.class); + } + + /** + * Convert an instance of EMGetPushPreferredLanguageResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetReactionDetailResult.java b/src/main/java/com/easemob/im/api/model/EMGetReactionDetailResult.java new file mode 100644 index 000000000..40d8e2bb2 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetReactionDetailResult.java @@ -0,0 +1,241 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMReactionResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetReactionDetailResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetReactionDetailResult { + public static final String SERIALIZED_NAME_REQUEST_STATUS_CODE = "requestStatusCode"; + @SerializedName(SERIALIZED_NAME_REQUEST_STATUS_CODE) + private String requestStatusCode; + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private EMReactionResource data; + + public EMGetReactionDetailResult() { + } + + public EMGetReactionDetailResult requestStatusCode(String requestStatusCode) { + + this.requestStatusCode = requestStatusCode; + return this; + } + + /** + * Get requestStatusCode + * @return requestStatusCode + **/ + @javax.annotation.Nullable + public String getRequestStatusCode() { + return requestStatusCode; + } + + + public void setRequestStatusCode(String requestStatusCode) { + this.requestStatusCode = requestStatusCode; + } + + + public EMGetReactionDetailResult data(EMReactionResource data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public EMReactionResource getData() { + return data; + } + + + public void setData(EMReactionResource data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetReactionDetailResult getReactionDetailResult = (EMGetReactionDetailResult) o; + return Objects.equals(this.requestStatusCode, getReactionDetailResult.requestStatusCode) && + Objects.equals(this.data, getReactionDetailResult.data); + } + + @Override + public int hashCode() { + return Objects.hash(requestStatusCode, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetReactionDetailResult {\n"); + sb.append(" requestStatusCode: ").append(toIndentedString(requestStatusCode)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("requestStatusCode"); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetReactionDetailResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetReactionDetailResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetReactionDetailResult is not found in the empty JSON string", EMGetReactionDetailResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetReactionDetailResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetReactionDetailResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("requestStatusCode") != null && !jsonObj.get("requestStatusCode").isJsonNull()) && !jsonObj.get("requestStatusCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `requestStatusCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("requestStatusCode").toString())); + } + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + EMReactionResource.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetReactionDetailResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetReactionDetailResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetReactionDetailResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetReactionDetailResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetReactionDetailResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetReactionDetailResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetReactionDetailResult + * @throws IOException if the JSON string is invalid with respect to EMGetReactionDetailResult + */ + public static EMGetReactionDetailResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetReactionDetailResult.class); + } + + /** + * Convert an instance of EMGetReactionDetailResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetReactionListResource.java b/src/main/java/com/easemob/im/api/model/EMGetReactionListResource.java new file mode 100644 index 000000000..89e222fd6 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetReactionListResource.java @@ -0,0 +1,261 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMReactionResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetReactionListResource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetReactionListResource { + public static final String SERIALIZED_NAME_MSG_ID = "msgId"; + @SerializedName(SERIALIZED_NAME_MSG_ID) + private String msgId; + + public static final String SERIALIZED_NAME_REACTION_LIST = "reactionList"; + @SerializedName(SERIALIZED_NAME_REACTION_LIST) + private List reactionList; + + public EMGetReactionListResource() { + } + + public EMGetReactionListResource msgId(String msgId) { + + this.msgId = msgId; + return this; + } + + /** + * Reaction 对应的消息 ID + * @return msgId + **/ + @javax.annotation.Nullable + public String getMsgId() { + return msgId; + } + + + public void setMsgId(String msgId) { + this.msgId = msgId; + } + + + public EMGetReactionListResource reactionList(List reactionList) { + + this.reactionList = reactionList; + return this; + } + + public EMGetReactionListResource addReactionListItem(EMReactionResource reactionListItem) { + if (this.reactionList == null) { + this.reactionList = new ArrayList<>(); + } + this.reactionList.add(reactionListItem); + return this; + } + + /** + * 单个消息的 Reaction 列表 + * @return reactionList + **/ + @javax.annotation.Nullable + public List getReactionList() { + return reactionList; + } + + + public void setReactionList(List reactionList) { + this.reactionList = reactionList; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetReactionListResource getReactionListResource = (EMGetReactionListResource) o; + return Objects.equals(this.msgId, getReactionListResource.msgId) && + Objects.equals(this.reactionList, getReactionListResource.reactionList); + } + + @Override + public int hashCode() { + return Objects.hash(msgId, reactionList); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetReactionListResource {\n"); + sb.append(" msgId: ").append(toIndentedString(msgId)).append("\n"); + sb.append(" reactionList: ").append(toIndentedString(reactionList)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("msgId"); + openapiFields.add("reactionList"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetReactionListResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetReactionListResource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetReactionListResource is not found in the empty JSON string", EMGetReactionListResource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetReactionListResource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetReactionListResource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msgId") != null && !jsonObj.get("msgId").isJsonNull()) && !jsonObj.get("msgId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `msgId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("msgId").toString())); + } + if (jsonObj.get("reactionList") != null && !jsonObj.get("reactionList").isJsonNull()) { + JsonArray jsonArrayreactionList = jsonObj.getAsJsonArray("reactionList"); + if (jsonArrayreactionList != null) { + // ensure the json data is an array + if (!jsonObj.get("reactionList").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `reactionList` to be an array in the JSON string but got `%s`", jsonObj.get("reactionList").toString())); + } + + // validate the optional field `reactionList` (array) + for (int i = 0; i < jsonArrayreactionList.size(); i++) { + EMReactionResource.validateJsonElement(jsonArrayreactionList.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetReactionListResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetReactionListResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetReactionListResource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetReactionListResource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetReactionListResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetReactionListResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetReactionListResource + * @throws IOException if the JSON string is invalid with respect to EMGetReactionListResource + */ + public static EMGetReactionListResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetReactionListResource.class); + } + + /** + * Convert an instance of EMGetReactionListResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetReactionResult.java b/src/main/java/com/easemob/im/api/model/EMGetReactionResult.java new file mode 100644 index 000000000..2906321eb --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetReactionResult.java @@ -0,0 +1,261 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMGetReactionListResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetReactionResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetReactionResult { + public static final String SERIALIZED_NAME_REQUEST_STATUS_CODE = "requestStatusCode"; + @SerializedName(SERIALIZED_NAME_REQUEST_STATUS_CODE) + private String requestStatusCode; + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public EMGetReactionResult() { + } + + public EMGetReactionResult requestStatusCode(String requestStatusCode) { + + this.requestStatusCode = requestStatusCode; + return this; + } + + /** + * Get requestStatusCode + * @return requestStatusCode + **/ + @javax.annotation.Nullable + public String getRequestStatusCode() { + return requestStatusCode; + } + + + public void setRequestStatusCode(String requestStatusCode) { + this.requestStatusCode = requestStatusCode; + } + + + public EMGetReactionResult data(List data) { + + this.data = data; + return this; + } + + public EMGetReactionResult addDataItem(EMGetReactionListResource dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetReactionResult getReactionResult = (EMGetReactionResult) o; + return Objects.equals(this.requestStatusCode, getReactionResult.requestStatusCode) && + Objects.equals(this.data, getReactionResult.data); + } + + @Override + public int hashCode() { + return Objects.hash(requestStatusCode, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetReactionResult {\n"); + sb.append(" requestStatusCode: ").append(toIndentedString(requestStatusCode)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("requestStatusCode"); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetReactionResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetReactionResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetReactionResult is not found in the empty JSON string", EMGetReactionResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetReactionResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetReactionResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("requestStatusCode") != null && !jsonObj.get("requestStatusCode").isJsonNull()) && !jsonObj.get("requestStatusCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `requestStatusCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("requestStatusCode").toString())); + } + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + EMGetReactionListResource.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetReactionResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetReactionResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetReactionResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetReactionResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetReactionResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetReactionResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetReactionResult + * @throws IOException if the JSON string is invalid with respect to EMGetReactionResult + */ + public static EMGetReactionResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetReactionResult.class); + } + + /** + * Convert an instance of EMGetReactionResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetUserSubscriptionListResource.java b/src/main/java/com/easemob/im/api/model/EMGetUserSubscriptionListResource.java new file mode 100644 index 000000000..7901d42aa --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetUserSubscriptionListResource.java @@ -0,0 +1,258 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMUserSubscriptionResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetUserSubscriptionListResource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetUserSubscriptionListResource { + public static final String SERIALIZED_NAME_TOTALNUM = "totalnum"; + @SerializedName(SERIALIZED_NAME_TOTALNUM) + private Integer totalnum; + + public static final String SERIALIZED_NAME_SUBLIST = "sublist"; + @SerializedName(SERIALIZED_NAME_SUBLIST) + private List sublist; + + public EMGetUserSubscriptionListResource() { + } + + public EMGetUserSubscriptionListResource totalnum(Integer totalnum) { + + this.totalnum = totalnum; + return this; + } + + /** + * Get totalnum + * @return totalnum + **/ + @javax.annotation.Nullable + public Integer getTotalnum() { + return totalnum; + } + + + public void setTotalnum(Integer totalnum) { + this.totalnum = totalnum; + } + + + public EMGetUserSubscriptionListResource sublist(List sublist) { + + this.sublist = sublist; + return this; + } + + public EMGetUserSubscriptionListResource addSublistItem(EMUserSubscriptionResource sublistItem) { + if (this.sublist == null) { + this.sublist = new ArrayList<>(); + } + this.sublist.add(sublistItem); + return this; + } + + /** + * Get sublist + * @return sublist + **/ + @javax.annotation.Nullable + public List getSublist() { + return sublist; + } + + + public void setSublist(List sublist) { + this.sublist = sublist; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetUserSubscriptionListResource getUserSubscriptionListResource = (EMGetUserSubscriptionListResource) o; + return Objects.equals(this.totalnum, getUserSubscriptionListResource.totalnum) && + Objects.equals(this.sublist, getUserSubscriptionListResource.sublist); + } + + @Override + public int hashCode() { + return Objects.hash(totalnum, sublist); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetUserSubscriptionListResource {\n"); + sb.append(" totalnum: ").append(toIndentedString(totalnum)).append("\n"); + sb.append(" sublist: ").append(toIndentedString(sublist)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("totalnum"); + openapiFields.add("sublist"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetUserSubscriptionListResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetUserSubscriptionListResource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetUserSubscriptionListResource is not found in the empty JSON string", EMGetUserSubscriptionListResource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetUserSubscriptionListResource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetUserSubscriptionListResource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("sublist") != null && !jsonObj.get("sublist").isJsonNull()) { + JsonArray jsonArraysublist = jsonObj.getAsJsonArray("sublist"); + if (jsonArraysublist != null) { + // ensure the json data is an array + if (!jsonObj.get("sublist").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `sublist` to be an array in the JSON string but got `%s`", jsonObj.get("sublist").toString())); + } + + // validate the optional field `sublist` (array) + for (int i = 0; i < jsonArraysublist.size(); i++) { + EMUserSubscriptionResource.validateJsonElement(jsonArraysublist.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetUserSubscriptionListResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetUserSubscriptionListResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetUserSubscriptionListResource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetUserSubscriptionListResource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetUserSubscriptionListResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetUserSubscriptionListResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetUserSubscriptionListResource + * @throws IOException if the JSON string is invalid with respect to EMGetUserSubscriptionListResource + */ + public static EMGetUserSubscriptionListResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetUserSubscriptionListResource.class); + } + + /** + * Convert an instance of EMGetUserSubscriptionListResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMGetUserSubscriptionListResult.java b/src/main/java/com/easemob/im/api/model/EMGetUserSubscriptionListResult.java new file mode 100644 index 000000000..e40e60b2f --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMGetUserSubscriptionListResult.java @@ -0,0 +1,210 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMGetUserSubscriptionListResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMGetUserSubscriptionListResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMGetUserSubscriptionListResult { + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + private EMGetUserSubscriptionListResource result; + + public EMGetUserSubscriptionListResult() { + } + + public EMGetUserSubscriptionListResult result(EMGetUserSubscriptionListResource result) { + + this.result = result; + return this; + } + + /** + * Get result + * @return result + **/ + @javax.annotation.Nullable + public EMGetUserSubscriptionListResource getResult() { + return result; + } + + + public void setResult(EMGetUserSubscriptionListResource result) { + this.result = result; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMGetUserSubscriptionListResult getUserSubscriptionListResult = (EMGetUserSubscriptionListResult) o; + return Objects.equals(this.result, getUserSubscriptionListResult.result); + } + + @Override + public int hashCode() { + return Objects.hash(result); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMGetUserSubscriptionListResult {\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("result"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMGetUserSubscriptionListResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMGetUserSubscriptionListResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMGetUserSubscriptionListResult is not found in the empty JSON string", EMGetUserSubscriptionListResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMGetUserSubscriptionListResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMGetUserSubscriptionListResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `result` + if (jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) { + EMGetUserSubscriptionListResource.validateJsonElement(jsonObj.get("result")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMGetUserSubscriptionListResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMGetUserSubscriptionListResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMGetUserSubscriptionListResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMGetUserSubscriptionListResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMGetUserSubscriptionListResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMGetUserSubscriptionListResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMGetUserSubscriptionListResult + * @throws IOException if the JSON string is invalid with respect to EMGetUserSubscriptionListResult + */ + public static EMGetUserSubscriptionListResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMGetUserSubscriptionListResult.class); + } + + /** + * Convert an instance of EMGetUserSubscriptionListResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMOfflinePushNewResource.java b/src/main/java/com/easemob/im/api/model/EMOfflinePushNewResource.java new file mode 100644 index 000000000..73f01f7ae --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMOfflinePushNewResource.java @@ -0,0 +1,268 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMOfflinePushNewResource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMOfflinePushNewResource { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_IGNORE_DURATION = "ignoreDuration"; + @SerializedName(SERIALIZED_NAME_IGNORE_DURATION) + private BigDecimal ignoreDuration; + + public static final String SERIALIZED_NAME_IGNORE_INTERVAL = "ignoreInterval"; + @SerializedName(SERIALIZED_NAME_IGNORE_INTERVAL) + private String ignoreInterval; + + public EMOfflinePushNewResource() { + } + + public EMOfflinePushNewResource type(String type) { + + this.type = type; + return this; + } + + /** + * 离线推送通知方式 + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public EMOfflinePushNewResource ignoreDuration(BigDecimal ignoreDuration) { + + this.ignoreDuration = ignoreDuration; + return this; + } + + /** + * 离线推送免打扰时长 + * @return ignoreDuration + **/ + @javax.annotation.Nullable + public BigDecimal getIgnoreDuration() { + return ignoreDuration; + } + + + public void setIgnoreDuration(BigDecimal ignoreDuration) { + this.ignoreDuration = ignoreDuration; + } + + + public EMOfflinePushNewResource ignoreInterval(String ignoreInterval) { + + this.ignoreInterval = ignoreInterval; + return this; + } + + /** + * 离线推送免打扰时间段 + * @return ignoreInterval + **/ + @javax.annotation.Nullable + public String getIgnoreInterval() { + return ignoreInterval; + } + + + public void setIgnoreInterval(String ignoreInterval) { + this.ignoreInterval = ignoreInterval; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMOfflinePushNewResource offlinePushNewResource = (EMOfflinePushNewResource) o; + return Objects.equals(this.type, offlinePushNewResource.type) && + Objects.equals(this.ignoreDuration, offlinePushNewResource.ignoreDuration) && + Objects.equals(this.ignoreInterval, offlinePushNewResource.ignoreInterval); + } + + @Override + public int hashCode() { + return Objects.hash(type, ignoreDuration, ignoreInterval); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMOfflinePushNewResource {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" ignoreDuration: ").append(toIndentedString(ignoreDuration)).append("\n"); + sb.append(" ignoreInterval: ").append(toIndentedString(ignoreInterval)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("ignoreDuration"); + openapiFields.add("ignoreInterval"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMOfflinePushNewResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMOfflinePushNewResource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMOfflinePushNewResource is not found in the empty JSON string", EMOfflinePushNewResource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMOfflinePushNewResource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMOfflinePushNewResource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("ignoreInterval") != null && !jsonObj.get("ignoreInterval").isJsonNull()) && !jsonObj.get("ignoreInterval").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ignoreInterval` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ignoreInterval").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMOfflinePushNewResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMOfflinePushNewResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMOfflinePushNewResource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMOfflinePushNewResource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMOfflinePushNewResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMOfflinePushNewResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMOfflinePushNewResource + * @throws IOException if the JSON string is invalid with respect to EMOfflinePushNewResource + */ + public static EMOfflinePushNewResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMOfflinePushNewResource.class); + } + + /** + * Convert an instance of EMOfflinePushNewResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMOfflinePushTemplateResource.java b/src/main/java/com/easemob/im/api/model/EMOfflinePushTemplateResource.java new file mode 100644 index 000000000..9e0152056 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMOfflinePushTemplateResource.java @@ -0,0 +1,327 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMOfflinePushTemplateResource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMOfflinePushTemplateResource { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_TITLE_PATTERN = "title_pattern"; + @SerializedName(SERIALIZED_NAME_TITLE_PATTERN) + private String titlePattern; + + public static final String SERIALIZED_NAME_CONTENT_PATTERN = "content_pattern"; + @SerializedName(SERIALIZED_NAME_CONTENT_PATTERN) + private String contentPattern; + + public static final String SERIALIZED_NAME_CREATE_AT = "createAt"; + @SerializedName(SERIALIZED_NAME_CREATE_AT) + private BigDecimal createAt; + + public static final String SERIALIZED_NAME_UPDATE_AT = "updateAt"; + @SerializedName(SERIALIZED_NAME_UPDATE_AT) + private BigDecimal updateAt; + + public EMOfflinePushTemplateResource() { + } + + public EMOfflinePushTemplateResource name(String name) { + + this.name = name; + return this; + } + + /** + * 推送模板的名称 + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public EMOfflinePushTemplateResource titlePattern(String titlePattern) { + + this.titlePattern = titlePattern; + return this; + } + + /** + * 推送模板的自定义标题 + * @return titlePattern + **/ + @javax.annotation.Nullable + public String getTitlePattern() { + return titlePattern; + } + + + public void setTitlePattern(String titlePattern) { + this.titlePattern = titlePattern; + } + + + public EMOfflinePushTemplateResource contentPattern(String contentPattern) { + + this.contentPattern = contentPattern; + return this; + } + + /** + * 推送模板的自定义内容 + * @return contentPattern + **/ + @javax.annotation.Nullable + public String getContentPattern() { + return contentPattern; + } + + + public void setContentPattern(String contentPattern) { + this.contentPattern = contentPattern; + } + + + public EMOfflinePushTemplateResource createAt(BigDecimal createAt) { + + this.createAt = createAt; + return this; + } + + /** + * 创建模板的 Unix 时间戳,单位为毫秒 + * @return createAt + **/ + @javax.annotation.Nullable + public BigDecimal getCreateAt() { + return createAt; + } + + + public void setCreateAt(BigDecimal createAt) { + this.createAt = createAt; + } + + + public EMOfflinePushTemplateResource updateAt(BigDecimal updateAt) { + + this.updateAt = updateAt; + return this; + } + + /** + * 最近一次修改模板的 Unix 时间戳,单位为毫秒 + * @return updateAt + **/ + @javax.annotation.Nullable + public BigDecimal getUpdateAt() { + return updateAt; + } + + + public void setUpdateAt(BigDecimal updateAt) { + this.updateAt = updateAt; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMOfflinePushTemplateResource offlinePushTemplateResource = (EMOfflinePushTemplateResource) o; + return Objects.equals(this.name, offlinePushTemplateResource.name) && + Objects.equals(this.titlePattern, offlinePushTemplateResource.titlePattern) && + Objects.equals(this.contentPattern, offlinePushTemplateResource.contentPattern) && + Objects.equals(this.createAt, offlinePushTemplateResource.createAt) && + Objects.equals(this.updateAt, offlinePushTemplateResource.updateAt); + } + + @Override + public int hashCode() { + return Objects.hash(name, titlePattern, contentPattern, createAt, updateAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMOfflinePushTemplateResource {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" titlePattern: ").append(toIndentedString(titlePattern)).append("\n"); + sb.append(" contentPattern: ").append(toIndentedString(contentPattern)).append("\n"); + sb.append(" createAt: ").append(toIndentedString(createAt)).append("\n"); + sb.append(" updateAt: ").append(toIndentedString(updateAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("title_pattern"); + openapiFields.add("content_pattern"); + openapiFields.add("createAt"); + openapiFields.add("updateAt"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMOfflinePushTemplateResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMOfflinePushTemplateResource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMOfflinePushTemplateResource is not found in the empty JSON string", EMOfflinePushTemplateResource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMOfflinePushTemplateResource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMOfflinePushTemplateResource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("title_pattern") != null && !jsonObj.get("title_pattern").isJsonNull()) && !jsonObj.get("title_pattern").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `title_pattern` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title_pattern").toString())); + } + if ((jsonObj.get("content_pattern") != null && !jsonObj.get("content_pattern").isJsonNull()) && !jsonObj.get("content_pattern").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `content_pattern` to be a primitive type in the JSON string but got `%s`", jsonObj.get("content_pattern").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMOfflinePushTemplateResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMOfflinePushTemplateResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMOfflinePushTemplateResource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMOfflinePushTemplateResource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMOfflinePushTemplateResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMOfflinePushTemplateResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMOfflinePushTemplateResource + * @throws IOException if the JSON string is invalid with respect to EMOfflinePushTemplateResource + */ + public static EMOfflinePushTemplateResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMOfflinePushTemplateResource.class); + } + + /** + * Convert an instance of EMOfflinePushTemplateResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMPushBindingInfoResource.java b/src/main/java/com/easemob/im/api/model/EMPushBindingInfoResource.java new file mode 100644 index 000000000..11f508129 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMPushBindingInfoResource.java @@ -0,0 +1,270 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMPushBindingInfoResource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMPushBindingInfoResource { + public static final String SERIALIZED_NAME_DEVICE_ID = "device_id"; + @SerializedName(SERIALIZED_NAME_DEVICE_ID) + private String deviceId; + + public static final String SERIALIZED_NAME_DEVICE_TOKEN = "device_token"; + @SerializedName(SERIALIZED_NAME_DEVICE_TOKEN) + private String deviceToken; + + public static final String SERIALIZED_NAME_NOTIFIER_NAME = "notifier_name"; + @SerializedName(SERIALIZED_NAME_NOTIFIER_NAME) + private String notifierName; + + public EMPushBindingInfoResource() { + } + + public EMPushBindingInfoResource deviceId(String deviceId) { + + this.deviceId = deviceId; + return this; + } + + /** + * 移动端设备标识,服务端用于识别设备,进行推送信息的绑定和解绑 + * @return deviceId + **/ + @javax.annotation.Nullable + public String getDeviceId() { + return deviceId; + } + + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + + public EMPushBindingInfoResource deviceToken(String deviceToken) { + + this.deviceToken = deviceToken; + return this; + } + + /** + * 推送设备 token + * @return deviceToken + **/ + @javax.annotation.Nullable + public String getDeviceToken() { + return deviceToken; + } + + + public void setDeviceToken(String deviceToken) { + this.deviceToken = deviceToken; + } + + + public EMPushBindingInfoResource notifierName(String notifierName) { + + this.notifierName = notifierName; + return this; + } + + /** + * 推送证书名称 + * @return notifierName + **/ + @javax.annotation.Nullable + public String getNotifierName() { + return notifierName; + } + + + public void setNotifierName(String notifierName) { + this.notifierName = notifierName; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMPushBindingInfoResource pushBindingInfoResource = (EMPushBindingInfoResource) o; + return Objects.equals(this.deviceId, pushBindingInfoResource.deviceId) && + Objects.equals(this.deviceToken, pushBindingInfoResource.deviceToken) && + Objects.equals(this.notifierName, pushBindingInfoResource.notifierName); + } + + @Override + public int hashCode() { + return Objects.hash(deviceId, deviceToken, notifierName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMPushBindingInfoResource {\n"); + sb.append(" deviceId: ").append(toIndentedString(deviceId)).append("\n"); + sb.append(" deviceToken: ").append(toIndentedString(deviceToken)).append("\n"); + sb.append(" notifierName: ").append(toIndentedString(notifierName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("device_id"); + openapiFields.add("device_token"); + openapiFields.add("notifier_name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMPushBindingInfoResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMPushBindingInfoResource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMPushBindingInfoResource is not found in the empty JSON string", EMPushBindingInfoResource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMPushBindingInfoResource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMPushBindingInfoResource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("device_id") != null && !jsonObj.get("device_id").isJsonNull()) && !jsonObj.get("device_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `device_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("device_id").toString())); + } + if ((jsonObj.get("device_token") != null && !jsonObj.get("device_token").isJsonNull()) && !jsonObj.get("device_token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `device_token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("device_token").toString())); + } + if ((jsonObj.get("notifier_name") != null && !jsonObj.get("notifier_name").isJsonNull()) && !jsonObj.get("notifier_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `notifier_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("notifier_name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMPushBindingInfoResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMPushBindingInfoResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMPushBindingInfoResource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMPushBindingInfoResource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMPushBindingInfoResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMPushBindingInfoResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMPushBindingInfoResource + * @throws IOException if the JSON string is invalid with respect to EMPushBindingInfoResource + */ + public static EMPushBindingInfoResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMPushBindingInfoResource.class); + } + + /** + * Convert an instance of EMPushBindingInfoResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMPushPreferredLanguageResource.java b/src/main/java/com/easemob/im/api/model/EMPushPreferredLanguageResource.java new file mode 100644 index 000000000..2e8862fde --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMPushPreferredLanguageResource.java @@ -0,0 +1,208 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMPushPreferredLanguageResource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMPushPreferredLanguageResource { + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + private String language; + + public EMPushPreferredLanguageResource() { + } + + public EMPushPreferredLanguageResource language(String language) { + + this.language = language; + return this; + } + + /** + * 用户接收推送通知的首选语言的代码 + * @return language + **/ + @javax.annotation.Nullable + public String getLanguage() { + return language; + } + + + public void setLanguage(String language) { + this.language = language; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMPushPreferredLanguageResource pushPreferredLanguageResource = (EMPushPreferredLanguageResource) o; + return Objects.equals(this.language, pushPreferredLanguageResource.language); + } + + @Override + public int hashCode() { + return Objects.hash(language); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMPushPreferredLanguageResource {\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMPushPreferredLanguageResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMPushPreferredLanguageResource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMPushPreferredLanguageResource is not found in the empty JSON string", EMPushPreferredLanguageResource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMPushPreferredLanguageResource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMPushPreferredLanguageResource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMPushPreferredLanguageResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMPushPreferredLanguageResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMPushPreferredLanguageResource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMPushPreferredLanguageResource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMPushPreferredLanguageResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMPushPreferredLanguageResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMPushPreferredLanguageResource + * @throws IOException if the JSON string is invalid with respect to EMPushPreferredLanguageResource + */ + public static EMPushPreferredLanguageResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMPushPreferredLanguageResource.class); + } + + /** + * Convert an instance of EMPushPreferredLanguageResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMReactionResource.java b/src/main/java/com/easemob/im/api/model/EMReactionResource.java new file mode 100644 index 000000000..e4ee6be2c --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMReactionResource.java @@ -0,0 +1,368 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMReactionResource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMReactionResource { + public static final String SERIALIZED_NAME_REACTION_ID = "reactionId"; + @SerializedName(SERIALIZED_NAME_REACTION_ID) + private String reactionId; + + public static final String SERIALIZED_NAME_REACTION = "reaction"; + @SerializedName(SERIALIZED_NAME_REACTION) + private String reaction; + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + private Integer count; + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + private Boolean state; + + public static final String SERIALIZED_NAME_USER_LIST = "userList"; + @SerializedName(SERIALIZED_NAME_USER_LIST) + private List userList; + + public static final String SERIALIZED_NAME_CURSOR = "cursor"; + @SerializedName(SERIALIZED_NAME_CURSOR) + private String cursor; + + public EMReactionResource() { + } + + public EMReactionResource reactionId(String reactionId) { + + this.reactionId = reactionId; + return this; + } + + /** + * Reaction ID + * @return reactionId + **/ + @javax.annotation.Nullable + public String getReactionId() { + return reactionId; + } + + + public void setReactionId(String reactionId) { + this.reactionId = reactionId; + } + + + public EMReactionResource reaction(String reaction) { + + this.reaction = reaction; + return this; + } + + /** + * 表情 ID,与客户端一致。该参数与创建/追加 Reaction API的请求参数 message 相同 + * @return reaction + **/ + @javax.annotation.Nullable + public String getReaction() { + return reaction; + } + + + public void setReaction(String reaction) { + this.reaction = reaction; + } + + + public EMReactionResource count(Integer count) { + + this.count = count; + return this; + } + + /** + * 添加该 Reaction 的用户人数 + * @return count + **/ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + + public void setCount(Integer count) { + this.count = count; + } + + + public EMReactionResource state(Boolean state) { + + this.state = state; + return this; + } + + /** + * 当前请求用户是否添加过该 Reaction: - true:是 - false:否 + * @return state + **/ + @javax.annotation.Nullable + public Boolean getState() { + return state; + } + + + public void setState(Boolean state) { + this.state = state; + } + + + public EMReactionResource userList(List userList) { + + this.userList = userList; + return this; + } + + public EMReactionResource addUserListItem(String userListItem) { + if (this.userList == null) { + this.userList = new ArrayList<>(); + } + this.userList.add(userListItem); + return this; + } + + /** + * 添加 Reaction 的用户 ID 列表。只返回最早操作 Reaction 的三个用户的 ID + * @return userList + **/ + @javax.annotation.Nullable + public List getUserList() { + return userList; + } + + + public void setUserList(List userList) { + this.userList = userList; + } + + + public EMReactionResource cursor(String cursor) { + + this.cursor = cursor; + return this; + } + + /** + * 查询游标,指定下次查询的起始位置 + * @return cursor + **/ + @javax.annotation.Nullable + public String getCursor() { + return cursor; + } + + + public void setCursor(String cursor) { + this.cursor = cursor; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMReactionResource reactionResource = (EMReactionResource) o; + return Objects.equals(this.reactionId, reactionResource.reactionId) && + Objects.equals(this.reaction, reactionResource.reaction) && + Objects.equals(this.count, reactionResource.count) && + Objects.equals(this.state, reactionResource.state) && + Objects.equals(this.userList, reactionResource.userList) && + Objects.equals(this.cursor, reactionResource.cursor); + } + + @Override + public int hashCode() { + return Objects.hash(reactionId, reaction, count, state, userList, cursor); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMReactionResource {\n"); + sb.append(" reactionId: ").append(toIndentedString(reactionId)).append("\n"); + sb.append(" reaction: ").append(toIndentedString(reaction)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" userList: ").append(toIndentedString(userList)).append("\n"); + sb.append(" cursor: ").append(toIndentedString(cursor)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reactionId"); + openapiFields.add("reaction"); + openapiFields.add("count"); + openapiFields.add("state"); + openapiFields.add("userList"); + openapiFields.add("cursor"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMReactionResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMReactionResource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMReactionResource is not found in the empty JSON string", EMReactionResource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMReactionResource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMReactionResource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("reactionId") != null && !jsonObj.get("reactionId").isJsonNull()) && !jsonObj.get("reactionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reactionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reactionId").toString())); + } + if ((jsonObj.get("reaction") != null && !jsonObj.get("reaction").isJsonNull()) && !jsonObj.get("reaction").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reaction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reaction").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("userList") != null && !jsonObj.get("userList").isJsonNull() && !jsonObj.get("userList").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `userList` to be an array in the JSON string but got `%s`", jsonObj.get("userList").toString())); + } + if ((jsonObj.get("cursor") != null && !jsonObj.get("cursor").isJsonNull()) && !jsonObj.get("cursor").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cursor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cursor").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMReactionResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMReactionResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMReactionResource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMReactionResource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMReactionResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMReactionResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMReactionResource + * @throws IOException if the JSON string is invalid with respect to EMReactionResource + */ + public static EMReactionResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMReactionResource.class); + } + + /** + * Convert an instance of EMReactionResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMReceiverConfigurationTemplateName.java b/src/main/java/com/easemob/im/api/model/EMReceiverConfigurationTemplateName.java new file mode 100644 index 000000000..e76852624 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMReceiverConfigurationTemplateName.java @@ -0,0 +1,208 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMReceiverConfigurationTemplateName + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMReceiverConfigurationTemplateName { + public static final String SERIALIZED_NAME_TEMPLATE_NAME = "templateName"; + @SerializedName(SERIALIZED_NAME_TEMPLATE_NAME) + private String templateName; + + public EMReceiverConfigurationTemplateName() { + } + + public EMReceiverConfigurationTemplateName templateName(String templateName) { + + this.templateName = templateName; + return this; + } + + /** + * 模板名称 + * @return templateName + **/ + @javax.annotation.Nullable + public String getTemplateName() { + return templateName; + } + + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMReceiverConfigurationTemplateName receiverConfigurationTemplateName = (EMReceiverConfigurationTemplateName) o; + return Objects.equals(this.templateName, receiverConfigurationTemplateName.templateName); + } + + @Override + public int hashCode() { + return Objects.hash(templateName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMReceiverConfigurationTemplateName {\n"); + sb.append(" templateName: ").append(toIndentedString(templateName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("templateName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMReceiverConfigurationTemplateName + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMReceiverConfigurationTemplateName.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMReceiverConfigurationTemplateName is not found in the empty JSON string", EMReceiverConfigurationTemplateName.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMReceiverConfigurationTemplateName.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMReceiverConfigurationTemplateName` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("templateName") != null && !jsonObj.get("templateName").isJsonNull()) && !jsonObj.get("templateName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `templateName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("templateName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMReceiverConfigurationTemplateName.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMReceiverConfigurationTemplateName' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMReceiverConfigurationTemplateName.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMReceiverConfigurationTemplateName value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMReceiverConfigurationTemplateName read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMReceiverConfigurationTemplateName given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMReceiverConfigurationTemplateName + * @throws IOException if the JSON string is invalid with respect to EMReceiverConfigurationTemplateName + */ + public static EMReceiverConfigurationTemplateName fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMReceiverConfigurationTemplateName.class); + } + + /** + * Convert an instance of EMReceiverConfigurationTemplateName to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMReceiverConfigurationTemplateNameResource.java b/src/main/java/com/easemob/im/api/model/EMReceiverConfigurationTemplateNameResource.java new file mode 100644 index 000000000..f9f34d21a --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMReceiverConfigurationTemplateNameResource.java @@ -0,0 +1,208 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMReceiverConfigurationTemplateNameResource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMReceiverConfigurationTemplateNameResource { + public static final String SERIALIZED_NAME_TEMPLATE_NAME = "templateName"; + @SerializedName(SERIALIZED_NAME_TEMPLATE_NAME) + private String templateName; + + public EMReceiverConfigurationTemplateNameResource() { + } + + public EMReceiverConfigurationTemplateNameResource templateName(String templateName) { + + this.templateName = templateName; + return this; + } + + /** + * Get templateName + * @return templateName + **/ + @javax.annotation.Nullable + public String getTemplateName() { + return templateName; + } + + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMReceiverConfigurationTemplateNameResource receiverConfigurationTemplateNameResource = (EMReceiverConfigurationTemplateNameResource) o; + return Objects.equals(this.templateName, receiverConfigurationTemplateNameResource.templateName); + } + + @Override + public int hashCode() { + return Objects.hash(templateName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMReceiverConfigurationTemplateNameResource {\n"); + sb.append(" templateName: ").append(toIndentedString(templateName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("templateName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMReceiverConfigurationTemplateNameResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMReceiverConfigurationTemplateNameResource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMReceiverConfigurationTemplateNameResource is not found in the empty JSON string", EMReceiverConfigurationTemplateNameResource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMReceiverConfigurationTemplateNameResource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMReceiverConfigurationTemplateNameResource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("templateName") != null && !jsonObj.get("templateName").isJsonNull()) && !jsonObj.get("templateName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `templateName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("templateName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMReceiverConfigurationTemplateNameResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMReceiverConfigurationTemplateNameResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMReceiverConfigurationTemplateNameResource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMReceiverConfigurationTemplateNameResource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMReceiverConfigurationTemplateNameResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMReceiverConfigurationTemplateNameResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMReceiverConfigurationTemplateNameResource + * @throws IOException if the JSON string is invalid with respect to EMReceiverConfigurationTemplateNameResource + */ + public static EMReceiverConfigurationTemplateNameResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMReceiverConfigurationTemplateNameResource.class); + } + + /** + * Convert an instance of EMReceiverConfigurationTemplateNameResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMReceiverConfigurationTemplateNameResult.java b/src/main/java/com/easemob/im/api/model/EMReceiverConfigurationTemplateNameResult.java new file mode 100644 index 000000000..df374db53 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMReceiverConfigurationTemplateNameResult.java @@ -0,0 +1,210 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMReceiverConfigurationTemplateNameResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMReceiverConfigurationTemplateNameResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMReceiverConfigurationTemplateNameResult { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private EMReceiverConfigurationTemplateNameResource data; + + public EMReceiverConfigurationTemplateNameResult() { + } + + public EMReceiverConfigurationTemplateNameResult data(EMReceiverConfigurationTemplateNameResource data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public EMReceiverConfigurationTemplateNameResource getData() { + return data; + } + + + public void setData(EMReceiverConfigurationTemplateNameResource data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMReceiverConfigurationTemplateNameResult receiverConfigurationTemplateNameResult = (EMReceiverConfigurationTemplateNameResult) o; + return Objects.equals(this.data, receiverConfigurationTemplateNameResult.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMReceiverConfigurationTemplateNameResult {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMReceiverConfigurationTemplateNameResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMReceiverConfigurationTemplateNameResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMReceiverConfigurationTemplateNameResult is not found in the empty JSON string", EMReceiverConfigurationTemplateNameResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMReceiverConfigurationTemplateNameResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMReceiverConfigurationTemplateNameResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + EMReceiverConfigurationTemplateNameResource.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMReceiverConfigurationTemplateNameResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMReceiverConfigurationTemplateNameResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMReceiverConfigurationTemplateNameResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMReceiverConfigurationTemplateNameResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMReceiverConfigurationTemplateNameResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMReceiverConfigurationTemplateNameResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMReceiverConfigurationTemplateNameResult + * @throws IOException if the JSON string is invalid with respect to EMReceiverConfigurationTemplateNameResult + */ + public static EMReceiverConfigurationTemplateNameResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMReceiverConfigurationTemplateNameResult.class); + } + + /** + * Convert an instance of EMReceiverConfigurationTemplateNameResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSetOfflinePushNew.java b/src/main/java/com/easemob/im/api/model/EMSetOfflinePushNew.java new file mode 100644 index 000000000..691484f9e --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSetOfflinePushNew.java @@ -0,0 +1,268 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSetOfflinePushNew + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSetOfflinePushNew { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_IGNORE_INTERVAL = "ignoreInterval"; + @SerializedName(SERIALIZED_NAME_IGNORE_INTERVAL) + private String ignoreInterval; + + public static final String SERIALIZED_NAME_IGNORE_DURATION = "ignoreDuration"; + @SerializedName(SERIALIZED_NAME_IGNORE_DURATION) + private BigDecimal ignoreDuration; + + public EMSetOfflinePushNew() { + } + + public EMSetOfflinePushNew type(String type) { + + this.type = type; + return this; + } + + /** + * 离线推送通知方式: - DEFAULT:指定的会话采用 app 的设置。该值仅对单聊或群聊会话有效,对 app 级别无效。 - ALL:接收全部离线消息的推送通知; - AT:只接收提及当前用户的离线消息的推送通知。该字段推荐在群聊中使用。若提及一个或多个用户,需在创建消息时对 ext 字段传 \"em_at_list\":[\"user1\", \"user2\" ...];若提及所有人,对该字段传 \"em_at_list\":\"all\"。 - NONE:不接收离线消息的推送通知 注意:若 app 和指定会话均设置了该参数,则该会话采用自身的设置,其他会话采用 app 的设置 + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public EMSetOfflinePushNew ignoreInterval(String ignoreInterval) { + + this.ignoreInterval = ignoreInterval; + return this; + } + + /** + * 每天触发离线推送免打扰的时间段,精确到分钟,格式为 HH:MM-HH:MM,例如 08:30-10:00。该时间为 24 小时制,免打扰时间段的开始时间和结束时间中的小时数和分钟数的取值范围分别为 [00,23] 和 [00,59]。 该参数的设置说明如下: - 该参数仅针对 app 生效,对单聊或群聊不生效。 - 该参数设置后,免打扰模式每天定时触发。例如,开始时间为 08:00,结束时间为 10:00,免打扰模式在每天的 8:00-10:00 内生效。若你在 11:00 设置开始时间为 08:00,结束时间为 12:00,则免打扰模式在当天的 11:00-12:00 生效,以后每天均在 8:00-12:00 生效。 - 若开始时间和结束时间相同,则全天免打扰。 - 若结束时间早于开始时间,则免打扰模式在每天的开始时间到次日的结束时间内生效。例如,开始时间为 10:00,结束时间为 08:00,则免打扰模式的在当天的 10:00 到次日的 8:00 生效。 - 目前仅支持在每天的一个指定时间段内开启免打扰模式,不支持多个免打扰时间段,新的设置会覆盖之前的设置。 - 若不设置该参数,传空字符串。 - 若该参数和 ignoreDuration 均设置,免打扰模式当日在这两个时间段均生效,例如,例如,上午 8:00 将 app 级的 ignoreInterval 设置为 8:00-10:00,ignoreDuration 设置为 14400000 毫秒(4 个小时),则 app 在今天 8:00-12:00 和以后每天 8:00-10:00 处于免打扰模式 + * @return ignoreInterval + **/ + @javax.annotation.Nullable + public String getIgnoreInterval() { + return ignoreInterval; + } + + + public void setIgnoreInterval(String ignoreInterval) { + this.ignoreInterval = ignoreInterval; + } + + + public EMSetOfflinePushNew ignoreDuration(BigDecimal ignoreDuration) { + + this.ignoreDuration = ignoreDuration; + return this; + } + + /** + * 离线推送免打扰时长,单位为毫秒。该参数的取值范围为 [0,604800000],0 表示该参数无效,604800000 表示免打扰模式持续 7 天。 - 该参数对 app 和单聊和群聊均生效。 - 与 ignoreInterval 的设置每天生效不同,该参数为一次有效,设置后立即生效,例如,上午 8:00 将 app 层级的 ignoreDuration 设置为 14400000 毫秒(4 个小时),则 app 只在今天 8:00-12:00 处于免打扰模式。 - 若该参数和 ignoreDuration 均设置,免打扰模式当日在这两个时间段均生效,例如,上午 8:00 将 app 级的 ignoreInterval 设置为 8:00-10:00,ignoreDuration 设置为 14400000 毫秒(4 个小时),则 app 在今天 8:00-12:00 和以后每天 8:00-10:00 处于免打扰模式 + * @return ignoreDuration + **/ + @javax.annotation.Nullable + public BigDecimal getIgnoreDuration() { + return ignoreDuration; + } + + + public void setIgnoreDuration(BigDecimal ignoreDuration) { + this.ignoreDuration = ignoreDuration; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSetOfflinePushNew setOfflinePushNew = (EMSetOfflinePushNew) o; + return Objects.equals(this.type, setOfflinePushNew.type) && + Objects.equals(this.ignoreInterval, setOfflinePushNew.ignoreInterval) && + Objects.equals(this.ignoreDuration, setOfflinePushNew.ignoreDuration); + } + + @Override + public int hashCode() { + return Objects.hash(type, ignoreInterval, ignoreDuration); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSetOfflinePushNew {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" ignoreInterval: ").append(toIndentedString(ignoreInterval)).append("\n"); + sb.append(" ignoreDuration: ").append(toIndentedString(ignoreDuration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("ignoreInterval"); + openapiFields.add("ignoreDuration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSetOfflinePushNew + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSetOfflinePushNew.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSetOfflinePushNew is not found in the empty JSON string", EMSetOfflinePushNew.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSetOfflinePushNew.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSetOfflinePushNew` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("ignoreInterval") != null && !jsonObj.get("ignoreInterval").isJsonNull()) && !jsonObj.get("ignoreInterval").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ignoreInterval` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ignoreInterval").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSetOfflinePushNew.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSetOfflinePushNew' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSetOfflinePushNew.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSetOfflinePushNew value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSetOfflinePushNew read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSetOfflinePushNew given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSetOfflinePushNew + * @throws IOException if the JSON string is invalid with respect to EMSetOfflinePushNew + */ + public static EMSetOfflinePushNew fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSetOfflinePushNew.class); + } + + /** + * Convert an instance of EMSetOfflinePushNew to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSetOfflinePushNewResult.java b/src/main/java/com/easemob/im/api/model/EMSetOfflinePushNewResult.java new file mode 100644 index 000000000..e26d838fd --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSetOfflinePushNewResult.java @@ -0,0 +1,210 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMOfflinePushNewResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSetOfflinePushNewResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSetOfflinePushNewResult { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private EMOfflinePushNewResource data; + + public EMSetOfflinePushNewResult() { + } + + public EMSetOfflinePushNewResult data(EMOfflinePushNewResource data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public EMOfflinePushNewResource getData() { + return data; + } + + + public void setData(EMOfflinePushNewResource data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSetOfflinePushNewResult setOfflinePushNewResult = (EMSetOfflinePushNewResult) o; + return Objects.equals(this.data, setOfflinePushNewResult.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSetOfflinePushNewResult {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSetOfflinePushNewResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSetOfflinePushNewResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSetOfflinePushNewResult is not found in the empty JSON string", EMSetOfflinePushNewResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSetOfflinePushNewResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSetOfflinePushNewResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + EMOfflinePushNewResource.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSetOfflinePushNewResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSetOfflinePushNewResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSetOfflinePushNewResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSetOfflinePushNewResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSetOfflinePushNewResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSetOfflinePushNewResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSetOfflinePushNewResult + * @throws IOException if the JSON string is invalid with respect to EMSetOfflinePushNewResult + */ + public static EMSetOfflinePushNewResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSetOfflinePushNewResult.class); + } + + /** + * Convert an instance of EMSetOfflinePushNewResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSetOfflinePushOld.java b/src/main/java/com/easemob/im/api/model/EMSetOfflinePushOld.java new file mode 100644 index 000000000..542385a42 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSetOfflinePushOld.java @@ -0,0 +1,326 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSetOfflinePushOld + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSetOfflinePushOld { + public static final String SERIALIZED_NAME_NICKNAME = "nickname"; + @SerializedName(SERIALIZED_NAME_NICKNAME) + private String nickname; + + public static final String SERIALIZED_NAME_NOTIFICATION_DISPLAY_STYLE = "notification_display_style"; + @SerializedName(SERIALIZED_NAME_NOTIFICATION_DISPLAY_STYLE) + private Integer notificationDisplayStyle; + + public static final String SERIALIZED_NAME_NOTIFICATION_NO_DISTURBING = "notification_no_disturbing"; + @SerializedName(SERIALIZED_NAME_NOTIFICATION_NO_DISTURBING) + private Boolean notificationNoDisturbing; + + public static final String SERIALIZED_NAME_NOTIFICATION_NO_DISTURBING_START = "notification_no_disturbing_start"; + @SerializedName(SERIALIZED_NAME_NOTIFICATION_NO_DISTURBING_START) + private String notificationNoDisturbingStart; + + public static final String SERIALIZED_NAME_NOTIFICATION_NO_DISTURBING_END = "notification_no_disturbing_end"; + @SerializedName(SERIALIZED_NAME_NOTIFICATION_NO_DISTURBING_END) + private String notificationNoDisturbingEnd; + + public EMSetOfflinePushOld() { + } + + public EMSetOfflinePushOld nickname(String nickname) { + + this.nickname = nickname; + return this; + } + + /** + * 离线推送时在接收方的客户端推送通知栏中显示的发送方的昵称。你可以自定义该昵称,长度不能超过 100 个字符。 支持以下字符集: - 26 个小写英文字母 a-z; - 26 个大写英文字母 A-Z; - 10 个数字 0-9; - 中文; - 特殊字符。 若不设置昵称,推送消息详情时,即设置离线推送通知的展示方式时将 notification_display_style 设置为 1,会显示发送方的用户 ID,而非昵称。 该昵称可与用户属性中的昵称设置不同,不过我们建议这两种昵称的设置保持一致。因此,修改其中一个昵称时,也需调用相应方法对另一个进行更新,确保设置一致。更新用户属性中的昵称的方法,详见 设置用户属性 + * @return nickname + **/ + @javax.annotation.Nullable + public String getNickname() { + return nickname; + } + + + public void setNickname(String nickname) { + this.nickname = nickname; + } + + + public EMSetOfflinePushOld notificationDisplayStyle(Integer notificationDisplayStyle) { + + this.notificationDisplayStyle = notificationDisplayStyle; + return this; + } + + /** + * 离线推送通知的展示方式: -(默认)0:推送标题为“您有一条新消息”,推送内容为“请点击查看”; - 1:推送标题为“您有一条新消息”,推送内容为发送人昵称和离线消息的内容 + * @return notificationDisplayStyle + **/ + @javax.annotation.Nullable + public Integer getNotificationDisplayStyle() { + return notificationDisplayStyle; + } + + + public void setNotificationDisplayStyle(Integer notificationDisplayStyle) { + this.notificationDisplayStyle = notificationDisplayStyle; + } + + + public EMSetOfflinePushOld notificationNoDisturbing(Boolean notificationNoDisturbing) { + + this.notificationNoDisturbing = notificationNoDisturbing; + return this; + } + + /** + * 是否设置为免打扰模式: - true:是; - false:否 + * @return notificationNoDisturbing + **/ + @javax.annotation.Nullable + public Boolean getNotificationNoDisturbing() { + return notificationNoDisturbing; + } + + + public void setNotificationNoDisturbing(Boolean notificationNoDisturbing) { + this.notificationNoDisturbing = notificationNoDisturbing; + } + + + public EMSetOfflinePushOld notificationNoDisturbingStart(String notificationNoDisturbingStart) { + + this.notificationNoDisturbingStart = notificationNoDisturbingStart; + return this; + } + + /** + * 免打扰时间段的开始时间,精确到小时,取值范围为 [0,23]。例如 “8” 表示每日 8:00 开启免打扰模式 + * @return notificationNoDisturbingStart + **/ + @javax.annotation.Nullable + public String getNotificationNoDisturbingStart() { + return notificationNoDisturbingStart; + } + + + public void setNotificationNoDisturbingStart(String notificationNoDisturbingStart) { + this.notificationNoDisturbingStart = notificationNoDisturbingStart; + } + + + public EMSetOfflinePushOld notificationNoDisturbingEnd(String notificationNoDisturbingEnd) { + + this.notificationNoDisturbingEnd = notificationNoDisturbingEnd; + return this; + } + + /** + * 免打扰时间段的结束时间,精确到小时,取值范围为 [0,23]。例如 “18” 表示每日 18:00 关闭免打扰模式 + * @return notificationNoDisturbingEnd + **/ + @javax.annotation.Nullable + public String getNotificationNoDisturbingEnd() { + return notificationNoDisturbingEnd; + } + + + public void setNotificationNoDisturbingEnd(String notificationNoDisturbingEnd) { + this.notificationNoDisturbingEnd = notificationNoDisturbingEnd; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSetOfflinePushOld setOfflinePushOld = (EMSetOfflinePushOld) o; + return Objects.equals(this.nickname, setOfflinePushOld.nickname) && + Objects.equals(this.notificationDisplayStyle, setOfflinePushOld.notificationDisplayStyle) && + Objects.equals(this.notificationNoDisturbing, setOfflinePushOld.notificationNoDisturbing) && + Objects.equals(this.notificationNoDisturbingStart, setOfflinePushOld.notificationNoDisturbingStart) && + Objects.equals(this.notificationNoDisturbingEnd, setOfflinePushOld.notificationNoDisturbingEnd); + } + + @Override + public int hashCode() { + return Objects.hash(nickname, notificationDisplayStyle, notificationNoDisturbing, notificationNoDisturbingStart, notificationNoDisturbingEnd); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSetOfflinePushOld {\n"); + sb.append(" nickname: ").append(toIndentedString(nickname)).append("\n"); + sb.append(" notificationDisplayStyle: ").append(toIndentedString(notificationDisplayStyle)).append("\n"); + sb.append(" notificationNoDisturbing: ").append(toIndentedString(notificationNoDisturbing)).append("\n"); + sb.append(" notificationNoDisturbingStart: ").append(toIndentedString(notificationNoDisturbingStart)).append("\n"); + sb.append(" notificationNoDisturbingEnd: ").append(toIndentedString(notificationNoDisturbingEnd)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("nickname"); + openapiFields.add("notification_display_style"); + openapiFields.add("notification_no_disturbing"); + openapiFields.add("notification_no_disturbing_start"); + openapiFields.add("notification_no_disturbing_end"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSetOfflinePushOld + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSetOfflinePushOld.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSetOfflinePushOld is not found in the empty JSON string", EMSetOfflinePushOld.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSetOfflinePushOld.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSetOfflinePushOld` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("nickname") != null && !jsonObj.get("nickname").isJsonNull()) && !jsonObj.get("nickname").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nickname` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nickname").toString())); + } + if ((jsonObj.get("notification_no_disturbing_start") != null && !jsonObj.get("notification_no_disturbing_start").isJsonNull()) && !jsonObj.get("notification_no_disturbing_start").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `notification_no_disturbing_start` to be a primitive type in the JSON string but got `%s`", jsonObj.get("notification_no_disturbing_start").toString())); + } + if ((jsonObj.get("notification_no_disturbing_end") != null && !jsonObj.get("notification_no_disturbing_end").isJsonNull()) && !jsonObj.get("notification_no_disturbing_end").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `notification_no_disturbing_end` to be a primitive type in the JSON string but got `%s`", jsonObj.get("notification_no_disturbing_end").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSetOfflinePushOld.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSetOfflinePushOld' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSetOfflinePushOld.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSetOfflinePushOld value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSetOfflinePushOld read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSetOfflinePushOld given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSetOfflinePushOld + * @throws IOException if the JSON string is invalid with respect to EMSetOfflinePushOld + */ + public static EMSetOfflinePushOld fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSetOfflinePushOld.class); + } + + /** + * Convert an instance of EMSetOfflinePushOld to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSetPushBindingInfo.java b/src/main/java/com/easemob/im/api/model/EMSetPushBindingInfo.java new file mode 100644 index 000000000..c923921a0 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSetPushBindingInfo.java @@ -0,0 +1,270 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSetPushBindingInfo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSetPushBindingInfo { + public static final String SERIALIZED_NAME_DEVICE_ID = "device_id"; + @SerializedName(SERIALIZED_NAME_DEVICE_ID) + private String deviceId; + + public static final String SERIALIZED_NAME_NOTIFIER_NAME = "notifier_name"; + @SerializedName(SERIALIZED_NAME_NOTIFIER_NAME) + private String notifierName; + + public static final String SERIALIZED_NAME_DEVICE_TOKEN = "device_token"; + @SerializedName(SERIALIZED_NAME_DEVICE_TOKEN) + private String deviceToken; + + public EMSetPushBindingInfo() { + } + + public EMSetPushBindingInfo deviceId(String deviceId) { + + this.deviceId = deviceId; + return this; + } + + /** + * 移动端设备标识,服务端用于识别设备,进行推送信息的绑定和解绑 + * @return deviceId + **/ + @javax.annotation.Nullable + public String getDeviceId() { + return deviceId; + } + + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + + public EMSetPushBindingInfo notifierName(String notifierName) { + + this.notifierName = notifierName; + return this; + } + + /** + * 推送证书名称。 - 传入的证书名称必需与你在环信控制台的添加推送证书页面上填写的证书名称一致,否则推送失败 - 若 notifier_name 为空,表示解除当前设备与所有推送信息的绑定 + * @return notifierName + **/ + @javax.annotation.Nullable + public String getNotifierName() { + return notifierName; + } + + + public void setNotifierName(String notifierName) { + this.notifierName = notifierName; + } + + + public EMSetPushBindingInfo deviceToken(String deviceToken) { + + this.deviceToken = deviceToken; + return this; + } + + /** + * 推送设备 token。错误的信息会推送失败,且服务端自动解除绑定。若 device_token 为空,则会解除当前用户当前设备 ID 和当前证书名的绑定 + * @return deviceToken + **/ + @javax.annotation.Nullable + public String getDeviceToken() { + return deviceToken; + } + + + public void setDeviceToken(String deviceToken) { + this.deviceToken = deviceToken; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSetPushBindingInfo setPushBindingInfo = (EMSetPushBindingInfo) o; + return Objects.equals(this.deviceId, setPushBindingInfo.deviceId) && + Objects.equals(this.notifierName, setPushBindingInfo.notifierName) && + Objects.equals(this.deviceToken, setPushBindingInfo.deviceToken); + } + + @Override + public int hashCode() { + return Objects.hash(deviceId, notifierName, deviceToken); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSetPushBindingInfo {\n"); + sb.append(" deviceId: ").append(toIndentedString(deviceId)).append("\n"); + sb.append(" notifierName: ").append(toIndentedString(notifierName)).append("\n"); + sb.append(" deviceToken: ").append(toIndentedString(deviceToken)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("device_id"); + openapiFields.add("notifier_name"); + openapiFields.add("device_token"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSetPushBindingInfo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSetPushBindingInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSetPushBindingInfo is not found in the empty JSON string", EMSetPushBindingInfo.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSetPushBindingInfo.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSetPushBindingInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("device_id") != null && !jsonObj.get("device_id").isJsonNull()) && !jsonObj.get("device_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `device_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("device_id").toString())); + } + if ((jsonObj.get("notifier_name") != null && !jsonObj.get("notifier_name").isJsonNull()) && !jsonObj.get("notifier_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `notifier_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("notifier_name").toString())); + } + if ((jsonObj.get("device_token") != null && !jsonObj.get("device_token").isJsonNull()) && !jsonObj.get("device_token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `device_token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("device_token").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSetPushBindingInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSetPushBindingInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSetPushBindingInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSetPushBindingInfo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSetPushBindingInfo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSetPushBindingInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSetPushBindingInfo + * @throws IOException if the JSON string is invalid with respect to EMSetPushBindingInfo + */ + public static EMSetPushBindingInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSetPushBindingInfo.class); + } + + /** + * Convert an instance of EMSetPushBindingInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSetPushBindingInfoResult.java b/src/main/java/com/easemob/im/api/model/EMSetPushBindingInfoResult.java new file mode 100644 index 000000000..1a3db8a67 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSetPushBindingInfoResult.java @@ -0,0 +1,230 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMPushBindingInfoResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSetPushBindingInfoResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSetPushBindingInfoResult { + public static final String SERIALIZED_NAME_ENTITIES = "entities"; + @SerializedName(SERIALIZED_NAME_ENTITIES) + private List entities; + + public EMSetPushBindingInfoResult() { + } + + public EMSetPushBindingInfoResult entities(List entities) { + + this.entities = entities; + return this; + } + + public EMSetPushBindingInfoResult addEntitiesItem(EMPushBindingInfoResource entitiesItem) { + if (this.entities == null) { + this.entities = new ArrayList<>(); + } + this.entities.add(entitiesItem); + return this; + } + + /** + * Get entities + * @return entities + **/ + @javax.annotation.Nullable + public List getEntities() { + return entities; + } + + + public void setEntities(List entities) { + this.entities = entities; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSetPushBindingInfoResult setPushBindingInfoResult = (EMSetPushBindingInfoResult) o; + return Objects.equals(this.entities, setPushBindingInfoResult.entities); + } + + @Override + public int hashCode() { + return Objects.hash(entities); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSetPushBindingInfoResult {\n"); + sb.append(" entities: ").append(toIndentedString(entities)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("entities"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSetPushBindingInfoResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSetPushBindingInfoResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSetPushBindingInfoResult is not found in the empty JSON string", EMSetPushBindingInfoResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSetPushBindingInfoResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSetPushBindingInfoResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("entities") != null && !jsonObj.get("entities").isJsonNull()) { + JsonArray jsonArrayentities = jsonObj.getAsJsonArray("entities"); + if (jsonArrayentities != null) { + // ensure the json data is an array + if (!jsonObj.get("entities").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `entities` to be an array in the JSON string but got `%s`", jsonObj.get("entities").toString())); + } + + // validate the optional field `entities` (array) + for (int i = 0; i < jsonArrayentities.size(); i++) { + EMPushBindingInfoResource.validateJsonElement(jsonArrayentities.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSetPushBindingInfoResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSetPushBindingInfoResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSetPushBindingInfoResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSetPushBindingInfoResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSetPushBindingInfoResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSetPushBindingInfoResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSetPushBindingInfoResult + * @throws IOException if the JSON string is invalid with respect to EMSetPushBindingInfoResult + */ + public static EMSetPushBindingInfoResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSetPushBindingInfoResult.class); + } + + /** + * Convert an instance of EMSetPushBindingInfoResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSetPushPreferredLanguage.java b/src/main/java/com/easemob/im/api/model/EMSetPushPreferredLanguage.java new file mode 100644 index 000000000..aebc4647d --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSetPushPreferredLanguage.java @@ -0,0 +1,208 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSetPushPreferredLanguage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSetPushPreferredLanguage { + public static final String SERIALIZED_NAME_TRANSLATION_LANGUAGE = "translationLanguage"; + @SerializedName(SERIALIZED_NAME_TRANSLATION_LANGUAGE) + private String translationLanguage; + + public EMSetPushPreferredLanguage() { + } + + public EMSetPushPreferredLanguage translationLanguage(String translationLanguage) { + + this.translationLanguage = translationLanguage; + return this; + } + + /** + * 用户接收的推送通知的首选语言的代码。如果设置为空字符串,表示无需翻译,服务器直接推送原语言的通知 + * @return translationLanguage + **/ + @javax.annotation.Nullable + public String getTranslationLanguage() { + return translationLanguage; + } + + + public void setTranslationLanguage(String translationLanguage) { + this.translationLanguage = translationLanguage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSetPushPreferredLanguage setPushPreferredLanguage = (EMSetPushPreferredLanguage) o; + return Objects.equals(this.translationLanguage, setPushPreferredLanguage.translationLanguage); + } + + @Override + public int hashCode() { + return Objects.hash(translationLanguage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSetPushPreferredLanguage {\n"); + sb.append(" translationLanguage: ").append(toIndentedString(translationLanguage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("translationLanguage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSetPushPreferredLanguage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSetPushPreferredLanguage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSetPushPreferredLanguage is not found in the empty JSON string", EMSetPushPreferredLanguage.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSetPushPreferredLanguage.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSetPushPreferredLanguage` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("translationLanguage") != null && !jsonObj.get("translationLanguage").isJsonNull()) && !jsonObj.get("translationLanguage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `translationLanguage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("translationLanguage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSetPushPreferredLanguage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSetPushPreferredLanguage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSetPushPreferredLanguage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSetPushPreferredLanguage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSetPushPreferredLanguage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSetPushPreferredLanguage given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSetPushPreferredLanguage + * @throws IOException if the JSON string is invalid with respect to EMSetPushPreferredLanguage + */ + public static EMSetPushPreferredLanguage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSetPushPreferredLanguage.class); + } + + /** + * Convert an instance of EMSetPushPreferredLanguage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSetPushPreferredLanguageResult.java b/src/main/java/com/easemob/im/api/model/EMSetPushPreferredLanguageResult.java new file mode 100644 index 000000000..8693ca60b --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSetPushPreferredLanguageResult.java @@ -0,0 +1,210 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMPushPreferredLanguageResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSetPushPreferredLanguageResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSetPushPreferredLanguageResult { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private EMPushPreferredLanguageResource data; + + public EMSetPushPreferredLanguageResult() { + } + + public EMSetPushPreferredLanguageResult data(EMPushPreferredLanguageResource data) { + + this.data = data; + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public EMPushPreferredLanguageResource getData() { + return data; + } + + + public void setData(EMPushPreferredLanguageResource data) { + this.data = data; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSetPushPreferredLanguageResult setPushPreferredLanguageResult = (EMSetPushPreferredLanguageResult) o; + return Objects.equals(this.data, setPushPreferredLanguageResult.data); + } + + @Override + public int hashCode() { + return Objects.hash(data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSetPushPreferredLanguageResult {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("data"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSetPushPreferredLanguageResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSetPushPreferredLanguageResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSetPushPreferredLanguageResult is not found in the empty JSON string", EMSetPushPreferredLanguageResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSetPushPreferredLanguageResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSetPushPreferredLanguageResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + EMPushPreferredLanguageResource.validateJsonElement(jsonObj.get("data")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSetPushPreferredLanguageResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSetPushPreferredLanguageResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSetPushPreferredLanguageResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSetPushPreferredLanguageResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSetPushPreferredLanguageResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSetPushPreferredLanguageResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSetPushPreferredLanguageResult + * @throws IOException if the JSON string is invalid with respect to EMSetPushPreferredLanguageResult + */ + public static EMSetPushPreferredLanguageResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSetPushPreferredLanguageResult.class); + } + + /** + * Convert an instance of EMSetPushPreferredLanguageResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSetReaction.java b/src/main/java/com/easemob/im/api/model/EMSetReaction.java new file mode 100644 index 000000000..e93e90d96 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSetReaction.java @@ -0,0 +1,239 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSetReaction + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSetReaction { + public static final String SERIALIZED_NAME_MSG_ID = "msgId"; + @SerializedName(SERIALIZED_NAME_MSG_ID) + private String msgId; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + + public EMSetReaction() { + } + + public EMSetReaction msgId(String msgId) { + + this.msgId = msgId; + return this; + } + + /** + * 消息 ID + * @return msgId + **/ + @javax.annotation.Nullable + public String getMsgId() { + return msgId; + } + + + public void setMsgId(String msgId) { + this.msgId = msgId; + } + + + public EMSetReaction message(String message) { + + this.message = message; + return this; + } + + /** + * 表情 ID。长度不能超过 128 个字符,必须与客户端的设置一致。该参数对支持的字符集类型没有限制,若使用特殊字符,获取和删除 Reaction 时需对特殊字符进行 URL 编码 + * @return message + **/ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSetReaction setReaction = (EMSetReaction) o; + return Objects.equals(this.msgId, setReaction.msgId) && + Objects.equals(this.message, setReaction.message); + } + + @Override + public int hashCode() { + return Objects.hash(msgId, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSetReaction {\n"); + sb.append(" msgId: ").append(toIndentedString(msgId)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("msgId"); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSetReaction + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSetReaction.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSetReaction is not found in the empty JSON string", EMSetReaction.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSetReaction.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSetReaction` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("msgId") != null && !jsonObj.get("msgId").isJsonNull()) && !jsonObj.get("msgId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `msgId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("msgId").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSetReaction.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSetReaction' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSetReaction.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSetReaction value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSetReaction read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSetReaction given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSetReaction + * @throws IOException if the JSON string is invalid with respect to EMSetReaction + */ + public static EMSetReaction fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSetReaction.class); + } + + /** + * Convert an instance of EMSetReaction to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSetReactionResult.java b/src/main/java/com/easemob/im/api/model/EMSetReactionResult.java new file mode 100644 index 000000000..5ac1db9a7 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSetReactionResult.java @@ -0,0 +1,208 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSetReactionResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSetReactionResult { + public static final String SERIALIZED_NAME_REQUEST_STATUS_CODE = "requestStatusCode"; + @SerializedName(SERIALIZED_NAME_REQUEST_STATUS_CODE) + private String requestStatusCode; + + public EMSetReactionResult() { + } + + public EMSetReactionResult requestStatusCode(String requestStatusCode) { + + this.requestStatusCode = requestStatusCode; + return this; + } + + /** + * Get requestStatusCode + * @return requestStatusCode + **/ + @javax.annotation.Nullable + public String getRequestStatusCode() { + return requestStatusCode; + } + + + public void setRequestStatusCode(String requestStatusCode) { + this.requestStatusCode = requestStatusCode; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSetReactionResult setReactionResult = (EMSetReactionResult) o; + return Objects.equals(this.requestStatusCode, setReactionResult.requestStatusCode); + } + + @Override + public int hashCode() { + return Objects.hash(requestStatusCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSetReactionResult {\n"); + sb.append(" requestStatusCode: ").append(toIndentedString(requestStatusCode)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("requestStatusCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSetReactionResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSetReactionResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSetReactionResult is not found in the empty JSON string", EMSetReactionResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSetReactionResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSetReactionResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("requestStatusCode") != null && !jsonObj.get("requestStatusCode").isJsonNull()) && !jsonObj.get("requestStatusCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `requestStatusCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("requestStatusCode").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSetReactionResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSetReactionResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSetReactionResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSetReactionResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSetReactionResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSetReactionResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSetReactionResult + * @throws IOException if the JSON string is invalid with respect to EMSetReactionResult + */ + public static EMSetReactionResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSetReactionResult.class); + } + + /** + * Convert an instance of EMSetReactionResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSetUserPresenceStatus.java b/src/main/java/com/easemob/im/api/model/EMSetUserPresenceStatus.java new file mode 100644 index 000000000..83b621224 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSetUserPresenceStatus.java @@ -0,0 +1,208 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSetUserPresenceStatus + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSetUserPresenceStatus { + public static final String SERIALIZED_NAME_EXT = "ext"; + @SerializedName(SERIALIZED_NAME_EXT) + private String ext; + + public EMSetUserPresenceStatus() { + } + + public EMSetUserPresenceStatus ext(String ext) { + + this.ext = ext; + return this; + } + + /** + * 在线状态扩展信息。建议不超过 64 字节 + * @return ext + **/ + @javax.annotation.Nullable + public String getExt() { + return ext; + } + + + public void setExt(String ext) { + this.ext = ext; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSetUserPresenceStatus setUserPresenceStatus = (EMSetUserPresenceStatus) o; + return Objects.equals(this.ext, setUserPresenceStatus.ext); + } + + @Override + public int hashCode() { + return Objects.hash(ext); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSetUserPresenceStatus {\n"); + sb.append(" ext: ").append(toIndentedString(ext)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("ext"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSetUserPresenceStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSetUserPresenceStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSetUserPresenceStatus is not found in the empty JSON string", EMSetUserPresenceStatus.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSetUserPresenceStatus.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSetUserPresenceStatus` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("ext") != null && !jsonObj.get("ext").isJsonNull()) && !jsonObj.get("ext").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ext` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ext").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSetUserPresenceStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSetUserPresenceStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSetUserPresenceStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSetUserPresenceStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSetUserPresenceStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSetUserPresenceStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSetUserPresenceStatus + * @throws IOException if the JSON string is invalid with respect to EMSetUserPresenceStatus + */ + public static EMSetUserPresenceStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSetUserPresenceStatus.class); + } + + /** + * Convert an instance of EMSetUserPresenceStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSetUserPresenceStatusResult.java b/src/main/java/com/easemob/im/api/model/EMSetUserPresenceStatusResult.java new file mode 100644 index 000000000..f027bfc12 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSetUserPresenceStatusResult.java @@ -0,0 +1,208 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSetUserPresenceStatusResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSetUserPresenceStatusResult { + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + private String result; + + public EMSetUserPresenceStatusResult() { + } + + public EMSetUserPresenceStatusResult result(String result) { + + this.result = result; + return this; + } + + /** + * Get result + * @return result + **/ + @javax.annotation.Nullable + public String getResult() { + return result; + } + + + public void setResult(String result) { + this.result = result; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSetUserPresenceStatusResult setUserPresenceStatusResult = (EMSetUserPresenceStatusResult) o; + return Objects.equals(this.result, setUserPresenceStatusResult.result); + } + + @Override + public int hashCode() { + return Objects.hash(result); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSetUserPresenceStatusResult {\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("result"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSetUserPresenceStatusResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSetUserPresenceStatusResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSetUserPresenceStatusResult is not found in the empty JSON string", EMSetUserPresenceStatusResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSetUserPresenceStatusResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSetUserPresenceStatusResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) && !jsonObj.get("result").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `result` to be a primitive type in the JSON string but got `%s`", jsonObj.get("result").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSetUserPresenceStatusResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSetUserPresenceStatusResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSetUserPresenceStatusResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSetUserPresenceStatusResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSetUserPresenceStatusResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSetUserPresenceStatusResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSetUserPresenceStatusResult + * @throws IOException if the JSON string is invalid with respect to EMSetUserPresenceStatusResult + */ + public static EMSetUserPresenceStatusResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSetUserPresenceStatusResult.class); + } + + /** + * Convert an instance of EMSetUserPresenceStatusResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSubscribeMultipleUsersPresenceStatus.java b/src/main/java/com/easemob/im/api/model/EMSubscribeMultipleUsersPresenceStatus.java new file mode 100644 index 000000000..e081e7bad --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSubscribeMultipleUsersPresenceStatus.java @@ -0,0 +1,219 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSubscribeMultipleUsersPresenceStatus + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSubscribeMultipleUsersPresenceStatus { + public static final String SERIALIZED_NAME_USERNAMES = "usernames"; + @SerializedName(SERIALIZED_NAME_USERNAMES) + private List usernames; + + public EMSubscribeMultipleUsersPresenceStatus() { + } + + public EMSubscribeMultipleUsersPresenceStatus usernames(List usernames) { + + this.usernames = usernames; + return this; + } + + public EMSubscribeMultipleUsersPresenceStatus addUsernamesItem(String usernamesItem) { + if (this.usernames == null) { + this.usernames = new ArrayList<>(); + } + this.usernames.add(usernamesItem); + return this; + } + + /** + * 被订阅用户的用户 ID 数组,例如 [\"user1\", \"user2\"]。该数组最多可包含 100 个用户 ID + * @return usernames + **/ + @javax.annotation.Nullable + public List getUsernames() { + return usernames; + } + + + public void setUsernames(List usernames) { + this.usernames = usernames; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSubscribeMultipleUsersPresenceStatus subscribeMultipleUsersPresenceStatus = (EMSubscribeMultipleUsersPresenceStatus) o; + return Objects.equals(this.usernames, subscribeMultipleUsersPresenceStatus.usernames); + } + + @Override + public int hashCode() { + return Objects.hash(usernames); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSubscribeMultipleUsersPresenceStatus {\n"); + sb.append(" usernames: ").append(toIndentedString(usernames)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("usernames"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSubscribeMultipleUsersPresenceStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSubscribeMultipleUsersPresenceStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSubscribeMultipleUsersPresenceStatus is not found in the empty JSON string", EMSubscribeMultipleUsersPresenceStatus.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSubscribeMultipleUsersPresenceStatus.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSubscribeMultipleUsersPresenceStatus` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("usernames") != null && !jsonObj.get("usernames").isJsonNull() && !jsonObj.get("usernames").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `usernames` to be an array in the JSON string but got `%s`", jsonObj.get("usernames").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSubscribeMultipleUsersPresenceStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSubscribeMultipleUsersPresenceStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSubscribeMultipleUsersPresenceStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSubscribeMultipleUsersPresenceStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSubscribeMultipleUsersPresenceStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSubscribeMultipleUsersPresenceStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSubscribeMultipleUsersPresenceStatus + * @throws IOException if the JSON string is invalid with respect to EMSubscribeMultipleUsersPresenceStatus + */ + public static EMSubscribeMultipleUsersPresenceStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSubscribeMultipleUsersPresenceStatus.class); + } + + /** + * Convert an instance of EMSubscribeMultipleUsersPresenceStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSubscribeMultipleUsersPresenceStatusResource.java b/src/main/java/com/easemob/im/api/model/EMSubscribeMultipleUsersPresenceStatusResource.java new file mode 100644 index 000000000..7475c023e --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSubscribeMultipleUsersPresenceStatusResource.java @@ -0,0 +1,324 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSubscribeMultipleUsersPresenceStatusResource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSubscribeMultipleUsersPresenceStatusResource { + public static final String SERIALIZED_NAME_UID = "uid"; + @SerializedName(SERIALIZED_NAME_UID) + private String uid; + + public static final String SERIALIZED_NAME_LAST_TIME = "last_time"; + @SerializedName(SERIALIZED_NAME_LAST_TIME) + private BigDecimal lastTime; + + public static final String SERIALIZED_NAME_EXPIRY = "expiry"; + @SerializedName(SERIALIZED_NAME_EXPIRY) + private BigDecimal expiry; + + public static final String SERIALIZED_NAME_EXT = "ext"; + @SerializedName(SERIALIZED_NAME_EXT) + private String ext; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private Object status; + + public EMSubscribeMultipleUsersPresenceStatusResource() { + } + + public EMSubscribeMultipleUsersPresenceStatusResource uid(String uid) { + + this.uid = uid; + return this; + } + + /** + * 用户在即时通讯服务器的唯一 ID + * @return uid + **/ + @javax.annotation.Nullable + public String getUid() { + return uid; + } + + + public void setUid(String uid) { + this.uid = uid; + } + + + public EMSubscribeMultipleUsersPresenceStatusResource lastTime(BigDecimal lastTime) { + + this.lastTime = lastTime; + return this; + } + + /** + * 被订阅用户的最近在线时间,Unix 时间戳,单位为秒。服务端会在被订阅的用户登录和登出时记录该时间 + * @return lastTime + **/ + @javax.annotation.Nullable + public BigDecimal getLastTime() { + return lastTime; + } + + + public void setLastTime(BigDecimal lastTime) { + this.lastTime = lastTime; + } + + + public EMSubscribeMultipleUsersPresenceStatusResource expiry(BigDecimal expiry) { + + this.expiry = expiry; + return this; + } + + /** + * 订阅过期的 Unix 时间戳,单位为秒 + * @return expiry + **/ + @javax.annotation.Nullable + public BigDecimal getExpiry() { + return expiry; + } + + + public void setExpiry(BigDecimal expiry) { + this.expiry = expiry; + } + + + public EMSubscribeMultipleUsersPresenceStatusResource ext(String ext) { + + this.ext = ext; + return this; + } + + /** + * 被订阅用户的在线状态扩展信息 + * @return ext + **/ + @javax.annotation.Nullable + public String getExt() { + return ext; + } + + + public void setExt(String ext) { + this.ext = ext; + } + + + public EMSubscribeMultipleUsersPresenceStatusResource status(Object status) { + + this.status = status; + return this; + } + + /** + * 被订阅用户在多端的状态: - 0: 离线。 - 1: 在线。 - 其他值:用户自定义的在线状态 + * @return status + **/ + @javax.annotation.Nullable + public Object getStatus() { + return status; + } + + + public void setStatus(Object status) { + this.status = status; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSubscribeMultipleUsersPresenceStatusResource subscribeMultipleUsersPresenceStatusResource = (EMSubscribeMultipleUsersPresenceStatusResource) o; + return Objects.equals(this.uid, subscribeMultipleUsersPresenceStatusResource.uid) && + Objects.equals(this.lastTime, subscribeMultipleUsersPresenceStatusResource.lastTime) && + Objects.equals(this.expiry, subscribeMultipleUsersPresenceStatusResource.expiry) && + Objects.equals(this.ext, subscribeMultipleUsersPresenceStatusResource.ext) && + Objects.equals(this.status, subscribeMultipleUsersPresenceStatusResource.status); + } + + @Override + public int hashCode() { + return Objects.hash(uid, lastTime, expiry, ext, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSubscribeMultipleUsersPresenceStatusResource {\n"); + sb.append(" uid: ").append(toIndentedString(uid)).append("\n"); + sb.append(" lastTime: ").append(toIndentedString(lastTime)).append("\n"); + sb.append(" expiry: ").append(toIndentedString(expiry)).append("\n"); + sb.append(" ext: ").append(toIndentedString(ext)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("uid"); + openapiFields.add("last_time"); + openapiFields.add("expiry"); + openapiFields.add("ext"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSubscribeMultipleUsersPresenceStatusResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSubscribeMultipleUsersPresenceStatusResource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSubscribeMultipleUsersPresenceStatusResource is not found in the empty JSON string", EMSubscribeMultipleUsersPresenceStatusResource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSubscribeMultipleUsersPresenceStatusResource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSubscribeMultipleUsersPresenceStatusResource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("uid") != null && !jsonObj.get("uid").isJsonNull()) && !jsonObj.get("uid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uid").toString())); + } + if ((jsonObj.get("ext") != null && !jsonObj.get("ext").isJsonNull()) && !jsonObj.get("ext").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ext` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ext").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSubscribeMultipleUsersPresenceStatusResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSubscribeMultipleUsersPresenceStatusResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSubscribeMultipleUsersPresenceStatusResource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSubscribeMultipleUsersPresenceStatusResource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSubscribeMultipleUsersPresenceStatusResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSubscribeMultipleUsersPresenceStatusResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSubscribeMultipleUsersPresenceStatusResource + * @throws IOException if the JSON string is invalid with respect to EMSubscribeMultipleUsersPresenceStatusResource + */ + public static EMSubscribeMultipleUsersPresenceStatusResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSubscribeMultipleUsersPresenceStatusResource.class); + } + + /** + * Convert an instance of EMSubscribeMultipleUsersPresenceStatusResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMSubscribeMultipleUsersPresenceStatusResult.java b/src/main/java/com/easemob/im/api/model/EMSubscribeMultipleUsersPresenceStatusResult.java new file mode 100644 index 000000000..a6cc213c8 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMSubscribeMultipleUsersPresenceStatusResult.java @@ -0,0 +1,230 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.easemob.im.api.model.EMSubscribeMultipleUsersPresenceStatusResource; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMSubscribeMultipleUsersPresenceStatusResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMSubscribeMultipleUsersPresenceStatusResult { + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + private List result; + + public EMSubscribeMultipleUsersPresenceStatusResult() { + } + + public EMSubscribeMultipleUsersPresenceStatusResult result(List result) { + + this.result = result; + return this; + } + + public EMSubscribeMultipleUsersPresenceStatusResult addResultItem(EMSubscribeMultipleUsersPresenceStatusResource resultItem) { + if (this.result == null) { + this.result = new ArrayList<>(); + } + this.result.add(resultItem); + return this; + } + + /** + * Get result + * @return result + **/ + @javax.annotation.Nullable + public List getResult() { + return result; + } + + + public void setResult(List result) { + this.result = result; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMSubscribeMultipleUsersPresenceStatusResult subscribeMultipleUsersPresenceStatusResult = (EMSubscribeMultipleUsersPresenceStatusResult) o; + return Objects.equals(this.result, subscribeMultipleUsersPresenceStatusResult.result); + } + + @Override + public int hashCode() { + return Objects.hash(result); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMSubscribeMultipleUsersPresenceStatusResult {\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("result"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMSubscribeMultipleUsersPresenceStatusResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMSubscribeMultipleUsersPresenceStatusResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMSubscribeMultipleUsersPresenceStatusResult is not found in the empty JSON string", EMSubscribeMultipleUsersPresenceStatusResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMSubscribeMultipleUsersPresenceStatusResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMSubscribeMultipleUsersPresenceStatusResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) { + JsonArray jsonArrayresult = jsonObj.getAsJsonArray("result"); + if (jsonArrayresult != null) { + // ensure the json data is an array + if (!jsonObj.get("result").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `result` to be an array in the JSON string but got `%s`", jsonObj.get("result").toString())); + } + + // validate the optional field `result` (array) + for (int i = 0; i < jsonArrayresult.size(); i++) { + EMSubscribeMultipleUsersPresenceStatusResource.validateJsonElement(jsonArrayresult.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMSubscribeMultipleUsersPresenceStatusResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMSubscribeMultipleUsersPresenceStatusResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMSubscribeMultipleUsersPresenceStatusResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMSubscribeMultipleUsersPresenceStatusResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMSubscribeMultipleUsersPresenceStatusResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMSubscribeMultipleUsersPresenceStatusResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMSubscribeMultipleUsersPresenceStatusResult + * @throws IOException if the JSON string is invalid with respect to EMSubscribeMultipleUsersPresenceStatusResult + */ + public static EMSubscribeMultipleUsersPresenceStatusResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMSubscribeMultipleUsersPresenceStatusResult.class); + } + + /** + * Convert an instance of EMSubscribeMultipleUsersPresenceStatusResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMUnsubscribeMultipleUsersPresenceStatusResult.java b/src/main/java/com/easemob/im/api/model/EMUnsubscribeMultipleUsersPresenceStatusResult.java new file mode 100644 index 000000000..25a19f6f1 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMUnsubscribeMultipleUsersPresenceStatusResult.java @@ -0,0 +1,208 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMUnsubscribeMultipleUsersPresenceStatusResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMUnsubscribeMultipleUsersPresenceStatusResult { + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + private String result; + + public EMUnsubscribeMultipleUsersPresenceStatusResult() { + } + + public EMUnsubscribeMultipleUsersPresenceStatusResult result(String result) { + + this.result = result; + return this; + } + + /** + * Get result + * @return result + **/ + @javax.annotation.Nullable + public String getResult() { + return result; + } + + + public void setResult(String result) { + this.result = result; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMUnsubscribeMultipleUsersPresenceStatusResult unsubscribeMultipleUsersPresenceStatusResult = (EMUnsubscribeMultipleUsersPresenceStatusResult) o; + return Objects.equals(this.result, unsubscribeMultipleUsersPresenceStatusResult.result); + } + + @Override + public int hashCode() { + return Objects.hash(result); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMUnsubscribeMultipleUsersPresenceStatusResult {\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("result"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMUnsubscribeMultipleUsersPresenceStatusResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMUnsubscribeMultipleUsersPresenceStatusResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMUnsubscribeMultipleUsersPresenceStatusResult is not found in the empty JSON string", EMUnsubscribeMultipleUsersPresenceStatusResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMUnsubscribeMultipleUsersPresenceStatusResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMUnsubscribeMultipleUsersPresenceStatusResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) && !jsonObj.get("result").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `result` to be a primitive type in the JSON string but got `%s`", jsonObj.get("result").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMUnsubscribeMultipleUsersPresenceStatusResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMUnsubscribeMultipleUsersPresenceStatusResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMUnsubscribeMultipleUsersPresenceStatusResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMUnsubscribeMultipleUsersPresenceStatusResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMUnsubscribeMultipleUsersPresenceStatusResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMUnsubscribeMultipleUsersPresenceStatusResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMUnsubscribeMultipleUsersPresenceStatusResult + * @throws IOException if the JSON string is invalid with respect to EMUnsubscribeMultipleUsersPresenceStatusResult + */ + public static EMUnsubscribeMultipleUsersPresenceStatusResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMUnsubscribeMultipleUsersPresenceStatusResult.class); + } + + /** + * Convert an instance of EMUnsubscribeMultipleUsersPresenceStatusResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/easemob/im/api/model/EMUserSubscriptionResource.java b/src/main/java/com/easemob/im/api/model/EMUserSubscriptionResource.java new file mode 100644 index 000000000..6bb88aa62 --- /dev/null +++ b/src/main/java/com/easemob/im/api/model/EMUserSubscriptionResource.java @@ -0,0 +1,239 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.easemob.im.JSON; + +/** + * EMUserSubscriptionResource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-19T14:46:11.706022+08:00[Asia/Shanghai]") +public class EMUserSubscriptionResource { + public static final String SERIALIZED_NAME_UID = "uid"; + @SerializedName(SERIALIZED_NAME_UID) + private String uid; + + public static final String SERIALIZED_NAME_EXPIRY = "expiry"; + @SerializedName(SERIALIZED_NAME_EXPIRY) + private String expiry; + + public EMUserSubscriptionResource() { + } + + public EMUserSubscriptionResource uid(String uid) { + + this.uid = uid; + return this; + } + + /** + * 当前订阅的用户总数 + * @return uid + **/ + @javax.annotation.Nullable + public String getUid() { + return uid; + } + + + public void setUid(String uid) { + this.uid = uid; + } + + + public EMUserSubscriptionResource expiry(String expiry) { + + this.expiry = expiry; + return this; + } + + /** + * 订阅的过期时间戳,单位为秒 + * @return expiry + **/ + @javax.annotation.Nullable + public String getExpiry() { + return expiry; + } + + + public void setExpiry(String expiry) { + this.expiry = expiry; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EMUserSubscriptionResource userSubscriptionResource = (EMUserSubscriptionResource) o; + return Objects.equals(this.uid, userSubscriptionResource.uid) && + Objects.equals(this.expiry, userSubscriptionResource.expiry); + } + + @Override + public int hashCode() { + return Objects.hash(uid, expiry); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EMUserSubscriptionResource {\n"); + sb.append(" uid: ").append(toIndentedString(uid)).append("\n"); + sb.append(" expiry: ").append(toIndentedString(expiry)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("uid"); + openapiFields.add("expiry"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EMUserSubscriptionResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EMUserSubscriptionResource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EMUserSubscriptionResource is not found in the empty JSON string", EMUserSubscriptionResource.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EMUserSubscriptionResource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMUserSubscriptionResource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("uid") != null && !jsonObj.get("uid").isJsonNull()) && !jsonObj.get("uid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uid").toString())); + } + if ((jsonObj.get("expiry") != null && !jsonObj.get("expiry").isJsonNull()) && !jsonObj.get("expiry").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expiry` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expiry").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EMUserSubscriptionResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EMUserSubscriptionResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EMUserSubscriptionResource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EMUserSubscriptionResource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EMUserSubscriptionResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EMUserSubscriptionResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of EMUserSubscriptionResource + * @throws IOException if the JSON string is invalid with respect to EMUserSubscriptionResource + */ + public static EMUserSubscriptionResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EMUserSubscriptionResource.class); + } + + /** + * Convert an instance of EMUserSubscriptionResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/test/java/com/easemob/im/api/MessageApiTest.java b/src/test/java/com/easemob/im/api/MessageApiTest.java index a298e29d4..b1bef23ac 100644 --- a/src/test/java/com/easemob/im/api/MessageApiTest.java +++ b/src/test/java/com/easemob/im/api/MessageApiTest.java @@ -313,8 +313,6 @@ public void sendMessagesToGroupTest() throws ApiException { EMSendMessageResult response = messageApi.sendMessagesToGroup(emCreateMessage); assertNotNull(response.getData()); - Map data = (Map) response.getData(); - System.out.println("messageId : " + data.get(groupId)); assertDoesNotThrow(() -> userApi.deleteUser(username1)); assertDoesNotThrow(() -> userApi.deleteUser(username2)); @@ -376,8 +374,6 @@ public void sendMessagesToRoomTest() throws ApiException { EMSendMessageResult response = messageApi.sendMessagesToRoom(emCreateMessage); assertNotNull(response.getData()); - Map data = (Map) response.getData(); - System.out.println("messageId : " + data.get(roomId)); assertDoesNotThrow(() -> userApi.deleteUser(username1)); assertDoesNotThrow(() -> userApi.deleteUser(username2)); @@ -424,8 +420,6 @@ public void sendMessagesToUserTest() throws ApiException { EMSendMessageResult response = messageApi.sendMessagesToUser(emCreateMessage); assertNotNull(response.getData()); - Map data = (Map)response.getData(); - System.out.println("messageId : " + data.get(username2)); assertDoesNotThrow(() -> userApi.deleteUser(username1)); assertDoesNotThrow(() -> userApi.deleteUser(username2)); diff --git a/src/test/java/com/easemob/im/api/PresenceApiTest.java b/src/test/java/com/easemob/im/api/PresenceApiTest.java new file mode 100644 index 000000000..0e0393138 --- /dev/null +++ b/src/test/java/com/easemob/im/api/PresenceApiTest.java @@ -0,0 +1,206 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api; + +import com.easemob.im.ApiException; +import com.easemob.im.api.model.EMGetGroupOnlineMemberCountResult; +import com.easemob.im.api.model.EMGetMultipleUsersPresenceStatus; +import com.easemob.im.api.model.EMGetMultipleUsersPresenceStatusResult; +import com.easemob.im.api.model.EMGetUserSubscriptionListResult; +import com.easemob.im.api.model.EMSetUserPresenceStatus; +import com.easemob.im.api.model.EMSetUserPresenceStatusResult; +import com.easemob.im.api.model.EMSubscribeMultipleUsersPresenceStatus; +import com.easemob.im.api.model.EMSubscribeMultipleUsersPresenceStatusResult; +import com.easemob.im.api.model.EMUnsubscribeMultipleUsersPresenceStatusResult; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.*; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * API tests for PresenceApi + */ +@Disabled +public class PresenceApiTest extends AbstractTest { + + private final PresenceApi api = new PresenceApi(); + + private final UserApi userApi = new UserApi(); + + /** + * 查询单个群组的在线成员数量 + * + * 你可以查询单个群组的在线成员数量。如需使用该 API,需要联系环信商务开通。这里的在线状态指用户的 app 与服务器成功建立连接,不包括用户的自定义在线状态,如忙碌、马上回来等。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%9F%A5%E8%AF%A2%E5%8D%95%E4%B8%AA%E7%BE%A4%E7%BB%84%E7%9A%84%E5%9C%A8%E7%BA%BF%E6%88%90%E5%91%98%E6%95%B0%E9%87%8F + * + * @throws ApiException if the Api call fails + */ + @Test + public void getGroupOnlineMemberCountTest() throws ApiException { + String groupId = "123456"; + Integer queryType = 1; +// EMGetGroupOnlineMemberCountResult response = api.getGroupOnlineMemberCount(groupId, queryType); +// System.out.println(response); + } + + /** + * 批量获取在线状态信息 + * + * 你一次可获取多个用户的在线状态信息。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%89%B9%E9%87%8F%E8%8E%B7%E5%8F%96%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81%E4%BF%A1%E6%81%AF + * + * @throws ApiException if the Api call fails + */ + @Test + public void getMultipleUserPresenceStatusTest() throws ApiException { + String username = "tom"; + String resource = "ios_123456"; + String status = "1"; + String ext = "online"; + + EMSetUserPresenceStatus setUserPresenceStatus = new EMSetUserPresenceStatus(); + setUserPresenceStatus.setExt(ext); + assertDoesNotThrow(() -> api.setUserPresenceStatus(username, resource, status, setUserPresenceStatus)); + + EMGetMultipleUsersPresenceStatus emGetMultipleUsersPresenceStatus = new EMGetMultipleUsersPresenceStatus(); + emGetMultipleUsersPresenceStatus.usernames(new ArrayList() {{ + add("jack"); + }}); + + EMGetMultipleUsersPresenceStatusResult result = assertDoesNotThrow(() -> api.getMultipleUserPresenceStatus(username, emGetMultipleUsersPresenceStatus)); + assertNotNull(result); + assertNotNull(result.getResult()); + assertNotNull(result.getResult().get(0)); + assertNotNull(result.getResult().get(0).getUid()); + assertEquals(username, result.getResult().get(0).getUid()); + assertEquals(status, ((Map) result.getResult().get(0).getStatus()).get(resource)); + assertEquals(ext, result.getResult().get(0).getExt()); + } + + /** + * 查询订阅列表 + * + * 查询当前用户已订阅在线状态的用户列表。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%9F%A5%E8%AF%A2%E8%AE%A2%E9%98%85%E5%88%97%E8%A1%A8 + * + * @throws ApiException if the Api call fails + */ + @Test + public void getUserSubscriptionListTest() throws ApiException { + String username1 = "tom1"; + String username2 = "tom2"; + String username3 = "tom3"; + Integer pageNum = 1; + Integer pageSize = 10; + + EMSubscribeMultipleUsersPresenceStatus subscribeMultipleUsersPresenceStatus = new EMSubscribeMultipleUsersPresenceStatus(); + subscribeMultipleUsersPresenceStatus.setUsernames(new ArrayList() {{ + add(username2); + add(username3); + }}); + + assertDoesNotThrow(() -> api.subscribeMultipleUsersPresenceStatus(username1, "36000", subscribeMultipleUsersPresenceStatus)); + + EMGetUserSubscriptionListResult result = assertDoesNotThrow(() -> api.getUserSubscriptionList(username1, pageNum, pageSize)); + assertNotNull(result); + assertNotNull(result.getResult()); + assertNotNull(result.getResult().getSublist()); + assertEquals(2, result.getResult().getTotalnum()); + assertEquals(2, result.getResult().getSublist().size()); + } + + /** + * 设置用户在线状态信息 + * + * 可以设置用户在指定设备的在线状态信息。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E8%AE%BE%E7%BD%AE%E7%94%A8%E6%88%B7%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81%E4%BF%A1%E6%81%AF + * + * @throws ApiException if the Api call fails + */ + @Test + public void setUserPresenceStatusTest() throws ApiException { + String username = "tom"; + String resource = "ios_123456"; + String status = "1"; + EMSetUserPresenceStatus emSetUserPresenceStatus = new EMSetUserPresenceStatus(); + emSetUserPresenceStatus.setExt("ext"); + + EMSetUserPresenceStatusResult result = assertDoesNotThrow(() -> api.setUserPresenceStatus(username, resource, status, emSetUserPresenceStatus)); + assertNotNull(result); + assertNotNull(result.getResult()); + assertEquals("ok", result.getResult()); + } + + /** + * 批量订阅在线状态 + * + * 一次可订阅多个用户的在线状态。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E6%89%B9%E9%87%8F%E8%AE%A2%E9%98%85%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81 + * + * @throws ApiException if the Api call fails + */ + @Test + public void subscribeMultipleUsersPresenceStatusTest() throws ApiException { + String username1 = "tom"; + String username2 = "jack"; + String expiry = "36000"; + EMSubscribeMultipleUsersPresenceStatus subscribeMultipleUsersPresenceStatus = new EMSubscribeMultipleUsersPresenceStatus(); + subscribeMultipleUsersPresenceStatus.setUsernames(new ArrayList() {{ + add(username2); + }}); + EMSubscribeMultipleUsersPresenceStatusResult result = assertDoesNotThrow(() -> api.subscribeMultipleUsersPresenceStatus(username1, expiry, subscribeMultipleUsersPresenceStatus)); + assertNotNull(result); + assertNotNull(result.getResult()); + assertEquals(1, result.getResult().size()); + + EMGetUserSubscriptionListResult getUserSubscriptionListResult = assertDoesNotThrow(() -> api.getUserSubscriptionList(username1, 1, 10)); + assertNotNull(getUserSubscriptionListResult); + assertNotNull(getUserSubscriptionListResult.getResult()); + assertNotNull(getUserSubscriptionListResult.getResult().getSublist()); + assertEquals(1, getUserSubscriptionListResult.getResult().getTotalnum()); + assertEquals(1, getUserSubscriptionListResult.getResult().getSublist().size()); + } + + /** + * 取消订阅多个用户的在线状态 + * + * 取消订阅多个用户的在线状态。文档介绍:https://docs-im-beta.easemob.com/document/server-side/presence.html#%E5%8F%96%E6%B6%88%E8%AE%A2%E9%98%85%E5%A4%9A%E4%B8%AA%E7%94%A8%E6%88%B7%E7%9A%84%E5%9C%A8%E7%BA%BF%E7%8A%B6%E6%80%81 + * + * @throws ApiException if the Api call fails + */ + @Test + public void unsubscribeMultipleUsersPresenceStatusTest() throws ApiException { + String username1 = "tom3"; + String username2 = "jack3"; + String expiry = "36000"; + EMSubscribeMultipleUsersPresenceStatus subscribeMultipleUsersPresenceStatus = new EMSubscribeMultipleUsersPresenceStatus(); + subscribeMultipleUsersPresenceStatus.setUsernames(new ArrayList() {{ + add(username2); + }}); + EMSubscribeMultipleUsersPresenceStatusResult result = assertDoesNotThrow(() -> api.subscribeMultipleUsersPresenceStatus(username1, expiry, subscribeMultipleUsersPresenceStatus)); + assertNotNull(result); + assertNotNull(result.getResult()); + assertEquals(1, result.getResult().size()); + + EMUnsubscribeMultipleUsersPresenceStatusResult unsubscribeMultipleUsersPresenceStatusResult = assertDoesNotThrow(() -> api.unsubscribeMultipleUsersPresenceStatus(username1, + Collections.singletonList(username2))); + assertNotNull(unsubscribeMultipleUsersPresenceStatusResult); + assertEquals("ok", unsubscribeMultipleUsersPresenceStatusResult.getResult()); + + EMGetUserSubscriptionListResult getUserSubscriptionListResult = assertDoesNotThrow(() -> api.getUserSubscriptionList(username1, 1, 10)); + assertNotNull(getUserSubscriptionListResult); + assertNotNull(getUserSubscriptionListResult.getResult()); + assertNotNull(getUserSubscriptionListResult.getResult().getSublist()); + assertEquals(0, getUserSubscriptionListResult.getResult().getTotalnum()); + assertEquals(0, getUserSubscriptionListResult.getResult().getSublist().size()); + } + +} diff --git a/src/test/java/com/easemob/im/api/PushApiTest.java b/src/test/java/com/easemob/im/api/PushApiTest.java new file mode 100644 index 000000000..edf989498 --- /dev/null +++ b/src/test/java/com/easemob/im/api/PushApiTest.java @@ -0,0 +1,456 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api; + +import com.easemob.im.ApiException; +import com.easemob.im.api.model.*; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + +/** + * API tests for PushApi + */ +@Disabled +public class PushApiTest extends AbstractTest { + + private final PushApi api = new PushApi(); + + private final UserApi userApi = new UserApi(); + + /** + * 创建离线推送模板 + * + * 创建离线推送消息模板,包括默认模板 default 和自定模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E5%88%9B%E5%BB%BA%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%A8%A1%E6%9D%BF + * + * @throws ApiException if the Api call fails + */ + @Test + public void createOfflinePushTemplateTest() throws ApiException { + String name = "test"; + String title = "标题 {0}"; + String content = "内容 {0}"; + + EMCreateOfflinePushTemplate emCreateOfflinePushTemplate = new EMCreateOfflinePushTemplate(); + emCreateOfflinePushTemplate.setName(name); + emCreateOfflinePushTemplate.setTitlePattern(title); + emCreateOfflinePushTemplate.setContentPattern(content); + + EMCreateOfflinePushTemplateResult createOfflinePushTemplateResult = assertDoesNotThrow(() -> api.createOfflinePushTemplate(emCreateOfflinePushTemplate)); + assertNotNull(createOfflinePushTemplateResult); + assertNotNull(createOfflinePushTemplateResult.getData()); + assertEquals(name, createOfflinePushTemplateResult.getData().getName()); + assertEquals(title, createOfflinePushTemplateResult.getData().getTitlePattern()); + assertEquals(content, createOfflinePushTemplateResult.getData().getContentPattern()); + + assertDoesNotThrow(() -> api.deleteOfflinePushTemplate(name)); + } + + /** + * 删除离线推送模板 + * + * 删除离线消息推送模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E5%88%A0%E9%99%A4%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%A8%A1%E6%9D%BF + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteOfflinePushTemplateTest() throws ApiException { + String name = "test1"; + String title = "标题 {0}"; + String content = "内容 {0}"; + + EMCreateOfflinePushTemplate emCreateOfflinePushTemplate = new EMCreateOfflinePushTemplate(); + emCreateOfflinePushTemplate.setName(name); + emCreateOfflinePushTemplate.setTitlePattern(title); + emCreateOfflinePushTemplate.setContentPattern(content); + + EMCreateOfflinePushTemplateResult createOfflinePushTemplateResult = assertDoesNotThrow(() -> api.createOfflinePushTemplate(emCreateOfflinePushTemplate)); + assertNotNull(createOfflinePushTemplateResult); + assertNotNull(createOfflinePushTemplateResult.getData()); + assertEquals(name, createOfflinePushTemplateResult.getData().getName()); + assertEquals(title, createOfflinePushTemplateResult.getData().getTitlePattern()); + assertEquals(content, createOfflinePushTemplateResult.getData().getContentPattern()); + + EMDeleteOfflinePushTemplateResult deleteOfflinePushTemplateResult = assertDoesNotThrow(() -> api.deleteOfflinePushTemplate(name)); + assertNotNull(deleteOfflinePushTemplateResult); + assertNotNull(deleteOfflinePushTemplateResult.getData()); + assertEquals(name, deleteOfflinePushTemplateResult.getData().getName()); + assertEquals(title, deleteOfflinePushTemplateResult.getData().getTitlePattern()); + assertEquals(content, deleteOfflinePushTemplateResult.getData().getContentPattern()); + } + + /** + * 查询离线推送设置 + * + * 查询指定单聊、指定群聊或全局的离线推送设置。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%9F%A5%E8%AF%A2%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E8%AE%BE%E7%BD%AE + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOfflinePushTest() throws ApiException { + String username1 = randomUserName(); + String username2 = randomUserName(); + String password = "123456"; + + List emCreateUserList = new ArrayList<>(); + EMCreateUser createUser1 = new EMCreateUser(); + createUser1.setUsername(username1); + createUser1.setPassword(password); + + EMCreateUser createUser2 = new EMCreateUser(); + createUser2.setUsername(username2); + createUser2.setPassword(password); + + emCreateUserList.add(createUser1); + emCreateUserList.add(createUser2); + + assertDoesNotThrow(() -> userApi.createUsers(emCreateUserList)); + + String chattype = "user"; + String key = username2; + String type = "ALL"; + String ignoreInterval = "21:30-08:00"; + BigDecimal ignoreDuration = new BigDecimal(86400); + EMSetOfflinePushNew emSetOfflinePushNew = new EMSetOfflinePushNew(); + emSetOfflinePushNew.setType(type); + emSetOfflinePushNew.setIgnoreInterval(ignoreInterval); + emSetOfflinePushNew.setIgnoreDuration(ignoreDuration); + + EMSetOfflinePushNewResult setOfflinePushNewResult = assertDoesNotThrow(() -> api.setOfflinePushNew(username1, chattype, key, emSetOfflinePushNew)); + assertNotNull(setOfflinePushNewResult); + assertNotNull(setOfflinePushNewResult.getData()); + assertEquals(type, setOfflinePushNewResult.getData().getType()); + assertEquals(ignoreInterval, setOfflinePushNewResult.getData().getIgnoreInterval()); + + EMGetOfflinePushResult getOfflinePushResult = assertDoesNotThrow(() -> api.getOfflinePush(username1, chattype, key)); + assertNotNull(getOfflinePushResult); + assertNotNull(getOfflinePushResult.getData()); + assertEquals(type, getOfflinePushResult.getData().getType()); + assertEquals(ignoreInterval, getOfflinePushResult.getData().getIgnoreInterval()); + + assertDoesNotThrow(() -> userApi.deleteUser(username1)); + assertDoesNotThrow(() -> userApi.deleteUser(username2)); + } + + /** + * 查询离线推送模板 + * + * 查询离线推送消息使用的模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%9F%A5%E8%AF%A2%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%A8%A1%E6%9D%BF + * + * @throws ApiException if the Api call fails + */ + @Test + public void getOfflinePushTemplateTest() throws ApiException { + String name = "test"; + String title = "标题 {0}"; + String content = "内容 {0}"; + + EMCreateOfflinePushTemplate emCreateOfflinePushTemplate = new EMCreateOfflinePushTemplate(); + emCreateOfflinePushTemplate.setName(name); + emCreateOfflinePushTemplate.setTitlePattern(title); + emCreateOfflinePushTemplate.setContentPattern(content); + + assertDoesNotThrow(() -> api.createOfflinePushTemplate(emCreateOfflinePushTemplate)); + + EMGetOfflinePushTemplateResult getOfflinePushTemplateResult = assertDoesNotThrow(() -> api.getOfflinePushTemplate(name)); + assertNotNull(getOfflinePushTemplateResult); + assertNotNull(getOfflinePushTemplateResult.getData()); + assertEquals(name, getOfflinePushTemplateResult.getData().getName()); + assertEquals(title, getOfflinePushTemplateResult.getData().getTitlePattern()); + assertEquals(content, getOfflinePushTemplateResult.getData().getContentPattern()); + + assertDoesNotThrow(() -> api.deleteOfflinePushTemplate(name)); + } + + /** + * 查询推送绑定信息 + * + * 查询当前用户的所有设备的推送绑定信息。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%9F%A5%E8%AF%A2%E6%8E%A8%E9%80%81%E7%BB%91%E5%AE%9A%E4%BF%A1%E6%81%AF + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPushBindingInfoTest() throws ApiException { + String username = randomUserName(); + String password = "123456"; + + List emCreateUserList = new ArrayList<>(); + EMCreateUser createUser = new EMCreateUser(); + createUser.setUsername(username); + createUser.setPassword(password); + + emCreateUserList.add(createUser); + + assertDoesNotThrow(() -> userApi.createUsers(emCreateUserList)); + + String notifierName = "104410638"; + String deviceId = "8ce08cad-9369-4bdd-86c8-695a0d247cda"; + String deviceToken = "BAEAAAAAB.jkuDmf8hRUPDgOel-zX9exVlcjS1akCWQIUA3cBbB_DprnHMeFR11PV1of1sVNKPmKdKhMB22YuO8-Z_Ksoqxo8Y"; + + EMSetPushBindingInfo emSetPushBindingInfo = new EMSetPushBindingInfo(); + emSetPushBindingInfo.setNotifierName(notifierName); + emSetPushBindingInfo.setDeviceId(deviceId); + emSetPushBindingInfo.setDeviceToken(deviceToken); + + assertDoesNotThrow(() -> api.setPushBindingInfo(username, emSetPushBindingInfo)); + + EMGetPushBindingInfoResult result = assertDoesNotThrow(() -> api.getPushBindingInfo(username)); + assertNotNull(result); + assertNotNull(result.getEntities()); + assertEquals(notifierName, result.getEntities().get(0).getNotifierName()); + assertEquals(deviceId, result.getEntities().get(0).getDeviceId()); + assertEquals(deviceToken, result.getEntities().get(0).getDeviceToken()); + + assertDoesNotThrow(() -> userApi.deleteUser(username)); + } + + /** + * 获取推送通知的首选语言 + * + * 获取推送通知的首选语言。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%8E%B7%E5%8F%96%E6%8E%A8%E9%80%81%E9%80%9A%E7%9F%A5%E7%9A%84%E9%A6%96%E9%80%89%E8%AF%AD%E8%A8%80 + * + * @throws ApiException if the Api call fails + */ + @Test + public void getPushPreferredLanguageTest() throws ApiException { + String username = randomUserName(); + String password = "123456"; + + List emCreateUserList = new ArrayList<>(); + EMCreateUser createUser = new EMCreateUser(); + createUser.setUsername(username); + createUser.setPassword(password); + + emCreateUserList.add(createUser); + + assertDoesNotThrow(() -> userApi.createUsers(emCreateUserList)); + + EMSetPushPreferredLanguage setPushPreferredLanguage = new EMSetPushPreferredLanguage(); + setPushPreferredLanguage.setTranslationLanguage("EU"); + assertDoesNotThrow(() -> api.setPushPreferredLanguage(username, setPushPreferredLanguage)); + + EMGetPushPreferredLanguageResult getPushPreferredLanguageResult = assertDoesNotThrow(() -> api.getPushPreferredLanguage(username)); + assertNotNull(getPushPreferredLanguageResult); + assertNotNull(getPushPreferredLanguageResult.getData()); + assertEquals("EU", getPushPreferredLanguageResult.getData().getLanguage()); + + assertDoesNotThrow(() -> userApi.deleteUser(username)); + } + + /** + * 接收方配置模板名称 + * + * 接收方可以调用该 API 设置推送模板。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E6%8E%A5%E6%94%B6%E6%96%B9%E9%85%8D%E7%BD%AE%E6%A8%A1%E6%9D%BF%E5%90%8D%E7%A7%B0 + * + * @throws ApiException if the Api call fails + */ + @Test + public void receiverConfigurationTemplateNameTest() throws ApiException { + String username = randomUserName(); + String password = "123456"; + + List emCreateUserList = new ArrayList<>(); + EMCreateUser createUser = new EMCreateUser(); + createUser.setUsername(username); + createUser.setPassword(password); + + emCreateUserList.add(createUser); + + assertDoesNotThrow(() -> userApi.createUsers(emCreateUserList)); + + EMReceiverConfigurationTemplateName emReceiverConfigurationTemplateName = new EMReceiverConfigurationTemplateName(); + emReceiverConfigurationTemplateName.setTemplateName("receive_template_name"); + + EMReceiverConfigurationTemplateNameResult result = assertDoesNotThrow(() -> api.receiverConfigurationTemplateName(username, emReceiverConfigurationTemplateName)); + assertNotNull(result); + assertNotNull(result.getData()); + assertEquals("receive_template_name", result.getData().getTemplateName()); + + assertDoesNotThrow(() -> userApi.deleteUser(username)); + } + + /** + * 设置离线推送(新) + * + * 你可以设置全局离线推送的通知方式和免打扰模式以及单个单聊或群聊会话的离线推送设置。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81 + * + * @throws ApiException if the Api call fails + */ + @Test + public void setOfflinePushNewTest() throws ApiException { + String username1 = randomUserName(); + String username2 = randomUserName(); + String password = "123456"; + + List emCreateUserList = new ArrayList<>(); + EMCreateUser createUser1 = new EMCreateUser(); + createUser1.setUsername(username1); + createUser1.setPassword(password); + + EMCreateUser createUser2 = new EMCreateUser(); + createUser2.setUsername(username2); + createUser2.setPassword(password); + + emCreateUserList.add(createUser1); + emCreateUserList.add(createUser2); + + assertDoesNotThrow(() -> userApi.createUsers(emCreateUserList)); + + String chattype = "user"; + String key = username2; + String type = "ALL"; + String ignoreInterval = "21:30-08:00"; + BigDecimal ignoreDuration = new BigDecimal(86400); + EMSetOfflinePushNew emSetOfflinePushNew = new EMSetOfflinePushNew(); + emSetOfflinePushNew.setType(type); + emSetOfflinePushNew.setIgnoreInterval(ignoreInterval); + emSetOfflinePushNew.setIgnoreDuration(ignoreDuration); + + EMSetOfflinePushNewResult response = assertDoesNotThrow(() -> api.setOfflinePushNew(username1, chattype, key, emSetOfflinePushNew)); + assertNotNull(response); + assertNotNull(response.getData()); + assertEquals(type, response.getData().getType()); + assertEquals(ignoreInterval, response.getData().getIgnoreInterval()); + + assertDoesNotThrow(() -> userApi.deleteUser(username1)); + assertDoesNotThrow(() -> userApi.deleteUser(username2)); + } + + /** + * 离线推送设置。包括设置离线推送时显示的昵称、设置离线推送通知的展示方式、设置免打扰模式 + * + * 离线推送设置。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E6%97%B6%E6%98%BE%E7%A4%BA%E7%9A%84%E6%98%B5%E7%A7%B0、https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E7%A6%BB%E7%BA%BF%E6%8E%A8%E9%80%81%E9%80%9A%E7%9F%A5%E7%9A%84%E5%B1%95%E7%A4%BA%E6%96%B9%E5%BC%8F、https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E5%85%8D%E6%89%93%E6%89%B0%E6%A8%A1%E5%BC%8F + * + * @throws ApiException if the Api call fails + */ + @Test + public void setOfflinePushOldTest() throws ApiException { + String username = randomUserName(); + String password = "123456"; + + List emCreateUserList = new ArrayList<>(); + EMCreateUser createUser = new EMCreateUser(); + createUser.setUsername(username); + createUser.setPassword(password); + + emCreateUserList.add(createUser); + + assertDoesNotThrow(() -> userApi.createUsers(emCreateUserList)); + + // 设置离线推送时显示的昵称 + EMSetOfflinePushOld pushNickname = new EMSetOfflinePushOld(); + pushNickname.setNickname("Tom"); + assertDoesNotThrow(() -> api.setOfflinePushOld(username, pushNickname)); + + // 设置离线推送通知的展示方式 + EMSetOfflinePushOld notificationDisplayStyle = new EMSetOfflinePushOld(); + notificationDisplayStyle.setNotificationDisplayStyle(1); + assertDoesNotThrow(() -> api.setOfflinePushOld(username, notificationDisplayStyle)); + + // 设置免打扰模式 + EMSetOfflinePushOld notificationNoDisturbing = new EMSetOfflinePushOld(); + notificationNoDisturbing.setNotificationNoDisturbing(true); + notificationNoDisturbing.setNotificationNoDisturbingStart("1"); + notificationNoDisturbing.setNotificationNoDisturbingEnd("3"); + assertDoesNotThrow(() -> api.setOfflinePushOld(username, notificationNoDisturbing)); + + assertDoesNotThrow(() -> userApi.deleteUser(username)); + } + + /** + * 绑定和解绑推送信息 + * + * 推送消息时,设备与推送信息会进行绑定,包括设备 ID、推送证书和 device token。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E7%BB%91%E5%AE%9A%E5%92%8C%E8%A7%A3%E7%BB%91%E6%8E%A8%E9%80%81%E4%BF%A1%E6%81%AF + * + * @throws ApiException if the Api call fails + */ + @Test + public void setPushBindingInfoTest() throws ApiException { + String username = randomUserName(); + String password = "123456"; + + List emCreateUserList = new ArrayList<>(); + EMCreateUser createUser = new EMCreateUser(); + createUser.setUsername(username); + createUser.setPassword(password); + + emCreateUserList.add(createUser); + + assertDoesNotThrow(() -> userApi.createUsers(emCreateUserList)); + + String notifierName = "104410638"; + String deviceId = "8ce08cad-9369-4bdd-86c8-695a0d247cda"; + String deviceToken = "BAEAAAAAB.jkuDmf8hRUPDgOel-zX9exVlcjS1akCWQIUA3cBbB_DprnHMeFR11PV1of1sVNKPmKdKhMB22YuO8-Z_Ksoqxo8Y"; + + EMSetPushBindingInfo emSetPushBindingInfo = new EMSetPushBindingInfo(); + emSetPushBindingInfo.setNotifierName(notifierName); + emSetPushBindingInfo.setDeviceId(deviceId); + emSetPushBindingInfo.setDeviceToken(deviceToken); + + EMSetPushBindingInfoResult result = assertDoesNotThrow(() -> api.setPushBindingInfo(username, emSetPushBindingInfo)); + assertNotNull(result); + assertNotNull(result.getEntities()); + assertNotNull(result.getEntities().get(0).getNotifierName()); + assertEquals(notifierName, result.getEntities().get(0).getNotifierName()); + assertEquals(deviceId, result.getEntities().get(0).getDeviceId()); + assertEquals(deviceToken, result.getEntities().get(0).getDeviceToken()); + + assertDoesNotThrow(() -> userApi.deleteUser(username)); + } + + /** + * 设置推送通知的首选语言 + * + * 设置离线推送消息的首选语言。文档介绍:https://docs-im-beta.easemob.com/document/server-side/push.html#%E8%AE%BE%E7%BD%AE%E6%8E%A8%E9%80%81%E9%80%9A%E7%9F%A5%E7%9A%84%E9%A6%96%E9%80%89%E8%AF%AD%E8%A8%80 + * + * @throws ApiException if the Api call fails + */ + @Test + public void setPushPreferredLanguageTest() throws ApiException { + String username = randomUserName(); + String password = "123456"; + + List emCreateUserList = new ArrayList<>(); + EMCreateUser createUser = new EMCreateUser(); + createUser.setUsername(username); + createUser.setPassword(password); + + emCreateUserList.add(createUser); + + assertDoesNotThrow(() -> userApi.createUsers(emCreateUserList)); + + EMSetPushPreferredLanguage setPushPreferredLanguage = new EMSetPushPreferredLanguage(); + setPushPreferredLanguage.setTranslationLanguage("EU"); + EMSetPushPreferredLanguageResult setPushPreferredLanguageResult = assertDoesNotThrow(() -> api.setPushPreferredLanguage(username, setPushPreferredLanguage)); + assertNotNull(setPushPreferredLanguageResult); + assertNotNull(setPushPreferredLanguageResult.getData()); + assertEquals("EU", setPushPreferredLanguageResult.getData().getLanguage()); + + EMGetPushPreferredLanguageResult getPushPreferredLanguageResult = assertDoesNotThrow(() -> api.getPushPreferredLanguage(username)); + assertNotNull(getPushPreferredLanguageResult); + assertNotNull(getPushPreferredLanguageResult.getData()); + assertEquals("EU", getPushPreferredLanguageResult.getData().getLanguage()); + + assertDoesNotThrow(() -> userApi.deleteUser(username)); + } + +} diff --git a/src/test/java/com/easemob/im/api/ReactionApiTest.java b/src/test/java/com/easemob/im/api/ReactionApiTest.java new file mode 100644 index 000000000..baae29ecc --- /dev/null +++ b/src/test/java/com/easemob/im/api/ReactionApiTest.java @@ -0,0 +1,294 @@ +/* + * EMService + * Easemob Rest API + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.easemob.im.api; + +import com.easemob.im.ApiException; +import com.easemob.im.api.model.*; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * API tests for ReactionApi + */ +@Disabled +public class ReactionApiTest extends AbstractTest { + + private final ReactionApi api = new ReactionApi(); + + private final UserApi userApi = new UserApi(); + + private final MessageApi messageApi = new MessageApi(); + + /** + * 删除 Reaction + * + * 删除当前用户追加的 Reaction。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E5%88%A0%E9%99%A4-reaction + * + * @throws ApiException if the Api call fails + */ + @Test + public void deleteReactionTest() throws ApiException { + String username1 = randomUserName(); + String username2 = randomUserName(); + String password = "123456"; + + List emCreateUserList = new ArrayList<>(); + EMCreateUser createUser1 = new EMCreateUser(); + createUser1.setUsername(username1); + createUser1.setPassword(password); + + EMCreateUser createUser2 = new EMCreateUser(); + createUser2.setUsername(username2); + createUser2.setPassword(password); + + emCreateUserList.add(createUser1); + emCreateUserList.add(createUser2); + + assertDoesNotThrow(() -> userApi.createUsers(emCreateUserList)); + + EMCreateMessage emCreateMessage = new EMCreateMessage(); + emCreateMessage.setFrom(username1); + emCreateMessage.setTo(new ArrayList(){{add(username2);}}); + emCreateMessage.setType("txt"); + EMMessageContent messageContent = new EMMessageContent(); + messageContent.setMsg("test message"); + emCreateMessage.setBody(messageContent); + + EMSendMessageResult sendMessageResult = assertDoesNotThrow(() -> messageApi.sendMessagesToUser(emCreateMessage)); + assertNotNull(sendMessageResult.getData()); + Map data = (Map) sendMessageResult.getData(); + + String msgId = (String) data.get(username2); + String message = "emoji_1"; + + EMSetReaction emSetReaction = new EMSetReaction(); + emSetReaction.setMsgId(msgId); + emSetReaction.setMessage(message); + + EMSetReactionResult setReactionResult = assertDoesNotThrow(() -> api.setReaction(username1, emSetReaction)); + assertNotNull(setReactionResult); + assertNotNull(setReactionResult.getRequestStatusCode()); + assertEquals("ok", setReactionResult.getRequestStatusCode()); + + EMDeleteReactionResult deleteReactionResult = assertDoesNotThrow(() -> api.deleteReaction(username1, msgId, message)); + assertNotNull(deleteReactionResult); + assertEquals("ok", deleteReactionResult.getRequestStatusCode()); + + assertDoesNotThrow(() -> userApi.deleteUser(username1)); + assertDoesNotThrow(() -> userApi.deleteUser(username2)); + } + + /** + * 根据消息 ID 获取 Reaction + * + * 该方法根据单聊或群聊中的消息 ID 获取单个或多个消息的 Reaction 信息,包括 Reaction ID、使用的表情 ID、以及使用该 Reaction 的用户 ID 及用户人数。获取的 Reaction 的用户列表只展示最早三个添加 Reaction 的用户。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E6%A0%B9%E6%8D%AE%E6%B6%88%E6%81%AF-id-%E8%8E%B7%E5%8F%96-reaction + * + * @throws ApiException if the Api call fails + */ + @Test + public void getReactionTest() throws ApiException { + String username1 = randomUserName(); + String username2 = randomUserName(); + String password = "123456"; + + List emCreateUserList = new ArrayList<>(); + EMCreateUser createUser1 = new EMCreateUser(); + createUser1.setUsername(username1); + createUser1.setPassword(password); + + EMCreateUser createUser2 = new EMCreateUser(); + createUser2.setUsername(username2); + createUser2.setPassword(password); + + emCreateUserList.add(createUser1); + emCreateUserList.add(createUser2); + + assertDoesNotThrow(() -> userApi.createUsers(emCreateUserList)); + + EMCreateMessage emCreateMessage = new EMCreateMessage(); + emCreateMessage.setFrom(username1); + emCreateMessage.setTo(new ArrayList(){{add(username2);}}); + emCreateMessage.setType("txt"); + EMMessageContent messageContent = new EMMessageContent(); + messageContent.setMsg("test message"); + emCreateMessage.setBody(messageContent); + + EMSendMessageResult sendMessageResult = assertDoesNotThrow(() -> messageApi.sendMessagesToUser(emCreateMessage)); + assertNotNull(sendMessageResult.getData()); + Map data = (Map) sendMessageResult.getData(); + + String msgId = (String) data.get(username2); + String message = "emoji_1"; + + EMSetReaction emSetReaction = new EMSetReaction(); + emSetReaction.setMsgId(msgId); + emSetReaction.setMessage(message); + + EMSetReactionResult setReactionResult = assertDoesNotThrow(() -> api.setReaction(username1, emSetReaction)); + assertNotNull(setReactionResult); + assertNotNull(setReactionResult.getRequestStatusCode()); + assertEquals("ok", setReactionResult.getRequestStatusCode()); + + List msgIdList = Arrays.asList(msgId); + String msgType = "chat"; + String groupId = null; + + EMGetReactionResult getReactionResult = assertDoesNotThrow(() -> api.getReaction(username1, msgIdList, msgType, groupId)); + assertNotNull(getReactionResult); + assertEquals("ok", getReactionResult.getRequestStatusCode()); + assertNotNull(getReactionResult.getData()); + assertNotNull(getReactionResult.getData().get(0)); + assertEquals(msgId, getReactionResult.getData().get(0).getMsgId()); + assertEquals(1, getReactionResult.getData().get(0).getReactionList().get(0).getUserList().size()); + assertEquals(message, getReactionResult.getData().get(0).getReactionList().get(0).getReaction()); + + assertDoesNotThrow(() -> api.deleteReaction(username1, msgId, message)); + + assertDoesNotThrow(() -> userApi.deleteUser(username1)); + assertDoesNotThrow(() -> userApi.deleteUser(username2)); + } + + /** + * 根据消息 ID 和表情 ID 获取 Reaction 信息 + * + * 在单聊或群聊场景中对单条消息创建或追加 Reaction。创建 Reaction 指对消息添加第一条 Reaction,后续的 Reaction 添加称为追加。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E5%88%9B%E5%BB%BA-%E8%BF%BD%E5%8A%A0-reaction + * + * @throws ApiException if the Api call fails + */ + @Test + public void getReactionDetailTest() throws ApiException { + String username1 = randomUserName(); + String username2 = randomUserName(); + String password = "123456"; + + List emCreateUserList = new ArrayList<>(); + EMCreateUser createUser1 = new EMCreateUser(); + createUser1.setUsername(username1); + createUser1.setPassword(password); + + EMCreateUser createUser2 = new EMCreateUser(); + createUser2.setUsername(username2); + createUser2.setPassword(password); + + emCreateUserList.add(createUser1); + emCreateUserList.add(createUser2); + + assertDoesNotThrow(() -> userApi.createUsers(emCreateUserList)); + + EMCreateMessage emCreateMessage = new EMCreateMessage(); + emCreateMessage.setFrom(username1); + emCreateMessage.setTo(new ArrayList(){{add(username2);}}); + emCreateMessage.setType("txt"); + EMMessageContent messageContent = new EMMessageContent(); + messageContent.setMsg("test message"); + emCreateMessage.setBody(messageContent); + + EMSendMessageResult sendMessageResult = assertDoesNotThrow(() -> messageApi.sendMessagesToUser(emCreateMessage)); + assertNotNull(sendMessageResult.getData()); + Map data = (Map) sendMessageResult.getData(); + + String msgId = (String) data.get(username2); + String message = "emoji_1"; + + EMSetReaction emSetReaction = new EMSetReaction(); + emSetReaction.setMsgId(msgId); + emSetReaction.setMessage(message); + + EMSetReactionResult setReactionResult = assertDoesNotThrow(() -> api.setReaction(username1, emSetReaction)); + assertNotNull(setReactionResult); + assertNotNull(setReactionResult.getRequestStatusCode()); + assertEquals("ok", setReactionResult.getRequestStatusCode()); + + Integer limit = 1; + String cursor = null; + + EMGetReactionDetailResult getReactionDetailResult = assertDoesNotThrow(() -> api.getReactionDetail(username1, msgId, message, limit, cursor)); + assertNotNull(getReactionDetailResult); + assertNotNull(getReactionDetailResult.getData()); + assertNotNull(getReactionDetailResult.getData().getUserList()); + assertEquals(message, getReactionDetailResult.getData().getReaction()); + assertEquals(1, getReactionDetailResult.getData().getUserList().size()); + assertEquals(true, getReactionDetailResult.getData().getState()); + + assertDoesNotThrow(() -> api.deleteReaction(username1, msgId, message)); + + assertDoesNotThrow(() -> userApi.deleteUser(username1)); + assertDoesNotThrow(() -> userApi.deleteUser(username2)); + } + + /** + * 创建/追加 Reaction + * + * 在单聊或群聊场景中对单条消息创建或追加 Reaction。创建 Reaction 指对消息添加第一条 Reaction,后续的 Reaction 添加称为追加。文档介绍:https://docs-im-beta.easemob.com/document/server-side/reaction.html#%E5%88%9B%E5%BB%BA-%E8%BF%BD%E5%8A%A0-reaction + * + * @throws ApiException if the Api call fails + */ + @Test + public void setReactionTest() throws ApiException { + String username1 = randomUserName(); + String username2 = randomUserName(); + String password = "123456"; + + List emCreateUserList = new ArrayList<>(); + EMCreateUser createUser1 = new EMCreateUser(); + createUser1.setUsername(username1); + createUser1.setPassword(password); + + EMCreateUser createUser2 = new EMCreateUser(); + createUser2.setUsername(username2); + createUser2.setPassword(password); + + emCreateUserList.add(createUser1); + emCreateUserList.add(createUser2); + + assertDoesNotThrow(() -> userApi.createUsers(emCreateUserList)); + + EMCreateMessage emCreateMessage = new EMCreateMessage(); + emCreateMessage.setFrom(username1); + emCreateMessage.setTo(new ArrayList(){{add(username2);}}); + emCreateMessage.setType("txt"); + EMMessageContent messageContent = new EMMessageContent(); + messageContent.setMsg("test message"); + emCreateMessage.setBody(messageContent); + + EMSendMessageResult sendMessageResult = assertDoesNotThrow(() -> messageApi.sendMessagesToUser(emCreateMessage)); + assertNotNull(sendMessageResult.getData()); + Map data = (Map) sendMessageResult.getData(); + + String msgId = (String) data.get(username2); + String message = "emoji_1"; + + EMSetReaction emSetReaction = new EMSetReaction(); + emSetReaction.setMsgId(msgId); + emSetReaction.setMessage(message); + + EMSetReactionResult setReactionResult = assertDoesNotThrow(() -> api.setReaction(username1, emSetReaction)); + assertNotNull(setReactionResult); + assertNotNull(setReactionResult.getRequestStatusCode()); + assertEquals("ok", setReactionResult.getRequestStatusCode()); + + assertDoesNotThrow(() -> api.deleteReaction(username1, msgId, message)); + + assertDoesNotThrow(() -> userApi.deleteUser(username1)); + assertDoesNotThrow(() -> userApi.deleteUser(username2)); + } + +}