com.twilio.rest.flexapi.v1.FlexFlow Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of twilio Show documentation
Show all versions of twilio Show documentation
Twilio Java Helper Library
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Flex
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.twilio.rest.flexapi.v1;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Resource;
import com.twilio.converter.DateConverter;
import com.twilio.converter.Promoter;
import com.twilio.exception.ApiConnectionException;
import com.twilio.exception.ApiException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.time.ZonedDateTime;
import java.util.Map;
import java.util.Map;
import java.util.Objects;
import lombok.ToString;
import lombok.ToString;
@JsonIgnoreProperties(ignoreUnknown = true)
@ToString
public class FlexFlow extends Resource {
private static final long serialVersionUID = 232454907869065L;
public static FlexFlowCreator creator(
final String friendlyName,
final String chatServiceSid,
final FlexFlow.ChannelType channelType
) {
return new FlexFlowCreator(friendlyName, chatServiceSid, channelType);
}
public static FlexFlowDeleter deleter(final String pathSid) {
return new FlexFlowDeleter(pathSid);
}
public static FlexFlowFetcher fetcher(final String pathSid) {
return new FlexFlowFetcher(pathSid);
}
public static FlexFlowReader reader() {
return new FlexFlowReader();
}
public static FlexFlowUpdater updater(final String pathSid) {
return new FlexFlowUpdater(pathSid);
}
/**
* Converts a JSON String into a FlexFlow object using the provided ObjectMapper.
*
* @param json Raw JSON String
* @param objectMapper Jackson ObjectMapper
* @return FlexFlow object represented by the provided JSON
*/
public static FlexFlow fromJson(
final String json,
final ObjectMapper objectMapper
) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, FlexFlow.class);
} catch (final JsonMappingException | JsonParseException e) {
throw new ApiException(e.getMessage(), e);
} catch (final IOException e) {
throw new ApiConnectionException(e.getMessage(), e);
}
}
/**
* Converts a JSON InputStream into a FlexFlow object using the provided
* ObjectMapper.
*
* @param json Raw JSON InputStream
* @param objectMapper Jackson ObjectMapper
* @return FlexFlow object represented by the provided JSON
*/
public static FlexFlow fromJson(
final InputStream json,
final ObjectMapper objectMapper
) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, FlexFlow.class);
} catch (final JsonMappingException | JsonParseException e) {
throw new ApiException(e.getMessage(), e);
} catch (final IOException e) {
throw new ApiConnectionException(e.getMessage(), e);
}
}
public enum ChannelType {
WEB("web"),
SMS("sms"),
FACEBOOK("facebook"),
WHATSAPP("whatsapp"),
LINE("line"),
CUSTOM("custom");
private final String value;
private ChannelType(final String value) {
this.value = value;
}
public String toString() {
return value;
}
@JsonCreator
public static ChannelType forValue(final String value) {
return Promoter.enumFromString(value, ChannelType.values());
}
}
public enum IntegrationType {
STUDIO("studio"),
EXTERNAL("external"),
TASK("task");
private final String value;
private IntegrationType(final String value) {
this.value = value;
}
public String toString() {
return value;
}
@JsonCreator
public static IntegrationType forValue(final String value) {
return Promoter.enumFromString(value, IntegrationType.values());
}
}
private final String accountSid;
private final ZonedDateTime dateCreated;
private final ZonedDateTime dateUpdated;
private final String sid;
private final String friendlyName;
private final String chatServiceSid;
private final FlexFlow.ChannelType channelType;
private final String contactIdentity;
private final Boolean enabled;
private final FlexFlow.IntegrationType integrationType;
private final Map integration;
private final Boolean longLived;
private final Boolean janitorEnabled;
private final URI url;
@JsonCreator
private FlexFlow(
@JsonProperty("account_sid") final String accountSid,
@JsonProperty("date_created") final String dateCreated,
@JsonProperty("date_updated") final String dateUpdated,
@JsonProperty("sid") final String sid,
@JsonProperty("friendly_name") final String friendlyName,
@JsonProperty("chat_service_sid") final String chatServiceSid,
@JsonProperty("channel_type") final FlexFlow.ChannelType channelType,
@JsonProperty("contact_identity") final String contactIdentity,
@JsonProperty("enabled") final Boolean enabled,
@JsonProperty(
"integration_type"
) final FlexFlow.IntegrationType integrationType,
@JsonProperty("integration") final Map integration,
@JsonProperty("long_lived") final Boolean longLived,
@JsonProperty("janitor_enabled") final Boolean janitorEnabled,
@JsonProperty("url") final URI url
) {
this.accountSid = accountSid;
this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated);
this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated);
this.sid = sid;
this.friendlyName = friendlyName;
this.chatServiceSid = chatServiceSid;
this.channelType = channelType;
this.contactIdentity = contactIdentity;
this.enabled = enabled;
this.integrationType = integrationType;
this.integration = integration;
this.longLived = longLived;
this.janitorEnabled = janitorEnabled;
this.url = url;
}
public final String getAccountSid() {
return this.accountSid;
}
public final ZonedDateTime getDateCreated() {
return this.dateCreated;
}
public final ZonedDateTime getDateUpdated() {
return this.dateUpdated;
}
public final String getSid() {
return this.sid;
}
public final String getFriendlyName() {
return this.friendlyName;
}
public final String getChatServiceSid() {
return this.chatServiceSid;
}
public final FlexFlow.ChannelType getChannelType() {
return this.channelType;
}
public final String getContactIdentity() {
return this.contactIdentity;
}
public final Boolean getEnabled() {
return this.enabled;
}
public final FlexFlow.IntegrationType getIntegrationType() {
return this.integrationType;
}
public final Map getIntegration() {
return this.integration;
}
public final Boolean getLongLived() {
return this.longLived;
}
public final Boolean getJanitorEnabled() {
return this.janitorEnabled;
}
public final URI getUrl() {
return this.url;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FlexFlow other = (FlexFlow) o;
return (
Objects.equals(accountSid, other.accountSid) &&
Objects.equals(dateCreated, other.dateCreated) &&
Objects.equals(dateUpdated, other.dateUpdated) &&
Objects.equals(sid, other.sid) &&
Objects.equals(friendlyName, other.friendlyName) &&
Objects.equals(chatServiceSid, other.chatServiceSid) &&
Objects.equals(channelType, other.channelType) &&
Objects.equals(contactIdentity, other.contactIdentity) &&
Objects.equals(enabled, other.enabled) &&
Objects.equals(integrationType, other.integrationType) &&
Objects.equals(integration, other.integration) &&
Objects.equals(longLived, other.longLived) &&
Objects.equals(janitorEnabled, other.janitorEnabled) &&
Objects.equals(url, other.url)
);
}
@Override
public int hashCode() {
return Objects.hash(
accountSid,
dateCreated,
dateUpdated,
sid,
friendlyName,
chatServiceSid,
channelType,
contactIdentity,
enabled,
integrationType,
integration,
longLived,
janitorEnabled,
url
);
}
}