Skip to content

Commit

Permalink
CodeGen from PR 30346 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge c87844561dd481653d4fbe44d43eeb99a8d16ce7 into ad60d7f8eba124edc6999677c55aba2184e303b0
  • Loading branch information
SDKAuto committed Oct 1, 2024
1 parent 0cff707 commit 410f96d
Show file tree
Hide file tree
Showing 15 changed files with 833 additions and 16 deletions.
148 changes: 145 additions & 3 deletions sdk/communication/azure-communication-messages/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,156 @@

## 1.1.0-beta.1 (Unreleased)

### Breaking Changes

* `implementation.models.MessageDataStream` was removed

#### `implementation.NotificationMessagesClientImpl$NotificationMessagesClientService` was modified

* `send(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was removed
* `sendSync(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was removed

### Features Added

### Breaking Changes
* `models.ImageNotificationContent` was added

### Bugs Fixed
* `models.CommunicationMessagesChannel` was added

### Other Changes
* `implementation.accesshelpers.MessageTemplateItemAccessHelper` was added

* `models.AudioNotificationContent` was added

* `models.DocumentNotificationContent` was added

* `implementation.accesshelpers.MessageTemplateItemAccessHelper$MessageTemplateItemAccessor` was added

* `models.VideoNotificationContent` was added

* `models.MessageTemplateValueKind` was added

* `models.CommunicationMessageKind` was added

* `models.MessageTemplateBindingsKind` was added

#### `models.MessageTemplateImage` was modified

* `fromJson(com.azure.json.JsonReader)` was added
* `getKind()` was added
* `toJson(com.azure.json.JsonWriter)` was added

#### `models.SendMessageResult` was modified

* `fromJson(com.azure.json.JsonReader)` was added
* `toJson(com.azure.json.JsonWriter)` was added

#### `models.MessageTemplate` was modified

* `fromJson(com.azure.json.JsonReader)` was added
* `toJson(com.azure.json.JsonWriter)` was added

#### `models.MessageTemplateQuickAction` was modified

* `getKind()` was added
* `toJson(com.azure.json.JsonWriter)` was added
* `fromJson(com.azure.json.JsonReader)` was added

#### `models.MessageTemplateBindings` was modified

* `fromJson(com.azure.json.JsonReader)` was added
* `toJson(com.azure.json.JsonWriter)` was added
* `getKind()` was added

#### `models.channels.WhatsAppMessageTemplateBindings` was modified

* `toJson(com.azure.json.JsonWriter)` was added
* `fromJson(com.azure.json.JsonReader)` was added
* `getKind()` was added

#### `models.MessageTemplateVideo` was modified

* `fromJson(com.azure.json.JsonReader)` was added
* `getKind()` was added
* `toJson(com.azure.json.JsonWriter)` was added

#### `models.MessageTemplateText` was modified

* `toJson(com.azure.json.JsonWriter)` was added
* `fromJson(com.azure.json.JsonReader)` was added
* `getKind()` was added

#### `models.NotificationContent` was modified

* `fromJson(com.azure.json.JsonReader)` was added
* `getKind()` was added
* `toJson(com.azure.json.JsonWriter)` was added

#### `models.TextNotificationContent` was modified

* `toJson(com.azure.json.JsonWriter)` was added
* `fromJson(com.azure.json.JsonReader)` was added
* `getKind()` was added

#### `models.MediaNotificationContent` was modified

* `fromJson(com.azure.json.JsonReader)` was added
* `getKind()` was added
* `toJson(com.azure.json.JsonWriter)` was added

#### `models.MessageTemplateItem` was modified

* `getKind()` was added
* `toJson(com.azure.json.JsonWriter)` was added
* `fromJson(com.azure.json.JsonReader)` was added

#### `models.MessageTemplateValue` was modified

* `toJson(com.azure.json.JsonWriter)` was added
* `getKind()` was added
* `fromJson(com.azure.json.JsonReader)` was added

#### `models.TemplateNotificationContent` was modified

* `getKind()` was added
* `toJson(com.azure.json.JsonWriter)` was added
* `fromJson(com.azure.json.JsonReader)` was added

#### `models.MessageReceipt` was modified

* `fromJson(com.azure.json.JsonReader)` was added
* `toJson(com.azure.json.JsonWriter)` was added

#### `models.MessageTemplateLocation` was modified

* `fromJson(com.azure.json.JsonReader)` was added
* `getKind()` was added
* `toJson(com.azure.json.JsonWriter)` was added

#### `models.channels.WhatsAppMessageTemplateBindingsButton` was modified

* `toJson(com.azure.json.JsonWriter)` was added
* `fromJson(com.azure.json.JsonReader)` was added

#### `models.MessageTemplateDocument` was modified

* `fromJson(com.azure.json.JsonReader)` was added
* `getKind()` was added
* `toJson(com.azure.json.JsonWriter)` was added

#### `models.channels.WhatsAppMessageTemplateItem` was modified

* `fromJson(com.azure.json.JsonReader)` was added
* `toJson(com.azure.json.JsonWriter)` was added
* `getKind()` was added

#### `models.channels.WhatsAppMessageTemplateBindingsComponent` was modified

* `toJson(com.azure.json.JsonWriter)` was added
* `fromJson(com.azure.json.JsonReader)` was added

#### `implementation.NotificationMessagesClientImpl$NotificationMessagesClientService` was modified

* `sendSync(java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was added
* `send(java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.BinaryData,com.azure.core.http.rest.RequestOptions,com.azure.core.util.Context)` was added

## 1.0.7 (2024-09-27)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ public enum MessagesServiceVersion implements ServiceVersion {
/**
* Enum value 2024-02-01.
*/
V2024_02_01("2024-02-01");
V2024_02_01("2024-02-01"),

/**
* Enum value 2024-08-30.
*/
V2024_08_30("2024-08-30");

private final String version;

Expand All @@ -35,6 +40,6 @@ public String getVersion() {
* @return The latest {@link MessagesServiceVersion}.
*/
public static MessagesServiceVersion getLatest() {
return V2024_02_01;
return V2024_08_30;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public final class NotificationMessagesAsyncClient {
* <pre>
* {@code
* {
* kind: String(text/image/template) (Required)
* kind: String(text/image/image_v0/document/video/audio/template) (Required)
* channelRegistrationId: String (Required)
* to (Required): [
* String (Required)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public final class NotificationMessagesClient {
* <pre>
* {@code
* {
* kind: String(text/image/template) (Required)
* kind: String(text/image/image_v0/document/video/audio/template) (Required)
* channelRegistrationId: String (Required)
* to (Required): [
* String (Required)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Response<BinaryData> downloadMediaSync(@HostParam("endpoint") String endpoint,
* <pre>
* {@code
* {
* kind: String(text/image/template) (Required)
* kind: String(text/image/image_v0/document/video/audio/template) (Required)
* channelRegistrationId: String (Required)
* to (Required): [
* String (Required)
Expand Down Expand Up @@ -284,7 +284,7 @@ public Mono<Response<BinaryData>> sendWithResponseAsync(BinaryData notificationC
* <pre>
* {@code
* {
* kind: String(text/image/template) (Required)
* kind: String(text/image/image_v0/document/video/audio/template) (Required)
* channelRegistrationId: String (Required)
* to (Required): [
* String (Required)
Expand Down
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;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.Collection;

/**
* The type of message. Supports text, image, template.
* The type of message.
*/
public final class CommunicationMessageKind extends ExpandableStringEnum<CommunicationMessageKind> {

Expand Down Expand Up @@ -60,4 +60,28 @@ public static CommunicationMessageKind fromString(String name) {
public static Collection<CommunicationMessageKind> values() {
return values(CommunicationMessageKind.class);
}

/**
* Image message type. Legacy image type for `MediaNotificationContent` which is being deprecated.
*/
@Generated
public static final CommunicationMessageKind IMAGE_V0 = fromString("image_v0");

/**
* Document message type.
*/
@Generated
public static final CommunicationMessageKind DOCUMENT = fromString("document");

/**
* Video message type.
*/
@Generated
public static final CommunicationMessageKind VIDEO = fromString("video");

/**
* Audio message type.
*/
@Generated
public static final CommunicationMessageKind AUDIO = fromString("audio");
}
Loading

0 comments on commit 410f96d

Please sign in to comment.