@hunt-labs/bytekit-sdk 0.2.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +117 -0
- package/README.md +80 -10
- package/dist/allowlist.d.ts +1 -1
- package/dist/allowlist.js +7 -0
- package/dist/client.d.ts +100 -6
- package/dist/client.js +202 -49
- package/dist/generated/api.d.ts +17 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +0 -2
- package/dist/resources/account.d.ts +16 -11
- package/dist/resources/account.js +20 -15
- package/dist/resources/bulk.d.ts +24 -8
- package/dist/resources/bulk.js +14 -9
- package/dist/resources/fetch.d.ts +127 -10
- package/dist/resources/fetch.js +67 -19
- package/dist/resources/monitors.d.ts +69 -11
- package/dist/resources/monitors.js +27 -14
- package/dist/resources/query-string.d.ts +10 -0
- package/dist/resources/query-string.js +20 -0
- package/dist/resources/scrape.d.ts +48 -9
- package/dist/resources/scrape.js +10 -5
- package/dist/resources/screenshots.d.ts +42 -5
- package/dist/resources/screenshots.js +44 -5
- package/dist/resources/search.d.ts +9 -4
- package/dist/resources/search.js +8 -3
- package/dist/resources/sitemap.d.ts +41 -5
- package/dist/resources/sitemap.js +23 -5
- package/dist/resources/usage.d.ts +36 -0
- package/dist/resources/usage.js +30 -0
- package/dist/resources/webhooks.d.ts +25 -0
- package/dist/resources/webhooks.js +20 -0
- package/dist/types.d.ts +7 -4
- package/dist/types.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ApiResponse, ByteKit, RequestOptions } from '../client.js';
|
|
2
2
|
import type { operations } from '../generated/api.js';
|
|
3
3
|
import type { ScreenshotId } from '../types.js';
|
|
4
4
|
/** The `createScreenshot` request body exactly as the OpenAPI spec declares it. */
|
|
@@ -47,15 +47,52 @@ export type ScreenshotCreateResponse = operations['createScreenshot']['responses
|
|
|
47
47
|
export type ScreenshotGetResponse = operations['getScreenshot']['responses'][200]['content']['application/json'] | operations['getScreenshot']['responses'][202]['content']['application/json'];
|
|
48
48
|
export declare class ScreenshotsResource {
|
|
49
49
|
private readonly client;
|
|
50
|
-
constructor(client:
|
|
51
|
-
/**
|
|
52
|
-
|
|
50
|
+
constructor(client: ByteKit);
|
|
51
|
+
/**
|
|
52
|
+
* POST /v1/screenshots — capture a screenshot.
|
|
53
|
+
*
|
|
54
|
+
* `params.async` maps to the `?async=true` query param (queued 202 capture). It is a QUERY
|
|
55
|
+
* param on `createScreenshot`, distinct from scrape where `async` is a body field. `params` is
|
|
56
|
+
* optional and `async` omitted-when-absent: `create(opts)` with no second argument posts to the
|
|
57
|
+
* bare `/v1/screenshots` URL unchanged — existing single-arg callers are unaffected.
|
|
58
|
+
*
|
|
59
|
+
* `requestOptions` is the THIRD positional parameter (after `params`) so both existing call
|
|
60
|
+
* shapes stay unaffected. It carries the CLIENT-side abort budget (`requestTimeoutMs`) and an
|
|
61
|
+
* optional caller `signal`; both override the constructor's `timeoutMs` default.
|
|
62
|
+
*/
|
|
63
|
+
create(opts: ScreenshotCreateRequest, params?: {
|
|
64
|
+
async?: boolean;
|
|
65
|
+
}, requestOptions?: RequestOptions): Promise<ScreenshotCreateResponse>;
|
|
53
66
|
/**
|
|
54
67
|
* GET /v1/screenshots/{id} — poll a screenshot by ID.
|
|
55
68
|
*
|
|
56
69
|
* A terminal-`failed` screenshot returns the `Error` envelope on a 200
|
|
57
70
|
* (issue #2027), so narrow the result before reading `image_url`.
|
|
58
71
|
*/
|
|
59
|
-
get(id: ScreenshotId): Promise<ScreenshotGetResponse>;
|
|
72
|
+
get(id: ScreenshotId, requestOptions?: RequestOptions): Promise<ScreenshotGetResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* POST /v1/screenshots, returning the header set alongside the body (#2547).
|
|
75
|
+
*
|
|
76
|
+
* Same request as `screenshots.create` — same method, path, body and
|
|
77
|
+
* `RequestOptions` precedence — and `data` is exactly what `create()` resolves to.
|
|
78
|
+
* `create()`'s own return type is UNCHANGED; this is an additive sibling.
|
|
79
|
+
*
|
|
80
|
+
* The spec documents the `X-Screenshot-*` family (`ID`, `Status`, `URL`,
|
|
81
|
+
* `Credits-Charged`, `Duration-Ms`, `Created-At`, `Completed-At`, `Expires-At`,
|
|
82
|
+
* `Status-Code`, `Cache`, `Cache-Age`) plus `X-Raw-Bytes` / `X-Billable-Bytes` /
|
|
83
|
+
* `X-Billing-Multiplier`; every one of them is on `headers`.
|
|
84
|
+
*/
|
|
85
|
+
createWithResponse(opts: ScreenshotCreateRequest, params?: {
|
|
86
|
+
async?: boolean;
|
|
87
|
+
}, requestOptions?: RequestOptions): Promise<ApiResponse<ScreenshotCreateResponse>>;
|
|
88
|
+
/**
|
|
89
|
+
* GET /v1/screenshots/{id}, returning the header set alongside the body (#2547).
|
|
90
|
+
*
|
|
91
|
+
* Same request as `screenshots.get`, and `data` is exactly what `get()`
|
|
92
|
+
* resolves to (including the #2027 failed-envelope arm). `get()`'s own return type is
|
|
93
|
+
* UNCHANGED; this is an additive sibling. The documented `X-Screenshot-*`,
|
|
94
|
+
* `X-Raw-Bytes`, `X-Billable-Bytes` and `X-Billing-Multiplier` headers are on `headers`.
|
|
95
|
+
*/
|
|
96
|
+
getWithResponse(id: ScreenshotId, requestOptions?: RequestOptions): Promise<ApiResponse<ScreenshotGetResponse>>;
|
|
60
97
|
}
|
|
61
98
|
export {};
|
|
@@ -3,9 +3,21 @@ export class ScreenshotsResource {
|
|
|
3
3
|
constructor(client) {
|
|
4
4
|
this.client = client;
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* POST /v1/screenshots — capture a screenshot.
|
|
8
|
+
*
|
|
9
|
+
* `params.async` maps to the `?async=true` query param (queued 202 capture). It is a QUERY
|
|
10
|
+
* param on `createScreenshot`, distinct from scrape where `async` is a body field. `params` is
|
|
11
|
+
* optional and `async` omitted-when-absent: `create(opts)` with no second argument posts to the
|
|
12
|
+
* bare `/v1/screenshots` URL unchanged — existing single-arg callers are unaffected.
|
|
13
|
+
*
|
|
14
|
+
* `requestOptions` is the THIRD positional parameter (after `params`) so both existing call
|
|
15
|
+
* shapes stay unaffected. It carries the CLIENT-side abort budget (`requestTimeoutMs`) and an
|
|
16
|
+
* optional caller `signal`; both override the constructor's `timeoutMs` default.
|
|
17
|
+
*/
|
|
18
|
+
create(opts, params, requestOptions) {
|
|
19
|
+
const suffix = params?.async === true ? '?async=true' : '';
|
|
20
|
+
return this.client.request('POST', `/v1/screenshots${suffix}`, opts, requestOptions);
|
|
9
21
|
}
|
|
10
22
|
/**
|
|
11
23
|
* GET /v1/screenshots/{id} — poll a screenshot by ID.
|
|
@@ -13,7 +25,34 @@ export class ScreenshotsResource {
|
|
|
13
25
|
* A terminal-`failed` screenshot returns the `Error` envelope on a 200
|
|
14
26
|
* (issue #2027), so narrow the result before reading `image_url`.
|
|
15
27
|
*/
|
|
16
|
-
get(id) {
|
|
17
|
-
return this.client.request('GET', `/v1/screenshots/${id}
|
|
28
|
+
get(id, requestOptions) {
|
|
29
|
+
return this.client.request('GET', `/v1/screenshots/${id}`, undefined, requestOptions);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* POST /v1/screenshots, returning the header set alongside the body (#2547).
|
|
33
|
+
*
|
|
34
|
+
* Same request as `screenshots.create` — same method, path, body and
|
|
35
|
+
* `RequestOptions` precedence — and `data` is exactly what `create()` resolves to.
|
|
36
|
+
* `create()`'s own return type is UNCHANGED; this is an additive sibling.
|
|
37
|
+
*
|
|
38
|
+
* The spec documents the `X-Screenshot-*` family (`ID`, `Status`, `URL`,
|
|
39
|
+
* `Credits-Charged`, `Duration-Ms`, `Created-At`, `Completed-At`, `Expires-At`,
|
|
40
|
+
* `Status-Code`, `Cache`, `Cache-Age`) plus `X-Raw-Bytes` / `X-Billable-Bytes` /
|
|
41
|
+
* `X-Billing-Multiplier`; every one of them is on `headers`.
|
|
42
|
+
*/
|
|
43
|
+
createWithResponse(opts, params, requestOptions) {
|
|
44
|
+
const suffix = params?.async === true ? '?async=true' : '';
|
|
45
|
+
return this.client.requestWithResponse('POST', `/v1/screenshots${suffix}`, opts, requestOptions);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* GET /v1/screenshots/{id}, returning the header set alongside the body (#2547).
|
|
49
|
+
*
|
|
50
|
+
* Same request as `screenshots.get`, and `data` is exactly what `get()`
|
|
51
|
+
* resolves to (including the #2027 failed-envelope arm). `get()`'s own return type is
|
|
52
|
+
* UNCHANGED; this is an additive sibling. The documented `X-Screenshot-*`,
|
|
53
|
+
* `X-Raw-Bytes`, `X-Billable-Bytes` and `X-Billing-Multiplier` headers are on `headers`.
|
|
54
|
+
*/
|
|
55
|
+
getWithResponse(id, requestOptions) {
|
|
56
|
+
return this.client.requestWithResponse('GET', `/v1/screenshots/${id}`, undefined, requestOptions);
|
|
18
57
|
}
|
|
19
58
|
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ByteKit, RequestOptions } from '../client.js';
|
|
2
2
|
import type { SearchOpts, SearchResponse } from '../types.js';
|
|
3
3
|
export declare class SearchResource {
|
|
4
4
|
private readonly client;
|
|
5
|
-
constructor(client:
|
|
6
|
-
/**
|
|
7
|
-
|
|
5
|
+
constructor(client: ByteKit);
|
|
6
|
+
/**
|
|
7
|
+
* POST /v1/search — run a web search and return ranked organic results.
|
|
8
|
+
*
|
|
9
|
+
* `requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an
|
|
10
|
+
* optional caller `signal`; both override the constructor's `timeoutMs` default.
|
|
11
|
+
*/
|
|
12
|
+
query(opts: SearchOpts, requestOptions?: RequestOptions): Promise<SearchResponse>;
|
|
8
13
|
}
|
package/dist/resources/search.js
CHANGED
|
@@ -3,8 +3,13 @@ export class SearchResource {
|
|
|
3
3
|
constructor(client) {
|
|
4
4
|
this.client = client;
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* POST /v1/search — run a web search and return ranked organic results.
|
|
8
|
+
*
|
|
9
|
+
* `requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an
|
|
10
|
+
* optional caller `signal`; both override the constructor's `timeoutMs` default.
|
|
11
|
+
*/
|
|
12
|
+
query(opts, requestOptions) {
|
|
13
|
+
return this.client.request('POST', '/v1/search', opts, requestOptions);
|
|
9
14
|
}
|
|
10
15
|
}
|
|
@@ -1,10 +1,46 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ApiResponse, ByteKit, RequestOptions } from '../client.js';
|
|
2
|
+
import type { operations } from '../generated/api.js';
|
|
2
3
|
import type { SitemapId } from '../types.js';
|
|
4
|
+
/** The `createSitemap` request body exactly as the OpenAPI spec declares it. */
|
|
5
|
+
type SitemapRequestSpec = operations['createSitemap']['requestBody']['content']['application/json'];
|
|
6
|
+
/**
|
|
7
|
+
* Body of POST /v1/sitemap — `url` is required, every other field optional.
|
|
8
|
+
*
|
|
9
|
+
* Same `defaultNonNullable` drift documented on `ScreenshotCreateRequest`
|
|
10
|
+
* (screenshots.ts:12-31, follow-up #2540): the spec says `required: [url]`
|
|
11
|
+
* (openapi.yaml `SitemapRequest`) but 7 sibling fields carry `default:`, which
|
|
12
|
+
* `openapi-typescript` v7's `defaultNonNullable` transform promotes to
|
|
13
|
+
* non-optional in the generated type. Relaxed here so the spec-minimal
|
|
14
|
+
* `create({ url })` compiles — still DERIVED from the operation type, never
|
|
15
|
+
* hand-authored.
|
|
16
|
+
*/
|
|
17
|
+
export type SitemapCreateRequest = Partial<SitemapRequestSpec> & Pick<SitemapRequestSpec, 'url'>;
|
|
18
|
+
/** 202 payload of POST /v1/sitemap — sitemap crawls are always async. */
|
|
19
|
+
export type SitemapCreateResponse = operations['createSitemap']['responses'][202]['content']['application/json'];
|
|
20
|
+
/** 200 payload of GET /v1/sitemap/{id}. */
|
|
21
|
+
export type SitemapGetResponse = operations['getSitemap']['responses'][200]['content']['application/json'];
|
|
3
22
|
export declare class SitemapResource {
|
|
4
23
|
private readonly client;
|
|
5
|
-
constructor(client:
|
|
6
|
-
/**
|
|
7
|
-
|
|
24
|
+
constructor(client: ByteKit);
|
|
25
|
+
/**
|
|
26
|
+
* POST /v1/sitemap — start a sitemap crawl.
|
|
27
|
+
*
|
|
28
|
+
* `requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an
|
|
29
|
+
* optional caller `signal`; both override the constructor's `timeoutMs` default.
|
|
30
|
+
*/
|
|
31
|
+
create(opts: SitemapCreateRequest, requestOptions?: RequestOptions): Promise<SitemapCreateResponse>;
|
|
8
32
|
/** GET /v1/sitemap/{id} — get a sitemap job by ID */
|
|
9
|
-
get(id: SitemapId): Promise<
|
|
33
|
+
get(id: SitemapId, requestOptions?: RequestOptions): Promise<SitemapGetResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* GET /v1/sitemap/{id}, returning the header set alongside the body (#2547).
|
|
36
|
+
*
|
|
37
|
+
* Same request as `sitemap.get` — same method, path and `RequestOptions`
|
|
38
|
+
* precedence — and `data` is exactly what `get()` resolves to. `get()`'s own return type
|
|
39
|
+
* is UNCHANGED; this is an additive sibling, not a replacement.
|
|
40
|
+
*
|
|
41
|
+
* The spec documents `X-Sitemap-ID`, `X-Raw-Bytes`, `X-Billing-Multiplier` and
|
|
42
|
+
* `X-Billable-Bytes` on this endpoint's 200; every one of them is on `headers`.
|
|
43
|
+
*/
|
|
44
|
+
getWithResponse(id: SitemapId, requestOptions?: RequestOptions): Promise<ApiResponse<SitemapGetResponse>>;
|
|
10
45
|
}
|
|
46
|
+
export {};
|
|
@@ -3,12 +3,30 @@ export class SitemapResource {
|
|
|
3
3
|
constructor(client) {
|
|
4
4
|
this.client = client;
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* POST /v1/sitemap — start a sitemap crawl.
|
|
8
|
+
*
|
|
9
|
+
* `requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an
|
|
10
|
+
* optional caller `signal`; both override the constructor's `timeoutMs` default.
|
|
11
|
+
*/
|
|
12
|
+
create(opts, requestOptions) {
|
|
13
|
+
return this.client.request('POST', '/v1/sitemap', opts, requestOptions);
|
|
9
14
|
}
|
|
10
15
|
/** GET /v1/sitemap/{id} — get a sitemap job by ID */
|
|
11
|
-
get(id) {
|
|
12
|
-
return this.client.request('GET', `/v1/sitemap/${id}
|
|
16
|
+
get(id, requestOptions) {
|
|
17
|
+
return this.client.request('GET', `/v1/sitemap/${id}`, undefined, requestOptions);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* GET /v1/sitemap/{id}, returning the header set alongside the body (#2547).
|
|
21
|
+
*
|
|
22
|
+
* Same request as `sitemap.get` — same method, path and `RequestOptions`
|
|
23
|
+
* precedence — and `data` is exactly what `get()` resolves to. `get()`'s own return type
|
|
24
|
+
* is UNCHANGED; this is an additive sibling, not a replacement.
|
|
25
|
+
*
|
|
26
|
+
* The spec documents `X-Sitemap-ID`, `X-Raw-Bytes`, `X-Billing-Multiplier` and
|
|
27
|
+
* `X-Billable-Bytes` on this endpoint's 200; every one of them is on `headers`.
|
|
28
|
+
*/
|
|
29
|
+
getWithResponse(id, requestOptions) {
|
|
30
|
+
return this.client.requestWithResponse('GET', `/v1/sitemap/${id}`, undefined, requestOptions);
|
|
13
31
|
}
|
|
14
32
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ByteKit, RequestOptions } from '../client.js';
|
|
2
|
+
import type { operations } from '../generated/api.js';
|
|
3
|
+
/** 200 payload of GET /v1/usage — current billing period usage summary. */
|
|
4
|
+
export type GetUsageResponse = operations['getUsage']['responses'][200]['content']['application/json'];
|
|
5
|
+
/**
|
|
6
|
+
* Query params of GET /v1/usage/daily.
|
|
7
|
+
* Derived from the generated OpenAPI types so it stays in sync with the spec.
|
|
8
|
+
*/
|
|
9
|
+
export type GetUsageDailyParams = NonNullable<operations['getUsageDaily']['parameters']['query']>;
|
|
10
|
+
/** 200 payload of GET /v1/usage/daily — per-day usage breakdown. */
|
|
11
|
+
export type GetUsageDailyResponse = operations['getUsageDaily']['responses'][200]['content']['application/json'];
|
|
12
|
+
/** Query params of GET /v1/usage/by-endpoint. */
|
|
13
|
+
export type GetUsageByEndpointParams = NonNullable<operations['getUsageByEndpoint']['parameters']['query']>;
|
|
14
|
+
/** 200 payload of GET /v1/usage/by-endpoint — per-endpoint bandwidth breakdown. */
|
|
15
|
+
export type GetUsageByEndpointResponse = operations['getUsageByEndpoint']['responses'][200]['content']['application/json'];
|
|
16
|
+
export declare class UsageResource {
|
|
17
|
+
private readonly client;
|
|
18
|
+
constructor(client: ByteKit);
|
|
19
|
+
/**
|
|
20
|
+
* GET /v1/usage — get current billing period usage.
|
|
21
|
+
*
|
|
22
|
+
* `requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an
|
|
23
|
+
* optional caller `signal`; both override the constructor's `timeoutMs` default.
|
|
24
|
+
*/
|
|
25
|
+
get(requestOptions?: RequestOptions): Promise<GetUsageResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* GET /v1/usage/daily — get daily usage breakdown.
|
|
28
|
+
* Default range is the last 30 days; max range is 366 days.
|
|
29
|
+
*/
|
|
30
|
+
daily(params?: GetUsageDailyParams, requestOptions?: RequestOptions): Promise<GetUsageDailyResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* GET /v1/usage/by-endpoint — get per-endpoint bandwidth breakdown.
|
|
33
|
+
* Default range is the last 30 days; max range is 366 days.
|
|
34
|
+
*/
|
|
35
|
+
byEndpoint(params?: GetUsageByEndpointParams, requestOptions?: RequestOptions): Promise<GetUsageByEndpointResponse>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { toQueryString } from './query-string.js';
|
|
2
|
+
export class UsageResource {
|
|
3
|
+
client;
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* GET /v1/usage — get current billing period usage.
|
|
9
|
+
*
|
|
10
|
+
* `requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an
|
|
11
|
+
* optional caller `signal`; both override the constructor's `timeoutMs` default.
|
|
12
|
+
*/
|
|
13
|
+
get(requestOptions) {
|
|
14
|
+
return this.client.request('GET', '/v1/usage', undefined, requestOptions);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* GET /v1/usage/daily — get daily usage breakdown.
|
|
18
|
+
* Default range is the last 30 days; max range is 366 days.
|
|
19
|
+
*/
|
|
20
|
+
daily(params, requestOptions) {
|
|
21
|
+
return this.client.request('GET', `/v1/usage/daily${toQueryString(params)}`, undefined, requestOptions);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* GET /v1/usage/by-endpoint — get per-endpoint bandwidth breakdown.
|
|
25
|
+
* Default range is the last 30 days; max range is 366 days.
|
|
26
|
+
*/
|
|
27
|
+
byEndpoint(params, requestOptions) {
|
|
28
|
+
return this.client.request('GET', `/v1/usage/by-endpoint${toQueryString(params)}`, undefined, requestOptions);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ByteKit, RequestOptions } from '../client.js';
|
|
2
|
+
import type { operations } from '../generated/api.js';
|
|
3
|
+
import type { WebhookDeliveryId } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Query params of GET /v1/webhook-deliveries.
|
|
6
|
+
* Derived from the generated OpenAPI types so it stays in sync with the spec.
|
|
7
|
+
*/
|
|
8
|
+
export type ListWebhookDeliveriesParams = NonNullable<operations['listWebhookDeliveries']['parameters']['query']>;
|
|
9
|
+
/** 200 payload of GET /v1/webhook-deliveries. */
|
|
10
|
+
export type ListWebhookDeliveriesResponse = operations['listWebhookDeliveries']['responses'][200]['content']['application/json'];
|
|
11
|
+
/** 200 payload of POST /v1/webhook-deliveries/{id}/retry. */
|
|
12
|
+
export type RetryWebhookDeliveryResponse = operations['retryWebhookDelivery']['responses'][200]['content']['application/json'];
|
|
13
|
+
export declare class WebhooksResource {
|
|
14
|
+
private readonly client;
|
|
15
|
+
constructor(client: ByteKit);
|
|
16
|
+
/**
|
|
17
|
+
* GET /v1/webhook-deliveries — list webhook deliveries.
|
|
18
|
+
*
|
|
19
|
+
* `requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an
|
|
20
|
+
* optional caller `signal`; both override the constructor's `timeoutMs` default.
|
|
21
|
+
*/
|
|
22
|
+
list(params?: ListWebhookDeliveriesParams, requestOptions?: RequestOptions): Promise<ListWebhookDeliveriesResponse>;
|
|
23
|
+
/** POST /v1/webhook-deliveries/{id}/retry — requeue a failed or exhausted delivery. */
|
|
24
|
+
retry(id: WebhookDeliveryId, requestOptions?: RequestOptions): Promise<RetryWebhookDeliveryResponse>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { toQueryString } from './query-string.js';
|
|
2
|
+
export class WebhooksResource {
|
|
3
|
+
client;
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* GET /v1/webhook-deliveries — list webhook deliveries.
|
|
9
|
+
*
|
|
10
|
+
* `requestOptions` carries the CLIENT-side abort budget (`requestTimeoutMs`) and an
|
|
11
|
+
* optional caller `signal`; both override the constructor's `timeoutMs` default.
|
|
12
|
+
*/
|
|
13
|
+
list(params, requestOptions) {
|
|
14
|
+
return this.client.request('GET', `/v1/webhook-deliveries${toQueryString(params)}`, undefined, requestOptions);
|
|
15
|
+
}
|
|
16
|
+
/** POST /v1/webhook-deliveries/{id}/retry — requeue a failed or exhausted delivery. */
|
|
17
|
+
retry(id, requestOptions) {
|
|
18
|
+
return this.client.request('POST', `/v1/webhook-deliveries/${id}/retry`, undefined, requestOptions);
|
|
19
|
+
}
|
|
20
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Prefixed-ID branded types for all
|
|
2
|
+
* Prefixed-ID branded types for all ByteKit resource identifiers.
|
|
3
3
|
*
|
|
4
4
|
* These mirror the `ss_`, `rec_`, `bulk_`, etc. prefixes used at the API
|
|
5
5
|
* boundary (internal rows use raw UUIDs).
|
|
6
6
|
*/
|
|
7
7
|
export type ScrapeId = `sc_${string}`;
|
|
8
8
|
export type ScreenshotId = `ss_${string}`;
|
|
9
|
-
export type RecordingId = `rec_${string}`;
|
|
10
9
|
export type BulkId = `bulk_${string}`;
|
|
11
10
|
export type MonitorId = `mon_${string}`;
|
|
12
11
|
export type SitemapId = `sm_${string}`;
|
|
13
12
|
export type ApiKeyId = `ak_${string}`;
|
|
13
|
+
export type WebhookDeliveryId = `wh_${string}`;
|
|
14
14
|
/** Which search index to query. `web` (default), `news`, or `images`. */
|
|
15
15
|
export type SearchType = 'web' | 'news' | 'images';
|
|
16
16
|
/** Recency window for search results (maps to the upstream time filter). */
|
|
@@ -66,8 +66,11 @@ export interface SearchResult {
|
|
|
66
66
|
url: string;
|
|
67
67
|
/** Short text excerpt for the result. Omitted for `images` results. */
|
|
68
68
|
snippet: string;
|
|
69
|
-
/**
|
|
70
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Published date when the provider reports one, else `null`. Present for
|
|
71
|
+
* `web`/`news` results; omitted entirely (`undefined`) for `images` results.
|
|
72
|
+
*/
|
|
73
|
+
date?: string | null;
|
|
71
74
|
/** Publisher / source name. Present for `news` and `images` results. */
|
|
72
75
|
source?: string;
|
|
73
76
|
/** Hosting-page domain of the result. Present only for `images` results. */
|
package/dist/types.js
CHANGED