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

Missing documentation for Master.versions.filter #158

Open
JOJ0 opened this issue Oct 12, 2024 · 3 comments
Open

Missing documentation for Master.versions.filter #158

JOJ0 opened this issue Oct 12, 2024 · 3 comments

Comments

@JOJ0
Copy link
Contributor

JOJ0 commented Oct 12, 2024

I would like to add the filter possibility for Master versions to our docs. See below how it's done already concisely described by @AnssiAhola, which came up in a recent Discussions post.

Now while I'm at it, I want to investigate if there are maybe more objects that make use of the filter from the BasePaginatedResponse class...

Original Post

It's pretty hard to figure it out from the source code, but Master.versions is actually a PaginatedList under the hood which inherits BasePaginatedResponse so it has the filter() method and should call that specific api when invoked.

Example

master = client.master(1051980)
result = master.versions.filter(format="CD")
for release in result:
    print(release)

The filter() method supports all the parameters described in the API docs and can be passed in as kwargs

result = master.versions.filter(
    master_id=123,
    page=1,
    per_page=10,
    format="Vinyl",
    label="Scorpio Music",
    released=1992,
    country="Belgium",
    sort="released",
    sort_order="asc"
)

Hope that helps, Cheers!

Originally posted by @AnssiAhola in #155 (reply in thread)

@JOJ0
Copy link
Contributor Author

JOJ0 commented Oct 12, 2024

While investigating I played around with a graphical view of modules. This is the Master class. It didn't really help my investigation but it was fun to look at 😆

discogs_client models Master

@AnssiAhola
Copy link
Contributor

Now that would be neat for the docs page 😅 , but I'm guessing that is an separate tool that generated that graph?

@JOJ0
Copy link
Contributor Author

JOJ0 commented Nov 22, 2024

Hi @AnssiAhola yes this would indeed be neat but as you've guessed it's from a separate tool and if we include it, it would mean "manual" maintenance of keeping this pictures up to date:

This is the oneliner I used to generate it (on macOS zsh). The main tool that generates it is pyreverse: https://pylint.pycqa.org/en/latest/pyreverse.html

export CLASS=discogs_client.models.Master;  pyreverse -ASmy -c ${CLASS} discogs_client; dot -Tpng ${CLASS}.dot > ${CLASS}.png; open -a Preview ${CLASS}.png

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

No branches or pull requests

2 participants