UNPKG

instagram-graph-api

Version:

A library to help perform requests to the Instagram Graph API.

231 lines (230 loc) 10 kB
import { CommentField, DayMetric, HashtagMediaField, LifetimeMetric, MediaField, PageField, SimplePostMetric, StoryMetric, WeekAndMonthMetric } from './Enums'; import { DeleteCommentRequest } from './requests/comment/DeleteCommentRequest'; import { GetCommentRequest } from './requests/comment/GetCommentRequest'; import { PostHideCommentRequest } from './requests/comment/PostHideCommentRequest'; import { GetRepliesRequest } from './requests/comment/replies/GetRepliesRequest'; import { PostReplyRequest } from './requests/comment/replies/PostReplyRequest'; import { GetHashtagRecentMediaRequest } from './requests/hashtag/media/GetHashtagRecentMediaRequest'; import { GetHashtagTopMediaRequest } from './requests/hashtag/media/GetHashtagTopMediaRequest'; import { GetHashtagIdRequest } from './requests/hashtag/search/GetHashtagIdRequest'; import { GetMediaChildrenRequest } from './requests/media/children/GetMediaChildrenRequest'; import { GetMediaCommentsRequest } from './requests/media/comments/GetMediaCommentsRequest'; import { PostMediaCommentRequest } from './requests/media/comments/PostMediaCommentRequest'; import { GetMediaInfoRequest } from './requests/media/info/GetMediaInfoRequest'; import { GetSimplePostMediaInsightsRequest } from './requests/media/insights/GetSimplePostMediaInsightsRequest'; import { GetStoryMediaInsightsRequest } from './requests/media/insights/GetStoryMediaInsightsRequest'; import { GetPageInfoRequest } from './requests/page/info/GetPageInfoRequest'; import { GetPageDayInsightsRequest } from './requests/page/insights/GetPageDayInsightsRequest'; import { GetPageLifetimeInsightsRequest } from './requests/page/insights/GetPageLifetimeInsightsRequest'; import { GetPageMonthInsightsRequest } from './requests/page/insights/GetPageMonthInsightsRequest'; import { GetPageWeekInsightsRequest } from './requests/page/insights/GetPageWeekInsightsRequest'; import { GetPageMediaRequest } from './requests/page/media/GetPageMediaRequest'; /** * A client that creating requests. * * @author Tiago Grosso <tiagogrosso99@gmail.com> * @since 0.2.0 */ export declare class Client { /** * The API access token. */ private accessToken; /** * The id of the page. This is used on page related requests so it should be the page for which the access token has permissions. */ private pageId; /** * The constructor. * * @param accessToken the access token. * @param pageId The id of the page. */ constructor(accessToken: string, pageId: string); /** * Gets the access token. * * @returns the access token. */ getAccessToken(): string; /** * Gets the page id. * * @returns the page id. */ getPageId(): string; /** * Builds a new {@link GetPageInfoRequest}. * * @param fields the fields to retrieve from the API. If no field is specified, all are retrieved. * * @returns a new {@link GetPageInfoRequest}. */ newGetPageInfoRequest(...fields: PageField[]): GetPageInfoRequest; /** * Builds a new {@link GetPageMediaRequest}. * * @param fields the fields to retrieve from the API for each media object. If no field is specified, all are retrieved. * * @returns a new {@link GetPageMediaRequest}. */ newGetPageMediaRequest(...fields: MediaField[]): GetPageMediaRequest; /** * Builds a new {@link GetPageLifetimeInsightsRequest}. * * @param metrics the metrics to retrieve from the API. If no metric is specified, all are retrieved. * * @returns a new {@link GetPageLifetimeInsightsRequest}. */ newGetPageLifetimeInsightsRequest(...metrics: LifetimeMetric[]): GetPageLifetimeInsightsRequest; /** * Builds a new {@link GetPageDayInsightsRequest}. * * @param metrics the metrics to retrieve from the API. If no metric is specified, all are retrieved. * * @returns a new {@link GetPageDayInsightsRequest}. */ newGetPageDayInsightsRequest(...metrics: DayMetric[]): GetPageDayInsightsRequest; /** * Builds a new {@link GetPageWeekInsightsRequest}. * * @param metrics the metrics to retrieve from the API. If no metric is specified, all are retrieved. * * @returns a new {@link GetPageWeekInsightsRequest}. */ newGetPageWeekInsightsRequest(...metrics: WeekAndMonthMetric[]): GetPageWeekInsightsRequest; /** * Builds a new {@link GetPageMonthInsightsRequest}. * * @param metrics the metrics to retrieve from the API. If no metric is specified, all are retrieved. * * @returns a new {@link GetPageMonthInsightsRequest}. */ newGetPageMonthInsightsRequest(...metrics: WeekAndMonthMetric[]): GetPageMonthInsightsRequest; /** * Builds a new {@link GetMediaInfoRequest}. * * @param mediaId the media object id. * @param fields the fields to retrieve from the API. If no field is specified, all are retrieved. * * @returns a new {@link GetMediaInfoRequest}. */ newGetMediaInfoRequest(mediaId: string, ...fields: MediaField[]): GetMediaInfoRequest; /** * Builds a new {@link GetMediaChildrenRequest}. * * @param mediaId the media object id. * * @returns a new {@link GetMediaChildrenRequest}. */ newGetMediaChildrenRequest(mediaId: string): GetMediaChildrenRequest; /** * Builds a new {@link GetMediaCommentsRequest}. * * @param mediaId the media object id. * @param fields the fields to retrieve from the API. If no field is specified, all are retrieved. * * @returns a new {@link GetMediaCommentsRequest}. */ newGetMediaCommentsRequest(mediaId: string, ...fields: CommentField[]): GetMediaCommentsRequest; /** * Builds a new {@link PostMediaCommentRequest}. * * @param mediaId the media object id. * @param text the text of the comment, * * @returns a new {@link PostMediaCommentRequest}. */ newPostMediaCommentRequest(mediaId: string, text: string): PostMediaCommentRequest; /** * Builds a new {@link GetPostMediaInsightsRequest}. * * @param mediaId the media object id (must be of type 'Photo' or 'Video'). * @param metrics the metrics to retrieve from the API. If no metric is specified, all are retrieved. * * @returns a new {@link GetPostMediaInsightsRequest}. */ newGetSimplePostMediaInsightsRequest(mediaId: string, ...metrics: SimplePostMetric[]): GetSimplePostMediaInsightsRequest; /** * Builds a new {@link GetPostMediaInsightsRequest}. * * @param mediaId the media object id (must be of type 'Story'). * @param metrics the metrics to retrieve from the API. If no metric is specified, all are retrieved. * * @returns a new {@link GetPostMediaInsightsRequest}. */ newGetStoryMediaInsightsRequest(mediaId: string, ...metrics: StoryMetric[]): GetStoryMediaInsightsRequest; /** * Builds a new {@link GetHashtagIdRequest}. * * @param hashtag the hashtag. * @param userId (optional) the id of the user making the request. If omitted, the page id is used. * * @returns a new {@link GetHashtagIdRequest}. */ newGetHashtagIdRequest(hashtag: string, userId?: string): GetHashtagIdRequest; /** * Builds a new {@link GetHashtagRecentMediaRequest}. * * @param hashtagId the hashtag id. * @param userId (optional) the id of the user making the request. If omitted, the page id is used. * @param fields the media fields to retrieve from the API. If no field is specified, all are retrieved. * * @returns a new {@link GetHashtagRecentMediaRequest}. */ newGetHashtagRecentMediaRequest(hashtagId: string, userId?: string, ...fields: HashtagMediaField[]): GetHashtagRecentMediaRequest; /** * Builds a new {@link GetHashtagTopMediaRequest}. * * @param hashtagId the hashtag id. * @param userId (optional) the id of the user making the request. If omitted, the page id is used. * @param fields the media fields to retrieve from the API. If no field is specified, all are retrieved. * * @returns a new {@link GetHashtagTopMediaRequest}. */ newGetHashtagTopMediaRequest(hashtagId: string, userId?: string, ...fields: HashtagMediaField[]): GetHashtagTopMediaRequest; /** * Builds a new {@link GetCommentRequest}. * * @param commentId the comment id. * @param fields the comment fields to retrieve from the API. If no field is specified, all are retrieved. * * @returns a new {@link GetCommentRequest}. */ newGetCommentRequest(commentId: string, ...fields: CommentField[]): GetCommentRequest; /** * Builds a new {@link PostHideCommentRequest}. * * @param commentId the comment id. * @param hide whether to hide or show the comment (default: true). * * @returns a new {@link PostHideCommentRequest}. */ newPostHideCommentRequest(commentId: string, hide?: boolean): PostHideCommentRequest; /** * Builds a new {@link DeleteCommentRequest}. * * @param commentId the comment id. * * @returns a new {@link DeleteCommentRequest}. */ newDeleteCommentRequest(commentId: string): DeleteCommentRequest; /** * Builds a new {@link GetRepliesRequest}. * * @param commentId the comment id. * @param fields the comment fields to retrieve from the API. If no field is specified, all are retrieved. * * @returns a new {@link GetRepliesRequest}. */ newGetRepliesRequest(commentId: string, ...fields: CommentField[]): GetRepliesRequest; /** * Builds a new {@link PostReplyRequest}. * * @param commentId the comment id. * @param text the text of the reply. * * @returns a new {@link PostReplyRequest}. */ newPostReplyRequest(commentId: string, text: string): PostReplyRequest; }