// 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 Deliverables extends APIResource { /** * Update a deliverable with a link to the published content on social media * platforms (Instagram, TikTok, YouTube, etc.). The link must be a valid URL * pointing to where the content was published. This allows brands to track and * verify the published content. * * @example * ```ts * const deliverable = * await client.creators.campaigns.deliverables.update( * '456e7890-e12b-34c5-d678-901234567890', * { * id: '123e4567-e89b-12d3-a456-426614174000', * deliverableLink: * 'https://www.instagram.com/p/ABC123/', * }, * ); * ``` */ update( deliverableID: string, params: DeliverableUpdateParams, options?: RequestOptions, ): APIPromise { const { id, ...body } = params; return this._client.put(path`/creators/campaigns/${id}/deliverables/${deliverableID}`, { body, ...options, }); } /** * Get all deliverables for a specific campaign that belong to the authenticated * creator. Only returns deliverables created by the current user. * * @example * ```ts * const deliverables = * await client.creators.campaigns.deliverables.list( * '123e4567-e89b-12d3-a456-426614174000-instagram', * ); * ``` */ list(id: string, options?: RequestOptions): APIPromise { return this._client.get(path`/creators/campaigns/${id}/deliverables`, options); } /** * Delete a specific deliverable that belongs to the authenticated creator. Only * deliverables that have not been approved can be deleted. The deliverable must * belong to both the specified campaign and the current user. * * @example * ```ts * const deliverable = * await client.creators.campaigns.deliverables.delete( * '456e7890-e12b-34c5-d678-901234567890', * { id: '123e4567-e89b-12d3-a456-426614174000' }, * ); * ``` */ delete( did: string, params: DeliverableDeleteParams, options?: RequestOptions, ): APIPromise { const { id } = params; return this._client.delete(path`/creators/campaigns/${id}/deliverables/${did}`, options); } /** * Generate a pre-signed URL for uploading campaign deliverable assets. The URL * allows direct upload to cloud storage in the campaign-specific directory with a * unique deliverable ID. * * @example * ```ts * const response = * await client.creators.campaigns.deliverables.generateUploadURL( * '550e8400-e29b-41d4-a716-446655440000-instagram', * { fileName: 'my-deliverable-video.mp4' }, * ); * ``` */ generateUploadURL( id: string, body: DeliverableGenerateUploadURLParams, options?: RequestOptions, ): APIPromise { return this._client.post(path`/creators/campaigns/${id}/deliverables/upload-url`, { body, ...options }); } /** * Submit uploaded deliverable assets for brand review. Creator must acknowledge * terms and provide list of uploaded file keys. Creates or updates a deliverable * record with pending status. * * @example * ```ts * const response = * await client.creators.campaigns.deliverables.submitForReview( * '550e8400-e29b-41d4-a716-446655440000-instagram', * { * contentType: 'post', * platform: 'instagram', * readTerms: true, * uploadedKeys: [ * 'campaigns/123/deliverables/abc-def-456.mp4', * 'campaigns/123/deliverables/abc-def-789.jpg', * ], * }, * ); * ``` */ submitForReview( id: string, body: DeliverableSubmitForReviewParams, options?: RequestOptions, ): APIPromise { return this._client.post(path`/creators/campaigns/${id}/deliverables/submit-review`, { body, ...options, }); } } /** * Response schema for updating creator campaign deliverable with link */ export interface DeliverableUpdateResponse { /** * ID of the deliverable that was updated */ id: string; /** * The updated deliverable link */ deliverableLink: string; /** * Confirmation message */ message: string; } /** * List of deliverables for a creator campaign */ export type DeliverableListResponse = Array; export namespace DeliverableListResponse { /** * Complete deliverable information */ export interface DeliverableListResponseItem { /** * Unique identifier for the deliverable */ id: string; /** * Unique identifier of the campaign this deliverable belongs to */ campaignId: string; /** * Type of content being delivered */ contentType: 'post' | 'story' | 'reel' | 'video' | 'live'; /** * URL link to the published deliverable (Instagram, TikTok, YouTube, etc.) */ deliverableLink: string | null; /** * S3 key for the deliverable file */ fileUrl: string | null; /** * Unique identifier of the influencer who created this deliverable */ influencerId: string; /** * Additional notes about the deliverable */ notes: string | null; /** * Social media platform where the content will be published */ platform: 'instagram' | 'youtube' | 'tiktok' | 'facebook' | 'twitter'; /** * Reason for rejection if the deliverable was rejected */ rejectReason: string | null; /** * ISO 8601 timestamp of when the deliverable was last reviewed by admin or brand */ reviewedAt: string | null; /** * Current status of the deliverable */ status: 'pending' | 'pending_admin_approval' | 'pending_brand_approval' | 'approved' | 'rejected'; /** * ISO 8601 timestamp of when the deliverable was uploaded */ uploadedAt: string; /** * Profile picture URL of the influencer */ influencerAvatar?: string | null; /** * Handle of the influencer who created this deliverable */ influencerHandle?: string; /** * Name of the influencer who created this deliverable */ influencerName?: string; } } /** * Response schema for deleting creator campaign deliverable */ export interface DeliverableDeleteResponse { /** * ID of the deliverable that was deleted */ deletedId: string; /** * Confirmation message */ message: string; } export interface DeliverableGenerateUploadURLResponse { data: DeliverableGenerateUploadURLResponse.Data; /** * Indicates if the request was successful */ success: boolean; } export namespace DeliverableGenerateUploadURLResponse { export interface Data { /** * URL expiration time in seconds */ expiresIn: number; /** * The S3 key where the file will be stored */ key: string; /** * Pre-signed S3 URL for direct upload */ url: string; } } export interface DeliverableSubmitForReviewResponse { /** * Array of created deliverables - one per uploaded file */ data: Array; /** * Success message */ message: string; /** * Indicates if the submission was successful */ success: boolean; } export namespace DeliverableSubmitForReviewResponse { /** * Complete deliverable information */ export interface Data { /** * Unique identifier for the deliverable */ id: string; /** * Unique identifier of the campaign this deliverable belongs to */ campaignId: string; /** * Type of content being delivered */ contentType: 'post' | 'story' | 'reel' | 'video' | 'live'; /** * URL link to the published deliverable (Instagram, TikTok, YouTube, etc.) */ deliverableLink: string | null; /** * S3 key for the deliverable file */ fileUrl: string | null; /** * Unique identifier of the influencer who created this deliverable */ influencerId: string; /** * Additional notes about the deliverable */ notes: string | null; /** * Social media platform where the content will be published */ platform: 'instagram' | 'youtube' | 'tiktok' | 'facebook' | 'twitter'; /** * Reason for rejection if the deliverable was rejected */ rejectReason: string | null; /** * ISO 8601 timestamp of when the deliverable was last reviewed by admin or brand */ reviewedAt: string | null; /** * Current status of the deliverable */ status: 'pending' | 'pending_admin_approval' | 'pending_brand_approval' | 'approved' | 'rejected'; /** * ISO 8601 timestamp of when the deliverable was uploaded */ uploadedAt: string; /** * Profile picture URL of the influencer */ influencerAvatar?: string | null; /** * Handle of the influencer who created this deliverable */ influencerHandle?: string; /** * Name of the influencer who created this deliverable */ influencerName?: string; } } export interface DeliverableUpdateParams { /** * Path param: Unique identifier of the campaign */ id: string; /** * Body param: URL link to the published deliverable (Instagram, TikTok, YouTube, * etc.) */ deliverableLink: string; } export interface DeliverableDeleteParams { /** * Unique identifier of the campaign */ id: string; } export interface DeliverableGenerateUploadURLParams { /** * The filename with extension for the asset to be uploaded */ fileName: string; } export interface DeliverableSubmitForReviewParams { /** * Type of content being delivered */ contentType: 'post' | 'story' | 'reel' | 'video' | 'live'; /** * Social media platform where the content will be published */ platform: 'instagram' | 'youtube' | 'tiktok' | 'facebook' | 'twitter'; /** * Confirmation that creator has read and agrees to terms */ readTerms: true; /** * List of S3 keys for uploaded deliverable files - each key creates a separate * deliverable */ uploadedKeys: Array; /** * Optional notes from creator about the deliverables */ notes?: string; } export declare namespace Deliverables { export { type DeliverableUpdateResponse as DeliverableUpdateResponse, type DeliverableListResponse as DeliverableListResponse, type DeliverableDeleteResponse as DeliverableDeleteResponse, type DeliverableGenerateUploadURLResponse as DeliverableGenerateUploadURLResponse, type DeliverableSubmitForReviewResponse as DeliverableSubmitForReviewResponse, type DeliverableUpdateParams as DeliverableUpdateParams, type DeliverableDeleteParams as DeliverableDeleteParams, type DeliverableGenerateUploadURLParams as DeliverableGenerateUploadURLParams, type DeliverableSubmitForReviewParams as DeliverableSubmitForReviewParams, }; }