com.twilio.rest.monitor.v1.Event 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 - Monitor
* 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.monitor.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.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 Event extends Resource {
private static final long serialVersionUID = 206221188315695L;
public static EventFetcher fetcher(final String pathSid) {
return new EventFetcher(pathSid);
}
public static EventReader reader() {
return new EventReader();
}
/**
* Converts a JSON String into a Event object using the provided ObjectMapper.
*
* @param json Raw JSON String
* @param objectMapper Jackson ObjectMapper
* @return Event object represented by the provided JSON
*/
public static Event fromJson(
final String json,
final ObjectMapper objectMapper
) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, Event.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 Event object using the provided
* ObjectMapper.
*
* @param json Raw JSON InputStream
* @param objectMapper Jackson ObjectMapper
* @return Event object represented by the provided JSON
*/
public static Event fromJson(
final InputStream json,
final ObjectMapper objectMapper
) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, Event.class);
} catch (final JsonMappingException | JsonParseException e) {
throw new ApiException(e.getMessage(), e);
} catch (final IOException e) {
throw new ApiConnectionException(e.getMessage(), e);
}
}
private final String accountSid;
private final String actorSid;
private final String actorType;
private final String description;
private final Map eventData;
private final ZonedDateTime eventDate;
private final String eventType;
private final String resourceSid;
private final String resourceType;
private final String sid;
private final String source;
private final String sourceIpAddress;
private final URI url;
private final Map links;
@JsonCreator
private Event(
@JsonProperty("account_sid") final String accountSid,
@JsonProperty("actor_sid") final String actorSid,
@JsonProperty("actor_type") final String actorType,
@JsonProperty("description") final String description,
@JsonProperty("event_data") final Map eventData,
@JsonProperty("event_date") final String eventDate,
@JsonProperty("event_type") final String eventType,
@JsonProperty("resource_sid") final String resourceSid,
@JsonProperty("resource_type") final String resourceType,
@JsonProperty("sid") final String sid,
@JsonProperty("source") final String source,
@JsonProperty("source_ip_address") final String sourceIpAddress,
@JsonProperty("url") final URI url,
@JsonProperty("links") final Map links
) {
this.accountSid = accountSid;
this.actorSid = actorSid;
this.actorType = actorType;
this.description = description;
this.eventData = eventData;
this.eventDate = DateConverter.iso8601DateTimeFromString(eventDate);
this.eventType = eventType;
this.resourceSid = resourceSid;
this.resourceType = resourceType;
this.sid = sid;
this.source = source;
this.sourceIpAddress = sourceIpAddress;
this.url = url;
this.links = links;
}
public final String getAccountSid() {
return this.accountSid;
}
public final String getActorSid() {
return this.actorSid;
}
public final String getActorType() {
return this.actorType;
}
public final String getDescription() {
return this.description;
}
public final Map getEventData() {
return this.eventData;
}
public final ZonedDateTime getEventDate() {
return this.eventDate;
}
public final String getEventType() {
return this.eventType;
}
public final String getResourceSid() {
return this.resourceSid;
}
public final String getResourceType() {
return this.resourceType;
}
public final String getSid() {
return this.sid;
}
public final String getSource() {
return this.source;
}
public final String getSourceIpAddress() {
return this.sourceIpAddress;
}
public final URI getUrl() {
return this.url;
}
public final Map getLinks() {
return this.links;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Event other = (Event) o;
return (
Objects.equals(accountSid, other.accountSid) &&
Objects.equals(actorSid, other.actorSid) &&
Objects.equals(actorType, other.actorType) &&
Objects.equals(description, other.description) &&
Objects.equals(eventData, other.eventData) &&
Objects.equals(eventDate, other.eventDate) &&
Objects.equals(eventType, other.eventType) &&
Objects.equals(resourceSid, other.resourceSid) &&
Objects.equals(resourceType, other.resourceType) &&
Objects.equals(sid, other.sid) &&
Objects.equals(source, other.source) &&
Objects.equals(sourceIpAddress, other.sourceIpAddress) &&
Objects.equals(url, other.url) &&
Objects.equals(links, other.links)
);
}
@Override
public int hashCode() {
return Objects.hash(
accountSid,
actorSid,
actorType,
description,
eventData,
eventDate,
eventType,
resourceSid,
resourceType,
sid,
source,
sourceIpAddress,
url,
links
);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy