Skip to content

Commit

Permalink
创建群组 & 聊天室支持自定义id,增加单向删除漫游消息相关功能
Browse files Browse the repository at this point in the history
  • Loading branch information
FuDongHai committed Sep 19, 2024
1 parent 07dde18 commit 0229c1d
Show file tree
Hide file tree
Showing 8 changed files with 1,812 additions and 854 deletions.
284 changes: 284 additions & 0 deletions src/main/java/com/easemob/im/api/MessageApi.java

Large diffs are not rendered by default.

1,060 changes: 539 additions & 521 deletions src/main/java/com/easemob/im/api/model/EMCreateGroup.java

Large diffs are not rendered by default.

697 changes: 364 additions & 333 deletions src/main/java/com/easemob/im/api/model/EMCreateRoom.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
/*
* 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 com.easemob.im.JSON;
import com.google.gson.*;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

import java.io.IOException;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

/**
* EMOneWayClearGroupRoamingMessagesByMsgIdResult
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-19T17:22:04.272445+08:00[Asia/Shanghai]")
public class EMOneWayClearGroupRoamingMessagesByMsgIdResult {
public static final String SERIALIZED_NAME_REQUEST_STATUS_CODE = "requestStatusCode";
@SerializedName(SERIALIZED_NAME_REQUEST_STATUS_CODE)
private String requestStatusCode;

public EMOneWayClearGroupRoamingMessagesByMsgIdResult() {
}

public EMOneWayClearGroupRoamingMessagesByMsgIdResult 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;
}
EMOneWayClearGroupRoamingMessagesByMsgIdResult oneWayClearGroupRoamingMessagesByMsgIdResult = (EMOneWayClearGroupRoamingMessagesByMsgIdResult) o;
return Objects.equals(this.requestStatusCode, oneWayClearGroupRoamingMessagesByMsgIdResult.requestStatusCode);
}

@Override
public int hashCode() {
return Objects.hash(requestStatusCode);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class EMOneWayClearGroupRoamingMessagesByMsgIdResult {\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<String> openapiFields;
public static HashSet<String> openapiRequiredFields;

static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet<String>();
openapiFields.add("requestStatusCode");

// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet<String>();
}

/**
* 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 EMOneWayClearGroupRoamingMessagesByMsgIdResult
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!EMOneWayClearGroupRoamingMessagesByMsgIdResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in EMOneWayClearGroupRoamingMessagesByMsgIdResult is not found in the empty JSON string", EMOneWayClearGroupRoamingMessagesByMsgIdResult.openapiRequiredFields.toString()));
}
}

Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!EMOneWayClearGroupRoamingMessagesByMsgIdResult.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMOneWayClearGroupRoamingMessagesByMsgIdResult` 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 <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!EMOneWayClearGroupRoamingMessagesByMsgIdResult.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'EMOneWayClearGroupRoamingMessagesByMsgIdResult' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<EMOneWayClearGroupRoamingMessagesByMsgIdResult> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(EMOneWayClearGroupRoamingMessagesByMsgIdResult.class));

return (TypeAdapter<T>) new TypeAdapter<EMOneWayClearGroupRoamingMessagesByMsgIdResult>() {
@Override
public void write(JsonWriter out, EMOneWayClearGroupRoamingMessagesByMsgIdResult value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}

@Override
public EMOneWayClearGroupRoamingMessagesByMsgIdResult read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}

}.nullSafe();
}
}

/**
* Create an instance of EMOneWayClearGroupRoamingMessagesByMsgIdResult given an JSON string
*
* @param jsonString JSON string
* @return An instance of EMOneWayClearGroupRoamingMessagesByMsgIdResult
* @throws IOException if the JSON string is invalid with respect to EMOneWayClearGroupRoamingMessagesByMsgIdResult
*/
public static EMOneWayClearGroupRoamingMessagesByMsgIdResult fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, EMOneWayClearGroupRoamingMessagesByMsgIdResult.class);
}

/**
* Convert an instance of EMOneWayClearGroupRoamingMessagesByMsgIdResult to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
/*
* 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 com.easemob.im.JSON;
import com.google.gson.*;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

import java.io.IOException;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

/**
* EMOneWayClearUserRoamingMessagesByMsgIdResult
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-09-19T17:22:04.272445+08:00[Asia/Shanghai]")
public class EMOneWayClearUserRoamingMessagesByMsgIdResult {
public static final String SERIALIZED_NAME_REQUEST_STATUS_CODE = "requestStatusCode";
@SerializedName(SERIALIZED_NAME_REQUEST_STATUS_CODE)
private String requestStatusCode;

public EMOneWayClearUserRoamingMessagesByMsgIdResult() {
}

public EMOneWayClearUserRoamingMessagesByMsgIdResult 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;
}
EMOneWayClearUserRoamingMessagesByMsgIdResult oneWayClearUserRoamingMessagesByMsgIdResult = (EMOneWayClearUserRoamingMessagesByMsgIdResult) o;
return Objects.equals(this.requestStatusCode, oneWayClearUserRoamingMessagesByMsgIdResult.requestStatusCode);
}

@Override
public int hashCode() {
return Objects.hash(requestStatusCode);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class EMOneWayClearUserRoamingMessagesByMsgIdResult {\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<String> openapiFields;
public static HashSet<String> openapiRequiredFields;

static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet<String>();
openapiFields.add("requestStatusCode");

// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet<String>();
}

/**
* 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 EMOneWayClearUserRoamingMessagesByMsgIdResult
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!EMOneWayClearUserRoamingMessagesByMsgIdResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in EMOneWayClearUserRoamingMessagesByMsgIdResult is not found in the empty JSON string", EMOneWayClearUserRoamingMessagesByMsgIdResult.openapiRequiredFields.toString()));
}
}

Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Map.Entry<String, JsonElement> entry : entries) {
if (!EMOneWayClearUserRoamingMessagesByMsgIdResult.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EMOneWayClearUserRoamingMessagesByMsgIdResult` 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 <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
if (!EMOneWayClearUserRoamingMessagesByMsgIdResult.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'EMOneWayClearUserRoamingMessagesByMsgIdResult' and its subtypes
}
final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter<EMOneWayClearUserRoamingMessagesByMsgIdResult> thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(EMOneWayClearUserRoamingMessagesByMsgIdResult.class));

return (TypeAdapter<T>) new TypeAdapter<EMOneWayClearUserRoamingMessagesByMsgIdResult>() {
@Override
public void write(JsonWriter out, EMOneWayClearUserRoamingMessagesByMsgIdResult value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}

@Override
public EMOneWayClearUserRoamingMessagesByMsgIdResult read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}

}.nullSafe();
}
}

/**
* Create an instance of EMOneWayClearUserRoamingMessagesByMsgIdResult given an JSON string
*
* @param jsonString JSON string
* @return An instance of EMOneWayClearUserRoamingMessagesByMsgIdResult
* @throws IOException if the JSON string is invalid with respect to EMOneWayClearUserRoamingMessagesByMsgIdResult
*/
public static EMOneWayClearUserRoamingMessagesByMsgIdResult fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, EMOneWayClearUserRoamingMessagesByMsgIdResult.class);
}

/**
* Convert an instance of EMOneWayClearUserRoamingMessagesByMsgIdResult to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}

Loading

0 comments on commit 0229c1d

Please sign in to comment.