Correctly implement the POST credentials method#348
Correctly implement the POST credentials method#348svenwiltink wants to merge 2 commits intophp-opencloud:masterfrom
Conversation
74352e5 to
c51346d
Compare
https://docs.openstack.org/api-ref/identity/v3/index.html?expanded=authenticating-with-an-application-credential-detail,create-credential-detail#credentials specifies that the credentials endpoint expects a credential object and returns one. This patch ensures the data is properly encoded and decoded.
k0ka
left a comment
There was a problem hiding this comment.
Also we will need integration test to check if this parameter really works in OpenStack API.
| return $this->model(Project::class)->enumerate($this->api->getUserProjects(), ['id' => $this->id]); | ||
| } | ||
|
|
||
| public function listCredentials(): \Generator |
There was a problem hiding this comment.
@return \Generator<mixed, \OpenStack\Identity\v3\Models\Credential>
| * Returns a generator which will yield a collection of credential objects. The elements which generators yield can | ||
| * be accessed using a foreach loop. Often the API will not return the full state of the resource in collections; | ||
| * you will need to use retrieve() to pull in the full state of the remote resource from the API. | ||
| */ |
There was a problem hiding this comment.
@return \Generator<mixed, \OpenStack\Identity\v3\Models\Credential>
| ]; | ||
| } | ||
|
|
||
| public function userIdQueryUnderscore(): array |
There was a problem hiding this comment.
Why creating new function?
As far as I see https://docs.openstack.org/api-ref/identity/v3/#credentials
POST /v3/credentials and GET /v3/credentials are using the same parameter type user_id.
| ]; | ||
| } | ||
|
|
||
| public function getUserCredentials(): array |
There was a problem hiding this comment.
There is not need to create a new definition there. We already have getCredentials() and can just reuse it by adding the userId parameter.
|
Superseded by #433 |
https://docs.openstack.org/api-ref/identity/v3/index.html?expanded=authenticating-with-an-application-credential-detail,create-credential-detail#credentials
specifies that the credentials endpoint expects a credential object and returns one. This patch ensures the data is properly encoded and decoded.