Skip to content
Merged
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 src/Parts/ApplicationRoleConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ class ApplicationRoleConnection
{
public ?string $platform_name;
public ?string $platform_username;
public ApplicationRoleConnectionMetadata $metadata;
public ?object $metadata;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metadata is empty with ApplicationRoleConnectionMetadata because the response from the API that is for the user isn't of that format.

It returns an object with the metadata key names and their values.

String=>String|Int

The other method getRecords() does use ApplicationRoleConnectionMetadata but not this one.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix the mapping in a later release

}
18 changes: 12 additions & 6 deletions src/Rest/ApplicationRoleConnectionMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand All @@ -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,
Expand Down
14 changes: 10 additions & 4 deletions src/Rest/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand All @@ -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,
Expand Down