newscatcher-catchall-sdk 1.5.1 → 2.0.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.
- package/README.md +11 -2
- package/dist/cjs/BaseClient.d.ts +3 -0
- package/dist/cjs/BaseClient.js +17 -2
- package/dist/cjs/api/resources/datasets/client/Client.d.ts +30 -31
- package/dist/cjs/api/resources/datasets/client/Client.js +55 -64
- package/dist/cjs/api/resources/datasets/client/requests/ListDatasetEntitiesRequest.d.ts +28 -0
- package/dist/cjs/api/resources/datasets/client/requests/ListDatasetsRequest.d.ts +0 -1
- package/dist/cjs/api/resources/datasets/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/entities/client/Client.d.ts +3 -7
- package/dist/cjs/api/resources/entities/client/Client.js +3 -7
- package/dist/cjs/api/resources/jobs/client/Client.d.ts +2 -4
- package/dist/cjs/api/resources/jobs/client/Client.js +2 -4
- package/dist/cjs/api/resources/jobs/client/requests/GetUserJobsRequest.d.ts +0 -1
- package/dist/cjs/api/resources/jobs/client/requests/SubmitRequestDto.d.ts +7 -1
- package/dist/cjs/api/resources/monitors/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/monitors/client/Client.js +2 -1
- package/dist/cjs/api/resources/monitors/client/requests/CreateMonitorRequestDto.d.ts +7 -4
- package/dist/cjs/api/resources/monitors/client/requests/ListMonitorsRequest.d.ts +0 -1
- package/dist/cjs/api/types/ConnectedEntity.d.ts +12 -9
- package/dist/cjs/core/auth/AuthProvider.d.ts +1 -0
- package/dist/cjs/core/auth/AuthProvider.js +7 -0
- package/dist/cjs/core/auth/index.d.ts +1 -1
- package/dist/cjs/core/auth/index.js +3 -1
- package/dist/cjs/core/fetcher/requestWithRetries.js +4 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +3 -0
- package/dist/esm/BaseClient.mjs +17 -2
- package/dist/esm/api/resources/datasets/client/Client.d.mts +30 -31
- package/dist/esm/api/resources/datasets/client/Client.mjs +55 -64
- package/dist/esm/api/resources/datasets/client/requests/ListDatasetEntitiesRequest.d.mts +28 -0
- package/dist/esm/api/resources/datasets/client/requests/ListDatasetsRequest.d.mts +0 -1
- package/dist/esm/api/resources/datasets/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/entities/client/Client.d.mts +3 -7
- package/dist/esm/api/resources/entities/client/Client.mjs +3 -7
- package/dist/esm/api/resources/jobs/client/Client.d.mts +2 -4
- package/dist/esm/api/resources/jobs/client/Client.mjs +2 -4
- package/dist/esm/api/resources/jobs/client/requests/GetUserJobsRequest.d.mts +0 -1
- package/dist/esm/api/resources/jobs/client/requests/SubmitRequestDto.d.mts +7 -1
- package/dist/esm/api/resources/monitors/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/monitors/client/Client.mjs +2 -1
- package/dist/esm/api/resources/monitors/client/requests/CreateMonitorRequestDto.d.mts +7 -4
- package/dist/esm/api/resources/monitors/client/requests/ListMonitorsRequest.d.mts +0 -1
- package/dist/esm/api/types/ConnectedEntity.d.mts +12 -9
- package/dist/esm/core/auth/AuthProvider.d.mts +1 -0
- package/dist/esm/core/auth/AuthProvider.mjs +6 -1
- package/dist/esm/core/auth/index.d.mts +1 -1
- package/dist/esm/core/auth/index.mjs +1 -0
- package/dist/esm/core/fetcher/requestWithRetries.mjs +4 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
- package/reference.md +35 -42
- package/dist/cjs/api/resources/datasets/client/requests/ListEntitiesInDatasetRequest.d.ts +0 -21
- package/dist/esm/api/resources/datasets/client/requests/ListEntitiesInDatasetRequest.d.mts +0 -21
- /package/dist/cjs/api/resources/datasets/client/requests/{ListEntitiesInDatasetRequest.js → ListDatasetEntitiesRequest.js} +0 -0
- /package/dist/esm/api/resources/datasets/client/requests/{ListEntitiesInDatasetRequest.mjs → ListDatasetEntitiesRequest.mjs} +0 -0
|
@@ -3,7 +3,8 @@ import type * as CatchAllApi from "../../../../index.js";
|
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
5
|
* reference_job_id: "5f0c9087-85cb-4917-b3c7-e5a5eff73a0c",
|
|
6
|
-
* schedule: "every day at 12 PM
|
|
6
|
+
* schedule: "every day at 12 PM",
|
|
7
|
+
* timezone: "UTC",
|
|
7
8
|
* webhook: {
|
|
8
9
|
* url: "https://your-endpoint.com/webhook",
|
|
9
10
|
* method: "POST",
|
|
@@ -22,12 +23,14 @@ export interface CreateMonitorRequestDto {
|
|
|
22
23
|
* If [`backfill`](https://www.newscatcherapi.com/docs/web-search-api/api-reference/monitors/create-monitor#body-backfill) is true, the job's `end_date` must be within the last 7 days.
|
|
23
24
|
*/
|
|
24
25
|
reference_job_id: string;
|
|
26
|
+
/** Monitor schedule in plain text format. Minimum frequency depends on your plan. */
|
|
27
|
+
schedule: string;
|
|
25
28
|
/**
|
|
26
|
-
*
|
|
29
|
+
* The IANA timezone identifier used as the fallback when the `schedule` string does not include an explicit timezone.
|
|
27
30
|
*
|
|
28
|
-
*
|
|
31
|
+
* If the schedule includes a timezone abbreviation (for example, `"every day at 9am EST"`), the parsed timezone takes priority and this value is ignored.
|
|
29
32
|
*/
|
|
30
|
-
|
|
33
|
+
timezone?: string;
|
|
31
34
|
/** Optional webhook to receive notifications when jobs complete. */
|
|
32
35
|
webhook?: CatchAllApi.WebhookDto;
|
|
33
36
|
/** Maximum number of records per monitor run. If not provided, defaults to the plan limit. */
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import type * as CatchAllApi from "../index.js";
|
|
1
2
|
/**
|
|
2
|
-
* A company entity matched to a record in a Company Watchlist job, with
|
|
3
|
-
* a relevance score and explanation.
|
|
3
|
+
* A company entity matched to a record in a Company Watchlist job, with a relevance score and explanation.
|
|
4
4
|
*
|
|
5
|
-
* Only entities with `ed_score` ≥ 1 appear in results. Entities scored
|
|
6
|
-
* 0 are filtered out before the response is returned.
|
|
5
|
+
* Only entities with `ed_score` ≥ 1 appear in results. Entities scored 0 are filtered out before the response is returned. When `ed_score_min` is set at submission time, entities below that threshold are excluded.
|
|
7
6
|
*/
|
|
8
7
|
export interface ConnectedEntity {
|
|
9
8
|
/** Unique identifier of the matched entity. */
|
|
@@ -11,8 +10,7 @@ export interface ConnectedEntity {
|
|
|
11
10
|
/** Name of the matched entity. */
|
|
12
11
|
name: string;
|
|
13
12
|
/**
|
|
14
|
-
* Relevance score indicating how directly the entity is associated
|
|
15
|
-
* with this event.
|
|
13
|
+
* Relevance score indicating how directly the entity is associated with this event.
|
|
16
14
|
*
|
|
17
15
|
* | Score | Meaning |
|
|
18
16
|
* |-------|---------|
|
|
@@ -22,9 +20,14 @@ export interface ConnectedEntity {
|
|
|
22
20
|
* | 1–3 | Indirect mention (listed with others, stock noise) |
|
|
23
21
|
*/
|
|
24
22
|
ed_score: number;
|
|
23
|
+
/** Short explanation (up to 100 characters) of why this entity is associated with the event. */
|
|
24
|
+
relation: string;
|
|
25
|
+
/** The entity type. */
|
|
26
|
+
type: string;
|
|
25
27
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
+
* The stored attributes for this entity. Present only when attributes exist in the database.
|
|
29
|
+
*
|
|
30
|
+
* The field name matches the value of `type` — for example, `"company"` type entities have a `company` field.
|
|
28
31
|
*/
|
|
29
|
-
|
|
32
|
+
company?: CatchAllApi.CompanyAttributes | undefined;
|
|
30
33
|
}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAuthProvider = isAuthProvider;
|
|
4
|
+
function isAuthProvider(value) {
|
|
5
|
+
return (typeof value === "object" &&
|
|
6
|
+
value !== null &&
|
|
7
|
+
"getAuthRequest" in value &&
|
|
8
|
+
typeof value.getAuthRequest === "function");
|
|
9
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export { type AuthProvider, isAuthProvider } from "./AuthProvider.js";
|
|
2
2
|
export type { AuthRequest } from "./AuthRequest.js";
|
|
3
3
|
export { BasicAuth } from "./BasicAuth.js";
|
|
4
4
|
export { BearerToken } from "./BearerToken.js";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NoOpAuthProvider = exports.BearerToken = exports.BasicAuth = void 0;
|
|
3
|
+
exports.NoOpAuthProvider = exports.BearerToken = exports.BasicAuth = exports.isAuthProvider = void 0;
|
|
4
|
+
var AuthProvider_js_1 = require("./AuthProvider.js");
|
|
5
|
+
Object.defineProperty(exports, "isAuthProvider", { enumerable: true, get: function () { return AuthProvider_js_1.isAuthProvider; } });
|
|
4
6
|
var BasicAuth_js_1 = require("./BasicAuth.js");
|
|
5
7
|
Object.defineProperty(exports, "BasicAuth", { enumerable: true, get: function () { return BasicAuth_js_1.BasicAuth; } });
|
|
6
8
|
var BearerToken_js_1 = require("./BearerToken.js");
|
|
@@ -14,6 +14,9 @@ const INITIAL_RETRY_DELAY = 1000; // in milliseconds
|
|
|
14
14
|
const MAX_RETRY_DELAY = 60000; // in milliseconds
|
|
15
15
|
const DEFAULT_MAX_RETRIES = 2;
|
|
16
16
|
const JITTER_FACTOR = 0.2; // 20% random jitter
|
|
17
|
+
function isRetryableStatusCode(statusCode) {
|
|
18
|
+
return [408, 429].includes(statusCode) || statusCode >= 500;
|
|
19
|
+
}
|
|
17
20
|
function addPositiveJitter(delay) {
|
|
18
21
|
const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR;
|
|
19
22
|
return delay * jitterMultiplier;
|
|
@@ -53,7 +56,7 @@ function requestWithRetries(requestFn_1) {
|
|
|
53
56
|
return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
|
|
54
57
|
let response = yield requestFn();
|
|
55
58
|
for (let i = 0; i < maxRetries; ++i) {
|
|
56
|
-
if (
|
|
59
|
+
if (isRetryableStatusCode(response.status)) {
|
|
57
60
|
const delay = getRetryDelayFromHeaders(response, i);
|
|
58
61
|
yield new Promise((resolve) => setTimeout(resolve, delay));
|
|
59
62
|
response = yield requestFn();
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "2.0.0";
|
package/dist/cjs/version.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HeaderAuthProvider } from "./auth/HeaderAuthProvider.mjs";
|
|
2
2
|
import * as core from "./core/index.mjs";
|
|
3
3
|
import type * as environments from "./environments.mjs";
|
|
4
|
+
export type AuthOption = false | core.AuthProvider["getAuthRequest"] | core.AuthProvider | HeaderAuthProvider.AuthOptions;
|
|
4
5
|
export type BaseClientOptions = {
|
|
5
6
|
environment?: core.Supplier<environments.CatchAllApiEnvironment | string>;
|
|
6
7
|
/** Specify a custom URL to connect the client to. */
|
|
@@ -15,6 +16,8 @@ export type BaseClientOptions = {
|
|
|
15
16
|
fetch?: typeof fetch;
|
|
16
17
|
/** Configure logging for the client. */
|
|
17
18
|
logging?: core.logging.LogConfig | core.logging.Logger;
|
|
19
|
+
/** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */
|
|
20
|
+
auth?: AuthOption;
|
|
18
21
|
} & HeaderAuthProvider.AuthOptions;
|
|
19
22
|
export interface BaseRequestOptions {
|
|
20
23
|
/** The maximum time to wait for a response in seconds. */
|
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "newscatcher-catchall-sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "
|
|
10
|
-
"User-Agent": "newscatcher-catchall-sdk/
|
|
9
|
+
"X-Fern-SDK-Version": "2.0.0",
|
|
10
|
+
"User-Agent": "newscatcher-catchall-sdk/2.0.0",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -16,6 +16,21 @@ export function normalizeClientOptions(options) {
|
|
|
16
16
|
export function normalizeClientOptionsWithAuth(options) {
|
|
17
17
|
var _a;
|
|
18
18
|
const normalized = normalizeClientOptions(options);
|
|
19
|
+
if (options.auth === false) {
|
|
20
|
+
normalized.authProvider = new core.NoOpAuthProvider();
|
|
21
|
+
return normalized;
|
|
22
|
+
}
|
|
23
|
+
if (options.auth != null) {
|
|
24
|
+
if (typeof options.auth === "function") {
|
|
25
|
+
normalized.authProvider = { getAuthRequest: options.auth };
|
|
26
|
+
return normalized;
|
|
27
|
+
}
|
|
28
|
+
if (core.isAuthProvider(options.auth)) {
|
|
29
|
+
normalized.authProvider = options.auth;
|
|
30
|
+
return normalized;
|
|
31
|
+
}
|
|
32
|
+
Object.assign(normalized, options.auth);
|
|
33
|
+
}
|
|
19
34
|
const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
|
|
20
35
|
(_a = normalized.authProvider) !== null && _a !== void 0 ? _a : (normalized.authProvider = new HeaderAuthProvider(normalizedWithNoOpAuthProvider));
|
|
21
36
|
return normalized;
|
|
@@ -18,9 +18,7 @@ export declare class DatasetsClient {
|
|
|
18
18
|
protected readonly _options: NormalizedClientOptionsWithAuth<DatasetsClient.Options>;
|
|
19
19
|
constructor(options?: DatasetsClient.Options);
|
|
20
20
|
/**
|
|
21
|
-
* Returns a paginated list of datasets belonging to the authenticated
|
|
22
|
-
* organization. Supports filtering by status and sorting by name,
|
|
23
|
-
* status, or creation date.
|
|
21
|
+
* Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date.
|
|
24
22
|
*
|
|
25
23
|
* @param {CatchAllApi.ListDatasetsRequest} request
|
|
26
24
|
* @param {DatasetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -61,9 +59,7 @@ export declare class DatasetsClient {
|
|
|
61
59
|
createDataset(request: CatchAllApi.CreateDatasetRequest, requestOptions?: DatasetsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.DatasetResponse>;
|
|
62
60
|
private __createDataset;
|
|
63
61
|
/**
|
|
64
|
-
* Creates a new dataset by uploading a CSV file. Each row in the CSV
|
|
65
|
-
* becomes an entity. The `name` column is required; all other columns
|
|
66
|
-
* are optional.
|
|
62
|
+
* Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. The `name` and `domain`columns are required; all other columns are optional.
|
|
67
63
|
*
|
|
68
64
|
* **CSV format:**
|
|
69
65
|
* ```csv
|
|
@@ -144,22 +140,6 @@ export declare class DatasetsClient {
|
|
|
144
140
|
*/
|
|
145
141
|
updateDataset(request: CatchAllApi.UpdateDatasetRequest, requestOptions?: DatasetsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.DatasetResponse>;
|
|
146
142
|
private __updateDataset;
|
|
147
|
-
/**
|
|
148
|
-
* Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
|
|
149
|
-
*
|
|
150
|
-
* @param {CatchAllApi.ListEntitiesInDatasetRequest} request
|
|
151
|
-
* @param {DatasetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
152
|
-
*
|
|
153
|
-
* @throws {@link CatchAllApi.ForbiddenError}
|
|
154
|
-
* @throws {@link CatchAllApi.NotFoundError}
|
|
155
|
-
*
|
|
156
|
-
* @example
|
|
157
|
-
* await client.datasets.listEntitiesInDataset({
|
|
158
|
-
* dataset_id: "ccabb755-afc2-4047-b84c-78d1f23d49b2"
|
|
159
|
-
* })
|
|
160
|
-
*/
|
|
161
|
-
listEntitiesInDataset(request: CatchAllApi.ListEntitiesInDatasetRequest, requestOptions?: DatasetsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.DatasetEntityListResponse>;
|
|
162
|
-
private __listEntitiesInDataset;
|
|
163
143
|
/**
|
|
164
144
|
* Adds one or more existing entities to a dataset. Returns the number of entities added.
|
|
165
145
|
*
|
|
@@ -181,9 +161,7 @@ export declare class DatasetsClient {
|
|
|
181
161
|
addEntitiesToDataset(request: CatchAllApi.AddEntitiesToDatasetRequest, requestOptions?: DatasetsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.ManageEntitiesResponse>;
|
|
182
162
|
private __addEntitiesToDataset;
|
|
183
163
|
/**
|
|
184
|
-
* Removes one or more entities from a dataset. The entities themselves
|
|
185
|
-
* are not deleted — they are only removed from this dataset. Returns
|
|
186
|
-
* the number of entities removed.
|
|
164
|
+
* Removes one or more entities from a dataset. The entities themselves are not deleted — they are only removed from this dataset. Returns the number of entities removed.
|
|
187
165
|
*
|
|
188
166
|
* @param {CatchAllApi.RemoveEntitiesFromDatasetRequest} request
|
|
189
167
|
* @param {DatasetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -203,8 +181,31 @@ export declare class DatasetsClient {
|
|
|
203
181
|
removeEntitiesFromDataset(request: CatchAllApi.RemoveEntitiesFromDatasetRequest, requestOptions?: DatasetsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.ManageEntitiesResponse>;
|
|
204
182
|
private __removeEntitiesFromDataset;
|
|
205
183
|
/**
|
|
206
|
-
* Returns
|
|
207
|
-
*
|
|
184
|
+
* Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
|
|
185
|
+
*
|
|
186
|
+
* @param {CatchAllApi.ListDatasetEntitiesRequest} request
|
|
187
|
+
* @param {DatasetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
188
|
+
*
|
|
189
|
+
* @throws {@link CatchAllApi.ForbiddenError}
|
|
190
|
+
* @throws {@link CatchAllApi.NotFoundError}
|
|
191
|
+
* @throws {@link CatchAllApi.UnprocessableEntityError}
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* await client.datasets.listEntitiesInDataset({
|
|
195
|
+
* dataset_id: "ccabb755-afc2-4047-b84c-78d1f23d49b2",
|
|
196
|
+
* page: 1,
|
|
197
|
+
* page_size: 100,
|
|
198
|
+
* search: "OpenAI",
|
|
199
|
+
* status: "ready",
|
|
200
|
+
* entity_type: "company",
|
|
201
|
+
* sort_by: "created_at",
|
|
202
|
+
* sort_order: "desc"
|
|
203
|
+
* })
|
|
204
|
+
*/
|
|
205
|
+
listEntitiesInDataset(request: CatchAllApi.ListDatasetEntitiesRequest, requestOptions?: DatasetsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.DatasetEntityListResponse>;
|
|
206
|
+
private __listEntitiesInDataset;
|
|
207
|
+
/**
|
|
208
|
+
* Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
|
|
208
209
|
*
|
|
209
210
|
* @param {CatchAllApi.GetDatasetStatusHistoryRequest} request
|
|
210
211
|
* @param {DatasetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -220,11 +221,9 @@ export declare class DatasetsClient {
|
|
|
220
221
|
getDatasetStatusHistory(request: CatchAllApi.GetDatasetStatusHistoryRequest, requestOptions?: DatasetsClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.DatasetStatusHistoryResponse>;
|
|
221
222
|
private __getDatasetStatusHistory;
|
|
222
223
|
/**
|
|
223
|
-
* Appends new companies to an existing dataset by uploading a CSV file.
|
|
224
|
-
* Uses the same CSV format as the dataset creation endpoint.
|
|
224
|
+
* Appends new companies to an existing dataset by uploading a CSV file. Uses the same CSV format as the dataset creation endpoint.
|
|
225
225
|
*
|
|
226
|
-
* The response omits `dataset_name` compared to the create-from-CSV
|
|
227
|
-
* endpoint since the dataset already exists.
|
|
226
|
+
* The response omits `dataset_name` compared to the create-from-CSV endpoint since the dataset already exists.
|
|
228
227
|
*
|
|
229
228
|
* @param {CatchAllApi.UploadCsvToDatasetRequest} request
|
|
230
229
|
* @param {DatasetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -38,9 +38,7 @@ export class DatasetsClient {
|
|
|
38
38
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
* Returns a paginated list of datasets belonging to the authenticated
|
|
42
|
-
* organization. Supports filtering by status and sorting by name,
|
|
43
|
-
* status, or creation date.
|
|
41
|
+
* Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date.
|
|
44
42
|
*
|
|
45
43
|
* @param {CatchAllApi.ListDatasetsRequest} request
|
|
46
44
|
* @param {DatasetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -172,9 +170,7 @@ export class DatasetsClient {
|
|
|
172
170
|
});
|
|
173
171
|
}
|
|
174
172
|
/**
|
|
175
|
-
* Creates a new dataset by uploading a CSV file. Each row in the CSV
|
|
176
|
-
* becomes an entity. The `name` column is required; all other columns
|
|
177
|
-
* are optional.
|
|
173
|
+
* Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. The `name` and `domain`columns are required; all other columns are optional.
|
|
178
174
|
*
|
|
179
175
|
* **CSV format:**
|
|
180
176
|
* ```csv
|
|
@@ -422,46 +418,40 @@ export class DatasetsClient {
|
|
|
422
418
|
});
|
|
423
419
|
}
|
|
424
420
|
/**
|
|
425
|
-
*
|
|
421
|
+
* Adds one or more existing entities to a dataset. Returns the number of entities added.
|
|
426
422
|
*
|
|
427
|
-
* @param {CatchAllApi.
|
|
423
|
+
* @param {CatchAllApi.AddEntitiesToDatasetRequest} request
|
|
428
424
|
* @param {DatasetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
429
425
|
*
|
|
430
426
|
* @throws {@link CatchAllApi.ForbiddenError}
|
|
431
427
|
* @throws {@link CatchAllApi.NotFoundError}
|
|
428
|
+
* @throws {@link CatchAllApi.UnprocessableEntityError}
|
|
432
429
|
*
|
|
433
430
|
* @example
|
|
434
|
-
* await client.datasets.
|
|
435
|
-
* dataset_id: "ccabb755-afc2-4047-b84c-78d1f23d49b2"
|
|
431
|
+
* await client.datasets.addEntitiesToDataset({
|
|
432
|
+
* dataset_id: "ccabb755-afc2-4047-b84c-78d1f23d49b2",
|
|
433
|
+
* body: {
|
|
434
|
+
* entity_ids: ["854198fa-f702-49db-a381-0427fa87f173"]
|
|
435
|
+
* }
|
|
436
436
|
* })
|
|
437
437
|
*/
|
|
438
|
-
|
|
439
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
438
|
+
addEntitiesToDataset(request, requestOptions) {
|
|
439
|
+
return core.HttpResponsePromise.fromPromise(this.__addEntitiesToDataset(request, requestOptions));
|
|
440
440
|
}
|
|
441
|
-
|
|
441
|
+
__addEntitiesToDataset(request, requestOptions) {
|
|
442
442
|
return __awaiter(this, void 0, void 0, function* () {
|
|
443
443
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
444
|
-
const { dataset_id: datasetId,
|
|
445
|
-
const _queryParams = {
|
|
446
|
-
page,
|
|
447
|
-
page_size: pageSize,
|
|
448
|
-
search,
|
|
449
|
-
status: status != null ? status : undefined,
|
|
450
|
-
entity_type: entityType != null ? entityType : undefined,
|
|
451
|
-
sort_by: sortBy != null ? sortBy : undefined,
|
|
452
|
-
sort_order: sortOrder != null ? sortOrder : undefined,
|
|
453
|
-
};
|
|
444
|
+
const { dataset_id: datasetId, body: _body } = request;
|
|
454
445
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
455
446
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
456
447
|
const _response = yield core.fetcher({
|
|
457
448
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, `catchAll/datasets/${core.url.encodePathParam(datasetId)}/entities`),
|
|
458
|
-
method: "
|
|
449
|
+
method: "POST",
|
|
459
450
|
headers: _headers,
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
.build(),
|
|
451
|
+
contentType: "application/json",
|
|
452
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
453
|
+
requestType: "json",
|
|
454
|
+
body: _body,
|
|
465
455
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
466
456
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
467
457
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -469,10 +459,7 @@ export class DatasetsClient {
|
|
|
469
459
|
logging: this._options.logging,
|
|
470
460
|
});
|
|
471
461
|
if (_response.ok) {
|
|
472
|
-
return {
|
|
473
|
-
data: _response.body,
|
|
474
|
-
rawResponse: _response.rawResponse,
|
|
475
|
-
};
|
|
462
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
476
463
|
}
|
|
477
464
|
if (_response.error.reason === "status-code") {
|
|
478
465
|
switch (_response.error.statusCode) {
|
|
@@ -480,6 +467,8 @@ export class DatasetsClient {
|
|
|
480
467
|
throw new CatchAllApi.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
481
468
|
case 404:
|
|
482
469
|
throw new CatchAllApi.NotFoundError(_response.error.body, _response.rawResponse);
|
|
470
|
+
case 422:
|
|
471
|
+
throw new CatchAllApi.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
483
472
|
default:
|
|
484
473
|
throw new errors.CatchAllApiError({
|
|
485
474
|
statusCode: _response.error.statusCode,
|
|
@@ -488,13 +477,13 @@ export class DatasetsClient {
|
|
|
488
477
|
});
|
|
489
478
|
}
|
|
490
479
|
}
|
|
491
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "
|
|
480
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/catchAll/datasets/{dataset_id}/entities");
|
|
492
481
|
});
|
|
493
482
|
}
|
|
494
483
|
/**
|
|
495
|
-
*
|
|
484
|
+
* Removes one or more entities from a dataset. The entities themselves are not deleted — they are only removed from this dataset. Returns the number of entities removed.
|
|
496
485
|
*
|
|
497
|
-
* @param {CatchAllApi.
|
|
486
|
+
* @param {CatchAllApi.RemoveEntitiesFromDatasetRequest} request
|
|
498
487
|
* @param {DatasetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
499
488
|
*
|
|
500
489
|
* @throws {@link CatchAllApi.ForbiddenError}
|
|
@@ -502,17 +491,17 @@ export class DatasetsClient {
|
|
|
502
491
|
* @throws {@link CatchAllApi.UnprocessableEntityError}
|
|
503
492
|
*
|
|
504
493
|
* @example
|
|
505
|
-
* await client.datasets.
|
|
494
|
+
* await client.datasets.removeEntitiesFromDataset({
|
|
506
495
|
* dataset_id: "ccabb755-afc2-4047-b84c-78d1f23d49b2",
|
|
507
496
|
* body: {
|
|
508
497
|
* entity_ids: ["854198fa-f702-49db-a381-0427fa87f173"]
|
|
509
498
|
* }
|
|
510
499
|
* })
|
|
511
500
|
*/
|
|
512
|
-
|
|
513
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
501
|
+
removeEntitiesFromDataset(request, requestOptions) {
|
|
502
|
+
return core.HttpResponsePromise.fromPromise(this.__removeEntitiesFromDataset(request, requestOptions));
|
|
514
503
|
}
|
|
515
|
-
|
|
504
|
+
__removeEntitiesFromDataset(request, requestOptions) {
|
|
516
505
|
return __awaiter(this, void 0, void 0, function* () {
|
|
517
506
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
518
507
|
const { dataset_id: datasetId, body: _body } = request;
|
|
@@ -520,7 +509,7 @@ export class DatasetsClient {
|
|
|
520
509
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
521
510
|
const _response = yield core.fetcher({
|
|
522
511
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, `catchAll/datasets/${core.url.encodePathParam(datasetId)}/entities`),
|
|
523
|
-
method: "
|
|
512
|
+
method: "DELETE",
|
|
524
513
|
headers: _headers,
|
|
525
514
|
contentType: "application/json",
|
|
526
515
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
@@ -551,15 +540,13 @@ export class DatasetsClient {
|
|
|
551
540
|
});
|
|
552
541
|
}
|
|
553
542
|
}
|
|
554
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "
|
|
543
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/catchAll/datasets/{dataset_id}/entities");
|
|
555
544
|
});
|
|
556
545
|
}
|
|
557
546
|
/**
|
|
558
|
-
*
|
|
559
|
-
* are not deleted — they are only removed from this dataset. Returns
|
|
560
|
-
* the number of entities removed.
|
|
547
|
+
* Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
|
|
561
548
|
*
|
|
562
|
-
* @param {CatchAllApi.
|
|
549
|
+
* @param {CatchAllApi.ListDatasetEntitiesRequest} request
|
|
563
550
|
* @param {DatasetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
564
551
|
*
|
|
565
552
|
* @throws {@link CatchAllApi.ForbiddenError}
|
|
@@ -567,25 +554,29 @@ export class DatasetsClient {
|
|
|
567
554
|
* @throws {@link CatchAllApi.UnprocessableEntityError}
|
|
568
555
|
*
|
|
569
556
|
* @example
|
|
570
|
-
* await client.datasets.
|
|
557
|
+
* await client.datasets.listEntitiesInDataset({
|
|
571
558
|
* dataset_id: "ccabb755-afc2-4047-b84c-78d1f23d49b2",
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
559
|
+
* page: 1,
|
|
560
|
+
* page_size: 100,
|
|
561
|
+
* search: "OpenAI",
|
|
562
|
+
* status: "ready",
|
|
563
|
+
* entity_type: "company",
|
|
564
|
+
* sort_by: "created_at",
|
|
565
|
+
* sort_order: "desc"
|
|
575
566
|
* })
|
|
576
567
|
*/
|
|
577
|
-
|
|
578
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
568
|
+
listEntitiesInDataset(request, requestOptions) {
|
|
569
|
+
return core.HttpResponsePromise.fromPromise(this.__listEntitiesInDataset(request, requestOptions));
|
|
579
570
|
}
|
|
580
|
-
|
|
571
|
+
__listEntitiesInDataset(request, requestOptions) {
|
|
581
572
|
return __awaiter(this, void 0, void 0, function* () {
|
|
582
573
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
583
|
-
const { dataset_id: datasetId,
|
|
574
|
+
const { dataset_id: datasetId } = request, _body = __rest(request, ["dataset_id"]);
|
|
584
575
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
585
576
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
586
577
|
const _response = yield core.fetcher({
|
|
587
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, `catchAll/datasets/${core.url.encodePathParam(datasetId)}/entities`),
|
|
588
|
-
method: "
|
|
578
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CatchAllApiEnvironment.Default, `catchAll/datasets/${core.url.encodePathParam(datasetId)}/entities/list`),
|
|
579
|
+
method: "POST",
|
|
589
580
|
headers: _headers,
|
|
590
581
|
contentType: "application/json",
|
|
591
582
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
@@ -598,7 +589,10 @@ export class DatasetsClient {
|
|
|
598
589
|
logging: this._options.logging,
|
|
599
590
|
});
|
|
600
591
|
if (_response.ok) {
|
|
601
|
-
return {
|
|
592
|
+
return {
|
|
593
|
+
data: _response.body,
|
|
594
|
+
rawResponse: _response.rawResponse,
|
|
595
|
+
};
|
|
602
596
|
}
|
|
603
597
|
if (_response.error.reason === "status-code") {
|
|
604
598
|
switch (_response.error.statusCode) {
|
|
@@ -616,12 +610,11 @@ export class DatasetsClient {
|
|
|
616
610
|
});
|
|
617
611
|
}
|
|
618
612
|
}
|
|
619
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "
|
|
613
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/catchAll/datasets/{dataset_id}/entities/list");
|
|
620
614
|
});
|
|
621
615
|
}
|
|
622
616
|
/**
|
|
623
|
-
* Returns the full status change history for a dataset, ordered
|
|
624
|
-
* chronologically from oldest to newest.
|
|
617
|
+
* Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
|
|
625
618
|
*
|
|
626
619
|
* @param {CatchAllApi.GetDatasetStatusHistoryRequest} request
|
|
627
620
|
* @param {DatasetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -678,11 +671,9 @@ export class DatasetsClient {
|
|
|
678
671
|
});
|
|
679
672
|
}
|
|
680
673
|
/**
|
|
681
|
-
* Appends new companies to an existing dataset by uploading a CSV file.
|
|
682
|
-
* Uses the same CSV format as the dataset creation endpoint.
|
|
674
|
+
* Appends new companies to an existing dataset by uploading a CSV file. Uses the same CSV format as the dataset creation endpoint.
|
|
683
675
|
*
|
|
684
|
-
* The response omits `dataset_name` compared to the create-from-CSV
|
|
685
|
-
* endpoint since the dataset already exists.
|
|
676
|
+
* The response omits `dataset_name` compared to the create-from-CSV endpoint since the dataset already exists.
|
|
686
677
|
*
|
|
687
678
|
* @param {CatchAllApi.UploadCsvToDatasetRequest} request
|
|
688
679
|
* @param {DatasetsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type * as CatchAllApi from "../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* dataset_id: "ccabb755-afc2-4047-b84c-78d1f23d49b2",
|
|
6
|
+
* page: 1,
|
|
7
|
+
* page_size: 100,
|
|
8
|
+
* search: "OpenAI",
|
|
9
|
+
* status: "ready",
|
|
10
|
+
* entity_type: "company",
|
|
11
|
+
* sort_by: "created_at",
|
|
12
|
+
* sort_order: "desc"
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
export interface ListDatasetEntitiesRequest {
|
|
16
|
+
/** Unique dataset identifier. */
|
|
17
|
+
dataset_id: string;
|
|
18
|
+
/** The page number to retrieve. */
|
|
19
|
+
page?: number;
|
|
20
|
+
/** The number of entities per page. */
|
|
21
|
+
page_size?: number;
|
|
22
|
+
/** Filters entities by name using a case-insensitive substring match. */
|
|
23
|
+
search?: string;
|
|
24
|
+
status?: CatchAllApi.EntityStatus;
|
|
25
|
+
entity_type?: CatchAllApi.EntityType;
|
|
26
|
+
sort_by?: CatchAllApi.EntitySortBy;
|
|
27
|
+
sort_order?: CatchAllApi.SortOrder;
|
|
28
|
+
}
|
|
@@ -16,6 +16,5 @@ export interface ListDatasetsRequest {
|
|
|
16
16
|
latest_status?: CatchAllApi.DatasetStatus;
|
|
17
17
|
sort_by?: CatchAllApi.DatasetSortBy;
|
|
18
18
|
sort_order?: CatchAllApi.SortOrder;
|
|
19
|
-
/** Filter results by ownership. Defaults to `all`. */
|
|
20
19
|
ownership?: CatchAllApi.OwnershipFilter;
|
|
21
20
|
}
|
|
@@ -4,8 +4,8 @@ export type { CreateDatasetRequest } from "./CreateDatasetRequest.mjs";
|
|
|
4
4
|
export type { DeleteDatasetRequest } from "./DeleteDatasetRequest.mjs";
|
|
5
5
|
export type { GetDatasetRequest } from "./GetDatasetRequest.mjs";
|
|
6
6
|
export type { GetDatasetStatusHistoryRequest } from "./GetDatasetStatusHistoryRequest.mjs";
|
|
7
|
+
export type { ListDatasetEntitiesRequest } from "./ListDatasetEntitiesRequest.mjs";
|
|
7
8
|
export type { ListDatasetsRequest } from "./ListDatasetsRequest.mjs";
|
|
8
|
-
export type { ListEntitiesInDatasetRequest } from "./ListEntitiesInDatasetRequest.mjs";
|
|
9
9
|
export type { RemoveEntitiesFromDatasetRequest } from "./RemoveEntitiesFromDatasetRequest.mjs";
|
|
10
10
|
export type { UpdateDatasetRequest } from "./UpdateDatasetRequest.mjs";
|
|
11
11
|
export type { UploadCsvToDatasetRequest } from "./UploadCsvToDatasetRequest.mjs";
|
|
@@ -18,9 +18,7 @@ export declare class EntitiesClient {
|
|
|
18
18
|
protected readonly _options: NormalizedClientOptionsWithAuth<EntitiesClient.Options>;
|
|
19
19
|
constructor(options?: EntitiesClient.Options);
|
|
20
20
|
/**
|
|
21
|
-
* Returns a paginated list of entities belonging to the authenticated
|
|
22
|
-
* organization. Supports filtering by status and entity type, and
|
|
23
|
-
* sorting by name, status, or creation date.
|
|
21
|
+
* Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date.
|
|
24
22
|
*
|
|
25
23
|
* @param {CatchAllApi.ListEntitiesRequest} request
|
|
26
24
|
* @param {EntitiesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -65,11 +63,9 @@ export declare class EntitiesClient {
|
|
|
65
63
|
createEntity(request: CatchAllApi.CreateEntityRequest, requestOptions?: EntitiesClient.RequestOptions): core.HttpResponsePromise<CatchAllApi.CreateEntityResponse>;
|
|
66
64
|
private __createEntity;
|
|
67
65
|
/**
|
|
68
|
-
* Creates multiple entities in a single request. Each entity is
|
|
69
|
-
* processed independently — a failure in one does not affect others.
|
|
66
|
+
* Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others.
|
|
70
67
|
*
|
|
71
|
-
* Returns an array of `{id, status}` objects in the same order as
|
|
72
|
-
* the input array.
|
|
68
|
+
* Returns an array of `{id, status}` objects in the same order as the input array.
|
|
73
69
|
*
|
|
74
70
|
* @param {CatchAllApi.CreateEntitiesBatchRequest} request
|
|
75
71
|
* @param {EntitiesClient.RequestOptions} requestOptions - Request-specific configuration.
|