Skip to content

Commit 0ca8fc8

Browse files
committed
Tidied up DeleteRepost and DeleteLike to have better error results
Added an overload to GetProfile() to load the profile of the current user Renamed MuteActor and UnmuteActor to Mute and Unmute Added SetProfileRecord method Added simple tutorial docs with the same topic as the official sdk docs
1 parent f1a2671 commit 0ca8fc8

26 files changed

+613
-78
lines changed

docs/docs/endpointStatus.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
| | [app.bsky.graph.getStarterPacks](https://docs.bsky.app/docs/api/app-bsky-graph-get-starter-packs) | `BlueskyAgent.GetStarterPacks()` [*](https://github.com/bluesky-social/atproto/issues/2920) ||
4343
| | [app.bsky.graph.getSuggestedFollowsByActor](https://docs.bsky.app/docs/api/app-bsky-graph-get-suggested-follows-by-actor) | `BlueskyAgent.GetSuggestedFollowsByActor()` ||
4444
| | [app.bsky.graph.muteActorList](https://docs.bsky.app/docs/api/app-bsky-graph-mute-actor-list) | `BlueskyAgent.MuteActorList()` ||
45-
| | [app.bsky.graph.muteActor](https://docs.bsky.app/docs/api/app-bsky-graph-mute-actor) | `BlueskyAgent.MuteActor()` ||
45+
| | [app.bsky.graph.muteActor](https://docs.bsky.app/docs/api/app-bsky-graph-mute-actor) | `BlueskyAgent.Mute()` ||
4646
| | [app.bsky.graph.muteThread](https://docs.bsky.app/docs/api/app-bsky-graph-mute-thread) | `BlueskyAgent.MuteThread()` ||
4747
| | [app.bsky.graph.unmuteActorList](https://docs.bsky.app/docs/api/app-bsky-graph-unmute-actor-list) | `BlueskyAgent.UnmuteActorList()` ||
48-
| | [app.bsky.graph.unmuteActor](https://docs.bsky.app/docs/api/app-bsky-graph-unmute-actor) | `BlueskyAgent.UmnuteActor()` ||
48+
| | [app.bsky.graph.unmuteActor](https://docs.bsky.app/docs/api/app-bsky-graph-unmute-actor) | `BlueskyAgent.Unmute()` ||
4949
| | [app.bsky.graph.unmuteThread](https://docs.bsky.app/docs/api/app-bsky-graph-unmute-thread) | `BlueskyAgent.UnmuteThread()` ||
5050
| **Labelers** | [app.bsky.labeler.getServices](https://docs.bsky.app/docs/api/app-bsky-labeler-get-services) | `BlueskyAgent.GetLabelerServices()` ||
5151
| **Notifications** | [app.bsky.notification.getUnreadCount](https://docs.bsky.app/docs/api/app-bsky-notification-get-unread-count) | `BlueskyAgent.GetNotificationUnreadCount()` ||

docs/docs/posting.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ Reposting works in just the same way.
134134

135135
```c#
136136
var repostResult = await agent.Repost(postStrongReference);
137-
var undoRepostResult = await agent.UndoRepost(repostResult.Result);
137+
var undoRepostResult = await agent.DeleteRepost(postUri);
138138
```
139139

140140
Quoting a post requires both the post strong reference, and the text you the quote post to contain.
141-
Deleting a post quoting another post is like deleting a regular post, you call `DeletePost`;
141+
Deleting a post quoting another post is like deleting a regular post, you call `DeletePost` with the AT-URI of the quote post that was created;
142142

143143
```c#
144144
var quoteResult = await agent.Quote(postStrongReference, "This is a quote of a post.");

docs/docs/threadGatesAndPostGates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ if (userPreferences.Succeeded)
6767
}
6868
```
6969

70-
You can then past this into `agent.Post()`
70+
You can then pass this into `agent.Post()`
7171

7272
```c#
7373
await agent.Post(
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Blocking users
2+
3+
Blocking a user prevents interaction and hides the user from a client . Blocked accounts will not be able to like, reply, mention, or follow you.
4+
Their posts, replies, and profile in search will also be hidden from you. Blocks are *public*.
5+
6+
Blocking a user works just like muting.
7+
8+
`Block(did)`
9+
10+
| Parameter | Type | Description | Required |
11+
|--------------|------|--------------------------------|:----------:|
12+
| did | Did | The DID of the user to block . | Yes |
13+
14+
```c#
15+
await agent.Block(did);
16+
```
17+
18+
> [!TIP]
19+
> If you only know the [handle](../commonTerms.md#handles) of a user you can get their DID with `agent.ResolveHandle()`.
20+
21+
## Unblocking a user
22+
23+
Unblock is also simliar to muting.
24+
25+
`Unblock(did)`
26+
27+
| Parameter | Type | Description | Required |
28+
|--------------|------|----------------------------------|:----------:|
29+
| did | Did | The DID of the user to unblock . | Yes |
30+
31+
```c#
32+
await agent.Unblock(did);
33+
```

docs/docs/tutorials/creatingAPost.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The following code will login to Bluesky and create a simple post.
66

77
The result of a successful call to `Post()` creates a [record](../commonTerms.md#records) in your Bluesky [repository](../commonTerms.md#repositories).
88

9-
The call will return, amongst other information, the `at://` [uri](../commonTerms.md#uri) of the post record and its [content identifier (CID)](../commonTerms.md#cid).
9+
The call will return, amongst other information, the `at://` [uri](../commonTerms.md#uri) of the post record and its [content identifier (CID)](../commonTerms.md#cid).
1010

1111
[!code-csharp[](code/helloWorld.cs#L7-L11)]
1212

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Editing profiles
2+
3+
An authenticated user can edit their profile, including updating their display name, avatar, banner image, and bio.
4+
5+
> [!TIP]
6+
> Only accounts with a valid profile are indexed for search. When creating a new account, Bluesky recommends creating a minimal
7+
> profile with `DisplayName` set to the user's [handle](../commonTerms.md#handles).
8+
9+
To create a profile call `agent.SetProfile()` with a profile record value.
10+
11+
`SetProfile(profile)`
12+
13+
| Parameter | Type | Description | Required |
14+
|--------------|---------------------|-------------------------------------------------------------------------|:----------:|
15+
| profile | ProfileRecordValue | The new profile record to create. | Yes |
16+
17+
```
18+
await agent.SetProfile(
19+
new ProfileRecordValue(
20+
displayName: "display name",
21+
description: "description");
22+
```
23+
24+
To edit a profile get the user's existing profile with `agent.GetProfile()`, edit the profile,
25+
then call `agent.SetProfile()` with the edited profile record.
26+
27+
`SetProfile(profile)`
28+
29+
| Parameter | Type | Description | Required |
30+
|--------------|---------------------|-------------------------------------------------------------------------|:----------:|
31+
| profile | ProfileRecord | The updated profile record to write. | Yes |
32+
33+
```c#
34+
var getProfileResult = await agent.GetProfile();
35+
if (getProfileResult.Succeeded)
36+
{
37+
getProfileResult.Result.Profile.Description = "The idunno.Bluesky Test Bot";
38+
agent.SetProfile(getProfileResult.Result, cancellationToken: cancellationToken);
39+
}
40+
```
41+
42+
### Adding or updating the profile avatar or banner
43+
44+
Images are handled as separate records by Bluesky, so adding or updating an avatar or profile banner requires the additional step of uploading the image to create a Blob record.
45+
46+
```c#
47+
var avatarUploadBlobResult = await agent.UploadBlob(imageAsByteArray, mimeType: "image/jpeg");
48+
var getProfileResult = await agent.GetProfile();
49+
50+
if (getProfileResult.Succeeded &&
51+
avatarUploadBlobResult.Succeeded)
52+
{
53+
getProfileResult.Result.Profile.Description = "The idunno.Bluesky Test Bot";
54+
getProfileResult.Result.Profile.Avatar = avatarUploadBlobResult.Result;
55+
agent.SetProfile(getProfileResult.Result, cancellationToken: cancellationToken);
56+
}
57+
```
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Following and unfollowing
2+
3+
## Following
4+
5+
To follow a user call `agent.Follow()` with the [DID](../commonTerms.md#dids) of the user you want to follow.
6+
7+
`Follow(did)`
8+
9+
| Parameter | Type | Description | Required |
10+
|--------------|------|--------------------------------|:----------:|
11+
| did | Did | The DID of the user to follow. | Yes |
12+
13+
```c#
14+
await agent.Follow(did);
15+
```
16+
17+
> [!TIP]
18+
> If you only know the [handle](../commonTerms.md#handles) of a user you can get their DID with `agent.ResolveHandle()`.
19+
20+
## Unfollowing
21+
22+
To unfollow a user call `agent.DeleteFollow()` with the [DID](../commonTerms.md#dids) of the user you want to follow.
23+
24+
`DeleteFollow(did)`
25+
26+
| Parameter | Type | Description | Required |
27+
|--------------|------|----------------------------------|:----------:|
28+
| did | Did | The DID of the user to unfollow. | Yes |
29+
30+
```c#
31+
await agent.DeleteFollow(did);
32+
```
33+
34+
If you have the `at://` [uri](../commonTerms.md#uri) of the follow record for a `DID` you can also pass that to `DeleteFollow()`.
35+
36+
`DeleteFollow(atUri)`
37+
38+
| Parameter | Type | Description | Required |
39+
|--------------|-------|---------------------------------|:----------:|
40+
| atUri | AtUri | The AtUri of the follow record. | Yes |
41+
42+
```c#
43+
await agent.DeleteFollow(atUri);
44+
```
45+
46+
A `StrongReference` to the follow record is returned from the call to `Follow()`
47+
or from [getting the user's profile](viewingProfiles.md).
48+
49+
If the `Viewer` property on a profile view is not null then the `Following` property on `Viewer` will be a `StrongReference` if the current is following
50+
the user whose profile you looked up. That `StrongReference`'s `Uri` property will be the at:// uri of the follow record.

docs/docs/tutorials/likingAndReposting.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ Liking a post is done by calling `agent.Like()` with a [strong reference](../com
88
to like
99

1010
`Like(strongReference)`
11-
| Parameter | Type | Description | Required |
12-
|--------------|--------|--------------------------------------------------------------------------------------------|:----------:|
11+
12+
| Parameter | Type | Description | Required |
13+
|-----------------|-----------------|--------------------------------------------------------------------------------|:----------:|
1314
| strongReference | StrongReference | The [Strong Reference](../commonTerms.md#strongReference) of the post to like. | Yes |
1415

1516
```c#
@@ -20,6 +21,7 @@ var likeResult = agent.Like(strongReference);
2021
the post to like
2122

2223
`Like(atUri, cid)`
24+
2325
| Parameter | Type | Description | Required |
2426
|--------------|--------|-------------------------------------------------------------------------|:----------:|
2527
| uri | AtUri | The [at:// uri](../commonTerms.md#uri) of the post to like. | Yes |
@@ -31,38 +33,55 @@ var likeResult = agent.Like(uri, cid);
3133

3234
## Unliking a post
3335

34-
Unliking a post requires calling `agent.DeleteLike()` with like record's [at:// uri](../commonTerms.md#uri)
36+
Unliking a post requires calling `agent.DeleteLike()` with original post's [at:// uri](../commonTerms.md#uri).
3537

3638
| Parameter | Type | Description | Required |
3739
|--------------|--------|----------------------------------------------------------------------------|:----------:|
3840
| uri | AtUri | The [at:// uri](../commonTerms.md#uri) of the post to delete the like for. | Yes |
3941

4042
```c#
41-
var unlikeResult = agent.DeleteLike(uri);
43+
var deleteLikeResult = agent.DeleteLike(uri);
4244
```
4345

4446
## Reposting a post
4547

4648
Reposting and un-reposting looks almost exactly the same as liking and unliking.
4749

4850
`Repost(strongReference)`
49-
| Parameter | Type | Description | Required |
50-
|--------------|--------|----------------------------------------------------------------------------------------------|:----------:|
51-
| strongReference | StrongReference | The [Strong Reference](../commonTerms.md#strongReference) of the post to repost. | Yes |
51+
52+
| Parameter | Type | Description | Required |
53+
|-----------------|-----------------|----------------------------------------------------------------------------------------------|:----------:|
54+
| strongReference | StrongReference | The [Strong Reference](../commonTerms.md#strongReference) of the post to repost. | Yes |
5255

5356
```c#
54-
var likeResult = agent.Repost(strongReference);
57+
var repostResult = agent.Repost(strongReference);
5558
```
5659

57-
`Repost(atUri, cid)`
60+
.Repost(atUri, cid)`
61+
5862
| Parameter | Type | Description | Required |
5963
|--------------|--------|---------------------------------------------------------------------------|:----------:|
6064
| uri | AtUri | The [at:// uri](../commonTerms.md#uri) of the post to repost. | Yes |
6165
| cid | Cid | The [CID](../commonTerms.md#cid) of the post to repost. | Yes |
6266

6367
```c#
64-
var likeResult = agent.DeleteREpost(uri, cid);
68+
var repostResult = agent.Repost(uri, cid);
6569
```
6670

6771
## Un-Reposting a post
6872

73+
Just like un-liking a post deleting a repost requires the original post's [at:// uri](../commonTerms.md#uri).
74+
75+
| Parameter | Type | Description | Required |
76+
|--------------|--------|----------------------------------------------------------------------------|:----------:|
77+
| uri | AtUri | The [at:// uri](../commonTerms.md#uri) of the post to delete the like for. | Yes |
78+
79+
```c#
80+
var deleteRepostResult = agent.DeleteRepost(uri);
81+
```
82+
83+
### Quoting a post
84+
85+
>[!Note]
86+
>For information on quote posts see the [Posting tutorial](../posting.md#likeRepostQuote).
87+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Muting users
2+
3+
Muting a user hides their posts from your feeds. Mutes are *private*. Muting a user is as easy following a user.
4+
5+
`Mute(did)`
6+
7+
| Parameter | Type | Description | Required |
8+
|--------------|------|--------------------------------|:----------:|
9+
| actor | Did | The DID of the user to mute . | Yes |
10+
11+
```c#
12+
await agent.Mute(did);
13+
```
14+
15+
> [!TIP]
16+
> If you only know the [handle](../commonTerms.md#handles) of a user you can get their DID with `agent.ResolveHandle()`.
17+
18+
## Unmuting a user
19+
20+
`Unmute(did)`
21+
22+
| Parameter | Type | Description | Required |
23+
|--------------|------|----------------------------------|:----------:|
24+
| actor | Did | The DID of the user to un-mute . | Yes |
25+
26+
```c#
27+
await agent.Unmute(did);
28+
```

docs/docs/tutorials/threadGates.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Thread Gates
2+
3+
Thread gates set who can reply to a post.
4+
5+
The available rules are
6+
7+
* **idunno.Bluesky.Feed.Gates.MentionRule** : Allow replies from actors mentioned in your post.
8+
* **idunno.Bluesky.Feed.Gates.FollowingRule**: Allow replies from actors you follow.
9+
* **idunno.Bluesky.Feed.Gates.FollowerRule**: Allow replies from actors you follow you.
10+
* **idunno.Bluesky.Feed.Gates.ListRule**: Allow replies from actors in a list.
11+
12+
A thread gate may have up to 5 rules.
13+
14+
## Setting a thread gate
15+
16+
You set a thread gate on one of your existing posts with `agent.AddThreadGate();`
17+
18+
`AddThreadGate(post, rules?)`
19+
20+
| Parameter | Type | Description | Required | Default |
21+
|-----------|-------------------|------------------------------------------------------------|:----------:|:---------:|
22+
| post | AtUri | The [at:// uri](../commonTerms.md#uri) of the post to gate | Yes | |
23+
| rules | ThreadGateRule[]? | A collection of rules to apply to the post | No | *null* |
24+
25+
```c#
26+
await agent.AddThreadGate(
27+
post: postUri,
28+
rules: [
29+
new FollowingRule(),
30+
new MentionRule()
31+
]);
32+
```
33+
34+
If you pass an empty array for the `rules` parameter then nobody will be able to reply.
35+
36+
```c#
37+
await agent.AddThreadGate(
38+
post: postUri,
39+
// allow nobody to reply.
40+
rules: []);
41+
```
42+
43+
## Deleting a thread gate
44+
45+
To delete a thread gate one of your posts use `agent.DeleteThreadGate();`
46+
47+
`DeleteThreadGate(post)`
48+
49+
| Parameter | Type | Description | Required | Default |
50+
|-----------|------------------|------------------------------------------------------------|:----------:|:---------:|
51+
| post | AtUri | The [at:// uri](../commonTerms.md#uri) of the post to gate | Yes | |
52+
53+
```c#
54+
await agent.DeleteThreadGate(
55+
post: postUri);
56+
```
57+
58+
## Creating a new gated post
59+
60+
You can create a post and post gate rules at the same time by passing an array of `ThreadGateRule` to any of
61+
the `agent.Post()` method that accepts the array.
62+
63+
`Post(text, ..., threadGateRules[]?)`
64+
65+
| Parameter | Type | Description | Required | Default |
66+
|-----------|-------------------|------------------------------------------------------------|:----------:|:---------:|
67+
| post | string | The text for the new post | Yes | |
68+
| rules | ThreadGateRule[]? | A collection of thread gate rules to apply to the post | No | *null* |
69+
70+
```c#
71+
await agent.Post(
72+
text: "New gated post only for people I follow.",
73+
threadGateRules: [new FollowingRule()]);
74+
```

0 commit comments

Comments
 (0)