fortrabbit / interview-task-php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Packagist missing some parameters

nerdial opened this issue · comments

Hi,
So i started working on the task, i realized that in the following api there is not much data for example : dependents, updated field, so i can sort based on these fields. i am guessing i should call each package api separately which is not performant. since the default limit is 50 so it will call 50 times an api as said not performant at all. if there is hidden gem that i am missing please let me know. but i could not find enough data,
what am i missing in the api ?
https://packagist.org/search.json?type=craft-plugin

another question is :
I believe packagist does not support Sort functionality so i am expected to implement on my own after getting final result. I checked the documentation i think there is no sort functionality.
So i should implement two kinds of sort which are :
orderBy => as suggested it can be downloads, favers, dependents, updated, since i dont have access to dependents and updated i can not sort them.
order => i am assuming this order should sort the result by the name of the package
here is another question based on the description of the task there should be 2 orders (eg :name, downloads) simultaneously applied to the final result which makes the output unordered. do you expect me to implement this as well ?

sorry there is a lot of questions here but i need to ask to finalize the task.

i am guessing i should call each package api separately

that's the only way I found

which is not performant.

that's part of the challenge

checked the documentation i think there is no sort functionality.

that's part of the challenge

order => i am assuming this order should sort the result by the name of the package

No. Please have a look at the (command options)[https://github.com/fortrabbit/interview-task-php#command-options] again


here is another question based on the description of the task there should be 2 orders (eg :name, downloads)

Sorting is expected on a single field only: downloads OR favers OR dependents ...


sorry there is a lot of questions here but i need to ask to finalize the task.

No worries! Better ask for clarification instead of doing the wrong thing.

Good luck! We hope you enjoy the task.

Thanks for the update. I fixed the above issues. though i have 2 other issues. here are :

  1. What do you mean by field "updated" ? where can i find this field ? "public DateTime $updated"
  2. And How can i get the most recent branch ? what api gives me such information ? "public string $version"

Other than these i am done with the task.
@ostark

What do you mean by field "updated" ? where can i find this field ? "public DateTime $updated"

There is a time field in the API response. Take the most recent one and map it to the updated property.

And How can i get the most recent branch ? what api gives me such information ? "public string $version"

The API call for a single package provides data about different releases - watch out for the versions key. We are interested in the first child, that's the most recent one. There is a field called version, which contains strings like dev-master or 2.0.0.