forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CodeGen from PR 30346 in Azure/azure-rest-api-specs
Merge c87844561dd481653d4fbe44d43eeb99a8d16ce7 into ad60d7f8eba124edc6999677c55aba2184e303b0
- Loading branch information
SDKAuto
committed
Oct 1, 2024
1 parent
0cff707
commit 410f96d
Showing
15 changed files
with
833 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
...sages/src/main/java/com/azure/communication/messages/models/AudioNotificationContent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// Code generated by Microsoft (R) TypeSpec Code Generator. | ||
|
||
package com.azure.communication.messages.models; | ||
|
||
import com.azure.core.annotation.Generated; | ||
import com.azure.core.annotation.Immutable; | ||
import com.azure.json.JsonReader; | ||
import com.azure.json.JsonToken; | ||
import com.azure.json.JsonWriter; | ||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
/** | ||
* A request to send an audio notification. | ||
*/ | ||
@Immutable | ||
public final class AudioNotificationContent extends NotificationContent { | ||
/* | ||
* The type discriminator describing a notification type. | ||
*/ | ||
@Generated | ||
private CommunicationMessageKind kind = CommunicationMessageKind.AUDIO; | ||
|
||
/* | ||
* A media url for the file. Required if the type is one of the supported media types, e.g. image | ||
*/ | ||
@Generated | ||
private final String mediaUrl; | ||
|
||
/** | ||
* Creates an instance of AudioNotificationContent class. | ||
* | ||
* @param channelRegistrationId the channelRegistrationId value to set. | ||
* @param to the to value to set. | ||
* @param mediaUrl the mediaUrl value to set. | ||
*/ | ||
@Generated | ||
public AudioNotificationContent(String channelRegistrationId, List<String> to, String mediaUrl) { | ||
super(channelRegistrationId, to); | ||
this.mediaUrl = mediaUrl; | ||
} | ||
|
||
/** | ||
* Get the kind property: The type discriminator describing a notification type. | ||
* | ||
* @return the kind value. | ||
*/ | ||
@Generated | ||
@Override | ||
public CommunicationMessageKind getKind() { | ||
return this.kind; | ||
} | ||
|
||
/** | ||
* Get the mediaUrl property: A media url for the file. Required if the type is one of the supported media types, | ||
* e.g. image. | ||
* | ||
* @return the mediaUrl value. | ||
*/ | ||
@Generated | ||
public String getMediaUrl() { | ||
return this.mediaUrl; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Generated | ||
@Override | ||
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { | ||
jsonWriter.writeStartObject(); | ||
jsonWriter.writeStringField("channelRegistrationId", getChannelRegistrationId()); | ||
jsonWriter.writeArrayField("to", getTo(), (writer, element) -> writer.writeString(element)); | ||
jsonWriter.writeStringField("mediaUri", this.mediaUrl); | ||
jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); | ||
return jsonWriter.writeEndObject(); | ||
} | ||
|
||
/** | ||
* Reads an instance of AudioNotificationContent from the JsonReader. | ||
* | ||
* @param jsonReader The JsonReader being read. | ||
* @return An instance of AudioNotificationContent if the JsonReader was pointing to an instance of it, or null if | ||
* it was pointing to JSON null. | ||
* @throws IllegalStateException If the deserialized JSON object was missing any required properties. | ||
* @throws IOException If an error occurs while reading the AudioNotificationContent. | ||
*/ | ||
@Generated | ||
public static AudioNotificationContent fromJson(JsonReader jsonReader) throws IOException { | ||
return jsonReader.readObject(reader -> { | ||
String channelRegistrationId = null; | ||
List<String> to = null; | ||
String mediaUrl = null; | ||
CommunicationMessageKind kind = CommunicationMessageKind.AUDIO; | ||
while (reader.nextToken() != JsonToken.END_OBJECT) { | ||
String fieldName = reader.getFieldName(); | ||
reader.nextToken(); | ||
|
||
if ("channelRegistrationId".equals(fieldName)) { | ||
channelRegistrationId = reader.getString(); | ||
} else if ("to".equals(fieldName)) { | ||
to = reader.readArray(reader1 -> reader1.getString()); | ||
} else if ("mediaUri".equals(fieldName)) { | ||
mediaUrl = reader.getString(); | ||
} else if ("kind".equals(fieldName)) { | ||
kind = CommunicationMessageKind.fromString(reader.getString()); | ||
} else { | ||
reader.skipChildren(); | ||
} | ||
} | ||
AudioNotificationContent deserializedAudioNotificationContent | ||
= new AudioNotificationContent(channelRegistrationId, to, mediaUrl); | ||
deserializedAudioNotificationContent.kind = kind; | ||
|
||
return deserializedAudioNotificationContent; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.