Interface: MediaApi
Single media reads and actions.
Methods
archive()
archive(mediaId): Promise<void>;Hides one of the account's posts from the profile, keeping it in the archive.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
Returns
Promise<void>
comment()
comment(
mediaId,
text,
options?
): Promise<{
[key: string]: unknown;
content_type?: string;
created_at?: number;
pk?: string;
status?: string;
text?: string;
user?: {
[key: string]: unknown;
biography?: string;
external_url?: string | null;
follower_count?: number | null;
following_count?: number | null;
full_name?: string;
is_private?: boolean;
is_verified?: boolean;
media_count?: number | null;
pk?: string;
profile_pic_url?: string | null;
username?: string;
};
}>;Comments on a post, or replies to a comment.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
text | string |
options? | CommentOptions |
Returns
Promise<{ [key: string]: unknown; content_type?: string; created_at?: number; pk?: string; status?: string; text?: string; user?: { [key: string]: unknown; biography?: string; external_url?: string | null; follower_count?: number | null; following_count?: number | null; full_name?: string; is_private?: boolean; is_verified?: boolean; media_count?: number | null; pk?: string; profile_pic_url?: string | null; username?: string; }; }>
comments()
comments(mediaId, options?): Promise<Page<{
[key: string]: unknown;
content_type?: string;
created_at?: number;
pk?: string;
status?: string;
text?: string;
user?: {
[key: string]: unknown;
biography?: string;
external_url?: string | null;
follower_count?: number | null;
following_count?: number | null;
full_name?: string;
is_private?: boolean;
is_verified?: boolean;
media_count?: number | null;
pk?: string;
profile_pic_url?: string | null;
username?: string;
};
}>>;One page of the comments on a post.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
options? | CommentListOptions |
Returns
Promise<Page<{ [key: string]: unknown; content_type?: string; created_at?: number; pk?: string; status?: string; text?: string; user?: { [key: string]: unknown; biography?: string; external_url?: string | null; follower_count?: number | null; following_count?: number | null; full_name?: string; is_private?: boolean; is_verified?: boolean; media_count?: number | null; pk?: string; profile_pic_url?: string | null; username?: string; }; }>>
delete()
delete(mediaId, mediaType?): Promise<void>;Deletes one of the account's own posts.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
mediaType? | "PHOTO" | "VIDEO" | "CAROUSEL" | "STORY" |
Returns
Promise<void>
deleteComment()
deleteComment(mediaId, commentId): Promise<void>;Deletes a comment.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
commentId | string |
Returns
Promise<void>
deleteComments()
deleteComments(mediaId, commentIds): Promise<void>;Deletes several comments on a post at once.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
commentIds | readonly string[] |
Returns
Promise<void>
edit()
edit(mediaId, options): Promise<{
[key: string]: unknown;
caption?: | {
[key: string]: unknown;
text?: string;
}
| null;
code?: string;
comment_count?: number | null;
id?: string;
image_versions2?: {
[key: string]: unknown;
candidates?: object[];
};
like_count?: number | null;
media_type?: number;
pk?: string;
taken_at?: number;
user?: {
[key: string]: unknown;
biography?: string;
external_url?: string | null;
follower_count?: number | null;
following_count?: number | null;
full_name?: string;
is_private?: boolean;
is_verified?: boolean;
media_count?: number | null;
pk?: string;
profile_pic_url?: string | null;
username?: string;
};
usertags?: | {
[key: string]: unknown;
in?: object[];
}
| null;
video_versions?: object[] | null;
}>;Changes the caption or the tagged people of one of the account's posts.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
options | EditMediaOptions |
Returns
Promise<{ [key: string]: unknown; caption?: | { [key: string]: unknown; text?: string; } | null; code?: string; comment_count?: number | null; id?: string; image_versions2?: { [key: string]: unknown; candidates?: object[]; }; like_count?: number | null; media_type?: number; pk?: string; taken_at?: number; user?: { [key: string]: unknown; biography?: string; external_url?: string | null; follower_count?: number | null; following_count?: number | null; full_name?: string; is_private?: boolean; is_verified?: boolean; media_count?: number | null; pk?: string; profile_pic_url?: string | null; username?: string; }; usertags?: | { [key: string]: unknown; in?: object[]; } | null; video_versions?: object[] | null; }>
info()
info(mediaId): Promise<{
[key: string]: unknown;
caption?: | {
[key: string]: unknown;
text?: string;
}
| null;
code?: string;
comment_count?: number | null;
id?: string;
image_versions2?: {
[key: string]: unknown;
candidates?: object[];
};
like_count?: number | null;
media_type?: number;
pk?: string;
taken_at?: number;
user?: {
[key: string]: unknown;
biography?: string;
external_url?: string | null;
follower_count?: number | null;
following_count?: number | null;
full_name?: string;
is_private?: boolean;
is_verified?: boolean;
media_count?: number | null;
pk?: string;
profile_pic_url?: string | null;
username?: string;
};
usertags?: | {
[key: string]: unknown;
in?: object[];
}
| null;
video_versions?: object[] | null;
}>;A post with its caption, counts and author.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
Returns
Promise<{ [key: string]: unknown; caption?: | { [key: string]: unknown; text?: string; } | null; code?: string; comment_count?: number | null; id?: string; image_versions2?: { [key: string]: unknown; candidates?: object[]; }; like_count?: number | null; media_type?: number; pk?: string; taken_at?: number; user?: { [key: string]: unknown; biography?: string; external_url?: string | null; follower_count?: number | null; following_count?: number | null; full_name?: string; is_private?: boolean; is_verified?: boolean; media_count?: number | null; pk?: string; profile_pic_url?: string | null; username?: string; }; usertags?: | { [key: string]: unknown; in?: object[]; } | null; video_versions?: object[] | null; }>
like()
like(mediaId): Promise<void>;Likes a post.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
Returns
Promise<void>
likeComment()
likeComment(commentId): Promise<void>;Likes a comment.
Parameters
| Parameter | Type |
|---|---|
commentId | string |
Returns
Promise<void>
likers()
likers(mediaId): Promise<object[]>;The users who liked a post.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
Returns
Promise<object[]>
paginateComments()
paginateComments(mediaId): AsyncGenerator<{
[key: string]: unknown;
content_type?: string;
created_at?: number;
pk?: string;
status?: string;
text?: string;
user?: {
[key: string]: unknown;
biography?: string;
external_url?: string | null;
follower_count?: number | null;
following_count?: number | null;
full_name?: string;
is_private?: boolean;
is_verified?: boolean;
media_count?: number | null;
pk?: string;
profile_pic_url?: string | null;
username?: string;
};
}>;Walks the comments on a post, one at a time across pages.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
Returns
AsyncGenerator<{ [key: string]: unknown; content_type?: string; created_at?: number; pk?: string; status?: string; text?: string; user?: { [key: string]: unknown; biography?: string; external_url?: string | null; follower_count?: number | null; following_count?: number | null; full_name?: string; is_private?: boolean; is_verified?: boolean; media_count?: number | null; pk?: string; profile_pic_url?: string | null; username?: string; }; }>
paginateReplies()
paginateReplies(mediaId, commentId): AsyncGenerator<{
[key: string]: unknown;
content_type?: string;
created_at?: number;
pk?: string;
status?: string;
text?: string;
user?: {
[key: string]: unknown;
biography?: string;
external_url?: string | null;
follower_count?: number | null;
following_count?: number | null;
full_name?: string;
is_private?: boolean;
is_verified?: boolean;
media_count?: number | null;
pk?: string;
profile_pic_url?: string | null;
username?: string;
};
}>;Walks the replies to a comment, one at a time across pages.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
commentId | string |
Returns
AsyncGenerator<{ [key: string]: unknown; content_type?: string; created_at?: number; pk?: string; status?: string; text?: string; user?: { [key: string]: unknown; biography?: string; external_url?: string | null; follower_count?: number | null; following_count?: number | null; full_name?: string; is_private?: boolean; is_verified?: boolean; media_count?: number | null; pk?: string; profile_pic_url?: string | null; username?: string; }; }>
paginateSaved()
paginateSaved(): AsyncGenerator<{
[key: string]: unknown;
caption?: | {
[key: string]: unknown;
text?: string;
}
| null;
code?: string;
comment_count?: number | null;
id?: string;
image_versions2?: {
[key: string]: unknown;
candidates?: object[];
};
like_count?: number | null;
media_type?: number;
pk?: string;
taken_at?: number;
user?: {
[key: string]: unknown;
biography?: string;
external_url?: string | null;
follower_count?: number | null;
following_count?: number | null;
full_name?: string;
is_private?: boolean;
is_verified?: boolean;
media_count?: number | null;
pk?: string;
profile_pic_url?: string | null;
username?: string;
};
usertags?: | {
[key: string]: unknown;
in?: object[];
}
| null;
video_versions?: object[] | null;
}>;Walks the saved posts, one at a time across pages.
Returns
AsyncGenerator<{ [key: string]: unknown; caption?: | { [key: string]: unknown; text?: string; } | null; code?: string; comment_count?: number | null; id?: string; image_versions2?: { [key: string]: unknown; candidates?: object[]; }; like_count?: number | null; media_type?: number; pk?: string; taken_at?: number; user?: { [key: string]: unknown; biography?: string; external_url?: string | null; follower_count?: number | null; following_count?: number | null; full_name?: string; is_private?: boolean; is_verified?: boolean; media_count?: number | null; pk?: string; profile_pic_url?: string | null; username?: string; }; usertags?: | { [key: string]: unknown; in?: object[]; } | null; video_versions?: object[] | null; }>
pin()
pin(mediaId): Promise<void>;Pins one of the account's posts to the top of the profile grid.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
Returns
Promise<void>
pinComment()
pinComment(mediaId, commentId): Promise<void>;Pins a comment to the top of one of the account's posts.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
commentId | string |
Returns
Promise<void>
replies()
replies(
mediaId,
commentId,
options?
): Promise<Page<{
[key: string]: unknown;
content_type?: string;
created_at?: number;
pk?: string;
status?: string;
text?: string;
user?: {
[key: string]: unknown;
biography?: string;
external_url?: string | null;
follower_count?: number | null;
following_count?: number | null;
full_name?: string;
is_private?: boolean;
is_verified?: boolean;
media_count?: number | null;
pk?: string;
profile_pic_url?: string | null;
username?: string;
};
}>>;One page of the replies to a comment.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
commentId | string |
options? | ReplyListOptions |
Returns
Promise<Page<{ [key: string]: unknown; content_type?: string; created_at?: number; pk?: string; status?: string; text?: string; user?: { [key: string]: unknown; biography?: string; external_url?: string | null; follower_count?: number | null; following_count?: number | null; full_name?: string; is_private?: boolean; is_verified?: boolean; media_count?: number | null; pk?: string; profile_pic_url?: string | null; username?: string; }; }>>
save()
save(mediaId, options?): Promise<void>;Saves a post, to the general saved list or to one collection.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
options? | SaveOptions |
Returns
Promise<void>
saved()
saved(options?): Promise<Page<{
[key: string]: unknown;
caption?: | {
[key: string]: unknown;
text?: string;
}
| null;
code?: string;
comment_count?: number | null;
id?: string;
image_versions2?: {
[key: string]: unknown;
candidates?: object[];
};
like_count?: number | null;
media_type?: number;
pk?: string;
taken_at?: number;
user?: {
[key: string]: unknown;
biography?: string;
external_url?: string | null;
follower_count?: number | null;
following_count?: number | null;
full_name?: string;
is_private?: boolean;
is_verified?: boolean;
media_count?: number | null;
pk?: string;
profile_pic_url?: string | null;
username?: string;
};
usertags?: | {
[key: string]: unknown;
in?: object[];
}
| null;
video_versions?: object[] | null;
}>>;One page of the saved posts.
Parameters
| Parameter | Type |
|---|---|
options? | CommentListOptions |
Returns
Promise<Page<{ [key: string]: unknown; caption?: | { [key: string]: unknown; text?: string; } | null; code?: string; comment_count?: number | null; id?: string; image_versions2?: { [key: string]: unknown; candidates?: object[]; }; like_count?: number | null; media_type?: number; pk?: string; taken_at?: number; user?: { [key: string]: unknown; biography?: string; external_url?: string | null; follower_count?: number | null; following_count?: number | null; full_name?: string; is_private?: boolean; is_verified?: boolean; media_count?: number | null; pk?: string; profile_pic_url?: string | null; username?: string; }; usertags?: | { [key: string]: unknown; in?: object[]; } | null; video_versions?: object[] | null; }>>
unarchive()
unarchive(mediaId): Promise<void>;Puts an archived post back on the profile.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
Returns
Promise<void>
unlike()
unlike(mediaId): Promise<void>;Removes a like from a post.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
Returns
Promise<void>
unlikeComment()
unlikeComment(commentId): Promise<void>;Removes a like from a comment.
Parameters
| Parameter | Type |
|---|---|
commentId | string |
Returns
Promise<void>
unpin()
unpin(mediaId): Promise<void>;Unpins a post from the profile grid.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
Returns
Promise<void>
unpinComment()
unpinComment(mediaId, commentId): Promise<void>;Unpins a comment.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
commentId | string |
Returns
Promise<void>
unsave()
unsave(mediaId, options?): Promise<void>;Removes a post from the saved posts, or from one collection.
Parameters
| Parameter | Type |
|---|---|
mediaId | string |
options? | SaveOptions |
Returns
Promise<void>