// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import { APIPromise } from '../../core/api-promise'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; export class Leads extends APIResource { /** * Retrieve up to 5 unique influencers associated with a specific campaign. * Deduplicates leads by influencer to prevent showing the same influencer multiple * times (e.g., when they have accounts on multiple platforms). Returns influencer * information including name, handle, followers count, and avatar. * * @example * ```ts * const leads = await client.campaigns.leads.list( * '123e4567-e89b-12d3-a456-426614174000', * ); * ``` */ list(id: string, options?: RequestOptions): APIPromise { return this._client.get(path`/campaigns/${id}/leads`, options); } /** * Get comprehensive lead overview statistics including total invited, total * accepted, and acceptance ratio with time-based filtering options (this week, * this month, year to date, all time). * * @example * ```ts * const response = await client.campaigns.leads.overview(); * ``` */ overview( query: LeadOverviewParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get('/campaigns/leads/overview', { query, ...options }); } } /** * Response schema for retrieving unique campaign influencers */ export interface LeadListResponse { /** * Number of unique influencers returned */ count: number; /** * Array of unique influencers (deduplicates leads by influencer) */ influencers: Array; } export namespace LeadListResponse { /** * Influencer information for a campaign */ export interface Influencer { /** * Unique identifier for the influencer */ id: string; /** * URL to the influencer's avatar image */ avatar: string; /** * Number of followers */ followers: number; /** * Social media handle of the influencer */ handle: string; /** * Name of the influencer */ name: string; } } /** * Response schema for lead overview statistics */ export interface LeadOverviewResponse { /** * Acceptance ratio as a percentage (0-100) */ acceptanceRatio: number; /** * Applied time filter */ timeFilter: string; /** * Total number of leads accepted */ totalAccepted: number; /** * Total number of leads invited */ totalInvited: number; } export interface LeadOverviewParams { /** * Time filter for lead statistics */ timeFilter?: 'this_month' | 'this_week' | 'year_to_date' | 'all_time'; } export declare namespace Leads { export { type LeadListResponse as LeadListResponse, type LeadOverviewResponse as LeadOverviewResponse, type LeadOverviewParams as LeadOverviewParams, }; }