com.azure.communication.callautomation.models.events.CallTransferAccepted Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-communication-callautomation Show documentation
Show all versions of azure-communication-callautomation Show documentation
This package contains clients and data structures used to make call with Azure Communication Call Automation Service.
For this release, see notes - https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/communication/azure-communication-callautomation/README.md and https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/communication/azure-communication-callautomation/CHANGELOG.md.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.communication.callautomation.models.events;
import java.io.IOException;
import com.azure.communication.callautomation.implementation.converters.CommunicationIdentifierConverter;
import com.azure.communication.callautomation.implementation.models.CommunicationIdentifierModel;
import com.azure.communication.common.CommunicationIdentifier;
import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
/** The CallTransferAccepted model. */
@Immutable
public final class CallTransferAccepted extends CallAutomationEventBase {
/**
* The participant who is being transferred away.
*/
private CommunicationIdentifier transferee;
/**
* Target to whom the call is transferred.
*/
private CommunicationIdentifier transferTarget;
private CallTransferAccepted() {
}
/**
* The participant who is being transferred away
* @return the transferee value
*/
public CommunicationIdentifier getTransferee() {
return this.transferee;
}
/**
* Target to whom the call is transferred.
* @return the transferTarget value
*/
public CommunicationIdentifier getTransferTarget() {
return this.transferTarget;
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("transferee", CommunicationIdentifierConverter.convert(transferee));
jsonWriter.writeJsonField("transferTarget", CommunicationIdentifierConverter.convert(transferTarget));
super.writeFields(jsonWriter);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of CallTransferAccepted from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of CallTransferAccepted 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 CallTransferAccepted.
*/
public static CallTransferAccepted fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
final CallTransferAccepted event = new CallTransferAccepted();
while (jsonReader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("transferee".equals(fieldName)) {
final CommunicationIdentifierModel inner = CommunicationIdentifierModel.fromJson(reader);
event.transferee = CommunicationIdentifierConverter.convert(inner);
} else if ("transferTarget".equals(fieldName)) {
final CommunicationIdentifierModel inner = CommunicationIdentifierModel.fromJson(reader);
event.transferTarget = CommunicationIdentifierConverter.convert(inner);
} else {
if (!event.readField(fieldName, reader)) {
reader.skipChildren();
}
}
}
return event;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy