Comments (17)
https://join-lemmy.org/api/classes/LemmyHttp.html#getPost
@Arsen6331 the current main
of lemmy / lemmy-js-client has a lot of API changes that haven't been deployed yet.
from go-lemmy.
The conversion done for this library is only partially automated, so if the API changes this much, it's going to become very difficult to maintain very quickly. To solve that, I'm working on a completely automated converter right now that I will use to automatically generate bindings for the latest release once it's done (should be pretty soon).
from go-lemmy.
The bindings are now completely automatically generated for v0.16.7. Can you try them and see if it fixes your issue? @mrusme
The Login()
function has been renamed to ClientLogin()
,
You have to use Post()
, which will return GetPostResponse
, which will have the comments, because that's the way the current API does it.
from go-lemmy.
Sorry for the late response, it was new year and I didn't have much time. I'll try to figure out what's going on here and get back to you, thanks.
from go-lemmy.
Interestingly, it is sending post_id=458247
(I'm using post ID 458247 for testing) to the server, but it seems that's ignored for some reason.
from go-lemmy.
The way Lemmy's UI seems to do it is they use getPost()
and then check the comments
field that's returned, but the Rust and JS structs don't have a comments field, so I'm not sure how that gets returned.
from go-lemmy.
Maybe @dessalines might be able to help here? Would be cool to get this working, currently having a new Lemmy client in the works and this library saved my poor ass from having to implement all this on my own. :-)
Specifically, quote:
sending post_id=458247 (I'm using post ID 458247 for testing) to the server, but it seems that's ignored for some reason.
from go-lemmy.
join-lemmy.org/api/classes/LemmyHttp.html#getPost
@Arsen6331 the current
main
of lemmy / lemmy-js-client has a lot of API changes that haven't been deployed yet.
I looked at the LemmyHttp docs, and neither getPost
nor getPosts
appear to return comments.
from go-lemmy.
Ah my bad, that must be showing the RC unfortunately.
Here you go:
https://github.com/LemmyNet/lemmy-js-client/blob/0.16.4/src/interfaces/api/post.ts#L29
from go-lemmy.
Is there a quickfix that can be used up until then however?
from go-lemmy.
You can try adding a comments
field to the GetPostResponse
struct, but there are likely other issues you'll encounter.
from go-lemmy.
@Arsen6331 it seems that now types (e.g. ListingTypeSubscribe
) are a bit messed up:
cannot use types.NewOptional(types.ListingTypeSubscribed) (value of type types.Optional[string]) as type types.Optional[types.ListingType] in struct literal
from go-lemmy.
Ah, I forgot to use the type I created. Can you try now? It should be fixed.
from go-lemmy.
Are you sure Updated, checking.go.arsenm.dev/go-lemmy
is updating properly? I can see your commits here but I'm using the package as it was defined in its go mod.
from go-lemmy.
It seems the internal time.Time parsing doesn't work yet:
parsing time "\"2022-12-29T01:39:01.346720\"" as "\"2006-01-02T15:04:05Z07:00\"": cannot parse "\"" as "Z07:00"
That's what I'm doing:
resp, err := sys.client.Posts(context.Background(), types.GetPosts{
Type: types.NewOptional(types.ListingTypeSubscribed),
Sort: types.NewOptional(types.SortTypeNew),
Limit: types.NewOptional(int64(50)),
})
from go-lemmy.
Just fixed that, should be working now
from go-lemmy.
Awesome work! Can retrieve the correct comments now. 👍🏼 Very nice, thank you very much!
from go-lemmy.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-lemmy.