Giter Club home page Giter Club logo

Comments (5)

schwern avatar schwern commented on June 8, 2024

If you're referring to the List issues for a repository part of the API, it works for me.™

$ perl -wle 'use Pithub; $i = Pithub->new->issues->list( user => "gr2m", repo => "milestones", params => { milestone => "02 App & Plugin Templates" } );  print $i->first->{milestone}{title}'
02 App & Plugin Templates

Could you provide code demonstrating the problem?

from pithub.

bakoontz avatar bakoontz commented on June 8, 2024

Here's an example (changing the milestone parameter to the string doesn't produce any results):

#! /usr/bin/perl
use strict;
use Pithub;

my $i = Pithub::Issues->new(auto_pagination => 1);
my $result = $i->list(
    user => 'wikkawik',
    repo => 'WikkaWiki',
    params => {
        milestone => "1.3.6",
        #milestone => 21,
        state => "closed",
        sort => "number",
        direction => "asc",
    }
);

while(my $row = $result->next) {
    print "$row->{'number'}:$row->{'title'}\n"
}

from pithub.

schwern avatar schwern commented on June 8, 2024

It looks like the Github API is doing a terrible job on this. I get inconsistent results, the milestone string works for some repositories, for most it doesn't. Sometimes it works for milestones with no open issues, sometimes it doesn't.

Pithub is a thin wrapper around the Github API. Bugs in the API should be fixed by Github. I'd recommend you contact them about this and get back to us when you get a response.

from pithub.

bakoontz avatar bakoontz commented on June 8, 2024

I seem to be in the wrong about this. It's clear that v3 of the github API does not support searching for milestones by milestone title, and that one needs to synthesize a mapping between milestone number and title in order to accomplish a search by title. This is the response I received from github support:

Thanks for a detailed description.

First, you're right -- the milestone parameter should be a string *, a number (integer), or string none. May I ask why you're passing in a string value that is not * or none?

Just to clarify -- both of those API calls you mentioned are succeeding, you're getting back a 200 OK response. When you pass in "1.3.6" as the milestone, that's interpreted as number 1, and when you pass in "02 App & Plugin Templates", that's interpreted as number 2. So, your queries are interpreted as ?milestone=1 and ?milestone=2. In the first case, there are no issues associated with milestone 1 which have been closed, so you get an empty array. In the second case, there are some issues associated with milestone 2 which have been closed, so you get some items back.

Does this explain the behavior you observed? Again, my suggestion would be to use milestone numbers to filter issues by milestone, and not milestone titles. You can get the number of a milestone by listing milestones for the repository:

from pithub.

schwern avatar schwern commented on June 8, 2024

Re-reading the API documentation, it is quite clear. I could have sworn it wasn't and thought maybe they recently changed it, but I checked the Wayback Machine and it hasn't. Also the Pithub::Issues documentation already has it correct. Reading comprehension fail all around!

Interpreting "1.3.6" as "1" is heroic to an absurd and confusing level. I would suggest to them they make it a validation error instead. I would also suggest they allow milestone names since, unlike issues, their web site refers to milestones by name and there's no API call to look up a milestone by name.

I'm going to close this out. Feel free to reopen if you feel it's not done, or open another issue if you find a related problem.

from pithub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.