Skip to content

Commit

Permalink
Use JSON annotated event definition (#22101)
Browse files Browse the repository at this point in the history
* Use json annotated event definition

* update newly generated classes
  • Loading branch information
arifsaikat-microsoft authored and chrwhit committed Jun 10, 2021
1 parent b69b82d commit 4b58902
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 388 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,33 @@
package com.azure.communication.callingserver.models.events;

import com.azure.communication.callingserver.models.CallState;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.BinaryData;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* The call leg state change event.
*/
public final class CallLegStateChangedEvent extends CallingServerEventBase {
/**
* The event type.
/** The call state change event. */
@Fluent
public final class CallLegStateChangedEvent {
/*
* The conversation.id.
*/
public static final String EVENT_TYPE = "Microsoft.Communication.CallLegStateChanged";
@JsonProperty(value = "conversationId")
private String conversationId;

/**
* The conversation id.
/*
* The call leg.id.
*/
private String conversationId;
@JsonProperty(value = "callLegId")
private String callLegId;

/*
* The call state.
*/
@JsonProperty(value = "callState")
private CallState callState;

/**
* Get the conversation id.
* Get the conversationId property: The conversation.id.
*
* @return the conversationId value.
*/
Expand All @@ -30,9 +39,9 @@ public String getConversationId() {
}

/**
* Set the subject.
* Set the conversationId property: The conversation.id.
*
* @param conversationId the conversation id.
* @param conversationId the conversationId value to set.
* @return the CallLegStateChangedEvent object itself.
*/
public CallLegStateChangedEvent setConversationId(String conversationId) {
Expand All @@ -41,23 +50,18 @@ public CallLegStateChangedEvent setConversationId(String conversationId) {
}

/**
* The call leg.id.
*/
private String callLegId;

/**
* Get the call leg id.
* Get the callLegId property: The call leg.id.
*
* @return the call leg id value.
* @return the callLegId value.
*/
public String getCallLegId() {
return this.callLegId;
}

/**
* Set the subject.
* Set the callLegId property: The call leg.id.
*
* @param callLegId the call leg id.
* @param callLegId the callLegId value to set.
* @return the CallLegStateChangedEvent object itself.
*/
public CallLegStateChangedEvent setCallLegId(String callLegId) {
Expand All @@ -66,60 +70,25 @@ public CallLegStateChangedEvent setCallLegId(String callLegId) {
}

/**
* The call state.
*/
private CallState callState;

/**
* Get the call state.
* Get the callState property: The call state.
*
* @return the call state value.
* @return the callState value.
*/
public CallState getCallState() {
return this.callState;
}

/**
* Set the call state.
* Set the callState property: The call state.
*
* @param callState the call state.
* @param callState the callState value to set.
* @return the CallLegStateChangedEvent object itself.
*/
public CallLegStateChangedEvent setCallState(CallState callState) {
this.callState = callState;
return this;
}

/**
* Initializes a new instance of CallLegStateChangedEvent.
*/
public CallLegStateChangedEvent() {

}

/**
* Initializes a new instance of CallLegStateChangedEvent.
*
* @param conversationId The conversation id.
* @param callLegId The call leg id.
* @param callState The call state.
* @throws IllegalArgumentException if any parameter is null or empty.
*/
public CallLegStateChangedEvent(String conversationId, String callLegId, CallState callState) {
if (conversationId == null || conversationId.isEmpty()) {
throw new IllegalArgumentException("object conversationId cannot be null or empty");
}
if (callLegId == null || callLegId.isEmpty()) {
throw new IllegalArgumentException("object callLegId cannot be null or empty");
}
if (callState == null) {
throw new IllegalArgumentException("object callState cannot be null");
}
this.conversationId = conversationId;
this.callLegId = callLegId;
this.callState = callState;
}

/**
* Deserialize {@link CallLegStateChangedEvent} event.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,53 @@

package com.azure.communication.callingserver.models.events;

import java.time.OffsetDateTime;

import com.azure.communication.callingserver.models.CallRecordingState;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.BinaryData;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* The call recording state change event.
*/
public final class CallRecordingStateChangeEvent extends CallingServerEventBase {
/**
* The event type.
*/
public static final String EVENT_TYPE = "Microsoft.Communication.CallRecordingStateChange";
import java.time.OffsetDateTime;

/**
/** The call recording state change event. */
@Fluent
public final class CallRecordingStateChangeEvent {
/*
* The call recording id
*/
@JsonProperty(value = "recordingId")
private String recordingId;

/*
* The recording state of the recording
*/
@JsonProperty(value = "state")
private CallRecordingState state;

/*
* The time of the recording started
*/
@JsonProperty(value = "startDateTime")
private OffsetDateTime startDateTime;

/*
* The conversation id from a out call start recording request
*/
@JsonProperty(value = "conversationId")
private String conversationId;

/**
* Get the call recording id.
*
* @return the call recording id value.
* Get the recordingId property: The call recording id.
*
* @return the recordingId value.
*/
public String getRecordingId() {
return this.recordingId;
}

/**
* Set the call recording id.
*
* @param recordingId the call recording id.
* Set the recordingId property: The call recording id.
*
* @param recordingId the recordingId value to set.
* @return the CallRecordingStateChangeEvent object itself.
*/
public CallRecordingStateChangeEvent setRecordingId(String recordingId) {
Expand All @@ -43,23 +58,18 @@ public CallRecordingStateChangeEvent setRecordingId(String recordingId) {
}

/**
* The call recording state.
*/
private CallRecordingState state;

/**
* Get the call recording state.
* Get the state property: The recording state of the recording.
*
* @return the call recording state value.
* @return the state value.
*/
public CallRecordingState getState() {
return this.state;
}

/**
* Set the call recording state.
* Set the state property: The recording state of the recording.
*
* @param state the call recording state.
* @param state the state value to set.
* @return the CallRecordingStateChangeEvent object itself.
*/
public CallRecordingStateChangeEvent setState(CallRecordingState state) {
Expand All @@ -68,23 +78,18 @@ public CallRecordingStateChangeEvent setState(CallRecordingState state) {
}

/**
* The time of the recording started.
*/
private OffsetDateTime startDateTime;

/**
* Get the time of the recording started.
* Get the startDateTime property: The time of the recording started.
*
* @return the time of the recording started.
* @return the startDateTime value.
*/
public OffsetDateTime getStartDateTime() {
return this.startDateTime;
}

/**
* Set the subject.
* Set the startDateTime property: The time of the recording started.
*
* @param startDateTime the call leg id.
* @param startDateTime the startDateTime value to set.
* @return the CallRecordingStateChangeEvent object itself.
*/
public CallRecordingStateChangeEvent setStartDateTime(OffsetDateTime startDateTime) {
Expand All @@ -93,69 +98,28 @@ public CallRecordingStateChangeEvent setStartDateTime(OffsetDateTime startDateTi
}

/**
* The conversation id from a out call start recording request.
*/
private String conversationId;

/**
* Get the conversation id from a out call start recording request.
*
* @return the time of the recording started.
* Get the conversationId property: The conversation id from a out call start recording request.
*
* @return the conversationId value.
*/
public String getConversationId() {
return this.conversationId;
}

/**
* Set the conversation id from a out call start recording request.
* Set the conversationId property: The conversation id from a out call start recording request.
*
* @param conversationId the call leg id.
* @param conversationId the conversationId value to set.
* @return the CallRecordingStateChangeEvent object itself.
*/
public CallRecordingStateChangeEvent setConversationId(String conversationId) {
this.conversationId = conversationId;
return this;
}

/**
* Initializes a new instance of CallRecordingStateChangeEvent.
*/
public CallRecordingStateChangeEvent() {

}

/**
* Initializes a new instance of CallRecordingStateChangeEvent.
*
* @param recordingId The recording id.
* @param state The state.
* @param startDateTime The startDateTime.
* @param conversationId The conversation id.
* @throws IllegalArgumentException if any parameter is null or empty.
*/
public CallRecordingStateChangeEvent(String recordingId, CallRecordingState state, OffsetDateTime startDateTime,
String conversationId) {
if (recordingId == null || recordingId.isEmpty()) {
throw new IllegalArgumentException("object recordingId cannot be null or empty");
}
if (state == null) {
throw new IllegalArgumentException("object state cannot be null");
}
if (startDateTime == null) {
throw new IllegalArgumentException("object startDateTime cannot be null");
}
if (conversationId == null || conversationId.isEmpty()) {
throw new IllegalArgumentException("object conversationId cannot be null or empty");
}
this.recordingId = recordingId;
this.state = state;
this.startDateTime = startDateTime;
this.conversationId = conversationId;
}

/**
* Deserialize {@link CallRecordingStateChangeEvent} event.
*
*
* @param eventData binary data for event
* @return {@link CallRecordingStateChangeEvent} event.
*/
Expand Down
Loading

0 comments on commit 4b58902

Please sign in to comment.