jira-api-restclient icon indicating copy to clipboard operation
jira-api-restclient copied to clipboard

The "$params" or "$options" method parameter name

Open aik099 opened this issue 1 year ago • 2 comments

Right now some methods of the Api class use the $params parameter (6 methods) and some use the $options parameter (2 methods) for specifying extra parameters for the upcoming Jira API call.

I think we need to use consistent naming because the parameter meanings for API calls are identical.

What do you prefer?

// cc: @chobie, @jpastoor, @glensc

aik099 avatar Dec 31 '24 15:12 aik099

examples!

for this one, params is correct:

 		return $this->api(self::REQUEST_PUT, sprintf('/rest/api/2/issue/%s', $issue_key), $params);

altho api method it's $data:

  • https://github.com/console-helpers/jira-api-restclient/blob/a8986ac2128ad7e92294bbf741328f65ae92cde8/src/Jira/Api.php#L762

glensc avatar Jan 01 '25 18:01 glensc

@glensc , what about other methods using $params and $options?

I'm on the fence here, because:

  • what usually is specified in $params goes into the json-encoded Request body part (according to the API docs) so they are parameters of the API call
  • the $options are optional stuff and indeed every API call implemented can work without specifying these

So they're options and params at the same time.

The $data variable name is from library conception times. Not sure what @chobie meant with this name. Probably an abstract name to represent a data, that goes into the request.

aik099 avatar Jan 01 '25 20:01 aik099