Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for more media message types #30346

Merged
merged 46 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
63a844d
Add support for more media message types (video and document) under a…
glorialimicrosoft Aug 19, 2024
f46820d
remove commented out code
glorialimicrosoft Aug 19, 2024
cc602f9
Try to expand MediaNotificationContent
glorialimicrosoft Aug 21, 2024
1547f86
try to add a discriminator to MediaNotificationContent
glorialimicrosoft Aug 22, 2024
1037cfa
use @clientName("MediaNotificationContent")
glorialimicrosoft Aug 23, 2024
3115f6e
Update code to reflect final decision of having a breaking change for…
glorialimicrosoft Aug 28, 2024
ecff9df
add audio notification content
glorialimicrosoft Aug 28, 2024
2a641d1
Run npx tsv specification/communication/Communication.Messages
glorialimicrosoft Aug 28, 2024
2bd35f7
fix swagger avocado: The swagger JSON file is not referenced from the…
glorialimicrosoft Aug 28, 2024
cec09fe
fix Swagger Avocado
glorialimicrosoft Aug 28, 2024
3759deb
remove example files
glorialimicrosoft Aug 28, 2024
67b246d
fix Avocado
glorialimicrosoft Aug 28, 2024
75958fe
add an example for audio
glorialimicrosoft Aug 28, 2024
c39bcbe
Add support for more media message types (video and document) under a…
glorialimicrosoft Aug 19, 2024
107f795
remove commented out code
glorialimicrosoft Aug 19, 2024
124d19e
Try to expand MediaNotificationContent
glorialimicrosoft Aug 21, 2024
4964e5a
try to add a discriminator to MediaNotificationContent
glorialimicrosoft Aug 22, 2024
59f96f0
use @clientName("MediaNotificationContent")
glorialimicrosoft Aug 23, 2024
b45b177
Update code to reflect final decision of having a breaking change for…
glorialimicrosoft Aug 28, 2024
788e551
add audio notification content
glorialimicrosoft Aug 28, 2024
bef2798
Run npx tsv specification/communication/Communication.Messages
glorialimicrosoft Aug 28, 2024
41f81c9
fix swagger avocado: The swagger JSON file is not referenced from the…
glorialimicrosoft Aug 28, 2024
2010073
fix Swagger Avocado
glorialimicrosoft Aug 28, 2024
237149d
remove example files
glorialimicrosoft Aug 28, 2024
fda55ca
fix Avocado
glorialimicrosoft Aug 28, 2024
3aa0658
add an example for audio
glorialimicrosoft Aug 28, 2024
9650de0
Merge branch 'gelli/addSupportForMoreMediaMessageTypes' of https://gi…
glorialimicrosoft Aug 31, 2024
b6dc4c7
take `content` off audio
glorialimicrosoft Aug 31, 2024
ce04721
fix avocado
glorialimicrosoft Aug 31, 2024
eeb43b0
fix avocado
glorialimicrosoft Aug 31, 2024
eba52f5
update the examples
glorialimicrosoft Sep 4, 2024
3965c9c
Change 2024-08-30-preview to 2024-08-30
glorialimicrosoft Sep 6, 2024
8224c06
fix readme folder version
glorialimicrosoft Sep 6, 2024
ad22b82
fix avocado: The default tag does not contains the latest API version…
glorialimicrosoft Sep 6, 2024
b38c318
fix avocado
glorialimicrosoft Sep 6, 2024
d6064de
use image_v0, use caption as a client name for content, add #deprecat…
glorialimicrosoft Sep 27, 2024
5cb3d2a
mark MediaNotificationContent's access as internal using @access(Acc…
glorialimicrosoft Sep 30, 2024
81d4a06
rename content to caption directly in API definition instead of using…
glorialimicrosoft Sep 30, 2024
0b6042a
run prettier for Swagger PrettierCheck
glorialimicrosoft Sep 30, 2024
7e48cb9
run prettier for NotificationMessages_SendVideo.json
glorialimicrosoft Sep 30, 2024
c878445
Merge branch 'main' into gelli/addSupportForMoreMediaMessageTypes
glorialimicrosoft Oct 1, 2024
2a4eabf
add @deprecated in the comment for MediaNotificationContent - this is…
glorialimicrosoft Oct 2, 2024
107e119
Use @clientName("content", "python") for caption field
glorialimicrosoft Oct 8, 2024
31d8b73
add x-ms-examples back to fix avocado
glorialimicrosoft Oct 8, 2024
3d558dc
remove @clientName("content", "python") for VideoNotificationContent …
glorialimicrosoft Oct 9, 2024
75d91ed
remove version for TS
glorialimicrosoft Oct 14, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"title": "Sends a notification message - audio",
"operationId": "NotificationMessagesOperations_Send",
"parameters": {
"api-version": "2024-08-30-preview",
"content-type": "application/json",
"body": {
"channelRegistrationId": "0f0eb78e-a576-1dfc-b414-0f0756de3338",
"to": [
"14250000000"
],
"kind": "audio",
"mediaUri": "https://example.com/audio.mp44",
"content": "check out this audio!"
},
"endpoint": "https://my-resource.communication.azure.com"
},
"responses": {
"202": {
"body": {
"receipts": [
{
"messageId": "320fc2a1-4c4b-4387-9c1a-bd38b57795de",
"to": "14250000000"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"title": "Sends a notification message - document",
"operationId": "NotificationMessagesOperations_Send",
"parameters": {
"api-version": "2024-08-30-preview",
"content-type": "application/json",
"body": {
"channelRegistrationId": "0f0eb78e-a576-1dfc-b414-0f0756de3338",
"to": [
"14250000000"
],
"kind": "document",
"mediaUri": "https://example.com/document.pdf",
"content": "check out this document!"
},
"endpoint": "https://my-resource.communication.azure.com"
},
"responses": {
"202": {
"body": {
"receipts": [
{
"messageId": "320fc2a1-4c4b-4387-9c1a-bd38b57795de",
"to": "14250000000"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"title": "Sends a notification message - image",
"operationId": "NotificationMessagesOperations_Send",
"parameters": {
"api-version": "2024-08-30-preview",
"content-type": "application/json",
"body": {
"channelRegistrationId": "0f0eb78e-a576-1dfc-b414-0f0756de3338",
"to": [
"14250000000"
],
"kind": "image",
"mediaUri": "https://example.com/image.jpg",
"content": "check out this image!"
},
"endpoint": "https://my-resource.communication.azure.com"
},
"responses": {
"202": {
"body": {
"receipts": [
{
"messageId": "320fc2a1-4c4b-4387-9c1a-bd38b57795de",
"to": "14250000000"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"title": "Sends a notification message - Template",
"operationId": "NotificationMessagesOperations_Send",
"parameters": {
"api-version": "2024-08-30-preview",
"content-type": "application/json",
"body": {
"channelRegistrationId": "0f0eb78e-a576-1dfc-b414-0f0756de3338",
"to": [
"14250000000"
],
"kind": "template",
"template": {
"name": "example",
"language": "en",
"values": [
{
"name": "userName",
"kind": "text",
"text": "John Doe"
},
{
"name": "orderNumber",
"kind": "text",
"text": "12345"
}
],
"bindings": {
"body": [
{
"refValue": "userName"
},
{
"refValue": "orderNumber"
}
],
"kind": "whatsApp"
}
}
},
"endpoint": "https://my-resource.communication.azure.com"
},
"responses": {
"202": {
"body": {
"receipts": [
{
"messageId": "320fc2a1-4c4b-4387-9c1a-bd38b57795de",
"to": "14250000000"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"title": "Sends a notification message - text",
"operationId": "NotificationMessagesOperations_Send",
"parameters": {
"api-version": "2024-08-30-preview",
"content-type": "application/json",
"body": {
"channelRegistrationId": "0f0eb78e-a576-1dfc-b414-0f0756de3338",
"to": [
"14250000000"
],
"kind": "text",
"content": "Text message through CPM"
},
"endpoint": "https://my-resource.communication.azure.com"
},
"responses": {
"202": {
"body": {
"receipts": [
{
"messageId": "320fc2a1-4c4b-4387-9c1a-bd38b57795de",
"to": "14250000000"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"title": "Sends a notification message - video",
"operationId": "NotificationMessagesOperations_Send",
"parameters": {
"api-version": "2024-08-30-preview",
"content-type": "application/json",
"body": {
"channelRegistrationId": "0f0eb78e-a576-1dfc-b414-0f0756de3338",
"to": [
"14250000000"
],
"kind": "video",
"mediaUri": "https://example.com/video.mp44",
"content": "check out this video!"
},
"endpoint": "https://my-resource.communication.azure.com"
},
"responses": {
"202": {
"body": {
"receipts": [
{
"messageId": "320fc2a1-4c4b-4387-9c1a-bd38b57795de",
"to": "14250000000"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"title": "Download media",
"operationId": "StreamOperations_GetMedia",
"parameters": {
"api-version": "2024-08-30-preview",
"content-type": "application/json",
"id": "d19e68ec-bdd6-4a50-8dfb-cbb1642df6ab",
"endpoint": "https://my-resource.communication.azure.com"
},
"responses": {
"200": {
"body": "<binary_media_data>"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"title": "Gets a list of templates",
"operationId": "TemplateOperations_ListTemplates",
"parameters": {
"api-version": "2024-08-30-preview",
"content-type": "application/json",
"channelId": "0f0eb78e-a576-1dfc-b414-0f0756de3338",
"endpoint": "https://my-resource.communication.azure.com"
},
"responses": {
"200": {
"body": {
"value": [
{
"name": "sample_shipping_confirmation",
"language": "en_US",
"status": "approved",
"kind": "whatsApp",
"content": [
{
"type": "BODY",
"text": "Your package has been shipped. It will be delivered in {{1}} business days."
},
{
"type": "FOOTER",
"text": "This message is from an unverified business."
}
]
}
],
"nextLink": null
}
}
}
}
77 changes: 65 additions & 12 deletions specification/communication/Communication.Messages/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using Azure.Core.Traits;
@versioned(Azure.Communication.MessagesService.Versions)
namespace Azure.Communication.MessagesService;

@doc("The type of message. Supports text, image, template.")
@doc("The type of message.")
union CommunicationMessageKind {
string,

Expand All @@ -24,6 +24,18 @@ union CommunicationMessageKind {
@doc("Image message type.")
image: "image",

@added(Versions.c2024_08_30_Preview)
@doc("Document message type.")
document: "document",

@added(Versions.c2024_08_30_Preview)
@doc("Video message type.")
video: "video",

@added(Versions.c2024_08_30_Preview)
@doc("Audio message type.")
audio: "audio",

@doc("Template message type.")
template: "template",
}
Expand Down Expand Up @@ -117,11 +129,9 @@ model TextNotificationContent extends NotificationContent {
content: string;
}

@doc("A request to send a media notification.")
model MediaNotificationContent extends NotificationContent {
@doc("Message notification type is image.")
kind: CommunicationMessageKind.image;

@added(Versions.c2024_08_30_Preview)
@doc("A request to send a media notification. Could be an image, document or video.")
model MediaNotificationContent {
@doc("Optional text content.")
content?: string;

Expand All @@ -130,6 +140,45 @@ model MediaNotificationContent extends NotificationContent {
mediaUri: url;
}

@renamedFrom(Versions.c2024_08_30_Preview, "MediaNotificationContent")
@doc("A request to send an image notification.")
model ImageNotificationContent extends NotificationContent {
@doc("Message notification type is image.")
kind: CommunicationMessageKind.image;

...MediaNotificationContent;
}

@added(Versions.c2024_08_30_Preview)
@doc("A request to send a document notification.")
model DocumentNotificationContent extends NotificationContent {
@doc("Message notification type is image.")
kind: CommunicationMessageKind.document;

@doc("Optional name for the file.")
fileName?: string;

...MediaNotificationContent;
}

@added(Versions.c2024_08_30_Preview)
@doc("A request to send a video notification.")
model VideoNotificationContent extends NotificationContent {
@doc("Message notification type is image.")
kind: CommunicationMessageKind.video;

...MediaNotificationContent;
}

@added(Versions.c2024_08_30_Preview)
@doc("A request to send an audio notification.")
model AudioNotificationContent extends NotificationContent {
@doc("Message notification type is audio.")
kind: CommunicationMessageKind.audio;

...MediaNotificationContent;
}

@doc("A request to send a template notification.")
model TemplateNotificationContent extends NotificationContent {
@doc("Message notification type is template.")
Expand Down Expand Up @@ -368,16 +417,20 @@ alias ListTemplatesQueryParams = ListQueryParametersTrait<{
maxpagesize?: int32;
}>;

@doc("Notification messages send request body.")
model NotificationMessagesSendRequestBody {
@doc("Details of the message to send.")
@bodyRoot
body: NotificationContent;
}

@doc("Azure Communication Messages Versions")
enum Versions {
@doc("Azure Communication Messages 2024-02-01 api version")
@useDependency(Azure.Core.Versions.v1_0_Preview_2)
c2024_02_01: "2024-02-01",
}

@doc("Notification messages send request body.")
model NotificationMessagesSendRequestBody {
@doc("Details of the message to send.")
@bodyRoot
body: NotificationContent;
@doc("Azure Communication Messages 2024-08-30-preview api version")
@useDependency(Azure.Core.Versions.v1_0_Preview_2)
c2024_08_30_Preview: "2024-08-30-preview",
}
Loading
Loading