Skip to content

Commit

Permalink
Add group avatar, import contact list and force user single device lo…
Browse files Browse the repository at this point in the history
…gout function
  • Loading branch information
FuDongHai committed Jul 29, 2024
1 parent efd98cf commit 63bd0d3
Show file tree
Hide file tree
Showing 14 changed files with 2,039 additions and 484 deletions.
121 changes: 121 additions & 0 deletions src/main/java/com/easemob/im/api/ContactApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -664,4 +664,125 @@ public okhttp3.Call setContactNoteAsync(String ownerUsername, String friendUsern
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}

/**
* Build call for importContactList
* @param username (required)
* @param isSendNotice 好友导入后是否向 SDK 发送通知:- true:是;-(默认)false:否 (optional)
* @param emImportContactList (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
*/
public okhttp3.Call importContactListCall(String username, Boolean isSendNotice, EMImportContactList emImportContactList, 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 = emImportContactList;

// create path and map variables
String localVarPath = "/users/{username}/contacts/import"
.replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString()));

List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();

if (isSendNotice != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("isSendNotice", isSendNotice));
}

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 importContactListValidateBeforeCall(String username, Boolean isSendNotice, EMImportContactList emImportContactList, 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 importContactList(Async)");
}

return importContactListCall(username, isSendNotice, emImportContactList, _callback);

}

/**
* 导入好友列表
* 你可以调用该接口导入好友列表。文档介绍:https://doc.easemob.com/document/server-side/user_relationship.html#%E5%AF%BC%E5%85%A5%E5%A5%BD%E5%8F%8B%E5%88%97%E8%A1%A8
* @param username (required)
* @param isSendNotice 好友导入后是否向 SDK 发送通知:- true:是;-(默认)false:否 (optional)
* @param emImportContactList (optional)
* @return EMImportContactListResult
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* http.response.details
*/
public EMImportContactListResult importContactList(String username, Boolean isSendNotice, EMImportContactList emImportContactList) throws ApiException {
ApiResponse<EMImportContactListResult> localVarResp = importContactListWithHttpInfo(username, isSendNotice, emImportContactList);
return localVarResp.getData();
}

/**
* 导入好友列表
* 你可以调用该接口导入好友列表。文档介绍:https://doc.easemob.com/document/server-side/user_relationship.html#%E5%AF%BC%E5%85%A5%E5%A5%BD%E5%8F%8B%E5%88%97%E8%A1%A8
* @param username (required)
* @param isSendNotice 好友导入后是否向 SDK 发送通知:- true:是;-(默认)false:否 (optional)
* @param emImportContactList (optional)
* @return ApiResponse&lt;EMImportContactListResult&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* http.response.details
*/
public ApiResponse<EMImportContactListResult> importContactListWithHttpInfo(String username, Boolean isSendNotice, EMImportContactList emImportContactList) throws ApiException {
okhttp3.Call localVarCall = importContactListValidateBeforeCall(username, isSendNotice, emImportContactList, null);
Type localVarReturnType = new TypeToken<EMImportContactListResult>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}

/**
* 导入好友列表 (asynchronously)
* 你可以调用该接口导入好友列表。文档介绍:https://doc.easemob.com/document/server-side/user_relationship.html#%E5%AF%BC%E5%85%A5%E5%A5%BD%E5%8F%8B%E5%88%97%E8%A1%A8
* @param username (required)
* @param isSendNotice 好友导入后是否向 SDK 发送通知:- true:是;-(默认)false:否 (optional)
* @param emImportContactList (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
*/
public okhttp3.Call importContactListAsync(String username, Boolean isSendNotice, EMImportContactList emImportContactList, final ApiCallback<EMImportContactListResult> _callback) throws ApiException {

okhttp3.Call localVarCall = importContactListValidateBeforeCall(username, isSendNotice, emImportContactList, _callback);
Type localVarReturnType = new TypeToken<EMImportContactListResult>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
}
124 changes: 121 additions & 3 deletions src/main/java/com/easemob/im/api/UserApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ private okhttp3.Call modifyPushNicknamesValidateBeforeCall(List<EMModifyPushNick
}

/**
* 批量修改用户推送昵称
* 批量修改用户推送昵称。文档介绍:https://doc.easemob.com/document/server-side/push.html#%E6%89%B9%E9%87%8F%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
* @param emModifyPushNickname (optional)
* @return EMModifyPushNicknamesResult
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
Expand All @@ -1966,7 +1966,7 @@ public EMModifyPushNicknamesResult modifyPushNicknames(List<EMModifyPushNickname
}

/**
* 批量修改用户推送昵称
* 批量修改用户推送昵称。 文档介绍:https://doc.easemob.com/document/server-side/push.html#%E6%89%B9%E9%87%8F%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
* @param emModifyPushNickname (optional)
* @return ApiResponse&lt;EMModifyPushNicknamesResult&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
Expand All @@ -1979,7 +1979,7 @@ public ApiResponse<EMModifyPushNicknamesResult> modifyPushNicknamesWithHttpInfo(
}

/**
* 批量修改用户推送昵称 (asynchronously)
* 批量修改用户推送昵称 (asynchronously)。 文档介绍:https://doc.easemob.com/document/server-side/push.html#%E6%89%B9%E9%87%8F%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
* @param emModifyPushNickname (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
Expand All @@ -1993,4 +1993,122 @@ public okhttp3.Call modifyPushNicknamesAsync(List<EMModifyPushNickname> emModify
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}

/**
* Build call for forceUserLogoutFromSingleDevice
* @param username (required)
* @param resourceId (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
*/
public okhttp3.Call forceUserLogoutFromSingleDeviceCall(String username, String resourceId, 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}/disconnect/{resourceId}"
.replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString()))
.replace("{" + "resourceId" + "}", localVarApiClient.escapeString(resourceId.toString()));

List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();

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 forceUserLogoutFromSingleDeviceValidateBeforeCall(String username, String resourceId, 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 forceUserLogoutFromSingleDevice(Async)");
}

// verify the required parameter 'resourceId' is set
if (resourceId == null) {
throw new ApiException("Missing the required parameter 'resourceId' when calling forceUserLogoutFromSingleDevice(Async)");
}

return forceUserLogoutFromSingleDeviceCall(username, resourceId, _callback);

}

/**
* 强制用户从单设备下线
* 如果用户在多个设备上登录,你可以调用该接口强制其在某一台设备上下线。若强制用户从所有设备下线,可以调用强制用户下线接口。文档介绍:https://doc.easemob.com/document/server-side/account_system.html#%E5%BC%BA%E5%88%B6%E7%94%A8%E6%88%B7%E4%BB%8E%E5%8D%95%E8%AE%BE%E5%A4%87%E4%B8%8B%E7%BA%BF
* @param username (required)
* @param resourceId (required)
* @return EMForceUserLogoutFromSingleDeviceResult
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* http.response.details
*/
public EMForceUserLogoutFromSingleDeviceResult forceUserLogoutFromSingleDevice(String username, String resourceId) throws ApiException {
ApiResponse<EMForceUserLogoutFromSingleDeviceResult> localVarResp = forceUserLogoutFromSingleDeviceWithHttpInfo(username, resourceId);
return localVarResp.getData();
}

/**
* 强制用户从单设备下线
* 如果用户在多个设备上登录,你可以调用该接口强制其在某一台设备上下线。若强制用户从所有设备下线,可以调用强制用户下线接口。文档介绍:https://doc.easemob.com/document/server-side/account_system.html#%E5%BC%BA%E5%88%B6%E7%94%A8%E6%88%B7%E4%BB%8E%E5%8D%95%E8%AE%BE%E5%A4%87%E4%B8%8B%E7%BA%BF
* @param username (required)
* @param resourceId (required)
* @return ApiResponse&lt;EMForceUserLogoutFromSingleDeviceResult&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* http.response.details
*/
public ApiResponse<EMForceUserLogoutFromSingleDeviceResult> forceUserLogoutFromSingleDeviceWithHttpInfo(String username, String resourceId) throws ApiException {
okhttp3.Call localVarCall = forceUserLogoutFromSingleDeviceValidateBeforeCall(username, resourceId, null);
Type localVarReturnType = new TypeToken<EMForceUserLogoutFromSingleDeviceResult>(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}

/**
* 强制用户从单设备下线 (asynchronously)
* 如果用户在多个设备上登录,你可以调用该接口强制其在某一台设备上下线。若强制用户从所有设备下线,可以调用强制用户下线接口。文档介绍:https://doc.easemob.com/document/server-side/account_system.html#%E5%BC%BA%E5%88%B6%E7%94%A8%E6%88%B7%E4%BB%8E%E5%8D%95%E8%AE%BE%E5%A4%87%E4%B8%8B%E7%BA%BF
* @param username (required)
* @param resourceId (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
*/
public okhttp3.Call forceUserLogoutFromSingleDeviceAsync(String username, String resourceId, final ApiCallback<EMForceUserLogoutFromSingleDeviceResult> _callback) throws ApiException {

okhttp3.Call localVarCall = forceUserLogoutFromSingleDeviceValidateBeforeCall(username, resourceId, _callback);
Type localVarReturnType = new TypeToken<EMForceUserLogoutFromSingleDeviceResult>(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
}
Loading

0 comments on commit 63bd0d3

Please sign in to comment.