Asklemmy
A loosely moderated place to ask open-ended questions
Search asklemmy ๐
If your post meets the following criteria, it's welcome here!
- Open-ended question
- Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
- Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
- Not ad nauseam inducing: please make sure it is a question that would be new to most members
- An actual topic of discussion
Looking for support?
Looking for a community?
- Lemmyverse: community search
- sub.rehab: maps old subreddits to fediverse options, marks official as such
- [email protected]: a community for finding communities
~Icon~ ~by~ ~@Double_[email protected]~
nevermind, i actually did it now 4 minutes after complaining because i saw there's code examples here:
this works:
import { GetPost, GetPostResponse, LemmyHttp, Login } from "lemmy-js-client";
export interface API {
client: LemmyHttp;
auth: string;
}
export let alpha: API = {
client: new LemmyHttp("https://sh.itjust.works"),
auth: "",
};
let formAlpha: Login = {
username_or_email: "username",
password: "password",
};
export async function getPost(
api: API,
post_id: number
): Promise<GetPostResponse> {
let form: GetPost = {
id: post_id,
auth: api.auth,
};
return api.client.getPost(form);
}
getPost(alpha, 1).then((res) => {
console.log(res);
});
been playing with it for like 20 minutes and it seems like the documentation and the code are different, so i can't implement any of what they say i can, been trying to just find the answers in the code with no luck cuz apparently the repo is all typescript and there's no code in the main repo, idk where this client's source code is.
have u been able to do any requests w it?
https://join-lemmy.org/docs/en/contributors/04-api.html
Not sure about any info that is hidden to the default Lemmy-UI though
yeah there' is a lot of info there i found that is hidden on the UI but it's not enough to switch a post's url to another instance sadly. Seems there's no permlink or unique ID that is searchable, only a post id on the local server and a post id on the remote server but there's nothing like /c/community/permlink, it's all post/numbers and the numbers are different on each instance
here's an example response from the api when u get a post or comment: