newscatcher-catchall-sdk 4.0.0 → 4.0.1
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 +1 -0
- package/dist/cjs/BaseClient.d.ts +12 -0
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/datasets/client/Client.d.ts +5 -3
- package/dist/cjs/api/resources/datasets/client/Client.js +11 -8
- package/dist/cjs/api/resources/entities/client/Client.d.ts +8 -6
- package/dist/cjs/api/resources/entities/client/Client.js +12 -9
- package/dist/cjs/api/resources/entities/client/requests/UpdateEntityRequest.d.ts +1 -1
- package/dist/cjs/api/resources/jobs/client/Client.js +5 -4
- package/dist/cjs/api/resources/jobs/client/requests/SubmitRequestDto.d.ts +4 -0
- package/dist/cjs/api/resources/monitors/client/Client.js +4 -3
- package/dist/cjs/api/resources/projects/client/Client.js +4 -3
- package/dist/cjs/api/resources/webhooks/client/Client.d.ts +25 -0
- package/dist/cjs/api/resources/webhooks/client/Client.js +78 -4
- package/dist/cjs/api/resources/webhooks/client/requests/CreateWebhookRequestDto.d.ts +2 -2
- package/dist/cjs/api/resources/webhooks/client/requests/TriggerWebhookRequest.d.ts +23 -0
- package/dist/cjs/api/resources/webhooks/client/requests/TriggerWebhookRequest.js +3 -0
- package/dist/cjs/api/resources/webhooks/client/requests/UpdateWebhookRequestDto.d.ts +2 -2
- package/dist/cjs/api/resources/webhooks/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/types/CompanyAttributes.d.ts +0 -2
- package/dist/cjs/api/types/CreateEntityRequest.d.ts +4 -2
- package/dist/cjs/api/types/DatasetResponse.d.ts +15 -0
- package/dist/cjs/api/types/FormatterConfigDto.d.ts +15 -0
- package/dist/cjs/api/types/FormatterConfigDto.js +3 -0
- package/dist/cjs/api/types/InitializeResponseDto.d.ts +6 -1
- package/dist/cjs/api/types/WebhookResponseDto.d.ts +2 -2
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -0
- package/dist/cjs/core/file/file.js +3 -0
- package/dist/cjs/core/form-data-utils/FormDataWrapper.js +3 -0
- package/dist/cjs/core/requestBody.d.ts +12 -0
- package/dist/cjs/core/requestBody.js +26 -0
- package/dist/cjs/core/url/qs.js +2 -2
- package/dist/cjs/errors/CatchAllApiError.d.ts +1 -0
- package/dist/cjs/errors/CatchAllApiError.js +4 -0
- package/dist/cjs/errors/CatchAllApiTimeoutError.d.ts +2 -2
- package/dist/cjs/errors/CatchAllApiTimeoutError.js +39 -5
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +12 -0
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/datasets/client/Client.d.mts +5 -3
- package/dist/esm/api/resources/datasets/client/Client.mjs +11 -8
- package/dist/esm/api/resources/entities/client/Client.d.mts +8 -6
- package/dist/esm/api/resources/entities/client/Client.mjs +12 -9
- package/dist/esm/api/resources/entities/client/requests/UpdateEntityRequest.d.mts +1 -1
- package/dist/esm/api/resources/jobs/client/Client.mjs +5 -4
- package/dist/esm/api/resources/jobs/client/requests/SubmitRequestDto.d.mts +4 -0
- package/dist/esm/api/resources/monitors/client/Client.mjs +4 -3
- package/dist/esm/api/resources/projects/client/Client.mjs +4 -3
- package/dist/esm/api/resources/webhooks/client/Client.d.mts +25 -0
- package/dist/esm/api/resources/webhooks/client/Client.mjs +78 -4
- package/dist/esm/api/resources/webhooks/client/requests/CreateWebhookRequestDto.d.mts +2 -2
- package/dist/esm/api/resources/webhooks/client/requests/TriggerWebhookRequest.d.mts +23 -0
- package/dist/esm/api/resources/webhooks/client/requests/TriggerWebhookRequest.mjs +2 -0
- package/dist/esm/api/resources/webhooks/client/requests/UpdateWebhookRequestDto.d.mts +2 -2
- package/dist/esm/api/resources/webhooks/client/requests/index.d.mts +1 -0
- package/dist/esm/api/types/CompanyAttributes.d.mts +0 -2
- package/dist/esm/api/types/CreateEntityRequest.d.mts +4 -2
- package/dist/esm/api/types/DatasetResponse.d.mts +15 -0
- package/dist/esm/api/types/FormatterConfigDto.d.mts +15 -0
- package/dist/esm/api/types/FormatterConfigDto.mjs +2 -0
- package/dist/esm/api/types/InitializeResponseDto.d.mts +6 -1
- package/dist/esm/api/types/WebhookResponseDto.d.mts +2 -2
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/core/file/file.mjs +3 -0
- package/dist/esm/core/form-data-utils/FormDataWrapper.mjs +3 -0
- package/dist/esm/core/requestBody.d.mts +12 -0
- package/dist/esm/core/requestBody.mjs +23 -0
- package/dist/esm/core/url/qs.mjs +2 -2
- package/dist/esm/errors/CatchAllApiError.d.mts +1 -0
- package/dist/esm/errors/CatchAllApiError.mjs +4 -0
- package/dist/esm/errors/CatchAllApiTimeoutError.d.mts +2 -2
- package/dist/esm/errors/CatchAllApiTimeoutError.mjs +6 -5
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +86 -9
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spreads caller-supplied `additionalBodyParameters` (from `requestOptions.additionalBodyParameters`)
|
|
3
|
+
* on top of the request body. Caller-supplied properties win over the endpoint body. When no
|
|
4
|
+
* additional body parameters are provided, the original body is returned unchanged so serialization
|
|
5
|
+
* is unaffected.
|
|
6
|
+
*
|
|
7
|
+
* The merge only applies to plain-object (JSON object) bodies. When the body is `null`/`undefined`
|
|
8
|
+
* the additional parameters become the body; when the body is an array or a primitive JSON value it
|
|
9
|
+
* is returned unchanged, since object properties cannot be spread into it. This mirrors the Python
|
|
10
|
+
* SDK, which only merges additional body parameters into mapping bodies.
|
|
11
|
+
*/
|
|
12
|
+
export function mergeAdditionalBodyParameters(body, additionalBodyParameters) {
|
|
13
|
+
if (additionalBodyParameters == null) {
|
|
14
|
+
return body;
|
|
15
|
+
}
|
|
16
|
+
if (body == null) {
|
|
17
|
+
return Object.assign({}, additionalBodyParameters);
|
|
18
|
+
}
|
|
19
|
+
if (typeof body === "object" && !Array.isArray(body)) {
|
|
20
|
+
return Object.assign(Object.assign({}, body), additionalBodyParameters);
|
|
21
|
+
}
|
|
22
|
+
return body;
|
|
23
|
+
}
|
package/dist/esm/core/url/qs.mjs
CHANGED
|
@@ -16,7 +16,7 @@ function stringifyObject(obj, prefix = "", options) {
|
|
|
16
16
|
const parts = [];
|
|
17
17
|
for (const [key, value] of Object.entries(obj)) {
|
|
18
18
|
const fullKey = prefix ? `${prefix}[${key}]` : key;
|
|
19
|
-
if (value
|
|
19
|
+
if (value == null) {
|
|
20
20
|
continue;
|
|
21
21
|
}
|
|
22
22
|
if (Array.isArray(value)) {
|
|
@@ -36,7 +36,7 @@ function stringifyObject(obj, prefix = "", options) {
|
|
|
36
36
|
else {
|
|
37
37
|
for (let i = 0; i < value.length; i++) {
|
|
38
38
|
const item = value[i];
|
|
39
|
-
if (item
|
|
39
|
+
if (item == null) {
|
|
40
40
|
continue;
|
|
41
41
|
}
|
|
42
42
|
if (typeof item === "object" && !Array.isArray(item) && item !== null) {
|
|
@@ -15,6 +15,10 @@ export class CatchAllApiError extends Error {
|
|
|
15
15
|
this.cause = cause;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
get requestId() {
|
|
19
|
+
var _a, _b, _c;
|
|
20
|
+
return (_c = (_b = (_a = this.rawResponse) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.get("x-request-id")) !== null && _c !== void 0 ? _c : undefined;
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
function buildMessage({ message, statusCode, body, }) {
|
|
20
24
|
const lines = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as errors from "./index.mjs";
|
|
2
|
+
export declare class CatchAllApiTimeoutError extends errors.CatchAllApiError {
|
|
3
3
|
constructor(message: string, opts?: {
|
|
4
4
|
cause?: unknown;
|
|
5
5
|
});
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
2
|
+
import * as errors from "./index.mjs";
|
|
3
|
+
export class CatchAllApiTimeoutError extends errors.CatchAllApiError {
|
|
3
4
|
constructor(message, opts) {
|
|
4
|
-
super(
|
|
5
|
+
super({
|
|
6
|
+
message: message,
|
|
7
|
+
cause: opts === null || opts === void 0 ? void 0 : opts.cause,
|
|
8
|
+
});
|
|
5
9
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
6
10
|
if (Error.captureStackTrace) {
|
|
7
11
|
Error.captureStackTrace(this, this.constructor);
|
|
8
12
|
}
|
|
9
13
|
this.name = "CatchAllApiTimeoutError";
|
|
10
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.cause) != null) {
|
|
11
|
-
this.cause = opts.cause;
|
|
12
|
-
}
|
|
13
14
|
}
|
|
14
15
|
}
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "4.0.
|
|
1
|
+
export declare const SDK_VERSION = "4.0.1";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "4.0.
|
|
1
|
+
export const SDK_VERSION = "4.0.1";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -1932,6 +1932,79 @@ await client.webhooks.listWebhooksForResource({
|
|
|
1932
1932
|
</dl>
|
|
1933
1933
|
|
|
1934
1934
|
|
|
1935
|
+
</dd>
|
|
1936
|
+
</dl>
|
|
1937
|
+
</details>
|
|
1938
|
+
|
|
1939
|
+
<details><summary><code>client.webhooks.<a href="/src/api/resources/webhooks/client/Client.ts">triggerWebhook</a>({ ...params }) -> void</code></summary>
|
|
1940
|
+
<dl>
|
|
1941
|
+
<dd>
|
|
1942
|
+
|
|
1943
|
+
#### 📝 Description
|
|
1944
|
+
|
|
1945
|
+
<dl>
|
|
1946
|
+
<dd>
|
|
1947
|
+
|
|
1948
|
+
<dl>
|
|
1949
|
+
<dd>
|
|
1950
|
+
|
|
1951
|
+
Manually dispatches a webhook delivery for a resource on demand, without
|
|
1952
|
+
waiting for the next job or monitor cycle.
|
|
1953
|
+
|
|
1954
|
+
Use this to re-deliver results after a failed delivery, replay a specific
|
|
1955
|
+
job's results, or validate a webhook against live data. The webhook must
|
|
1956
|
+
already be assigned to the resource.
|
|
1957
|
+
</dd>
|
|
1958
|
+
</dl>
|
|
1959
|
+
</dd>
|
|
1960
|
+
</dl>
|
|
1961
|
+
|
|
1962
|
+
#### 🔌 Usage
|
|
1963
|
+
|
|
1964
|
+
<dl>
|
|
1965
|
+
<dd>
|
|
1966
|
+
|
|
1967
|
+
<dl>
|
|
1968
|
+
<dd>
|
|
1969
|
+
|
|
1970
|
+
```typescript
|
|
1971
|
+
await client.webhooks.triggerWebhook({
|
|
1972
|
+
resource_type: "job",
|
|
1973
|
+
resource_id: "3fec5b07-8786-46d7-9486-d43ff67eccd4",
|
|
1974
|
+
webhook_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
1975
|
+
job_id: "3fec5b07-8786-46d7-9486-d43ff67eccd4"
|
|
1976
|
+
});
|
|
1977
|
+
|
|
1978
|
+
```
|
|
1979
|
+
</dd>
|
|
1980
|
+
</dl>
|
|
1981
|
+
</dd>
|
|
1982
|
+
</dl>
|
|
1983
|
+
|
|
1984
|
+
#### ⚙️ Parameters
|
|
1985
|
+
|
|
1986
|
+
<dl>
|
|
1987
|
+
<dd>
|
|
1988
|
+
|
|
1989
|
+
<dl>
|
|
1990
|
+
<dd>
|
|
1991
|
+
|
|
1992
|
+
**request:** `CatchAllApi.TriggerWebhookRequest`
|
|
1993
|
+
|
|
1994
|
+
</dd>
|
|
1995
|
+
</dl>
|
|
1996
|
+
|
|
1997
|
+
<dl>
|
|
1998
|
+
<dd>
|
|
1999
|
+
|
|
2000
|
+
**requestOptions:** `WebhooksClient.RequestOptions`
|
|
2001
|
+
|
|
2002
|
+
</dd>
|
|
2003
|
+
</dl>
|
|
2004
|
+
</dd>
|
|
2005
|
+
</dl>
|
|
2006
|
+
|
|
2007
|
+
|
|
1935
2008
|
</dd>
|
|
1936
2009
|
</dl>
|
|
1937
2010
|
</details>
|
|
@@ -2084,10 +2157,10 @@ await client.entities.listEntities({
|
|
|
2084
2157
|
|
|
2085
2158
|
Creates a new company entity and begins background enrichment.
|
|
2086
2159
|
|
|
2160
|
+
Each entity requires a `name` plus at least one of: a `description` or a `domain`. Providing both is recommended — `domain` is the highest-signal identifier because it is unambiguous; a well-written `description` is the best alternative when no domain is available.
|
|
2161
|
+
|
|
2087
2162
|
The entity status starts as `pending` and transitions to `ready` once
|
|
2088
|
-
enrichment completes.
|
|
2089
|
-
possible — `domain` is the highest-signal field because it is
|
|
2090
|
-
unambiguous.
|
|
2163
|
+
enrichment completes.
|
|
2091
2164
|
</dd>
|
|
2092
2165
|
</dl>
|
|
2093
2166
|
</dd>
|
|
@@ -2105,12 +2178,12 @@ unambiguous.
|
|
|
2105
2178
|
await client.entities.createEntity({
|
|
2106
2179
|
name: "NewsCatcher",
|
|
2107
2180
|
entity_type: "company",
|
|
2108
|
-
description: "
|
|
2181
|
+
description: "NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",
|
|
2109
2182
|
additional_attributes: {
|
|
2110
2183
|
company_attributes: {
|
|
2111
2184
|
domain: "newscatcherapi.com",
|
|
2112
2185
|
key_persons: ["Artem Bugara", "Maksym Sugonyaka"],
|
|
2113
|
-
alternative_names: ["
|
|
2186
|
+
alternative_names: ["NewsCatcher CatchAll", "NewsCatcher API"]
|
|
2114
2187
|
}
|
|
2115
2188
|
}
|
|
2116
2189
|
});
|
|
@@ -2163,6 +2236,8 @@ await client.entities.createEntity({
|
|
|
2163
2236
|
|
|
2164
2237
|
Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others.
|
|
2165
2238
|
|
|
2239
|
+
Each entity requires a `name` plus at least one of: a `description` or a `domain`. See [Create entity](https://www.newscatcherapi.com/docs/web-search-api/api-reference/entities/create-entity) for the full field reference.
|
|
2240
|
+
|
|
2166
2241
|
Returns an array of `{id, status}` objects in the same order as the input array.
|
|
2167
2242
|
</dd>
|
|
2168
2243
|
</dl>
|
|
@@ -2400,7 +2475,7 @@ await client.entities.updateEntity({
|
|
|
2400
2475
|
description: "Updated description",
|
|
2401
2476
|
additional_attributes: {
|
|
2402
2477
|
company_attributes: {
|
|
2403
|
-
alternative_names: ["
|
|
2478
|
+
alternative_names: ["NewsCatcher CatchAll", "NewsCatcher API", "NCA"]
|
|
2404
2479
|
}
|
|
2405
2480
|
}
|
|
2406
2481
|
});
|
|
@@ -2518,7 +2593,9 @@ await client.datasets.listDatasets({
|
|
|
2518
2593
|
<dl>
|
|
2519
2594
|
<dd>
|
|
2520
2595
|
|
|
2521
|
-
Creates a new dataset from a list of existing entity IDs.
|
|
2596
|
+
Creates a new dataset from a list of existing entity IDs. The optional `description` field here describes the dataset itself — it is separate from the entity-level `description` used for matching.
|
|
2597
|
+
|
|
2598
|
+
Entities must be created before adding them to a dataset. Each entity requires a `name` plus at least one of: a `description` or a `domain`. Use [Create entity](https://www.newscatcherapi.com/docs/web-search-api/api-reference/entities/create-entity) or [Create entities batch](https://www.newscatcherapi.com/docs/web-search-api/api-reference/entities/create-entities-batch) to create entities first.
|
|
2522
2599
|
|
|
2523
2600
|
If any of the provided entity IDs do not exist or do not belong to
|
|
2524
2601
|
your organization, the request fails with `400`. All entity IDs must
|
|
@@ -2592,12 +2669,12 @@ await client.datasets.createDataset({
|
|
|
2592
2669
|
<dl>
|
|
2593
2670
|
<dd>
|
|
2594
2671
|
|
|
2595
|
-
Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity.
|
|
2672
|
+
Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. Each row requires a `name` plus at least one of: a `description` or a `domain`; all other columns are optional. Note: `description` in the CSV is the entity's matching description — it is separate from the dataset-level `description` field in the form data.
|
|
2596
2673
|
|
|
2597
2674
|
**CSV format:**
|
|
2598
2675
|
```csv
|
|
2599
2676
|
name,description,domain,alternative_names,key_persons
|
|
2600
|
-
NewsCatcher,"
|
|
2677
|
+
NewsCatcher,"NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",newscatcherapi.com,"NewsCatcher CatchAll;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
|
|
2601
2678
|
OpenAI,"Artificial intelligence research company",openai.com,"Open AI","Sam Altman"
|
|
2602
2679
|
```
|
|
2603
2680
|
|