// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../../core/resource'; import * as VideoScriptAPI from './video-script'; import { VideoScript, VideoScriptRegenerateParams, VideoScriptRegenerateResponse, VideoScriptRetrieveParams, VideoScriptRetrieveResponse, } from './video-script'; import { APIPromise } from '../../../../core/api-promise'; import { RequestOptions } from '../../../../internal/request-options'; import { path } from '../../../../internal/utils/path'; export class Leads extends APIResource { videoScript: VideoScriptAPI.VideoScript = new VideoScriptAPI.VideoScript(this._client); /** * Approve a campaign lead offer with a selected deliverable deadline. The creator * accepts the campaign invitation, selects their delivery date, and a deal is * created. A scheduled bonus is automatically calculated and added to the * creator's balance based on their selected delivery date (Day 1: $10, Day 2: $8, * Day 3: $6, Day 4: $4, Day 5: $2). This endpoint is idempotent - approving an * already approved lead returns the existing deal information. Once approved, the * creator can start creating deliverables for the campaign. A PREPARE_VIDEO_SCRIPT * event is published for notification purposes. * * @example * ```ts * const response = * await client.creators.campaigns.leads.approve( * '550e8400-e29b-41d4-a716-446655440001', * { * id: '550e8400-e29b-41d4-a716-446655440000-instagram', * deliverableDeadline: '2024-01-15', * }, * ); * ``` */ approve( leadID: string, params: LeadApproveParams, options?: RequestOptions, ): APIPromise { const { id, ...body } = params; return this._client.post(path`/creators/campaigns/${id}/leads/${leadID}/approve`, { body, ...options }); } /** * Reject a campaign lead offer with a specific reason. If the reason is "the price * is too low" and a counter offer price is provided, the system will create a * counter offer and keep the lead in pending status. For other rejection reasons * like "i dont want this offer", the lead will be marked as rejected and closed * definitively. * * @example * ```ts * const response = * await client.creators.campaigns.leads.reject( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { id: 'x', reason: 'price_too_low' }, * ); * ``` */ reject(leadID: string, params: LeadRejectParams, options?: RequestOptions): APIPromise { const { id, ...body } = params; return this._client.post(path`/creators/campaigns/${id}/leads/${leadID}/reject`, { body, ...options }); } } export interface LeadApproveResponse { data: LeadApproveResponse.Data; /** * Success message */ message: string; /** * Indicates if the approval was successful */ success: boolean; } export namespace LeadApproveResponse { export interface Data { /** * Campaign ID */ campaignId: string; /** * Campaign deadline for deliverables */ deadline: string; /** * Created deal ID */ dealId: string; /** * Approved lead ID */ leadId: string; /** * New lead status after approval */ status: 'accepted'; } } export interface LeadRejectResponse { leadId: string; message: string; reasonRejected: | 'price_too_low' | 'dont_want_offer' | 'not_aligned_with_brand' | 'timing_conflict' | 'other'; rejectedAt: string; status: 'rejected' | 'counteroffer'; counterOfferPrice?: number; negotiationRound?: number; } export interface LeadApproveParams { /** * Path param: Campaign ID or Virtual Campaign ID (with platform suffix) */ id: string; /** * Body param: Deliverable deadline selected by the creator (YYYY-MM-DD format) */ deliverableDeadline: string; } export interface LeadRejectParams { /** * Path param: */ id: string; /** * Body param: */ reason: 'price_too_low' | 'dont_want_offer' | 'not_aligned_with_brand' | 'timing_conflict' | 'other'; /** * Body param: */ additionalNotes?: string; } Leads.VideoScript = VideoScript; export declare namespace Leads { export { type LeadApproveResponse as LeadApproveResponse, type LeadRejectResponse as LeadRejectResponse, type LeadApproveParams as LeadApproveParams, type LeadRejectParams as LeadRejectParams, }; export { VideoScript as VideoScript, type VideoScriptRetrieveResponse as VideoScriptRetrieveResponse, type VideoScriptRegenerateResponse as VideoScriptRegenerateResponse, type VideoScriptRetrieveParams as VideoScriptRetrieveParams, type VideoScriptRegenerateParams as VideoScriptRegenerateParams, }; }