From f8133290552840e3723a0f67371a4481039c5ac6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 14:52:13 +0000 Subject: [PATCH 1/3] feat(api): api update --- .stats.yml | 4 ++-- src/Messages/MessageSearchParams.php | 14 ++++---------- src/Messages/MessageSearchParams/Sender.php | 15 --------------- src/ServiceContracts/MessagesContract.php | 5 ++--- src/Services/MessagesRawService.php | 3 +-- src/Services/MessagesService.php | 5 ++--- 6 files changed, 11 insertions(+), 35 deletions(-) delete mode 100644 src/Messages/MessageSearchParams/Sender.php diff --git a/.stats.yml b/.stats.yml index 8ec4701..5a6113f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 23 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-774bb08472b6bb14c280fe5b767925675516b5c8ccc0b89b5abd7ac7bc30fe5a.yml -openapi_spec_hash: ddd1ce1f334b45206ac008b0f5296842 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-4acef56b00be513f305543096fdd407e6947f0a5ad268ab2e627ff30b37a75db.yml +openapi_spec_hash: e876d796b6c25f18577f6be3944bf7d9 config_hash: b5ac0c1579dfe6257bcdb84cfd1002fc diff --git a/src/Messages/MessageSearchParams.php b/src/Messages/MessageSearchParams.php index e9ffe25..49d617f 100644 --- a/src/Messages/MessageSearchParams.php +++ b/src/Messages/MessageSearchParams.php @@ -11,7 +11,6 @@ use BeeperDesktop\Messages\MessageSearchParams\ChatType; use BeeperDesktop\Messages\MessageSearchParams\Direction; use BeeperDesktop\Messages\MessageSearchParams\MediaType; -use BeeperDesktop\Messages\MessageSearchParams\Sender; /** * Search messages across chats using Beeper's message index. @@ -31,7 +30,7 @@ * limit?: int|null, * mediaTypes?: list>|null, * query?: string|null, - * sender?: string|null|Sender|value-of, + * sender?: string|null, * } */ final class MessageSearchParams implements BaseModel @@ -124,10 +123,8 @@ final class MessageSearchParams implements BaseModel /** * Filter by sender: 'me' (messages sent by the authenticated user), 'others' (messages sent by others), or a specific user ID string (user.id). - * - * @var string|value-of|null $sender */ - #[Optional(enum: Sender::class)] + #[Optional] public ?string $sender; public function __construct() @@ -145,7 +142,6 @@ public function __construct() * @param ChatType|value-of|null $chatType * @param Direction|value-of|null $direction * @param list>|null $mediaTypes - * @param string|Sender|value-of|null $sender */ public static function with( ?array $accountIDs = null, @@ -160,7 +156,7 @@ public static function with( ?int $limit = null, ?array $mediaTypes = null, ?string $query = null, - Sender|string|null $sender = null, + ?string $sender = null, ): self { $self = new self; @@ -325,10 +321,8 @@ public function withQuery(string $query): self /** * Filter by sender: 'me' (messages sent by the authenticated user), 'others' (messages sent by others), or a specific user ID string (user.id). - * - * @param string|Sender|value-of $sender */ - public function withSender(Sender|string $sender): self + public function withSender(string $sender): self { $self = clone $this; $self['sender'] = $sender; diff --git a/src/Messages/MessageSearchParams/Sender.php b/src/Messages/MessageSearchParams/Sender.php deleted file mode 100644 index e58a8ab..0000000 --- a/src/Messages/MessageSearchParams/Sender.php +++ /dev/null @@ -1,15 +0,0 @@ -> $mediaTypes Filter messages by media types. Use ['any'] for any media type, or specify exact types like ['video', 'image']. Omit for no media filtering. * @param string $query Literal word search (non-semantic). Finds messages containing these EXACT words in any order. Use single words users actually type, not concepts or phrases. Example: use "dinner" not "dinner plans", use "sick" not "health issues". If omitted, returns results filtered only by other parameters. - * @param string|Sender|value-of $sender Filter by sender: 'me' (messages sent by the authenticated user), 'others' (messages sent by others), or a specific user ID string (user.id). + * @param string $sender Filter by sender: 'me' (messages sent by the authenticated user), 'others' (messages sent by others), or a specific user ID string (user.id). * @param RequestOpts|null $requestOptions * * @return CursorSearch @@ -94,7 +93,7 @@ public function search( int $limit = 20, ?array $mediaTypes = null, ?string $query = null, - Sender|string|null $sender = null, + ?string $sender = null, RequestOptions|array|null $requestOptions = null, ): CursorSearch; diff --git a/src/Services/MessagesRawService.php b/src/Services/MessagesRawService.php index 58ac32b..9d379ed 100644 --- a/src/Services/MessagesRawService.php +++ b/src/Services/MessagesRawService.php @@ -15,7 +15,6 @@ use BeeperDesktop\Messages\MessageSearchParams; use BeeperDesktop\Messages\MessageSearchParams\ChatType; use BeeperDesktop\Messages\MessageSearchParams\MediaType; -use BeeperDesktop\Messages\MessageSearchParams\Sender; use BeeperDesktop\Messages\MessageSendParams; use BeeperDesktop\Messages\MessageSendParams\Attachment; use BeeperDesktop\Messages\MessageSendResponse; @@ -127,7 +126,7 @@ public function list( * limit?: int, * mediaTypes?: list>, * query?: string, - * sender?: string|Sender|value-of, + * sender?: string, * }|MessageSearchParams $params * @param RequestOpts|null $requestOptions * diff --git a/src/Services/MessagesService.php b/src/Services/MessagesService.php index 70f0386..23d1d14 100644 --- a/src/Services/MessagesService.php +++ b/src/Services/MessagesService.php @@ -13,7 +13,6 @@ use BeeperDesktop\Messages\MessageListParams\Direction; use BeeperDesktop\Messages\MessageSearchParams\ChatType; use BeeperDesktop\Messages\MessageSearchParams\MediaType; -use BeeperDesktop\Messages\MessageSearchParams\Sender; use BeeperDesktop\Messages\MessageSendParams\Attachment; use BeeperDesktop\Messages\MessageSendResponse; use BeeperDesktop\Messages\MessageUpdateResponse; @@ -114,7 +113,7 @@ public function list( * @param int $limit maximum number of messages to return * @param list> $mediaTypes Filter messages by media types. Use ['any'] for any media type, or specify exact types like ['video', 'image']. Omit for no media filtering. * @param string $query Literal word search (non-semantic). Finds messages containing these EXACT words in any order. Use single words users actually type, not concepts or phrases. Example: use "dinner" not "dinner plans", use "sick" not "health issues". If omitted, returns results filtered only by other parameters. - * @param string|Sender|value-of $sender Filter by sender: 'me' (messages sent by the authenticated user), 'others' (messages sent by others), or a specific user ID string (user.id). + * @param string $sender Filter by sender: 'me' (messages sent by the authenticated user), 'others' (messages sent by others), or a specific user ID string (user.id). * @param RequestOpts|null $requestOptions * * @return CursorSearch @@ -134,7 +133,7 @@ public function search( int $limit = 20, ?array $mediaTypes = null, ?string $query = null, - Sender|string|null $sender = null, + ?string $sender = null, RequestOptions|array|null $requestOptions = null, ): CursorSearch { $params = Util::removeNulls( From fe6b606f1e40643b6f81a68bfbf467653d070a6a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 14:58:05 +0000 Subject: [PATCH 2/3] feat(api): api update --- .stats.yml | 2 +- src/Chats/ChatCreateParams.php | 191 ++++++++++++-- src/Chats/ChatCreateParams/Chat.php | 237 ------------------ .../ChatCreateParams/{Chat => }/Mode.php | 2 +- .../ChatCreateParams/{Chat => }/Type.php | 2 +- .../ChatCreateParams/{Chat => }/User.php | 2 +- src/ServiceContracts/ChatsContract.php | 36 ++- src/Services/ChatsRawService.php | 31 ++- src/Services/ChatsService.php | 49 +++- tests/Services/ChatsTest.php | 30 ++- 10 files changed, 280 insertions(+), 302 deletions(-) delete mode 100644 src/Chats/ChatCreateParams/Chat.php rename src/Chats/ChatCreateParams/{Chat => }/Mode.php (76%) rename src/Chats/ChatCreateParams/{Chat => }/Type.php (82%) rename src/Chats/ChatCreateParams/{Chat => }/User.php (98%) diff --git a/.stats.yml b/.stats.yml index 5a6113f..56c368e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 23 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-4acef56b00be513f305543096fdd407e6947f0a5ad268ab2e627ff30b37a75db.yml openapi_spec_hash: e876d796b6c25f18577f6be3944bf7d9 -config_hash: b5ac0c1579dfe6257bcdb84cfd1002fc +config_hash: 659111d4e28efa599b5f800619ed79c2 diff --git a/src/Chats/ChatCreateParams.php b/src/Chats/ChatCreateParams.php index 0bdb4bc..a476c25 100644 --- a/src/Chats/ChatCreateParams.php +++ b/src/Chats/ChatCreateParams.php @@ -4,7 +4,10 @@ namespace BeeperDesktop\Chats; -use BeeperDesktop\Chats\ChatCreateParams\Chat; +use BeeperDesktop\Chats\ChatCreateParams\Mode; +use BeeperDesktop\Chats\ChatCreateParams\Type; +use BeeperDesktop\Chats\ChatCreateParams\User; +use BeeperDesktop\Core\Attributes\Optional; use BeeperDesktop\Core\Attributes\Required; use BeeperDesktop\Core\Concerns\SdkModel; use BeeperDesktop\Core\Concerns\SdkParams; @@ -15,10 +18,17 @@ * * @see BeeperDesktop\Services\ChatsService::create() * - * @phpstan-import-type ChatShape from \BeeperDesktop\Chats\ChatCreateParams\Chat + * @phpstan-import-type UserShape from \BeeperDesktop\Chats\ChatCreateParams\User * * @phpstan-type ChatCreateParamsShape = array{ - * chat: \BeeperDesktop\Chats\ChatCreateParams\Chat|ChatShape + * accountID: string, + * allowInvite?: bool|null, + * messageText?: string|null, + * mode?: null|Mode|value-of, + * participantIDs?: list|null, + * title?: string|null, + * type?: null|Type|value-of, + * user?: null|User|UserShape, * } */ final class ChatCreateParams implements BaseModel @@ -27,21 +37,72 @@ final class ChatCreateParams implements BaseModel use SdkModel; use SdkParams; + /** + * Account to create or start the chat on. + */ #[Required] - public Chat $chat; + public string $accountID; + + /** + * Whether invite-based DM creation is allowed when required by the platform. Used for mode='start'. + */ + #[Optional] + public ?bool $allowInvite; + + /** + * Optional first message content if the platform requires it to create the chat. + */ + #[Optional] + public ?string $messageText; + + /** + * Operation mode. Defaults to 'create' when omitted. + * + * @var value-of|null $mode + */ + #[Optional(enum: Mode::class)] + public ?string $mode; + + /** + * Required when mode='create'. User IDs to include in the new chat. + * + * @var list|null $participantIDs + */ + #[Optional(list: 'string')] + public ?array $participantIDs; + + /** + * Optional title for group chats when mode='create'; ignored for single chats on most platforms. + */ + #[Optional] + public ?string $title; + + /** + * Required when mode='create'. 'single' requires exactly one participantID; 'group' supports multiple participants and optional title. + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * Required when mode='start'. Merged user-like contact payload used to resolve the best identifier. + */ + #[Optional] + public ?User $user; /** * `new ChatCreateParams()` is missing required properties by the API. * * To enforce required parameters use * ``` - * ChatCreateParams::with(chat: ...) + * ChatCreateParams::with(accountID: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new ChatCreateParams)->withChat(...) + * (new ChatCreateParams)->withAccountID(...) * ``` */ public function __construct() @@ -54,26 +115,128 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param Chat|ChatShape $chat + * @param Mode|value-of|null $mode + * @param list|null $participantIDs + * @param Type|value-of|null $type + * @param User|UserShape|null $user */ public static function with( - Chat|array $chat + string $accountID, + ?bool $allowInvite = null, + ?string $messageText = null, + Mode|string|null $mode = null, + ?array $participantIDs = null, + ?string $title = null, + Type|string|null $type = null, + User|array|null $user = null, ): self { $self = new self; - $self['chat'] = $chat; + $self['accountID'] = $accountID; + + null !== $allowInvite && $self['allowInvite'] = $allowInvite; + null !== $messageText && $self['messageText'] = $messageText; + null !== $mode && $self['mode'] = $mode; + null !== $participantIDs && $self['participantIDs'] = $participantIDs; + null !== $title && $self['title'] = $title; + null !== $type && $self['type'] = $type; + null !== $user && $self['user'] = $user; return $self; } /** - * @param Chat|ChatShape $chat + * Account to create or start the chat on. */ - public function withChat( - Chat|array $chat - ): self { + public function withAccountID(string $accountID): self + { + $self = clone $this; + $self['accountID'] = $accountID; + + return $self; + } + + /** + * Whether invite-based DM creation is allowed when required by the platform. Used for mode='start'. + */ + public function withAllowInvite(bool $allowInvite): self + { + $self = clone $this; + $self['allowInvite'] = $allowInvite; + + return $self; + } + + /** + * Optional first message content if the platform requires it to create the chat. + */ + public function withMessageText(string $messageText): self + { + $self = clone $this; + $self['messageText'] = $messageText; + + return $self; + } + + /** + * Operation mode. Defaults to 'create' when omitted. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * Required when mode='create'. User IDs to include in the new chat. + * + * @param list $participantIDs + */ + public function withParticipantIDs(array $participantIDs): self + { + $self = clone $this; + $self['participantIDs'] = $participantIDs; + + return $self; + } + + /** + * Optional title for group chats when mode='create'; ignored for single chats on most platforms. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * Required when mode='create'. 'single' requires exactly one participantID; 'group' supports multiple participants and optional title. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Required when mode='start'. Merged user-like contact payload used to resolve the best identifier. + * + * @param User|UserShape $user + */ + public function withUser(User|array $user): self + { $self = clone $this; - $self['chat'] = $chat; + $self['user'] = $user; return $self; } diff --git a/src/Chats/ChatCreateParams/Chat.php b/src/Chats/ChatCreateParams/Chat.php deleted file mode 100644 index d1d63c2..0000000 --- a/src/Chats/ChatCreateParams/Chat.php +++ /dev/null @@ -1,237 +0,0 @@ -, - * participantIDs?: list|null, - * title?: string|null, - * type?: null|Type|value-of, - * user?: null|User|UserShape, - * } - */ -final class Chat implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Account to create or start the chat on. - */ - #[Required] - public string $accountID; - - /** - * Whether invite-based DM creation is allowed when required by the platform. Used for mode='start'. - */ - #[Optional] - public ?bool $allowInvite; - - /** - * Optional first message content if the platform requires it to create the chat. - */ - #[Optional] - public ?string $messageText; - - /** - * Operation mode. Defaults to 'create' when omitted. - * - * @var value-of|null $mode - */ - #[Optional(enum: Mode::class)] - public ?string $mode; - - /** - * Required when mode='create'. User IDs to include in the new chat. - * - * @var list|null $participantIDs - */ - #[Optional(list: 'string')] - public ?array $participantIDs; - - /** - * Optional title for group chats when mode='create'; ignored for single chats on most platforms. - */ - #[Optional] - public ?string $title; - - /** - * Required when mode='create'. 'single' requires exactly one participantID; 'group' supports multiple participants and optional title. - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * Required when mode='start'. Merged user-like contact payload used to resolve the best identifier. - */ - #[Optional] - public ?User $user; - - /** - * `new Chat()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Chat::with(accountID: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Chat)->withAccountID(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Mode|value-of|null $mode - * @param list|null $participantIDs - * @param Type|value-of|null $type - * @param User|UserShape|null $user - */ - public static function with( - string $accountID, - ?bool $allowInvite = null, - ?string $messageText = null, - Mode|string|null $mode = null, - ?array $participantIDs = null, - ?string $title = null, - Type|string|null $type = null, - User|array|null $user = null, - ): self { - $self = new self; - - $self['accountID'] = $accountID; - - null !== $allowInvite && $self['allowInvite'] = $allowInvite; - null !== $messageText && $self['messageText'] = $messageText; - null !== $mode && $self['mode'] = $mode; - null !== $participantIDs && $self['participantIDs'] = $participantIDs; - null !== $title && $self['title'] = $title; - null !== $type && $self['type'] = $type; - null !== $user && $self['user'] = $user; - - return $self; - } - - /** - * Account to create or start the chat on. - */ - public function withAccountID(string $accountID): self - { - $self = clone $this; - $self['accountID'] = $accountID; - - return $self; - } - - /** - * Whether invite-based DM creation is allowed when required by the platform. Used for mode='start'. - */ - public function withAllowInvite(bool $allowInvite): self - { - $self = clone $this; - $self['allowInvite'] = $allowInvite; - - return $self; - } - - /** - * Optional first message content if the platform requires it to create the chat. - */ - public function withMessageText(string $messageText): self - { - $self = clone $this; - $self['messageText'] = $messageText; - - return $self; - } - - /** - * Operation mode. Defaults to 'create' when omitted. - * - * @param Mode|value-of $mode - */ - public function withMode(Mode|string $mode): self - { - $self = clone $this; - $self['mode'] = $mode; - - return $self; - } - - /** - * Required when mode='create'. User IDs to include in the new chat. - * - * @param list $participantIDs - */ - public function withParticipantIDs(array $participantIDs): self - { - $self = clone $this; - $self['participantIDs'] = $participantIDs; - - return $self; - } - - /** - * Optional title for group chats when mode='create'; ignored for single chats on most platforms. - */ - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - /** - * Required when mode='create'. 'single' requires exactly one participantID; 'group' supports multiple participants and optional title. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * Required when mode='start'. Merged user-like contact payload used to resolve the best identifier. - * - * @param User|UserShape $user - */ - public function withUser(User|array $user): self - { - $self = clone $this; - $self['user'] = $user; - - return $self; - } -} diff --git a/src/Chats/ChatCreateParams/Chat/Mode.php b/src/Chats/ChatCreateParams/Mode.php similarity index 76% rename from src/Chats/ChatCreateParams/Chat/Mode.php rename to src/Chats/ChatCreateParams/Mode.php index ce0dabd..8ade752 100644 --- a/src/Chats/ChatCreateParams/Chat/Mode.php +++ b/src/Chats/ChatCreateParams/Mode.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace BeeperDesktop\Chats\ChatCreateParams\Chat; +namespace BeeperDesktop\Chats\ChatCreateParams; /** * Operation mode. Defaults to 'create' when omitted. diff --git a/src/Chats/ChatCreateParams/Chat/Type.php b/src/Chats/ChatCreateParams/Type.php similarity index 82% rename from src/Chats/ChatCreateParams/Chat/Type.php rename to src/Chats/ChatCreateParams/Type.php index 630c2f6..16d7400 100644 --- a/src/Chats/ChatCreateParams/Chat/Type.php +++ b/src/Chats/ChatCreateParams/Type.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace BeeperDesktop\Chats\ChatCreateParams\Chat; +namespace BeeperDesktop\Chats\ChatCreateParams; /** * Required when mode='create'. 'single' requires exactly one participantID; 'group' supports multiple participants and optional title. diff --git a/src/Chats/ChatCreateParams/Chat/User.php b/src/Chats/ChatCreateParams/User.php similarity index 98% rename from src/Chats/ChatCreateParams/Chat/User.php rename to src/Chats/ChatCreateParams/User.php index df629a7..3f60298 100644 --- a/src/Chats/ChatCreateParams/Chat/User.php +++ b/src/Chats/ChatCreateParams/User.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace BeeperDesktop\Chats\ChatCreateParams\Chat; +namespace BeeperDesktop\Chats\ChatCreateParams; use BeeperDesktop\Core\Attributes\Optional; use BeeperDesktop\Core\Concerns\SdkModel; diff --git a/src/ServiceContracts/ChatsContract.php b/src/ServiceContracts/ChatsContract.php index e86488b..1c30811 100644 --- a/src/ServiceContracts/ChatsContract.php +++ b/src/ServiceContracts/ChatsContract.php @@ -4,20 +4,22 @@ namespace BeeperDesktop\ServiceContracts; -use BeeperDesktop\Chats\ChatCreateParams\Chat; +use BeeperDesktop\Chats\Chat; +use BeeperDesktop\Chats\ChatCreateParams\Mode; +use BeeperDesktop\Chats\ChatCreateParams\Type; +use BeeperDesktop\Chats\ChatCreateParams\User; use BeeperDesktop\Chats\ChatListParams\Direction; use BeeperDesktop\Chats\ChatListResponse; use BeeperDesktop\Chats\ChatNewResponse; use BeeperDesktop\Chats\ChatSearchParams\Inbox; use BeeperDesktop\Chats\ChatSearchParams\Scope; -use BeeperDesktop\Chats\ChatSearchParams\Type; use BeeperDesktop\Core\Exceptions\APIException; use BeeperDesktop\CursorNoLimit; use BeeperDesktop\CursorSearch; use BeeperDesktop\RequestOptions; /** - * @phpstan-import-type ChatShape from \BeeperDesktop\Chats\ChatCreateParams\Chat + * @phpstan-import-type UserShape from \BeeperDesktop\Chats\ChatCreateParams\User * @phpstan-import-type RequestOpts from \BeeperDesktop\RequestOptions */ interface ChatsContract @@ -25,14 +27,28 @@ interface ChatsContract /** * @api * - * @param Chat|ChatShape $chat + * @param string $accountID account to create or start the chat on + * @param bool $allowInvite Whether invite-based DM creation is allowed when required by the platform. Used for mode='start'. + * @param string $messageText optional first message content if the platform requires it to create the chat + * @param Mode|value-of $mode Operation mode. Defaults to 'create' when omitted. + * @param list $participantIDs Required when mode='create'. User IDs to include in the new chat. + * @param string $title optional title for group chats when mode='create'; ignored for single chats on most platforms + * @param Type|value-of $type Required when mode='create'. 'single' requires exactly one participantID; 'group' supports multiple participants and optional title. + * @param User|UserShape $user Required when mode='start'. Merged user-like contact payload used to resolve the best identifier. * @param RequestOpts|null $requestOptions * * @throws APIException */ public function create( - Chat|array $chat, - RequestOptions|array|null $requestOptions = null + string $accountID, + bool $allowInvite = true, + ?string $messageText = null, + Mode|string|null $mode = null, + ?array $participantIDs = null, + ?string $title = null, + Type|string|null $type = null, + User|array|null $user = null, + RequestOptions|array|null $requestOptions = null, ): ChatNewResponse; /** @@ -48,7 +64,7 @@ public function retrieve( string $chatID, ?int $maxParticipantCount = -1, RequestOptions|array|null $requestOptions = null, - ): \BeeperDesktop\Chats\Chat; + ): Chat; /** * @api @@ -97,11 +113,11 @@ public function archive( * @param int $limit Set the maximum number of chats to retrieve. Valid range: 1-200, default is 50 * @param string $query Literal token search (non-semantic). Use single words users type (e.g., "dinner"). When multiple words provided, ALL must match. Case-insensitive. * @param Scope|value-of $scope search scope: 'titles' matches title + network; 'participants' matches participant names - * @param Type|value-of $type Specify the type of chats to retrieve: use "single" for direct messages, "group" for group chats, or "any" to get all types + * @param \BeeperDesktop\Chats\ChatSearchParams\Type|value-of<\BeeperDesktop\Chats\ChatSearchParams\Type> $type Specify the type of chats to retrieve: use "single" for direct messages, "group" for group chats, or "any" to get all types * @param bool|null $unreadOnly Set to true to only retrieve chats that have unread messages * @param RequestOpts|null $requestOptions * - * @return CursorSearch<\BeeperDesktop\Chats\Chat> + * @return CursorSearch * * @throws APIException */ @@ -116,7 +132,7 @@ public function search( int $limit = 50, ?string $query = null, Scope|string $scope = 'titles', - Type|string $type = 'any', + \BeeperDesktop\Chats\ChatSearchParams\Type|string $type = 'any', ?bool $unreadOnly = null, RequestOptions|array|null $requestOptions = null, ): CursorSearch; diff --git a/src/Services/ChatsRawService.php b/src/Services/ChatsRawService.php index 1df2645..d54d92b 100644 --- a/src/Services/ChatsRawService.php +++ b/src/Services/ChatsRawService.php @@ -4,9 +4,12 @@ namespace BeeperDesktop\Services; +use BeeperDesktop\Chats\Chat; use BeeperDesktop\Chats\ChatArchiveParams; use BeeperDesktop\Chats\ChatCreateParams; -use BeeperDesktop\Chats\ChatCreateParams\Chat; +use BeeperDesktop\Chats\ChatCreateParams\Mode; +use BeeperDesktop\Chats\ChatCreateParams\Type; +use BeeperDesktop\Chats\ChatCreateParams\User; use BeeperDesktop\Chats\ChatListParams; use BeeperDesktop\Chats\ChatListParams\Direction; use BeeperDesktop\Chats\ChatListResponse; @@ -15,7 +18,6 @@ use BeeperDesktop\Chats\ChatSearchParams; use BeeperDesktop\Chats\ChatSearchParams\Inbox; use BeeperDesktop\Chats\ChatSearchParams\Scope; -use BeeperDesktop\Chats\ChatSearchParams\Type; use BeeperDesktop\Client; use BeeperDesktop\Core\Contracts\BaseResponse; use BeeperDesktop\Core\Exceptions\APIException; @@ -27,7 +29,7 @@ /** * Manage chats. * - * @phpstan-import-type ChatShape from \BeeperDesktop\Chats\ChatCreateParams\Chat + * @phpstan-import-type UserShape from \BeeperDesktop\Chats\ChatCreateParams\User * @phpstan-import-type RequestOpts from \BeeperDesktop\RequestOptions */ final class ChatsRawService implements ChatsRawContract @@ -43,7 +45,16 @@ public function __construct(private Client $client) {} * * Create a single/group chat (mode='create') or start a direct chat from merged user data (mode='start'). * - * @param array{chat: Chat|ChatShape}|ChatCreateParams $params + * @param array{ + * accountID: string, + * allowInvite?: bool, + * messageText?: string, + * mode?: Mode|value-of, + * participantIDs?: list, + * title?: string, + * type?: Type|value-of, + * user?: User|UserShape, + * }|ChatCreateParams $params * @param RequestOpts|null $requestOptions * * @return BaseResponse @@ -63,7 +74,7 @@ public function create( return $this->client->request( method: 'post', path: 'v1/chats', - body: (object) $parsed['chat'], + body: (object) $parsed, options: $options, convert: ChatNewResponse::class, ); @@ -78,7 +89,7 @@ public function create( * @param array{maxParticipantCount?: int|null}|ChatRetrieveParams $params * @param RequestOpts|null $requestOptions * - * @return BaseResponse<\BeeperDesktop\Chats\Chat> + * @return BaseResponse * * @throws APIException */ @@ -98,7 +109,7 @@ public function retrieve( path: ['v1/chats/%1$s', $chatID], query: $parsed, options: $options, - convert: \BeeperDesktop\Chats\Chat::class, + convert: Chat::class, ); } @@ -187,12 +198,12 @@ public function archive( * limit?: int, * query?: string, * scope?: Scope|value-of, - * type?: Type|value-of, + * type?: ChatSearchParams\Type|value-of, * unreadOnly?: bool|null, * }|ChatSearchParams $params * @param RequestOpts|null $requestOptions * - * @return BaseResponse> + * @return BaseResponse> * * @throws APIException */ @@ -211,7 +222,7 @@ public function search( path: 'v1/chats/search', query: $parsed, options: $options, - convert: \BeeperDesktop\Chats\Chat::class, + convert: Chat::class, page: CursorSearch::class, ); } diff --git a/src/Services/ChatsService.php b/src/Services/ChatsService.php index 8ca0439..fbeb607 100644 --- a/src/Services/ChatsService.php +++ b/src/Services/ChatsService.php @@ -4,13 +4,15 @@ namespace BeeperDesktop\Services; -use BeeperDesktop\Chats\ChatCreateParams\Chat; +use BeeperDesktop\Chats\Chat; +use BeeperDesktop\Chats\ChatCreateParams\Mode; +use BeeperDesktop\Chats\ChatCreateParams\Type; +use BeeperDesktop\Chats\ChatCreateParams\User; use BeeperDesktop\Chats\ChatListParams\Direction; use BeeperDesktop\Chats\ChatListResponse; use BeeperDesktop\Chats\ChatNewResponse; use BeeperDesktop\Chats\ChatSearchParams\Inbox; use BeeperDesktop\Chats\ChatSearchParams\Scope; -use BeeperDesktop\Chats\ChatSearchParams\Type; use BeeperDesktop\Client; use BeeperDesktop\Core\Exceptions\APIException; use BeeperDesktop\Core\Util; @@ -24,7 +26,7 @@ /** * Manage chats. * - * @phpstan-import-type ChatShape from \BeeperDesktop\Chats\ChatCreateParams\Chat + * @phpstan-import-type UserShape from \BeeperDesktop\Chats\ChatCreateParams\User * @phpstan-import-type RequestOpts from \BeeperDesktop\RequestOptions */ final class ChatsService implements ChatsContract @@ -59,16 +61,41 @@ public function __construct(private Client $client) * * Create a single/group chat (mode='create') or start a direct chat from merged user data (mode='start'). * - * @param Chat|ChatShape $chat + * @param string $accountID account to create or start the chat on + * @param bool $allowInvite Whether invite-based DM creation is allowed when required by the platform. Used for mode='start'. + * @param string $messageText optional first message content if the platform requires it to create the chat + * @param Mode|value-of $mode Operation mode. Defaults to 'create' when omitted. + * @param list $participantIDs Required when mode='create'. User IDs to include in the new chat. + * @param string $title optional title for group chats when mode='create'; ignored for single chats on most platforms + * @param Type|value-of $type Required when mode='create'. 'single' requires exactly one participantID; 'group' supports multiple participants and optional title. + * @param User|UserShape $user Required when mode='start'. Merged user-like contact payload used to resolve the best identifier. * @param RequestOpts|null $requestOptions * * @throws APIException */ public function create( - Chat|array $chat, - RequestOptions|array|null $requestOptions = null + string $accountID, + bool $allowInvite = true, + ?string $messageText = null, + Mode|string|null $mode = null, + ?array $participantIDs = null, + ?string $title = null, + Type|string|null $type = null, + User|array|null $user = null, + RequestOptions|array|null $requestOptions = null, ): ChatNewResponse { - $params = Util::removeNulls(['chat' => $chat]); + $params = Util::removeNulls( + [ + 'accountID' => $accountID, + 'allowInvite' => $allowInvite, + 'messageText' => $messageText, + 'mode' => $mode, + 'participantIDs' => $participantIDs, + 'title' => $title, + 'type' => $type, + 'user' => $user, + ], + ); // @phpstan-ignore-next-line argument.type $response = $this->raw->create(params: $params, requestOptions: $requestOptions); @@ -91,7 +118,7 @@ public function retrieve( string $chatID, ?int $maxParticipantCount = -1, RequestOptions|array|null $requestOptions = null, - ): \BeeperDesktop\Chats\Chat { + ): Chat { $params = Util::removeNulls( ['maxParticipantCount' => $maxParticipantCount] ); @@ -175,11 +202,11 @@ public function archive( * @param int $limit Set the maximum number of chats to retrieve. Valid range: 1-200, default is 50 * @param string $query Literal token search (non-semantic). Use single words users type (e.g., "dinner"). When multiple words provided, ALL must match. Case-insensitive. * @param Scope|value-of $scope search scope: 'titles' matches title + network; 'participants' matches participant names - * @param Type|value-of $type Specify the type of chats to retrieve: use "single" for direct messages, "group" for group chats, or "any" to get all types + * @param \BeeperDesktop\Chats\ChatSearchParams\Type|value-of<\BeeperDesktop\Chats\ChatSearchParams\Type> $type Specify the type of chats to retrieve: use "single" for direct messages, "group" for group chats, or "any" to get all types * @param bool|null $unreadOnly Set to true to only retrieve chats that have unread messages * @param RequestOpts|null $requestOptions * - * @return CursorSearch<\BeeperDesktop\Chats\Chat> + * @return CursorSearch * * @throws APIException */ @@ -194,7 +221,7 @@ public function search( int $limit = 50, ?string $query = null, Scope|string $scope = 'titles', - Type|string $type = 'any', + \BeeperDesktop\Chats\ChatSearchParams\Type|string $type = 'any', ?bool $unreadOnly = null, RequestOptions|array|null $requestOptions = null, ): CursorSearch { diff --git a/tests/Services/ChatsTest.php b/tests/Services/ChatsTest.php index 71d8111..6678d05 100644 --- a/tests/Services/ChatsTest.php +++ b/tests/Services/ChatsTest.php @@ -34,7 +34,7 @@ protected function setUp(): void #[Test] public function testCreate(): void { - $result = $this->client->chats->create(chat: ['accountID' => 'accountID']); + $result = $this->client->chats->create(accountID: 'accountID'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(ChatNewResponse::class, $result); @@ -44,21 +44,19 @@ public function testCreate(): void public function testCreateWithOptionalParams(): void { $result = $this->client->chats->create( - chat: [ - 'accountID' => 'accountID', - 'allowInvite' => true, - 'messageText' => 'messageText', - 'mode' => 'create', - 'participantIDs' => ['string'], - 'title' => 'title', - 'type' => 'single', - 'user' => [ - 'id' => 'id', - 'email' => 'email', - 'fullName' => 'fullName', - 'phoneNumber' => 'phoneNumber', - 'username' => 'username', - ], + accountID: 'accountID', + allowInvite: true, + messageText: 'messageText', + mode: 'create', + participantIDs: ['string'], + title: 'title', + type: 'single', + user: [ + 'id' => 'id', + 'email' => 'email', + 'fullName' => 'fullName', + 'phoneNumber' => 'phoneNumber', + 'username' => 'username', ], ); From 46cecae242cf2185a5d5379aa731150e2e662994 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Feb 2026 14:58:42 +0000 Subject: [PATCH 3/3] release: 0.1.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ src/Version.php | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1332969..3d2ac0b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.1" + ".": "0.1.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..25dbb52 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog + +## 0.1.0 (2026-02-20) + +Full Changelog: [v0.0.1...v0.1.0](https://github.com/beeper/desktop-api-php/compare/v0.0.1...v0.1.0) + +### Features + +* **api:** api update ([fe6b606](https://github.com/beeper/desktop-api-php/commit/fe6b606f1e40643b6f81a68bfbf467653d070a6a)) +* **api:** api update ([f813329](https://github.com/beeper/desktop-api-php/commit/f8133290552840e3723a0f67371a4481039c5ac6)) +* **api:** api update ([1c754b3](https://github.com/beeper/desktop-api-php/commit/1c754b319cf35db0357cd97d9713119b78f70fc5)) +* **api:** update via SDK Studio ([1c4d0e7](https://github.com/beeper/desktop-api-php/commit/1c4d0e7cb265c3bfcca18b886ec84d25eb7154d2)) +* **api:** update via SDK Studio ([e372296](https://github.com/beeper/desktop-api-php/commit/e372296e9885f6bb33819a22d29e92ac725395f1)) diff --git a/src/Version.php b/src/Version.php index fa38b72..10c344d 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace BeeperDesktop; // x-release-please-start-version -const VERSION = '0.0.1'; +const VERSION = '0.1.0'; // x-release-please-end