@stack0/sdk 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { Mail } from './mail/index.js';
2
2
  export { AddContactToSequenceRequest, AddContactsToAudienceRequest, AddContactsToAudienceResponse, AddDomainRequest, AddDomainResponse, ArchiveSequenceResponse, Attachment, Audience, AudienceContact, Audiences, BatchTrackEventsRequest, BatchTrackEventsResponse, Campaign, CampaignStatsResponse, CampaignStatus, Campaigns, CancelCampaignResponse, CancelEmailResponse, ConnectionType, ContactStatus, Contacts, CreateAudienceRequest, CreateCampaignRequest, CreateConnectionRequest, CreateContactRequest, CreateEventRequest, CreateNodeRequest, CreateSequenceRequest, CreateTemplateRequest, DeleteAudienceResponse, DeleteCampaignResponse, DeleteConnectionResponse, DeleteContactResponse, DeleteDomainResponse, DeleteEventResponse, DeleteNodeResponse, DeleteSequenceResponse, DeleteTemplateResponse, DnsRecord, Domain, DomainStatus, Domains, Email, EmailAddress, EmailAnalyticsResponse, EmailRecipient, EmailStatus, EventAnalyticsResponse, EventOccurrence, EventPropertiesSchema, EventProperty, Events, GetDnsRecordsResponse, GetEmailResponse, HourlyAnalyticsDataPoint, HourlyAnalyticsResponse, ImportContactsRequest, ImportContactsResponse, ListAudienceContactsRequest, ListAudienceContactsResponse, ListAudiencesRequest, ListAudiencesResponse, ListCampaignsRequest, ListCampaignsResponse, ListContactsRequest, ListContactsResponse, ListDomainsRequest, ListDomainsResponse, ListEmailsRequest, ListEmailsResponse, ListEventOccurrencesRequest, ListEventOccurrencesResponse, ListEventsRequest, ListEventsResponse, ListSendersRequest, ListSendersResponse, ListSequenceEntriesRequest, ListSequenceEntriesResponse, ListSequencesRequest, ListSequencesResponse, ListTemplatesRequest, ListTemplatesResponse, MailContact, MailEvent, PauseCampaignResponse, PauseSequenceResponse, PreviewTemplateRequest, PreviewTemplateResponse, PublishSequenceResponse, RemoveContactFromSequenceRequest, RemoveContactFromSequenceResponse, RemoveContactsFromAudienceRequest, RemoveContactsFromAudienceResponse, ResendEmailResponse, ResumeSequenceResponse, SendBatchEmailRequest, SendBatchEmailResponse, SendBroadcastEmailRequest, SendBroadcastEmailResponse, SendCampaignRequest, SendCampaignResponse, SendEmailRequest, SendEmailResponse, Sender, Sequence, SequenceAnalyticsResponse, SequenceConnection, SequenceEntry, SequenceEntryStatus, SequenceNode, SequenceNodeType, SequenceStatus, SequenceTriggerFrequency, SequenceTriggerType, SequenceWithNodes, Sequences, SetDefaultDomainResponse, SetNodeBranchRequest, SetNodeEmailRequest, SetNodeExperimentRequest, SetNodeFilterRequest, SetNodeTimerRequest, Template, Templates, TimeSeriesAnalyticsRequest, TimeSeriesAnalyticsResponse, TimeSeriesDataPoint, TrackEventRequest, TrackEventResponse, UpdateAudienceRequest, UpdateCampaignRequest, UpdateContactRequest, UpdateEventRequest, UpdateNodePositionRequest, UpdateNodeRequest, UpdateSequenceRequest, UpdateTemplateRequest, VerifyDomainResponse } from './mail/index.js';
3
3
  import { CDN } from './cdn/index.js';
4
- export { Asset, AssetStatus, AssetType, BundleDownloadUrlRequest, BundleDownloadUrlResponse, BundleStatus, ConfirmUploadRequest, ConfirmUploadResponse, CreateBundleRequest, CreateBundleResponse, CreateFolderRequest, DeleteAssetRequest, DeleteAssetsRequest, DeleteAssetsResponse, DownloadBundle, ExtractAudioRequest, ExtractAudioResponse, Folder, FolderTreeNode, GetAssetRequest, GetFolderTreeRequest, ListAssetsRequest, ListAssetsResponse, ListBundlesRequest, ListBundlesResponse, ListJobsRequest, ListJobsResponse, ListPrivateFilesRequest, ListPrivateFilesResponse, MoveAssetsRequest, MoveAssetsResponse, PrivateDownloadUrlRequest, PrivateDownloadUrlResponse, PrivateFile, PrivateFileStatus, PrivateUploadUrlRequest, PrivateUploadUrlResponse, RegenerateThumbnailRequest, RegenerateThumbnailResponse, StreamingUrls, ThumbnailRequest, ThumbnailResponse, TranscodeJob, TranscodeVideoRequest, TranscodingStatus, TransformOptions, TrimOptions, UpdateAssetRequest, UpdatePrivateFileRequest, UploadUrlRequest, UploadUrlResponse, VideoCodec, VideoOutputFormat, VideoQuality, VideoVariant, WatermarkOptions } from './cdn/index.js';
4
+ export { Asset, AssetStatus, AssetType, BundleDownloadUrlRequest, BundleDownloadUrlResponse, BundleStatus, CdnEnvironment, CdnStorageBreakdownItem, CdnStorageBreakdownRequest, CdnStorageBreakdownResponse, CdnUsageDataPoint, CdnUsageHistoryRequest, CdnUsageHistoryResponse, CdnUsageRequest, CdnUsageResponse, ConfirmUploadRequest, ConfirmUploadResponse, CreateBundleRequest, CreateBundleResponse, CreateFolderRequest, DeleteAssetRequest, DeleteAssetsRequest, DeleteAssetsResponse, DownloadBundle, ExtractAudioRequest, ExtractAudioResponse, Folder, FolderListItem, FolderTreeNode, GetAssetRequest, GetFolderByPathRequest, GetFolderRequest, GetFolderTreeRequest, ListAssetsRequest, ListAssetsResponse, ListBundlesRequest, ListBundlesResponse, ListFoldersRequest, ListFoldersResponse, ListJobsRequest, ListJobsResponse, ListPrivateFilesRequest, ListPrivateFilesResponse, ListThumbnailsRequest, ListThumbnailsResponse, MoveAssetsRequest, MoveAssetsResponse, MoveFolderRequest, MoveFolderResponse, MovePrivateFilesRequest, MovePrivateFilesResponse, PrivateDownloadUrlRequest, PrivateDownloadUrlResponse, PrivateFile, PrivateFileStatus, PrivateUploadUrlRequest, PrivateUploadUrlResponse, RegenerateThumbnailRequest, RegenerateThumbnailResponse, StreamingUrls, ThumbnailRequest, ThumbnailResponse, TranscodeJob, TranscodeVideoRequest, TranscodingStatus, TransformOptions, TrimOptions, UpdateAssetRequest, UpdateFolderRequest, UpdatePrivateFileRequest, UploadUrlRequest, UploadUrlResponse, VideoCodec, VideoOutputFormat, VideoQuality, VideoThumbnail, VideoVariant, WatermarkOptions } from './cdn/index.js';
5
5
  import { Screenshots } from './screenshots/index.js';
6
6
  export { BatchScreenshotJob, Clip, CreateBatchScreenshotsRequest, CreateScreenshotRequest, CreateScreenshotResponse, CreateScreenshotScheduleRequest, DeviceType, GetScreenshotRequest, ListScreenshotsRequest, ListScreenshotsResponse, ResourceType, Screenshot, ScreenshotBatchJobsResponse, ScreenshotFormat, ScreenshotSchedule, ScreenshotSchedulesResponse, ScreenshotStatus, UpdateScreenshotScheduleRequest } from './screenshots/index.js';
7
7
  import { Extraction } from './extraction/index.js';
8
- export { BatchExtractionJob, CreateBatchExtractionsRequest, CreateExtractionRequest, CreateExtractionResponse, CreateExtractionScheduleRequest, ExtractionBatchJobsResponse, ExtractionMode, ExtractionResult, ExtractionSchedule, ExtractionSchedulesResponse, ExtractionStatus, ExtractionUsage, GetExtractionRequest, GetUsageRequest, ListExtractionsRequest, ListExtractionsResponse, PageMetadata, UpdateExtractionScheduleRequest } from './extraction/index.js';
8
+ export { BatchExtractionJob, CreateBatchExtractionsRequest, CreateExtractionRequest, CreateExtractionResponse, CreateExtractionScheduleRequest, DailyUsageItem, ExtractionBatchJobsResponse, ExtractionMode, ExtractionResult, ExtractionSchedule, ExtractionSchedulesResponse, ExtractionStatus, ExtractionUsage, GetDailyUsageResponse, GetExtractionRequest, GetUsageRequest, ListExtractionsRequest, ListExtractionsResponse, PageMetadata, UpdateExtractionScheduleRequest } from './extraction/index.js';
9
9
  import { Webdata } from './webdata/index.js';
10
10
  import { H as HttpClient, a as HttpClientConfig } from './http-client-Cgie_Rv6.js';
11
11
  export { B as BatchJobStatus, C as CreateBatchResponse, e as CreateScheduleResponse, E as Environment, G as GetBatchJobRequest, c as GetScheduleRequest, L as ListBatchJobsRequest, d as ListSchedulesRequest, P as PaginatedRequest, a as PaginatedResponse, b as ScheduleFrequency, S as Stack0Error } from './shared-types-CjKSP5Xc.js';
@@ -349,6 +349,130 @@ interface PassthroughRequest {
349
349
  query?: Record<string, string>;
350
350
  headers?: Record<string, string>;
351
351
  }
352
+ type IntegrationEnvironment = "sandbox" | "production";
353
+ interface InitiateOAuthRequest {
354
+ connectorSlug: string;
355
+ projectId?: string;
356
+ environment?: IntegrationEnvironment;
357
+ name?: string;
358
+ redirectUrl: string;
359
+ }
360
+ interface InitiateOAuthResponse {
361
+ authUrl: string;
362
+ connectionId: string;
363
+ state: string;
364
+ }
365
+ interface CompleteOAuthRequest {
366
+ code: string;
367
+ state: string;
368
+ redirectUrl: string;
369
+ }
370
+ interface CompleteOAuthResponse {
371
+ connectionId: string;
372
+ status: "connected";
373
+ externalAccountId?: string;
374
+ externalAccountName?: string;
375
+ }
376
+ interface ReconnectConnectionRequest {
377
+ connectionId: string;
378
+ redirectUrl: string;
379
+ }
380
+ interface ReconnectConnectionResponse {
381
+ authUrl: string;
382
+ connectionId: string;
383
+ state: string;
384
+ }
385
+ interface UpdateConnectionRequest {
386
+ connectionId: string;
387
+ name?: string;
388
+ }
389
+ interface UpdateConnectionResponse {
390
+ id: string;
391
+ name: string;
392
+ status: Connection["status"];
393
+ }
394
+ interface IntegrationStatsRequest {
395
+ environment?: IntegrationEnvironment;
396
+ }
397
+ interface IntegrationStatsResponse {
398
+ totalConnections: number;
399
+ activeConnections: number;
400
+ errorConnections: number;
401
+ totalApiCalls: number;
402
+ apiCallsLast30Days: number;
403
+ connectorBreakdown: Array<{
404
+ connectorSlug: string;
405
+ connectorName: string;
406
+ connectionCount: number;
407
+ }>;
408
+ }
409
+ interface ListLogsRequest {
410
+ connectionId?: string;
411
+ connectorSlug?: string;
412
+ statusCode?: number;
413
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
414
+ search?: string;
415
+ limit?: number;
416
+ cursor?: string;
417
+ }
418
+ interface ApiLog {
419
+ id: string;
420
+ connectionId: string;
421
+ connectionName: string | null;
422
+ connectorSlug: string | null;
423
+ connectorName: string | null;
424
+ method: string;
425
+ path: string;
426
+ model: string | null;
427
+ operation: string | null;
428
+ statusCode: number;
429
+ errorMessage: string | null;
430
+ requestDurationMs: number;
431
+ createdAt: Date;
432
+ }
433
+ interface ListLogsResponse {
434
+ logs: ApiLog[];
435
+ hasMore: boolean;
436
+ nextCursor?: string;
437
+ }
438
+ interface ConnectionDetails {
439
+ id: string;
440
+ name: string;
441
+ status: Connection["status"];
442
+ environment: IntegrationEnvironment;
443
+ connector: {
444
+ slug: string;
445
+ name: string;
446
+ category: ConnectorCategory;
447
+ logoUrl: string | null;
448
+ supportedModels?: string[];
449
+ } | null;
450
+ externalAccountId: string | null;
451
+ externalAccountName: string | null;
452
+ connectedBy: {
453
+ id: string;
454
+ name: string | null;
455
+ email: string;
456
+ } | null;
457
+ connectedAt: Date | null;
458
+ lastUsedAt: Date | null;
459
+ errorMessage: string | null;
460
+ lastErrorAt: Date | null;
461
+ createdAt: Date;
462
+ updatedAt: Date | null;
463
+ }
464
+ interface ListConnectionsRequest {
465
+ projectId?: string;
466
+ environment?: IntegrationEnvironment;
467
+ connectorSlug?: string;
468
+ status?: Connection["status"];
469
+ limit?: number;
470
+ }
471
+ interface ListConnectionsResponse {
472
+ connections: Array<Omit<ConnectionDetails, "supportedModels" | "lastErrorAt" | "updatedAt">>;
473
+ hasMore: boolean;
474
+ nextCursor?: string;
475
+ }
352
476
 
353
477
  /**
354
478
  * Stack0 Integrations Client
@@ -492,43 +616,101 @@ declare class Integrations {
492
616
  getConnector(slug: string): Promise<Connector>;
493
617
  /**
494
618
  * List all connections
619
+ *
620
+ * @example
621
+ * ```typescript
622
+ * const { connections } = await integrations.listConnections({
623
+ * environment: 'production',
624
+ * status: 'connected',
625
+ * });
626
+ * ```
495
627
  */
496
- listConnections(options?: {
497
- connectorId?: string;
498
- status?: Connection["status"];
499
- }): Promise<Connection[]>;
628
+ listConnections(request?: ListConnectionsRequest): Promise<ListConnectionsResponse>;
500
629
  /**
501
630
  * Get a specific connection
502
631
  */
503
- getConnection(id: string): Promise<Connection>;
632
+ getConnection(connectionId: string): Promise<ConnectionDetails>;
504
633
  /**
505
- * Create a new connection (initiates OAuth flow)
506
- * Returns the OAuth authorization URL to redirect the user to
634
+ * Initiate OAuth flow for a connector
635
+ *
636
+ * @example
637
+ * ```typescript
638
+ * const { authUrl, connectionId, state } = await integrations.initiateOAuth({
639
+ * connectorSlug: 'hubspot',
640
+ * redirectUrl: 'https://yourapp.com/oauth/callback',
641
+ * name: 'My HubSpot Connection',
642
+ * });
643
+ * // Redirect user to authUrl
644
+ * ```
507
645
  */
508
- createConnection(connectorSlug: string, options?: {
509
- name?: string;
510
- projectId?: string;
511
- }): Promise<{
512
- connectionId: string;
513
- authorizationUrl: string;
514
- }>;
646
+ initiateOAuth(request: InitiateOAuthRequest): Promise<InitiateOAuthResponse>;
647
+ /**
648
+ * Complete OAuth flow with callback data
649
+ *
650
+ * @example
651
+ * ```typescript
652
+ * const result = await integrations.completeOAuth({
653
+ * code: 'auth_code_from_callback',
654
+ * state: 'state_from_initiate',
655
+ * redirectUrl: 'https://yourapp.com/oauth/callback',
656
+ * });
657
+ * console.log(`Connected to: ${result.externalAccountName}`);
658
+ * ```
659
+ */
660
+ completeOAuth(request: CompleteOAuthRequest): Promise<CompleteOAuthResponse>;
661
+ /**
662
+ * Update a connection
663
+ */
664
+ updateConnection(request: UpdateConnectionRequest): Promise<UpdateConnectionResponse>;
515
665
  /**
516
666
  * Delete a connection
517
667
  */
518
- deleteConnection(id: string): Promise<{
668
+ deleteConnection(connectionId: string): Promise<{
519
669
  success: boolean;
520
670
  }>;
521
671
  /**
522
- * Test a connection's credentials
672
+ * Reconnect an expired or errored connection
673
+ *
674
+ * @example
675
+ * ```typescript
676
+ * const { authUrl, state } = await integrations.reconnectConnection({
677
+ * connectionId: 'conn_123',
678
+ * redirectUrl: 'https://yourapp.com/oauth/callback',
679
+ * });
680
+ * // Redirect user to authUrl
681
+ * ```
523
682
  */
524
- testConnection(id: string): Promise<{
525
- success: boolean;
526
- error?: string;
527
- }>;
683
+ reconnectConnection(request: ReconnectConnectionRequest): Promise<ReconnectConnectionResponse>;
684
+ /**
685
+ * Get integration statistics
686
+ *
687
+ * @example
688
+ * ```typescript
689
+ * const stats = await integrations.getStats({ environment: 'production' });
690
+ * console.log(`Active connections: ${stats.activeConnections}`);
691
+ * console.log(`API calls last 30 days: ${stats.apiCallsLast30Days}`);
692
+ * ```
693
+ */
694
+ getStats(request?: IntegrationStatsRequest): Promise<IntegrationStatsResponse>;
695
+ /**
696
+ * List API logs
697
+ *
698
+ * @example
699
+ * ```typescript
700
+ * const { logs } = await integrations.listLogs({
701
+ * connectionId: 'conn_123',
702
+ * limit: 50,
703
+ * });
704
+ * ```
705
+ */
706
+ listLogs(request?: ListLogsRequest): Promise<ListLogsResponse>;
528
707
  /**
529
708
  * Make a raw passthrough request to the provider API
530
709
  */
531
710
  passthrough(request: PassthroughRequest): Promise<unknown>;
711
+ private convertConnectionDates;
712
+ private convertConnectionDetailsDates;
713
+ private convertLogDates;
532
714
  }
533
715
 
534
716
  /**
@@ -775,6 +957,260 @@ interface ContentPerformanceItem {
775
957
  engagementRate: number;
776
958
  }
777
959
  type ContentPerformanceResponse = ContentPerformanceItem[];
960
+ interface UpdateTrendStatusRequest {
961
+ trendId: string;
962
+ status: TrendStatus;
963
+ }
964
+ interface UpdateTrendStatusResponse {
965
+ success: boolean;
966
+ }
967
+ interface UpdateScriptRequest {
968
+ scriptId: string;
969
+ hook?: string;
970
+ slides?: ScriptSlide[];
971
+ cta?: string;
972
+ }
973
+ interface CreateScriptVersionRequest {
974
+ scriptId: string;
975
+ hook: string;
976
+ slides: ScriptSlide[];
977
+ cta: string;
978
+ prompt?: string;
979
+ model?: string;
980
+ tokensUsed?: number;
981
+ generationTimeMs?: number;
982
+ }
983
+ interface DeleteScriptResponse {
984
+ success: boolean;
985
+ }
986
+ interface CalendarEntry {
987
+ id: string;
988
+ organizationId: string;
989
+ projectId: string;
990
+ environment: MarketingEnvironment;
991
+ contentId: string;
992
+ scheduledFor: Date;
993
+ timezone: string;
994
+ autoPublish: boolean;
995
+ notifyUser: boolean;
996
+ publishAttempted: boolean;
997
+ publishedAt: Date | null;
998
+ createdAt: Date;
999
+ updatedAt: Date | null;
1000
+ }
1001
+ interface ScheduleContentRequest {
1002
+ projectSlug: string;
1003
+ environment?: MarketingEnvironment;
1004
+ contentId: string;
1005
+ scheduledFor: Date;
1006
+ timezone?: string;
1007
+ autoPublish?: boolean;
1008
+ notifyUser?: boolean;
1009
+ }
1010
+ interface ListCalendarEntriesRequest {
1011
+ projectSlug: string;
1012
+ environment?: MarketingEnvironment;
1013
+ startDate?: Date;
1014
+ endDate?: Date;
1015
+ limit?: number;
1016
+ offset?: number;
1017
+ }
1018
+ type ListCalendarEntriesResponse = CalendarEntry[];
1019
+ interface UpdateCalendarEntryRequest {
1020
+ entryId: string;
1021
+ scheduledFor?: Date;
1022
+ timezone?: string;
1023
+ autoPublish?: boolean;
1024
+ notifyUser?: boolean;
1025
+ }
1026
+ interface CancelCalendarEntryResponse {
1027
+ success: boolean;
1028
+ }
1029
+ interface MarkPublishedRequest {
1030
+ entryId: string;
1031
+ publishedAt?: Date;
1032
+ }
1033
+ type AssetJobStatus = "pending" | "processing" | "completed" | "failed";
1034
+ type AssetJobType = "slide_generation" | "video_assembly";
1035
+ interface AssetJob {
1036
+ id: string;
1037
+ organizationId: string;
1038
+ projectId: string;
1039
+ contentId: string;
1040
+ jobType: AssetJobType;
1041
+ status: AssetJobStatus;
1042
+ input: Record<string, unknown> | null;
1043
+ output: Record<string, unknown> | null;
1044
+ error: string | null;
1045
+ attempts: number;
1046
+ maxAttempts: number;
1047
+ startedAt: Date | null;
1048
+ completedAt: Date | null;
1049
+ createdAt: Date;
1050
+ }
1051
+ interface CreateAssetJobRequest {
1052
+ projectSlug: string;
1053
+ contentId: string;
1054
+ jobType: AssetJobType;
1055
+ input?: Record<string, unknown>;
1056
+ }
1057
+ interface ListAssetJobsRequest {
1058
+ projectSlug: string;
1059
+ contentId?: string;
1060
+ status?: AssetJobStatus;
1061
+ jobType?: AssetJobType;
1062
+ limit?: number;
1063
+ offset?: number;
1064
+ }
1065
+ type ListAssetJobsResponse = AssetJob[];
1066
+ interface UpdateAssetJobStatusRequest {
1067
+ jobId: string;
1068
+ status: AssetJobStatus;
1069
+ output?: Record<string, unknown>;
1070
+ error?: string;
1071
+ }
1072
+ interface RetryAssetJobResponse {
1073
+ success: boolean;
1074
+ }
1075
+ interface CancelAssetJobResponse {
1076
+ success: boolean;
1077
+ }
1078
+ interface MarketingSettings {
1079
+ organizationId: string;
1080
+ projectId: string;
1081
+ environment: MarketingEnvironment;
1082
+ targetAudience: string | null;
1083
+ brandVoice: string | null;
1084
+ contentThemes: string[];
1085
+ avoidTopics: string[];
1086
+ preferredPlatforms: string[];
1087
+ preferredPostTimes: Record<string, unknown> | null;
1088
+ notifyOnNewOpportunities: boolean;
1089
+ notifyOnContentReady: boolean;
1090
+ notificationEmail: string | null;
1091
+ notificationSlackWebhook: string | null;
1092
+ monitoredKeywords: string[];
1093
+ monitoredSubreddits: string[];
1094
+ customInstructions: string | null;
1095
+ }
1096
+ interface GetSettingsRequest {
1097
+ projectSlug: string;
1098
+ environment?: MarketingEnvironment;
1099
+ }
1100
+ interface UpdateSettingsRequest {
1101
+ projectSlug: string;
1102
+ environment?: MarketingEnvironment;
1103
+ targetAudience?: string;
1104
+ brandVoice?: string;
1105
+ contentThemes?: string[];
1106
+ avoidTopics?: string[];
1107
+ preferredPlatforms?: string[];
1108
+ monitoredKeywords?: string[];
1109
+ monitoredSubreddits?: string[];
1110
+ customInstructions?: string;
1111
+ }
1112
+ interface UpdateSettingsResponse {
1113
+ success: boolean;
1114
+ created: boolean;
1115
+ }
1116
+ interface MarketingUsage {
1117
+ id: string;
1118
+ organizationId: string;
1119
+ projectId: string;
1120
+ environment: MarketingEnvironment;
1121
+ periodStart: Date;
1122
+ periodEnd: Date;
1123
+ contentGenerated: number;
1124
+ tiktokVideosGenerated: number;
1125
+ aiScriptsGenerated: number;
1126
+ aiTokensUsed: number;
1127
+ slidesGenerated: number;
1128
+ videosAssembled: number;
1129
+ creditsUsed: number;
1130
+ createdAt: Date;
1131
+ updatedAt: Date | null;
1132
+ }
1133
+ interface GetCurrentUsageRequest {
1134
+ projectSlug: string;
1135
+ environment?: MarketingEnvironment;
1136
+ }
1137
+ interface CurrentUsageResponse {
1138
+ periodStart: Date;
1139
+ periodEnd: Date;
1140
+ contentGenerated: number;
1141
+ tiktokVideosGenerated: number;
1142
+ aiScriptsGenerated: number;
1143
+ aiTokensUsed: number;
1144
+ slidesGenerated: number;
1145
+ videosAssembled: number;
1146
+ creditsUsed: number;
1147
+ }
1148
+ interface GetUsageHistoryRequest {
1149
+ projectSlug: string;
1150
+ environment?: MarketingEnvironment;
1151
+ startDate?: Date;
1152
+ endDate?: Date;
1153
+ limit?: number;
1154
+ }
1155
+ type UsageHistoryResponse = MarketingUsage[];
1156
+ interface GetTotalUsageRequest {
1157
+ projectSlug: string;
1158
+ environment?: MarketingEnvironment;
1159
+ startDate?: Date;
1160
+ endDate?: Date;
1161
+ }
1162
+ interface TotalUsageResponse {
1163
+ contentGenerated: number;
1164
+ tiktokVideosGenerated: number;
1165
+ aiScriptsGenerated: number;
1166
+ aiTokensUsed: number;
1167
+ slidesGenerated: number;
1168
+ videosAssembled: number;
1169
+ creditsUsed: number;
1170
+ }
1171
+ interface RecordUsageRequest {
1172
+ projectSlug: string;
1173
+ environment?: MarketingEnvironment;
1174
+ contentGenerated?: number;
1175
+ tiktokVideosGenerated?: number;
1176
+ aiScriptsGenerated?: number;
1177
+ aiTokensUsed?: number;
1178
+ slidesGenerated?: number;
1179
+ videosAssembled?: number;
1180
+ creditsUsed?: number;
1181
+ }
1182
+ interface TrendAnalyticsRequest {
1183
+ projectSlug: string;
1184
+ environment?: MarketingEnvironment;
1185
+ startDate?: Date;
1186
+ endDate?: Date;
1187
+ }
1188
+ interface TrendAnalyticsResponse {
1189
+ totalTrends: number;
1190
+ trendsByStatus: Array<{
1191
+ status: TrendStatus;
1192
+ count: number;
1193
+ }>;
1194
+ trendsBySource: Array<{
1195
+ source: string;
1196
+ count: number;
1197
+ }>;
1198
+ }
1199
+ interface OpportunityConversionRequest {
1200
+ projectSlug: string;
1201
+ environment?: MarketingEnvironment;
1202
+ startDate?: Date;
1203
+ endDate?: Date;
1204
+ }
1205
+ interface OpportunityConversionResponse {
1206
+ totalOpportunities: number;
1207
+ generatedContent: number;
1208
+ conversionRate: number;
1209
+ opportunitiesByStatus: Array<{
1210
+ status: string;
1211
+ count: number;
1212
+ }>;
1213
+ }
778
1214
 
779
1215
  /**
780
1216
  * Stack0 Marketing Client
@@ -814,6 +1250,18 @@ declare class Marketing {
814
1250
  * Get a single trend by ID
815
1251
  */
816
1252
  getTrend(trendId: string): Promise<Trend>;
1253
+ /**
1254
+ * Update trend status
1255
+ *
1256
+ * @example
1257
+ * ```typescript
1258
+ * await marketing.updateTrendStatus({
1259
+ * trendId: 'trend-id',
1260
+ * status: 'active',
1261
+ * });
1262
+ * ```
1263
+ */
1264
+ updateTrendStatus(request: UpdateTrendStatusRequest): Promise<UpdateTrendStatusResponse>;
817
1265
  /**
818
1266
  * Generate content opportunities from active trends
819
1267
  *
@@ -957,6 +1405,41 @@ declare class Marketing {
957
1405
  * Get a single script by ID
958
1406
  */
959
1407
  getScript(scriptId: string): Promise<Script>;
1408
+ /**
1409
+ * Update a script
1410
+ *
1411
+ * @example
1412
+ * ```typescript
1413
+ * const updated = await marketing.updateScript({
1414
+ * scriptId: 'script-id',
1415
+ * hook: 'Updated hook line',
1416
+ * cta: 'New call to action!',
1417
+ * });
1418
+ * ```
1419
+ */
1420
+ updateScript(request: UpdateScriptRequest): Promise<Script>;
1421
+ /**
1422
+ * Create a new version of a script
1423
+ *
1424
+ * @example
1425
+ * ```typescript
1426
+ * const newVersion = await marketing.createScriptVersion({
1427
+ * scriptId: 'script-id',
1428
+ * hook: 'Updated hook for v2',
1429
+ * slides: [...],
1430
+ * cta: 'Updated CTA',
1431
+ * });
1432
+ * ```
1433
+ */
1434
+ createScriptVersion(request: CreateScriptVersionRequest): Promise<Script>;
1435
+ /**
1436
+ * Get all versions of a script
1437
+ */
1438
+ getScriptVersions(scriptId: string): Promise<Script[]>;
1439
+ /**
1440
+ * Delete a script
1441
+ */
1442
+ deleteScript(scriptId: string): Promise<DeleteScriptResponse>;
960
1443
  /**
961
1444
  * Get analytics overview
962
1445
  *
@@ -985,10 +1468,201 @@ declare class Marketing {
985
1468
  * ```
986
1469
  */
987
1470
  getContentPerformance(request: ContentPerformanceRequest): Promise<ContentPerformanceResponse>;
1471
+ /**
1472
+ * Get trend discovery analytics
1473
+ *
1474
+ * @example
1475
+ * ```typescript
1476
+ * const trendStats = await marketing.getTrendAnalytics({
1477
+ * projectSlug: 'my-project',
1478
+ * environment: 'production',
1479
+ * });
1480
+ * console.log(`Total trends: ${trendStats.totalTrends}`);
1481
+ * ```
1482
+ */
1483
+ getTrendAnalytics(request: TrendAnalyticsRequest): Promise<TrendAnalyticsResponse>;
1484
+ /**
1485
+ * Get opportunity conversion analytics
1486
+ *
1487
+ * @example
1488
+ * ```typescript
1489
+ * const conversion = await marketing.getOpportunityConversion({
1490
+ * projectSlug: 'my-project',
1491
+ * environment: 'production',
1492
+ * });
1493
+ * console.log(`Conversion rate: ${conversion.conversionRate}%`);
1494
+ * ```
1495
+ */
1496
+ getOpportunityConversion(request: OpportunityConversionRequest): Promise<OpportunityConversionResponse>;
1497
+ /**
1498
+ * Schedule content for publishing
1499
+ *
1500
+ * @example
1501
+ * ```typescript
1502
+ * const entry = await marketing.scheduleContent({
1503
+ * projectSlug: 'my-project',
1504
+ * contentId: 'content-id',
1505
+ * scheduledFor: new Date('2024-12-25T10:00:00Z'),
1506
+ * autoPublish: true,
1507
+ * });
1508
+ * ```
1509
+ */
1510
+ scheduleContent(request: ScheduleContentRequest): Promise<CalendarEntry>;
1511
+ /**
1512
+ * List scheduled content
1513
+ *
1514
+ * @example
1515
+ * ```typescript
1516
+ * const entries = await marketing.listCalendarEntries({
1517
+ * projectSlug: 'my-project',
1518
+ * startDate: new Date('2024-12-01'),
1519
+ * endDate: new Date('2024-12-31'),
1520
+ * });
1521
+ * ```
1522
+ */
1523
+ listCalendarEntries(request: ListCalendarEntriesRequest): Promise<CalendarEntry[]>;
1524
+ /**
1525
+ * Get a single calendar entry by ID
1526
+ */
1527
+ getCalendarEntry(entryId: string): Promise<CalendarEntry>;
1528
+ /**
1529
+ * Update a calendar entry
1530
+ *
1531
+ * @example
1532
+ * ```typescript
1533
+ * const updated = await marketing.updateCalendarEntry({
1534
+ * entryId: 'entry-id',
1535
+ * scheduledFor: new Date('2024-12-26T10:00:00Z'),
1536
+ * });
1537
+ * ```
1538
+ */
1539
+ updateCalendarEntry(request: UpdateCalendarEntryRequest): Promise<CalendarEntry>;
1540
+ /**
1541
+ * Cancel a scheduled calendar entry
1542
+ */
1543
+ cancelCalendarEntry(entryId: string): Promise<CancelCalendarEntryResponse>;
1544
+ /**
1545
+ * Mark content as published
1546
+ */
1547
+ markContentPublished(request: MarkPublishedRequest): Promise<CalendarEntry>;
1548
+ /**
1549
+ * Create an asset generation job
1550
+ *
1551
+ * @example
1552
+ * ```typescript
1553
+ * const job = await marketing.createAssetJob({
1554
+ * projectSlug: 'my-project',
1555
+ * contentId: 'content-id',
1556
+ * jobType: 'slide_generation',
1557
+ * input: { style: 'modern' },
1558
+ * });
1559
+ * ```
1560
+ */
1561
+ createAssetJob(request: CreateAssetJobRequest): Promise<AssetJob>;
1562
+ /**
1563
+ * List asset jobs
1564
+ *
1565
+ * @example
1566
+ * ```typescript
1567
+ * const jobs = await marketing.listAssetJobs({
1568
+ * projectSlug: 'my-project',
1569
+ * status: 'processing',
1570
+ * });
1571
+ * ```
1572
+ */
1573
+ listAssetJobs(request: ListAssetJobsRequest): Promise<AssetJob[]>;
1574
+ /**
1575
+ * Get an asset job by ID
1576
+ */
1577
+ getAssetJob(jobId: string): Promise<AssetJob>;
1578
+ /**
1579
+ * Update asset job status
1580
+ */
1581
+ updateAssetJobStatus(request: UpdateAssetJobStatusRequest): Promise<AssetJob>;
1582
+ /**
1583
+ * Retry a failed asset job
1584
+ */
1585
+ retryAssetJob(jobId: string): Promise<AssetJob>;
1586
+ /**
1587
+ * Cancel an asset job
1588
+ */
1589
+ cancelAssetJob(jobId: string): Promise<AssetJob>;
1590
+ /**
1591
+ * Get marketing settings for a project
1592
+ *
1593
+ * @example
1594
+ * ```typescript
1595
+ * const settings = await marketing.getSettings({
1596
+ * projectSlug: 'my-project',
1597
+ * environment: 'production',
1598
+ * });
1599
+ * console.log(`Brand voice: ${settings.brandVoice}`);
1600
+ * ```
1601
+ */
1602
+ getSettings(request: GetSettingsRequest): Promise<MarketingSettings>;
1603
+ /**
1604
+ * Update marketing settings
1605
+ *
1606
+ * @example
1607
+ * ```typescript
1608
+ * await marketing.updateSettings({
1609
+ * projectSlug: 'my-project',
1610
+ * brandVoice: 'Professional yet approachable',
1611
+ * monitoredKeywords: ['AI', 'startup', 'tech'],
1612
+ * });
1613
+ * ```
1614
+ */
1615
+ updateSettings(request: UpdateSettingsRequest): Promise<UpdateSettingsResponse>;
1616
+ /**
1617
+ * Get current period usage
1618
+ *
1619
+ * @example
1620
+ * ```typescript
1621
+ * const usage = await marketing.getCurrentUsage({
1622
+ * projectSlug: 'my-project',
1623
+ * environment: 'production',
1624
+ * });
1625
+ * console.log(`AI tokens used: ${usage.aiTokensUsed}`);
1626
+ * ```
1627
+ */
1628
+ getCurrentUsage(request: GetCurrentUsageRequest): Promise<CurrentUsageResponse>;
1629
+ /**
1630
+ * Get usage history
1631
+ *
1632
+ * @example
1633
+ * ```typescript
1634
+ * const history = await marketing.getUsageHistory({
1635
+ * projectSlug: 'my-project',
1636
+ * limit: 6, // Last 6 months
1637
+ * });
1638
+ * ```
1639
+ */
1640
+ getUsageHistory(request: GetUsageHistoryRequest): Promise<MarketingUsage[]>;
1641
+ /**
1642
+ * Get total usage across all periods
1643
+ *
1644
+ * @example
1645
+ * ```typescript
1646
+ * const totals = await marketing.getTotalUsage({
1647
+ * projectSlug: 'my-project',
1648
+ * startDate: new Date('2024-01-01'),
1649
+ * });
1650
+ * console.log(`Total content generated: ${totals.contentGenerated}`);
1651
+ * ```
1652
+ */
1653
+ getTotalUsage(request: GetTotalUsageRequest): Promise<TotalUsageResponse>;
1654
+ /**
1655
+ * Record usage (typically called internally)
1656
+ */
1657
+ recordUsage(request: RecordUsageRequest): Promise<MarketingUsage>;
988
1658
  private convertTrendDates;
989
1659
  private convertOpportunityDates;
990
1660
  private convertContentDates;
991
1661
  private convertScriptDates;
1662
+ private convertCalendarEntryDates;
1663
+ private convertAssetJobDates;
1664
+ private convertUsageDates;
1665
+ private convertMarketingUsageDates;
992
1666
  }
993
1667
 
994
1668
  /**
@@ -1074,4 +1748,4 @@ declare class Stack0 {
1074
1748
  constructor(config: Stack0Config);
1075
1749
  }
1076
1750
 
1077
- export { type AnalyticsOverviewRequest, type AnalyticsOverviewResponse, type ApprovalStatus, type ApproveContentRequest, CDN, type Channel, type CommunicationUser, type Company, type Connection, type Connector, type ConnectorCategory, type Contact, type Content, type ContentPerformanceItem, type ContentPerformanceRequest, type ContentPerformanceResponse, type ContentStatus, type ContentType, type CreateCompanyInput, type CreateContactInput, type CreateContentRequest, type CreateDealInput, type CreateScriptRequest, type Deal, type DiscoverTrendsRequest, type DiscoverTrendsResponse, type DismissOpportunityRequest, Extraction, type GenerateOpportunitiesRequest, type GenerateOpportunitiesResponse, type Address as IntegrationAddress, type ColumnType as IntegrationColumnType, type CreateDocumentInput as IntegrationCreateDocumentInput, type CreateFolderInput as IntegrationCreateFolderInput, type CreateTableRowInput as IntegrationCreateTableRowInput, type Document as IntegrationDocument, type IntegrationEmailAddress, type File as IntegrationFile, type FilePermission as IntegrationFilePermission, type IntegrationFolder, type MessageAttachment as IntegrationMessageAttachment, type MessageReaction as IntegrationMessageReaction, type PhoneNumber as IntegrationPhoneNumber, type SelectOption as IntegrationSelectOption, type Table as IntegrationTable, type TableColumn as IntegrationTableColumn, type TableRow as IntegrationTableRow, type UpdateDocumentInput as IntegrationUpdateDocumentInput, type UpdateTableRowInput as IntegrationUpdateTableRowInput, Integrations, type ListOptions as IntegrationsListOptions, type PaginatedResult as IntegrationsPaginatedResult, type ListContentRequest, type ListContentResponse, type ListOpportunitiesRequest, type ListOpportunitiesResponse, type ListScriptsRequest, type ListScriptsResponse, type ListTrendsRequest, type ListTrendsResponse, Mail, Marketing, type MarketingEnvironment, type Message, type Opportunity, type PassthroughRequest, type RejectContentRequest, Screenshots, type Script, type ScriptSlide, type SendMessageInput, Stack0, type Stack0Config, type Trend, type TrendStatus, type UpdateCompanyInput, type UpdateContactInput, type UpdateContentRequest, type UpdateDealInput, type UploadFileInput, Webdata, Stack0 as default };
1751
+ export { type AnalyticsOverviewRequest, type AnalyticsOverviewResponse, type ApprovalStatus, type ApproveContentRequest, type AssetJob, type AssetJobStatus, type AssetJobType, CDN, type CalendarEntry, type CancelAssetJobResponse, type CancelCalendarEntryResponse, type Channel, type CommunicationUser, type Company, type Connection, type Connector, type ConnectorCategory, type Contact, type Content, type ContentPerformanceItem, type ContentPerformanceRequest, type ContentPerformanceResponse, type ContentStatus, type ContentType, type CreateAssetJobRequest, type CreateCompanyInput, type CreateContactInput, type CreateContentRequest, type CreateDealInput, type CreateScriptRequest, type CreateScriptVersionRequest, type CurrentUsageResponse, type Deal, type DeleteScriptResponse, type DiscoverTrendsRequest, type DiscoverTrendsResponse, type DismissOpportunityRequest, Extraction, type GenerateOpportunitiesRequest, type GenerateOpportunitiesResponse, type GetCurrentUsageRequest, type GetSettingsRequest, type GetTotalUsageRequest, type GetUsageHistoryRequest, type Address as IntegrationAddress, type ColumnType as IntegrationColumnType, type CreateDocumentInput as IntegrationCreateDocumentInput, type CreateFolderInput as IntegrationCreateFolderInput, type CreateTableRowInput as IntegrationCreateTableRowInput, type Document as IntegrationDocument, type IntegrationEmailAddress, type File as IntegrationFile, type FilePermission as IntegrationFilePermission, type IntegrationFolder, type MessageAttachment as IntegrationMessageAttachment, type MessageReaction as IntegrationMessageReaction, type PhoneNumber as IntegrationPhoneNumber, type SelectOption as IntegrationSelectOption, type Table as IntegrationTable, type TableColumn as IntegrationTableColumn, type TableRow as IntegrationTableRow, type UpdateDocumentInput as IntegrationUpdateDocumentInput, type UpdateTableRowInput as IntegrationUpdateTableRowInput, Integrations, type ListOptions as IntegrationsListOptions, type PaginatedResult as IntegrationsPaginatedResult, type ListAssetJobsRequest, type ListAssetJobsResponse, type ListCalendarEntriesRequest, type ListCalendarEntriesResponse, type ListContentRequest, type ListContentResponse, type ListOpportunitiesRequest, type ListOpportunitiesResponse, type ListScriptsRequest, type ListScriptsResponse, type ListTrendsRequest, type ListTrendsResponse, Mail, type MarkPublishedRequest, Marketing, type MarketingEnvironment, type MarketingSettings, type MarketingUsage, type Message, type Opportunity, type OpportunityConversionRequest, type OpportunityConversionResponse, type PassthroughRequest, type RecordUsageRequest, type RejectContentRequest, type RetryAssetJobResponse, type ScheduleContentRequest, Screenshots, type Script, type ScriptSlide, type SendMessageInput, Stack0, type Stack0Config, type TotalUsageResponse, type Trend, type TrendAnalyticsRequest, type TrendAnalyticsResponse, type TrendStatus, type UpdateAssetJobStatusRequest, type UpdateCalendarEntryRequest, type UpdateCompanyInput, type UpdateContactInput, type UpdateContentRequest, type UpdateDealInput, type UpdateScriptRequest, type UpdateSettingsRequest, type UpdateSettingsResponse, type UpdateTrendStatusRequest, type UpdateTrendStatusResponse, type UploadFileInput, type UsageHistoryResponse, Webdata, Stack0 as default };