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

com.alipay.v3.model.AlipayMerchantLiveItemplanModifyModel Maven / Gradle / Ivy

There is a newer version: 3.1.6.ALL
Show newest version
/*
 * 支付宝开放平台API
 * 支付宝开放平台v3协议文档
 *
 * The version of the OpenAPI document: 2024-01-12
 * 
 *
 * 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.alipay.v3.model;

import java.util.Objects;
import java.util.Arrays;
import com.alipay.v3.model.ItemPlanContentDO;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.ArrayList;
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 java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import com.alipay.v3.JSON;

/**
 * AlipayMerchantLiveItemplanModifyModel
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AlipayMerchantLiveItemplanModifyModel {
  public static final String SERIALIZED_NAME_CONTENT = "content";
  @SerializedName(SERIALIZED_NAME_CONTENT)
  private List content = null;

  public static final String SERIALIZED_NAME_END_TIME = "end_time";
  @SerializedName(SERIALIZED_NAME_END_TIME)
  private String endTime;

  public static final String SERIALIZED_NAME_OP_TYPE = "op_type";
  @SerializedName(SERIALIZED_NAME_OP_TYPE)
  private String opType;

  public static final String SERIALIZED_NAME_OPERATOR_APPID = "operator_appid";
  @SerializedName(SERIALIZED_NAME_OPERATOR_APPID)
  private String operatorAppid;

  public static final String SERIALIZED_NAME_OPERATOR_TYPE = "operator_type";
  @SerializedName(SERIALIZED_NAME_OPERATOR_TYPE)
  private String operatorType;

  public static final String SERIALIZED_NAME_PLAN_NAME = "plan_name";
  @SerializedName(SERIALIZED_NAME_PLAN_NAME)
  private String planName;

  public static final String SERIALIZED_NAME_START_TIME = "start_time";
  @SerializedName(SERIALIZED_NAME_START_TIME)
  private String startTime;

  public static final String SERIALIZED_NAME_STATUS = "status";
  @SerializedName(SERIALIZED_NAME_STATUS)
  private Integer status;

  public static final String SERIALIZED_NAME_TARGET_ID = "target_id";
  @SerializedName(SERIALIZED_NAME_TARGET_ID)
  private String targetId;

  public static final String SERIALIZED_NAME_TARGET_RANGE = "target_range";
  @SerializedName(SERIALIZED_NAME_TARGET_RANGE)
  private String targetRange;

  public static final String SERIALIZED_NAME_TARGET_TYPE = "target_type";
  @SerializedName(SERIALIZED_NAME_TARGET_TYPE)
  private String targetType;

  public AlipayMerchantLiveItemplanModifyModel() { 
  }

  public AlipayMerchantLiveItemplanModifyModel content(List content) {
    
    this.content = content;
    return this;
  }

  public AlipayMerchantLiveItemplanModifyModel addContentItem(ItemPlanContentDO contentItem) {
    if (this.content == null) {
      this.content = new ArrayList<>();
    }
    this.content.add(contentItem);
    return this;
  }

   /**
   * 投放内容,数组,内容为具体条目
   * @return content
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "投放内容,数组,内容为具体条目")

  public List getContent() {
    return content;
  }


  public void setContent(List content) {
    this.content = content;
  }


  public AlipayMerchantLiveItemplanModifyModel endTime(String endTime) {
    
    this.endTime = endTime;
    return this;
  }

   /**
   * 可空,计划截止时间
   * @return endTime
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2022-01-01 00:00:01", value = "可空,计划截止时间")

  public String getEndTime() {
    return endTime;
  }


  public void setEndTime(String endTime) {
    this.endTime = endTime;
  }


  public AlipayMerchantLiveItemplanModifyModel opType(String opType) {
    
    this.opType = opType;
    return this;
  }

   /**
   * 针对投放内容的操作, 包含3种类型: 覆盖:OVERRIDE  追加:APPEND  删除:DELETE
   * @return opType
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "APPEND", value = "针对投放内容的操作, 包含3种类型: 覆盖:OVERRIDE  追加:APPEND  删除:DELETE")

  public String getOpType() {
    return opType;
  }


  public void setOpType(String opType) {
    this.opType = opType;
  }


  public AlipayMerchantLiveItemplanModifyModel operatorAppid(String operatorAppid) {
    
    this.operatorAppid = operatorAppid;
    return this;
  }

   /**
   * 投放方标识,一般为小程序id
   * @return operatorAppid
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2021003126612033", value = "投放方标识,一般为小程序id")

  public String getOperatorAppid() {
    return operatorAppid;
  }


  public void setOperatorAppid(String operatorAppid) {
    this.operatorAppid = operatorAppid;
  }


  public AlipayMerchantLiveItemplanModifyModel operatorType(String operatorType) {
    
    this.operatorType = operatorType;
    return this;
  }

   /**
   * 投放方类型,生活号:LIFE_APP 达人:CONTENT_USER 小程序:TINYAPP
   * @return operatorType
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "TINYAPP", value = "投放方类型,生活号:LIFE_APP 达人:CONTENT_USER 小程序:TINYAPP")

  public String getOperatorType() {
    return operatorType;
  }


  public void setOperatorType(String operatorType) {
    this.operatorType = operatorType;
  }


  public AlipayMerchantLiveItemplanModifyModel planName(String planName) {
    
    this.planName = planName;
    return this;
  }

   /**
   * 投放计划名,可空
   * @return planName
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "测试计划", value = "投放计划名,可空")

  public String getPlanName() {
    return planName;
  }


  public void setPlanName(String planName) {
    this.planName = planName;
  }


  public AlipayMerchantLiveItemplanModifyModel startTime(String startTime) {
    
    this.startTime = startTime;
    return this;
  }

   /**
   * 可空,计划生效时间
   * @return startTime
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2022-01-01 00:00:01", value = "可空,计划生效时间")

  public String getStartTime() {
    return startTime;
  }


  public void setStartTime(String startTime) {
    this.startTime = startTime;
  }


  public AlipayMerchantLiveItemplanModifyModel status(Integer status) {
    
    this.status = status;
    return this;
  }

   /**
   * 计划状态 0待生效 1生效中 -1已作废
   * @return status
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "1", value = "计划状态 0待生效 1生效中 -1已作废")

  public Integer getStatus() {
    return status;
  }


  public void setStatus(Integer status) {
    this.status = status;
  }


  public AlipayMerchantLiveItemplanModifyModel targetId(String targetId) {
    
    this.targetId = targetId;
    return this;
  }

   /**
   * 投放目标,一般为生活号id,多个逗号隔开
   * @return targetId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "2021003126612050", value = "投放目标,一般为生活号id,多个逗号隔开")

  public String getTargetId() {
    return targetId;
  }


  public void setTargetId(String targetId) {
    this.targetId = targetId;
  }


  public AlipayMerchantLiveItemplanModifyModel targetRange(String targetRange) {
    
    this.targetRange = targetRange;
    return this;
  }

   /**
   * 投放范围, 指主体内的具体子渠道,为空则任意子渠道
   * @return targetRange
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "空", value = "投放范围, 指主体内的具体子渠道,为空则任意子渠道")

  public String getTargetRange() {
    return targetRange;
  }


  public void setTargetRange(String targetRange) {
    this.targetRange = targetRange;
  }


  public AlipayMerchantLiveItemplanModifyModel targetType(String targetType) {
    
    this.targetType = targetType;
    return this;
  }

   /**
   * 投放目标类型 生活号:LIFE_APP  达人:CONTENT_USER  小程序:TINYAPP
   * @return targetType
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "PUBLICAPP", value = "投放目标类型 生活号:LIFE_APP  达人:CONTENT_USER  小程序:TINYAPP")

  public String getTargetType() {
    return targetType;
  }


  public void setTargetType(String targetType) {
    this.targetType = targetType;
  }

  /**
   * A container for additional, undeclared properties.
   * This is a holder for any undeclared properties as specified with
   * the 'additionalProperties' keyword in the OAS document.
   */
  private Map additionalProperties;

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   *
   * @param key name of the property
   * @param value value of the property
   * @return the AlipayMerchantLiveItemplanModifyModel instance itself
   */
  public AlipayMerchantLiveItemplanModifyModel putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Return the additional (undeclared) property.
   *
   * @return a map of objects
   */
  public Map getAdditionalProperties() {
    return additionalProperties;
  }

  /**
   * Return the additional (undeclared) property with the specified name.
   *
   * @param key name of the property
   * @return an object
   */
  public Object getAdditionalProperty(String key) {
    if (this.additionalProperties == null) {
        return null;
    }
    return this.additionalProperties.get(key);
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    AlipayMerchantLiveItemplanModifyModel alipayMerchantLiveItemplanModifyModel = (AlipayMerchantLiveItemplanModifyModel) o;
    return Objects.equals(this.content, alipayMerchantLiveItemplanModifyModel.content) &&
        Objects.equals(this.endTime, alipayMerchantLiveItemplanModifyModel.endTime) &&
        Objects.equals(this.opType, alipayMerchantLiveItemplanModifyModel.opType) &&
        Objects.equals(this.operatorAppid, alipayMerchantLiveItemplanModifyModel.operatorAppid) &&
        Objects.equals(this.operatorType, alipayMerchantLiveItemplanModifyModel.operatorType) &&
        Objects.equals(this.planName, alipayMerchantLiveItemplanModifyModel.planName) &&
        Objects.equals(this.startTime, alipayMerchantLiveItemplanModifyModel.startTime) &&
        Objects.equals(this.status, alipayMerchantLiveItemplanModifyModel.status) &&
        Objects.equals(this.targetId, alipayMerchantLiveItemplanModifyModel.targetId) &&
        Objects.equals(this.targetRange, alipayMerchantLiveItemplanModifyModel.targetRange) &&
        Objects.equals(this.targetType, alipayMerchantLiveItemplanModifyModel.targetType)&&
        Objects.equals(this.additionalProperties, alipayMerchantLiveItemplanModifyModel.additionalProperties);
  }

  @Override
  public int hashCode() {
    return Objects.hash(content, endTime, opType, operatorAppid, operatorType, planName, startTime, status, targetId, targetRange, targetType, additionalProperties);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class AlipayMerchantLiveItemplanModifyModel {\n");
    sb.append("    content: ").append(toIndentedString(content)).append("\n");
    sb.append("    endTime: ").append(toIndentedString(endTime)).append("\n");
    sb.append("    opType: ").append(toIndentedString(opType)).append("\n");
    sb.append("    operatorAppid: ").append(toIndentedString(operatorAppid)).append("\n");
    sb.append("    operatorType: ").append(toIndentedString(operatorType)).append("\n");
    sb.append("    planName: ").append(toIndentedString(planName)).append("\n");
    sb.append("    startTime: ").append(toIndentedString(startTime)).append("\n");
    sb.append("    status: ").append(toIndentedString(status)).append("\n");
    sb.append("    targetId: ").append(toIndentedString(targetId)).append("\n");
    sb.append("    targetRange: ").append(toIndentedString(targetRange)).append("\n");
    sb.append("    targetType: ").append(toIndentedString(targetType)).append("\n");
    sb.append("    additionalProperties: ").append(toIndentedString(additionalProperties)).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("content");
    openapiFields.add("end_time");
    openapiFields.add("op_type");
    openapiFields.add("operator_appid");
    openapiFields.add("operator_type");
    openapiFields.add("plan_name");
    openapiFields.add("start_time");
    openapiFields.add("status");
    openapiFields.add("target_id");
    openapiFields.add("target_range");
    openapiFields.add("target_type");

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

 /**
  * Validates the JSON Object and throws an exception if issues found
  *
  * @param jsonObj JSON Object
  * @throws IOException if the JSON Object is invalid with respect to AlipayMerchantLiveItemplanModifyModel
  */
  public static void validateJsonObject(JsonObject jsonObj) throws IOException {
      if (jsonObj == null) {
        if (AlipayMerchantLiveItemplanModifyModel.openapiRequiredFields.isEmpty()) {
          return;
        } else { // has required fields
          throw new IllegalArgumentException(String.format("The required field(s) %s in AlipayMerchantLiveItemplanModifyModel is not found in the empty JSON string", AlipayMerchantLiveItemplanModifyModel.openapiRequiredFields.toString()));
        }
      }
      JsonArray jsonArraycontent = jsonObj.getAsJsonArray("content");
      if (jsonArraycontent != null) {
        // ensure the json data is an array
        if (!jsonObj.get("content").isJsonArray()) {
          throw new IllegalArgumentException(String.format("Expected the field `content` to be an array in the JSON string but got `%s`", jsonObj.get("content").toString()));
        }

        // validate the optional field `content` (array)
        for (int i = 0; i < jsonArraycontent.size(); i++) {
          ItemPlanContentDO.validateJsonObject(jsonArraycontent.get(i).getAsJsonObject());
        };
      }
      if (jsonObj.get("end_time") != null && !jsonObj.get("end_time").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `end_time` to be a primitive type in the JSON string but got `%s`", jsonObj.get("end_time").toString()));
      }
      if (jsonObj.get("op_type") != null && !jsonObj.get("op_type").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `op_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("op_type").toString()));
      }
      if (jsonObj.get("operator_appid") != null && !jsonObj.get("operator_appid").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `operator_appid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("operator_appid").toString()));
      }
      if (jsonObj.get("operator_type") != null && !jsonObj.get("operator_type").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `operator_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("operator_type").toString()));
      }
      if (jsonObj.get("plan_name") != null && !jsonObj.get("plan_name").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `plan_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("plan_name").toString()));
      }
      if (jsonObj.get("start_time") != null && !jsonObj.get("start_time").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `start_time` to be a primitive type in the JSON string but got `%s`", jsonObj.get("start_time").toString()));
      }
      if (jsonObj.get("target_id") != null && !jsonObj.get("target_id").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `target_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("target_id").toString()));
      }
      if (jsonObj.get("target_range") != null && !jsonObj.get("target_range").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `target_range` to be a primitive type in the JSON string but got `%s`", jsonObj.get("target_range").toString()));
      }
      if (jsonObj.get("target_type") != null && !jsonObj.get("target_type").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `target_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("target_type").toString()));
      }
  }

  public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
    @SuppressWarnings("unchecked")
    @Override
    public  TypeAdapter create(Gson gson, TypeToken type) {
       if (!AlipayMerchantLiveItemplanModifyModel.class.isAssignableFrom(type.getRawType())) {
         return null; // this class only serializes 'AlipayMerchantLiveItemplanModifyModel' and its subtypes
       }
       final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
       final TypeAdapter thisAdapter
                        = gson.getDelegateAdapter(this, TypeToken.get(AlipayMerchantLiveItemplanModifyModel.class));

       return (TypeAdapter) new TypeAdapter() {
           @Override
           public void write(JsonWriter out, AlipayMerchantLiveItemplanModifyModel value) throws IOException {
             JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
             obj.remove("additionalProperties");
             // serialize additonal properties
             if (value.getAdditionalProperties() != null) {
               for (Map.Entry entry : value.getAdditionalProperties().entrySet()) {
                 if (entry.getValue() instanceof String)
                   obj.addProperty(entry.getKey(), (String) entry.getValue());
                 else if (entry.getValue() instanceof Number)
                   obj.addProperty(entry.getKey(), (Number) entry.getValue());
                 else if (entry.getValue() instanceof Boolean)
                   obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
                 else if (entry.getValue() instanceof Character)
                   obj.addProperty(entry.getKey(), (Character) entry.getValue());
                 else {
                   obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
                 }
               }
             }
             elementAdapter.write(out, obj);
           }

           @Override
           public AlipayMerchantLiveItemplanModifyModel read(JsonReader in) throws IOException {
             JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
             validateJsonObject(jsonObj);
             // store additional fields in the deserialized instance
             AlipayMerchantLiveItemplanModifyModel instance = thisAdapter.fromJsonTree(jsonObj);
             for (Map.Entry entry : jsonObj.entrySet()) {
               if (!openapiFields.contains(entry.getKey())) {
                 if (entry.getValue().isJsonPrimitive()) { // primitive type
                   if (entry.getValue().getAsJsonPrimitive().isString())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
                   else if (entry.getValue().getAsJsonPrimitive().isNumber())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
                   else if (entry.getValue().getAsJsonPrimitive().isBoolean())
                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
                   else
                     throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
                 } else { // non-primitive type
                   instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
                 }
               }
             }
             return instance;
           }

       }.nullSafe();
    }
  }

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

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy