Giter Site home page Giter Site logo

Comments (17)

dessalines avatar dessalines commented on July 20, 2024 1

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.

Elara6331 avatar Elara6331 commented on July 20, 2024 1

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.

Elara6331 avatar Elara6331 commented on July 20, 2024 1

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.

Elara6331 avatar Elara6331 commented on July 20, 2024

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.

Elara6331 avatar Elara6331 commented on July 20, 2024

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.

Elara6331 avatar Elara6331 commented on July 20, 2024

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.

mrusme avatar mrusme commented on July 20, 2024

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.

Elara6331 avatar Elara6331 commented on July 20, 2024

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.

image

from go-lemmy.

dessalines avatar dessalines commented on July 20, 2024

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

LemmyNet/joinlemmy-site#123

from go-lemmy.

mrusme avatar mrusme commented on July 20, 2024

Is there a quickfix that can be used up until then however?

from go-lemmy.

Elara6331 avatar Elara6331 commented on July 20, 2024

You can try adding a comments field to the GetPostResponse struct, but there are likely other issues you'll encounter.

from go-lemmy.

mrusme avatar mrusme commented on July 20, 2024

@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.

Elara6331 avatar Elara6331 commented on July 20, 2024

Ah, I forgot to use the type I created. Can you try now? It should be fixed.

from go-lemmy.

mrusme avatar mrusme commented on July 20, 2024

Are you sure 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. Updated, checking.

from go-lemmy.

mrusme avatar mrusme commented on July 20, 2024

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.

Elara6331 avatar Elara6331 commented on July 20, 2024

Just fixed that, should be working now

from go-lemmy.

mrusme avatar mrusme commented on July 20, 2024

Awesome work! Can retrieve the correct comments now. 👍🏼 Very nice, thank you very much!

from go-lemmy.

Related Issues (2)

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.