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