Skip to content
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

[9.18] Implemented with_labels_details parameter #449

Closed
wants to merge 1 commit into from
Closed

[9.18] Implemented with_labels_details parameter #449

wants to merge 1 commit into from

Conversation

rickkuilman
Copy link

I've implemented the with_labels_details parameter on the issues resource according to the GitLab.com Issues API docs.

It adds a more detailed version of the labels attribute like this:

// Retrieve all issue
$this->gitLabManager->issues()->all(1);

/**
 *  "labels" => array:1 [▼
 *      0 => "Bug"
 *      1 => "Approval"
 *  ]
 */

// Retrieve all issues, with more detailed version of the labels attribute
$this->gitLabManager->issues()->all(1, [
    'with_labels_details' => true,
]);

/**
 *  "labels" => array:2 [▼
 *    0 => array:5 [▼
 *      "id" => 3266
 *      "name" => "Bug"
 *      "color" => "#CC0033"
 *      "description" => "It's bug, not a feature"
 *      "text_color" => "#FFFFFF"
 *    ],
 *    1 => array:5 [▼
 *      "id" => 3280
 *      "name" => "Approval"
 *      "color" => "#35824F"
 *      "description" => "Ready for approval"
 *      "text_color" => "#FFFFFF"
 *    ]
 *  ]
 */

Happy #hacktoberfest everybody!

Copy link
Member

@m1guelpf m1guelpf left a comment

Choose a reason for hiding this comment

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

Can you update the tests?

@GrahamCampbell
Copy link
Member

Ping @rickkuilman. Do you plan on completing this PR please?

@glensc
Copy link
Contributor

glensc commented May 1, 2020

I'm curious how the boolean values should be validated. I've seen different patterns across this library, nothing sticks.

  1. no validation at all:
    $resolver->setDefined('with_labels_details')
  2. input boolean, output boolean like here:
       $resolver->setDefined('with_labels_details')
          ->setAllowedValues('with_labels_details', [true, false]);
  3. input boolean, output string:
       $booleanNormalizer = function (Options $resolver, $value) {
          return $value ? 'true' : 'false';
       };
       $resolver->setDefined('first_parent')
          ->setAllowedTypes('first_parent', 'bool')
          ->setNormalizer('first_parent', $booleanNormalizer);

@GrahamCampbell GrahamCampbell changed the base branch from master to 9.18 July 3, 2020 09:16
@GrahamCampbell GrahamCampbell changed the title Implemented with_labels_details parameter [9.18] Implemented with_labels_details parameter Jul 3, 2020
@GrahamCampbell
Copy link
Member

Thanks for starting work on this @rickkuilman. Are you able to finish this PR? 🚀

@GrahamCampbell GrahamCampbell self-assigned this Jul 3, 2020
@GrahamCampbell
Copy link
Member

input boolean, output string

@glensc This is the correct one. The rest of the code is meant to also look like that.

@GrahamCampbell
Copy link
Member

This has now been implemented on 9.18. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants