-
-
Notifications
You must be signed in to change notification settings - Fork 454
add params id fork #269
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
add params id fork #269
Conversation
I want to use namespace in fork project api ,so I added params in it。 |
lib/Gitlab/Api/Projects.php
Outdated
@@ -498,9 +498,9 @@ public function removeLabel($project_id, $name) | |||
* @param int $project_id | |||
* @return mixed | |||
*/ | |||
public function fork($project_id) | |||
public function fork($project_id, array $params) |
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.
The options parameter should be optional
fork default value
lib/Gitlab/Api/Projects.php
Outdated
{ | ||
return $this->post('projects/'.$this->encodePath($project_id).'/fork'); | ||
return $this->post('projects/'.$this->encodePath($project_id).'/fork', $params); |
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.
Could you add $params
validation using OptionResolver
?
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.
I don't know how to use;
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.
Here is an example of how to use OptionResolver
for a post
request: https://github.com/m4tthumphrey/php-gitlab-api/blob/032b7cca7b376686522d00bcb404bc9167a6e0c4/lib/Gitlab/Api/RepositoryFiles.php#L35-L68.
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.
Is that OK?
So,can you merge my pull requests? |
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.
add params in fork action function.
lib/Gitlab/Api/Projects.php
Outdated
{ | ||
return $this->post('projects/'.$this->encodePath($project_id).'/fork'); | ||
return $this->post('projects/'.$this->encodePath($project_id).'/fork', $params); |
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.
Is that OK?
lib/Gitlab/Api/Projects.php
Outdated
{ | ||
return $this->post('projects/'.$this->encodePath($project_id).'/fork'); | ||
return $this->post($this->getProjectPath($project_id, 'fork'), $params); |
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.
Please, use the OptionResolver
to add input data validation.
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.
OK
use the OptionResolver
I have finished it. |
lib/Gitlab/Api/Projects.php
Outdated
* @return mixed | ||
*/ | ||
public function fork($project_id) | ||
public function fork($project_id, array $params = array()) |
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.
Could you use $parameters
for consistency with other methods in this library?
lib/Gitlab/Api/Projects.php
Outdated
{ | ||
return $this->post('projects/'.$this->encodePath($project_id).'/fork'); | ||
$resolver = $this->createOptionsResolver(); |
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.
You can use $this->createOptionsResolver()
here as this methods returns an OptionsResolver
preconfigured for pagination. Here a new OptionsResolver()
will do the job.
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.
It looks like you missed this one ;)
sorry,I didn't find it。 |
The |
use `$resolver = new OptionsResolver();`
Thank you! |
add params id fork