Skip to content

Commit fed2c0c

Browse files
authored
Add stable version of common model swagger for Azure Communication Services (Azure#12799)
* Add stable version of common model swagger for Azure Communication Services * address comments * fix title in readme * reference common error models in identity swagger
1 parent 4abbd23 commit fed2c0c

File tree

3 files changed

+161
-50
lines changed

3 files changed

+161
-50
lines changed
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "Communication",
5+
"description": "Communication Services API common types.",
6+
"version": "2021-03-07"
7+
},
8+
"paths": {},
9+
"definitions": {
10+
"CommunicationErrorResponse": {
11+
"description": "The Communication Services error.",
12+
"type": "object",
13+
"required": [
14+
"error"
15+
],
16+
"properties": {
17+
"error": {
18+
"description": "The Communication Services error.",
19+
"$ref": "#/definitions/CommunicationError"
20+
}
21+
}
22+
},
23+
"CommunicationError": {
24+
"description": "The Communication Services error.",
25+
"type": "object",
26+
"required": [
27+
"code",
28+
"message"
29+
],
30+
"properties": {
31+
"code": {
32+
"type": "string",
33+
"description": "The error code."
34+
},
35+
"message": {
36+
"type": "string",
37+
"description": "The error message."
38+
},
39+
"target": {
40+
"type": "string",
41+
"readOnly": true,
42+
"description": "The error target."
43+
},
44+
"details": {
45+
"type": "array",
46+
"items": {
47+
"$ref": "#/definitions/CommunicationError"
48+
},
49+
"readOnly": true,
50+
"description": "Further details about specific errors that led to this error."
51+
},
52+
"innererror": {
53+
"x-ms-client-name": "innerError",
54+
"readOnly": true,
55+
"$ref": "#/definitions/CommunicationError",
56+
"description": "The inner error if any."
57+
}
58+
}
59+
},
60+
"CommunicationCloudEnvironmentModel": {
61+
"description": "The cloud that the identifier belongs to.",
62+
"type": "string",
63+
"enum": [
64+
"public",
65+
"dod",
66+
"gcch"
67+
],
68+
"x-ms-enum": {
69+
"name": "CommunicationCloudEnvironmentModel",
70+
"modelAsString": true
71+
}
72+
},
73+
"CommunicationIdentifierModel": {
74+
"description": "Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set.",
75+
"type": "object",
76+
"properties": {
77+
"rawId": {
78+
"type": "string",
79+
"description": "Raw Id of the identifier. Optional in requests, required in responses."
80+
},
81+
"communicationUser": {
82+
"$ref": "#/definitions/CommunicationUserIdentifierModel",
83+
"description": "The communication user."
84+
},
85+
"phoneNumber": {
86+
"$ref": "#/definitions/PhoneNumberIdentifierModel",
87+
"description": "The phone number."
88+
},
89+
"microsoftTeamsUser": {
90+
"$ref": "#/definitions/MicrosoftTeamsUserIdentifierModel",
91+
"description": "The Microsoft Teams user."
92+
}
93+
}
94+
},
95+
"CommunicationUserIdentifierModel": {
96+
"description": "A user that got created with an Azure Communication Services resource.",
97+
"type": "object",
98+
"required": [
99+
"id"
100+
],
101+
"properties": {
102+
"id": {
103+
"type": "string",
104+
"description": "The Id of the communication user."
105+
}
106+
}
107+
},
108+
"PhoneNumberIdentifierModel": {
109+
"description": "A phone number.",
110+
"type": "object",
111+
"required": [
112+
"value"
113+
],
114+
"properties": {
115+
"value": {
116+
"type": "string",
117+
"description": "The phone number in E.164 format."
118+
}
119+
}
120+
},
121+
"MicrosoftTeamsUserIdentifierModel": {
122+
"description": "A Microsoft Teams user.",
123+
"type": "object",
124+
"required": [
125+
"userId"
126+
],
127+
"properties": {
128+
"userId": {
129+
"type": "string",
130+
"description": "The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user."
131+
},
132+
"isAnonymous": {
133+
"type": "boolean",
134+
"description": "True if the Microsoft Teams user is anonymous. By default false if missing."
135+
},
136+
"cloud": {
137+
"$ref": "#/definitions/CommunicationCloudEnvironmentModel",
138+
"description": "The cloud that the Microsoft Teams user belongs to. By default 'public' if missing."
139+
}
140+
}
141+
}
142+
},
143+
"securityDefinitions": {
144+
"azure_auth": {
145+
"type": "oauth2",
146+
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
147+
"flow": "implicit",
148+
"description": "Azure Active Directory OAuth2 Flow.",
149+
"scopes": {
150+
"user_impersonation": "impersonate your user account"
151+
}
152+
}
153+
}
154+
}

specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/stable/2021-03-07/CommunicationIdentity.json

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"default": {
3636
"description": "Error",
3737
"schema": {
38-
"$ref": "#/definitions/CommunicationErrorResponse"
38+
"$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
3939
}
4040
},
4141
"201": {
@@ -78,7 +78,7 @@
7878
"default": {
7979
"description": "Error",
8080
"schema": {
81-
"$ref": "#/definitions/CommunicationErrorResponse"
81+
"$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
8282
}
8383
},
8484
"204": {
@@ -118,7 +118,7 @@
118118
"default": {
119119
"description": "Error",
120120
"schema": {
121-
"$ref": "#/definitions/CommunicationErrorResponse"
121+
"$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
122122
}
123123
},
124124
"204": {
@@ -170,7 +170,7 @@
170170
"default": {
171171
"description": "Error",
172172
"schema": {
173-
"$ref": "#/definitions/CommunicationErrorResponse"
173+
"$ref": "../../../Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json#/definitions/CommunicationErrorResponse"
174174
}
175175
},
176176
"200": {
@@ -213,52 +213,6 @@
213213
}
214214
}
215215
},
216-
"CommunicationError": {
217-
"description": "The Communication Services error.",
218-
"required": [
219-
"code",
220-
"message"
221-
],
222-
"type": "object",
223-
"properties": {
224-
"code": {
225-
"description": "The error code.",
226-
"type": "string"
227-
},
228-
"message": {
229-
"description": "The error message.",
230-
"type": "string"
231-
},
232-
"target": {
233-
"description": "The error target.",
234-
"type": "string",
235-
"readOnly": true
236-
},
237-
"details": {
238-
"description": "Further details about specific errors that led to this error.",
239-
"type": "array",
240-
"items": {
241-
"$ref": "#/definitions/CommunicationError"
242-
},
243-
"readOnly": true
244-
},
245-
"innerError": {
246-
"$ref": "#/definitions/CommunicationError"
247-
}
248-
}
249-
},
250-
"CommunicationErrorResponse": {
251-
"description": "The Communication Services error.",
252-
"required": [
253-
"error"
254-
],
255-
"type": "object",
256-
"properties": {
257-
"error": {
258-
"$ref": "#/definitions/CommunicationError"
259-
}
260-
}
261-
},
262216
"CommunicationIdentity": {
263217
"description": "A communication identity.",
264218
"required": [

specification/communication/data-plane/readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ These settings apply only when `--tag=package-2021-03-07` is specified on the co
8484
```yaml $(tag) == 'package-2021-03-07'
8585
input-file:
8686
- Microsoft.CommunicationServicesIdentity/stable/2021-03-07/CommunicationIdentity.json
87+
- Microsoft.CommunicationServicesCommon/stable/2021-03-07/common.json
88+
title:
89+
Azure Communication Services
8790
```
8891

8992
### Tag: package-2021-02-22-preview1

0 commit comments

Comments
 (0)