Fix response types of some timeline methods and add `unlike`
This commit is contained in:
parent
2148e71020
commit
81fbbf802e
|
@ -0,0 +1,6 @@
|
||||||
|
import { client, login } from "./mod.ts";
|
||||||
|
|
||||||
|
await login();
|
||||||
|
|
||||||
|
const a = await client.timeline.retrieveFeed();
|
||||||
|
console.log(a);
|
|
@ -32,7 +32,7 @@ export class Timeline extends MethodBase {
|
||||||
*
|
*
|
||||||
* @param post The ID or instance of the post to be deleted.
|
* @param post The ID or instance of the post to be deleted.
|
||||||
*/
|
*/
|
||||||
delete(post: string | Post): Promise<Post> {
|
delete(post: string | Post): Promise<boolean> {
|
||||||
return this.client.invokeRequest(
|
return this.client.invokeRequest(
|
||||||
new Request("timeline.delete", {
|
new Request("timeline.delete", {
|
||||||
post: typeof post === "string" ? post : post.id,
|
post: typeof post === "string" ? post : post.id,
|
||||||
|
@ -124,7 +124,7 @@ export class Timeline extends MethodBase {
|
||||||
*
|
*
|
||||||
* @param post The ID or instance of the post to like.
|
* @param post The ID or instance of the post to like.
|
||||||
*/
|
*/
|
||||||
like(post: string | Post): Promise<Post> {
|
like(post: string | Post): Promise<boolean> {
|
||||||
return this.client.invokeRequest(
|
return this.client.invokeRequest(
|
||||||
new Request("timeline.like", {
|
new Request("timeline.like", {
|
||||||
post: typeof post === "string" ? post : post.id,
|
post: typeof post === "string" ? post : post.id,
|
||||||
|
@ -133,6 +133,20 @@ export class Timeline extends MethodBase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Likes an existing post on the timeline.
|
||||||
|
*
|
||||||
|
* @param post The ID or instance of the post to like.
|
||||||
|
*/
|
||||||
|
unlike(post: string | Post): Promise<boolean> {
|
||||||
|
return this.client.invokeRequest(
|
||||||
|
new Request("timeline.unlike", {
|
||||||
|
post: typeof post === "string" ? post : post.id,
|
||||||
|
}),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of posts from the users timeline.
|
* Returns an array of posts from the users timeline.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue