microsoft/teams.net

Public

mirrored fromhttps://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
samples/migration-bot

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

core/src/Microsoft.Teams.Bot.Apps/TeamsApiClient.Models.cs

478lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4using System.Text.Json.Serialization;
5using Microsoft.Teams.Bot.Apps.Schema;
6using Microsoft.Teams.Bot.Core.Schema;
7
8namespace Microsoft.Teams.Bot.Apps;
9
10/// <summary>
11/// Represents a list of channels in a team.
12/// </summary>
13public class ChannelList
14{
15 /// <summary>
16 /// Gets or sets the list of channel conversations.
17 /// </summary>
18 [JsonPropertyName("conversations")]
19 public IList<TeamsChannel>? Channels { get; set; }
20}
21
22/// <summary>
23/// Represents detailed information about a team.
24/// </summary>
25public class TeamDetails
26{
27 /// <summary>
28 /// Gets or sets the unique identifier of the team.
29 /// </summary>
30 [JsonPropertyName("id")]
31 public string? Id { get; set; }
32
33 /// <summary>
34 /// Gets or sets the name of the team.
35 /// </summary>
36 [JsonPropertyName("name")]
37 public string? Name { get; set; }
38
39 /// <summary>
40 /// Gets or sets the Azure Active Directory group ID associated with the team.
41 /// </summary>
42 [JsonPropertyName("aadGroupId")]
43 public string? AadGroupId { get; set; }
44
45 /// <summary>
46 /// Gets or sets the number of channels in the team.
47 /// </summary>
48 [JsonPropertyName("channelCount")]
49 public int? ChannelCount { get; set; }
50
51 /// <summary>
52 /// Gets or sets the number of members in the team.
53 /// </summary>
54 [JsonPropertyName("memberCount")]
55 public int? MemberCount { get; set; }
56
57 /// <summary>
58 /// Gets or sets the type of the team. Valid values are standard, sharedChannel and privateChannel.
59 /// </summary>
60 [JsonPropertyName("type")]
61 public string? Type { get; set; }
62}
63
64/// <summary>
65/// Represents information about a meeting.
66/// </summary>
67public class MeetingInfo
68{
69 ///// <summary>
70 ///// Gets or sets the unique identifier of the meeting.
71 ///// </summary>
72 //[JsonPropertyName("id")]
73 //public string? Id { get; set; }
74
75 /// <summary>
76 /// Gets or sets the details of the meeting.
77 /// </summary>
78 [JsonPropertyName("details")]
79 public MeetingDetails? Details { get; set; }
80
81 /// <summary>
82 /// Gets or sets the conversation associated with the meeting.
83 /// </summary>
84 [JsonPropertyName("conversation")]
85 public ConversationAccount? Conversation { get; set; }
86
87 /// <summary>
88 /// Gets or sets the organizer of the meeting.
89 /// </summary>
90 [JsonPropertyName("organizer")]
91 public TeamsConversationAccount? Organizer { get; set; }
92}
93
94/// <summary>
95/// Represents detailed information about a meeting.
96/// </summary>
97public class MeetingDetails
98{
99 /// <summary>
100 /// Gets or sets the unique identifier of the meeting.
101 /// </summary>
102 [JsonPropertyName("id")]
103 public string? Id { get; set; }
104
105 /// <summary>
106 /// Gets or sets the Microsoft Graph resource ID of the meeting.
107 /// </summary>
108 [JsonPropertyName("msGraphResourceId")]
109 public string? MsGraphResourceId { get; set; }
110
111 /// <summary>
112 /// Gets or sets the scheduled start time of the meeting.
113 /// </summary>
114 [JsonPropertyName("scheduledStartTime")]
115 public DateTimeOffset? ScheduledStartTime { get; set; }
116
117 /// <summary>
118 /// Gets or sets the scheduled end time of the meeting.
119 /// </summary>
120 [JsonPropertyName("scheduledEndTime")]
121 public DateTimeOffset? ScheduledEndTime { get; set; }
122
123 /// <summary>
124 /// Gets or sets the join URL of the meeting.
125 /// </summary>
126 [JsonPropertyName("joinUrl")]
127 public Uri? JoinUrl { get; set; }
128
129 /// <summary>
130 /// Gets or sets the title of the meeting.
131 /// </summary>
132 [JsonPropertyName("title")]
133 public string? Title { get; set; }
134
135 /// <summary>
136 /// Gets or sets the type of the meeting.
137 /// </summary>
138 [JsonPropertyName("type")]
139 public string? Type { get; set; }
140}
141
142/// <summary>
143/// Represents a meeting participant with their details.
144/// </summary>
145public class MeetingParticipant
146{
147 /// <summary>
148 /// Gets or sets the user information.
149 /// </summary>
150 [JsonPropertyName("user")]
151 public ConversationAccount? User { get; set; }
152
153 /// <summary>
154 /// Gets or sets the meeting information.
155 /// </summary>
156 [JsonPropertyName("meeting")]
157 public MeetingParticipantInfo? Meeting { get; set; }
158
159 /// <summary>
160 /// Gets or sets the conversation information.
161 /// </summary>
162 [JsonPropertyName("conversation")]
163 public ConversationAccount? Conversation { get; set; }
164}
165
166/// <summary>
167/// Represents meeting-specific participant information.
168/// </summary>
169public class MeetingParticipantInfo
170{
171 /// <summary>
172 /// Gets or sets the role of the participant in the meeting.
173 /// </summary>
174 [JsonPropertyName("role")]
175 public string? Role { get; set; }
176
177 /// <summary>
178 /// Gets or sets a value indicating whether the participant is in the meeting.
179 /// </summary>
180 [JsonPropertyName("inMeeting")]
181 public bool? InMeeting { get; set; }
182}
183
184/// <summary>
185/// Base class for meeting notifications.
186/// </summary>
187public abstract class MeetingNotificationBase
188{
189 /// <summary>
190 /// Gets or sets the type of the notification.
191 /// </summary>
192 [JsonPropertyName("type")]
193 public abstract string Type { get; }
194}
195
196/// <summary>
197/// Represents a targeted meeting notification.
198/// </summary>
199public class TargetedMeetingNotification : MeetingNotificationBase
200{
201 /// <inheritdoc/>
202 [JsonPropertyName("type")]
203 public override string Type => "targetedMeetingNotification";
204
205 /// <summary>
206 /// Gets or sets the value of the notification.
207 /// </summary>
208 [JsonPropertyName("value")]
209 public TargetedMeetingNotificationValue? Value { get; set; }
210}
211
212/// <summary>
213/// Represents the value of a targeted meeting notification.
214/// </summary>
215public class TargetedMeetingNotificationValue
216{
217 /// <summary>
218 /// Gets or sets the list of recipients for the notification.
219 /// </summary>
220 [JsonPropertyName("recipients")]
221 public IList<string>? Recipients { get; set; }
222
223 /// <summary>
224 /// Gets or sets the surface configurations for the notification.
225 /// </summary>
226 [JsonPropertyName("surfaces")]
227 public IList<MeetingNotificationSurface>? Surfaces { get; set; }
228}
229
230/// <summary>
231/// Represents a surface for meeting notifications.
232/// </summary>
233public class MeetingNotificationSurface
234{
235 /// <summary>
236 /// Gets or sets the surface type (e.g., "meetingStage").
237 /// </summary>
238 [JsonPropertyName("surface")]
239 public string? Surface { get; set; }
240
241 /// <summary>
242 /// Gets or sets the content type of the notification.
243 /// </summary>
244 [JsonPropertyName("contentType")]
245 public string? ContentType { get; set; }
246
247 /// <summary>
248 /// Gets or sets the content of the notification.
249 /// </summary>
250 [JsonPropertyName("content")]
251 public object? Content { get; set; }
252}
253
254/// <summary>
255/// Response from sending a meeting notification.
256/// </summary>
257public class MeetingNotificationResponse
258{
259 /// <summary>
260 /// Gets or sets the list of recipients for whom the notification failed.
261 /// </summary>
262 [JsonPropertyName("recipientsFailureInfo")]
263 public IList<MeetingNotificationRecipientFailureInfo>? RecipientsFailureInfo { get; set; }
264}
265
266/// <summary>
267/// Information about a failed notification recipient.
268/// </summary>
269public class MeetingNotificationRecipientFailureInfo
270{
271 /// <summary>
272 /// Gets or sets the recipient ID.
273 /// </summary>
274 [JsonPropertyName("recipientMri")]
275 public string? RecipientMri { get; set; }
276
277 /// <summary>
278 /// Gets or sets the error code.
279 /// </summary>
280 [JsonPropertyName("errorCode")]
281 public string? ErrorCode { get; set; }
282
283 /// <summary>
284 /// Gets or sets the failure reason.
285 /// </summary>
286 [JsonPropertyName("failureReason")]
287 public string? FailureReason { get; set; }
288}
289
290/// <summary>
291/// Represents a team member for batch operations.
292/// </summary>
293public class TeamMember
294{
295 /// <summary>
296 /// Creates a new instance of the <see cref="TeamMember"/> class.
297 /// </summary>
298 public TeamMember()
299 {
300 }
301
302 /// <summary>
303 /// Creates a new instance of the <see cref="TeamMember"/> class with the specified ID.
304 /// </summary>
305 /// <param name="id">The member ID.</param>
306 public TeamMember(string id)
307 {
308 Id = id;
309 }
310
311 /// <summary>
312 /// Gets or sets the member ID.
313 /// </summary>
314 [JsonPropertyName("id")]
315 public string? Id { get; set; }
316}
317
318/// <summary>
319/// Represents the state of a batch operation.
320/// </summary>
321public class BatchOperationState
322{
323 /// <summary>
324 /// Gets or sets the state of the operation.
325 /// </summary>
326 [JsonPropertyName("state")]
327 public string? State { get; set; }
328
329 /// <summary>
330 /// Gets or sets the status map containing the count of different statuses.
331 /// </summary>
332 [JsonPropertyName("statusMap")]
333 public BatchOperationStatusMap? StatusMap { get; set; }
334
335 /// <summary>
336 /// Gets or sets the retry after date time.
337 /// </summary>
338 [JsonPropertyName("retryAfter")]
339 public DateTimeOffset? RetryAfter { get; set; }
340
341 /// <summary>
342 /// Gets or sets the total entries count.
343 /// </summary>
344 [JsonPropertyName("totalEntriesCount")]
345 public int? TotalEntriesCount { get; set; }
346}
347
348/// <summary>
349/// Represents the status map for a batch operation.
350/// </summary>
351public class BatchOperationStatusMap
352{
353 /// <summary>
354 /// Gets or sets the count of successful entries.
355 /// </summary>
356 [JsonPropertyName("success")]
357 public int? Success { get; set; }
358
359 /// <summary>
360 /// Gets or sets the count of failed entries.
361 /// </summary>
362 [JsonPropertyName("failed")]
363 public int? Failed { get; set; }
364
365 /// <summary>
366 /// Gets or sets the count of throttled entries.
367 /// </summary>
368 [JsonPropertyName("throttled")]
369 public int? Throttled { get; set; }
370
371 /// <summary>
372 /// Gets or sets the count of pending entries.
373 /// </summary>
374 [JsonPropertyName("pending")]
375 public int? Pending { get; set; }
376}
377
378/// <summary>
379/// Response containing failed entries from a batch operation.
380/// </summary>
381public class BatchFailedEntriesResponse
382{
383 /// <summary>
384 /// Gets or sets the continuation token for paging.
385 /// </summary>
386 [JsonPropertyName("continuationToken")]
387 public string? ContinuationToken { get; set; }
388
389 /// <summary>
390 /// Gets or sets the list of failed entries.
391 /// </summary>
392 [JsonPropertyName("failedEntries")]
393 public IList<BatchFailedEntry>? FailedEntries { get; set; }
394}
395
396/// <summary>
397/// Represents a failed entry in a batch operation.
398/// </summary>
399public class BatchFailedEntry
400{
401 /// <summary>
402 /// Gets or sets the ID of the failed entry.
403 /// </summary>
404 [JsonPropertyName("id")]
405 public string? Id { get; set; }
406
407 /// <summary>
408 /// Gets or sets the error code.
409 /// </summary>
410 [JsonPropertyName("error")]
411 public string? Error { get; set; }
412}
413
414/// <summary>
415/// Request body for sending a message to a list of users.
416/// </summary>
417internal sealed class SendMessageToUsersRequest
418{
419 /// <summary>
420 /// Gets or sets the list of members.
421 /// </summary>
422 [JsonPropertyName("members")]
423 public IList<TeamMember>? Members { get; set; }
424
425 /// <summary>
426 /// Gets or sets the activity to send.
427 /// </summary>
428 [JsonPropertyName("activity")]
429 public object? Activity { get; set; }
430
431 /// <summary>
432 /// Gets or sets the tenant ID.
433 /// </summary>
434 [JsonPropertyName("tenantId")]
435 public string? TenantId { get; set; }
436}
437
438/// <summary>
439/// Request body for sending a message to all users in a tenant.
440/// </summary>
441internal sealed class SendMessageToTenantRequest
442{
443 /// <summary>
444 /// Gets or sets the activity to send.
445 /// </summary>
446 [JsonPropertyName("activity")]
447 public object? Activity { get; set; }
448
449 /// <summary>
450 /// Gets or sets the tenant ID.
451 /// </summary>
452 [JsonPropertyName("tenantId")]
453 public string? TenantId { get; set; }
454}
455
456/// <summary>
457/// Request body for sending a message to all users in a team.
458/// </summary>
459internal sealed class SendMessageToTeamRequest
460{
461 /// <summary>
462 /// Gets or sets the activity to send.
463 /// </summary>
464 [JsonPropertyName("activity")]
465 public object? Activity { get; set; }
466
467 /// <summary>
468 /// Gets or sets the team ID.
469 /// </summary>
470 [JsonPropertyName("teamId")]
471 public string? TeamId { get; set; }
472
473 /// <summary>
474 /// Gets or sets the tenant ID.
475 /// </summary>
476 [JsonPropertyName("tenantId")]
477 public string? TenantId { get; set; }
478}
479