UNPKG

@zezosoft/zezo-ott-api-client

Version:

The official TypeScript SDK for Zezo OTT API. Easily integrate Zezo OTT into your applications with a powerful, developer-friendly package for video streaming, authentication, payments, and more.

1,634 lines (1,613 loc) 119 kB
import * as axios from 'axios'; import { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosHeaders } from 'axios'; declare class BaseService { protected client: AxiosInstance; constructor(options: IOptions); protected request(config: AxiosRequestConfig): Promise<axios.AxiosResponse<any, any>>; } interface IPopulate$2 { path: string; select?: string[]; populate?: IPopulate$2[]; } interface IPaginatedResponse$1<T> { docs: T[]; totalDocs: number; offset: number; limit: number; totalPages: number; page: number; pagingCounter: number; hasPrevPage: boolean; hasNextPage: boolean; prevPage: null | number; nextPage: null | number; } interface IContentlanguage { _id: string; name: string; } interface IContentCast { _id: string; name: string; type: "actor" | "director" | "writer" | "producer"; avatar: string | null; castType: string; } interface ISubtitles { title?: string | undefined; language?: string | undefined; type: "application/x-subrip" | "application/ttml+xml" | "text/vtt"; url: string; } interface IContentEpisodes { _id: string; name: string; description: string; data: string; duration: number; number: number; source_link: string; trailer_source_link: string; source_type: "HLS" | "MP4"; content_offering_type: "FREE" | "PREMIUM"; subtitles: ISubtitles[]; thumbnail: string; createdAt: string; updatedAt: string; status: boolean; skipIntroTimestamp?: { start: number; end: number; } | null; nextEpisodeTimestamp?: number | null; source_key_type?: "USE_PREFIX" | "USE_CUSTOM" | "NONE"; views?: number; watch_time?: number; } interface IContentSeasons { _id: string; name: string; content_id: string; order: number; season_number: number; episodes: IContentEpisodes[] | null; status: boolean; created_by: string; createdAt: string; updatedAt: string; images?: IContentImages[] | null; title_image?: string | null; description?: string | null; } interface IContentCategory { _id: string; name: string; } interface IContentGenres { _id: string; name: string; } interface IContentPagination { length: number; limit: number; page: number; total: number; hasNextPage: boolean; nextPage: number | null; } interface IContentMeta { pagination: IContentPagination; report: any | null; } interface IContentImages { id: string; image_id: string; name: string; width: number; height: number; sizes?: { small: string; medium: string; large: string; original: string; }; } interface IContentData { _id: string; name: string; slug: string; u_age: string; description: string; duration: string; rating: number; source_link: string | null; source_type: "HLS" | "MP4" | "LIVE_STREAM_HLS"; trailer_source_link: string | null; trailer_source_type: "HLS" | "MP4"; language: IContentlanguage | null; cast: IContentCast[] | null; poster: string; thumbnail: string; views: number; tags: string[]; job_id: string | null; seasons: IContentSeasons[] | null; status: "PUBLIC" | "PRIVATE" | "PENDING" | "REJECTED"; trash: boolean; type: "series" | "movie" | "live_stream"; content_offering_type: "FREE" | "PREMIUM" | "BUY_OR_RENT"; updated_by: string; created_by: string; createdAt: string; updatedAt: string; category: IContentCategory | null; genres: IContentGenres[] | null; subtitles: ISubtitles[]; is_buy_or_rent?: "BUY" | "RENT"; rent_duration?: number | null; price?: number | null; buy_or_rent_status: { _id?: string; status?: "valid" | "expired"; }[]; title_image?: string | null; content_duration?: string | null; release_year?: string | null; images?: IContentImages[] | null; watch_time?: number | null; revenue?: number | null; source_key_type?: "USE_PREFIX" | "USE_CUSTOM"; trailer_source_key_type?: "USE_PREFIX" | "USE_CUSTOM"; forKids: boolean; forFamily: boolean; buy_count?: number; rent_count?: number; buy_revenue?: number; rent_revenue?: number; } interface IContent { id: string; title: string; posterUrl: string; type: "movie" | "series" | "music"; } interface IContent { data: IContentData[]; meta: IContentMeta; } interface IRentOrBuyContentData { _id: string; content_id: IContentData; user_id: string; status: "valid" | "expired"; valid_upto: string; createdAt: string; updatedAt: string; } interface IRentOrBuyContent { data: IRentOrBuyContentData[]; meta: IContentMeta; } interface IGetIsRentOrBuyContentByIDData { _id: string; content_id: { _id: string; name: string; is_buy_or_rent?: "BUY" | "RENT"; rent_duration: number; price: number; }; user_id: string; status: "valid" | "expired"; valid_upto: string; createdAt: string; updatedAt: string; } interface ITvod { data: IContent["data"]; meta: { pagination: { page: number; limit: number; pages: number; total: number; hasNextPage: boolean; nextPage: null | number; }; }; } interface IUpdateContentGeoPayload { content_id: string; countries: string[]; } interface IGetManageContentQueryPayload { page?: number; limit?: number; order?: "asc" | "desc"; fields?: string[]; q?: string; filters?: object; populate?: IPopulate$2[]; id?: string; sortby?: string; } interface ICreateContentPayload { name: string; slug: string; type: "movie" | "series" | "live_stream"; description?: string; u_age?: string; duration?: string; rating?: string; source_link?: string; source_type?: "HLS" | "MP4" | "LIVE_STREAM_HLS"; trailer_source_link?: string; trailer_source_type?: "HLS" | "MP4"; category?: string; genres?: string[]; language?: string; cast?: string[]; tags?: string[]; content_offering_type?: "FREE" | "PREMIUM" | "BUY_OR_RENT"; is_buy_or_rent?: "BUY" | "RENT"; rent_duration?: number; price?: number; content_duration?: string; is_18_plus?: boolean; message_for_18_plus?: string; release_year?: string; forKids?: boolean; forFamily?: boolean; } interface ICreateContentResponse { id: string; } interface IContentActionsPayload { id: Array<string>; action: "public" | "private" | "trash" | "restore" | "delete"; } interface IContentActionsResponse { acknowledged: boolean; modifiedCount: number; matchedCount: number; } interface IUpdateContentPayload { name: string; slug: string; type: "movie" | "series" | "live_stream"; description?: string; u_age?: string; duration?: string; rating?: string; source_link?: string; source_type?: "HLS" | "MP4" | "LIVE_STREAM_HLS"; trailer_source_link?: string; trailer_source_type?: "HLS" | "MP4"; category?: string; genres?: string[]; language?: string; cast?: string[]; tags?: string[]; content_offering_type?: "FREE" | "PREMIUM" | "BUY_OR_RENT"; is_buy_or_rent?: "BUY" | "RENT"; rent_duration?: number; price?: number; content_duration?: string; is_18_plus?: boolean; message_for_18_plus?: string; release_year?: string; forKids?: boolean; forFamily?: boolean; } interface IUpdateContentResponse { id: string; } interface IGetSeasonManageQueryPayload { page?: number; limit?: number; order?: "asc" | "desc"; select?: string; q?: string; filters?: object; populate?: IPopulate$2[]; seasonId?: string; sortby?: string; contentId?: string; slug?: string; } interface ICreateContentSeasonPayload { content_id: string; name: string; season_number?: number; status?: boolean; } interface ICreateContentSeasonResponse { id: string; } interface IUpdateContentSeasonPayload { season_id: string; name?: string; season_number?: number; status?: boolean; } interface ICreateContentEpisodePayload { name: string; description: string; number?: number; duration: number; source_link: string; source_type: "HLS" | "MP4"; source_key_type?: "USE_PREFIX" | "USE_CUSTOM"; content_offering_type?: "FREE" | "PREMIUM"; status: boolean; skipIntroTimestamp?: { start: number; end: number; }; nextEpisodeTimestamp?: number | null; season_id: string; thumbnail: File; } interface IUpdateContentEpisodePayload { name: string; description: string; number?: number; duration: number; source_link: string; source_type: "HLS" | "MP4"; source_key_type?: "USE_PREFIX" | "USE_CUSTOM"; content_offering_type?: "FREE" | "PREMIUM"; status: boolean; skipIntroTimestamp?: { start: number; end: number; }; nextEpisodeTimestamp?: number | null; episode_id: string; thumbnail: string; } interface IUpdateContentSubtitlesPayload { id: string; action: "add" | "remove"; type: "content" | "episode"; title?: string; language: string; subtitle?: File; } interface IUploadContentImage { content_id: string; image_id: string; update_image_id?: string; type: "create" | "update"; file: File; } interface IDeleteContentImage { content_id: string; image_id: string; } interface ICreateImageSize { name: string; width: number; height: number; } interface IImageSize { _id: string; name: string; width: number; height: number; createdAt: Date; updatedAt: Date; } interface IViewCount { content_id: string; episode_id: string | null; /** * @deprecated */ ip_address?: string | null; platform: "web" | null; /** * @deprecated */ city?: string | null; /** * @deprecated */ location?: string | null; /** * @deprecated */ region?: string | null; /** * @deprecated */ timezone?: string | null; } interface IWatchTimeCount { content_id: string; episode_id: string | null; time: number; platform: "web"; } type TTimePeriod = "today" | "last_24_hours" | "last_3_days" | "last_7_days" | "last_14_days" | "last_30_days" | "last_60_days" | "this_week" | "this_month" | "this_year" | "all_time" | "custom"; interface IReadContentAnalyticsQueryPayload { timePeriod?: TTimePeriod; startDate?: string; endDate?: string; content_id?: string; } interface IReadLatestContentAnalyticsResponse { views: { _id: string; count: number; }[]; watchTime: { _id: string; time: number; }[]; } interface IReadUsersAnalyticsQueryPayload { timePeriod?: TTimePeriod; startDate?: string; endDate?: string; } interface IReadUsersAnalyticsResponse { totalUsers: number; users: { _id: string; count: number; }[]; subscriber: number; } interface IReadContentReportAnalyticsResponse { total: number; totalPublic: number; totalPrivate: number; } interface IReadRevenueAnalyticsQueryPayload { timePeriod?: TTimePeriod; startDate?: string; endDate?: string; revenue_type?: "tvod" | "svod" | "other"; tvodId?: string; tvodType?: "rent" | "buy" | "other"; status?: "created" | "paid" | "failed" | "attempted"; } interface IReadRevenueAnalyticsResponse { razorpay: number; UPI: number; cashfree: number; subpaisa: number; payumoney: number; stripe: number; ccavenue: number; phonepe: number; } interface IGetTvodAnalyticsQueryPayload { timePeriod?: TTimePeriod; id?: string; from?: string; to?: string; } interface IGetTvodAnalyticsResponse { total_bought: number; total_rented: number; date: string; } interface IGetTrendingAnalyticsQuery { timePeriod?: TTimePeriod; basedOn?: "views" | "watch_time" | "revenue"; limit?: number; } interface ITrending extends Pick<IContentData, "_id" | "name" | "description" | "content_duration" | "thumbnail" | "status" | "views" | "type" | "content_offering_type" | "createdAt" | "created_by" | "watch_time" | "revenue"> { } declare class AnalyticsService extends BaseService { constructor(options: IOptions); /** * Increments the view count for a given content or episode. * * @param payload the content id, episode id, and other metadata * @returns response from the server */ countView(payload: IViewCount): Promise<AxiosResponse<any, any>>; /** * Logs the watch time for a given content or episode. * * @param payload the content id, episode id, watch time, and other metadata * @returns response from the server */ countWatchTime(payload: IWatchTimeCount): Promise<AxiosResponse<any, any>>; /** * Reads the latest content analytics. * * @param query the query containing the filter options * @returns response from the server containing the latest content analytics */ readContentAnalytics(query?: IReadContentAnalyticsQueryPayload): Promise<AxiosResponse<IReadLatestContentAnalyticsResponse>>; /** * Reads the users analytics. * * @param query the query containing the filter options * @returns response from the server containing the users analytics */ readUsersAnalytics(query?: IReadUsersAnalyticsQueryPayload): Promise<AxiosResponse<IReadUsersAnalyticsResponse>>; /** * Reads the content report analytics. * * @returns response from the server containing the content report analytics */ readContentReportAnalytics(): Promise<AxiosResponse<IReadContentReportAnalyticsResponse>>; /** * Reads the revenue analytics. * * @param query Optional query parameters to filter the revenue analytics. * @returns A promise that resolves to the server's response containing the revenue analytics. */ readRevenueAnalytics(query?: IReadRevenueAnalyticsQueryPayload): Promise<AxiosResponse<IReadRevenueAnalyticsResponse>>; /** * Fetches the TVOD analytics for the given query. * * @param query Optional query parameters to filter the TVOD analytics. * @returns A promise that resolves to the server's response containing the TVOD analytics. */ getTvodAnalytics(query?: IGetTvodAnalyticsQueryPayload): Promise<AxiosResponse<IGetTvodAnalyticsResponse[]>>; /** * Fetches the trending analytics for the given query. * * @param query Optional query parameters to filter the trending analytics. * @returns A promise that resolves to the server's response containing the trending analytics. */ trending(query?: IGetTrendingAnalyticsQuery): Promise<AxiosResponse<ITrending[]>>; } interface ICheckout { subscription?: string; content?: string; coupon_code?: string; provider: "razorpay" | "stripe" | "phonepe" | "ccavenue"; metadata?: { payment_type?: "session" | "instant" | "none"; isPaymentInitiatedEnabled?: boolean; checkout_type?: "subscription" | "buy_or_rent"; }; } interface IPlatform { platform: "web" | "android" | "ios" | "android_tv"; } interface IPaymentReadyResponse { provider: "phonepe" | "razorpay" | "stripe" | "ccavenue"; logo?: string; } interface ICheckoutResponse { status: boolean; orderId: string; amount: number; real_amount: number; currency: "INR"; provider: string; publicKey?: string; extraData?: object; } interface IPaymentsQuery { page?: number; limit?: number; order?: "asc" | "desc"; q?: string; id?: string; order_id?: string; fields?: string[]; populate?: object; filters?: object; } interface IPayment { _id: string; userId: { _id: string; name?: string; email?: string; phone?: string; }; subscriptionId: string; revenue_type?: "tvod" | "svod" | "other"; tvodId?: string; tvodType?: "rent" | "buy" | "other"; paymentId?: string | null; orderId: string; reference_no?: string | null; tracking_id?: string | null; payment_gateway?: string; signature?: string | null; amount?: number; real_amount?: number; status: "created" | "paid" | "failed" | "attempted"; checkout_type: "subscription" | "buy_or_rent" | "other"; payment_type?: "session" | "instant" | "none"; coupon_code?: string; createdAt: string; updatedAt: string; } interface IAuthMethods { success: boolean; message: string; data: Array<"email" | "phone">; } interface IGetAuthProviderQueryPayload { fields: string[]; select: "web" | "tv" | "mobile"; } interface IAuthProviderResponse { success: boolean; message: string; data: { _id: string; methods_enabled: { email: boolean; phone: boolean; qrcode: boolean; }; methods: Array<"email" | "phone" | "qrcode">; createdAt: string; updatedAt: string; }; } interface IAuthProviderUpdatePayload { status: boolean; methods: Array<"email" | "phone" | "qrcode">; } declare class AuthMethodsService extends BaseService { constructor(options: IOptions); /** * Retrieves the available authentication methods for the specified platform. * * @param payload - The platform for which to retrieve authentication methods. * @returns A promise that resolves to an object containing the success status, * a message, and an array of available authentication methods (email or phone). */ loginMethods(payload: IPlatform): Promise<AxiosResponse<IAuthMethods>>; /** * Initializes the auth provider. * * @returns A promise that resolves to the server's response. */ init(): Promise<AxiosResponse>; /** * Fetches the list of configured private auth providers. * * @param query An object of query parameters to filter the results. * The available query parameters are: * - `select`: The columns to include in the results. * - `fields`: The columns to include in the results. * @returns A promise that resolves to the server's response containing the list of private auth providers. */ get(query?: IGetAuthProviderQueryPayload): Promise<AxiosResponse<IAuthProviderResponse>>; /** * Updates the authentication provider configuration. * * @param payload The payload containing the updated configuration for the authentication provider. * @returns A promise that resolves to the server's response. */ update(payload: IAuthProviderUpdatePayload): Promise<AxiosResponse>; } interface ISendOTPPayload { phone: string; countryCode?: string; re_captcha_token?: string; provider?: "whatsapp"; } interface ISendOTPResponse { hash: string; phone: string; } interface ISignUpResponse { token: string; user: { id: string; email: string; name: string; }; } interface ILoginPayload { email: string; password: string; check?: boolean; } interface IVerifyOtpPayload { hash: string; otp: number | string; phone: number | string; } interface ISignUpPayload { name: string; email: string; password: string; } interface IForgotPasswordPayload { email: string; } interface IResetPasswordPayload { id: string; token: string; password: string; } type IRoles = "user" | "admin" | "partner" | "manager"; interface IWhoami { id: string; name: string; phone: string; email: string; role: IRoles; avatar: string | null; sessions?: object[]; isSubscribed: boolean; subscription: { subscriptionId: string; subscriptionDetails: { _id: string; name: string; description: string; price: number; points: string[]; duration: string; currency: string[]; status: boolean; maxVideoQuality: string; created_by: string; updated_by: string; createdAt: string; updatedAt: string; isPopular: boolean; } | null; active_at: string; expiresIn: string; } | null; permissions: { permissions: string[]; resources: string[]; roles: string[]; }; } interface IRemoveSessionPayload { token_id: string; } interface IChangePasswordPayload { current_password: string; new_password: string; } interface IPopulate$1 { path: string; select?: string[]; populate?: IPopulate$1[]; } interface IPaginatedResponse<T> { docs: T[]; totalDocs: number; offset: number; limit: number; totalPages: number; page: number; pagingCounter: number; hasPrevPage: boolean; hasNextPage: boolean; prevPage: null | number; nextPage: null | number; } declare interface ILoginWithPhonePayload { phone: string; re_captcha_token?: string; countryCode?: string; } declare interface ILoginWithEmailPayload { email: string; password: string; } declare interface IEmailLoginResponse { status: number; data: { message: string; data: { user: { id: string; name: string; email: string; role: string; avatar: string | null; createdAt: string; updatedAt: string; }; accessToken: string; refreshToken: string; accessTokenExpiry: string; }; }; } declare interface IForgotPasswordResponse { status: number; } declare interface IResetPasswordResponse { status: number; } declare interface IWhoamiData { id: string; name: string; phone: string; email: string; role: "user" | "admin" | "partner"; avatar: string | null; sessions: IWhoamiData[]; isSubscribed: boolean; subscription: { subscriptionId: string; subscriptionDetails: { _id: string; name: string; description: string; price: number; points: string[]; duration: string; currency: string[]; status: boolean; maxVideoQuality: string; created_by: string; updated_by: string; createdAt: string; updatedAt: string; isPopular: boolean; } | null; active_at: string; expiresIn: string; } | null; } declare interface IWhoamiResponse { data: IWhoamiData; } declare interface IUserSession { user: IWhoamiData | null; token: string | null; isAuthenticated: boolean; isLoading: boolean; isError: boolean; watchlist?: string[]; } declare class AuthService extends BaseService { constructor(options: IOptions); /** * Send OTP to the user's phone * @param payload phone and optional recaptcha token * @returns response from the server */ sendOTP(payload: ISendOTPPayload): Promise<AxiosResponse<ISendOTPResponse>>; /** * Logins the user with the given email and password * @param payload email and password * @returns response from the server */ login(payload: ILoginPayload): Promise<AxiosResponse<any, any>>; /** * Verify the OTP sent to the user * @param payload the otp hash and the otp sent to the user * @returns response from the server */ verifyOTP(payload: IVerifyOtpPayload): Promise<AxiosResponse<any, any>>; /** * Sign up a user * @param payload name, email, and password * @returns response from the server */ signUp(payload: ISignUpPayload): Promise<AxiosResponse<any, any>>; /** * Forgot password * @param payload email * @returns response from the server */ forgotPassword(payload: IForgotPasswordPayload): Promise<AxiosResponse<any, any>>; /** * Reset the user's password * @param payload the id of the user, token from the forgot password email, and the new password * @returns response from the server */ resetPassword(payload: IResetPasswordPayload): Promise<AxiosResponse<any, any>>; /** * Retrieves the authenticated user's information. * * @returns An object containing the user's details such as id, name, email, role, and subscription information. */ whoamI(headers?: Record<string, string>): Promise<{ data: IWhoami; }>; /** * Logs out the user * @returns response from the server */ logout(headers?: Record<string, string>): Promise<AxiosResponse<any, any>>; /** * Removes a user session based on the provided token ID. * @param payload - An object containing the token ID of the session to be removed. * @returns Response from the server indicating the result of the session removal. */ removeSession(payload: IRemoveSessionPayload, headers?: Record<string, string>): Promise<AxiosResponse<any, any>>; /** * Changes the user's password. * @param payload - An object containing the current password and the new password. * @returns Response from the server indicating the result of the password change. */ changePassword(payload: IChangePasswordPayload): Promise<AxiosResponse<any, any>>; } interface IBlogQuery { slug: string; } interface IBlog { _id: string; title: string; slug: string; blog_content: string; tags: string[]; thumbnail: string | null; status: boolean; trash: boolean; createdAt: string; updatedAt: string; } interface IBlogs { message: string; data: IBlog[]; meta: { pagination: { page: number; pageSize: number; pageCount: number; total: number; }; report?: { totalPublic: number; totalPrivate: number; }; }; } declare class BlogService extends BaseService { constructor(options: IOptions); /** * Retrieves a blog by slug. * * @param payload the query with the slug of the blog to retrieve * @returns response from the server */ get(payload: IBlogQuery): Promise<AxiosResponse<IBlogs>>; } interface IGetSectionsQuery { page?: number; limit?: number; type?: string; category?: string; fields?: string[]; content_list?: boolean; content_list_fields?: string[]; content_list_limit?: number; content_list_populate?: any[]; } interface ISectionData { _id: string; name: string; type: string; category: { _id: string; name: string; slug: string; }; content: { data: IContentData[]; meta: { pagination: { page: number; limit: number; length: number; total: number; hasNextPage: boolean; nextPage: number | null; }; }; }; } interface ISection { data: ISectionData[]; meta: { pagination: { page: number; limit: number; length: number; total: number; hasNextPage: boolean; nextPage: number | null; }; }; } interface ICreateSectionPayload { name: string; } interface IPopulateV1 { path: string; select?: string; populate?: IPopulateV1[]; } interface IGetManageSectionsQuery { id?: string; page?: number; limit?: number; order?: "asc" | "desc"; sortBy?: string; genre?: string; category?: string; type?: string; select?: string; filters?: object; profile?: "kids" | "family" | "none"; populate?: IPopulateV1[]; } interface IGetSectionManageResponse { _id: string; name: string; label: string; order: number; type: string; profile?: "kids" | "family" | "none"; content_ids: IContentData[]; category: { _id: string; name: string; slug: string; }; genre?: string; content: { data: IContentData[]; }; status: boolean; createdAt: Date; updatedAt: Date; } interface IUpdateSectionStatusPayload { id: string; status: boolean; } interface ISectionUpdate { id: string; type: string; content_ids: string[]; profile: "kids" | "family" | "none"; name?: string; label?: string; category?: string; genre?: string; } interface ISectionStyles { _id: string; name: string; description: string; style_key: string; ios: { status: boolean; available: boolean; style_preview_image?: string; }; android: { status: boolean; available: boolean; style_preview_image?: string; }; web: { status: boolean; available: boolean; style_preview_image?: string; }; tv: { status: boolean; available: boolean; style_preview_image?: string; }; } interface ICreateSectionStyle extends Pick<ISectionStyles, "name" | "description" | "style_key" | "ios" | "android" | "tv" | "web"> { } interface IUpdateSectionStyle extends ICreateSectionStyle { } interface IGetSectionStylesQuery { page?: number; limit?: number; order?: "asc" | "desc"; q?: string; id?: string; sort?: string; select?: string; filter?: object; } interface IGetManageCategories { _id: string; name: string; slug: string; description?: string; icon?: string; image?: string; q?: string; show_in_menu: boolean; order: number; status: boolean; trash: boolean; createdAt: Date; updatedAt: Date; } interface IGetCategoriesData { _id: string; name: string; slug: string; description: string; order: number; icon: string | null; show_in_menu: boolean; image: string | null; } interface IGetCategories { message: string; data: IGetCategoriesData[]; } interface IUpdateCategory { name: string; description?: string; show_in_menu?: boolean; order?: number; icon?: string; image?: string; } interface ICreateCategory extends IUpdateCategory { } interface ICategoryActions { action: "public" | "private" | "moveToTrash" | "restore"; ids: string[]; } interface IGetCategoriesQuery { page?: number; limit?: number; order?: "asc" | "desc"; sortBy?: string; id?: string; q?: string; slug?: string; select?: string; filters?: object; populate?: IPopulateV1[]; } declare class CategoriesService extends BaseService { constructor(options: IOptions); /** * Creates a new category. * * @param payload The category data to send to the server. * @param headers Optional headers to include in the request. * @returns A promise that resolves to the server's response containing the ID of the new category. */ create(payload: ICreateCategory, headers?: AxiosHeaders): Promise<AxiosResponse<{ id: string; }>>; /** * Updates an existing category. * * @param id The ID of the category to update. * @param payload The category data to update on the server. * @param headers Optional headers to include in the request. * @returns A promise that resolves to the server's response containing the ID of the updated category. */ update(id: string, payload: IUpdateCategory, headers?: AxiosHeaders): Promise<AxiosResponse<{ id: string; }>>; /** * Deletes categories by their IDs. * * @param ids An array of category IDs to delete. * @returns A promise that resolves to the server's response containing the count of deleted categories. */ delete(ids: string[]): Promise<AxiosResponse<{ deletedCount: number; }>>; /** * Performs an action on multiple categories. * * @param payload The payload containing the action to perform and the IDs of the categories. * The available actions are "active", "inactive", "trash", "pending", and "blocked". * @returns A promise that resolves to the server's response containing the count of updated categories. */ actions(payload: ICategoryActions): Promise<AxiosResponse<{ updatedCount: number; }>>; /** * Retrieves a list of categories for management. * * @param query Optional query parameters to filter the results. * The available query parameters are: * - `page`: The page number to retrieve. * - `limit`: The number of items to retrieve per page. * - `order`: The order to sort the results by. The available values are `asc` and `desc`. * - `fields`: An array of column names to include in the results. * - `q`: A search query to filter the results by. * - `filters`: An object of filter values to filter the results by. * - `populate`: An array of populate options to include associated data in the results. * @returns A promise that resolves to the server's response containing the list of categories for management. */ getManage(query?: IGetCategoriesQuery): Promise<AxiosResponse<IPaginatedResponse$1<IGetManageCategories>>>; /** * Retrieves a list of categories. * * @param query Optional query parameters to filter the results. * The available query parameters are: * - `page`: The page number to retrieve. * - `limit`: The number of items to retrieve per page. * - `order`: The order to sort the results by. The available values are `asc` and `desc`. * - `fields`: An array of column names to include in the results. * - `q`: A search query to filter the results by. * - `filters`: An object of filter values to filter the results by. * - `populate`: An array of populate options to include associated data in the results. * @returns A promise that resolves to the server's response containing the list of categories. */ list(query?: IGetCategoriesQuery): Promise<AxiosResponse<IPaginatedResponse$1<IGetCategoriesData>>>; /** * Fetches the list of categories. * @deprecated Use the `list` method instead. * @returns A promise that resolves to the server's response containing * the categories data. */ get(): Promise<AxiosResponse<IGetCategories>>; } declare class ContentService extends BaseService { constructor(options: IOptions); /** * Fetches the list of content. * * @param query the search query * @returns response from the server */ get(query?: string): Promise<AxiosResponse<IContent>>; /** * Fetches the list of content seasons. * * @param query the search query * @returns response from the server containing the list of content seasons */ getSeasons(query?: string): Promise<AxiosResponse<IContentSeasons[]>>; /** * Checks if a content has been bought or rented by the current user. * @param contentId the id of the content to check * @returns a boolean indicating if the content has been bought or rented */ getIsContentBuyedOrRented(contentId: string, headers?: Record<string, string>): Promise<boolean>; /** * Fetches the list of content available for rent or buy. * * @param queryString the query string * @returns a promise that resolves to the server's response containing the list of content available for rent or buy */ getTvod(queryString?: string): Promise<AxiosResponse<ITvod>>; /** * Updates the geo location for a content. * * @param payload the update geo location payload * @returns a promise that resolves to the server's response */ updateGeoLocation(payload: IUpdateContentGeoPayload): Promise<AxiosResponse<any, any>>; /** * Fetches the list of content for management. * * @param query Optional query parameters to filter the results. * The available query parameters are: * - `page`: The page number to retrieve. * - `limit`: The number of items to retrieve per page. * - `order`: The order to sort the results by. The available values are `asc` and `desc`. * - `fields`: An array of column names to include in the results. * - `q`: A search query to filter the results by. * - `filters`: An object of filter values to filter the results by. * - `populate`: An array of populate options to include associated data in the results. * - `id`: A content ID to retrieve a single content. * @returns A promise that resolves to the server's response containing the list of content for management. */ getManage<T = IContentData>(query?: IGetManageContentQueryPayload): Promise<AxiosResponse<IPaginatedResponse$1<T>>>; /** * Creates a new content. * * @param payload The content data to send to the server. * @param headers Optional headers to include in the request. * @returns A promise that resolves to the server's response containing the newly created content. */ create(payload: ICreateContentPayload, headers?: AxiosHeaders): Promise<AxiosResponse<ICreateContentResponse>>; /** * Perform an action on a content. * * @param payload The content action payload. * @returns A promise that resolves to the server's response containing the result of the action. */ actions(payload: IContentActionsPayload): Promise<AxiosResponse<IContentActionsResponse>>; /** * Updates a content. * * @param contentID The ID of the content to update. * @param payload The content data to update on the server. * @param headers Optional headers to include in the request. * @returns A promise that resolves to the server's response containing the updated content. */ update(contentID: string, payload: IUpdateContentPayload, headers?: AxiosHeaders): Promise<AxiosResponse<IUpdateContentResponse>>; /** * Removes the title image for a content. * * @param contentID The ID of the content to remove the title image for. * @returns A promise that resolves to the server's response. */ removeTitleImage(contentID: string): Promise<AxiosResponse<any>>; /** * Retrieves a list of seasons for a content for management. * * @param query The query parameters to filter the results. * The available query parameters are: * - `page`: The page number to retrieve. * - `limit`: The number of items to retrieve per page. * - `order`: The order to sort the results by. The available values are `asc` and `desc`. * - `fields`: An array of column names to include in the results. * - `q`: A search query to filter the results by. * - `filters`: An object of filter values to filter the results by. * - `populate`: An array of populate options to include associated data in the results. * - `id`: A content ID to retrieve a single content. * @returns A promise that resolves to the server's response containing the list of seasons for the content. */ getSeasonManage<T = IContentSeasons>(query: IGetSeasonManageQueryPayload): Promise<AxiosResponse<IPaginatedResponse$1<T>>>; /** * Creates a new season for a content. * * @param payload The data to send to the server to create the season. * @returns A promise that resolves to the server's response containing the ID of the new season. */ createSeason(payload: ICreateContentSeasonPayload): Promise<AxiosResponse<ICreateContentSeasonResponse>>; /** * Deletes a season by ID. * * @param season_id The ID of the season to delete. * @returns A promise that resolves to the server's response containing the ID of the deleted season. */ deleteSeason(season_id: string): Promise<AxiosResponse<{ id: string; }>>; /** * Updates a season by ID. * * @param payload The data to send to the server to update the season. * @returns A promise that resolves to the server's response containing the ID of the updated season. */ updateSeason(payload: IUpdateContentSeasonPayload): Promise<AxiosResponse<{ id: string; }>>; /** * Creates a new episode for a season. * * @param payload The episode data to send to the server to create the episode. * @param headers Optional headers to include in the request. * @returns A promise that resolves to the server's response containing the ID of the new episode. */ createEpisode(payload: ICreateContentEpisodePayload, headers?: AxiosHeaders): Promise<AxiosResponse<{ id: string; }>>; /** * Deletes an episode by ID. * * @param episode_id The ID of the episode to delete. * @returns A promise that resolves to the server's response containing the ID of the deleted episode. */ deleteEpisode(episode_id: string): Promise<AxiosResponse<{ id: string; }>>; /** * Updates an episode by ID. * * @param payload The data to send to the server to update the episode. * @returns A promise that resolves to the server's response containing the ID of the updated episode. */ updateEpisode(payload: IUpdateContentEpisodePayload, headers?: AxiosHeaders): Promise<AxiosResponse<{ id: string; }>>; /** * Updates subtitles for a given content or episode. * * @param payload The data to send to the server to update the subtitles. * @param headers Optional headers to send with the request. * @returns A promise that resolves to the server's response. */ manageSubtitles(payload: IUpdateContentSubtitlesPayload, headers?: AxiosHeaders): Promise<AxiosResponse>; /** * Uploads images for a given content. * * @param payload The data to send to the server for uploading images. * @param headers Optional headers to send with the request. * @returns A promise that resolves to the server's response containing the ID of the uploaded image. */ uploadImages(payload: IUploadContentImage, headers?: AxiosHeaders): Promise<AxiosResponse<{ id: string; }>>; /** * Fetches search results based on the given query string. * * @param query The search query to be used for finding matching content. * @returns A promise that resolves to an array of matching content items. */ fetchSearchResults(query: string): Promise<AxiosResponse<IContent[]>>; /** * Deletes an image for a given content. * * @param payload The data to send to the server for deleting an image. * @returns A promise that resolves to the server's response containing the ID of the deleted image. */ deleteImage(payload: IDeleteContentImage): Promise<AxiosResponse<{ id: string; }>>; /** * Creates a new image size. * * @param payload The image size data to send to the server. The payload should include the `name`, `width`, and `height` of the image size. * @returns A promise that resolves to the server's response containing a message indicating the result of the operation. */ createImageSize(payload: ICreateImageSize): Promise<AxiosResponse<{ message: string; }>>; /** * Retrieves a list of all image sizes. * * @returns A promise that resolves to the server's response containing a list of image sizes. */ listImageSizes(): Promise<AxiosResponse<IImageSize[]>>; /** * Deletes an image size by its ID. * * @param id The ID of the image size to delete. * @returns A promise that resolves to the server's response containing a message indicating the result of the operation. */ deleteImageSize(id: string): Promise<AxiosResponse<{ message: string; }>>; } interface IAddToFavorites { id: string; } interface IIsFavorite { id: string; } interface IRemoveFromFavorites { id: string; } interface IFavoriteContentItem { _id: string; content: IContentData; createdAt: Date; updatedAt: Date; } interface IFavoritesResponse { data: IFavoriteContentItem[]; meta: { pagination: { page: number; pageSize: number; pageCount: number; total: number; }; }; } declare class FavoriteService extends BaseService { constructor(options: IOptions); /** * Add a content to the user's favorites. * @param payload The ID of the content to add * @returns Server response */ addToFavorites(payload: IAddToFavorites): Promise<AxiosResponse<any, any>>; /** * Check if a content is already in user's favorites. * @param payload The ID of the content to check * @returns Boolean or content info from server */ getIsFavorite(payload: IIsFavorite): Promise<AxiosResponse<any, any>>; /** * Remove a content from user's favorites. * @param payload The ID of the content to remove * @returns Server response */ removeFromFavorites(payload: IRemoveFromFavorites): Promise<AxiosResponse<any, any>>; /** * Get all favorite contents for the logged-in user. * @returns List of user's favorite content items */ get(): Promise<AxiosResponse<IFavoritesResponse>>; } declare class PaymentService extends BaseService { constructor(options: IOptions); /** * Lists payments. * * @param query The query to filter the results by. * @returns A promise that resolves to the server's response containing the list of payments. */ list<T = IPayment>(query?: IPaymentsQuery): Promise<AxiosResponse<IPaginatedResponse$1<T>>>; /** * Initializes a payment * * @param payload the checkout payload * @returns response from the server */ checkout(payload: ICheckout): Promise<AxiosResponse>; /** * Fetches the list of payment gateways that are ready to be used for checkout. * @param payload the platform to check * @returns response from the server */ ready(payload: IPlatform): Promise<AxiosResponse>; } declare class SectionsService extends BaseService { constructor(options: IOptions); /** * Creates a new section. * * @param payload The section data to send to the server. * @returns A promise that resolves to the server's response containing the ID of the new section. */ create(payload: ICreateSectionPayload): Promise<AxiosResponse<{ id: string; }>>; /** * Retrieves a list of sections with content for management. * * @param query The query parameters to filter the results by. * The available query parameters are: * - `page`: The page number to retrieve. * - `limit`: The number of items to retrieve per page. * - `order`: The order to sort the results by. The available values are `asc` and `desc`. * - `fields`: An array of column names to include in the results. * - `q`: A search query to filter the results by. * - `filters`: An object of filter values to filter the results by. * - `populate`: An array of populate options to include associated data in the results. * @returns A promise that resolves to the server's response containing the list of sections with content for management. */ getManage(query?: IGetManageSectionsQuery): Promise<AxiosResponse<IPaginatedResponse$1<IGetSectionManageResponse>>>; /** * Deletes a section by ID. * * @param id The ID of the section to delete. * @returns A promise that resolves to the server's response containing the ID of the deleted section. */ deleteSection(id: string): Promise<AxiosResponse<{ id: string; }>>; /** * Updates the status of a section. * * @param payload The payload to send to the server to update the section status. * The payload should contain the `id` of the section to update and the `status` to set. * @returns A promise that resolves to the server's response containing the ID of the updated section. */ updateStatus(payload: IUpdateSectionStatusPayload): Promise<AxiosResponse<{ id: string; }>>; /** * Updates the order of sections. * * @param orders An array of section IDs representing the new order. * @returns A promise that resolves to the server's response. */ updateOrder(orders: string[]): Promise<AxiosResponse>; /** * Updates a section. * * @param payload The payload containing the section details to update. * The payload should include: * - `id`: The ID of the section to update. * - `type`: The type of the section to update. * - `content_ids`: An array of content IDs associated with the section. * - `profile`: The profile for the section, which can be `kids`, `family`, or `none`. * - `name`: (Optional) The name of the section. * - `label`: (Optional) The label of the section. * - `category`: (Optional) The category of the section. * - `genre`: (Optional) The genre of the section. * @returns A promise that resolves to the server's response. */ update(payload: ISectionUpdate): Promise<AxiosResponse>; /** * Creates a new section style. * * @param payload The payload to send to the server to create the section style. * The payload should contain the `