Skip to content

Commit 37bb82d

Browse files
committed
Add tags paraemter to ReplyTo() and Quote() helpers
1 parent 149ac6a commit 37bb82d

File tree

1 file changed

+51
-11
lines changed

1 file changed

+51
-11
lines changed

src/idunno.Bluesky/Actions/BlueskyAgentActions.cs

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,8 @@ public async Task<AtProtoHttpResult<Commit>> DeletePost(StrongReference strongRe
10581058
/// Creates a simple Bluesky post record with the specified <paramref name="text"/>, in reply to the <paramref name="parent"/> post.
10591059
/// </summary>
10601060
/// <param name="parent">A <see cref="StrongReference"/> to the parent post that the new post will be in reply to.</param>
1061-
/// <param name="text">The text for the new reply</param>
1061+
/// <param name="text">The text for the new reply.</param>
1062+
/// <param name="tags">Any tags to apply to the reply.</param>
10621063
/// <param name="extractFacets">Flag indicating whether facets should be extracted from the post text automatically.</param>
10631064
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
10641065
/// <returns>The task object representing the asynchronous operation.</returns>
@@ -1068,6 +1069,7 @@ public async Task<AtProtoHttpResult<Commit>> DeletePost(StrongReference strongRe
10681069
public async Task<AtProtoHttpResult<CreateRecordResult>> ReplyTo(
10691070
StrongReference parent,
10701071
string text,
1072+
ICollection<string>? tags = null,
10711073
bool extractFacets = true,
10721074
CancellationToken cancellationToken = default)
10731075
{
@@ -1096,6 +1098,7 @@ public async Task<AtProtoHttpResult<CreateRecordResult>> ReplyTo(
10961098
/// <param name="parent">A <see cref="StrongReference"/> to the parent post that the new post will be in reply to.</param>
10971099
/// <param name="text">The text for the new reply</param>
10981100
/// <param name="image">An image to attach to the reply.</param>
1101+
/// <param name="tags">Any tags to apply to the reply.</param>
10991102
/// <param name="extractFacets">Flag indicating whether facets should be extracted from the post text automatically.</param>
11001103
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
11011104
/// <returns>The task object representing the asynchronous operation.</returns>
@@ -1106,6 +1109,7 @@ public async Task<AtProtoHttpResult<CreateRecordResult>> ReplyTo(
11061109
StrongReference parent,
11071110
string text,
11081111
EmbeddedImage image,
1112+
ICollection<string>? tags = null,
11091113
bool extractFacets = true,
11101114
CancellationToken cancellationToken = default)
11111115
{
@@ -1137,6 +1141,7 @@ public async Task<AtProtoHttpResult<CreateRecordResult>> ReplyTo(
11371141
/// <param name="parent">A <see cref="StrongReference"/> to the parent post that the new post will be in reply to.</param>
11381142
/// <param name="text">The text for the new post</param>
11391143
/// <param name="images">Any images to attach to the post.</param>
1144+
/// <param name="tags">Any tags to apply to the reply.</param>
11401145
/// <param name="extractFacets">Flag indicating whether facets should be extracted from the post text automatically.</param>
11411146
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
11421147
/// <returns>The task object representing the asynchronous operation.</returns>
@@ -1148,6 +1153,7 @@ public async Task<AtProtoHttpResult<CreateRecordResult>> ReplyTo(
11481153
StrongReference parent,
11491154
string text,
11501155
ICollection<EmbeddedImage> images,
1156+
ICollection<string>? tags = null,
11511157
bool extractFacets = true,
11521158
CancellationToken cancellationToken = default)
11531159
{
@@ -1175,6 +1181,7 @@ private async Task<AtProtoHttpResult<CreateRecordResult>> InternalReplyTo(
11751181
StrongReference parent,
11761182
string text,
11771183
ICollection<EmbeddedImage>? images = null,
1184+
ICollection<string>? tags = null,
11781185
bool extractFacets = true,
11791186
CancellationToken cancellationToken = default)
11801187
{
@@ -1205,7 +1212,7 @@ private async Task<AtProtoHttpResult<CreateRecordResult>> InternalReplyTo(
12051212
replyReferencesResult.RateLimit);
12061213
}
12071214

1208-
PostBuilder postBuilder = new(text: text, langs: null, createdAt: null, labels: null)
1215+
PostBuilder postBuilder = new(text: text, langs: null, createdAt: null, labels: null, tags: tags)
12091216
{
12101217
InReplyTo = replyReferencesResult.Result,
12111218
};
@@ -1679,16 +1686,26 @@ public async Task<AtProtoHttpResult<Commit>> DeleteLike(StrongReference strongRe
16791686
/// </summary>
16801687
/// <param name="strongReference">A <see cref="StrongReference"/> to the post to be quoted.</param>
16811688
/// <param name="text">The text for the new post.</param>
1689+
/// <param name="tags">Any tags to apply to the quote post.</param>
16821690
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
16831691
/// <returns>The task object representing the asynchronous operation.</returns>
16841692
/// <exception cref="ArgumentNullException">Thrown when <paramref name="strongReference"/> is null.</exception>
16851693
/// <exception cref="AuthenticationRequiredException">Thrown when the agent is not authenticated.</exception>
16861694
/// <exception cref="ArgumentOutOfRangeException">Thrown when the text length is longer than the maximum permitted.</exception>
1687-
public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(StrongReference strongReference, string text, CancellationToken cancellationToken = default)
1695+
public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(
1696+
StrongReference strongReference,
1697+
string text,
1698+
ICollection<string> tags,
1699+
CancellationToken cancellationToken = default)
16881700
{
16891701
ArgumentNullException.ThrowIfNull(strongReference);
16901702

1691-
return await Quote(strongReference, text, images: null, cancellationToken: cancellationToken).ConfigureAwait(false);
1703+
return await Quote(
1704+
strongReference: strongReference,
1705+
text: text,
1706+
images: null,
1707+
tags: tags,
1708+
cancellationToken: cancellationToken).ConfigureAwait(false);
16921709
}
16931710

16941711
/// <summary>
@@ -1697,19 +1714,30 @@ public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(StrongReference s
16971714
/// <param name="strongReference">A <see cref="StrongReference"/> to the post to be quoted.</param>
16981715
/// <param name="text">The text for the post</param>
16991716
/// <param name="image">The image to attach to the post.</param>
1717+
/// <param name="tags">Any tags to apply to the quote post.</param>
17001718
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
17011719
/// <returns>The task object representing the asynchronous operation.</returns>
17021720
/// <exception cref="ArgumentNullException">Thrown when <paramref name="strongReference"/> or <paramref name="image"/> is null.</exception>
17031721
/// <exception cref="ArgumentException">Thrown when <paramref name="text"/> is null.</exception>
17041722
/// <exception cref="AuthenticationRequiredException">Thrown when the agent is not authenticated.</exception>
17051723
/// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="text"/>'s length is greater than the maximum allowed characters or graphemes.</exception>
1706-
public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(StrongReference strongReference, string text, EmbeddedImage image, CancellationToken cancellationToken = default)
1724+
public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(
1725+
StrongReference strongReference,
1726+
string text,
1727+
EmbeddedImage image,
1728+
ICollection<string> tags,
1729+
CancellationToken cancellationToken = default)
17071730
{
17081731
ArgumentNullException.ThrowIfNull(strongReference);
17091732
ArgumentException.ThrowIfNullOrEmpty(text);
17101733
ArgumentNullException.ThrowIfNull(image);
17111734

1712-
return await Quote(strongReference, text, [image], cancellationToken: cancellationToken).ConfigureAwait(false);
1735+
return await Quote(
1736+
strongReference: strongReference,
1737+
text: text,
1738+
images: [image],
1739+
tags: tags,
1740+
cancellationToken: cancellationToken).ConfigureAwait(false);
17131741
}
17141742

17151743
/// <summary>
@@ -1718,12 +1746,18 @@ public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(StrongReference s
17181746
/// <param name="strongReference">A <see cref="StrongReference"/> to the post to be quoted.</param>
17191747
/// <param name="text">The text for the new post</param>
17201748
/// <param name="images">Any images to attach to the post.</param>
1749+
/// <param name="tags">Any tags to apply to the quote post.</param>
17211750
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
17221751
/// <returns>The task object representing the asynchronous operation.</returns>
17231752
/// <exception cref="ArgumentNullException">Thrown when <paramref name="strongReference"/> is null or <paramref name="text"/> is null or empty.</exception>
17241753
/// <exception cref="AuthenticationRequiredException">Thrown when the agent is not authenticated.</exception>
17251754
/// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="text"/>'s length is greater than the maximum allowed characters or graphemes.</exception>
1726-
public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(StrongReference strongReference, string text, ICollection<EmbeddedImage>? images, CancellationToken cancellationToken = default)
1755+
public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(
1756+
StrongReference strongReference,
1757+
string text,
1758+
ICollection<EmbeddedImage>? images,
1759+
ICollection<string>? tags,
1760+
CancellationToken cancellationToken = default)
17271761
{
17281762
ArgumentNullException.ThrowIfNull(strongReference);
17291763
ArgumentNullException.ThrowIfNull(text);
@@ -1752,7 +1786,8 @@ public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(StrongReference s
17521786
{
17531787
QuotePost = strongReference,
17541788
Text = text,
1755-
Langs = [Thread.CurrentThread.CurrentUICulture.Name]
1789+
Langs = [Thread.CurrentThread.CurrentUICulture.Name],
1790+
Tags = tags
17561791
};
17571792

17581793
if (images is not null)
@@ -1768,13 +1803,15 @@ public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(StrongReference s
17681803
/// </summary>
17691804
/// <param name="strongReference">A <see cref="StrongReference"/> to the post to be quoted.</param>
17701805
/// <param name="image">The image to attach to the quote.</param>
1806+
/// <param name="tags">Any tags to apply to the quote post.</param>
17711807
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
17721808
/// <returns>The task object representing the asynchronous operation.</returns>
17731809
/// <exception cref="ArgumentNullException">Thrown when <paramref name="image"/> is null</exception>
17741810
/// <exception cref="AuthenticationRequiredException">Thrown when the agent is not authenticated.</exception>
17751811
public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(
17761812
StrongReference strongReference,
17771813
EmbeddedImage image,
1814+
ICollection<string>? tags = null,
17781815
CancellationToken cancellationToken = default)
17791816
{
17801817
ArgumentNullException.ThrowIfNull(image);
@@ -1784,14 +1821,15 @@ public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(
17841821
throw new AuthenticationRequiredException();
17851822
}
17861823

1787-
return await Quote(strongReference, [image], cancellationToken: cancellationToken).ConfigureAwait(false);
1824+
return await Quote(strongReference, [image], tags: tags, cancellationToken: cancellationToken).ConfigureAwait(false);
17881825
}
17891826

17901827
/// <summary>
17911828
/// Creates an Bluesky post record quoting the post identified by <see cref="StrongReference"/>.
17921829
/// </summary>
17931830
/// <param name="strongReference">A <see cref="StrongReference"/> to the post to be quoted.</param>
1794-
/// <param name="images">Any images to attach to the post.</param>
1831+
/// <param name="images">Any images to attach to the quote post.</param>
1832+
/// <param name="tags">Any tags to apply to the quote post.</param>
17951833
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
17961834
/// <returns>The task object representing the asynchronous operation.</returns>
17971835
/// <exception cref="ArgumentNullException">Thrown when <paramref name="strongReference"/> is null</exception>
@@ -1806,6 +1844,7 @@ public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(
18061844
public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(
18071845
StrongReference strongReference,
18081846
ICollection<EmbeddedImage>? images = null,
1847+
ICollection<string>? tags = null,
18091848
CancellationToken cancellationToken = default)
18101849
{
18111850
ArgumentNullException.ThrowIfNull(strongReference);
@@ -1825,7 +1864,8 @@ public async Task<AtProtoHttpResult<CreateRecordResult>> Quote(
18251864
{
18261865
EmbeddedRecord = new EmbeddedRecord(strongReference),
18271866
Text = string.Empty,
1828-
CreatedAt = DateTimeOffset.UtcNow
1867+
CreatedAt = DateTimeOffset.UtcNow,
1868+
Tags = tags
18291869
};
18301870

18311871
if (images is not null)

0 commit comments

Comments
 (0)