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

com.lob.model.CampaignCreative Maven / Gradle / Ivy

The newest version!
/*
 * Lob
 * The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors. 

Looking for our [previous documentation](https://lob.github.io/legacy-docs/)? * * The version of the OpenAPI document: 1.3.0 * Contact: [email protected] * * 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.lob.model; import java.util.Objects; import java.util.Arrays; 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 com.lob.model.Campaign; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; import java.util.HashMap; import java.util.Map; /** * CampaignCreative */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class CampaignCreative { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) private String id; /** * Unique identifier prefixed with `crv_`. * @return id **/ @javax.annotation.Nullable public String getId() { return id; } public void setId (String id) throws IllegalArgumentException { if(!id.matches("^crv_[a-zA-Z0-9]+$")) { throw new IllegalArgumentException("Invalid id provided"); } this.id = id; } public static final String SERIALIZED_NAME_DESCRIPTION = "description"; @SerializedName(SERIALIZED_NAME_DESCRIPTION) private String description; /** * An internal description that identifies this resource. Must be no longer than 255 characters. * @return description **/ @javax.annotation.Nullable @ApiModelProperty(value = "An internal description that identifies this resource. Must be no longer than 255 characters. ") public String getDescription() { return description; } public static final String SERIALIZED_NAME_FROM = "from"; @SerializedName(SERIALIZED_NAME_FROM) private String from; public String getFrom() { return from; } public void setFrom(String from) { this.from = from; } public void setFrom(AddressEditable from) { Gson gson = new Gson(); this.from = gson.toJson(from); } /** * Mailpiece type for the creative */ @JsonAdapter(ResourceTypeEnum.Adapter.class) public enum ResourceTypeEnum { LETTER("letter"), POSTCARD("postcard"); private String value; ResourceTypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ResourceTypeEnum fromValue(String value) { for (ResourceTypeEnum b : ResourceTypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter { @Override public void write(final JsonWriter jsonWriter, final ResourceTypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ResourceTypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ResourceTypeEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_RESOURCE_TYPE = "resource_type"; @SerializedName(SERIALIZED_NAME_RESOURCE_TYPE) private ResourceTypeEnum resourceType; /** * Mailpiece type for the creative * @return resourceType **/ @javax.annotation.Nullable @ApiModelProperty(value = "Mailpiece type for the creative") public ResourceTypeEnum getResourceType() { return resourceType; } public static final String SERIALIZED_NAME_DETAILS = "details"; @SerializedName(SERIALIZED_NAME_DETAILS) private String details; public String getDetails() { return details; } public void setDetails(String details) { this.details = details; } public void setDetails(PostcardDetailsWritable details) { Gson gson = new Gson(); this.details = gson.toJson(details); } public void setDetails(LetterDetailsWritable details) { Gson gson = new Gson(); this.details = gson.toJson(details); } public static final String SERIALIZED_NAME_METADATA = "metadata"; @SerializedName(SERIALIZED_NAME_METADATA) private Map metadata = null; public Map getMetadata() { if (this.metadata == null) { this.metadata = new HashMap(); } return this.metadata; } public static final String SERIALIZED_NAME_TEMPLATE_PREVIEW_URLS = "template_preview_urls"; @SerializedName(SERIALIZED_NAME_TEMPLATE_PREVIEW_URLS) private Object templatePreviewUrls; /** * Preview URLs associated with a creative's artwork asset(s) if the creative uses HTML templates as assets. * @return templatePreviewUrls **/ @javax.annotation.Nullable @ApiModelProperty(value = "Preview URLs associated with a creative's artwork asset(s) if the creative uses HTML templates as assets.") public Object getTemplatePreviewUrls() { return templatePreviewUrls; } public static final String SERIALIZED_NAME_TEMPLATE_PREVIEWS = "template_previews"; @SerializedName(SERIALIZED_NAME_TEMPLATE_PREVIEWS) private List templatePreviews = null; public List getTemplatePreviews() { if (this.templatePreviews == null) { this.templatePreviews = new ArrayList(); } return this.templatePreviews; } public static final String SERIALIZED_NAME_DELETED = "deleted"; @SerializedName(SERIALIZED_NAME_DELETED) private Boolean deleted; /** * Only returned if the resource has been successfully deleted. * @return deleted **/ @javax.annotation.Nullable @ApiModelProperty(value = "Only returned if the resource has been successfully deleted.") public Boolean getDeleted() { return deleted; } public static final String SERIALIZED_NAME_CAMPAIGNS = "campaigns"; @SerializedName(SERIALIZED_NAME_CAMPAIGNS) private List campaigns = null; public List getCampaigns() { if (this.campaigns == null) { this.campaigns = new ArrayList(); } return this.campaigns; } public static final String SERIALIZED_NAME_DATE_CREATED = "date_created"; @SerializedName(SERIALIZED_NAME_DATE_CREATED) private OffsetDateTime dateCreated; /** * A timestamp in ISO 8601 format of the date the resource was created. * @return dateCreated **/ @javax.annotation.Nullable @ApiModelProperty(value = "A timestamp in ISO 8601 format of the date the resource was created.") public OffsetDateTime getDateCreated() { return dateCreated; } public static final String SERIALIZED_NAME_DATE_MODIFIED = "date_modified"; @SerializedName(SERIALIZED_NAME_DATE_MODIFIED) private OffsetDateTime dateModified; /** * A timestamp in ISO 8601 format of the date the resource was last modified. * @return dateModified **/ @javax.annotation.Nullable @ApiModelProperty(value = "A timestamp in ISO 8601 format of the date the resource was last modified.") public OffsetDateTime getDateModified() { return dateModified; } /** * Value is resource type. */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { CREATIVE("creative"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) private ObjectEnum _object = ObjectEnum.CREATIVE; /** * Value is resource type. * @return _object **/ @javax.annotation.Nullable @ApiModelProperty(value = "Value is resource type.") public ObjectEnum getObject() { return _object; } /* public CampaignCreative id(String id) { this.id = id; return this; } */ /* public CampaignCreative description(String description) { this.description = description; return this; } */ public void setDescription(String description) { this.description = description; } /* public CampaignCreative from(Object from) { this.from = from; return this; } */ /* public CampaignCreative resourceType(ResourceTypeEnum resourceType) { this.resourceType = resourceType; return this; } */ public void setResourceType(ResourceTypeEnum resourceType) { this.resourceType = resourceType; } /* public CampaignCreative details(Object details) { this.details = details; return this; } */ /* public CampaignCreative metadata(Map metadata) { this.metadata = metadata; return this; } */ public CampaignCreative putMetadataItem(String key, String metadataItem) { if (this.metadata == null) { this.metadata = new HashMap(); } this.metadata.put(key, metadataItem); return this; } public void setMetadata(Map metadata) { this.metadata = metadata; } /* public CampaignCreative templatePreviewUrls(Object templatePreviewUrls) { this.templatePreviewUrls = templatePreviewUrls; return this; } */ public void setTemplatePreviewUrls(Object templatePreviewUrls) { this.templatePreviewUrls = templatePreviewUrls; } /* public CampaignCreative templatePreviews(List templatePreviews) { this.templatePreviews = templatePreviews; return this; } */ public CampaignCreative addTemplatePreviewsItem(Object templatePreviewsItem) { if (this.templatePreviews == null) { this.templatePreviews = new ArrayList(); } this.templatePreviews.add(templatePreviewsItem); return this; } public void setTemplatePreviews(List templatePreviews) { this.templatePreviews = templatePreviews; } /* public CampaignCreative deleted(Boolean deleted) { this.deleted = deleted; return this; } */ public void setDeleted(Boolean deleted) { this.deleted = deleted; } /* public CampaignCreative campaigns(List campaigns) { this.campaigns = campaigns; return this; } */ public CampaignCreative addCampaignsItem(Campaign campaignsItem) { if (this.campaigns == null) { this.campaigns = new ArrayList(); } this.campaigns.add(campaignsItem); return this; } public void setCampaigns(List campaigns) { this.campaigns = campaigns; } /* public CampaignCreative dateCreated(OffsetDateTime dateCreated) { this.dateCreated = dateCreated; return this; } */ public void setDateCreated(OffsetDateTime dateCreated) { this.dateCreated = dateCreated; } /* public CampaignCreative dateModified(OffsetDateTime dateModified) { this.dateModified = dateModified; return this; } */ public void setDateModified(OffsetDateTime dateModified) { this.dateModified = dateModified; } /* public CampaignCreative _object(ObjectEnum _object) { this._object = _object; return this; } */ public void setObject(ObjectEnum _object) { this._object = _object; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CampaignCreative campaignCreative = (CampaignCreative) o; return Objects.equals(this.id, campaignCreative.id) && Objects.equals(this.description, campaignCreative.description) && Objects.equals(this.from, campaignCreative.from) && Objects.equals(this.resourceType, campaignCreative.resourceType) && Objects.equals(this.details, campaignCreative.details) && Objects.equals(this.metadata, campaignCreative.metadata) && Objects.equals(this.templatePreviewUrls, campaignCreative.templatePreviewUrls) && Objects.equals(this.templatePreviews, campaignCreative.templatePreviews) && Objects.equals(this.deleted, campaignCreative.deleted) && Objects.equals(this.campaigns, campaignCreative.campaigns) && Objects.equals(this.dateCreated, campaignCreative.dateCreated) && Objects.equals(this.dateModified, campaignCreative.dateModified) && Objects.equals(this._object, campaignCreative._object); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); } @Override public int hashCode() { return Objects.hash(id, description, from, resourceType, details, metadata, templatePreviewUrls, templatePreviews, deleted, campaigns, dateCreated, dateModified, _object); } private static int hashCodeNullable(JsonNullable a) { if (a == null) { return 1; } return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" from: ").append(toIndentedString(from)).append("\n"); sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); sb.append(" details: ").append(toIndentedString(details)).append("\n"); sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); sb.append(" templatePreviewUrls: ").append(toIndentedString(templatePreviewUrls)).append("\n"); sb.append(" templatePreviews: ").append(toIndentedString(templatePreviews)).append("\n"); sb.append(" deleted: ").append(toIndentedString(deleted)).append("\n"); sb.append(" campaigns: ").append(toIndentedString(campaigns)).append("\n"); sb.append(" dateCreated: ").append(toIndentedString(dateCreated)).append("\n"); sb.append(" dateModified: ").append(toIndentedString(dateModified)).append("\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append("}"); return sb.toString(); } public Map toMap() { Map localMap = new HashMap(); localMap.put("id", id); localMap.put("description", description); localMap.put("from", from); localMap.put("resource_type", resourceType); localMap.put("details", details); localMap.put("metadata", metadata); localMap.put("template_preview_urls", templatePreviewUrls); localMap.put("template_previews", templatePreviews); localMap.put("deleted", deleted); localMap.put("campaigns", campaigns); localMap.put("date_created", dateCreated); localMap.put("date_modified", dateModified); localMap.put("object", _object); return localMap; } /** * 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 "); } }