From 443842591fce682f63311455e16f52130046c69e Mon Sep 17 00:00:00 2001 From: PhaxeNor Date: Sat, 30 Aug 2025 18:34:16 +0200 Subject: [PATCH 1/2] Fixed Application Role Connection endpoints * Added applicationId paramter and binding --- src/Rest/ApplicationRoleConnectionMetadata.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Rest/ApplicationRoleConnectionMetadata.php b/src/Rest/ApplicationRoleConnectionMetadata.php index af904a1..e595462 100644 --- a/src/Rest/ApplicationRoleConnectionMetadata.php +++ b/src/Rest/ApplicationRoleConnectionMetadata.php @@ -18,11 +18,14 @@ class ApplicationRoleConnectionMetadata extends HttpResource * * @return PromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationRoleConnectionMetadata> */ - public function getRecords(): PromiseInterface + public function getRecords(string $applicationId): PromiseInterface { - return $this->mapPromise( + return $this->mapArrayPromise( $this->http->get( - Endpoint::APPLICATION_ROLE_CONNECTION_METADATA, + Endpoint::bind( + Endpoint::APPLICATION_ROLE_CONNECTION_METADATA, + $applicationId + ) ), PartsApplicationRoleConnectionMetadata::class, ); @@ -33,11 +36,14 @@ public function getRecords(): PromiseInterface * * @return PromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationRoleConnectionMetadata> */ - public function updateRecords(array $params): PromiseInterface + public function updateRecords(string $applicationId, array $params): PromiseInterface { - return $this->mapPromise( + return $this->mapArrayPromise( $this->http->put( - Endpoint::APPLICATION_ROLE_CONNECTION_METADATA, + Endpoint::bind( + Endpoint::APPLICATION_ROLE_CONNECTION_METADATA, + $applicationId + ), $params, ), PartsApplicationRoleConnectionMetadata::class, From 9d37b62b7fa49b53d2e8ae51c0ff07a1760e1673 Mon Sep 17 00:00:00 2001 From: PhaxeNor Date: Sat, 30 Aug 2025 18:38:28 +0200 Subject: [PATCH 2/2] Fixed User Role Connection endpoints * Added required applicationId paramater and set bind * Changed metadata type to optional object (as noted in Discord docs) --- src/Parts/ApplicationRoleConnection.php | 2 +- src/Rest/User.php | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Parts/ApplicationRoleConnection.php b/src/Parts/ApplicationRoleConnection.php index 9eab9ee..c4b25be 100644 --- a/src/Parts/ApplicationRoleConnection.php +++ b/src/Parts/ApplicationRoleConnection.php @@ -8,5 +8,5 @@ class ApplicationRoleConnection { public ?string $platform_name; public ?string $platform_username; - public ApplicationRoleConnectionMetadata $metadata; + public ?object $metadata; } diff --git a/src/Rest/User.php b/src/Rest/User.php index 332e2c0..5f1ab08 100644 --- a/src/Rest/User.php +++ b/src/Rest/User.php @@ -189,11 +189,14 @@ public function getCurrentUserConnections(): PromiseInterface * * @return PromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationRoleConnection> */ - public function getCurrentUserApplicationRoleConnection(): PromiseInterface + public function getCurrentUserApplicationRoleConnection(string $applicationId): PromiseInterface { return $this->mapPromise( $this->http->get( - Endpoint::USER_CURRENT_APPLICATION_ROLE_CONNECTION, + Endpoint::bind( + Endpoint::USER_CURRENT_APPLICATION_ROLE_CONNECTION, + $applicationId + ), ), ApplicationRoleConnection::class, ); @@ -204,11 +207,14 @@ public function getCurrentUserApplicationRoleConnection(): PromiseInterface * * @return PromiseInterface<\Ragnarok\Fenrir\Parts\ApplicationRoleConnection> */ - public function updateCurrentUserApplicationRoleConnection(array $params): PromiseInterface + public function updateCurrentUserApplicationRoleConnection(string $applicationId, array $params): PromiseInterface { return $this->mapPromise( $this->http->put( - Endpoint::USER_CURRENT_APPLICATION_ROLE_CONNECTION, + Endpoint::bind( + Endpoint::USER_CURRENT_APPLICATION_ROLE_CONNECTION, + $applicationId + ), $params ), ApplicationRoleConnection::class,