extend-ai 1.1.0 → 1.3.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/BaseClient.js +2 -2
- package/Client.d.ts +70 -8
- package/Client.js +78 -12
- package/api/client/requests/ClassifyRequest.d.ts +16 -1
- package/api/client/requests/EditRequest.d.ts +7 -1
- package/api/client/requests/ExtractRequest.d.ts +20 -1
- package/api/client/requests/ParseRequest.d.ts +2 -1
- package/api/client/requests/SplitRequest.d.ts +16 -1
- package/api/resources/batchProcessorRun/client/Client.d.ts +1 -1
- package/api/resources/batchProcessorRun/client/Client.js +1 -1
- package/api/resources/classifierVersions/client/Client.d.ts +2 -1
- package/api/resources/classifierVersions/client/Client.js +2 -1
- package/api/resources/classifierVersions/client/requests/ClassifierVersionsCreateRequest.d.ts +2 -1
- package/api/resources/classifiers/client/Client.d.ts +19 -2
- package/api/resources/classifiers/client/Client.js +19 -2
- package/api/resources/classifiers/client/requests/ClassifiersCreateRequest.d.ts +16 -1
- package/api/resources/classifiers/client/requests/ClassifiersUpdateRequest.d.ts +3 -1
- package/api/resources/classifyRuns/client/Client.d.ts +4 -1
- package/api/resources/classifyRuns/client/Client.js +4 -1
- package/api/resources/classifyRuns/client/requests/ClassifyRunsCreateRequest.d.ts +4 -1
- package/api/resources/editRuns/client/Client.d.ts +7 -1
- package/api/resources/editRuns/client/Client.js +7 -1
- package/api/resources/editRuns/client/requests/EditRunsCreateRequest.d.ts +7 -1
- package/api/resources/evaluationSetItems/client/Client.d.ts +16 -4
- package/api/resources/evaluationSetItems/client/Client.js +16 -4
- package/api/resources/evaluationSetItems/client/requests/EvaluationSetItemsCreateRequest.d.ts +8 -2
- package/api/resources/evaluationSetItems/client/requests/EvaluationSetItemsUpdateRequest.d.ts +7 -1
- package/api/resources/evaluationSets/client/Client.d.ts +4 -3
- package/api/resources/evaluationSets/client/Client.js +4 -3
- package/api/resources/evaluationSets/client/requests/EvaluationSetsCreateRequest.d.ts +3 -2
- package/api/resources/extractRuns/client/Client.d.ts +4 -1
- package/api/resources/extractRuns/client/Client.js +4 -1
- package/api/resources/extractRuns/client/requests/ExtractRunsCreateRequest.d.ts +4 -1
- package/api/resources/extractorVersions/client/Client.d.ts +2 -1
- package/api/resources/extractorVersions/client/Client.js +2 -1
- package/api/resources/extractorVersions/client/requests/ExtractorVersionsCreateRequest.d.ts +2 -1
- package/api/resources/extractors/client/Client.d.ts +23 -2
- package/api/resources/extractors/client/Client.js +23 -2
- package/api/resources/extractors/client/requests/ExtractorsCreateRequest.d.ts +20 -1
- package/api/resources/extractors/client/requests/ExtractorsUpdateRequest.d.ts +3 -1
- package/api/resources/files/client/Client.d.ts +1 -1
- package/api/resources/files/client/Client.js +1 -1
- package/api/resources/index.d.ts +6 -0
- package/api/resources/index.js +7 -1
- package/api/resources/parseRuns/client/Client.d.ts +2 -1
- package/api/resources/parseRuns/client/Client.js +2 -1
- package/api/resources/parseRuns/client/requests/ParseRunsCreateRequest.d.ts +2 -1
- package/api/resources/processorRun/client/Client.d.ts +3 -3
- package/api/resources/processorRun/client/Client.js +3 -3
- package/api/resources/processorRun/client/requests/ProcessorRunCreateRequest.d.ts +1 -1
- package/api/resources/splitRuns/client/Client.d.ts +4 -1
- package/api/resources/splitRuns/client/Client.js +4 -1
- package/api/resources/splitRuns/client/requests/SplitRunsCreateRequest.d.ts +4 -1
- package/api/resources/splitterVersions/client/Client.d.ts +2 -1
- package/api/resources/splitterVersions/client/Client.js +2 -1
- package/api/resources/splitterVersions/client/requests/SplitterVersionsCreateRequest.d.ts +2 -1
- package/api/resources/splitters/client/Client.d.ts +19 -2
- package/api/resources/splitters/client/Client.js +19 -2
- package/api/resources/splitters/client/requests/SplittersCreateRequest.d.ts +16 -1
- package/api/resources/splitters/client/requests/SplittersUpdateRequest.d.ts +3 -1
- package/api/resources/webhookEndpoints/client/Client.d.ts +133 -0
- package/api/resources/webhookEndpoints/client/Client.js +440 -0
- package/api/resources/webhookEndpoints/client/index.d.ts +1 -0
- package/api/resources/webhookEndpoints/client/index.js +17 -0
- package/api/resources/webhookEndpoints/client/requests/WebhookEndpointsCreateRequest.d.ts +21 -0
- package/api/resources/webhookEndpoints/client/requests/WebhookEndpointsCreateRequest.js +3 -0
- package/api/resources/webhookEndpoints/client/requests/WebhookEndpointsListRequest.d.ts +14 -0
- package/api/resources/webhookEndpoints/client/requests/WebhookEndpointsListRequest.js +3 -0
- package/api/resources/webhookEndpoints/client/requests/WebhookEndpointsUpdateRequest.d.ts +15 -0
- package/api/resources/webhookEndpoints/client/requests/WebhookEndpointsUpdateRequest.js +3 -0
- package/api/resources/webhookEndpoints/client/requests/index.d.ts +3 -0
- package/api/resources/webhookEndpoints/client/requests/index.js +2 -0
- package/api/resources/webhookEndpoints/index.d.ts +2 -0
- package/api/resources/webhookEndpoints/index.js +18 -0
- package/api/resources/webhookEndpoints/types/WebhookEndpointsDeleteResponse.d.ts +4 -0
- package/api/resources/webhookEndpoints/types/WebhookEndpointsDeleteResponse.js +3 -0
- package/api/resources/webhookEndpoints/types/WebhookEndpointsListResponse.d.ts +6 -0
- package/api/resources/webhookEndpoints/types/WebhookEndpointsListResponse.js +3 -0
- package/api/resources/webhookEndpoints/types/index.d.ts +2 -0
- package/api/resources/webhookEndpoints/types/index.js +18 -0
- package/api/resources/webhookSubscriptions/client/Client.d.ts +133 -0
- package/api/resources/webhookSubscriptions/client/Client.js +444 -0
- package/api/resources/webhookSubscriptions/client/index.d.ts +1 -0
- package/api/resources/webhookSubscriptions/client/index.js +17 -0
- package/api/resources/webhookSubscriptions/client/requests/WebhookSubscriptionsCreateRequest.d.ts +19 -0
- package/api/resources/webhookSubscriptions/client/requests/WebhookSubscriptionsCreateRequest.js +3 -0
- package/api/resources/webhookSubscriptions/client/requests/WebhookSubscriptionsListRequest.d.ts +16 -0
- package/api/resources/webhookSubscriptions/client/requests/WebhookSubscriptionsListRequest.js +3 -0
- package/api/resources/webhookSubscriptions/client/requests/WebhookSubscriptionsUpdateRequest.d.ts +11 -0
- package/api/resources/webhookSubscriptions/client/requests/WebhookSubscriptionsUpdateRequest.js +3 -0
- package/api/resources/webhookSubscriptions/client/requests/index.d.ts +3 -0
- package/api/resources/webhookSubscriptions/client/requests/index.js +2 -0
- package/api/resources/webhookSubscriptions/index.d.ts +2 -0
- package/api/resources/webhookSubscriptions/index.js +18 -0
- package/api/resources/webhookSubscriptions/types/WebhookSubscriptionsDeleteResponse.d.ts +4 -0
- package/api/resources/webhookSubscriptions/types/WebhookSubscriptionsDeleteResponse.js +3 -0
- package/api/resources/webhookSubscriptions/types/WebhookSubscriptionsListResponse.d.ts +6 -0
- package/api/resources/webhookSubscriptions/types/WebhookSubscriptionsListResponse.js +3 -0
- package/api/resources/webhookSubscriptions/types/index.d.ts +2 -0
- package/api/resources/webhookSubscriptions/types/index.js +18 -0
- package/api/resources/workflowRuns/client/Client.d.ts +22 -6
- package/api/resources/workflowRuns/client/Client.js +22 -6
- package/api/resources/workflowRuns/client/requests/WorkflowRunsCreateBatchRequest.d.ts +12 -2
- package/api/resources/workflowRuns/client/requests/WorkflowRunsCreateRequest.d.ts +3 -3
- package/api/resources/workflowRuns/client/requests/WorkflowRunsListRequest.d.ts +1 -1
- package/api/resources/workflowRuns/client/requests/WorkflowRunsUpdateRequest.d.ts +7 -1
- package/api/resources/workflowRuns/types/WorkflowRunsCreateRequestFile.d.ts +1 -1
- package/api/types/ExtractAdvancedOptions.d.ts +1 -1
- package/api/types/ExtractAdvancedOptionsReviewAgent.d.ts +1 -1
- package/api/types/ExtractConfigJson.d.ts +1 -1
- package/api/types/ExtractOutputMetadataValue.d.ts +1 -1
- package/api/types/ExtractOverrideConfigJson.d.ts +1 -1
- package/api/types/ExtractRun.d.ts +10 -2
- package/api/types/ExtractorVersion.d.ts +6 -1
- package/api/types/LegacyClassificationAdvancedOptions.d.ts +1 -1
- package/api/types/LegacyClassificationConfig.d.ts +2 -2
- package/api/types/LegacyClassificationConfigBaseProcessor.d.ts +1 -1
- package/api/types/LegacyClassificationConfigBaseProcessor.js +1 -1
- package/api/types/LegacyDocumentProcessorRunCredits.d.ts +2 -2
- package/api/types/LegacyExtractionAdvancedOptions.d.ts +2 -2
- package/api/types/LegacyExtractionAdvancedOptionsReviewAgent.d.ts +1 -1
- package/api/types/LegacyExtractionConfig.d.ts +3 -3
- package/api/types/LegacyExtractionConfigBaseProcessor.d.ts +1 -1
- package/api/types/LegacyExtractionConfigBaseProcessor.js +1 -1
- package/api/types/LegacyJsonOutputMetadataValue.d.ts +1 -1
- package/api/types/LegacySplitterAdvancedOptions.d.ts +1 -1
- package/api/types/LegacySplitterConfig.d.ts +2 -2
- package/api/types/LegacySplitterConfigBaseProcessor.d.ts +1 -1
- package/api/types/LegacySplitterConfigBaseProcessor.js +1 -1
- package/api/types/ParseConfig.d.ts +3 -1
- package/api/types/ParseConfigTarget.d.ts +1 -1
- package/api/types/ParseConfigTarget.js +1 -1
- package/api/types/WebhookAdvancedOptions.d.ts +9 -0
- package/api/types/WebhookAdvancedOptions.js +3 -0
- package/api/types/WebhookEndpoint.d.ts +18 -0
- package/api/types/WebhookEndpoint.js +3 -0
- package/api/types/WebhookEndpointCreate.d.ts +27 -0
- package/api/types/WebhookEndpointCreate.js +3 -0
- package/api/types/WebhookEndpointEventType.d.ts +32 -0
- package/api/types/WebhookEndpointEventType.js +35 -0
- package/api/types/WebhookEndpointStatus.d.ts +6 -0
- package/api/types/WebhookEndpointStatus.js +9 -0
- package/api/types/WebhookPayloadFormat.d.ts +11 -0
- package/api/types/WebhookPayloadFormat.js +14 -0
- package/api/types/WebhookPayloadOptions.d.ts +9 -0
- package/api/types/WebhookPayloadOptions.js +3 -0
- package/api/types/WebhookSubscription.d.ts +15 -0
- package/api/types/WebhookSubscription.js +3 -0
- package/api/types/WebhookSubscriptionEventType.d.ts +23 -0
- package/api/types/WebhookSubscriptionEventType.js +26 -0
- package/api/types/WebhookSubscriptionResourceType.d.ts +8 -0
- package/api/types/WebhookSubscriptionResourceType.js +11 -0
- package/api/types/index.d.ts +10 -0
- package/api/types/index.js +10 -0
- package/package.json +1 -1
- package/reference.md +897 -40
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient";
|
|
3
|
+
import * as core from "../../../../core";
|
|
4
|
+
import * as Extend from "../../../index";
|
|
5
|
+
export declare namespace WebhookSubscriptionsClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class WebhookSubscriptionsClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<WebhookSubscriptionsClient.Options>;
|
|
12
|
+
constructor(options: WebhookSubscriptionsClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* List webhook subscriptions. You can filter by `webhookEndpointId` to see all subscriptions for a given endpoint, or by `resourceId` to see all subscriptions for a given resource.
|
|
15
|
+
*
|
|
16
|
+
* @param {Extend.WebhookSubscriptionsListRequest} request
|
|
17
|
+
* @param {WebhookSubscriptionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
|
+
*
|
|
19
|
+
* @throws {@link Extend.BadRequestError}
|
|
20
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
21
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
22
|
+
* @throws {@link Extend.ForbiddenError}
|
|
23
|
+
* @throws {@link Extend.NotFoundError}
|
|
24
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
25
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
26
|
+
* @throws {@link Extend.InternalServerError}
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* await client.webhookSubscriptions.list({
|
|
30
|
+
* nextPageToken: "xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="
|
|
31
|
+
* })
|
|
32
|
+
*/
|
|
33
|
+
list(request?: Extend.WebhookSubscriptionsListRequest, requestOptions?: WebhookSubscriptionsClient.RequestOptions): core.HttpResponsePromise<Extend.WebhookSubscriptionsListResponse>;
|
|
34
|
+
private __list;
|
|
35
|
+
/**
|
|
36
|
+
* Create a resource-scoped webhook subscription on an existing webhook endpoint.
|
|
37
|
+
*
|
|
38
|
+
* Subscriptions let you receive events for a specific resource (e.g., a single extractor or workflow) rather than all resources of that type. The `enabledEvents` must be valid for the given `resourceType` and the endpoint's `apiVersion`.
|
|
39
|
+
*
|
|
40
|
+
* If a subscription already exists for the same endpoint and resource, it will be updated with the new `enabledEvents` instead of creating a duplicate.
|
|
41
|
+
*
|
|
42
|
+
* @param {Extend.WebhookSubscriptionsCreateRequest} request
|
|
43
|
+
* @param {WebhookSubscriptionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
44
|
+
*
|
|
45
|
+
* @throws {@link Extend.BadRequestError}
|
|
46
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
47
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
48
|
+
* @throws {@link Extend.ForbiddenError}
|
|
49
|
+
* @throws {@link Extend.NotFoundError}
|
|
50
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
51
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
52
|
+
* @throws {@link Extend.InternalServerError}
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* await client.webhookSubscriptions.create({
|
|
56
|
+
* webhookEndpointId: "wh_Xj8mK2pL9nR4vT7qY5wZ",
|
|
57
|
+
* resourceType: "extractor",
|
|
58
|
+
* resourceId: "ex_Xj8mK2pL9nR4vT7qY5wZ",
|
|
59
|
+
* enabledEvents: ["extract_run.processed", "extract_run.failed"]
|
|
60
|
+
* })
|
|
61
|
+
*/
|
|
62
|
+
create(request: Extend.WebhookSubscriptionsCreateRequest, requestOptions?: WebhookSubscriptionsClient.RequestOptions): core.HttpResponsePromise<Extend.WebhookSubscription>;
|
|
63
|
+
private __create;
|
|
64
|
+
/**
|
|
65
|
+
* Retrieve a webhook subscription by ID.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} id - The ID of the webhook subscription.
|
|
68
|
+
*
|
|
69
|
+
* Example: `"whes_Xj8mK2pL9nR4vT7qY5wZ"`
|
|
70
|
+
* @param {WebhookSubscriptionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
71
|
+
*
|
|
72
|
+
* @throws {@link Extend.BadRequestError}
|
|
73
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
74
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
75
|
+
* @throws {@link Extend.ForbiddenError}
|
|
76
|
+
* @throws {@link Extend.NotFoundError}
|
|
77
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
78
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
79
|
+
* @throws {@link Extend.InternalServerError}
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* await client.webhookSubscriptions.retrieve("webhook_subscription_id_here")
|
|
83
|
+
*/
|
|
84
|
+
retrieve(id: string, requestOptions?: WebhookSubscriptionsClient.RequestOptions): core.HttpResponsePromise<Extend.WebhookSubscription>;
|
|
85
|
+
private __retrieve;
|
|
86
|
+
/**
|
|
87
|
+
* Update the enabled events on a webhook subscription.
|
|
88
|
+
*
|
|
89
|
+
* @param {string} id - The ID of the webhook subscription to update.
|
|
90
|
+
*
|
|
91
|
+
* Example: `"whes_Xj8mK2pL9nR4vT7qY5wZ"`
|
|
92
|
+
* @param {Extend.WebhookSubscriptionsUpdateRequest} request
|
|
93
|
+
* @param {WebhookSubscriptionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
94
|
+
*
|
|
95
|
+
* @throws {@link Extend.BadRequestError}
|
|
96
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
97
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
98
|
+
* @throws {@link Extend.ForbiddenError}
|
|
99
|
+
* @throws {@link Extend.NotFoundError}
|
|
100
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
101
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
102
|
+
* @throws {@link Extend.InternalServerError}
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* await client.webhookSubscriptions.update("webhook_subscription_id_here", {
|
|
106
|
+
* enabledEvents: ["extract_run.processed"]
|
|
107
|
+
* })
|
|
108
|
+
*/
|
|
109
|
+
update(id: string, request: Extend.WebhookSubscriptionsUpdateRequest, requestOptions?: WebhookSubscriptionsClient.RequestOptions): core.HttpResponsePromise<Extend.WebhookSubscription>;
|
|
110
|
+
private __update;
|
|
111
|
+
/**
|
|
112
|
+
* Delete a webhook subscription. This operation is permanent and cannot be undone.
|
|
113
|
+
*
|
|
114
|
+
* @param {string} id - The ID of the webhook subscription to delete.
|
|
115
|
+
*
|
|
116
|
+
* Example: `"whes_Xj8mK2pL9nR4vT7qY5wZ"`
|
|
117
|
+
* @param {WebhookSubscriptionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
118
|
+
*
|
|
119
|
+
* @throws {@link Extend.BadRequestError}
|
|
120
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
121
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
122
|
+
* @throws {@link Extend.ForbiddenError}
|
|
123
|
+
* @throws {@link Extend.NotFoundError}
|
|
124
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
125
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
126
|
+
* @throws {@link Extend.InternalServerError}
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* await client.webhookSubscriptions.delete("webhook_subscription_id_here")
|
|
130
|
+
*/
|
|
131
|
+
delete(id: string, requestOptions?: WebhookSubscriptionsClient.RequestOptions): core.HttpResponsePromise<Extend.WebhookSubscriptionsDeleteResponse>;
|
|
132
|
+
private __delete;
|
|
133
|
+
}
|
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.WebhookSubscriptionsClient = void 0;
|
|
47
|
+
const BaseClient_1 = require("../../../../BaseClient");
|
|
48
|
+
const core = __importStar(require("../../../../core"));
|
|
49
|
+
const headers_1 = require("../../../../core/headers");
|
|
50
|
+
const environments = __importStar(require("../../../../environments"));
|
|
51
|
+
const handleNonStatusCodeError_1 = require("../../../../errors/handleNonStatusCodeError");
|
|
52
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
53
|
+
const Extend = __importStar(require("../../../index"));
|
|
54
|
+
class WebhookSubscriptionsClient {
|
|
55
|
+
constructor(options) {
|
|
56
|
+
this._options = (0, BaseClient_1.normalizeClientOptionsWithAuth)(options);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* List webhook subscriptions. You can filter by `webhookEndpointId` to see all subscriptions for a given endpoint, or by `resourceId` to see all subscriptions for a given resource.
|
|
60
|
+
*
|
|
61
|
+
* @param {Extend.WebhookSubscriptionsListRequest} request
|
|
62
|
+
* @param {WebhookSubscriptionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
63
|
+
*
|
|
64
|
+
* @throws {@link Extend.BadRequestError}
|
|
65
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
66
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
67
|
+
* @throws {@link Extend.ForbiddenError}
|
|
68
|
+
* @throws {@link Extend.NotFoundError}
|
|
69
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
70
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
71
|
+
* @throws {@link Extend.InternalServerError}
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* await client.webhookSubscriptions.list({
|
|
75
|
+
* nextPageToken: "xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="
|
|
76
|
+
* })
|
|
77
|
+
*/
|
|
78
|
+
list(request = {}, requestOptions) {
|
|
79
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
80
|
+
}
|
|
81
|
+
__list() {
|
|
82
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
83
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
84
|
+
const { webhookEndpointId, resourceId, sortDir, nextPageToken, maxPageSize } = request;
|
|
85
|
+
const _queryParams = {
|
|
86
|
+
webhookEndpointId,
|
|
87
|
+
resourceId,
|
|
88
|
+
sortDir: sortDir != null ? sortDir : undefined,
|
|
89
|
+
nextPageToken,
|
|
90
|
+
maxPageSize,
|
|
91
|
+
};
|
|
92
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
93
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
94
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
95
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ExtendEnvironment.Production, "webhook_subscriptions"),
|
|
96
|
+
method: "GET",
|
|
97
|
+
headers: _headers,
|
|
98
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
99
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 300) * 1000,
|
|
100
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
101
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
102
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
103
|
+
logging: this._options.logging,
|
|
104
|
+
});
|
|
105
|
+
if (_response.ok) {
|
|
106
|
+
return {
|
|
107
|
+
data: _response.body,
|
|
108
|
+
rawResponse: _response.rawResponse,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (_response.error.reason === "status-code") {
|
|
112
|
+
switch (_response.error.statusCode) {
|
|
113
|
+
case 400:
|
|
114
|
+
throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
|
|
115
|
+
case 401:
|
|
116
|
+
throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
117
|
+
case 402:
|
|
118
|
+
throw new Extend.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
119
|
+
case 403:
|
|
120
|
+
throw new Extend.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
121
|
+
case 404:
|
|
122
|
+
throw new Extend.NotFoundError(_response.error.body, _response.rawResponse);
|
|
123
|
+
case 422:
|
|
124
|
+
throw new Extend.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
125
|
+
case 429:
|
|
126
|
+
throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
127
|
+
case 500:
|
|
128
|
+
throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
|
|
129
|
+
default:
|
|
130
|
+
throw new errors.ExtendError({
|
|
131
|
+
statusCode: _response.error.statusCode,
|
|
132
|
+
body: _response.error.body,
|
|
133
|
+
rawResponse: _response.rawResponse,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/webhook_subscriptions");
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Create a resource-scoped webhook subscription on an existing webhook endpoint.
|
|
142
|
+
*
|
|
143
|
+
* Subscriptions let you receive events for a specific resource (e.g., a single extractor or workflow) rather than all resources of that type. The `enabledEvents` must be valid for the given `resourceType` and the endpoint's `apiVersion`.
|
|
144
|
+
*
|
|
145
|
+
* If a subscription already exists for the same endpoint and resource, it will be updated with the new `enabledEvents` instead of creating a duplicate.
|
|
146
|
+
*
|
|
147
|
+
* @param {Extend.WebhookSubscriptionsCreateRequest} request
|
|
148
|
+
* @param {WebhookSubscriptionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
149
|
+
*
|
|
150
|
+
* @throws {@link Extend.BadRequestError}
|
|
151
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
152
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
153
|
+
* @throws {@link Extend.ForbiddenError}
|
|
154
|
+
* @throws {@link Extend.NotFoundError}
|
|
155
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
156
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
157
|
+
* @throws {@link Extend.InternalServerError}
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* await client.webhookSubscriptions.create({
|
|
161
|
+
* webhookEndpointId: "wh_Xj8mK2pL9nR4vT7qY5wZ",
|
|
162
|
+
* resourceType: "extractor",
|
|
163
|
+
* resourceId: "ex_Xj8mK2pL9nR4vT7qY5wZ",
|
|
164
|
+
* enabledEvents: ["extract_run.processed", "extract_run.failed"]
|
|
165
|
+
* })
|
|
166
|
+
*/
|
|
167
|
+
create(request, requestOptions) {
|
|
168
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
169
|
+
}
|
|
170
|
+
__create(request, requestOptions) {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
172
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
173
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
174
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
175
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
176
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ExtendEnvironment.Production, "webhook_subscriptions"),
|
|
177
|
+
method: "POST",
|
|
178
|
+
headers: _headers,
|
|
179
|
+
contentType: "application/json",
|
|
180
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
181
|
+
requestType: "json",
|
|
182
|
+
body: request,
|
|
183
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 300) * 1000,
|
|
184
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
185
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
186
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
187
|
+
logging: this._options.logging,
|
|
188
|
+
});
|
|
189
|
+
if (_response.ok) {
|
|
190
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
191
|
+
}
|
|
192
|
+
if (_response.error.reason === "status-code") {
|
|
193
|
+
switch (_response.error.statusCode) {
|
|
194
|
+
case 400:
|
|
195
|
+
throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
|
|
196
|
+
case 401:
|
|
197
|
+
throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
198
|
+
case 402:
|
|
199
|
+
throw new Extend.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
200
|
+
case 403:
|
|
201
|
+
throw new Extend.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
202
|
+
case 404:
|
|
203
|
+
throw new Extend.NotFoundError(_response.error.body, _response.rawResponse);
|
|
204
|
+
case 422:
|
|
205
|
+
throw new Extend.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
206
|
+
case 429:
|
|
207
|
+
throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
208
|
+
case 500:
|
|
209
|
+
throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
|
|
210
|
+
default:
|
|
211
|
+
throw new errors.ExtendError({
|
|
212
|
+
statusCode: _response.error.statusCode,
|
|
213
|
+
body: _response.error.body,
|
|
214
|
+
rawResponse: _response.rawResponse,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/webhook_subscriptions");
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Retrieve a webhook subscription by ID.
|
|
223
|
+
*
|
|
224
|
+
* @param {string} id - The ID of the webhook subscription.
|
|
225
|
+
*
|
|
226
|
+
* Example: `"whes_Xj8mK2pL9nR4vT7qY5wZ"`
|
|
227
|
+
* @param {WebhookSubscriptionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
228
|
+
*
|
|
229
|
+
* @throws {@link Extend.BadRequestError}
|
|
230
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
231
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
232
|
+
* @throws {@link Extend.ForbiddenError}
|
|
233
|
+
* @throws {@link Extend.NotFoundError}
|
|
234
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
235
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
236
|
+
* @throws {@link Extend.InternalServerError}
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* await client.webhookSubscriptions.retrieve("webhook_subscription_id_here")
|
|
240
|
+
*/
|
|
241
|
+
retrieve(id, requestOptions) {
|
|
242
|
+
return core.HttpResponsePromise.fromPromise(this.__retrieve(id, requestOptions));
|
|
243
|
+
}
|
|
244
|
+
__retrieve(id, requestOptions) {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
247
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
248
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
249
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
250
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ExtendEnvironment.Production, `webhook_subscriptions/${core.url.encodePathParam(id)}`),
|
|
251
|
+
method: "GET",
|
|
252
|
+
headers: _headers,
|
|
253
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
254
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 300) * 1000,
|
|
255
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
256
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
257
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
258
|
+
logging: this._options.logging,
|
|
259
|
+
});
|
|
260
|
+
if (_response.ok) {
|
|
261
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
262
|
+
}
|
|
263
|
+
if (_response.error.reason === "status-code") {
|
|
264
|
+
switch (_response.error.statusCode) {
|
|
265
|
+
case 400:
|
|
266
|
+
throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
|
|
267
|
+
case 401:
|
|
268
|
+
throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
269
|
+
case 402:
|
|
270
|
+
throw new Extend.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
271
|
+
case 403:
|
|
272
|
+
throw new Extend.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
273
|
+
case 404:
|
|
274
|
+
throw new Extend.NotFoundError(_response.error.body, _response.rawResponse);
|
|
275
|
+
case 422:
|
|
276
|
+
throw new Extend.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
277
|
+
case 429:
|
|
278
|
+
throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
279
|
+
case 500:
|
|
280
|
+
throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
|
|
281
|
+
default:
|
|
282
|
+
throw new errors.ExtendError({
|
|
283
|
+
statusCode: _response.error.statusCode,
|
|
284
|
+
body: _response.error.body,
|
|
285
|
+
rawResponse: _response.rawResponse,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/webhook_subscriptions/{id}");
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Update the enabled events on a webhook subscription.
|
|
294
|
+
*
|
|
295
|
+
* @param {string} id - The ID of the webhook subscription to update.
|
|
296
|
+
*
|
|
297
|
+
* Example: `"whes_Xj8mK2pL9nR4vT7qY5wZ"`
|
|
298
|
+
* @param {Extend.WebhookSubscriptionsUpdateRequest} request
|
|
299
|
+
* @param {WebhookSubscriptionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
300
|
+
*
|
|
301
|
+
* @throws {@link Extend.BadRequestError}
|
|
302
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
303
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
304
|
+
* @throws {@link Extend.ForbiddenError}
|
|
305
|
+
* @throws {@link Extend.NotFoundError}
|
|
306
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
307
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
308
|
+
* @throws {@link Extend.InternalServerError}
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* await client.webhookSubscriptions.update("webhook_subscription_id_here", {
|
|
312
|
+
* enabledEvents: ["extract_run.processed"]
|
|
313
|
+
* })
|
|
314
|
+
*/
|
|
315
|
+
update(id, request, requestOptions) {
|
|
316
|
+
return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions));
|
|
317
|
+
}
|
|
318
|
+
__update(id, request, requestOptions) {
|
|
319
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
320
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
321
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
322
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
323
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
324
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ExtendEnvironment.Production, `webhook_subscriptions/${core.url.encodePathParam(id)}`),
|
|
325
|
+
method: "POST",
|
|
326
|
+
headers: _headers,
|
|
327
|
+
contentType: "application/json",
|
|
328
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
329
|
+
requestType: "json",
|
|
330
|
+
body: request,
|
|
331
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 300) * 1000,
|
|
332
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
333
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
334
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
335
|
+
logging: this._options.logging,
|
|
336
|
+
});
|
|
337
|
+
if (_response.ok) {
|
|
338
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
339
|
+
}
|
|
340
|
+
if (_response.error.reason === "status-code") {
|
|
341
|
+
switch (_response.error.statusCode) {
|
|
342
|
+
case 400:
|
|
343
|
+
throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
|
|
344
|
+
case 401:
|
|
345
|
+
throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
346
|
+
case 402:
|
|
347
|
+
throw new Extend.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
348
|
+
case 403:
|
|
349
|
+
throw new Extend.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
350
|
+
case 404:
|
|
351
|
+
throw new Extend.NotFoundError(_response.error.body, _response.rawResponse);
|
|
352
|
+
case 422:
|
|
353
|
+
throw new Extend.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
354
|
+
case 429:
|
|
355
|
+
throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
356
|
+
case 500:
|
|
357
|
+
throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
|
|
358
|
+
default:
|
|
359
|
+
throw new errors.ExtendError({
|
|
360
|
+
statusCode: _response.error.statusCode,
|
|
361
|
+
body: _response.error.body,
|
|
362
|
+
rawResponse: _response.rawResponse,
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/webhook_subscriptions/{id}");
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Delete a webhook subscription. This operation is permanent and cannot be undone.
|
|
371
|
+
*
|
|
372
|
+
* @param {string} id - The ID of the webhook subscription to delete.
|
|
373
|
+
*
|
|
374
|
+
* Example: `"whes_Xj8mK2pL9nR4vT7qY5wZ"`
|
|
375
|
+
* @param {WebhookSubscriptionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
376
|
+
*
|
|
377
|
+
* @throws {@link Extend.BadRequestError}
|
|
378
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
379
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
380
|
+
* @throws {@link Extend.ForbiddenError}
|
|
381
|
+
* @throws {@link Extend.NotFoundError}
|
|
382
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
383
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
384
|
+
* @throws {@link Extend.InternalServerError}
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* await client.webhookSubscriptions.delete("webhook_subscription_id_here")
|
|
388
|
+
*/
|
|
389
|
+
delete(id, requestOptions) {
|
|
390
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(id, requestOptions));
|
|
391
|
+
}
|
|
392
|
+
__delete(id, requestOptions) {
|
|
393
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
394
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
395
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
396
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
397
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
398
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ExtendEnvironment.Production, `webhook_subscriptions/${core.url.encodePathParam(id)}`),
|
|
399
|
+
method: "DELETE",
|
|
400
|
+
headers: _headers,
|
|
401
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
402
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 300) * 1000,
|
|
403
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
404
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
405
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
406
|
+
logging: this._options.logging,
|
|
407
|
+
});
|
|
408
|
+
if (_response.ok) {
|
|
409
|
+
return {
|
|
410
|
+
data: _response.body,
|
|
411
|
+
rawResponse: _response.rawResponse,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
if (_response.error.reason === "status-code") {
|
|
415
|
+
switch (_response.error.statusCode) {
|
|
416
|
+
case 400:
|
|
417
|
+
throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
|
|
418
|
+
case 401:
|
|
419
|
+
throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
420
|
+
case 402:
|
|
421
|
+
throw new Extend.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
422
|
+
case 403:
|
|
423
|
+
throw new Extend.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
424
|
+
case 404:
|
|
425
|
+
throw new Extend.NotFoundError(_response.error.body, _response.rawResponse);
|
|
426
|
+
case 422:
|
|
427
|
+
throw new Extend.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
428
|
+
case 429:
|
|
429
|
+
throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
430
|
+
case 500:
|
|
431
|
+
throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
|
|
432
|
+
default:
|
|
433
|
+
throw new errors.ExtendError({
|
|
434
|
+
statusCode: _response.error.statusCode,
|
|
435
|
+
body: _response.error.body,
|
|
436
|
+
rawResponse: _response.rawResponse,
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/webhook_subscriptions/{id}");
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
exports.WebhookSubscriptionsClient = WebhookSubscriptionsClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests"), exports);
|
package/api/resources/webhookSubscriptions/client/requests/WebhookSubscriptionsCreateRequest.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type * as Extend from "../../../../index";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* webhookEndpointId: "wh_Xj8mK2pL9nR4vT7qY5wZ",
|
|
6
|
+
* resourceType: "extractor",
|
|
7
|
+
* resourceId: "ex_Xj8mK2pL9nR4vT7qY5wZ",
|
|
8
|
+
* enabledEvents: ["extract_run.processed", "extract_run.failed"]
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface WebhookSubscriptionsCreateRequest {
|
|
12
|
+
/** The ID of the webhook endpoint to attach this subscription to. */
|
|
13
|
+
webhookEndpointId: string;
|
|
14
|
+
resourceType: Extend.WebhookSubscriptionResourceType;
|
|
15
|
+
/** The ID of the resource to scope this subscription to. */
|
|
16
|
+
resourceId: string;
|
|
17
|
+
/** The event types to subscribe to. Must be valid for the given `resourceType`. */
|
|
18
|
+
enabledEvents: Extend.WebhookSubscriptionEventType[];
|
|
19
|
+
}
|
package/api/resources/webhookSubscriptions/client/requests/WebhookSubscriptionsListRequest.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type * as Extend from "../../../../index";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* nextPageToken: "xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface WebhookSubscriptionsListRequest {
|
|
9
|
+
/** Filter subscriptions by the webhook endpoint they belong to. */
|
|
10
|
+
webhookEndpointId?: string;
|
|
11
|
+
/** Filter subscriptions by the resource they are scoped to. */
|
|
12
|
+
resourceId?: string;
|
|
13
|
+
sortDir?: Extend.SortDir;
|
|
14
|
+
nextPageToken?: Extend.NextPageToken;
|
|
15
|
+
maxPageSize?: Extend.MaxPageSize;
|
|
16
|
+
}
|