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/.stats.yml b/.stats.yml index 8ec4701..004aab8 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 -config_hash: b5ac0c1579dfe6257bcdb84cfd1002fc +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-5a8ac7b545c48dc892e5c680303e305254921554dabee848e40a808659dbcf1e.yml +openapi_spec_hash: 0103975601aac1445d3a4ef418c5d17a +config_hash: aa49273410d42fb96c5515dbce1f182f diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..06de719 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,20 @@ +# Changelog + +## 0.1.0 (2026-03-03) + +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 ([e098615](https://github.com/beeper/desktop-api-php/commit/e0986159d91fbd76d8647de9e2f7e2f1aedb071f)) +* **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)) + + +### Chores + +* **internal:** codegen related update ([297da59](https://github.com/beeper/desktop-api-php/commit/297da598fb4ba18fec57a63e461e4316f3d6e641)) +* **internal:** upgrade phpunit ([958db57](https://github.com/beeper/desktop-api-php/commit/958db5719fcca4f33c8b9c4796e34b8a3c5a8d91)) diff --git a/README.md b/README.md index b5d91b8..e4e22ab 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,7 @@ Parameters with a default value must be set by name. use BeeperDesktop\Client; -$client = new Client( - accessToken: getenv('BEEPER_ACCESS_TOKEN') ?: 'My Access Token' -); +$client = new Client(); $page = $client->chats->search(includeMuted: true, limit: 3, type: 'single'); @@ -65,9 +63,7 @@ This library provides auto-paginating iterators with each list response, so you use BeeperDesktop\Client; -$client = new Client( - accessToken: getenv('BEEPER_ACCESS_TOKEN') ?: 'My Access Token' -); +$client = new Client(); $page = $client->messages->search( accountIDs: ['local-telegram_ba_QFrb5lrLPhO3OT5MFBeTWv0x4BI'], diff --git a/composer.lock b/composer.lock index 3f6c209..7a5e63d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5fc63f7c84d94b42416689723c547f69", + "content-hash": "ffa287ea8babf60e021f37e62c6c207a", "packages": [ { "name": "php-http/discovery", @@ -194,16 +194,16 @@ "packages-dev": [ { "name": "brianium/paratest", - "version": "v7.8.4", + "version": "v7.8.5", "source": { "type": "git", "url": "https://github.com/paratestphp/paratest.git", - "reference": "130a9bf0e269ee5f5b320108f794ad03e275cad4" + "reference": "9b324c8fc319cf9728b581c7a90e1c8f6361c5e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/130a9bf0e269ee5f5b320108f794ad03e275cad4", - "reference": "130a9bf0e269ee5f5b320108f794ad03e275cad4", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/9b324c8fc319cf9728b581c7a90e1c8f6361c5e5", + "reference": "9b324c8fc319cf9728b581c7a90e1c8f6361c5e5", "shasum": "" }, "require": { @@ -211,27 +211,27 @@ "ext-pcre": "*", "ext-reflection": "*", "ext-simplexml": "*", - "fidry/cpu-core-counter": "^1.2.0", + "fidry/cpu-core-counter": "^1.3.0", "jean85/pretty-package-versions": "^2.1.1", - "php": "~8.2.0 || ~8.3.0 || ~8.4.0", - "phpunit/php-code-coverage": "^11.0.10", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "phpunit/php-code-coverage": "^11.0.12", "phpunit/php-file-iterator": "^5.1.0", "phpunit/php-timer": "^7.0.1", - "phpunit/phpunit": "^11.5.24", + "phpunit/phpunit": "^11.5.46", "sebastian/environment": "^7.2.1", - "symfony/console": "^6.4.22 || ^7.3.0", - "symfony/process": "^6.4.20 || ^7.3.0" + "symfony/console": "^6.4.22 || ^7.3.4 || ^8.0.3", + "symfony/process": "^6.4.20 || ^7.3.4 || ^8.0.3" }, "require-dev": { "doctrine/coding-standard": "^12.0.0", "ext-pcov": "*", "ext-posix": "*", - "phpstan/phpstan": "^2.1.17", + "phpstan/phpstan": "^2.1.33", "phpstan/phpstan-deprecation-rules": "^2.0.3", - "phpstan/phpstan-phpunit": "^2.0.6", - "phpstan/phpstan-strict-rules": "^2.0.4", - "squizlabs/php_codesniffer": "^3.13.2", - "symfony/filesystem": "^6.4.13 || ^7.3.0" + "phpstan/phpstan-phpunit": "^2.0.11", + "phpstan/phpstan-strict-rules": "^2.0.7", + "squizlabs/php_codesniffer": "^3.13.5", + "symfony/filesystem": "^6.4.13 || ^7.3.2 || ^8.0.1" }, "bin": [ "bin/paratest", @@ -271,7 +271,7 @@ ], "support": { "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v7.8.4" + "source": "https://github.com/paratestphp/paratest/tree/v7.8.5" }, "funding": [ { @@ -283,7 +283,7 @@ "type": "paypal" } ], - "time": "2025-06-23T06:07:21+00:00" + "time": "2026-01-08T08:02:38+00:00" }, { "name": "clue/ndjson-react", @@ -1412,38 +1412,38 @@ }, { "name": "pestphp/pest", - "version": "v3.8.4", + "version": "v3.8.5", "source": { "type": "git", "url": "https://github.com/pestphp/pest.git", - "reference": "72cf695554420e21858cda831d5db193db102574" + "reference": "7796630eafcfd1c02660cecdde3bc6984fbf01f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pestphp/pest/zipball/72cf695554420e21858cda831d5db193db102574", - "reference": "72cf695554420e21858cda831d5db193db102574", + "url": "https://api.github.com/repos/pestphp/pest/zipball/7796630eafcfd1c02660cecdde3bc6984fbf01f4", + "reference": "7796630eafcfd1c02660cecdde3bc6984fbf01f4", "shasum": "" }, "require": { - "brianium/paratest": "^7.8.4", - "nunomaduro/collision": "^8.8.2", - "nunomaduro/termwind": "^2.3.1", + "brianium/paratest": "^7.8.5", + "nunomaduro/collision": "^8.8.3", + "nunomaduro/termwind": "^2.3.3", "pestphp/pest-plugin": "^3.0.0", "pestphp/pest-plugin-arch": "^3.1.1", "pestphp/pest-plugin-mutate": "^3.0.5", "php": "^8.2.0", - "phpunit/phpunit": "^11.5.33" + "phpunit/phpunit": "^11.5.50" }, "conflict": { "filp/whoops": "<2.16.0", - "phpunit/phpunit": ">11.5.33", + "phpunit/phpunit": ">11.5.50", "sebastian/exporter": "<6.0.0", "webmozart/assert": "<1.11.0" }, "require-dev": { "pestphp/pest-dev-tools": "^3.4.0", "pestphp/pest-plugin-type-coverage": "^3.6.1", - "symfony/process": "^7.3.0" + "symfony/process": "^7.4.4" }, "bin": [ "bin/pest" @@ -1508,7 +1508,7 @@ ], "support": { "issues": "https://github.com/pestphp/pest/issues", - "source": "https://github.com/pestphp/pest/tree/v3.8.4" + "source": "https://github.com/pestphp/pest/tree/v3.8.5" }, "funding": [ { @@ -1520,7 +1520,7 @@ "type": "github" } ], - "time": "2025-08-20T19:12:42+00:00" + "time": "2026-01-28T01:33:45+00:00" }, { "name": "pestphp/pest-plugin", @@ -2627,28 +2627,28 @@ }, { "name": "phpunit/php-file-iterator", - "version": "5.1.0", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" + "reference": "2f3a64888c814fc235386b7387dd5b5ed92ad903" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", - "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/2f3a64888c814fc235386b7387dd5b5ed92ad903", + "reference": "2f3a64888c814fc235386b7387dd5b5ed92ad903", "shasum": "" }, "require": { "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -2676,15 +2676,27 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.1" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-file-iterator", + "type": "tidelift" } ], - "time": "2024-08-27T05:02:59+00:00" + "time": "2026-02-02T13:52:54+00:00" }, { "name": "phpunit/php-invoker", @@ -2872,16 +2884,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.33", + "version": "11.5.50", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "5965e9ff57546cb9137c0ff6aa78cb7442b05cf6" + "reference": "fdfc727f0fcacfeb8fcb30c7e5da173125b58be3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5965e9ff57546cb9137c0ff6aa78cb7442b05cf6", - "reference": "5965e9ff57546cb9137c0ff6aa78cb7442b05cf6", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fdfc727f0fcacfeb8fcb30c7e5da173125b58be3", + "reference": "fdfc727f0fcacfeb8fcb30c7e5da173125b58be3", "shasum": "" }, "require": { @@ -2895,17 +2907,17 @@ "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=8.2", - "phpunit/php-code-coverage": "^11.0.10", + "phpunit/php-code-coverage": "^11.0.12", "phpunit/php-file-iterator": "^5.1.0", "phpunit/php-invoker": "^5.0.1", "phpunit/php-text-template": "^4.0.1", "phpunit/php-timer": "^7.0.1", "sebastian/cli-parser": "^3.0.2", "sebastian/code-unit": "^3.0.3", - "sebastian/comparator": "^6.3.2", + "sebastian/comparator": "^6.3.3", "sebastian/diff": "^6.0.2", "sebastian/environment": "^7.2.1", - "sebastian/exporter": "^6.3.0", + "sebastian/exporter": "^6.3.2", "sebastian/global-state": "^7.0.2", "sebastian/object-enumerator": "^6.0.1", "sebastian/type": "^5.1.3", @@ -2953,7 +2965,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.33" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.50" }, "funding": [ { @@ -2977,7 +2989,7 @@ "type": "tidelift" } ], - "time": "2025-08-16T05:19:02+00:00" + "time": "2026-01-27T05:59:18+00:00" }, { "name": "psr/container", @@ -3936,16 +3948,16 @@ }, { "name": "sebastian/comparator", - "version": "6.3.2", + "version": "6.3.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "85c77556683e6eee4323e4c5468641ca0237e2e8" + "reference": "2c95e1e86cb8dd41beb8d502057d1081ccc8eca9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/85c77556683e6eee4323e4c5468641ca0237e2e8", - "reference": "85c77556683e6eee4323e4c5468641ca0237e2e8", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2c95e1e86cb8dd41beb8d502057d1081ccc8eca9", + "reference": "2c95e1e86cb8dd41beb8d502057d1081ccc8eca9", "shasum": "" }, "require": { @@ -4004,7 +4016,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/6.3.2" + "source": "https://github.com/sebastianbergmann/comparator/tree/6.3.3" }, "funding": [ { @@ -4024,7 +4036,7 @@ "type": "tidelift" } ], - "time": "2025-08-10T08:07:46+00:00" + "time": "2026-01-24T09:26:40+00:00" }, { "name": "sebastian/complexity", @@ -6668,5 +6680,5 @@ "platform-overrides": { "php": "8.3" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.9.0" } 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/Core/Conversion.php b/src/Core/Conversion.php index 494ec69..b903d2f 100644 --- a/src/Core/Conversion.php +++ b/src/Core/Conversion.php @@ -170,6 +170,37 @@ private static function tryConvert(Converter|ConverterSource|string $target, mix return $value; + case 'DateTimeInterface': + case 'DateTimeImmutable': + if (is_string($value)) { + try { + ++$state->maybe; + + return new \DateTimeImmutable($value); + } catch (\Exception) { + --$state->maybe; + } + } + + ++$state->no; + + return $value; + + case 'DateTime': + if (is_string($value)) { + try { + ++$state->maybe; + + return new \DateTime($value); + } catch (\Exception) { + --$state->maybe; + } + } + + ++$state->no; + + return $value; + default: ++$state->no; 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 @@ - $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/ServiceContracts/MessagesContract.php b/src/ServiceContracts/MessagesContract.php index 886634d..e8c3a3e 100644 --- a/src/ServiceContracts/MessagesContract.php +++ b/src/ServiceContracts/MessagesContract.php @@ -11,7 +11,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; @@ -74,7 +73,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 @@ -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/BeeperDesktopClientRawService.php b/src/Services/BeeperDesktopClientRawService.php index e40a60d..ee0acfe 100644 --- a/src/Services/BeeperDesktopClientRawService.php +++ b/src/Services/BeeperDesktopClientRawService.php @@ -15,6 +15,8 @@ use BeeperDesktop\ServiceContracts\BeeperDesktopClientRawContract; /** + * Control the Beeper Desktop application. + * * @phpstan-import-type RequestOpts from \BeeperDesktop\RequestOptions */ final class BeeperDesktopClientRawService implements BeeperDesktopClientRawContract diff --git a/src/Services/BeeperDesktopClientService.php b/src/Services/BeeperDesktopClientService.php index 9f2272f..0d44a9a 100644 --- a/src/Services/BeeperDesktopClientService.php +++ b/src/Services/BeeperDesktopClientService.php @@ -13,6 +13,8 @@ use BeeperDesktop\ServiceContracts\BeeperDesktopClientContract; /** + * Control the Beeper Desktop application. + * * @phpstan-import-type RequestOpts from \BeeperDesktop\RequestOptions */ final class BeeperDesktopClientService implements BeeperDesktopClientContract 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/src/Services/InfoRawService.php b/src/Services/InfoRawService.php index 853a5b8..9ed5030 100644 --- a/src/Services/InfoRawService.php +++ b/src/Services/InfoRawService.php @@ -12,6 +12,8 @@ use BeeperDesktop\ServiceContracts\InfoRawContract; /** + * Control the Beeper Desktop application. + * * @phpstan-import-type RequestOpts from \BeeperDesktop\RequestOptions */ final class InfoRawService implements InfoRawContract diff --git a/src/Services/InfoService.php b/src/Services/InfoService.php index c38342e..20ccaf2 100644 --- a/src/Services/InfoService.php +++ b/src/Services/InfoService.php @@ -11,6 +11,8 @@ use BeeperDesktop\ServiceContracts\InfoContract; /** + * Control the Beeper Desktop application. + * * @phpstan-import-type RequestOpts from \BeeperDesktop\RequestOptions */ final class InfoService implements InfoContract 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( 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 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', ], );