Fedihosting-Foundation / plemmy

A Python package for accessing the LemmyHttp API
Apache License 2.0
45 stars 15 forks source link

Fixes #14

Closed jheidecker closed 1 year ago

jheidecker commented 1 year ago

GetSiteResponse looks to prepare "all_languages" based on the "site" endpoint using the "Language" object. The language object is [code,id,name] which matches the published API, BUT GetSiteResponse is trying to use "discussion_languages" which is just a list of [id]s.

Attempting to enumerate anything from the site endpoint with GetSiteResponse illicits an error:

TypeError: plemmy.objects.Language() argument after ** must be a mapping, not int

I believe this is a typo or perhaps human error in the lemmy api docs, or transposing from those docs. This PR changes "discussion_languages" to "all languages," and (if it's required) adds "discussion_languages" to return a list of language id's from "site" in the same way GetCommunityResponse does from "community."

jheidecker commented 1 year ago

Continuing to implement and debug. GetPostResponse was enumerating moderators to a single CommunityModeratorView illiciting error:

TypeError: list indices must be integers or slices, not str

Changed this to return CommunityModeratorView for each moderator in moderators.

tjkessler commented 1 year ago

@jheidecker,

Nice finds! Probably errors on my part from the transposition 🥴 I'll go ahead and merge, new update will be 0.3.2!

Travis