Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 42 additions & 3 deletions sdk/communication/azure-communication-messages/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,51 @@

### Features Added

### Breaking Changes
* `models.channels.WhatsAppListActionBindings` was added

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

### Other Changes
* `models.ImageMessageContent` was added

* `models.ButtonSetContent` was added

* `models.MessageContent` was added

* `models.StickerNotificationContent` was added

* `models.channels.WhatsAppUrlActionBindings` was added

* `models.ActionGroup` was added

* `models.InteractiveMessage` was added

* `models.VideoMessageContent` was added

* `models.InteractiveNotificationContent` was added

* `models.ReactionNotificationContent` was added

* `models.DocumentMessageContent` was added

* `models.ButtonContent` was added

* `models.ActionGroupContent` was added

* `models.LinkContent` was added

* `models.MessageContentKind` was added

* `models.ActionBindings` was added

* `models.MessageActionBindingKind` was added

* `models.channels.WhatsAppButtonActionBindings` was added

* `models.TextMessageContent` was added

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

* `getName()` was added

## 1.1.1 (2024-12-04)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ public enum MessagesServiceVersion implements ServiceVersion {
/**
* Enum value 2024-08-30.
*/
V2024_08_30("2024-08-30");
V2024_08_30("2024-08-30"),

/**
* Enum value 2025-01-15-preview.
*/
V2025_01_15_PREVIEW("2025-01-15-preview");

private final String version;

Expand All @@ -40,6 +45,6 @@ public String getVersion() {
* @return The latest {@link MessagesServiceVersion}.
*/
public static MessagesServiceVersion getLatest() {
return V2024_08_30;
return V2025_01_15_PREVIEW;
}
}
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/image_v0/document/video/audio/template) (Required)
* kind: String(text/image/image_v0/document/video/audio/template/sticker/reaction/interactive) (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/image_v0/document/video/audio/template) (Required)
* kind: String(text/image/image_v0/document/video/audio/template/sticker/reaction/interactive) (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/image_v0/document/video/audio/template) (Required)
* kind: String(text/image/image_v0/document/video/audio/template/sticker/reaction/interactive) (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/image_v0/document/video/audio/template) (Required)
* kind: String(text/image/image_v0/document/video/audio/template/sticker/reaction/interactive) (Required)
* channelRegistrationId: String (Required)
* to (Required): [
* String (Required)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// 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.communication.messages.models.channels.WhatsAppButtonActionBindings;
import com.azure.communication.messages.models.channels.WhatsAppListActionBindings;
import com.azure.communication.messages.models.channels.WhatsAppUrlActionBindings;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
* Binding actions to the interactive message.
*/
@Immutable
public class ActionBindings implements JsonSerializable<ActionBindings> {
/*
* Kind of the MessageActionBinding.
*/
@Generated
private MessageActionBindingKind kind = MessageActionBindingKind.fromString("ActionBindings");

/**
* Creates an instance of ActionBindings class.
*/
@Generated
public ActionBindings() {
}

/**
* Get the kind property: Kind of the MessageActionBinding.
*
* @return the kind value.
*/
@Generated
public MessageActionBindingKind getKind() {
return this.kind;
}

/**
* {@inheritDoc}
*/
@Generated
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString());
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of ActionBindings from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ActionBindings 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 ActionBindings.
*/
@Generated
public static ActionBindings fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
String discriminatorValue = null;
try (JsonReader readerToUse = reader.bufferObject()) {
readerToUse.nextToken(); // Prepare for reading
while (readerToUse.nextToken() != JsonToken.END_OBJECT) {
String fieldName = readerToUse.getFieldName();
readerToUse.nextToken();
if ("kind".equals(fieldName)) {
discriminatorValue = readerToUse.getString();
break;
} else {
readerToUse.skipChildren();
}
}
// Use the discriminator value to determine which subtype should be deserialized.
if ("whatsAppListAction".equals(discriminatorValue)) {
return WhatsAppListActionBindings.fromJson(readerToUse.reset());
} else if ("whatsAppButtonAction".equals(discriminatorValue)) {
return WhatsAppButtonActionBindings.fromJson(readerToUse.reset());
} else if ("whatsAppUrlAction".equals(discriminatorValue)) {
return WhatsAppUrlActionBindings.fromJson(readerToUse.reset());
} else {
return fromJsonKnownDiscriminator(readerToUse.reset());
}
}
});
}

@Generated
static ActionBindings fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ActionBindings deserializedActionBindings = new ActionBindings();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("kind".equals(fieldName)) {
deserializedActionBindings.kind = MessageActionBindingKind.fromString(reader.getString());
} else {
reader.skipChildren();
}
}

return deserializedActionBindings;
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// 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.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
* The Action Group content.
*/
@Immutable
public final class ActionGroup implements JsonSerializable<ActionGroup> {
/*
* Title of the ActionGroup.
*/
@Generated
private final String title;

/*
* Array of items in ActionGroup.
*/
@Generated
private final List<ActionGroupItem> items;

/**
* Creates an instance of ActionGroup class.
*
* @param title the title value to set.
* @param items the items value to set.
*/
@Generated
public ActionGroup(String title, List<ActionGroupItem> items) {
this.title = title;
this.items = items;
}

/**
* Get the title property: Title of the ActionGroup.
*
* @return the title value.
*/
@Generated
public String getTitle() {
return this.title;
}

/**
* Get the items property: Array of items in ActionGroup.
*
* @return the items value.
*/
@Generated
public List<ActionGroupItem> getItems() {
return this.items;
}

/**
* {@inheritDoc}
*/
@Generated
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("title", this.title);
jsonWriter.writeArrayField("items", this.items, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of ActionGroup from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ActionGroup 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 ActionGroup.
*/
@Generated
public static ActionGroup fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
String title = null;
List<ActionGroupItem> items = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("title".equals(fieldName)) {
title = reader.getString();
} else if ("items".equals(fieldName)) {
items = reader.readArray(reader1 -> ActionGroupItem.fromJson(reader1));
} else {
reader.skipChildren();
}
}
return new ActionGroup(title, items);
});
}
}
Loading