Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.0.1"
".": "0.1.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -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
config_hash: b5ac0c1579dfe6257bcdb84cfd1002fc
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-4acef56b00be513f305543096fdd407e6947f0a5ad268ab2e627ff30b37a75db.yml
openapi_spec_hash: e876d796b6c25f18577f6be3944bf7d9
config_hash: 659111d4e28efa599b5f800619ed79c2
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
191 changes: 177 additions & 14 deletions src/Chats/ChatCreateParams.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Mode>,
* participantIDs?: list<string>|null,
* title?: string|null,
* type?: null|Type|value-of<Type>,
* user?: null|User|UserShape,
* }
*/
final class ChatCreateParams implements BaseModel
Expand All @@ -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<Mode>|null $mode
*/
#[Optional(enum: Mode::class)]
public ?string $mode;

/**
* Required when mode='create'. User IDs to include in the new chat.
*
* @var list<string>|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<Type>|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()
Expand All @@ -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<Mode>|null $mode
* @param list<string>|null $participantIDs
* @param Type|value-of<Type>|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> $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<string> $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> $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;
}
Expand Down
Loading
Loading