@linkt/sdk 0.5.0 → 0.7.0

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.
Files changed (129) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +0 -29
  3. package/client.d.mts +23 -1
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +23 -1
  6. package/client.d.ts.map +1 -1
  7. package/client.js +38 -4
  8. package/client.js.map +1 -1
  9. package/client.mjs +38 -4
  10. package/client.mjs.map +1 -1
  11. package/internal/parse.d.mts.map +1 -1
  12. package/internal/parse.d.ts.map +1 -1
  13. package/internal/parse.js +5 -0
  14. package/internal/parse.js.map +1 -1
  15. package/internal/parse.mjs +5 -0
  16. package/internal/parse.mjs.map +1 -1
  17. package/internal/utils/query.d.mts +2 -0
  18. package/internal/utils/query.d.mts.map +1 -0
  19. package/internal/utils/query.d.ts +2 -0
  20. package/internal/utils/query.d.ts.map +1 -0
  21. package/internal/utils/query.js +10 -0
  22. package/internal/utils/query.js.map +1 -0
  23. package/internal/utils/query.mjs +6 -0
  24. package/internal/utils/query.mjs.map +1 -0
  25. package/internal/utils.d.mts +1 -0
  26. package/internal/utils.d.ts +1 -0
  27. package/internal/utils.js +1 -0
  28. package/internal/utils.js.map +1 -1
  29. package/internal/utils.mjs +1 -0
  30. package/package.json +1 -1
  31. package/resources/entity.d.mts +34 -19
  32. package/resources/entity.d.mts.map +1 -1
  33. package/resources/entity.d.ts +34 -19
  34. package/resources/entity.d.ts.map +1 -1
  35. package/resources/entity.js +15 -8
  36. package/resources/entity.js.map +1 -1
  37. package/resources/entity.mjs +15 -8
  38. package/resources/entity.mjs.map +1 -1
  39. package/resources/files.d.mts +4 -2
  40. package/resources/files.d.mts.map +1 -1
  41. package/resources/files.d.ts +4 -2
  42. package/resources/files.d.ts.map +1 -1
  43. package/resources/files.js +3 -0
  44. package/resources/files.js.map +1 -1
  45. package/resources/files.mjs +3 -0
  46. package/resources/files.mjs.map +1 -1
  47. package/resources/icp.d.mts +31 -0
  48. package/resources/icp.d.mts.map +1 -1
  49. package/resources/icp.d.ts +31 -0
  50. package/resources/icp.d.ts.map +1 -1
  51. package/resources/icp.js +3 -0
  52. package/resources/icp.js.map +1 -1
  53. package/resources/icp.mjs +3 -0
  54. package/resources/icp.mjs.map +1 -1
  55. package/resources/index.d.mts +1 -0
  56. package/resources/index.d.mts.map +1 -1
  57. package/resources/index.d.ts +1 -0
  58. package/resources/index.d.ts.map +1 -1
  59. package/resources/index.js +3 -1
  60. package/resources/index.js.map +1 -1
  61. package/resources/index.mjs +1 -0
  62. package/resources/index.mjs.map +1 -1
  63. package/resources/run.d.mts +3 -0
  64. package/resources/run.d.mts.map +1 -1
  65. package/resources/run.d.ts +3 -0
  66. package/resources/run.d.ts.map +1 -1
  67. package/resources/run.js +3 -0
  68. package/resources/run.js.map +1 -1
  69. package/resources/run.mjs +3 -0
  70. package/resources/run.mjs.map +1 -1
  71. package/resources/schedule.d.mts +305 -0
  72. package/resources/schedule.d.mts.map +1 -0
  73. package/resources/schedule.d.ts +305 -0
  74. package/resources/schedule.d.ts.map +1 -0
  75. package/resources/schedule.js +84 -0
  76. package/resources/schedule.js.map +1 -0
  77. package/resources/schedule.mjs +80 -0
  78. package/resources/schedule.mjs.map +1 -0
  79. package/resources/sheet/schema.d.mts +3 -0
  80. package/resources/sheet/schema.d.mts.map +1 -1
  81. package/resources/sheet/schema.d.ts +3 -0
  82. package/resources/sheet/schema.d.ts.map +1 -1
  83. package/resources/sheet/schema.js +3 -0
  84. package/resources/sheet/schema.js.map +1 -1
  85. package/resources/sheet/schema.mjs +3 -0
  86. package/resources/sheet/schema.mjs.map +1 -1
  87. package/resources/sheet/sheet.d.mts +3 -0
  88. package/resources/sheet/sheet.d.mts.map +1 -1
  89. package/resources/sheet/sheet.d.ts +3 -0
  90. package/resources/sheet/sheet.d.ts.map +1 -1
  91. package/resources/sheet/sheet.js +3 -0
  92. package/resources/sheet/sheet.js.map +1 -1
  93. package/resources/sheet/sheet.mjs +3 -0
  94. package/resources/sheet/sheet.mjs.map +1 -1
  95. package/resources/signal.d.mts +4 -0
  96. package/resources/signal.d.mts.map +1 -1
  97. package/resources/signal.d.ts +4 -0
  98. package/resources/signal.d.ts.map +1 -1
  99. package/resources/signal.js +3 -0
  100. package/resources/signal.js.map +1 -1
  101. package/resources/signal.mjs +3 -0
  102. package/resources/signal.mjs.map +1 -1
  103. package/resources/task.d.mts +233 -5
  104. package/resources/task.d.mts.map +1 -1
  105. package/resources/task.d.ts +233 -5
  106. package/resources/task.d.ts.map +1 -1
  107. package/resources/task.js +3 -0
  108. package/resources/task.js.map +1 -1
  109. package/resources/task.mjs +3 -0
  110. package/resources/task.mjs.map +1 -1
  111. package/src/client.ts +63 -7
  112. package/src/internal/parse.ts +6 -0
  113. package/src/internal/utils/query.ts +7 -0
  114. package/src/internal/utils.ts +1 -0
  115. package/src/resources/entity.ts +36 -19
  116. package/src/resources/files.ts +4 -2
  117. package/src/resources/icp.ts +36 -0
  118. package/src/resources/index.ts +10 -0
  119. package/src/resources/run.ts +3 -0
  120. package/src/resources/schedule.ts +375 -0
  121. package/src/resources/sheet/schema.ts +3 -0
  122. package/src/resources/sheet/sheet.ts +3 -0
  123. package/src/resources/signal.ts +5 -0
  124. package/src/resources/task.ts +258 -0
  125. package/src/version.ts +1 -1
  126. package/version.d.mts +1 -1
  127. package/version.d.ts +1 -1
  128. package/version.js +1 -1
  129. package/version.mjs +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"task.js","sourceRoot":"","sources":["../src/resources/task.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,IAAK,SAAQ,sBAAW;IACnC;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,IAAsB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GA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AAA,YAAY,MAAM,EAAE,EAAE;YACnD,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,OAAO,CACL,MAAc,EACd,IAAuB,EACvB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,YAAY,MAAM,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnF,CAAC;CACF;AA9GD,oBA8GC"}
@@ -2,6 +2,9 @@
2
2
  import { APIResource } from "../core/resource.mjs";
3
3
  import { buildHeaders } from "../internal/headers.mjs";
4
4
  import { path } from "../internal/utils/path.mjs";
5
+ /**
6
+ * **Tasks** are reusable workflow templates that define HOW research is executed. Tasks reference Prefect flow deployments and can be configured with prompts and parameters. Create a task once, then execute it multiple times to generate runs. Each execution creates a new run that can be monitored independently.
7
+ */
5
8
  export class Task extends APIResource {
6
9
  /**
7
10
  * Create a new task template.
@@ -1 +1 @@
1
- {"version":3,"file":"task.mjs","sourceRoot":"","sources":["../src/resources/task.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,IAAsB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,MAAc,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CA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ACH,OAAO,CACL,MAAc,EACd,IAAuB,EACvB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,YAAY,MAAM,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnF,CAAC;CACF"}
package/src/client.ts CHANGED
@@ -11,7 +11,7 @@ import type { APIResponseProps } from './internal/parse';
11
11
  import { getPlatformHeaders } from './internal/detect-platform';
12
12
  import * as Shims from './internal/shims';
13
13
  import * as Opts from './internal/request-options';
14
- import * as qs from './internal/qs';
14
+ import { stringifyQuery } from './internal/utils/query';
15
15
  import { VERSION } from './version';
16
16
  import * as Errors from './core/error';
17
17
  import * as Uploads from './core/uploads';
@@ -61,6 +61,16 @@ import {
61
61
  RunListResponse,
62
62
  RunRetrieveResponse,
63
63
  } from './resources/run';
64
+ import {
65
+ CreateScheduleRequest,
66
+ Schedule,
67
+ ScheduleCreateParams,
68
+ ScheduleListParams,
69
+ ScheduleListResponse,
70
+ ScheduleResponse,
71
+ ScheduleUpdateParams,
72
+ UpdateScheduleRequest,
73
+ } from './resources/schedule';
64
74
  import { Signal, SignalListParams, SignalListResponse, SignalResponse } from './resources/signal';
65
75
  import {
66
76
  IngestPromptConfigResponse,
@@ -313,8 +323,8 @@ export class Linkt {
313
323
  return buildHeaders([{ 'x-api-key': this.apiKey }]);
314
324
  }
315
325
 
316
- protected stringifyQuery(query: Record<string, unknown>): string {
317
- return qs.stringify(query, { arrayFormat: 'comma' });
326
+ protected stringifyQuery(query: object | Record<string, unknown>): string {
327
+ return stringifyQuery(query);
318
328
  }
319
329
 
320
330
  private getUserAgent(): string {
@@ -351,7 +361,7 @@ export class Linkt {
351
361
  }
352
362
 
353
363
  if (typeof query === 'object' && query && !Array.isArray(query)) {
354
- url.search = this.stringifyQuery(query as Record<string, unknown>);
364
+ url.search = this.stringifyQuery(query);
355
365
  }
356
366
 
357
367
  return url.toString();
@@ -535,7 +545,7 @@ export class Linkt {
535
545
  loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
536
546
 
537
547
  const errText = await response.text().catch((err: any) => castToError(err).message);
538
- const errJSON = safeJSON(errText);
548
+ const errJSON = safeJSON(errText) as any;
539
549
  const errMessage = errJSON ? undefined : errText;
540
550
 
541
551
  loggerFor(this).debug(
@@ -576,9 +586,10 @@ export class Linkt {
576
586
  controller: AbortController,
577
587
  ): Promise<Response> {
578
588
  const { signal, method, ...options } = init || {};
579
- if (signal) signal.addEventListener('abort', () => controller.abort());
589
+ const abort = this._makeAbort(controller);
590
+ if (signal) signal.addEventListener('abort', abort, { once: true });
580
591
 
581
- const timeout = setTimeout(() => controller.abort(), ms);
592
+ const timeout = setTimeout(abort, ms);
582
593
 
583
594
  const isReadableBody =
584
595
  ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
@@ -745,6 +756,12 @@ export class Linkt {
745
756
  return headers.values;
746
757
  }
747
758
 
759
+ private _makeAbort(controller: AbortController) {
760
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
761
+ // would capture all request options, and cause a memory leak.
762
+ return () => controller.abort();
763
+ }
764
+
748
765
  private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
749
766
  bodyHeaders: HeadersLike;
750
767
  body: BodyInit | undefined;
@@ -777,6 +794,14 @@ export class Linkt {
777
794
  (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
778
795
  ) {
779
796
  return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
797
+ } else if (
798
+ typeof body === 'object' &&
799
+ headers.values.get('content-type') === 'application/x-www-form-urlencoded'
800
+ ) {
801
+ return {
802
+ bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
803
+ body: this.stringifyQuery(body),
804
+ };
780
805
  } else {
781
806
  return this.#encoder({ body, headers });
782
807
  }
@@ -801,12 +826,31 @@ export class Linkt {
801
826
 
802
827
  static toFile = Uploads.toFile;
803
828
 
829
+ /**
830
+ * **Ideal Customer Profiles (ICPs)** define WHAT entities to target using business-level descriptions and filters. ICPs are the foundation of your research workflows - they specify targeting criteria like industry, company size, job titles, and other characteristics that define your ideal customers. Create ICPs first, then link Sheets to them for entity storage.
831
+ */
804
832
  icp: API.Icp = new API.Icp(this);
833
+ /**
834
+ * **Sheets** are collections WHERE entities (companies, people) are stored. Each sheet must reference an ICP that defines targeting criteria, and holds entities of a single type (company or person). Sheets support custom schemas, CSV export, and comprehensive entity filtering. Use sheets to organize and manage your research results.
835
+ */
805
836
  sheet: API.SheetResource = new API.SheetResource(this);
806
837
  entity: API.Entity = new API.Entity(this);
838
+ /**
839
+ * **Tasks** are reusable workflow templates that define HOW research is executed. Tasks reference Prefect flow deployments and can be configured with prompts and parameters. Create a task once, then execute it multiple times to generate runs. Each execution creates a new run that can be monitored independently.
840
+ */
807
841
  task: API.Task = new API.Task(this);
842
+ /**
843
+ * **Signals** are time-based events detected by AI agents that affect your entities. Examples include funding rounds, leadership changes, hiring events, and product launches. Signals are **read-only** - they are created automatically by research workflows and represent an immutable audit trail of what happened and when.
844
+ */
808
845
  signal: API.Signal = new API.Signal(this);
846
+ /**
847
+ * **Runs** represent individual workflow executions. When you execute a task, it creates a run that progresses through states: SCHEDULED -> PENDING -> RUNNING -> COMPLETED (or FAILED/CANCELED). Monitor run status, view processing queues, and cancel running workflows through these endpoints.
848
+ */
809
849
  run: API.Run = new API.Run(this);
850
+ schedule: API.Schedule = new API.Schedule(this);
851
+ /**
852
+ * **Files** are uploaded data sources for your research workflows. Upload CSV or XLSX files containing entities (companies, people) or monitoring targets. Files are processed and stored securely, then can be referenced when creating signal monitoring or ingest tasks. XLSX files are automatically converted to CSV format.
853
+ */
810
854
  files: API.Files = new API.Files(this);
811
855
  }
812
856
 
@@ -816,6 +860,7 @@ Linkt.Entity = Entity;
816
860
  Linkt.Task = Task;
817
861
  Linkt.Signal = Signal;
818
862
  Linkt.Run = Run;
863
+ Linkt.Schedule = Schedule;
819
864
  Linkt.Files = Files;
820
865
 
821
866
  export declare namespace Linkt {
@@ -902,6 +947,17 @@ export declare namespace Linkt {
902
947
  type RunGetQueueParams as RunGetQueueParams,
903
948
  };
904
949
 
950
+ export {
951
+ Schedule as Schedule,
952
+ type CreateScheduleRequest as CreateScheduleRequest,
953
+ type ScheduleListResponse as ScheduleListResponse,
954
+ type ScheduleResponse as ScheduleResponse,
955
+ type UpdateScheduleRequest as UpdateScheduleRequest,
956
+ type ScheduleCreateParams as ScheduleCreateParams,
957
+ type ScheduleUpdateParams as ScheduleUpdateParams,
958
+ type ScheduleListParams as ScheduleListParams,
959
+ };
960
+
905
961
  export {
906
962
  Files as Files,
907
963
  type CsvProcessingStatus as CsvProcessingStatus,
@@ -29,6 +29,12 @@ export async function defaultParseResponse<T>(client: Linkt, props: APIResponseP
29
29
  const mediaType = contentType?.split(';')[0]?.trim();
30
30
  const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
31
31
  if (isJSON) {
32
+ const contentLength = response.headers.get('content-length');
33
+ if (contentLength === '0') {
34
+ // if there is no content we can't do anything
35
+ return undefined as T;
36
+ }
37
+
32
38
  const json = await response.json();
33
39
  return json as T;
34
40
  }
@@ -0,0 +1,7 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import * as qs from '../qs/stringify';
4
+
5
+ export function stringifyQuery(query: object | Record<string, unknown>) {
6
+ return qs.stringify(query, { arrayFormat: 'comma' });
7
+ }
@@ -6,3 +6,4 @@ export * from './utils/env';
6
6
  export * from './utils/log';
7
7
  export * from './utils/uuid';
8
8
  export * from './utils/sleep';
9
+ export * from './utils/query';
@@ -40,7 +40,8 @@ export class Entity extends APIResource {
40
40
  *
41
41
  * Supports filtering by:
42
42
  *
43
- * - icp_id: Entities in sheets belonging to an ICP
43
+ * - icp_id: Entities in sheets belonging to ICP(s). Supports multiple values for
44
+ * filtering across ICPs (e.g., ?icp_id=abc&icp_id=def).
44
45
  * - sheet_id: Entities in a specific sheet
45
46
  * - entity_type: Entities of a specific type (company, person, etc.)
46
47
  * - status: Filter by workflow status (supports multiple:
@@ -131,10 +132,12 @@ export class Entity extends APIResource {
131
132
  * ?status=new&status=contacted) Valid values: new, reviewed, passed, contacted,
132
133
  * null
133
134
  *
134
- * Args: icp_id: Filter by ICP ID (REQUIRED for format=combined) sheet_id: Filter
135
- * by sheet ID entity_type: Filter by entity type (ignored for format=combined)
136
- * entity_ids: Export specific entity IDs status: Filter by status values (multiple
137
- * allowed) format: Export format - "separate" (default) or "combined"
135
+ * Args: icp_id: Filter by ICP ID(s). Supports multiple values for separate format
136
+ * (e.g., ?icp_id=abc&icp_id=def). Combined format only supports a single ICP.
137
+ * sheet_id: Filter by sheet ID entity_type: Filter by entity type (ignored for
138
+ * format=combined) entity_ids: Export specific entity IDs status: Filter by status
139
+ * values (multiple allowed) hide_duplicates: Exclude duplicate entities from
140
+ * export format: Export format - "separate" (default) or "combined"
138
141
  *
139
142
  * Returns: StreamingResponse with CSV content
140
143
  *
@@ -149,13 +152,16 @@ export class Entity extends APIResource {
149
152
  * Get entity counts grouped by entity_type.
150
153
  *
151
154
  * Returns the count of entities for each entity_type (company, person, etc.)
152
- * across the organization. Supports optional filtering by ICP or status.
155
+ * across the organization. Supports optional filtering by ICP(s) or status.
153
156
  *
154
- * Additional filtering:
157
+ * Filtering options:
155
158
  *
159
+ * - icp_id: Filter by ICP ID(s). Supports multiple values for counting across ICPs
160
+ * (e.g., ?icp_id=abc&icp_id=def).
156
161
  * - status: Filter by workflow status (supports multiple:
157
162
  * ?status=new&status=reviewed) Valid values: new, reviewed, passed, contacted,
158
163
  * null
164
+ * - hide_duplicates: When true, excludes duplicate entities from counts
159
165
  *
160
166
  * Used by Entity Master List for accurate tab navigation counts.
161
167
  */
@@ -175,7 +181,8 @@ export class Entity extends APIResource {
175
181
  * Scope of search determined by filters:
176
182
  *
177
183
  * - sheet_id: Search within specific sheet
178
- * - icp_id: Search across ICP sheets
184
+ * - icp_id: Search across ICP sheet(s). Supports multiple values for searching
185
+ * across ICPs (e.g., ?icp_id=abc&icp_id=def).
179
186
  * - No filters: Search org-wide
180
187
  *
181
188
  * Additional filtering:
@@ -469,7 +476,7 @@ export interface EntityUpdateParams {
469
476
 
470
477
  export interface EntityListParams {
471
478
  /**
472
- * Valid entity types for sheets.
479
+ * Filter by entity type
473
480
  */
474
481
  entity_type?: SheetAPI.EntityType | null;
475
482
 
@@ -479,9 +486,9 @@ export interface EntityListParams {
479
486
  hide_duplicates?: boolean;
480
487
 
481
488
  /**
482
- * Filter by ICP ID
489
+ * Filter by ICP ID(s) - supports multiple
483
490
  */
484
- icp_id?: string | null;
491
+ icp_id?: Array<string> | null;
485
492
 
486
493
  /**
487
494
  * Page number (1-based)
@@ -533,7 +540,7 @@ export interface EntityExportParams {
533
540
  entity_ids?: Array<string> | null;
534
541
 
535
542
  /**
536
- * Valid entity types for sheets.
543
+ * Filter by entity type
537
544
  */
538
545
  entity_type?: SheetAPI.EntityType | null;
539
546
 
@@ -543,9 +550,14 @@ export interface EntityExportParams {
543
550
  format?: 'separate' | 'combined';
544
551
 
545
552
  /**
546
- * Filter by ICP ID
553
+ * Exclude duplicate entities from export (show only primaries)
554
+ */
555
+ hide_duplicates?: boolean;
556
+
557
+ /**
558
+ * Filter by ICP ID(s) - supports multiple
547
559
  */
548
- icp_id?: string | null;
560
+ icp_id?: Array<string> | null;
549
561
 
550
562
  /**
551
563
  * Filter by sheet ID
@@ -560,9 +572,14 @@ export interface EntityExportParams {
560
572
 
561
573
  export interface EntityGetCountsParams {
562
574
  /**
563
- * Filter by ICP ID
575
+ * Exclude duplicate entities from counts (show only primaries)
576
+ */
577
+ hide_duplicates?: boolean;
578
+
579
+ /**
580
+ * Filter by ICP ID(s) - supports multiple
564
581
  */
565
- icp_id?: string | null;
582
+ icp_id?: Array<string> | null;
566
583
 
567
584
  /**
568
585
  * Filter by status values (supports multiple: ?status=new&status=passed)
@@ -577,7 +594,7 @@ export interface EntitySearchParams {
577
594
  q: string;
578
595
 
579
596
  /**
580
- * Valid entity types for sheets.
597
+ * Filter by entity type
581
598
  */
582
599
  entity_type?: SheetAPI.EntityType | null;
583
600
 
@@ -587,9 +604,9 @@ export interface EntitySearchParams {
587
604
  hide_duplicates?: boolean;
588
605
 
589
606
  /**
590
- * Filter by ICP ID
607
+ * Filter by ICP ID(s) - supports multiple
591
608
  */
592
- icp_id?: string | null;
609
+ icp_id?: Array<string> | null;
593
610
 
594
611
  /**
595
612
  * Page number
@@ -2,11 +2,13 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
- import { type Uploadable } from '../core/uploads';
6
5
  import { RequestOptions } from '../internal/request-options';
7
6
  import { multipartFormRequestOptions } from '../internal/uploads';
8
7
  import { path } from '../internal/utils/path';
9
8
 
9
+ /**
10
+ * **Files** are uploaded data sources for your research workflows. Upload CSV or XLSX files containing entities (companies, people) or monitoring targets. Files are processed and stored securely, then can be referenced when creating signal monitoring or ingest tasks. XLSX files are automatically converted to CSV format.
11
+ */
10
12
  export class Files extends APIResource {
11
13
  /**
12
14
  * Get file details by ID.
@@ -204,7 +206,7 @@ export interface FileUploadParams {
204
206
  /**
205
207
  * CSV or XLSX file to upload
206
208
  */
207
- file: Uploadable;
209
+ file: string;
208
210
  }
209
211
 
210
212
  export declare namespace Files {
@@ -6,6 +6,9 @@ import { buildHeaders } from '../internal/headers';
6
6
  import { RequestOptions } from '../internal/request-options';
7
7
  import { path } from '../internal/utils/path';
8
8
 
9
+ /**
10
+ * **Ideal Customer Profiles (ICPs)** define WHAT entities to target using business-level descriptions and filters. ICPs are the foundation of your research workflows - they specify targeting criteria like industry, company size, job titles, and other characteristics that define your ideal customers. Create ICPs first, then link Sheets to them for entity storage.
11
+ */
9
12
  export class Icp extends APIResource {
10
13
  /**
11
14
  * Create a new Ideal Customer Profile (ICP).
@@ -136,6 +139,16 @@ export interface IcpResponse {
136
139
  name: string;
137
140
 
138
141
  updated_at: string;
142
+
143
+ /**
144
+ * v2 entity structure (lightweight, no descriptions)
145
+ */
146
+ entity_structure?: Array<IcpResponse.EntityStructure> | null;
147
+
148
+ /**
149
+ * ICP schema version (1 or 2)
150
+ */
151
+ schema_version?: number;
139
152
  }
140
153
 
141
154
  export namespace IcpResponse {
@@ -176,6 +189,29 @@ export namespace IcpResponse {
176
189
  */
177
190
  desired_count?: number | null;
178
191
  }
192
+
193
+ /**
194
+ * Response model for v2 entity structure entry.
195
+ *
196
+ * Lightweight structure that defines entity types and their hierarchy without the
197
+ * business description (which lives on sheets in v2).
198
+ */
199
+ export interface EntityStructure {
200
+ /**
201
+ * Entity type (company, person, etc.)
202
+ */
203
+ entity_type: string;
204
+
205
+ /**
206
+ * If this is the root entity type
207
+ */
208
+ root: boolean;
209
+
210
+ /**
211
+ * For non-root entities, desired count per parent
212
+ */
213
+ desired_count?: number | null;
214
+ }
179
215
  }
180
216
 
181
217
  /**
@@ -44,6 +44,16 @@ export {
44
44
  type RunListParams,
45
45
  type RunGetQueueParams,
46
46
  } from './run';
47
+ export {
48
+ Schedule,
49
+ type CreateScheduleRequest,
50
+ type ScheduleListResponse,
51
+ type ScheduleResponse,
52
+ type UpdateScheduleRequest,
53
+ type ScheduleCreateParams,
54
+ type ScheduleUpdateParams,
55
+ type ScheduleListParams,
56
+ } from './schedule';
47
57
  export {
48
58
  SheetResource,
49
59
  type EntityType,
@@ -6,6 +6,9 @@ import { buildHeaders } from '../internal/headers';
6
6
  import { RequestOptions } from '../internal/request-options';
7
7
  import { path } from '../internal/utils/path';
8
8
 
9
+ /**
10
+ * **Runs** represent individual workflow executions. When you execute a task, it creates a run that progresses through states: SCHEDULED -> PENDING -> RUNNING -> COMPLETED (or FAILED/CANCELED). Monitor run status, view processing queues, and cancel running workflows through these endpoints.
11
+ */
9
12
  export class Run extends APIResource {
10
13
  /**
11
14
  * Execute an agent by creating a new run.