@timeback/webhooks 0.1.1-beta.20260219190739
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 +226 -0
- package/dist/client.d.ts +70 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/constants.d.ts +29 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/factory.d.ts +38 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/index.d.ts +532 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17150 -0
- package/dist/lib/index.d.ts +9 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/resolve.d.ts +21 -0
- package/dist/lib/resolve.d.ts.map +1 -0
- package/dist/lib/transport.d.ts +19 -0
- package/dist/lib/transport.d.ts.map +1 -0
- package/dist/public-types.d.ts +170 -0
- package/dist/public-types.d.ts.map +1 -0
- package/dist/public-types.js +0 -0
- package/dist/resources/index.d.ts +6 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/webhook-filters.d.ts +104 -0
- package/dist/resources/webhook-filters.d.ts.map +1 -0
- package/dist/resources/webhooks.d.ts +116 -0
- package/dist/resources/webhooks.d.ts.map +1 -0
- package/dist/types/client.d.ts +51 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +42 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
import * as _timeback_internal_client_infra from '@timeback/internal-client-infra';
|
|
2
|
+
import { BaseTransportConfig, WebhookPaths, ClientConfig, TransportOnlyConfig, RequestOptions, ProviderClientConfig, ProviderRegistry, TimebackProvider, AuthCheckResult, BaseTransport } from '@timeback/internal-client-infra';
|
|
3
|
+
export { AuthCheckResult, EnvAuth, Environment, ExplicitAuth } from '@timeback/internal-client-infra';
|
|
4
|
+
|
|
5
|
+
type input<T> = T extends {
|
|
6
|
+
_zod: {
|
|
7
|
+
input: any;
|
|
8
|
+
};
|
|
9
|
+
} ? T["_zod"]["input"] : unknown;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Webhook Schemas
|
|
13
|
+
*
|
|
14
|
+
* Zod schemas for webhook and webhook filter inputs.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
20
|
+
// WEBHOOK INPUTS
|
|
21
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
22
|
+
|
|
23
|
+
declare const WebhookCreateInput = z
|
|
24
|
+
.object({
|
|
25
|
+
name: z.string().min(1, 'name must be a non-empty string'),
|
|
26
|
+
targetUrl: z.url('targetUrl must be a valid URL'),
|
|
27
|
+
secret: z.string().min(1, 'secret must be a non-empty string'),
|
|
28
|
+
active: z.boolean(),
|
|
29
|
+
sensor: z.string().nullable().optional(),
|
|
30
|
+
description: z.string().nullable().optional(),
|
|
31
|
+
})
|
|
32
|
+
.strict()
|
|
33
|
+
|
|
34
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
35
|
+
// TYPE EXPORTS (REQUEST INPUTS)
|
|
36
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
37
|
+
|
|
38
|
+
type WebhookCreateInput = input<typeof WebhookCreateInput>
|
|
39
|
+
|
|
40
|
+
declare const WebhookUpdateInput = WebhookCreateInput
|
|
41
|
+
type WebhookUpdateInput = input<typeof WebhookUpdateInput>
|
|
42
|
+
|
|
43
|
+
declare const WebhookFilterCreateInput = z
|
|
44
|
+
.object({
|
|
45
|
+
webhookId: z.string().min(1, 'webhookId must be a non-empty string'),
|
|
46
|
+
filterKey: z.string().min(1, 'filterKey must be a non-empty string'),
|
|
47
|
+
filterValue: z.string().min(1, 'filterValue must be a non-empty string'),
|
|
48
|
+
filterType: WebhookFilterType,
|
|
49
|
+
filterOperator: WebhookFilterOperation,
|
|
50
|
+
active: z.boolean(),
|
|
51
|
+
})
|
|
52
|
+
.strict()
|
|
53
|
+
type WebhookFilterCreateInput = input<typeof WebhookFilterCreateInput>
|
|
54
|
+
|
|
55
|
+
declare const WebhookFilterUpdateInput = WebhookFilterCreateInput
|
|
56
|
+
type WebhookFilterUpdateInput = input<typeof WebhookFilterUpdateInput>
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Webhook Types
|
|
60
|
+
*
|
|
61
|
+
* Type definitions for the Webhooks API.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
65
|
+
// ENUMS
|
|
66
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
67
|
+
|
|
68
|
+
/** Supported data types for webhook filter values */
|
|
69
|
+
type FilterType = 'string' | 'number' | 'boolean'
|
|
70
|
+
|
|
71
|
+
/** Supported filter comparison operations */
|
|
72
|
+
type FilterOperation =
|
|
73
|
+
| 'eq'
|
|
74
|
+
| 'neq'
|
|
75
|
+
| 'gt'
|
|
76
|
+
| 'gte'
|
|
77
|
+
| 'lt'
|
|
78
|
+
| 'lte'
|
|
79
|
+
| 'contains'
|
|
80
|
+
| 'notContains'
|
|
81
|
+
| 'in'
|
|
82
|
+
| 'notIn'
|
|
83
|
+
| 'startsWith'
|
|
84
|
+
| 'endsWith'
|
|
85
|
+
| 'regexp'
|
|
86
|
+
|
|
87
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
88
|
+
// ENTITIES
|
|
89
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
90
|
+
|
|
91
|
+
/** A registered webhook */
|
|
92
|
+
interface Webhook {
|
|
93
|
+
/** Unique webhook identifier (UUID) */
|
|
94
|
+
id: string
|
|
95
|
+
/** Associated sensor identifier, null if not scoped to a sensor */
|
|
96
|
+
sensor: string | null
|
|
97
|
+
/** Human-readable webhook name */
|
|
98
|
+
name: string
|
|
99
|
+
/** Optional webhook description */
|
|
100
|
+
description: string | null
|
|
101
|
+
/** Destination URL that receives event payloads */
|
|
102
|
+
targetUrl: string
|
|
103
|
+
/** Shared secret used to sign webhook payloads */
|
|
104
|
+
secret: string
|
|
105
|
+
/** Whether the webhook is currently active */
|
|
106
|
+
active: boolean
|
|
107
|
+
/** ISO 8601 creation timestamp */
|
|
108
|
+
created_at: string | null
|
|
109
|
+
/** ISO 8601 last update timestamp */
|
|
110
|
+
updated_at: string | null
|
|
111
|
+
/** ISO 8601 soft-delete timestamp, null if not deleted */
|
|
112
|
+
deleted_at: string | null
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** A filter attached to a webhook that controls which events trigger delivery */
|
|
116
|
+
interface WebhookFilter {
|
|
117
|
+
/** Unique filter identifier (UUID) */
|
|
118
|
+
id: string
|
|
119
|
+
/** UUID of the parent webhook */
|
|
120
|
+
webhookId: string
|
|
121
|
+
/** Event field to filter on (e.g., 'type', 'action') */
|
|
122
|
+
filterKey: string
|
|
123
|
+
/** Value to compare against */
|
|
124
|
+
filterValue: string
|
|
125
|
+
/** Data type of the filter value */
|
|
126
|
+
filterType: FilterType
|
|
127
|
+
/** Comparison operator */
|
|
128
|
+
filterOperator: FilterOperation
|
|
129
|
+
/** Whether the filter is currently active */
|
|
130
|
+
active: boolean
|
|
131
|
+
/** ISO 8601 creation timestamp */
|
|
132
|
+
created_at: string | null
|
|
133
|
+
/** ISO 8601 last update timestamp */
|
|
134
|
+
updated_at: string | null
|
|
135
|
+
/** ISO 8601 soft-delete timestamp, null if not deleted */
|
|
136
|
+
deleted_at: string | null
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Response for DELETE /webhooks/:id */
|
|
140
|
+
interface WebhookDeleteResponse {
|
|
141
|
+
message: string
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Response for DELETE /webhook-filters/:id */
|
|
145
|
+
interface WebhookFilterDeleteResponse {
|
|
146
|
+
message: string
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Client Configuration Types
|
|
151
|
+
*
|
|
152
|
+
* Configuration types for the Webhooks client.
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Transport interface for Webhooks client.
|
|
157
|
+
*
|
|
158
|
+
* Extends base transport requirements with webhook-specific paths.
|
|
159
|
+
* Required when using transport mode with WebhooksClient.
|
|
160
|
+
*/
|
|
161
|
+
interface WebhooksTransportLike {
|
|
162
|
+
/** Base URL of the API */
|
|
163
|
+
baseUrl: string;
|
|
164
|
+
/** API path profiles for Webhook operations */
|
|
165
|
+
paths: WebhookPaths;
|
|
166
|
+
/** Make an authenticated request */
|
|
167
|
+
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Webhooks client configuration options.
|
|
171
|
+
*
|
|
172
|
+
* Supports four modes:
|
|
173
|
+
* - **Provider mode**: `{ provider: TimebackProvider }` — pre-built provider with token sharing
|
|
174
|
+
* - **Environment mode**: `{ platform?, env, auth }` — Timeback hosted APIs
|
|
175
|
+
* - **Explicit mode**: `{ baseUrl, auth: { authUrl } }` — custom API URLs
|
|
176
|
+
* - **Transport mode**: `{ transport: WebhooksTransportLike }` — custom transport with paths
|
|
177
|
+
*/
|
|
178
|
+
type WebhooksClientConfig = ClientConfig | TransportOnlyConfig<WebhooksTransportLike> | ProviderClientConfig;
|
|
179
|
+
/**
|
|
180
|
+
* Configuration for Webhooks transport.
|
|
181
|
+
*/
|
|
182
|
+
type WebhooksTransportConfig = BaseTransportConfig & {
|
|
183
|
+
/** API path profiles for Webhook operations */
|
|
184
|
+
paths: WebhookPaths;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Instance type of WebhooksClient.
|
|
188
|
+
*/
|
|
189
|
+
type WebhooksClientInstance = InstanceType<typeof WebhooksClient>;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Webhooks Resource
|
|
193
|
+
*
|
|
194
|
+
* Manage webhooks - create, list, update, delete, activate, and deactivate.
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Webhooks resource.
|
|
199
|
+
*
|
|
200
|
+
* Provides methods to manage webhook registrations for receiving
|
|
201
|
+
* event notifications.
|
|
202
|
+
*/
|
|
203
|
+
declare class WebhooksResource {
|
|
204
|
+
private readonly transport;
|
|
205
|
+
constructor(transport: WebhooksTransportLike);
|
|
206
|
+
/**
|
|
207
|
+
* List webhooks, optionally filtered by sensor.
|
|
208
|
+
*
|
|
209
|
+
* @param sensor - Optional sensor ID to filter by
|
|
210
|
+
* @returns Array of registered webhooks
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```typescript
|
|
214
|
+
* const webhooks = await client.webhooks.list()
|
|
215
|
+
* const filtered = await client.webhooks.list('https://example.edu/sensors/1')
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
list(sensor?: string): Promise<Webhook[]>;
|
|
219
|
+
/**
|
|
220
|
+
* Get a specific webhook by ID.
|
|
221
|
+
*
|
|
222
|
+
* @param id - The webhook UUID
|
|
223
|
+
* @returns The webhook object
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* const webhook = await client.webhooks.get('123e4567-e89b-12d3-a456-426614174000')
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
get(id: string): Promise<Webhook>;
|
|
231
|
+
/**
|
|
232
|
+
* Create a new webhook.
|
|
233
|
+
*
|
|
234
|
+
* @param input - Webhook configuration
|
|
235
|
+
* @returns The created webhook
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* const webhook = await client.webhooks.create({
|
|
240
|
+
* name: 'My Webhook',
|
|
241
|
+
* targetUrl: 'https://myapp.example.com/caliper-events',
|
|
242
|
+
* secret: 'my-shared-secret',
|
|
243
|
+
* active: true,
|
|
244
|
+
* })
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
create(input: WebhookCreateInput): Promise<Webhook>;
|
|
248
|
+
/**
|
|
249
|
+
* Update an existing webhook.
|
|
250
|
+
*
|
|
251
|
+
* @param id - The webhook UUID
|
|
252
|
+
* @param input - Updated webhook configuration
|
|
253
|
+
* @returns The updated webhook
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* const updated = await client.webhooks.update(webhookId, {
|
|
258
|
+
* name: 'Updated Name',
|
|
259
|
+
* targetUrl: 'https://new-url.example.com/events',
|
|
260
|
+
* secret: 'new-secret',
|
|
261
|
+
* active: true,
|
|
262
|
+
* })
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
update(id: string, input: WebhookUpdateInput): Promise<Webhook>;
|
|
266
|
+
/**
|
|
267
|
+
* Delete a webhook.
|
|
268
|
+
*
|
|
269
|
+
* @param id - The webhook UUID
|
|
270
|
+
* @returns The delete response with status
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```typescript
|
|
274
|
+
* await client.webhooks.delete(webhookId)
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
delete(id: string): Promise<WebhookDeleteResponse>;
|
|
278
|
+
/**
|
|
279
|
+
* Activate a webhook.
|
|
280
|
+
*
|
|
281
|
+
* @param id - The webhook UUID
|
|
282
|
+
* @returns The activated webhook
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```typescript
|
|
286
|
+
* const webhook = await client.webhooks.activate(webhookId)
|
|
287
|
+
* console.log(webhook.active) // true
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
activate(id: string): Promise<Webhook>;
|
|
291
|
+
/**
|
|
292
|
+
* Deactivate a webhook.
|
|
293
|
+
*
|
|
294
|
+
* @param id - The webhook UUID
|
|
295
|
+
* @returns The deactivated webhook
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```typescript
|
|
299
|
+
* const webhook = await client.webhooks.deactivate(webhookId)
|
|
300
|
+
* console.log(webhook.active) // false
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
deactivate(id: string): Promise<Webhook>;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Webhook Filters Resource
|
|
308
|
+
*
|
|
309
|
+
* Manage webhook filters - create, list, update, and delete.
|
|
310
|
+
*/
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Webhook Filters resource.
|
|
314
|
+
*
|
|
315
|
+
* Provides methods to manage filters that control which events
|
|
316
|
+
* trigger webhook delivery.
|
|
317
|
+
*/
|
|
318
|
+
declare class WebhookFiltersResource {
|
|
319
|
+
private readonly transport;
|
|
320
|
+
constructor(transport: WebhooksTransportLike);
|
|
321
|
+
/**
|
|
322
|
+
* List all webhook filters.
|
|
323
|
+
*
|
|
324
|
+
* @returns Array of all webhook filters
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```typescript
|
|
328
|
+
* const filters = await client.webhookFilters.list()
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
list(): Promise<WebhookFilter[]>;
|
|
332
|
+
/**
|
|
333
|
+
* Get a specific webhook filter by ID.
|
|
334
|
+
*
|
|
335
|
+
* @param id - The webhook filter ID
|
|
336
|
+
* @returns The webhook filter object
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```typescript
|
|
340
|
+
* const filter = await client.webhookFilters.get(filterId)
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
get(id: string): Promise<WebhookFilter>;
|
|
344
|
+
/**
|
|
345
|
+
* List all filters for a specific webhook.
|
|
346
|
+
*
|
|
347
|
+
* @param webhookId - The parent webhook UUID
|
|
348
|
+
* @returns Array of filters for the specified webhook
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```typescript
|
|
352
|
+
* const filters = await client.webhookFilters.listByWebhook(webhookId)
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
listByWebhook(webhookId: string): Promise<WebhookFilter[]>;
|
|
356
|
+
/**
|
|
357
|
+
* Create a new webhook filter.
|
|
358
|
+
*
|
|
359
|
+
* @param input - Filter configuration
|
|
360
|
+
* @returns The created webhook filter
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* const filter = await client.webhookFilters.create({
|
|
365
|
+
* webhookId: '123e4567-e89b-12d3-a456-426614174000',
|
|
366
|
+
* filterKey: 'type',
|
|
367
|
+
* filterValue: 'ActivityEvent',
|
|
368
|
+
* filterType: 'string',
|
|
369
|
+
* filterOperator: 'eq',
|
|
370
|
+
* active: true,
|
|
371
|
+
* })
|
|
372
|
+
* ```
|
|
373
|
+
*/
|
|
374
|
+
create(input: WebhookFilterCreateInput): Promise<WebhookFilter>;
|
|
375
|
+
/**
|
|
376
|
+
* Update an existing webhook filter.
|
|
377
|
+
*
|
|
378
|
+
* @param id - The webhook filter ID
|
|
379
|
+
* @param input - Updated filter configuration
|
|
380
|
+
* @returns The updated webhook filter
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* ```typescript
|
|
384
|
+
* const updated = await client.webhookFilters.update(filterId, {
|
|
385
|
+
* webhookId: webhookId,
|
|
386
|
+
* filterKey: 'type',
|
|
387
|
+
* filterValue: 'TimeSpentEvent',
|
|
388
|
+
* filterType: 'string',
|
|
389
|
+
* filterOperator: 'eq',
|
|
390
|
+
* active: true,
|
|
391
|
+
* })
|
|
392
|
+
* ```
|
|
393
|
+
*/
|
|
394
|
+
update(id: string, input: WebhookFilterUpdateInput): Promise<WebhookFilter>;
|
|
395
|
+
/**
|
|
396
|
+
* Delete a webhook filter.
|
|
397
|
+
*
|
|
398
|
+
* @param id - The webhook filter ID
|
|
399
|
+
* @returns The delete response with status
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* ```typescript
|
|
403
|
+
* await client.webhookFilters.delete(filterId)
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
delete(id: string): Promise<WebhookFilterDeleteResponse>;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Webhooks Client
|
|
411
|
+
*
|
|
412
|
+
* Main entry point for the Webhooks management SDK.
|
|
413
|
+
*/
|
|
414
|
+
/**
|
|
415
|
+
* Webhooks API client.
|
|
416
|
+
*
|
|
417
|
+
* Provides methods to create, list, update, delete, activate, and
|
|
418
|
+
* deactivate webhooks, as well as manage webhook filters.
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* ```typescript
|
|
422
|
+
* // Environment mode (Timeback APIs)
|
|
423
|
+
* const client = new WebhooksClient({
|
|
424
|
+
* env: 'staging',
|
|
425
|
+
* auth: {
|
|
426
|
+
* clientId: 'your-client-id',
|
|
427
|
+
* clientSecret: 'your-client-secret',
|
|
428
|
+
* },
|
|
429
|
+
* })
|
|
430
|
+
* ```
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```typescript
|
|
434
|
+
* // Provider mode (shared tokens)
|
|
435
|
+
* import { TimebackProvider } from '@timeback/internal-client-infra'
|
|
436
|
+
*
|
|
437
|
+
* const provider = new TimebackProvider({
|
|
438
|
+
* platform: 'BEYOND_AI',
|
|
439
|
+
* env: 'staging',
|
|
440
|
+
* auth: { clientId: '...', clientSecret: '...' },
|
|
441
|
+
* })
|
|
442
|
+
*
|
|
443
|
+
* const client = new WebhooksClient({ provider })
|
|
444
|
+
* ```
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```typescript
|
|
448
|
+
* // Managing webhooks
|
|
449
|
+
* const webhook = await client.webhooks.create({
|
|
450
|
+
* name: 'My Webhook',
|
|
451
|
+
* targetUrl: 'https://myapp.example.com/events',
|
|
452
|
+
* secret: 'my-shared-secret',
|
|
453
|
+
* active: true,
|
|
454
|
+
* })
|
|
455
|
+
*
|
|
456
|
+
* // Add a filter
|
|
457
|
+
* await client.webhookFilters.create({
|
|
458
|
+
* webhookId: webhook.id,
|
|
459
|
+
* filterKey: 'type',
|
|
460
|
+
* filterValue: 'ActivityEvent',
|
|
461
|
+
* filterType: 'string',
|
|
462
|
+
* filterOperator: 'eq',
|
|
463
|
+
* active: true,
|
|
464
|
+
* })
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
declare const WebhooksClient: {
|
|
468
|
+
new (config?: WebhooksClientConfig): {
|
|
469
|
+
readonly transport: WebhooksTransportLike;
|
|
470
|
+
readonly _provider?: _timeback_internal_client_infra.TimebackProvider | undefined;
|
|
471
|
+
readonly webhooks: WebhooksResource;
|
|
472
|
+
readonly webhookFilters: WebhookFiltersResource;
|
|
473
|
+
getTransport(): WebhooksTransportLike;
|
|
474
|
+
checkAuth(): Promise<_timeback_internal_client_infra.AuthCheckResult>;
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Webhooks Client Factory
|
|
480
|
+
*
|
|
481
|
+
* Creates WebhooksClient classes bound to specific provider registries.
|
|
482
|
+
*/
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Create a WebhooksClient class bound to a specific provider registry.
|
|
486
|
+
*
|
|
487
|
+
* @param registry - Provider registry to use (defaults to all Timeback platforms)
|
|
488
|
+
* @returns WebhooksClient class bound to the registry
|
|
489
|
+
*/
|
|
490
|
+
declare function createWebhooksClient(registry?: ProviderRegistry): {
|
|
491
|
+
new (config?: WebhooksClientConfig): {
|
|
492
|
+
/** @internal */
|
|
493
|
+
readonly transport: WebhooksTransportLike;
|
|
494
|
+
/** @internal */
|
|
495
|
+
readonly _provider?: TimebackProvider | undefined;
|
|
496
|
+
/** Manage webhook registrations */
|
|
497
|
+
readonly webhooks: WebhooksResource;
|
|
498
|
+
/** Manage filters that control which events trigger webhook delivery */
|
|
499
|
+
readonly webhookFilters: WebhookFiltersResource;
|
|
500
|
+
/**
|
|
501
|
+
* Get the underlying transport for advanced use cases.
|
|
502
|
+
* @returns The transport instance used by this client
|
|
503
|
+
*/
|
|
504
|
+
getTransport(): WebhooksTransportLike;
|
|
505
|
+
/**
|
|
506
|
+
* Verify that OAuth authentication is working.
|
|
507
|
+
* @returns Auth check result
|
|
508
|
+
* @throws {Error} If client was initialized with custom transport (no provider)
|
|
509
|
+
*/
|
|
510
|
+
checkAuth(): Promise<AuthCheckResult>;
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Transport Layer
|
|
516
|
+
*
|
|
517
|
+
* HTTP transport for Webhooks API communication.
|
|
518
|
+
*/
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* HTTP transport layer for Webhooks API communication.
|
|
522
|
+
*
|
|
523
|
+
* Extends BaseTransport with webhook-specific path configuration.
|
|
524
|
+
*/
|
|
525
|
+
declare class Transport extends BaseTransport {
|
|
526
|
+
/** API path profiles for Webhook operations */
|
|
527
|
+
readonly paths: WebhookPaths;
|
|
528
|
+
constructor(config: WebhooksTransportConfig);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export { Transport, WebhookCreateInput, WebhookFilterCreateInput, WebhookFilterUpdateInput, WebhookUpdateInput, WebhooksClient, createWebhooksClient };
|
|
532
|
+
export type { FilterOperation, FilterType, Webhook, WebhookFilter, WebhooksClientConfig, WebhooksClientInstance };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAMH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEhD,YAAY,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACtD,YAAY,EAAE,oBAAoB,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9F,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAMtE,YAAY,EACX,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,GACxB,MAAM,qBAAqB,CAAA;AAE5B,YAAY,EACX,OAAO,EACP,aAAa,EACb,UAAU,EACV,eAAe,GACf,MAAM,oCAAoC,CAAA;AAM3C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA"}
|