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

com.mailersend.sms.webhooks.SmsWebhook Maven / Gradle / Ivy

/*************************************************
 * MailerSend Java SDK
 * https://github.com/mailersend/mailersend-java
 * 
 * @author MailerSend 
 * https://mailersend.com
 **************************************************/
package com.mailersend.sms.webhooks;

import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.util.Date;

import com.google.gson.annotations.SerializedName;
import com.mailersend.sdk.sms.phonenumbers.PhoneNumber;

/**
 * 

SmsWebhook class.

* * @author mailersend * @version $Id: $Id */ public class SmsWebhook { @SerializedName("id") public String id; @SerializedName("url") public String url; @SerializedName("events") public String[] events; @SerializedName("name") public String name; @SerializedName("enabled") public Boolean enabled; @SerializedName("editable") public Boolean editable; public Date createdAt; @SerializedName("created_at") private String createdAtStr; public Date updatedAt; @SerializedName("updated_at") private String updatedAtStr; @SerializedName("sms_number") public PhoneNumber smsNumber; /** * Is called to perform any actions after the deserialization of the response * Do not call directly */ protected void postDeserialize() { parseDates(); if (smsNumber != null) { smsNumber.postDeserialize(); } } /** * Parses the string dates from the response into java.util.Date objects */ protected void parseDates() { TemporalAccessor ta; Instant instant; if (createdAtStr != null && !createdAtStr.isBlank()) { ta = DateTimeFormatter.ISO_INSTANT.parse(createdAtStr); instant = Instant.from(ta); createdAt = Date.from(instant); } if (updatedAtStr != null && !updatedAtStr.isBlank()) { ta = DateTimeFormatter.ISO_INSTANT.parse(updatedAtStr); instant = Instant.from(ta); updatedAt = Date.from(instant); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy