newscatcher-catchall-sdk 1.0.0 → 1.1.2

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 (143) hide show
  1. package/README.md +284 -289
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/api/resources/jobs/client/Client.d.ts +13 -17
  4. package/dist/cjs/api/resources/jobs/client/Client.js +12 -19
  5. package/dist/cjs/api/resources/jobs/client/requests/ContinueRequestDto.d.ts +3 -3
  6. package/dist/cjs/api/resources/jobs/client/requests/GetJobResultsRequest.d.ts +2 -2
  7. package/dist/cjs/api/resources/jobs/client/requests/GetJobStatusRequest.d.ts +2 -2
  8. package/dist/cjs/api/resources/jobs/client/requests/InitializeRequestDto.d.ts +2 -1
  9. package/dist/cjs/api/resources/jobs/client/requests/SubmitRequestDto.d.ts +5 -6
  10. package/dist/cjs/api/resources/jobs/exports.d.ts +2 -0
  11. package/dist/cjs/api/resources/jobs/exports.js +21 -0
  12. package/dist/cjs/api/resources/meta/exports.d.ts +2 -0
  13. package/dist/cjs/api/resources/meta/exports.js +21 -0
  14. package/dist/cjs/api/resources/meta/types/GetVersionResponse.d.ts +1 -1
  15. package/dist/cjs/api/resources/meta/types/HealthCheckResponse.d.ts +1 -1
  16. package/dist/cjs/api/resources/monitors/client/Client.d.ts +23 -37
  17. package/dist/cjs/api/resources/monitors/client/Client.js +35 -41
  18. package/dist/cjs/api/resources/monitors/client/requests/CreateMonitorRequestDto.d.ts +23 -6
  19. package/dist/cjs/api/resources/monitors/client/requests/EnableMonitorRequestDto.d.ts +17 -0
  20. package/dist/cjs/api/resources/monitors/client/requests/ListMonitorsRequest.d.ts +10 -0
  21. package/dist/cjs/api/resources/monitors/client/requests/UpdateMonitorRequestDto.d.ts +2 -0
  22. package/dist/cjs/api/resources/monitors/client/requests/index.d.ts +2 -1
  23. package/dist/cjs/api/resources/monitors/exports.d.ts +2 -0
  24. package/dist/cjs/api/resources/monitors/exports.js +21 -0
  25. package/dist/cjs/api/types/BaseRecord.d.ts +38 -0
  26. package/dist/cjs/api/types/BaseRecord.js +16 -0
  27. package/dist/cjs/api/types/Citation.d.ts +3 -3
  28. package/dist/cjs/api/types/CompanyEnrichmentOutput.d.ts +29 -0
  29. package/dist/cjs/api/types/CompanyEnrichmentOutput.js +16 -0
  30. package/dist/cjs/api/types/ContinueResponseDto.d.ts +2 -2
  31. package/dist/cjs/api/types/CreateMonitorResponseDto.d.ts +1 -1
  32. package/dist/cjs/api/types/EndDate.d.ts +4 -2
  33. package/dist/cjs/api/types/EnrichmentType.d.ts +1 -3
  34. package/dist/cjs/api/types/EnrichmentType.js +1 -3
  35. package/dist/cjs/api/types/Error_.d.ts +1 -1
  36. package/dist/cjs/api/types/InitializeResponseDto.d.ts +8 -9
  37. package/dist/cjs/api/types/JobStep.d.ts +2 -2
  38. package/dist/cjs/api/types/Limit.d.ts +1 -1
  39. package/dist/cjs/api/types/ListMonitorsResponseDto.d.ts +7 -1
  40. package/dist/cjs/api/types/MonitorCitation.d.ts +3 -8
  41. package/dist/cjs/api/types/MonitorListItemDto.d.ts +7 -7
  42. package/dist/cjs/api/types/MonitorRecord.d.ts +4 -14
  43. package/dist/{esm/api/types/JobStatus.d.mts → cjs/api/types/PublicJobStatus.d.ts} +4 -4
  44. package/dist/cjs/api/types/{JobStatus.js → PublicJobStatus.js} +4 -4
  45. package/dist/cjs/api/types/PullJobResponseDto.d.ts +27 -22
  46. package/dist/cjs/api/types/PullMonitorResponseDto.d.ts +12 -12
  47. package/dist/cjs/api/types/Query.d.ts +1 -1
  48. package/dist/cjs/api/types/Record_.d.ts +2 -12
  49. package/dist/cjs/api/types/ReferenceJob.d.ts +3 -3
  50. package/dist/cjs/api/types/StartDate.d.ts +4 -2
  51. package/dist/cjs/api/types/StatusResponseDto.d.ts +2 -2
  52. package/dist/cjs/api/types/{SubmitResponseBody.d.ts → SubmitResponseDto.d.ts} +1 -1
  53. package/dist/cjs/api/types/UserJob.d.ts +1 -1
  54. package/dist/cjs/api/types/ValidationErrorDetail.d.ts +3 -3
  55. package/dist/cjs/api/types/ValidationErrorResponse.d.ts +1 -1
  56. package/dist/cjs/api/types/ValidatorSchema.d.ts +3 -3
  57. package/dist/cjs/api/types/WebhookDto.d.ts +4 -4
  58. package/dist/cjs/api/types/WebhookPayload.d.ts +9 -9
  59. package/dist/cjs/api/types/index.d.ts +4 -3
  60. package/dist/cjs/api/types/index.js +4 -3
  61. package/dist/cjs/core/fetcher/Fetcher.js +8 -2
  62. package/dist/cjs/core/fetcher/makeRequest.d.ts +6 -1
  63. package/dist/cjs/core/fetcher/makeRequest.js +30 -9
  64. package/dist/cjs/core/runtime/runtime.js +8 -7
  65. package/dist/cjs/version.d.ts +1 -1
  66. package/dist/cjs/version.js +1 -1
  67. package/dist/esm/BaseClient.mjs +2 -2
  68. package/dist/esm/api/resources/jobs/client/Client.d.mts +13 -17
  69. package/dist/esm/api/resources/jobs/client/Client.mjs +12 -19
  70. package/dist/esm/api/resources/jobs/client/requests/ContinueRequestDto.d.mts +3 -3
  71. package/dist/esm/api/resources/jobs/client/requests/GetJobResultsRequest.d.mts +2 -2
  72. package/dist/esm/api/resources/jobs/client/requests/GetJobStatusRequest.d.mts +2 -2
  73. package/dist/esm/api/resources/jobs/client/requests/InitializeRequestDto.d.mts +2 -1
  74. package/dist/esm/api/resources/jobs/client/requests/SubmitRequestDto.d.mts +5 -6
  75. package/dist/esm/api/resources/jobs/exports.d.mts +2 -0
  76. package/dist/esm/api/resources/jobs/exports.mjs +3 -0
  77. package/dist/esm/api/resources/meta/exports.d.mts +2 -0
  78. package/dist/esm/api/resources/meta/exports.mjs +3 -0
  79. package/dist/esm/api/resources/meta/types/GetVersionResponse.d.mts +1 -1
  80. package/dist/esm/api/resources/meta/types/HealthCheckResponse.d.mts +1 -1
  81. package/dist/esm/api/resources/monitors/client/Client.d.mts +23 -37
  82. package/dist/esm/api/resources/monitors/client/Client.mjs +35 -41
  83. package/dist/esm/api/resources/monitors/client/requests/CreateMonitorRequestDto.d.mts +23 -6
  84. package/dist/esm/api/resources/monitors/client/requests/EnableMonitorRequestDto.d.mts +17 -0
  85. package/dist/esm/api/resources/monitors/client/requests/ListMonitorsRequest.d.mts +10 -0
  86. package/dist/esm/api/resources/monitors/client/requests/UpdateMonitorRequestDto.d.mts +2 -0
  87. package/dist/esm/api/resources/monitors/client/requests/index.d.mts +2 -1
  88. package/dist/esm/api/resources/monitors/exports.d.mts +2 -0
  89. package/dist/esm/api/resources/monitors/exports.mjs +3 -0
  90. package/dist/esm/api/types/BaseRecord.d.mts +38 -0
  91. package/dist/esm/api/types/BaseRecord.mjs +13 -0
  92. package/dist/esm/api/types/Citation.d.mts +3 -3
  93. package/dist/esm/api/types/CompanyEnrichmentOutput.d.mts +29 -0
  94. package/dist/esm/api/types/CompanyEnrichmentOutput.mjs +13 -0
  95. package/dist/esm/api/types/ContinueResponseDto.d.mts +2 -2
  96. package/dist/esm/api/types/CreateMonitorResponseDto.d.mts +1 -1
  97. package/dist/esm/api/types/EndDate.d.mts +4 -2
  98. package/dist/esm/api/types/EnrichmentType.d.mts +1 -3
  99. package/dist/esm/api/types/EnrichmentType.mjs +1 -3
  100. package/dist/esm/api/types/Error_.d.mts +1 -1
  101. package/dist/esm/api/types/InitializeResponseDto.d.mts +8 -9
  102. package/dist/esm/api/types/JobStep.d.mts +2 -2
  103. package/dist/esm/api/types/Limit.d.mts +1 -1
  104. package/dist/esm/api/types/ListMonitorsResponseDto.d.mts +7 -1
  105. package/dist/esm/api/types/MonitorCitation.d.mts +3 -8
  106. package/dist/esm/api/types/MonitorListItemDto.d.mts +7 -7
  107. package/dist/esm/api/types/MonitorRecord.d.mts +4 -14
  108. package/dist/{cjs/api/types/JobStatus.d.ts → esm/api/types/PublicJobStatus.d.mts} +4 -4
  109. package/dist/esm/api/types/{JobStatus.mjs → PublicJobStatus.mjs} +3 -3
  110. package/dist/esm/api/types/PullJobResponseDto.d.mts +27 -22
  111. package/dist/esm/api/types/PullMonitorResponseDto.d.mts +12 -12
  112. package/dist/esm/api/types/Query.d.mts +1 -1
  113. package/dist/esm/api/types/Record_.d.mts +2 -12
  114. package/dist/esm/api/types/ReferenceJob.d.mts +3 -3
  115. package/dist/esm/api/types/StartDate.d.mts +4 -2
  116. package/dist/esm/api/types/StatusResponseDto.d.mts +2 -2
  117. package/dist/esm/api/types/{SubmitResponseBody.d.mts → SubmitResponseDto.d.mts} +1 -1
  118. package/dist/esm/api/types/UserJob.d.mts +1 -1
  119. package/dist/esm/api/types/ValidationErrorDetail.d.mts +3 -3
  120. package/dist/esm/api/types/ValidationErrorResponse.d.mts +1 -1
  121. package/dist/esm/api/types/ValidatorSchema.d.mts +3 -3
  122. package/dist/esm/api/types/WebhookDto.d.mts +4 -4
  123. package/dist/esm/api/types/WebhookPayload.d.mts +9 -9
  124. package/dist/esm/api/types/index.d.mts +4 -3
  125. package/dist/esm/api/types/index.mjs +4 -3
  126. package/dist/esm/core/fetcher/Fetcher.mjs +8 -2
  127. package/dist/esm/core/fetcher/makeRequest.d.mts +6 -1
  128. package/dist/esm/core/fetcher/makeRequest.mjs +28 -9
  129. package/dist/esm/core/runtime/runtime.mjs +8 -7
  130. package/dist/esm/version.d.mts +1 -1
  131. package/dist/esm/version.mjs +1 -1
  132. package/package.json +37 -4
  133. package/reference.md +43 -53
  134. package/dist/cjs/api/resources/monitors/client/requests/EnableMonitorRequest.d.ts +0 -10
  135. package/dist/cjs/api/types/Schema.d.ts +0 -6
  136. package/dist/esm/api/resources/monitors/client/requests/EnableMonitorRequest.d.mts +0 -10
  137. package/dist/esm/api/types/Schema.d.mts +0 -6
  138. /package/dist/cjs/api/resources/monitors/client/requests/{EnableMonitorRequest.js → EnableMonitorRequestDto.js} +0 -0
  139. /package/dist/cjs/api/{types/Schema.js → resources/monitors/client/requests/ListMonitorsRequest.js} +0 -0
  140. /package/dist/cjs/api/types/{SubmitResponseBody.js → SubmitResponseDto.js} +0 -0
  141. /package/dist/esm/api/resources/monitors/client/requests/{EnableMonitorRequest.mjs → EnableMonitorRequestDto.mjs} +0 -0
  142. /package/dist/esm/api/{types/Schema.mjs → resources/monitors/client/requests/ListMonitorsRequest.mjs} +0 -0
  143. /package/dist/esm/api/types/{SubmitResponseBody.mjs → SubmitResponseDto.mjs} +0 -0
package/README.md CHANGED
@@ -1,289 +1,284 @@
1
- # Newscatcher TypeScript Library
2
-
3
- [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FNewscatcher%2Fnewscatcher-catchall-typescript)
4
- [![npm shield](https://img.shields.io/npm/v/newscatcher-catchall-sdk)](https://www.npmjs.com/package/newscatcher-catchall-sdk)
5
-
6
- The Newscatcher TypeScript library provides convenient access to the Newscatcher APIs from TypeScript.
7
-
8
- ## Table of Contents
9
-
10
- - [Documentation](#documentation)
11
- - [Installation](#installation)
12
- - [Reference](#reference)
13
- - [Usage](#usage)
14
- - [Request and Response Types](#request-and-response-types)
15
- - [Exception Handling](#exception-handling)
16
- - [Advanced](#advanced)
17
- - [Additional Headers](#additional-headers)
18
- - [Additional Query String Parameters](#additional-query-string-parameters)
19
- - [Retries](#retries)
20
- - [Timeouts](#timeouts)
21
- - [Aborting Requests](#aborting-requests)
22
- - [Access Raw Response Data](#access-raw-response-data)
23
- - [Logging](#logging)
24
- - [Runtime Compatibility](#runtime-compatibility)
25
- - [Beta Status](#beta-status)
26
- - [Contributing](#contributing)
27
- - [Support](#support)
28
-
29
- ## Documentation
30
-
31
- API reference documentation is available [here](https://www.newscatcherapi.com/docs/v3/catch-all/endpoints/create-job).
32
-
33
- ## Installation
34
-
35
- ```sh
36
- npm i -s newscatcher-catchall-sdk
37
- ```
38
-
39
- ## Reference
40
-
41
- A full reference for this library is available [here](https://github.com/Newscatcher/newscatcher-catchall-typescript/blob/HEAD/./reference.md).
42
-
43
- ## Usage
44
-
45
- Instantiate and use the client with the following:
46
-
47
- ```typescript
48
- import { CatchAllApiClient } from "newscatcher-catchall-sdk";
49
-
50
- const client = new CatchAllApiClient({ apiKey: "YOUR_API_KEY" });
51
- await client.jobs.createJob({
52
- query: "AI company acquisitions",
53
- context: "Focus on deal size and acquiring company details",
54
- limit: 10,
55
- start_date: "2026-01-30T00:00:00Z",
56
- end_date: "2026-02-05T00:00:00Z"
57
- });
58
- ```
59
-
60
- ## Request and Response Types
61
-
62
- The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
63
- following namespace:
64
-
65
- ```typescript
66
- import { CatchAllApi } from "newscatcher-catchall-sdk";
67
-
68
- const request: CatchAllApi.InitializeRequestDto = {
69
- ...
70
- };
71
- ```
72
-
73
- ## Exception Handling
74
-
75
- When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
76
- will be thrown.
77
-
78
- ```typescript
79
- import { CatchAllApiError } from "newscatcher-catchall-sdk";
80
-
81
- try {
82
- await client.jobs.createJob(...);
83
- } catch (err) {
84
- if (err instanceof CatchAllApiError) {
85
- console.log(err.statusCode);
86
- console.log(err.message);
87
- console.log(err.body);
88
- console.log(err.rawResponse);
89
- }
90
- }
91
- ```
92
-
93
- ## Advanced
94
-
95
- ### Additional Headers
96
-
97
- If you would like to send additional headers as part of the request, use the `headers` request option.
98
-
99
- ```typescript
100
- import { CatchAllApiClient } from "newscatcher-catchall-sdk";
101
-
102
- const client = new CatchAllApiClient({
103
- ...
104
- headers: {
105
- 'X-Custom-Header': 'custom value'
106
- }
107
- });
108
-
109
- const response = await client.jobs.createJob(..., {
110
- headers: {
111
- 'X-Custom-Header': 'custom value'
112
- }
113
- });
114
- ```
115
-
116
- ### Additional Query String Parameters
117
-
118
- If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
119
-
120
- ```typescript
121
- const response = await client.jobs.createJob(..., {
122
- queryParams: {
123
- 'customQueryParamKey': 'custom query param value'
124
- }
125
- });
126
- ```
127
-
128
- ### Retries
129
-
130
- The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
131
- as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
132
- retry limit (default: 2).
133
-
134
- A request is deemed retryable when any of the following HTTP status codes is returned:
135
-
136
- - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
137
- - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
138
- - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
139
-
140
- Use the `maxRetries` request option to configure this behavior.
141
-
142
- ```typescript
143
- const response = await client.jobs.createJob(..., {
144
- maxRetries: 0 // override maxRetries at the request level
145
- });
146
- ```
147
-
148
- ### Timeouts
149
-
150
- The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
151
-
152
- ```typescript
153
- const response = await client.jobs.createJob(..., {
154
- timeoutInSeconds: 30 // override timeout to 30s
155
- });
156
- ```
157
-
158
- ### Aborting Requests
159
-
160
- The SDK allows users to abort requests at any point by passing in an abort signal.
161
-
162
- ```typescript
163
- const controller = new AbortController();
164
- const response = await client.jobs.createJob(..., {
165
- abortSignal: controller.signal
166
- });
167
- controller.abort(); // aborts the request
168
- ```
169
-
170
- ### Access Raw Response Data
171
-
172
- The SDK provides access to raw response data, including headers, through the `.withRawResponse()` method.
173
- The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
174
-
175
- ```typescript
176
- const { data, rawResponse } = await client.jobs.createJob(...).withRawResponse();
177
-
178
- console.log(data);
179
- console.log(rawResponse.headers['X-My-Header']);
180
- ```
181
-
182
- ### Logging
183
-
184
- The SDK supports logging. You can configure the logger by passing in a `logging` object to the client options.
185
-
186
- ```typescript
187
- import { CatchAllApiClient, logging } from "newscatcher-catchall-sdk";
188
-
189
- const client = new CatchAllApiClient({
190
- ...
191
- logging: {
192
- level: logging.LogLevel.Debug, // defaults to logging.LogLevel.Info
193
- logger: new logging.ConsoleLogger(), // defaults to ConsoleLogger
194
- silent: false, // defaults to true, set to false to enable logging
195
- }
196
- });
197
- ```
198
- The `logging` object can have the following properties:
199
- - `level`: The log level to use. Defaults to `logging.LogLevel.Info`.
200
- - `logger`: The logger to use. Defaults to a `logging.ConsoleLogger`.
201
- - `silent`: Whether to silence the logger. Defaults to `true`.
202
-
203
- The `level` property can be one of the following values:
204
- - `logging.LogLevel.Debug`
205
- - `logging.LogLevel.Info`
206
- - `logging.LogLevel.Warn`
207
- - `logging.LogLevel.Error`
208
-
209
- To provide a custom logger, you can pass in an object that implements the `logging.ILogger` interface.
210
-
211
- <details>
212
- <summary>Custom logger examples</summary>
213
-
214
- Here's an example using the popular `winston` logging library.
215
- ```ts
216
- import winston from 'winston';
217
-
218
- const winstonLogger = winston.createLogger({...});
219
-
220
- const logger: logging.ILogger = {
221
- debug: (msg, ...args) => winstonLogger.debug(msg, ...args),
222
- info: (msg, ...args) => winstonLogger.info(msg, ...args),
223
- warn: (msg, ...args) => winstonLogger.warn(msg, ...args),
224
- error: (msg, ...args) => winstonLogger.error(msg, ...args),
225
- };
226
- ```
227
-
228
- Here's an example using the popular `pino` logging library.
229
-
230
- ```ts
231
- import pino from 'pino';
232
-
233
- const pinoLogger = pino({...});
234
-
235
- const logger: logging.ILogger = {
236
- debug: (msg, ...args) => pinoLogger.debug(args, msg),
237
- info: (msg, ...args) => pinoLogger.info(args, msg),
238
- warn: (msg, ...args) => pinoLogger.warn(args, msg),
239
- error: (msg, ...args) => pinoLogger.error(args, msg),
240
- };
241
- ```
242
- </details>
243
-
244
-
245
- ### Runtime Compatibility
246
-
247
-
248
- The SDK works in the following runtimes:
249
-
250
-
251
-
252
- - Node.js 18+
253
- - Vercel
254
- - Cloudflare Workers
255
- - Deno v1.25+
256
- - Bun 1.0+
257
- - React Native
258
-
259
- ### Customizing Fetch Client
260
-
261
- The SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're running in an
262
- unsupported environment, this provides a way for you to break glass and ensure the SDK works.
263
-
264
- ```typescript
265
- import { CatchAllApiClient } from "newscatcher-catchall-sdk";
266
-
267
- const client = new CatchAllApiClient({
268
- ...
269
- fetcher: // provide your implementation here
270
- });
271
- ```
272
-
273
- ## Beta status
274
-
275
- CatchAll API is in beta. Breaking changes may occur in minor version updates. See the [Changelog](https://www.newscatcherapi.com/docs/v3/catch-all/overview/changelog) for updates.
276
-
277
- ## Contributing
278
-
279
- While we value open-source contributions to this SDK, this library is generated programmatically.
280
- Additions made directly to this library would have to be moved over to our generation code,
281
- otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
282
- a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
283
- an issue first to discuss with us!
284
-
285
- On the other hand, contributions to the README are always very welcome!
286
- ## Support
287
-
288
- - Documentation: [https://www.newscatcherapi.com/docs/v3/catch-all](https://www.newscatcherapi.com/docs/v3/catch-all)
289
- - Support: <support@newscatcherapi.com>
1
+ # Newscatcher CatchAll TypeScript Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FNewscatcher%2Fnewscatcher-catchall-typescript)
4
+ [![npm shield](https://img.shields.io/npm/v/newscatcher-catchall-sdk)](https://www.npmjs.com/package/newscatcher-catchall-sdk)
5
+
6
+ The Newscatcher CatchAll TypeScript library provides convenient access to the Web Search APIs from TypeScript.
7
+
8
+ ## Table of Contents
9
+
10
+ - [Documentation](#documentation)
11
+ - [Installation](#installation)
12
+ - [Reference](#reference)
13
+ - [Usage](#usage)
14
+ - [Request and Response Types](#request-and-response-types)
15
+ - [Exception Handling](#exception-handling)
16
+ - [Advanced](#advanced)
17
+ - [Additional Headers](#additional-headers)
18
+ - [Additional Query String Parameters](#additional-query-string-parameters)
19
+ - [Retries](#retries)
20
+ - [Timeouts](#timeouts)
21
+ - [Aborting Requests](#aborting-requests)
22
+ - [Access Raw Response Data](#access-raw-response-data)
23
+ - [Logging](#logging)
24
+ - [Runtime Compatibility](#runtime-compatibility)
25
+ - [Contributing](#contributing)
26
+ - [Support](#support)
27
+
28
+ ## Documentation
29
+
30
+ API reference documentation is available [here](https://www.newscatcherapi.com/docs/web-search-api/api-reference/jobs/initialize-job).
31
+
32
+ ## Installation
33
+
34
+ ```sh
35
+ npm i -s newscatcher-catchall-sdk
36
+ ```
37
+
38
+ ## Reference
39
+
40
+ A full reference for this library is available [here](https://github.com/Newscatcher/newscatcher-catchall-typescript/blob/HEAD/./reference.md).
41
+
42
+ ## Usage
43
+
44
+ Instantiate and use the client with the following:
45
+
46
+ ```typescript
47
+ import { CatchAllApiClient } from "newscatcher-catchall-sdk";
48
+
49
+ const client = new CatchAllApiClient({ apiKey: "YOUR_API_KEY" });
50
+ await client.jobs.createJob({
51
+ query: "AI company acquisitions",
52
+ context: "Focus on deal size and acquiring company details",
53
+ limit: 10,
54
+ start_date: "2026-01-30T00:00:00Z",
55
+ end_date: "2026-02-05T00:00:00Z"
56
+ });
57
+ ```
58
+
59
+ ## Request and Response Types
60
+
61
+ The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
62
+ following namespace:
63
+
64
+ ```typescript
65
+ import { CatchAllApi } from "newscatcher-catchall-sdk";
66
+
67
+ const request: CatchAllApi.InitializeRequestDto = {
68
+ ...
69
+ };
70
+ ```
71
+
72
+ ## Exception Handling
73
+
74
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
75
+ will be thrown.
76
+
77
+ ```typescript
78
+ import { CatchAllApiError } from "newscatcher-catchall-sdk";
79
+
80
+ try {
81
+ await client.jobs.createJob(...);
82
+ } catch (err) {
83
+ if (err instanceof CatchAllApiError) {
84
+ console.log(err.statusCode);
85
+ console.log(err.message);
86
+ console.log(err.body);
87
+ console.log(err.rawResponse);
88
+ }
89
+ }
90
+ ```
91
+
92
+ ## Advanced
93
+
94
+ ### Additional Headers
95
+
96
+ If you would like to send additional headers as part of the request, use the `headers` request option.
97
+
98
+ ```typescript
99
+ import { CatchAllApiClient } from "newscatcher-catchall-sdk";
100
+
101
+ const client = new CatchAllApiClient({
102
+ ...
103
+ headers: {
104
+ 'X-Custom-Header': 'custom value'
105
+ }
106
+ });
107
+
108
+ const response = await client.jobs.createJob(..., {
109
+ headers: {
110
+ 'X-Custom-Header': 'custom value'
111
+ }
112
+ });
113
+ ```
114
+
115
+ ### Additional Query String Parameters
116
+
117
+ If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
118
+
119
+ ```typescript
120
+ const response = await client.jobs.createJob(..., {
121
+ queryParams: {
122
+ 'customQueryParamKey': 'custom query param value'
123
+ }
124
+ });
125
+ ```
126
+
127
+ ### Retries
128
+
129
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
130
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
131
+ retry limit (default: 2).
132
+
133
+ A request is deemed retryable when any of the following HTTP status codes is returned:
134
+
135
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
136
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
137
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
138
+
139
+ Use the `maxRetries` request option to configure this behavior.
140
+
141
+ ```typescript
142
+ const response = await client.jobs.createJob(..., {
143
+ maxRetries: 0 // override maxRetries at the request level
144
+ });
145
+ ```
146
+
147
+ ### Timeouts
148
+
149
+ The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
150
+
151
+ ```typescript
152
+ const response = await client.jobs.createJob(..., {
153
+ timeoutInSeconds: 30 // override timeout to 30s
154
+ });
155
+ ```
156
+
157
+ ### Aborting Requests
158
+
159
+ The SDK allows users to abort requests at any point by passing in an abort signal.
160
+
161
+ ```typescript
162
+ const controller = new AbortController();
163
+ const response = await client.jobs.createJob(..., {
164
+ abortSignal: controller.signal
165
+ });
166
+ controller.abort(); // aborts the request
167
+ ```
168
+
169
+ ### Access Raw Response Data
170
+
171
+ The SDK provides access to raw response data, including headers, through the `.withRawResponse()` method.
172
+ The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
173
+
174
+ ```typescript
175
+ const { data, rawResponse } = await client.jobs.createJob(...).withRawResponse();
176
+
177
+ console.log(data);
178
+ console.log(rawResponse.headers['X-My-Header']);
179
+ ```
180
+
181
+ ### Logging
182
+
183
+ The SDK supports logging. You can configure the logger by passing in a `logging` object to the client options.
184
+
185
+ ```typescript
186
+ import { CatchAllApiClient, logging } from "newscatcher-catchall-sdk";
187
+
188
+ const client = new CatchAllApiClient({
189
+ ...
190
+ logging: {
191
+ level: logging.LogLevel.Debug, // defaults to logging.LogLevel.Info
192
+ logger: new logging.ConsoleLogger(), // defaults to ConsoleLogger
193
+ silent: false, // defaults to true, set to false to enable logging
194
+ }
195
+ });
196
+ ```
197
+ The `logging` object can have the following properties:
198
+ - `level`: The log level to use. Defaults to `logging.LogLevel.Info`.
199
+ - `logger`: The logger to use. Defaults to a `logging.ConsoleLogger`.
200
+ - `silent`: Whether to silence the logger. Defaults to `true`.
201
+
202
+ The `level` property can be one of the following values:
203
+ - `logging.LogLevel.Debug`
204
+ - `logging.LogLevel.Info`
205
+ - `logging.LogLevel.Warn`
206
+ - `logging.LogLevel.Error`
207
+
208
+ To provide a custom logger, you can pass in an object that implements the `logging.ILogger` interface.
209
+
210
+ <details>
211
+ <summary>Custom logger examples</summary>
212
+
213
+ Here's an example using the popular `winston` logging library.
214
+ ```ts
215
+ import winston from 'winston';
216
+
217
+ const winstonLogger = winston.createLogger({...});
218
+
219
+ const logger: logging.ILogger = {
220
+ debug: (msg, ...args) => winstonLogger.debug(msg, ...args),
221
+ info: (msg, ...args) => winstonLogger.info(msg, ...args),
222
+ warn: (msg, ...args) => winstonLogger.warn(msg, ...args),
223
+ error: (msg, ...args) => winstonLogger.error(msg, ...args),
224
+ };
225
+ ```
226
+
227
+ Here's an example using the popular `pino` logging library.
228
+
229
+ ```ts
230
+ import pino from 'pino';
231
+
232
+ const pinoLogger = pino({...});
233
+
234
+ const logger: logging.ILogger = {
235
+ debug: (msg, ...args) => pinoLogger.debug(args, msg),
236
+ info: (msg, ...args) => pinoLogger.info(args, msg),
237
+ warn: (msg, ...args) => pinoLogger.warn(args, msg),
238
+ error: (msg, ...args) => pinoLogger.error(args, msg),
239
+ };
240
+ ```
241
+ </details>
242
+
243
+
244
+ ### Runtime Compatibility
245
+
246
+
247
+ The SDK works in the following runtimes:
248
+
249
+
250
+
251
+ - Node.js 18+
252
+ - Vercel
253
+ - Cloudflare Workers
254
+ - Deno v1.25+
255
+ - Bun 1.0+
256
+ - React Native
257
+
258
+ ### Customizing Fetch Client
259
+
260
+ The SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're running in an
261
+ unsupported environment, this provides a way for you to break glass and ensure the SDK works.
262
+
263
+ ```typescript
264
+ import { CatchAllApiClient } from "newscatcher-catchall-sdk";
265
+
266
+ const client = new CatchAllApiClient({
267
+ ...
268
+ fetcher: // provide your implementation here
269
+ });
270
+ ```
271
+
272
+ ## Contributing
273
+
274
+ While we value open-source contributions to this SDK, this library is generated programmatically.
275
+ Additions made directly to this library would have to be moved over to our generation code,
276
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
277
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
278
+ an issue first to discuss with us!
279
+
280
+ On the other hand, contributions to the README are always very welcome!
281
+ ## Support
282
+
283
+ - Documentation: [www.newscatcherapi.com/docs/web-search-api](https://www.newscatcherapi.com/docs/web-search-api/get-started/introduction)
284
+ - Support: <support@newscatcherapi.com>
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "newscatcher-catchall-sdk",
46
- "X-Fern-SDK-Version": "1.0.0",
47
- "User-Agent": "newscatcher-catchall-sdk/1.0.0",
46
+ "X-Fern-SDK-Version": "1.1.2",
47
+ "User-Agent": "newscatcher-catchall-sdk/1.1.2",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);