Skip to content

Commit

Permalink
Update basic-client.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kawax committed Nov 24, 2024
1 parent 7d44361 commit ddf1cee
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/basic-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,41 @@ $profile = Bluesky::getProfile(actor: 'did')->json();
$feed = Bluesky::getAuthorFeed(actor: 'did')->json('feed');
```

The request content will automatically change depending on whether you are authenticated or not. To explicitly use the public API, use `logout()`.

```php
use Revolution\Bluesky\Facades\Bluesky;

// public requests
$profile = Bluesky::getProfile(actor: 'did')->json();

// authed requests
Bluesky::login();
$profile = Bluesky::getProfile(actor: 'did')->json();
// The DID of the authed user is set automatically.
$profile = Bluesky::getProfile()->json();

// public requests
Bluesky::logout();
$profile = Bluesky::getProfile(actor: 'did')->json();
```

There are some APIs whose responses change slightly depending on the authentication state.

```php
use Revolution\Bluesky\Facades\Bluesky;

// authed
$profile = Bluesky::login()->getProfile(actor: 'did')->json();
// has "viewer"
dump($profile['viewer']);

// public
$profile = Bluesky::logout()->getProfile(actor: 'did')->json();
// no "viewer"
dump($profile['viewer']);
```

## Macroable

```php
Expand Down

0 comments on commit ddf1cee

Please sign in to comment.