Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Text.Json.Serialization;

using Microsoft.Teams.Common;

namespace Microsoft.Teams.Api.MessageExtensions;

/// <summary>
/// Messaging Extension Attachment Layout. Possible values include: 'list', 'grid'.
/// </summary>
[JsonConverter(typeof(StringEnum.JsonConverter<AttachmentLayout>))]
public class AttachmentLayout(string value) : StringEnum(value)
{
public static readonly AttachmentLayout List = new("list");
[JsonIgnore]
public bool IsList => List.Equals(Value);

public static readonly AttachmentLayout Grid = new("grid");
[JsonIgnore]
public bool IsGrid => Grid.Equals(Value);
}
2 changes: 1 addition & 1 deletion Libraries/Microsoft.Teams.Api/MessageExtensions/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class Result
/// </summary>
[JsonPropertyName("attachmentLayout")]
[JsonPropertyOrder(0)]
public Api.Attachment.Layout? AttachmentLayout { get; set; }
public AttachmentLayout? AttachmentLayout { get; set; }

/// <summary>
/// The type of the result. Possible values include:
Expand Down
12 changes: 6 additions & 6 deletions Samples/Samples.MessageExtensions/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public Microsoft.Teams.Api.MessageExtensions.Response OnMessageExtensionQuery(
ComposeExtension = new Microsoft.Teams.Api.MessageExtensions.Result
{
Type = Microsoft.Teams.Api.MessageExtensions.ResultType.Result,
AttachmentLayout = Microsoft.Teams.Api.Attachment.Layout.List,
AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List,
Attachments = new List<Microsoft.Teams.Api.MessageExtensions.Attachment>()
}
};
Expand Down Expand Up @@ -262,7 +262,7 @@ private static Microsoft.Teams.Api.MessageExtensions.Response CreateSearchResult
ComposeExtension = new Microsoft.Teams.Api.MessageExtensions.Result
{
Type = Microsoft.Teams.Api.MessageExtensions.ResultType.Result,
AttachmentLayout = Microsoft.Teams.Api.Attachment.Layout.List,
AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List,
Attachments = attachments
}
};
Expand Down Expand Up @@ -310,7 +310,7 @@ private static Microsoft.Teams.Api.MessageExtensions.Response HandleCreateCard(J
ComposeExtension = new Microsoft.Teams.Api.MessageExtensions.Result
{
Type = Microsoft.Teams.Api.MessageExtensions.ResultType.Result,
AttachmentLayout = Microsoft.Teams.Api.Attachment.Layout.List,
AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List,
Attachments = new List<Microsoft.Teams.Api.MessageExtensions.Attachment> { attachment }
}
};
Expand Down Expand Up @@ -356,7 +356,7 @@ private static Microsoft.Teams.Api.MessageExtensions.Response HandleGetMessageDe
ComposeExtension = new Microsoft.Teams.Api.MessageExtensions.Result
{
Type = Microsoft.Teams.Api.MessageExtensions.ResultType.Result,
AttachmentLayout = Microsoft.Teams.Api.Attachment.Layout.List,
AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List,
Attachments = new List<Microsoft.Teams.Api.MessageExtensions.Attachment> { attachment }
}
};
Expand Down Expand Up @@ -407,7 +407,7 @@ private static Microsoft.Teams.Api.MessageExtensions.Response CreateLinkUnfurlRe
ComposeExtension = new Microsoft.Teams.Api.MessageExtensions.Result
{
Type = Microsoft.Teams.Api.MessageExtensions.ResultType.Result,
AttachmentLayout = Microsoft.Teams.Api.Attachment.Layout.List,
AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List,
Attachments = new List<Microsoft.Teams.Api.MessageExtensions.Attachment> { attachment }
}
};
Expand Down Expand Up @@ -452,7 +452,7 @@ private static Microsoft.Teams.Api.MessageExtensions.Response CreateItemSelectio
ComposeExtension = new Microsoft.Teams.Api.MessageExtensions.Result
{
Type = Microsoft.Teams.Api.MessageExtensions.ResultType.Result,
AttachmentLayout = Microsoft.Teams.Api.Attachment.Layout.List,
AttachmentLayout = Microsoft.Teams.Api.MessageExtensions.AttachmentLayout.List,
Attachments = new List<Microsoft.Teams.Api.MessageExtensions.Attachment> { attachment }
}
};
Expand Down
Loading