Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
drasticactions committed Oct 18, 2023
1 parent 86495db commit f45c5d5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ var listRecords = await atProtocol.Repo.ListPostAsync(ATHandle.Create("da-admin.
// This is a pattern match object which can either be the "Success" object,
// or an "Error" object. The "Error" object will always be the type of "Error" and always be from the Bluesky API.
// This would be where you would handle things like authentication errors and the like.
// You can get around this by using `.AsT0` to ignore the error object, but I would handle it where possible.
listRecords.Switch(
success => {
foreach(var post in success!.Records)
Expand All @@ -79,6 +78,12 @@ listRecords.Switch(
);
```

- Instead of pattern matching, you can also use `.HandleResult()` to return the `success` object, and throw an exception upon an `error`.

```csharp
var listRecords = (await atProtocol.Repo.ListPostAsync(ATHandle.Create("da-admin.drasticactions.ninja"))).HandleResult();
```

- To log in, we need to create a session. This is applied to all `ATProtocol` calls once applied. If you need to create calls from a non-auth user session, create a new `ATProtocol` or destroy the existing session.

```csharp
Expand Down

0 comments on commit f45c5d5

Please sign in to comment.