Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

Commit

Permalink
use string union instead of string in Chat message type (Azure#15703)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuChen-Microsoft authored Jun 21, 2021
1 parent 5eed304 commit 91c931a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export interface ChatMessageReadReceipt {
}

// @public
export type ChatMessageType = string;
export type ChatMessageType = "text" | "html" | "topicUpdated" | "participantAdded" | "participantRemoved";

// @public
export interface ChatParticipant {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as coreHttp from "@azure/core-http";
import { ChatApiClientOptionalParams } from "./models";

const packageName = "azure-communication-chat";
const packageVersion = "1.0.0";
const packageVersion = "1.1.0-beta.1";

export class ChatApiClientContext extends coreHttp.ServiceClient {
endpoint: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,28 +291,13 @@ export const enum KnownCommunicationCloudEnvironmentModel {
* **gcch**
*/
export type CommunicationCloudEnvironmentModel = string;

/** Known values of {@link ChatMessageType} that the service accepts. */
export const enum KnownChatMessageType {
Text = "text",
Html = "html",
TopicUpdated = "topicUpdated",
ParticipantAdded = "participantAdded",
ParticipantRemoved = "participantRemoved"
}

/**
* Defines values for ChatMessageType. \
* {@link KnownChatMessageType} can be used interchangeably with ChatMessageType,
* this enum contains the known values that the service supports.
* ### Know values supported by the service
* **text** \
* **html** \
* **topicUpdated** \
* **participantAdded** \
* **participantRemoved**
*/
export type ChatMessageType = string;
/** Defines values for ChatMessageType. */
export type ChatMessageType =
| "text"
| "html"
| "topicUpdated"
| "participantAdded"
| "participantRemoved";

/** Optional parameters. */
export interface ChatThreadListChatReadReceiptsOptionalParams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,14 @@ export const SendChatMessageRequest: coreHttp.CompositeMapper = {
type: {
serializedName: "type",
type: {
name: "String"
name: "Enum",
allowedValues: [
"text",
"html",
"topicUpdated",
"participantAdded",
"participantRemoved"
]
}
},
metadata: {
Expand Down Expand Up @@ -341,7 +348,14 @@ export const ChatMessage: coreHttp.CompositeMapper = {
serializedName: "type",
required: true,
type: {
name: "String"
name: "Enum",
allowedValues: [
"text",
"html",
"topicUpdated",
"participantAdded",
"participantRemoved"
]
}
},
sequenceId: {
Expand Down
10 changes: 10 additions & 0 deletions sdk/communication/communication-chat/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,13 @@ directive:
transform: >
$["x-ms-client-name"] = "ChatError";
```
### Set ChatMessageType Model as string false
```yaml
directive:
from: swagger-document
where: "$.definitions.ChatMessageType"
transform: >
$["x-ms-enum"].modelAsString = false;
```

0 comments on commit 91c931a

Please sign in to comment.