types.ts•29.2 kB
// types.ts
export interface LinkedinSearchUsersArgs {
keywords?: string;
first_name?: string;
last_name?: string;
title?: string;
company_keywords?: string;
school_keywords?: string;
current_company?: string;
past_company?: string;
location?: string;
industry?: string;
education?: string;
count?: number;
timeout?: number;
}
export interface LinkedinUserProfileArgs {
user: string;
with_experience?: boolean;
with_education?: boolean;
with_skills?: boolean;
}
export interface LinkedinEmailUserArgs {
email: string;
count?: number;
timeout?: number;
}
export interface LinkedinUserPostsArgs {
urn: string;
count?: number;
timeout?: number;
}
export interface LinkedinUserReactionsArgs {
urn: string;
count?: number;
timeout?: number;
}
export interface LinkedinUserCommentsArgs {
urn: string;
count?: number;
timeout?: number;
commented_after?: number;
}
export interface LinkedinChatMessagesArgs {
user: string;
company?: string;
count?: number;
timeout?: number;
}
export interface SendLinkedinChatMessageArgs {
user: string;
company?: string;
text: string;
timeout?: number;
}
export interface SendLinkedinConnectionArgs {
user: string;
timeout?: number;
}
export interface SendLinkedinPostCommentArgs {
text: string;
urn: string;
timeout?: number;
}
export interface GetLinkedinUserConnectionsArgs {
connected_after?: number;
count?: number;
timeout?: number;
}
export interface GetLinkedinPostRepostsArgs {
urn: string;
count?: number;
timeout?: number;
}
export interface GetLinkedinPostCommentsArgs {
urn: string;
sort?: "relevance" | "recent";
count?: number;
timeout?: number;
}
export interface GetLinkedinPostReactionsArgs {
urn: string;
count?: number;
timeout?: number;
}
export interface GetLinkedinGoogleCompanyArgs {
keywords: string[];
with_urn?: boolean;
count_per_keyword?: number;
timeout?: number;
}
export interface GetLinkedinCompanyArgs {
company: string;
timeout?: number;
}
export interface GetLinkedinCompanyEmployeesArgs {
companies: string[];
keywords?: string;
first_name?: string;
last_name?: string;
count?: number;
timeout?: number;
}
export interface SendLinkedinPostArgs {
text: string;
visibility?: "ANYONE" | "CONNECTIONS_ONLY";
comment_scope?: "ALL" | "CONNECTIONS_ONLY" | "NONE";
timeout?: number;
}
export interface LinkedinSalesNavigatorSearchUsersArgs {
keywords?: string;
first_names?: string[];
last_names?: string[];
current_titles?: string[];
location?: string | string[];
education?: string | string[];
languages?: string[];
past_titles?: string[];
functions?: string[];
levels?: string[];
years_in_the_current_company?: string[];
years_in_the_current_position?: string[];
company_sizes?: string[];
company_types?: string[];
company_locations?: string | string[];
current_companies?: string | string[];
past_companies?: string | string[];
industry?: string | string[];
count: number;
timeout?: number;
}
export interface LinkedinManagementConversationsPayload {
connected_after?: number;
count?: number;
timeout?: number;
}
export interface GoogleSearchPayload {
query: string;
count?: number;
timeout?: number;
}
export interface LinkedinSearchPostsArgs {
timeout?: number;
keywords?: string;
sort?: "relevance";
date_posted?: "past-month" | "past-week" | "past-24h";
content_type?: "videos" | "photos" | "jobs" | "live_videos" | "documents" | null;
mentioned?: string[] | null;
authors?: string[] | null;
author_industries?: string[] | string | null;
author_title?: string | null;
count: number;
}
export interface RedditSearchPostsArgs {
timeout?: number;
query: string;
sort?: "relevance" | "hot" | "top" | "new" | "comments";
time_filter?: "all" | "year" | "month" | "week" | "day" | "hour";
count: number;
}
export interface RedditPostsArgs {
timeout?: number;
post_url: string;
}
export interface RedditPostCommentsArgs {
timeout?: number;
post_url: string;
}
// Instagram types
export interface InstagramUserArgs {
timeout?: number;
user: string;
}
export interface InstagramUserPostsArgs {
timeout?: number;
user: string;
count: number;
}
export interface InstagramPostCommentsArgs {
timeout?: number;
post: string;
count: number;
}
export interface LinkedinCompanyPostsArgs {
urn: string;
count?: number;
timeout?: number;
}
export interface InstagramUserLocation {
"@type": "InstagramUserLocation";
street: string;
city: string;
city_id: number;
zip: string;
latitude: number;
longitude: number;
}
export interface InstagramUser {
"@type": "InstagramUser";
id: string;
alias: string;
name: string;
url: string;
image: string;
follower_count: number;
following_count: number;
description: string;
media_count: number;
is_private: boolean;
is_verified: boolean;
is_business: boolean;
category: string;
external_url: string;
email: string;
whatsapp_number: string;
phone: string;
location: InstagramUserLocation;
links: string[];
mentions: string[];
hashtags: string[];
pinned_channels: string[];
}
export interface InstagramUserPreview {
"@type": "InstagramUserPreview";
id: string;
name: string;
alias: string;
url: string;
image: string;
is_verified: boolean;
is_private: boolean;
}
export interface InstagramPost {
"@type": "InstagramPost";
id: string;
code: string;
url: string;
image: string;
text: string;
created_at: number;
like_count: number;
comment_count: number;
reshare_count: number;
user: InstagramUserPreview;
type: string;
media: string[];
carousel_media_count: number;
is_paid_partnership: boolean;
}
export interface InstagramComment {
"@type": "InstagramComment";
id: string;
comment_index: number;
created_at: number;
text: string;
like_count: number;
reply_count: number;
parent_id: string;
user: InstagramUserPreview;
}
export interface RedditSubreddit {
"@type": "RedditSubreddit";
id: string;
alias: string;
url: string;
icon_url: string;
banner_url: string;
description: string;
member_count: number;
online_count: number;
nsfw: boolean;
quarantined: boolean;
}
export interface RedditPost {
"@type": "RedditPost";
id: string;
title: string;
url: string;
created_at: number;
subreddit: RedditSubreddit;
vote_count: number;
comment_count: number;
thumbnail_url: string;
nsfw: boolean;
spoiler: boolean;
}
// LinkedIn User Comments types
export interface LinkedinURN {
type: string;
value: string;
}
export interface LinkedinReaction {
"@type": "LinkedinReaction";
type: "like" | "love" | "insightful" | "curious" | "celebrate" | "support";
count: number;
}
export interface LinkedinUserCommentUser {
"@type": "LinkedinUserCommentUser";
internal_id: LinkedinURN;
urn: LinkedinURN;
name: string;
alias: string;
url: string;
image: string;
headline: string;
}
export interface LinkedinUserPostUser {
"@type": "LinkedinUserPostUser";
internal_id: LinkedinURN;
urn: LinkedinURN;
name: string;
alias: string;
url: string;
headline: string;
image: string;
}
export interface LinkedinUserPostEvent {
"@type": "LinkedinUserPostEvent";
url: string;
image: string;
title: string;
date: string;
participant_count: number;
}
export interface LinkedinUserPostArticle {
"@type": "LinkedinUserPostArticle";
url: string;
urn: LinkedinURN;
image: string;
title: string;
subtitle: string;
description: string;
}
export interface LinkedinUserPostDocument {
"@type": "LinkedinUserPostDocument";
urn: LinkedinURN;
url: string;
title: string;
cover_images: string[];
images: string[];
total_images_count: number;
}
export interface LinkedinUserPost {
"@type": "LinkedinUserPost";
urn: LinkedinURN;
url: string;
author: LinkedinUserPostUser;
created_at: number;
share_urn: LinkedinURN;
is_empty_repost: boolean;
repost: any; // Can be complex nested structure
images: string[];
video_url?: string;
text: string;
comment_count: number;
share_count: number;
reactions: LinkedinReaction[];
event?: LinkedinUserPostEvent;
article?: LinkedinUserPostArticle;
document?: LinkedinUserPostDocument;
}
export interface LinkedinUserComment {
"@type": "LinkedinUserComment";
urn: LinkedinURN;
url: string;
text: string;
author: LinkedinUserCommentUser;
created_at: number;
is_commenter_post_author: boolean;
comment_count: number;
reactions: LinkedinReaction[];
parent?: LinkedinURN;
post: LinkedinUserPost;
}
export function isValidLinkedinSearchUsersArgs(
args: unknown
): args is LinkedinSearchUsersArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (obj.count !== undefined && typeof obj.count !== "number") {
return false;
}
if (obj.timeout !== undefined && typeof obj.timeout !== "number") {
return false;
}
const hasAnySearchField =
obj.keywords ||
obj.first_name ||
obj.last_name ||
obj.title ||
obj.company_keywords ||
obj.school_keywords ||
obj.current_company ||
obj.past_company ||
obj.location ||
obj.industry ||
obj.education;
if (!hasAnySearchField) return false;
return true;
}
export function isValidLinkedinUserProfileArgs(
args: unknown
): args is LinkedinUserProfileArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.user !== "string" || !obj.user.trim()) return false;
return true;
}
export function isValidLinkedinEmailUserArgs(
args: unknown
): args is LinkedinEmailUserArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.email !== "string" || !obj.email.trim()) return false;
if (obj.count !== undefined && typeof obj.count !== "number") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidLinkedinUserPostsArgs(
args: unknown
): args is LinkedinUserPostsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.urn !== "string" || !obj.urn.trim()) return false;
if (obj.count !== undefined && typeof obj.count !== "number") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidLinkedinUserReactionsArgs(
args: unknown
): args is LinkedinUserReactionsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.urn !== "string" || !obj.urn.trim()) return false;
if (obj.count !== undefined && typeof obj.count !== "number") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidLinkedinUserCommentsArgs(
args: unknown
): args is LinkedinUserCommentsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.urn !== "string" || !obj.urn.trim()) return false;
if (obj.count !== undefined && typeof obj.count !== "number") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
if (obj.commented_after !== undefined && typeof obj.commented_after !== "number") return false;
return true;
}
export function isValidLinkedinChatMessagesArgs(
args: unknown
): args is LinkedinChatMessagesArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.user !== "string" || !obj.user.trim()) return false;
if (obj.company !== undefined && typeof obj.company !== "string") return false;
if (obj.count !== undefined && typeof obj.count !== "number") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidSendLinkedinChatMessageArgs(
args: unknown
): args is SendLinkedinChatMessageArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.user !== "string" || !obj.user.trim()) return false;
if (obj.company !== undefined && typeof obj.company !== "string") return false;
if (typeof obj.text !== "string" || !obj.text.trim()) return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidSendLinkedinConnectionArgs(
args: unknown
): args is SendLinkedinConnectionArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.user !== "string" || !obj.user.trim()) return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidSendLinkedinPostCommentArgs(
args: unknown
): args is SendLinkedinPostCommentArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.text !== "string" || !obj.text.trim()) return false;
if (typeof obj.urn !== "string" || !obj.urn.trim()) return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidGetLinkedinUserConnectionsArgs(
args: unknown
): args is GetLinkedinUserConnectionsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (obj.connected_after !== undefined && typeof obj.connected_after !== "number") return false;
if (obj.count !== undefined && typeof obj.count !== "number") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidGetLinkedinPostRepostsArgs(
args: unknown
): args is GetLinkedinPostRepostsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.urn !== "string" || !obj.urn.includes("activity:")) return false;
if (obj.count !== undefined && typeof obj.count !== "number") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidGetLinkedinPostCommentsArgs(
args: unknown
): args is GetLinkedinPostCommentsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.urn !== "string" || !obj.urn.includes("activity:")) return false;
if (obj.sort !== undefined && obj.sort !== "relevance" && obj.sort !== "recent") return false;
if (obj.count !== undefined && typeof obj.count !== "number") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidGetLinkedinPostReactionsArgs(
args: unknown
): args is GetLinkedinPostReactionsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.urn !== "string" || !obj.urn.includes("activity:")) return false;
if (obj.count !== undefined && typeof obj.count !== "number") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidGetLinkedinGoogleCompanyArgs(
args: unknown
): args is GetLinkedinGoogleCompanyArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (!Array.isArray(obj.keywords) || obj.keywords.length === 0) return false;
if (obj.with_urn !== undefined && typeof obj.with_urn !== "boolean") return false;
if (
obj.count_per_keyword !== undefined &&
(typeof obj.count_per_keyword !== "number" ||
obj.count_per_keyword < 1 ||
obj.count_per_keyword > 10)
) {
return false;
}
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidGetLinkedinCompanyArgs(
args: unknown
): args is GetLinkedinCompanyArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.company !== "string" || !obj.company.trim()) return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidGetLinkedinCompanyEmployeesArgs(
args: unknown
): args is GetLinkedinCompanyEmployeesArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
// companies (обязательный массив строк)
if (!Array.isArray(obj.companies) || obj.companies.length === 0) return false;
for (const c of obj.companies) {
if (typeof c !== "string") return false;
}
if (obj.keywords !== undefined && typeof obj.keywords !== "string") return false;
if (obj.first_name !== undefined && typeof obj.first_name !== "string") return false;
if (obj.last_name !== undefined && typeof obj.last_name !== "string") return false;
if (obj.count !== undefined && typeof obj.count !== "number") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidSendLinkedinPostArgs(
args: unknown
): args is SendLinkedinPostArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.text !== "string" || !obj.text.trim()) return false;
if (obj.visibility !== undefined &&
obj.visibility !== "ANYONE" &&
obj.visibility !== "CONNECTIONS_ONLY") return false;
if (obj.comment_scope !== undefined &&
obj.comment_scope !== "ALL" &&
obj.comment_scope !== "CONNECTIONS_ONLY" &&
obj.comment_scope !== "NONE") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidLinkedinSalesNavigatorSearchUsersArgs(
args: unknown
): args is LinkedinSalesNavigatorSearchUsersArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.count !== "number" || obj.count <= 0 || obj.count > 2500) return false;
if (obj.keywords !== undefined && typeof obj.keywords !== "string") return false;
if (obj.first_names !== undefined) {
if (!Array.isArray(obj.first_names)) return false;
for (const name of obj.first_names) {
if (typeof name !== "string") return false;
}
}
if (obj.last_names !== undefined) {
if (!Array.isArray(obj.last_names)) return false;
for (const name of obj.last_names) {
if (typeof name !== "string") return false;
}
}
if (obj.current_titles !== undefined) {
if (!Array.isArray(obj.current_titles)) return false;
for (const title of obj.current_titles) {
if (typeof title !== "string") return false;
}
}
if (obj.location !== undefined) {
if (typeof obj.location !== "string" && !Array.isArray(obj.location)) return false;
if (Array.isArray(obj.location)) {
for (const loc of obj.location) {
if (typeof loc !== "string") return false;
}
}
}
if (obj.education !== undefined) {
if (typeof obj.education !== "string" && !Array.isArray(obj.education)) return false;
if (Array.isArray(obj.education)) {
for (const edu of obj.education) {
if (typeof edu !== "string") return false;
}
}
}
if (obj.languages !== undefined) {
if (!Array.isArray(obj.languages)) return false;
for (const lang of obj.languages) {
if (typeof lang !== "string") return false;
}
}
if (obj.past_titles !== undefined) {
if (!Array.isArray(obj.past_titles)) return false;
for (const title of obj.past_titles) {
if (typeof title !== "string") return false;
}
}
if (obj.functions !== undefined) {
if (!Array.isArray(obj.functions)) return false;
for (const func of obj.functions) {
if (typeof func !== "string") return false;
}
}
if (obj.levels !== undefined) {
if (!Array.isArray(obj.levels)) return false;
for (const level of obj.levels) {
if (typeof level !== "string") return false;
}
}
if (obj.years_in_the_current_company !== undefined) {
if (!Array.isArray(obj.years_in_the_current_company)) return false;
for (const years of obj.years_in_the_current_company) {
if (typeof years !== "string") return false;
}
}
if (obj.years_in_the_current_position !== undefined) {
if (!Array.isArray(obj.years_in_the_current_position)) return false;
for (const years of obj.years_in_the_current_position) {
if (typeof years !== "string") return false;
}
}
if (obj.company_sizes !== undefined) {
if (!Array.isArray(obj.company_sizes)) return false;
for (const size of obj.company_sizes) {
if (typeof size !== "string") return false;
}
}
if (obj.company_types !== undefined) {
if (!Array.isArray(obj.company_types)) return false;
for (const type of obj.company_types) {
if (typeof type !== "string") return false;
}
}
if (obj.company_locations !== undefined) {
if (typeof obj.company_locations !== "string" && !Array.isArray(obj.company_locations)) return false;
if (Array.isArray(obj.company_locations)) {
for (const loc of obj.company_locations) {
if (typeof loc !== "string") return false;
}
}
}
if (obj.current_companies !== undefined) {
if (typeof obj.current_companies !== "string" && !Array.isArray(obj.current_companies)) return false;
if (Array.isArray(obj.current_companies)) {
for (const company of obj.current_companies) {
if (typeof company !== "string") return false;
}
}
}
if (obj.past_companies !== undefined) {
if (typeof obj.past_companies !== "string" && !Array.isArray(obj.past_companies)) return false;
if (Array.isArray(obj.past_companies)) {
for (const company of obj.past_companies) {
if (typeof company !== "string") return false;
}
}
}
if (obj.industry !== undefined) {
if (typeof obj.industry !== "string" && !Array.isArray(obj.industry)) return false;
if (Array.isArray(obj.industry)) {
for (const ind of obj.industry) {
if (typeof ind !== "string") return false;
}
}
}
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidLinkedinManagementConversationsArgs(
args: unknown
): args is LinkedinManagementConversationsPayload {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (obj.connected_after !== undefined && typeof obj.connected_after !== "number") return false;
if (obj.count !== undefined && typeof obj.count !== "number") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}
export function isValidGoogleSearchPayload(
args: unknown
): args is GoogleSearchPayload {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.query !== "string" || !obj.query.trim()) return false;
if (obj.count !== undefined && (typeof obj.count !== "number" || obj.count <= 0 || obj.count > 20)) return false;
if (obj.timeout !== undefined && (typeof obj.timeout !== "number" || obj.timeout < 20 || obj.timeout > 1500)) return false;
return true;
}
export function isValidLinkedinSearchPostsArgs(
args: unknown
): args is LinkedinSearchPostsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.count !== "number" || obj.count <= 0) return false;
if (obj.timeout !== undefined && (typeof obj.timeout !== "number" || obj.timeout < 20 || obj.timeout > 1500)) return false;
if (obj.keywords !== undefined && typeof obj.keywords !== "string") return false;
if (obj.sort !== undefined && obj.sort !== "relevance") return false;
if (obj.date_posted !== undefined &&
obj.date_posted !== "past-month" &&
obj.date_posted !== "past-week" &&
obj.date_posted !== "past-24h") return false;
if (obj.content_type !== undefined && obj.content_type !== null &&
obj.content_type !== "videos" &&
obj.content_type !== "photos" &&
obj.content_type !== "jobs" &&
obj.content_type !== "live_videos" &&
obj.content_type !== "documents") return false;
if (obj.mentioned !== undefined && obj.mentioned !== null && !Array.isArray(obj.mentioned)) return false;
if (obj.authors !== undefined && obj.authors !== null && !Array.isArray(obj.authors)) return false;
if (obj.author_industries !== undefined && obj.author_industries !== null) {
if (typeof obj.author_industries !== "string" && !Array.isArray(obj.author_industries)) return false;
}
if (obj.author_title !== undefined && obj.author_title !== null && typeof obj.author_title !== "string") return false;
return true;
}
export function isValidRedditSearchPostsArgs(
args: unknown
): args is RedditSearchPostsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.query !== "string" || !obj.query.trim()) return false;
if (typeof obj.count !== "number" || obj.count <= 0) return false;
if (obj.timeout !== undefined && (typeof obj.timeout !== "number" || obj.timeout < 20 || obj.timeout > 1500)) return false;
if (obj.sort !== undefined &&
obj.sort !== "relevance" &&
obj.sort !== "hot" &&
obj.sort !== "top" &&
obj.sort !== "new" &&
obj.sort !== "comments") return false;
if (obj.time_filter !== undefined &&
obj.time_filter !== "all" &&
obj.time_filter !== "year" &&
obj.time_filter !== "month" &&
obj.time_filter !== "week" &&
obj.time_filter !== "day" &&
obj.time_filter !== "hour") return false;
return true;
}
export function isValidRedditPostsArgs(
args: unknown
): args is RedditPostsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.post_url !== "string" || !obj.post_url.trim()) return false;
if (obj.timeout !== undefined && (typeof obj.timeout !== "number" || obj.timeout < 20 || obj.timeout > 1500)) return false;
return true;
}
export function isValidRedditPostCommentsArgs(
args: unknown
): args is RedditPostCommentsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.post_url !== "string" || !obj.post_url.trim()) return false;
if (obj.timeout !== undefined && (typeof obj.timeout !== "number" || obj.timeout < 20 || obj.timeout > 1500)) return false;
return true;
}
// Instagram validation functions
export function isValidInstagramUserArgs(
args: unknown
): args is InstagramUserArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.user !== "string" || !obj.user.trim()) return false;
if (obj.timeout !== undefined && (typeof obj.timeout !== "number" || obj.timeout < 20 || obj.timeout > 1500)) return false;
return true;
}
export function isValidInstagramUserPostsArgs(
args: unknown
): args is InstagramUserPostsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.user !== "string" || !obj.user.trim()) return false;
if (typeof obj.count !== "number" || obj.count <= 0) return false;
if (obj.timeout !== undefined && (typeof obj.timeout !== "number" || obj.timeout < 20 || obj.timeout > 1500)) return false;
return true;
}
export function isValidInstagramPostCommentsArgs(
args: unknown
): args is InstagramPostCommentsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.post !== "string" || !obj.post.trim()) return false;
if (typeof obj.count !== "number" || obj.count <= 0) return false;
if (obj.timeout !== undefined && (typeof obj.timeout !== "number" || obj.timeout < 20 || obj.timeout > 1500)) return false;
return true;
}
export function isValidLinkedinCompanyPostsArgs(
args: unknown
): args is LinkedinCompanyPostsArgs {
if (typeof args !== "object" || args === null) return false;
const obj = args as Record<string, unknown>;
if (typeof obj.urn !== "string" || !obj.urn.trim()) return false;
if (!obj.urn.includes("company:")) return false;
if (obj.count !== undefined && typeof obj.count !== "number") return false;
if (obj.timeout !== undefined && typeof obj.timeout !== "number") return false;
return true;
}