-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly implement the POST credentials method #348
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,4 +103,9 @@ public function listProjects(): \Generator | |
{ | ||
return $this->model(Project::class)->enumerate($this->api->getUserProjects(), ['id' => $this->id]); | ||
} | ||
|
||
public function listCredentials(): \Generator | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @return \Generator<mixed, \OpenStack\Identity\v3\Models\Credential> |
||
{ | ||
return $this->model(Credential::class)->enumerate($this->api->getUserCredentials(), ['userId' => $this->id]); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,6 +195,15 @@ public function userIdQuery(): array | |
]; | ||
} | ||
|
||
public function userIdQueryUnderscore(): array | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why creating new function? |
||
{ | ||
return [ | ||
'sentAs' => 'user_id', | ||
'location' => 'query', | ||
'description' => 'Filter by user ID', | ||
]; | ||
} | ||
|
||
public function domain(): array | ||
{ | ||
return [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -338,6 +338,16 @@ public function listCredentials(): \Generator | |
return $this->model(Models\Credential::class)->enumerate($this->api->getCredentials()); | ||
} | ||
|
||
/** | ||
* 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @return \Generator<mixed, \OpenStack\Identity\v3\Models\Credential> |
||
public function listUserCredentials(array $options): \Generator | ||
{ | ||
return $this->model(Models\Credential::class)->enumerate($this->api->getUserCredentials(), $options); | ||
} | ||
|
||
/** | ||
* Retrieves a credential object and populates its unique identifier object. This operation will not perform a GET | ||
* or HEAD request by default; you will need to call retrieve() if you want to pull in remote state from the API. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is not need to create a new definition there. We already have
getCredentials()
and can just reuse it by adding theuserId
parameter.