-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support resolving website embeds (#1)
- Loading branch information
Showing
31 changed files
with
663 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace NotificationChannels\Bluesky; | ||
|
||
final class Blob | ||
{ | ||
public function __construct( | ||
public readonly array $blob, | ||
) { | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
return $this->blob; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace NotificationChannels\Bluesky\Embeds; | ||
|
||
use NotificationChannels\Bluesky\Support\SerializesToLexiconObject; | ||
|
||
abstract class Embed | ||
{ | ||
use SerializesToLexiconObject; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace NotificationChannels\Bluesky\Embeds; | ||
|
||
use NotificationChannels\Bluesky\BlueskyPost; | ||
use NotificationChannels\Bluesky\BlueskyService; | ||
|
||
interface EmbedResolver | ||
{ | ||
/** | ||
* Resolves an embed from the given post. | ||
*/ | ||
public function resolve(BlueskyService $bluesky, BlueskyPost $post): ?Embed; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace NotificationChannels\Bluesky\Embeds; | ||
|
||
final class External extends Embed | ||
{ | ||
public function __construct( | ||
public readonly string $uri, | ||
public readonly string $title, | ||
public readonly string $description, | ||
public readonly ?array $thumb = null, | ||
) {} | ||
|
||
public function getType(): string | ||
{ | ||
return 'app.bsky.embed.external'; | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
return [ | ||
'$type' => $this->getType(), | ||
'external' => $this->serializeProperties(), | ||
]; | ||
} | ||
} |
Oops, something went wrong.