com.azure.messaging.eventgrid.systemevents.AcsChatThreadEventBaseProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-messaging-eventgrid Show documentation
Show all versions of azure-messaging-eventgrid Show documentation
This package contains Microsoft Azure EventGrid SDK.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.messaging.eventgrid.systemevents;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
/**
* Schema of common properties of all chat thread events.
*/
@Fluent
public class AcsChatThreadEventBaseProperties extends AcsChatEventBaseProperties {
/*
* The original creation time of the thread
*/
private OffsetDateTime createTime;
/*
* The version of the thread
*/
private Long version;
/**
* Creates an instance of AcsChatThreadEventBaseProperties class.
*/
public AcsChatThreadEventBaseProperties() {
}
/**
* Get the createTime property: The original creation time of the thread.
*
* @return the createTime value.
*/
public OffsetDateTime getCreateTime() {
return this.createTime;
}
/**
* Set the createTime property: The original creation time of the thread.
*
* @param createTime the createTime value to set.
* @return the AcsChatThreadEventBaseProperties object itself.
*/
public AcsChatThreadEventBaseProperties setCreateTime(OffsetDateTime createTime) {
this.createTime = createTime;
return this;
}
/**
* Get the version property: The version of the thread.
*
* @return the version value.
*/
public Long getVersion() {
return this.version;
}
/**
* Set the version property: The version of the thread.
*
* @param version the version value to set.
* @return the AcsChatThreadEventBaseProperties object itself.
*/
public AcsChatThreadEventBaseProperties setVersion(Long version) {
this.version = version;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public AcsChatThreadEventBaseProperties
setRecipientCommunicationIdentifier(CommunicationIdentifierModel recipientCommunicationIdentifier) {
super.setRecipientCommunicationIdentifier(recipientCommunicationIdentifier);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public AcsChatThreadEventBaseProperties setTransactionId(String transactionId) {
super.setTransactionId(transactionId);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public AcsChatThreadEventBaseProperties setThreadId(String threadId) {
super.setThreadId(threadId);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("recipientCommunicationIdentifier", getRecipientCommunicationIdentifier());
jsonWriter.writeStringField("transactionId", getTransactionId());
jsonWriter.writeStringField("threadId", getThreadId());
jsonWriter.writeStringField("createTime",
this.createTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createTime));
jsonWriter.writeNumberField("version", this.version);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AcsChatThreadEventBaseProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AcsChatThreadEventBaseProperties if the JsonReader was pointing to an instance of it, or
* null if it was pointing to JSON null.
* @throws IOException If an error occurs while reading the AcsChatThreadEventBaseProperties.
*/
public static AcsChatThreadEventBaseProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AcsChatThreadEventBaseProperties deserializedAcsChatThreadEventBaseProperties
= new AcsChatThreadEventBaseProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("recipientCommunicationIdentifier".equals(fieldName)) {
deserializedAcsChatThreadEventBaseProperties
.setRecipientCommunicationIdentifier(CommunicationIdentifierModel.fromJson(reader));
} else if ("transactionId".equals(fieldName)) {
deserializedAcsChatThreadEventBaseProperties.setTransactionId(reader.getString());
} else if ("threadId".equals(fieldName)) {
deserializedAcsChatThreadEventBaseProperties.setThreadId(reader.getString());
} else if ("createTime".equals(fieldName)) {
deserializedAcsChatThreadEventBaseProperties.createTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("version".equals(fieldName)) {
deserializedAcsChatThreadEventBaseProperties.version = reader.getNullable(JsonReader::getLong);
} else {
reader.skipChildren();
}
}
return deserializedAcsChatThreadEventBaseProperties;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy