microsoft/teams.net

Public

mirrored from https://github.com/microsoft/teams.netAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
feature/user-agent-header

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

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