n8n-nodes-instagram-private-api-wrapped
Version:
n8n community node for Instagram automation using private API capabilities
67 lines (66 loc) • 1.97 kB
TypeScript
import { RetryOptions } from './types';
/**
* Utility functions for Instagram n8n integration
*/
export declare class Utils {
/**
* Execute a function with retry logic and exponential backoff
*/
static executeWithRetry<T>(operation: () => Promise<T>, options?: Partial<RetryOptions>): Promise<T>;
/**
* Create a delay promise
*/
static delay(ms: number): Promise<void>;
/**
* Sanitize text input to prevent issues with Instagram API
*/
static sanitizeText(text: string): string;
/**
* Generate random delay to avoid rate limiting
*/
static randomDelay(min?: number, max?: number): Promise<void>;
/**
* Formats error messages consistently
*/
static formatError(error: any): string;
/**
* Validates username format
*/
static validateUsername(username: string): boolean;
/**
* Validates hashtag format
*/
static validateHashtag(hashtag: string): string;
/**
* Validates image buffer
*/
static validateImageBuffer(buffer: Buffer): boolean;
/**
* Validates and formats media ID
*/
static validateMediaId(mediaId: string): string;
/**
* Extracts user ID from Instagram URL
*/
static extractUserIdFromUrl(url: string): string | null;
/**
* Formats timestamp to human readable date
*/
static formatTimestamp(timestamp: number): string;
/**
* Validates and limits numeric values
*/
static validateLimit(limit: number | undefined, defaultValue: number, maxValue: number): number;
/**
* Creates a retry mechanism for API calls
*/
static retry<T>(operation: () => Promise<T>, maxRetries?: number, baseDelay?: number): Promise<T>;
/**
* Checks if error is rate limit related
*/
static isRateLimitError(error: any): boolean;
/**
* Generates a unique request ID for tracking
*/
static generateRequestId(): string;
}