@algolia/ingestion 1.2.4 → 5.2.4-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +2368 -0
- package/dist/builds/browser.js +2044 -0
- package/dist/builds/browser.js.map +1 -0
- package/dist/builds/browser.min.js +2 -0
- package/dist/builds/browser.min.js.map +1 -0
- package/dist/builds/browser.umd.js +15 -0
- package/dist/builds/node.cjs +2065 -0
- package/dist/builds/node.cjs.map +1 -0
- package/dist/builds/node.js +2042 -0
- package/dist/builds/node.js.map +1 -0
- package/dist/node.d.cts +2368 -0
- package/dist/node.d.ts +2368 -0
- package/dist/src/ingestionClient.cjs +2032 -0
- package/dist/src/ingestionClient.cjs.map +1 -0
- package/dist/src/ingestionClient.js +2002 -0
- package/dist/src/ingestionClient.js.map +1 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +22 -22
- package/dist/builds/browser.d.ts +0 -75
- package/dist/builds/browser.d.ts.map +0 -1
- package/dist/builds/node.d.ts +0 -75
- package/dist/builds/node.d.ts.map +0 -1
- package/dist/ingestion.cjs +0 -2007
- package/dist/ingestion.esm.browser.js +0 -2678
- package/dist/ingestion.esm.node.js +0 -2001
- package/dist/ingestion.umd.js +0 -2
- package/dist/model/action.d.ts +0 -5
- package/dist/model/action.d.ts.map +0 -1
- package/dist/model/actionType.d.ts +0 -5
- package/dist/model/actionType.d.ts.map +0 -1
- package/dist/model/authAPIKey.d.ts +0 -10
- package/dist/model/authAPIKey.d.ts.map +0 -1
- package/dist/model/authAPIKeyPartial.d.ts +0 -10
- package/dist/model/authAPIKeyPartial.d.ts.map +0 -1
- package/dist/model/authAlgolia.d.ts +0 -14
- package/dist/model/authAlgolia.d.ts.map +0 -1
- package/dist/model/authAlgoliaInsights.d.ts +0 -14
- package/dist/model/authAlgoliaInsights.d.ts.map +0 -1
- package/dist/model/authAlgoliaInsightsPartial.d.ts +0 -14
- package/dist/model/authAlgoliaInsightsPartial.d.ts.map +0 -1
- package/dist/model/authAlgoliaPartial.d.ts +0 -14
- package/dist/model/authAlgoliaPartial.d.ts.map +0 -1
- package/dist/model/authBasic.d.ts +0 -14
- package/dist/model/authBasic.d.ts.map +0 -1
- package/dist/model/authBasicPartial.d.ts +0 -14
- package/dist/model/authBasicPartial.d.ts.map +0 -1
- package/dist/model/authGoogleServiceAccount.d.ts +0 -14
- package/dist/model/authGoogleServiceAccount.d.ts.map +0 -1
- package/dist/model/authGoogleServiceAccountPartial.d.ts +0 -14
- package/dist/model/authGoogleServiceAccountPartial.d.ts.map +0 -1
- package/dist/model/authInput.d.ts +0 -8
- package/dist/model/authInput.d.ts.map +0 -1
- package/dist/model/authInputPartial.d.ts +0 -8
- package/dist/model/authInputPartial.d.ts.map +0 -1
- package/dist/model/authOAuth.d.ts +0 -22
- package/dist/model/authOAuth.d.ts.map +0 -1
- package/dist/model/authOAuthPartial.d.ts +0 -22
- package/dist/model/authOAuthPartial.d.ts.map +0 -1
- package/dist/model/authentication.d.ts +0 -28
- package/dist/model/authentication.d.ts.map +0 -1
- package/dist/model/authenticationCreate.d.ts +0 -16
- package/dist/model/authenticationCreate.d.ts.map +0 -1
- package/dist/model/authenticationCreateResponse.d.ts +0 -18
- package/dist/model/authenticationCreateResponse.d.ts.map +0 -1
- package/dist/model/authenticationSearch.d.ts +0 -7
- package/dist/model/authenticationSearch.d.ts.map +0 -1
- package/dist/model/authenticationSortKeys.d.ts +0 -5
- package/dist/model/authenticationSortKeys.d.ts.map +0 -1
- package/dist/model/authenticationType.d.ts +0 -5
- package/dist/model/authenticationType.d.ts.map +0 -1
- package/dist/model/authenticationUpdate.d.ts +0 -16
- package/dist/model/authenticationUpdate.d.ts.map +0 -1
- package/dist/model/authenticationUpdateResponse.d.ts +0 -18
- package/dist/model/authenticationUpdateResponse.d.ts.map +0 -1
- package/dist/model/bigCommerceChannel.d.ts +0 -11
- package/dist/model/bigCommerceChannel.d.ts.map +0 -1
- package/dist/model/bigCommerceMetafield.d.ts +0 -11
- package/dist/model/bigCommerceMetafield.d.ts.map +0 -1
- package/dist/model/bigQueryDataType.d.ts +0 -2
- package/dist/model/bigQueryDataType.d.ts.map +0 -1
- package/dist/model/clientMethodProps.d.ts +0 -659
- package/dist/model/clientMethodProps.d.ts.map +0 -1
- package/dist/model/commercetoolsCustomFields.d.ts +0 -18
- package/dist/model/commercetoolsCustomFields.d.ts.map +0 -1
- package/dist/model/deleteResponse.d.ts +0 -7
- package/dist/model/deleteResponse.d.ts.map +0 -1
- package/dist/model/destination.d.ts +0 -31
- package/dist/model/destination.d.ts.map +0 -1
- package/dist/model/destinationCreate.d.ts +0 -19
- package/dist/model/destinationCreate.d.ts.map +0 -1
- package/dist/model/destinationCreateResponse.d.ts +0 -18
- package/dist/model/destinationCreateResponse.d.ts.map +0 -1
- package/dist/model/destinationIndexName.d.ts +0 -13
- package/dist/model/destinationIndexName.d.ts.map +0 -1
- package/dist/model/destinationInput.d.ts +0 -3
- package/dist/model/destinationInput.d.ts.map +0 -1
- package/dist/model/destinationSearch.d.ts +0 -7
- package/dist/model/destinationSearch.d.ts.map +0 -1
- package/dist/model/destinationSortKeys.d.ts +0 -5
- package/dist/model/destinationSortKeys.d.ts.map +0 -1
- package/dist/model/destinationType.d.ts +0 -5
- package/dist/model/destinationType.d.ts.map +0 -1
- package/dist/model/destinationUpdate.d.ts +0 -19
- package/dist/model/destinationUpdate.d.ts.map +0 -1
- package/dist/model/destinationUpdateResponse.d.ts +0 -18
- package/dist/model/destinationUpdateResponse.d.ts.map +0 -1
- package/dist/model/dockerImageType.d.ts +0 -5
- package/dist/model/dockerImageType.d.ts.map +0 -1
- package/dist/model/dockerRegistry.d.ts +0 -5
- package/dist/model/dockerRegistry.d.ts.map +0 -1
- package/dist/model/dockerStreams.d.ts +0 -13
- package/dist/model/dockerStreams.d.ts.map +0 -1
- package/dist/model/dockerStreamsInput.d.ts +0 -8
- package/dist/model/dockerStreamsInput.d.ts.map +0 -1
- package/dist/model/dockerStreamsSyncMode.d.ts +0 -5
- package/dist/model/dockerStreamsSyncMode.d.ts.map +0 -1
- package/dist/model/entityType.d.ts +0 -5
- package/dist/model/entityType.d.ts.map +0 -1
- package/dist/model/errorBase.d.ts +0 -7
- package/dist/model/errorBase.d.ts.map +0 -1
- package/dist/model/event.d.ts +0 -31
- package/dist/model/event.d.ts.map +0 -1
- package/dist/model/eventSortKeys.d.ts +0 -5
- package/dist/model/eventSortKeys.d.ts.map +0 -1
- package/dist/model/eventStatus.d.ts +0 -2
- package/dist/model/eventStatus.d.ts.map +0 -1
- package/dist/model/eventType.d.ts +0 -2
- package/dist/model/eventType.d.ts.map +0 -1
- package/dist/model/generateTransformationCodePayload.d.ts +0 -6
- package/dist/model/generateTransformationCodePayload.d.ts.map +0 -1
- package/dist/model/generateTransformationCodeResponse.d.ts +0 -4
- package/dist/model/generateTransformationCodeResponse.d.ts.map +0 -1
- package/dist/model/index.d.ts +0 -150
- package/dist/model/index.d.ts.map +0 -1
- package/dist/model/listAuthenticationsResponse.d.ts +0 -7
- package/dist/model/listAuthenticationsResponse.d.ts.map +0 -1
- package/dist/model/listDestinationsResponse.d.ts +0 -7
- package/dist/model/listDestinationsResponse.d.ts.map +0 -1
- package/dist/model/listEventsResponse.d.ts +0 -9
- package/dist/model/listEventsResponse.d.ts.map +0 -1
- package/dist/model/listSourcesResponse.d.ts +0 -7
- package/dist/model/listSourcesResponse.d.ts.map +0 -1
- package/dist/model/listTasksResponse.d.ts +0 -10
- package/dist/model/listTasksResponse.d.ts.map +0 -1
- package/dist/model/listTasksResponseV1.d.ts +0 -10
- package/dist/model/listTasksResponseV1.d.ts.map +0 -1
- package/dist/model/listTransformationsResponse.d.ts +0 -10
- package/dist/model/listTransformationsResponse.d.ts.map +0 -1
- package/dist/model/mappingFieldDirective.d.ts +0 -14
- package/dist/model/mappingFieldDirective.d.ts.map +0 -1
- package/dist/model/mappingFormatSchema.d.ts +0 -5
- package/dist/model/mappingFormatSchema.d.ts.map +0 -1
- package/dist/model/mappingInput.d.ts +0 -10
- package/dist/model/mappingInput.d.ts.map +0 -1
- package/dist/model/mappingKitAction.d.ts +0 -20
- package/dist/model/mappingKitAction.d.ts.map +0 -1
- package/dist/model/mappingTypeCSV.d.ts +0 -2
- package/dist/model/mappingTypeCSV.d.ts.map +0 -1
- package/dist/model/methodType.d.ts +0 -5
- package/dist/model/methodType.d.ts.map +0 -1
- package/dist/model/model.d.ts +0 -8
- package/dist/model/model.d.ts.map +0 -1
- package/dist/model/onDemandTrigger.d.ts +0 -12
- package/dist/model/onDemandTrigger.d.ts.map +0 -1
- package/dist/model/onDemandTriggerInput.d.ts +0 -8
- package/dist/model/onDemandTriggerInput.d.ts.map +0 -1
- package/dist/model/onDemandTriggerType.d.ts +0 -5
- package/dist/model/onDemandTriggerType.d.ts.map +0 -1
- package/dist/model/orderKeys.d.ts +0 -5
- package/dist/model/orderKeys.d.ts.map +0 -1
- package/dist/model/pagination.d.ts +0 -22
- package/dist/model/pagination.d.ts.map +0 -1
- package/dist/model/platform.d.ts +0 -5
- package/dist/model/platform.d.ts.map +0 -1
- package/dist/model/platformNone.d.ts +0 -5
- package/dist/model/platformNone.d.ts.map +0 -1
- package/dist/model/platformWithNone.d.ts +0 -4
- package/dist/model/platformWithNone.d.ts.map +0 -1
- package/dist/model/pushTaskPayload.d.ts +0 -7
- package/dist/model/pushTaskPayload.d.ts.map +0 -1
- package/dist/model/pushTaskRecords.d.ts +0 -7
- package/dist/model/pushTaskRecords.d.ts.map +0 -1
- package/dist/model/recordType.d.ts +0 -5
- package/dist/model/recordType.d.ts.map +0 -1
- package/dist/model/run.d.ts +0 -42
- package/dist/model/run.d.ts.map +0 -1
- package/dist/model/runListResponse.d.ts +0 -9
- package/dist/model/runListResponse.d.ts.map +0 -1
- package/dist/model/runOutcome.d.ts +0 -5
- package/dist/model/runOutcome.d.ts.map +0 -1
- package/dist/model/runProgress.d.ts +0 -5
- package/dist/model/runProgress.d.ts.map +0 -1
- package/dist/model/runReasonCode.d.ts +0 -5
- package/dist/model/runReasonCode.d.ts.map +0 -1
- package/dist/model/runResponse.d.ts +0 -14
- package/dist/model/runResponse.d.ts.map +0 -1
- package/dist/model/runSortKeys.d.ts +0 -5
- package/dist/model/runSortKeys.d.ts.map +0 -1
- package/dist/model/runSourcePayload.d.ts +0 -17
- package/dist/model/runSourcePayload.d.ts.map +0 -1
- package/dist/model/runSourceResponse.d.ts +0 -11
- package/dist/model/runSourceResponse.d.ts.map +0 -1
- package/dist/model/runStatus.d.ts +0 -5
- package/dist/model/runStatus.d.ts.map +0 -1
- package/dist/model/runType.d.ts +0 -5
- package/dist/model/runType.d.ts.map +0 -1
- package/dist/model/scheduleTrigger.d.ts +0 -20
- package/dist/model/scheduleTrigger.d.ts.map +0 -1
- package/dist/model/scheduleTriggerInput.d.ts +0 -12
- package/dist/model/scheduleTriggerInput.d.ts.map +0 -1
- package/dist/model/scheduleTriggerType.d.ts +0 -5
- package/dist/model/scheduleTriggerType.d.ts.map +0 -1
- package/dist/model/shopifyInput.d.ts +0 -10
- package/dist/model/shopifyInput.d.ts.map +0 -1
- package/dist/model/shopifyMarket.d.ts +0 -9
- package/dist/model/shopifyMarket.d.ts.map +0 -1
- package/dist/model/shopifyMetafield.d.ts +0 -9
- package/dist/model/shopifyMetafield.d.ts.map +0 -1
- package/dist/model/sortKeys.d.ts +0 -5
- package/dist/model/sortKeys.d.ts.map +0 -1
- package/dist/model/source.d.ts +0 -24
- package/dist/model/source.d.ts.map +0 -1
- package/dist/model/sourceBigCommerce.d.ts +0 -13
- package/dist/model/sourceBigCommerce.d.ts.map +0 -1
- package/dist/model/sourceBigQuery.d.ts +0 -29
- package/dist/model/sourceBigQuery.d.ts.map +0 -1
- package/dist/model/sourceCSV.d.ts +0 -22
- package/dist/model/sourceCSV.d.ts.map +0 -1
- package/dist/model/sourceCommercetools.d.ts +0 -16
- package/dist/model/sourceCommercetools.d.ts.map +0 -1
- package/dist/model/sourceCreate.d.ts +0 -15
- package/dist/model/sourceCreate.d.ts.map +0 -1
- package/dist/model/sourceCreateResponse.d.ts +0 -15
- package/dist/model/sourceCreateResponse.d.ts.map +0 -1
- package/dist/model/sourceDocker.d.ts +0 -19
- package/dist/model/sourceDocker.d.ts.map +0 -1
- package/dist/model/sourceGA4BigQueryExport.d.ts +0 -15
- package/dist/model/sourceGA4BigQueryExport.d.ts.map +0 -1
- package/dist/model/sourceInput.d.ts +0 -10
- package/dist/model/sourceInput.d.ts.map +0 -1
- package/dist/model/sourceJSON.d.ts +0 -13
- package/dist/model/sourceJSON.d.ts.map +0 -1
- package/dist/model/sourceSearch.d.ts +0 -4
- package/dist/model/sourceSearch.d.ts.map +0 -1
- package/dist/model/sourceShopify.d.ts +0 -4
- package/dist/model/sourceShopify.d.ts.map +0 -1
- package/dist/model/sourceShopifyBase.d.ts +0 -7
- package/dist/model/sourceShopifyBase.d.ts.map +0 -1
- package/dist/model/sourceSortKeys.d.ts +0 -5
- package/dist/model/sourceSortKeys.d.ts.map +0 -1
- package/dist/model/sourceType.d.ts +0 -2
- package/dist/model/sourceType.d.ts.map +0 -1
- package/dist/model/sourceUpdate.d.ts +0 -13
- package/dist/model/sourceUpdate.d.ts.map +0 -1
- package/dist/model/sourceUpdateCommercetools.d.ts +0 -15
- package/dist/model/sourceUpdateCommercetools.d.ts.map +0 -1
- package/dist/model/sourceUpdateDocker.d.ts +0 -17
- package/dist/model/sourceUpdateDocker.d.ts.map +0 -1
- package/dist/model/sourceUpdateInput.d.ts +0 -9
- package/dist/model/sourceUpdateInput.d.ts.map +0 -1
- package/dist/model/sourceUpdateResponse.d.ts +0 -15
- package/dist/model/sourceUpdateResponse.d.ts.map +0 -1
- package/dist/model/sourceUpdateShopify.d.ts +0 -7
- package/dist/model/sourceUpdateShopify.d.ts.map +0 -1
- package/dist/model/sourceWatchResponse.d.ts +0 -20
- package/dist/model/sourceWatchResponse.d.ts.map +0 -1
- package/dist/model/streamingInput.d.ts +0 -8
- package/dist/model/streamingInput.d.ts.map +0 -1
- package/dist/model/streamingTrigger.d.ts +0 -8
- package/dist/model/streamingTrigger.d.ts.map +0 -1
- package/dist/model/streamingTriggerType.d.ts +0 -5
- package/dist/model/streamingTriggerType.d.ts.map +0 -1
- package/dist/model/subscriptionTrigger.d.ts +0 -8
- package/dist/model/subscriptionTrigger.d.ts.map +0 -1
- package/dist/model/subscriptionTriggerType.d.ts +0 -5
- package/dist/model/subscriptionTriggerType.d.ts.map +0 -1
- package/dist/model/task.d.ts +0 -51
- package/dist/model/task.d.ts.map +0 -1
- package/dist/model/taskCreate.d.ts +0 -34
- package/dist/model/taskCreate.d.ts.map +0 -1
- package/dist/model/taskCreateResponse.d.ts +0 -14
- package/dist/model/taskCreateResponse.d.ts.map +0 -1
- package/dist/model/taskCreateTrigger.d.ts +0 -6
- package/dist/model/taskCreateTrigger.d.ts.map +0 -1
- package/dist/model/taskCreateV1.d.ts +0 -32
- package/dist/model/taskCreateV1.d.ts.map +0 -1
- package/dist/model/taskInput.d.ts +0 -8
- package/dist/model/taskInput.d.ts.map +0 -1
- package/dist/model/taskSearch.d.ts +0 -4
- package/dist/model/taskSearch.d.ts.map +0 -1
- package/dist/model/taskSortKeys.d.ts +0 -5
- package/dist/model/taskSortKeys.d.ts.map +0 -1
- package/dist/model/taskUpdate.d.ts +0 -24
- package/dist/model/taskUpdate.d.ts.map +0 -1
- package/dist/model/taskUpdateResponse.d.ts +0 -14
- package/dist/model/taskUpdateResponse.d.ts.map +0 -1
- package/dist/model/taskUpdateV1.d.ts +0 -22
- package/dist/model/taskUpdateV1.d.ts.map +0 -1
- package/dist/model/taskV1.d.ts +0 -44
- package/dist/model/taskV1.d.ts.map +0 -1
- package/dist/model/transformation.d.ts +0 -31
- package/dist/model/transformation.d.ts.map +0 -1
- package/dist/model/transformationCreate.d.ts +0 -22
- package/dist/model/transformationCreate.d.ts.map +0 -1
- package/dist/model/transformationCreateResponse.d.ts +0 -14
- package/dist/model/transformationCreateResponse.d.ts.map +0 -1
- package/dist/model/transformationError.d.ts +0 -14
- package/dist/model/transformationError.d.ts.map +0 -1
- package/dist/model/transformationModels.d.ts +0 -8
- package/dist/model/transformationModels.d.ts.map +0 -1
- package/dist/model/transformationSearch.d.ts +0 -4
- package/dist/model/transformationSearch.d.ts.map +0 -1
- package/dist/model/transformationTry.d.ts +0 -13
- package/dist/model/transformationTry.d.ts.map +0 -1
- package/dist/model/transformationTryResponse.d.ts +0 -9
- package/dist/model/transformationTryResponse.d.ts.map +0 -1
- package/dist/model/transformationUpdateResponse.d.ts +0 -14
- package/dist/model/transformationUpdateResponse.d.ts.map +0 -1
- package/dist/model/trigger.d.ts +0 -9
- package/dist/model/trigger.d.ts.map +0 -1
- package/dist/model/triggerType.d.ts +0 -5
- package/dist/model/triggerType.d.ts.map +0 -1
- package/dist/model/triggerUpdateInput.d.ts +0 -10
- package/dist/model/triggerUpdateInput.d.ts.map +0 -1
- package/dist/model/window.d.ts +0 -14
- package/dist/model/window.d.ts.map +0 -1
- package/dist/src/ingestionClient.d.ts +0 -854
- package/dist/src/ingestionClient.d.ts.map +0 -1
|
@@ -1,2678 +0,0 @@
|
|
|
1
|
-
function createAuth(appId, apiKey, authMode = 'WithinHeaders') {
|
|
2
|
-
const credentials = {
|
|
3
|
-
'x-algolia-api-key': apiKey,
|
|
4
|
-
'x-algolia-application-id': appId
|
|
5
|
-
};
|
|
6
|
-
return {
|
|
7
|
-
headers() {
|
|
8
|
-
return authMode === 'WithinHeaders' ? credentials : {};
|
|
9
|
-
},
|
|
10
|
-
queryParameters() {
|
|
11
|
-
return authMode === 'WithinQueryParameters' ? credentials : {};
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function createBrowserLocalStorageCache(options) {
|
|
17
|
-
let storage;
|
|
18
|
-
// We've changed the namespace to avoid conflicts with v4, as this version is a huge breaking change
|
|
19
|
-
const namespaceKey = `algolia-client-js-${options.key}`;
|
|
20
|
-
function getStorage() {
|
|
21
|
-
if (storage === undefined) {
|
|
22
|
-
storage = options.localStorage || window.localStorage;
|
|
23
|
-
}
|
|
24
|
-
return storage;
|
|
25
|
-
}
|
|
26
|
-
function getNamespace() {
|
|
27
|
-
return JSON.parse(getStorage().getItem(namespaceKey) || '{}');
|
|
28
|
-
}
|
|
29
|
-
function setNamespace(namespace) {
|
|
30
|
-
getStorage().setItem(namespaceKey, JSON.stringify(namespace));
|
|
31
|
-
}
|
|
32
|
-
function removeOutdatedCacheItems() {
|
|
33
|
-
const timeToLive = options.timeToLive ? options.timeToLive * 1000 : null;
|
|
34
|
-
const namespace = getNamespace();
|
|
35
|
-
const filteredNamespaceWithoutOldFormattedCacheItems = Object.fromEntries(Object.entries(namespace).filter(([, cacheItem]) => {
|
|
36
|
-
return cacheItem.timestamp !== undefined;
|
|
37
|
-
}));
|
|
38
|
-
setNamespace(filteredNamespaceWithoutOldFormattedCacheItems);
|
|
39
|
-
if (!timeToLive) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const filteredNamespaceWithoutExpiredItems = Object.fromEntries(Object.entries(filteredNamespaceWithoutOldFormattedCacheItems).filter(([, cacheItem]) => {
|
|
43
|
-
const currentTimestamp = new Date().getTime();
|
|
44
|
-
const isExpired = cacheItem.timestamp + timeToLive < currentTimestamp;
|
|
45
|
-
return !isExpired;
|
|
46
|
-
}));
|
|
47
|
-
setNamespace(filteredNamespaceWithoutExpiredItems);
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
get(key, defaultValue, events = {
|
|
51
|
-
miss: () => Promise.resolve()
|
|
52
|
-
}) {
|
|
53
|
-
return Promise.resolve().then(() => {
|
|
54
|
-
removeOutdatedCacheItems();
|
|
55
|
-
return getNamespace()[JSON.stringify(key)];
|
|
56
|
-
}).then(value => {
|
|
57
|
-
return Promise.all([value ? value.value : defaultValue(), value !== undefined]);
|
|
58
|
-
}).then(([value, exists]) => {
|
|
59
|
-
return Promise.all([value, exists || events.miss(value)]);
|
|
60
|
-
}).then(([value]) => value);
|
|
61
|
-
},
|
|
62
|
-
set(key, value) {
|
|
63
|
-
return Promise.resolve().then(() => {
|
|
64
|
-
const namespace = getNamespace();
|
|
65
|
-
namespace[JSON.stringify(key)] = {
|
|
66
|
-
timestamp: new Date().getTime(),
|
|
67
|
-
value
|
|
68
|
-
};
|
|
69
|
-
getStorage().setItem(namespaceKey, JSON.stringify(namespace));
|
|
70
|
-
return value;
|
|
71
|
-
});
|
|
72
|
-
},
|
|
73
|
-
delete(key) {
|
|
74
|
-
return Promise.resolve().then(() => {
|
|
75
|
-
const namespace = getNamespace();
|
|
76
|
-
delete namespace[JSON.stringify(key)];
|
|
77
|
-
getStorage().setItem(namespaceKey, JSON.stringify(namespace));
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
clear() {
|
|
81
|
-
return Promise.resolve().then(() => {
|
|
82
|
-
getStorage().removeItem(namespaceKey);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function createNullCache() {
|
|
89
|
-
return {
|
|
90
|
-
get(_key, defaultValue, events = {
|
|
91
|
-
miss: () => Promise.resolve()
|
|
92
|
-
}) {
|
|
93
|
-
const value = defaultValue();
|
|
94
|
-
return value.then(result => Promise.all([result, events.miss(result)])).then(([result]) => result);
|
|
95
|
-
},
|
|
96
|
-
set(_key, value) {
|
|
97
|
-
return Promise.resolve(value);
|
|
98
|
-
},
|
|
99
|
-
delete(_key) {
|
|
100
|
-
return Promise.resolve();
|
|
101
|
-
},
|
|
102
|
-
clear() {
|
|
103
|
-
return Promise.resolve();
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function createFallbackableCache(options) {
|
|
109
|
-
const caches = [...options.caches];
|
|
110
|
-
const current = caches.shift();
|
|
111
|
-
if (current === undefined) {
|
|
112
|
-
return createNullCache();
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
get(key, defaultValue, events = {
|
|
116
|
-
miss: () => Promise.resolve()
|
|
117
|
-
}) {
|
|
118
|
-
return current.get(key, defaultValue, events).catch(() => {
|
|
119
|
-
return createFallbackableCache({
|
|
120
|
-
caches
|
|
121
|
-
}).get(key, defaultValue, events);
|
|
122
|
-
});
|
|
123
|
-
},
|
|
124
|
-
set(key, value) {
|
|
125
|
-
return current.set(key, value).catch(() => {
|
|
126
|
-
return createFallbackableCache({
|
|
127
|
-
caches
|
|
128
|
-
}).set(key, value);
|
|
129
|
-
});
|
|
130
|
-
},
|
|
131
|
-
delete(key) {
|
|
132
|
-
return current.delete(key).catch(() => {
|
|
133
|
-
return createFallbackableCache({
|
|
134
|
-
caches
|
|
135
|
-
}).delete(key);
|
|
136
|
-
});
|
|
137
|
-
},
|
|
138
|
-
clear() {
|
|
139
|
-
return current.clear().catch(() => {
|
|
140
|
-
return createFallbackableCache({
|
|
141
|
-
caches
|
|
142
|
-
}).clear();
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function createMemoryCache(options = {
|
|
149
|
-
serializable: true
|
|
150
|
-
}) {
|
|
151
|
-
let cache = {};
|
|
152
|
-
return {
|
|
153
|
-
get(key, defaultValue, events = {
|
|
154
|
-
miss: () => Promise.resolve()
|
|
155
|
-
}) {
|
|
156
|
-
const keyAsString = JSON.stringify(key);
|
|
157
|
-
if (keyAsString in cache) {
|
|
158
|
-
return Promise.resolve(options.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]);
|
|
159
|
-
}
|
|
160
|
-
const promise = defaultValue();
|
|
161
|
-
return promise.then(value => events.miss(value)).then(() => promise);
|
|
162
|
-
},
|
|
163
|
-
set(key, value) {
|
|
164
|
-
cache[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;
|
|
165
|
-
return Promise.resolve(value);
|
|
166
|
-
},
|
|
167
|
-
delete(key) {
|
|
168
|
-
delete cache[JSON.stringify(key)];
|
|
169
|
-
return Promise.resolve();
|
|
170
|
-
},
|
|
171
|
-
clear() {
|
|
172
|
-
cache = {};
|
|
173
|
-
return Promise.resolve();
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// By default, API Clients at Algolia have expiration delay of 5 mins.
|
|
179
|
-
// In the JavaScript client, we have 2 mins.
|
|
180
|
-
const EXPIRATION_DELAY = 2 * 60 * 1000;
|
|
181
|
-
function createStatefulHost(host, status = 'up') {
|
|
182
|
-
const lastUpdate = Date.now();
|
|
183
|
-
function isUp() {
|
|
184
|
-
return status === 'up' || Date.now() - lastUpdate > EXPIRATION_DELAY;
|
|
185
|
-
}
|
|
186
|
-
function isTimedOut() {
|
|
187
|
-
return status === 'timed out' && Date.now() - lastUpdate <= EXPIRATION_DELAY;
|
|
188
|
-
}
|
|
189
|
-
return {
|
|
190
|
-
...host,
|
|
191
|
-
status,
|
|
192
|
-
lastUpdate,
|
|
193
|
-
isUp,
|
|
194
|
-
isTimedOut
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function _defineProperty(e, r, t) {
|
|
199
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
200
|
-
value: t,
|
|
201
|
-
enumerable: !0,
|
|
202
|
-
configurable: !0,
|
|
203
|
-
writable: !0
|
|
204
|
-
}) : e[r] = t, e;
|
|
205
|
-
}
|
|
206
|
-
function _toPrimitive(t, r) {
|
|
207
|
-
if ("object" != typeof t || !t) return t;
|
|
208
|
-
var e = t[Symbol.toPrimitive];
|
|
209
|
-
if (void 0 !== e) {
|
|
210
|
-
var i = e.call(t, r || "default");
|
|
211
|
-
if ("object" != typeof i) return i;
|
|
212
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
213
|
-
}
|
|
214
|
-
return ("string" === r ? String : Number)(t);
|
|
215
|
-
}
|
|
216
|
-
function _toPropertyKey(t) {
|
|
217
|
-
var i = _toPrimitive(t, "string");
|
|
218
|
-
return "symbol" == typeof i ? i : i + "";
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
class AlgoliaError extends Error {
|
|
222
|
-
constructor(message, name) {
|
|
223
|
-
super(message);
|
|
224
|
-
_defineProperty(this, "name", 'AlgoliaError');
|
|
225
|
-
if (name) {
|
|
226
|
-
this.name = name;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
class ErrorWithStackTrace extends AlgoliaError {
|
|
231
|
-
constructor(message, stackTrace, name) {
|
|
232
|
-
super(message, name);
|
|
233
|
-
// the array and object should be frozen to reflect the stackTrace at the time of the error
|
|
234
|
-
_defineProperty(this, "stackTrace", void 0);
|
|
235
|
-
this.stackTrace = stackTrace;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
class RetryError extends ErrorWithStackTrace {
|
|
239
|
-
constructor(stackTrace) {
|
|
240
|
-
super('Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.', stackTrace, 'RetryError');
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
class ApiError extends ErrorWithStackTrace {
|
|
244
|
-
constructor(message, status, stackTrace, name = 'ApiError') {
|
|
245
|
-
super(message, stackTrace, name);
|
|
246
|
-
_defineProperty(this, "status", void 0);
|
|
247
|
-
this.status = status;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
class DeserializationError extends AlgoliaError {
|
|
251
|
-
constructor(message, response) {
|
|
252
|
-
super(message, 'DeserializationError');
|
|
253
|
-
_defineProperty(this, "response", void 0);
|
|
254
|
-
this.response = response;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
// DetailedApiError is only used by the ingestion client to return more informative error, other clients will use ApiClient.
|
|
258
|
-
class DetailedApiError extends ApiError {
|
|
259
|
-
constructor(message, status, error, stackTrace) {
|
|
260
|
-
super(message, status, stackTrace, 'DetailedApiError');
|
|
261
|
-
_defineProperty(this, "error", void 0);
|
|
262
|
-
this.error = error;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
function serializeUrl(host, path, queryParameters) {
|
|
266
|
-
const queryParametersAsString = serializeQueryParameters(queryParameters);
|
|
267
|
-
let url = `${host.protocol}://${host.url}${host.port ? `:${host.port}` : ''}/${path.charAt(0) === '/' ? path.substring(1) : path}`;
|
|
268
|
-
if (queryParametersAsString.length) {
|
|
269
|
-
url += `?${queryParametersAsString}`;
|
|
270
|
-
}
|
|
271
|
-
return url;
|
|
272
|
-
}
|
|
273
|
-
function serializeQueryParameters(parameters) {
|
|
274
|
-
return Object.keys(parameters).filter(key => parameters[key] !== undefined).sort().map(key => `${key}=${encodeURIComponent(Object.prototype.toString.call(parameters[key]) === '[object Array]' ? parameters[key].join(',') : parameters[key]).replaceAll('+', '%20')}`).join('&');
|
|
275
|
-
}
|
|
276
|
-
function serializeData(request, requestOptions) {
|
|
277
|
-
if (request.method === 'GET' || request.data === undefined && requestOptions.data === undefined) {
|
|
278
|
-
return undefined;
|
|
279
|
-
}
|
|
280
|
-
const data = Array.isArray(request.data) ? request.data : {
|
|
281
|
-
...request.data,
|
|
282
|
-
...requestOptions.data
|
|
283
|
-
};
|
|
284
|
-
return JSON.stringify(data);
|
|
285
|
-
}
|
|
286
|
-
function serializeHeaders(baseHeaders, requestHeaders, requestOptionsHeaders) {
|
|
287
|
-
const headers = {
|
|
288
|
-
Accept: 'application/json',
|
|
289
|
-
...baseHeaders,
|
|
290
|
-
...requestHeaders,
|
|
291
|
-
...requestOptionsHeaders
|
|
292
|
-
};
|
|
293
|
-
const serializedHeaders = {};
|
|
294
|
-
Object.keys(headers).forEach(header => {
|
|
295
|
-
const value = headers[header];
|
|
296
|
-
serializedHeaders[header.toLowerCase()] = value;
|
|
297
|
-
});
|
|
298
|
-
return serializedHeaders;
|
|
299
|
-
}
|
|
300
|
-
function deserializeSuccess(response) {
|
|
301
|
-
try {
|
|
302
|
-
return JSON.parse(response.content);
|
|
303
|
-
} catch (e) {
|
|
304
|
-
throw new DeserializationError(e.message, response);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
function deserializeFailure({
|
|
308
|
-
content,
|
|
309
|
-
status
|
|
310
|
-
}, stackFrame) {
|
|
311
|
-
try {
|
|
312
|
-
const parsed = JSON.parse(content);
|
|
313
|
-
if ('error' in parsed) {
|
|
314
|
-
return new DetailedApiError(parsed.message, status, parsed.error, stackFrame);
|
|
315
|
-
}
|
|
316
|
-
return new ApiError(parsed.message, status, stackFrame);
|
|
317
|
-
} catch {
|
|
318
|
-
// ..
|
|
319
|
-
}
|
|
320
|
-
return new ApiError(content, status, stackFrame);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
function isNetworkError({
|
|
324
|
-
isTimedOut,
|
|
325
|
-
status
|
|
326
|
-
}) {
|
|
327
|
-
return !isTimedOut && ~~status === 0;
|
|
328
|
-
}
|
|
329
|
-
function isRetryable({
|
|
330
|
-
isTimedOut,
|
|
331
|
-
status
|
|
332
|
-
}) {
|
|
333
|
-
return isTimedOut || isNetworkError({
|
|
334
|
-
isTimedOut,
|
|
335
|
-
status
|
|
336
|
-
}) || ~~(status / 100) !== 2 && ~~(status / 100) !== 4;
|
|
337
|
-
}
|
|
338
|
-
function isSuccess({
|
|
339
|
-
status
|
|
340
|
-
}) {
|
|
341
|
-
return ~~(status / 100) === 2;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
function stackTraceWithoutCredentials(stackTrace) {
|
|
345
|
-
return stackTrace.map(stackFrame => stackFrameWithoutCredentials(stackFrame));
|
|
346
|
-
}
|
|
347
|
-
function stackFrameWithoutCredentials(stackFrame) {
|
|
348
|
-
const modifiedHeaders = stackFrame.request.headers['x-algolia-api-key'] ? {
|
|
349
|
-
'x-algolia-api-key': '*****'
|
|
350
|
-
} : {};
|
|
351
|
-
return {
|
|
352
|
-
...stackFrame,
|
|
353
|
-
request: {
|
|
354
|
-
...stackFrame.request,
|
|
355
|
-
headers: {
|
|
356
|
-
...stackFrame.request.headers,
|
|
357
|
-
...modifiedHeaders
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
function createTransporter({
|
|
364
|
-
hosts,
|
|
365
|
-
hostsCache,
|
|
366
|
-
baseHeaders,
|
|
367
|
-
baseQueryParameters,
|
|
368
|
-
algoliaAgent,
|
|
369
|
-
timeouts,
|
|
370
|
-
requester,
|
|
371
|
-
requestsCache,
|
|
372
|
-
responsesCache
|
|
373
|
-
}) {
|
|
374
|
-
async function createRetryableOptions(compatibleHosts) {
|
|
375
|
-
const statefulHosts = await Promise.all(compatibleHosts.map(compatibleHost => {
|
|
376
|
-
return hostsCache.get(compatibleHost, () => {
|
|
377
|
-
return Promise.resolve(createStatefulHost(compatibleHost));
|
|
378
|
-
});
|
|
379
|
-
}));
|
|
380
|
-
const hostsUp = statefulHosts.filter(host => host.isUp());
|
|
381
|
-
const hostsTimedOut = statefulHosts.filter(host => host.isTimedOut());
|
|
382
|
-
// Note, we put the hosts that previously timed out on the end of the list.
|
|
383
|
-
const hostsAvailable = [...hostsUp, ...hostsTimedOut];
|
|
384
|
-
const compatibleHostsAvailable = hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts;
|
|
385
|
-
return {
|
|
386
|
-
hosts: compatibleHostsAvailable,
|
|
387
|
-
getTimeout(timeoutsCount, baseTimeout) {
|
|
388
|
-
/**
|
|
389
|
-
* Imagine that you have 4 hosts, if timeouts will increase
|
|
390
|
-
* on the following way: 1 (timed out) > 4 (timed out) > 5 (200).
|
|
391
|
-
*
|
|
392
|
-
* Note that, the very next request, we start from the previous timeout.
|
|
393
|
-
*
|
|
394
|
-
* 5 (timed out) > 6 (timed out) > 7 ...
|
|
395
|
-
*
|
|
396
|
-
* This strategy may need to be reviewed, but is the strategy on the our
|
|
397
|
-
* current v3 version.
|
|
398
|
-
*/
|
|
399
|
-
const timeoutMultiplier = hostsTimedOut.length === 0 && timeoutsCount === 0 ? 1 : hostsTimedOut.length + 3 + timeoutsCount;
|
|
400
|
-
return timeoutMultiplier * baseTimeout;
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
async function retryableRequest(request, requestOptions, isRead = true) {
|
|
405
|
-
const stackTrace = [];
|
|
406
|
-
/**
|
|
407
|
-
* First we prepare the payload that do not depend from hosts.
|
|
408
|
-
*/
|
|
409
|
-
const data = serializeData(request, requestOptions);
|
|
410
|
-
const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);
|
|
411
|
-
// On `GET`, the data is proxied to query parameters.
|
|
412
|
-
const dataQueryParameters = request.method === 'GET' ? {
|
|
413
|
-
...request.data,
|
|
414
|
-
...requestOptions.data
|
|
415
|
-
} : {};
|
|
416
|
-
const queryParameters = {
|
|
417
|
-
...baseQueryParameters,
|
|
418
|
-
...request.queryParameters,
|
|
419
|
-
...dataQueryParameters
|
|
420
|
-
};
|
|
421
|
-
if (algoliaAgent.value) {
|
|
422
|
-
queryParameters['x-algolia-agent'] = algoliaAgent.value;
|
|
423
|
-
}
|
|
424
|
-
if (requestOptions && requestOptions.queryParameters) {
|
|
425
|
-
for (const key of Object.keys(requestOptions.queryParameters)) {
|
|
426
|
-
// We want to keep `undefined` and `null` values,
|
|
427
|
-
// but also avoid stringifying `object`s, as they are
|
|
428
|
-
// handled in the `serializeUrl` step right after.
|
|
429
|
-
if (!requestOptions.queryParameters[key] || Object.prototype.toString.call(requestOptions.queryParameters[key]) === '[object Object]') {
|
|
430
|
-
queryParameters[key] = requestOptions.queryParameters[key];
|
|
431
|
-
} else {
|
|
432
|
-
queryParameters[key] = requestOptions.queryParameters[key].toString();
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
let timeoutsCount = 0;
|
|
437
|
-
const retry = async (retryableHosts, getTimeout) => {
|
|
438
|
-
/**
|
|
439
|
-
* We iterate on each host, until there is no host left.
|
|
440
|
-
*/
|
|
441
|
-
const host = retryableHosts.pop();
|
|
442
|
-
if (host === undefined) {
|
|
443
|
-
throw new RetryError(stackTraceWithoutCredentials(stackTrace));
|
|
444
|
-
}
|
|
445
|
-
const timeout = {
|
|
446
|
-
...timeouts,
|
|
447
|
-
...requestOptions.timeouts
|
|
448
|
-
};
|
|
449
|
-
const payload = {
|
|
450
|
-
data,
|
|
451
|
-
headers,
|
|
452
|
-
method: request.method,
|
|
453
|
-
url: serializeUrl(host, request.path, queryParameters),
|
|
454
|
-
connectTimeout: getTimeout(timeoutsCount, timeout.connect),
|
|
455
|
-
responseTimeout: getTimeout(timeoutsCount, isRead ? timeout.read : timeout.write)
|
|
456
|
-
};
|
|
457
|
-
/**
|
|
458
|
-
* The stackFrame is pushed to the stackTrace so we
|
|
459
|
-
* can have information about onRetry and onFailure
|
|
460
|
-
* decisions.
|
|
461
|
-
*/
|
|
462
|
-
const pushToStackTrace = response => {
|
|
463
|
-
const stackFrame = {
|
|
464
|
-
request: payload,
|
|
465
|
-
response,
|
|
466
|
-
host,
|
|
467
|
-
triesLeft: retryableHosts.length
|
|
468
|
-
};
|
|
469
|
-
stackTrace.push(stackFrame);
|
|
470
|
-
return stackFrame;
|
|
471
|
-
};
|
|
472
|
-
const response = await requester.send(payload);
|
|
473
|
-
if (isRetryable(response)) {
|
|
474
|
-
const stackFrame = pushToStackTrace(response);
|
|
475
|
-
// If response is a timeout, we increase the number of timeouts so we can increase the timeout later.
|
|
476
|
-
if (response.isTimedOut) {
|
|
477
|
-
timeoutsCount++;
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* Failures are individually sent to the logger, allowing
|
|
481
|
-
* the end user to debug / store stack frames even
|
|
482
|
-
* when a retry error does not happen.
|
|
483
|
-
*/
|
|
484
|
-
// eslint-disable-next-line no-console -- this will be fixed by exposing a `logger` to the transporter
|
|
485
|
-
console.log('Retryable failure', stackFrameWithoutCredentials(stackFrame));
|
|
486
|
-
/**
|
|
487
|
-
* We also store the state of the host in failure cases. If the host, is
|
|
488
|
-
* down it will remain down for the next 2 minutes. In a timeout situation,
|
|
489
|
-
* this host will be added end of the list of hosts on the next request.
|
|
490
|
-
*/
|
|
491
|
-
await hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? 'timed out' : 'down'));
|
|
492
|
-
return retry(retryableHosts, getTimeout);
|
|
493
|
-
}
|
|
494
|
-
if (isSuccess(response)) {
|
|
495
|
-
return deserializeSuccess(response);
|
|
496
|
-
}
|
|
497
|
-
pushToStackTrace(response);
|
|
498
|
-
throw deserializeFailure(response, stackTrace);
|
|
499
|
-
};
|
|
500
|
-
/**
|
|
501
|
-
* Finally, for each retryable host perform request until we got a non
|
|
502
|
-
* retryable response. Some notes here:
|
|
503
|
-
*
|
|
504
|
-
* 1. The reverse here is applied so we can apply a `pop` later on => more performant.
|
|
505
|
-
* 2. We also get from the retryable options a timeout multiplier that is tailored
|
|
506
|
-
* for the current context.
|
|
507
|
-
*/
|
|
508
|
-
const compatibleHosts = hosts.filter(host => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'));
|
|
509
|
-
const options = await createRetryableOptions(compatibleHosts);
|
|
510
|
-
return retry([...options.hosts].reverse(), options.getTimeout);
|
|
511
|
-
}
|
|
512
|
-
function createRequest(request, requestOptions = {}) {
|
|
513
|
-
/**
|
|
514
|
-
* A read request is either a `GET` request, or a request that we make
|
|
515
|
-
* via the `read` transporter (e.g. `search`).
|
|
516
|
-
*/
|
|
517
|
-
const isRead = request.useReadTransporter || request.method === 'GET';
|
|
518
|
-
if (!isRead) {
|
|
519
|
-
/**
|
|
520
|
-
* On write requests, no cache mechanisms are applied, and we
|
|
521
|
-
* proxy the request immediately to the requester.
|
|
522
|
-
*/
|
|
523
|
-
return retryableRequest(request, requestOptions, isRead);
|
|
524
|
-
}
|
|
525
|
-
const createRetryableRequest = () => {
|
|
526
|
-
/**
|
|
527
|
-
* Then, we prepare a function factory that contains the construction of
|
|
528
|
-
* the retryable request. At this point, we may *not* perform the actual
|
|
529
|
-
* request. But we want to have the function factory ready.
|
|
530
|
-
*/
|
|
531
|
-
return retryableRequest(request, requestOptions);
|
|
532
|
-
};
|
|
533
|
-
/**
|
|
534
|
-
* Once we have the function factory ready, we need to determine of the
|
|
535
|
-
* request is "cacheable" - should be cached. Note that, once again,
|
|
536
|
-
* the user can force this option.
|
|
537
|
-
*/
|
|
538
|
-
const cacheable = requestOptions.cacheable || request.cacheable;
|
|
539
|
-
/**
|
|
540
|
-
* If is not "cacheable", we immediately trigger the retryable request, no
|
|
541
|
-
* need to check cache implementations.
|
|
542
|
-
*/
|
|
543
|
-
if (cacheable !== true) {
|
|
544
|
-
return createRetryableRequest();
|
|
545
|
-
}
|
|
546
|
-
/**
|
|
547
|
-
* If the request is "cacheable", we need to first compute the key to ask
|
|
548
|
-
* the cache implementations if this request is on progress or if the
|
|
549
|
-
* response already exists on the cache.
|
|
550
|
-
*/
|
|
551
|
-
const key = {
|
|
552
|
-
request,
|
|
553
|
-
requestOptions,
|
|
554
|
-
transporter: {
|
|
555
|
-
queryParameters: baseQueryParameters,
|
|
556
|
-
headers: baseHeaders
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
/**
|
|
560
|
-
* With the computed key, we first ask the responses cache
|
|
561
|
-
* implementation if this request was been resolved before.
|
|
562
|
-
*/
|
|
563
|
-
return responsesCache.get(key, () => {
|
|
564
|
-
/**
|
|
565
|
-
* If the request has never resolved before, we actually ask if there
|
|
566
|
-
* is a current request with the same key on progress.
|
|
567
|
-
*/
|
|
568
|
-
return requestsCache.get(key, () =>
|
|
569
|
-
/**
|
|
570
|
-
* Finally, if there is no request in progress with the same key,
|
|
571
|
-
* this `createRetryableRequest()` will actually trigger the
|
|
572
|
-
* retryable request.
|
|
573
|
-
*/
|
|
574
|
-
requestsCache.set(key, createRetryableRequest()).then(response => Promise.all([requestsCache.delete(key), response]), err => Promise.all([requestsCache.delete(key), Promise.reject(err)])).then(([_, response]) => response));
|
|
575
|
-
}, {
|
|
576
|
-
/**
|
|
577
|
-
* Of course, once we get this response back from the server, we
|
|
578
|
-
* tell response cache to actually store the received response
|
|
579
|
-
* to be used later.
|
|
580
|
-
*/
|
|
581
|
-
miss: response => responsesCache.set(key, response)
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
return {
|
|
585
|
-
hostsCache,
|
|
586
|
-
requester,
|
|
587
|
-
timeouts,
|
|
588
|
-
algoliaAgent,
|
|
589
|
-
baseHeaders,
|
|
590
|
-
baseQueryParameters,
|
|
591
|
-
hosts,
|
|
592
|
-
request: createRequest,
|
|
593
|
-
requestsCache,
|
|
594
|
-
responsesCache
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
function createAlgoliaAgent(version) {
|
|
599
|
-
const algoliaAgent = {
|
|
600
|
-
value: `Algolia for JavaScript (${version})`,
|
|
601
|
-
add(options) {
|
|
602
|
-
const addedAlgoliaAgent = `; ${options.segment}${options.version !== undefined ? ` (${options.version})` : ''}`;
|
|
603
|
-
if (algoliaAgent.value.indexOf(addedAlgoliaAgent) === -1) {
|
|
604
|
-
algoliaAgent.value = `${algoliaAgent.value}${addedAlgoliaAgent}`;
|
|
605
|
-
}
|
|
606
|
-
return algoliaAgent;
|
|
607
|
-
}
|
|
608
|
-
};
|
|
609
|
-
return algoliaAgent;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
function getAlgoliaAgent({
|
|
613
|
-
algoliaAgents,
|
|
614
|
-
client,
|
|
615
|
-
version
|
|
616
|
-
}) {
|
|
617
|
-
const defaultAlgoliaAgent = createAlgoliaAgent(version).add({
|
|
618
|
-
segment: client,
|
|
619
|
-
version
|
|
620
|
-
});
|
|
621
|
-
algoliaAgents.forEach(algoliaAgent => defaultAlgoliaAgent.add(algoliaAgent));
|
|
622
|
-
return defaultAlgoliaAgent;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
const DEFAULT_CONNECT_TIMEOUT_BROWSER = 1000;
|
|
626
|
-
const DEFAULT_READ_TIMEOUT_BROWSER = 2000;
|
|
627
|
-
const DEFAULT_WRITE_TIMEOUT_BROWSER = 30000;
|
|
628
|
-
|
|
629
|
-
function createXhrRequester() {
|
|
630
|
-
function send(request) {
|
|
631
|
-
return new Promise((resolve) => {
|
|
632
|
-
const baseRequester = new XMLHttpRequest();
|
|
633
|
-
baseRequester.open(request.method, request.url, true);
|
|
634
|
-
Object.keys(request.headers).forEach((key) => baseRequester.setRequestHeader(key, request.headers[key]));
|
|
635
|
-
const createTimeout = (timeout, content) => {
|
|
636
|
-
return setTimeout(() => {
|
|
637
|
-
baseRequester.abort();
|
|
638
|
-
resolve({
|
|
639
|
-
status: 0,
|
|
640
|
-
content,
|
|
641
|
-
isTimedOut: true,
|
|
642
|
-
});
|
|
643
|
-
}, timeout);
|
|
644
|
-
};
|
|
645
|
-
const connectTimeout = createTimeout(request.connectTimeout, 'Connection timeout');
|
|
646
|
-
let responseTimeout;
|
|
647
|
-
baseRequester.onreadystatechange = () => {
|
|
648
|
-
if (baseRequester.readyState > baseRequester.OPENED && responseTimeout === undefined) {
|
|
649
|
-
clearTimeout(connectTimeout);
|
|
650
|
-
responseTimeout = createTimeout(request.responseTimeout, 'Socket timeout');
|
|
651
|
-
}
|
|
652
|
-
};
|
|
653
|
-
baseRequester.onerror = () => {
|
|
654
|
-
// istanbul ignore next
|
|
655
|
-
if (baseRequester.status === 0) {
|
|
656
|
-
clearTimeout(connectTimeout);
|
|
657
|
-
clearTimeout(responseTimeout);
|
|
658
|
-
resolve({
|
|
659
|
-
content: baseRequester.responseText || 'Network request failed',
|
|
660
|
-
status: baseRequester.status,
|
|
661
|
-
isTimedOut: false,
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
};
|
|
665
|
-
baseRequester.onload = () => {
|
|
666
|
-
clearTimeout(connectTimeout);
|
|
667
|
-
clearTimeout(responseTimeout);
|
|
668
|
-
resolve({
|
|
669
|
-
content: baseRequester.responseText,
|
|
670
|
-
status: baseRequester.status,
|
|
671
|
-
isTimedOut: false,
|
|
672
|
-
});
|
|
673
|
-
};
|
|
674
|
-
baseRequester.send(request.data);
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
return { send };
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
681
|
-
const apiClientVersion = '1.2.4';
|
|
682
|
-
const REGIONS = ['eu', 'us'];
|
|
683
|
-
function getDefaultHosts(region) {
|
|
684
|
-
const url = 'data.{region}.algolia.com'.replace('{region}', region);
|
|
685
|
-
return [{ url, accept: 'readWrite', protocol: 'https' }];
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* Guard: Return strongly typed specific OnDemandTrigger for a given Trigger.
|
|
689
|
-
*
|
|
690
|
-
* @summary Guard method that returns a strongly typed specific OnDemandTrigger for a given Trigger.
|
|
691
|
-
* @param trigger - The given Task Trigger.
|
|
692
|
-
*/
|
|
693
|
-
function isOnDemandTrigger(trigger) {
|
|
694
|
-
return trigger.type === 'onDemand';
|
|
695
|
-
}
|
|
696
|
-
/**
|
|
697
|
-
* Guard: Return strongly typed specific ScheduleTrigger for a given Trigger.
|
|
698
|
-
*
|
|
699
|
-
* @summary Guard method that returns a strongly typed specific ScheduleTrigger for a given Trigger.
|
|
700
|
-
* @param trigger - The given Task Trigger.
|
|
701
|
-
*/
|
|
702
|
-
function isScheduleTrigger(trigger) {
|
|
703
|
-
return trigger.type === 'schedule';
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* Guard: Return strongly typed specific SubscriptionTrigger for a given Trigger.
|
|
707
|
-
*
|
|
708
|
-
* @summary Guard method that returns a strongly typed specific SubscriptionTrigger for a given Trigger.
|
|
709
|
-
* @param trigger - The given Task Trigger.
|
|
710
|
-
*/
|
|
711
|
-
function isSubscriptionTrigger(trigger) {
|
|
712
|
-
return trigger.type === 'subscription';
|
|
713
|
-
}
|
|
714
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
715
|
-
function createIngestionClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }) {
|
|
716
|
-
const auth = createAuth(appIdOption, apiKeyOption, authMode);
|
|
717
|
-
const transporter = createTransporter({
|
|
718
|
-
hosts: getDefaultHosts(regionOption),
|
|
719
|
-
...options,
|
|
720
|
-
algoliaAgent: getAlgoliaAgent({
|
|
721
|
-
algoliaAgents,
|
|
722
|
-
client: 'Ingestion',
|
|
723
|
-
version: apiClientVersion,
|
|
724
|
-
}),
|
|
725
|
-
baseHeaders: {
|
|
726
|
-
'content-type': 'text/plain',
|
|
727
|
-
...auth.headers(),
|
|
728
|
-
...options.baseHeaders,
|
|
729
|
-
},
|
|
730
|
-
baseQueryParameters: {
|
|
731
|
-
...auth.queryParameters(),
|
|
732
|
-
...options.baseQueryParameters,
|
|
733
|
-
},
|
|
734
|
-
});
|
|
735
|
-
return {
|
|
736
|
-
transporter,
|
|
737
|
-
/**
|
|
738
|
-
* The `appId` currently in use.
|
|
739
|
-
*/
|
|
740
|
-
appId: appIdOption,
|
|
741
|
-
/**
|
|
742
|
-
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
743
|
-
*/
|
|
744
|
-
clearCache() {
|
|
745
|
-
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);
|
|
746
|
-
},
|
|
747
|
-
/**
|
|
748
|
-
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
749
|
-
*/
|
|
750
|
-
get _ua() {
|
|
751
|
-
return transporter.algoliaAgent.value;
|
|
752
|
-
},
|
|
753
|
-
/**
|
|
754
|
-
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
755
|
-
*
|
|
756
|
-
* @param segment - The algolia agent (user-agent) segment to add.
|
|
757
|
-
* @param version - The version of the agent.
|
|
758
|
-
*/
|
|
759
|
-
addAlgoliaAgent(segment, version) {
|
|
760
|
-
transporter.algoliaAgent.add({ segment, version });
|
|
761
|
-
},
|
|
762
|
-
/**
|
|
763
|
-
* Creates a new authentication resource.
|
|
764
|
-
*
|
|
765
|
-
* Required API Key ACLs:
|
|
766
|
-
* - addObject
|
|
767
|
-
* - deleteIndex
|
|
768
|
-
* - editSettings.
|
|
769
|
-
*
|
|
770
|
-
* @param authenticationCreate -.
|
|
771
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
772
|
-
*/
|
|
773
|
-
createAuthentication(authenticationCreate, requestOptions) {
|
|
774
|
-
if (!authenticationCreate) {
|
|
775
|
-
throw new Error('Parameter `authenticationCreate` is required when calling `createAuthentication`.');
|
|
776
|
-
}
|
|
777
|
-
if (!authenticationCreate.type) {
|
|
778
|
-
throw new Error('Parameter `authenticationCreate.type` is required when calling `createAuthentication`.');
|
|
779
|
-
}
|
|
780
|
-
if (!authenticationCreate.name) {
|
|
781
|
-
throw new Error('Parameter `authenticationCreate.name` is required when calling `createAuthentication`.');
|
|
782
|
-
}
|
|
783
|
-
if (!authenticationCreate.input) {
|
|
784
|
-
throw new Error('Parameter `authenticationCreate.input` is required when calling `createAuthentication`.');
|
|
785
|
-
}
|
|
786
|
-
const requestPath = '/1/authentications';
|
|
787
|
-
const headers = {};
|
|
788
|
-
const queryParameters = {};
|
|
789
|
-
const request = {
|
|
790
|
-
method: 'POST',
|
|
791
|
-
path: requestPath,
|
|
792
|
-
queryParameters,
|
|
793
|
-
headers,
|
|
794
|
-
data: authenticationCreate,
|
|
795
|
-
};
|
|
796
|
-
return transporter.request(request, requestOptions);
|
|
797
|
-
},
|
|
798
|
-
/**
|
|
799
|
-
* Creates a new destination.
|
|
800
|
-
*
|
|
801
|
-
* Required API Key ACLs:
|
|
802
|
-
* - addObject
|
|
803
|
-
* - deleteIndex
|
|
804
|
-
* - editSettings.
|
|
805
|
-
*
|
|
806
|
-
* @param destinationCreate -.
|
|
807
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
808
|
-
*/
|
|
809
|
-
createDestination(destinationCreate, requestOptions) {
|
|
810
|
-
if (!destinationCreate) {
|
|
811
|
-
throw new Error('Parameter `destinationCreate` is required when calling `createDestination`.');
|
|
812
|
-
}
|
|
813
|
-
if (!destinationCreate.type) {
|
|
814
|
-
throw new Error('Parameter `destinationCreate.type` is required when calling `createDestination`.');
|
|
815
|
-
}
|
|
816
|
-
if (!destinationCreate.name) {
|
|
817
|
-
throw new Error('Parameter `destinationCreate.name` is required when calling `createDestination`.');
|
|
818
|
-
}
|
|
819
|
-
if (!destinationCreate.input) {
|
|
820
|
-
throw new Error('Parameter `destinationCreate.input` is required when calling `createDestination`.');
|
|
821
|
-
}
|
|
822
|
-
const requestPath = '/1/destinations';
|
|
823
|
-
const headers = {};
|
|
824
|
-
const queryParameters = {};
|
|
825
|
-
const request = {
|
|
826
|
-
method: 'POST',
|
|
827
|
-
path: requestPath,
|
|
828
|
-
queryParameters,
|
|
829
|
-
headers,
|
|
830
|
-
data: destinationCreate,
|
|
831
|
-
};
|
|
832
|
-
return transporter.request(request, requestOptions);
|
|
833
|
-
},
|
|
834
|
-
/**
|
|
835
|
-
* Creates a new source.
|
|
836
|
-
*
|
|
837
|
-
* Required API Key ACLs:
|
|
838
|
-
* - addObject
|
|
839
|
-
* - deleteIndex
|
|
840
|
-
* - editSettings.
|
|
841
|
-
*
|
|
842
|
-
* @param sourceCreate -.
|
|
843
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
844
|
-
*/
|
|
845
|
-
createSource(sourceCreate, requestOptions) {
|
|
846
|
-
if (!sourceCreate) {
|
|
847
|
-
throw new Error('Parameter `sourceCreate` is required when calling `createSource`.');
|
|
848
|
-
}
|
|
849
|
-
if (!sourceCreate.type) {
|
|
850
|
-
throw new Error('Parameter `sourceCreate.type` is required when calling `createSource`.');
|
|
851
|
-
}
|
|
852
|
-
if (!sourceCreate.name) {
|
|
853
|
-
throw new Error('Parameter `sourceCreate.name` is required when calling `createSource`.');
|
|
854
|
-
}
|
|
855
|
-
const requestPath = '/1/sources';
|
|
856
|
-
const headers = {};
|
|
857
|
-
const queryParameters = {};
|
|
858
|
-
const request = {
|
|
859
|
-
method: 'POST',
|
|
860
|
-
path: requestPath,
|
|
861
|
-
queryParameters,
|
|
862
|
-
headers,
|
|
863
|
-
data: sourceCreate,
|
|
864
|
-
};
|
|
865
|
-
return transporter.request(request, requestOptions);
|
|
866
|
-
},
|
|
867
|
-
/**
|
|
868
|
-
* Creates a new task.
|
|
869
|
-
*
|
|
870
|
-
* @param taskCreate - Request body for creating a task.
|
|
871
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
872
|
-
*/
|
|
873
|
-
createTask(taskCreate, requestOptions) {
|
|
874
|
-
if (!taskCreate) {
|
|
875
|
-
throw new Error('Parameter `taskCreate` is required when calling `createTask`.');
|
|
876
|
-
}
|
|
877
|
-
if (!taskCreate.sourceID) {
|
|
878
|
-
throw new Error('Parameter `taskCreate.sourceID` is required when calling `createTask`.');
|
|
879
|
-
}
|
|
880
|
-
if (!taskCreate.destinationID) {
|
|
881
|
-
throw new Error('Parameter `taskCreate.destinationID` is required when calling `createTask`.');
|
|
882
|
-
}
|
|
883
|
-
if (!taskCreate.action) {
|
|
884
|
-
throw new Error('Parameter `taskCreate.action` is required when calling `createTask`.');
|
|
885
|
-
}
|
|
886
|
-
const requestPath = '/2/tasks';
|
|
887
|
-
const headers = {};
|
|
888
|
-
const queryParameters = {};
|
|
889
|
-
const request = {
|
|
890
|
-
method: 'POST',
|
|
891
|
-
path: requestPath,
|
|
892
|
-
queryParameters,
|
|
893
|
-
headers,
|
|
894
|
-
data: taskCreate,
|
|
895
|
-
};
|
|
896
|
-
return transporter.request(request, requestOptions);
|
|
897
|
-
},
|
|
898
|
-
/**
|
|
899
|
-
* Creates a new task using the v1 endpoint, please use `createTask` instead.
|
|
900
|
-
*
|
|
901
|
-
* @param taskCreate - Request body for creating a task.
|
|
902
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
903
|
-
*/
|
|
904
|
-
createTaskV1(taskCreate, requestOptions) {
|
|
905
|
-
if (!taskCreate) {
|
|
906
|
-
throw new Error('Parameter `taskCreate` is required when calling `createTaskV1`.');
|
|
907
|
-
}
|
|
908
|
-
if (!taskCreate.sourceID) {
|
|
909
|
-
throw new Error('Parameter `taskCreate.sourceID` is required when calling `createTaskV1`.');
|
|
910
|
-
}
|
|
911
|
-
if (!taskCreate.destinationID) {
|
|
912
|
-
throw new Error('Parameter `taskCreate.destinationID` is required when calling `createTaskV1`.');
|
|
913
|
-
}
|
|
914
|
-
if (!taskCreate.trigger) {
|
|
915
|
-
throw new Error('Parameter `taskCreate.trigger` is required when calling `createTaskV1`.');
|
|
916
|
-
}
|
|
917
|
-
if (!taskCreate.action) {
|
|
918
|
-
throw new Error('Parameter `taskCreate.action` is required when calling `createTaskV1`.');
|
|
919
|
-
}
|
|
920
|
-
const requestPath = '/1/tasks';
|
|
921
|
-
const headers = {};
|
|
922
|
-
const queryParameters = {};
|
|
923
|
-
const request = {
|
|
924
|
-
method: 'POST',
|
|
925
|
-
path: requestPath,
|
|
926
|
-
queryParameters,
|
|
927
|
-
headers,
|
|
928
|
-
data: taskCreate,
|
|
929
|
-
};
|
|
930
|
-
return transporter.request(request, requestOptions);
|
|
931
|
-
},
|
|
932
|
-
/**
|
|
933
|
-
* Creates a new transformation.
|
|
934
|
-
*
|
|
935
|
-
* @param transformationCreate - Request body for creating a transformation.
|
|
936
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
937
|
-
*/
|
|
938
|
-
createTransformation(transformationCreate, requestOptions) {
|
|
939
|
-
if (!transformationCreate) {
|
|
940
|
-
throw new Error('Parameter `transformationCreate` is required when calling `createTransformation`.');
|
|
941
|
-
}
|
|
942
|
-
if (!transformationCreate.code) {
|
|
943
|
-
throw new Error('Parameter `transformationCreate.code` is required when calling `createTransformation`.');
|
|
944
|
-
}
|
|
945
|
-
if (!transformationCreate.name) {
|
|
946
|
-
throw new Error('Parameter `transformationCreate.name` is required when calling `createTransformation`.');
|
|
947
|
-
}
|
|
948
|
-
const requestPath = '/1/transformations';
|
|
949
|
-
const headers = {};
|
|
950
|
-
const queryParameters = {};
|
|
951
|
-
const request = {
|
|
952
|
-
method: 'POST',
|
|
953
|
-
path: requestPath,
|
|
954
|
-
queryParameters,
|
|
955
|
-
headers,
|
|
956
|
-
data: transformationCreate,
|
|
957
|
-
};
|
|
958
|
-
return transporter.request(request, requestOptions);
|
|
959
|
-
},
|
|
960
|
-
/**
|
|
961
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
962
|
-
*
|
|
963
|
-
* @param customDelete - The customDelete object.
|
|
964
|
-
* @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
965
|
-
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
966
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
967
|
-
*/
|
|
968
|
-
customDelete({ path, parameters }, requestOptions) {
|
|
969
|
-
if (!path) {
|
|
970
|
-
throw new Error('Parameter `path` is required when calling `customDelete`.');
|
|
971
|
-
}
|
|
972
|
-
const requestPath = '/{path}'.replace('{path}', path);
|
|
973
|
-
const headers = {};
|
|
974
|
-
const queryParameters = parameters ? parameters : {};
|
|
975
|
-
const request = {
|
|
976
|
-
method: 'DELETE',
|
|
977
|
-
path: requestPath,
|
|
978
|
-
queryParameters,
|
|
979
|
-
headers,
|
|
980
|
-
};
|
|
981
|
-
return transporter.request(request, requestOptions);
|
|
982
|
-
},
|
|
983
|
-
/**
|
|
984
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
985
|
-
*
|
|
986
|
-
* @param customGet - The customGet object.
|
|
987
|
-
* @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
988
|
-
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
989
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
990
|
-
*/
|
|
991
|
-
customGet({ path, parameters }, requestOptions) {
|
|
992
|
-
if (!path) {
|
|
993
|
-
throw new Error('Parameter `path` is required when calling `customGet`.');
|
|
994
|
-
}
|
|
995
|
-
const requestPath = '/{path}'.replace('{path}', path);
|
|
996
|
-
const headers = {};
|
|
997
|
-
const queryParameters = parameters ? parameters : {};
|
|
998
|
-
const request = {
|
|
999
|
-
method: 'GET',
|
|
1000
|
-
path: requestPath,
|
|
1001
|
-
queryParameters,
|
|
1002
|
-
headers,
|
|
1003
|
-
};
|
|
1004
|
-
return transporter.request(request, requestOptions);
|
|
1005
|
-
},
|
|
1006
|
-
/**
|
|
1007
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
1008
|
-
*
|
|
1009
|
-
* @param customPost - The customPost object.
|
|
1010
|
-
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
1011
|
-
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
1012
|
-
* @param customPost.body - Parameters to send with the custom request.
|
|
1013
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1014
|
-
*/
|
|
1015
|
-
customPost({ path, parameters, body }, requestOptions) {
|
|
1016
|
-
if (!path) {
|
|
1017
|
-
throw new Error('Parameter `path` is required when calling `customPost`.');
|
|
1018
|
-
}
|
|
1019
|
-
const requestPath = '/{path}'.replace('{path}', path);
|
|
1020
|
-
const headers = {};
|
|
1021
|
-
const queryParameters = parameters ? parameters : {};
|
|
1022
|
-
const request = {
|
|
1023
|
-
method: 'POST',
|
|
1024
|
-
path: requestPath,
|
|
1025
|
-
queryParameters,
|
|
1026
|
-
headers,
|
|
1027
|
-
data: body ? body : {},
|
|
1028
|
-
};
|
|
1029
|
-
return transporter.request(request, requestOptions);
|
|
1030
|
-
},
|
|
1031
|
-
/**
|
|
1032
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
1033
|
-
*
|
|
1034
|
-
* @param customPut - The customPut object.
|
|
1035
|
-
* @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
1036
|
-
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
1037
|
-
* @param customPut.body - Parameters to send with the custom request.
|
|
1038
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1039
|
-
*/
|
|
1040
|
-
customPut({ path, parameters, body }, requestOptions) {
|
|
1041
|
-
if (!path) {
|
|
1042
|
-
throw new Error('Parameter `path` is required when calling `customPut`.');
|
|
1043
|
-
}
|
|
1044
|
-
const requestPath = '/{path}'.replace('{path}', path);
|
|
1045
|
-
const headers = {};
|
|
1046
|
-
const queryParameters = parameters ? parameters : {};
|
|
1047
|
-
const request = {
|
|
1048
|
-
method: 'PUT',
|
|
1049
|
-
path: requestPath,
|
|
1050
|
-
queryParameters,
|
|
1051
|
-
headers,
|
|
1052
|
-
data: body ? body : {},
|
|
1053
|
-
};
|
|
1054
|
-
return transporter.request(request, requestOptions);
|
|
1055
|
-
},
|
|
1056
|
-
/**
|
|
1057
|
-
* Deletes an authentication resource. You can\'t delete authentication resources that are used by a source or a destination.
|
|
1058
|
-
*
|
|
1059
|
-
* Required API Key ACLs:
|
|
1060
|
-
* - addObject
|
|
1061
|
-
* - deleteIndex
|
|
1062
|
-
* - editSettings.
|
|
1063
|
-
*
|
|
1064
|
-
* @param deleteAuthentication - The deleteAuthentication object.
|
|
1065
|
-
* @param deleteAuthentication.authenticationID - Unique identifier of an authentication resource.
|
|
1066
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1067
|
-
*/
|
|
1068
|
-
deleteAuthentication({ authenticationID }, requestOptions) {
|
|
1069
|
-
if (!authenticationID) {
|
|
1070
|
-
throw new Error('Parameter `authenticationID` is required when calling `deleteAuthentication`.');
|
|
1071
|
-
}
|
|
1072
|
-
const requestPath = '/1/authentications/{authenticationID}'.replace('{authenticationID}', encodeURIComponent(authenticationID));
|
|
1073
|
-
const headers = {};
|
|
1074
|
-
const queryParameters = {};
|
|
1075
|
-
const request = {
|
|
1076
|
-
method: 'DELETE',
|
|
1077
|
-
path: requestPath,
|
|
1078
|
-
queryParameters,
|
|
1079
|
-
headers,
|
|
1080
|
-
};
|
|
1081
|
-
return transporter.request(request, requestOptions);
|
|
1082
|
-
},
|
|
1083
|
-
/**
|
|
1084
|
-
* Deletes a destination by its ID. You can\'t delete destinations that are referenced in tasks.
|
|
1085
|
-
*
|
|
1086
|
-
* Required API Key ACLs:
|
|
1087
|
-
* - addObject
|
|
1088
|
-
* - deleteIndex
|
|
1089
|
-
* - editSettings.
|
|
1090
|
-
*
|
|
1091
|
-
* @param deleteDestination - The deleteDestination object.
|
|
1092
|
-
* @param deleteDestination.destinationID - Unique identifier of a destination.
|
|
1093
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1094
|
-
*/
|
|
1095
|
-
deleteDestination({ destinationID }, requestOptions) {
|
|
1096
|
-
if (!destinationID) {
|
|
1097
|
-
throw new Error('Parameter `destinationID` is required when calling `deleteDestination`.');
|
|
1098
|
-
}
|
|
1099
|
-
const requestPath = '/1/destinations/{destinationID}'.replace('{destinationID}', encodeURIComponent(destinationID));
|
|
1100
|
-
const headers = {};
|
|
1101
|
-
const queryParameters = {};
|
|
1102
|
-
const request = {
|
|
1103
|
-
method: 'DELETE',
|
|
1104
|
-
path: requestPath,
|
|
1105
|
-
queryParameters,
|
|
1106
|
-
headers,
|
|
1107
|
-
};
|
|
1108
|
-
return transporter.request(request, requestOptions);
|
|
1109
|
-
},
|
|
1110
|
-
/**
|
|
1111
|
-
* Deletes a source by its ID. You can\'t delete sources that are referenced in tasks.
|
|
1112
|
-
*
|
|
1113
|
-
* Required API Key ACLs:
|
|
1114
|
-
* - addObject
|
|
1115
|
-
* - deleteIndex
|
|
1116
|
-
* - editSettings.
|
|
1117
|
-
*
|
|
1118
|
-
* @param deleteSource - The deleteSource object.
|
|
1119
|
-
* @param deleteSource.sourceID - Unique identifier of a source.
|
|
1120
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1121
|
-
*/
|
|
1122
|
-
deleteSource({ sourceID }, requestOptions) {
|
|
1123
|
-
if (!sourceID) {
|
|
1124
|
-
throw new Error('Parameter `sourceID` is required when calling `deleteSource`.');
|
|
1125
|
-
}
|
|
1126
|
-
const requestPath = '/1/sources/{sourceID}'.replace('{sourceID}', encodeURIComponent(sourceID));
|
|
1127
|
-
const headers = {};
|
|
1128
|
-
const queryParameters = {};
|
|
1129
|
-
const request = {
|
|
1130
|
-
method: 'DELETE',
|
|
1131
|
-
path: requestPath,
|
|
1132
|
-
queryParameters,
|
|
1133
|
-
headers,
|
|
1134
|
-
};
|
|
1135
|
-
return transporter.request(request, requestOptions);
|
|
1136
|
-
},
|
|
1137
|
-
/**
|
|
1138
|
-
* Deletes a task by its ID.
|
|
1139
|
-
*
|
|
1140
|
-
* @param deleteTask - The deleteTask object.
|
|
1141
|
-
* @param deleteTask.taskID - Unique identifier of a task.
|
|
1142
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1143
|
-
*/
|
|
1144
|
-
deleteTask({ taskID }, requestOptions) {
|
|
1145
|
-
if (!taskID) {
|
|
1146
|
-
throw new Error('Parameter `taskID` is required when calling `deleteTask`.');
|
|
1147
|
-
}
|
|
1148
|
-
const requestPath = '/2/tasks/{taskID}'.replace('{taskID}', encodeURIComponent(taskID));
|
|
1149
|
-
const headers = {};
|
|
1150
|
-
const queryParameters = {};
|
|
1151
|
-
const request = {
|
|
1152
|
-
method: 'DELETE',
|
|
1153
|
-
path: requestPath,
|
|
1154
|
-
queryParameters,
|
|
1155
|
-
headers,
|
|
1156
|
-
};
|
|
1157
|
-
return transporter.request(request, requestOptions);
|
|
1158
|
-
},
|
|
1159
|
-
/**
|
|
1160
|
-
* Deletes a task by its ID using the v1 endpoint, please use `deleteTask` instead.
|
|
1161
|
-
*
|
|
1162
|
-
* @param deleteTaskV1 - The deleteTaskV1 object.
|
|
1163
|
-
* @param deleteTaskV1.taskID - Unique identifier of a task.
|
|
1164
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1165
|
-
*/
|
|
1166
|
-
deleteTaskV1({ taskID }, requestOptions) {
|
|
1167
|
-
if (!taskID) {
|
|
1168
|
-
throw new Error('Parameter `taskID` is required when calling `deleteTaskV1`.');
|
|
1169
|
-
}
|
|
1170
|
-
const requestPath = '/1/tasks/{taskID}'.replace('{taskID}', encodeURIComponent(taskID));
|
|
1171
|
-
const headers = {};
|
|
1172
|
-
const queryParameters = {};
|
|
1173
|
-
const request = {
|
|
1174
|
-
method: 'DELETE',
|
|
1175
|
-
path: requestPath,
|
|
1176
|
-
queryParameters,
|
|
1177
|
-
headers,
|
|
1178
|
-
};
|
|
1179
|
-
return transporter.request(request, requestOptions);
|
|
1180
|
-
},
|
|
1181
|
-
/**
|
|
1182
|
-
* Deletes a transformation by its ID.
|
|
1183
|
-
*
|
|
1184
|
-
* @param deleteTransformation - The deleteTransformation object.
|
|
1185
|
-
* @param deleteTransformation.transformationID - Unique identifier of a transformation.
|
|
1186
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1187
|
-
*/
|
|
1188
|
-
deleteTransformation({ transformationID }, requestOptions) {
|
|
1189
|
-
if (!transformationID) {
|
|
1190
|
-
throw new Error('Parameter `transformationID` is required when calling `deleteTransformation`.');
|
|
1191
|
-
}
|
|
1192
|
-
const requestPath = '/1/transformations/{transformationID}'.replace('{transformationID}', encodeURIComponent(transformationID));
|
|
1193
|
-
const headers = {};
|
|
1194
|
-
const queryParameters = {};
|
|
1195
|
-
const request = {
|
|
1196
|
-
method: 'DELETE',
|
|
1197
|
-
path: requestPath,
|
|
1198
|
-
queryParameters,
|
|
1199
|
-
headers,
|
|
1200
|
-
};
|
|
1201
|
-
return transporter.request(request, requestOptions);
|
|
1202
|
-
},
|
|
1203
|
-
/**
|
|
1204
|
-
* Disables a task.
|
|
1205
|
-
*
|
|
1206
|
-
* Required API Key ACLs:
|
|
1207
|
-
* - addObject
|
|
1208
|
-
* - deleteIndex
|
|
1209
|
-
* - editSettings.
|
|
1210
|
-
*
|
|
1211
|
-
* @param disableTask - The disableTask object.
|
|
1212
|
-
* @param disableTask.taskID - Unique identifier of a task.
|
|
1213
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1214
|
-
*/
|
|
1215
|
-
disableTask({ taskID }, requestOptions) {
|
|
1216
|
-
if (!taskID) {
|
|
1217
|
-
throw new Error('Parameter `taskID` is required when calling `disableTask`.');
|
|
1218
|
-
}
|
|
1219
|
-
const requestPath = '/2/tasks/{taskID}/disable'.replace('{taskID}', encodeURIComponent(taskID));
|
|
1220
|
-
const headers = {};
|
|
1221
|
-
const queryParameters = {};
|
|
1222
|
-
const request = {
|
|
1223
|
-
method: 'PUT',
|
|
1224
|
-
path: requestPath,
|
|
1225
|
-
queryParameters,
|
|
1226
|
-
headers,
|
|
1227
|
-
};
|
|
1228
|
-
return transporter.request(request, requestOptions);
|
|
1229
|
-
},
|
|
1230
|
-
/**
|
|
1231
|
-
* Disables a task using the v1 endpoint, please use `disableTask` instead.
|
|
1232
|
-
*
|
|
1233
|
-
* Required API Key ACLs:
|
|
1234
|
-
* - addObject
|
|
1235
|
-
* - deleteIndex
|
|
1236
|
-
* - editSettings.
|
|
1237
|
-
*
|
|
1238
|
-
* @param disableTaskV1 - The disableTaskV1 object.
|
|
1239
|
-
* @param disableTaskV1.taskID - Unique identifier of a task.
|
|
1240
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1241
|
-
*/
|
|
1242
|
-
disableTaskV1({ taskID }, requestOptions) {
|
|
1243
|
-
if (!taskID) {
|
|
1244
|
-
throw new Error('Parameter `taskID` is required when calling `disableTaskV1`.');
|
|
1245
|
-
}
|
|
1246
|
-
const requestPath = '/1/tasks/{taskID}/disable'.replace('{taskID}', encodeURIComponent(taskID));
|
|
1247
|
-
const headers = {};
|
|
1248
|
-
const queryParameters = {};
|
|
1249
|
-
const request = {
|
|
1250
|
-
method: 'PUT',
|
|
1251
|
-
path: requestPath,
|
|
1252
|
-
queryParameters,
|
|
1253
|
-
headers,
|
|
1254
|
-
};
|
|
1255
|
-
return transporter.request(request, requestOptions);
|
|
1256
|
-
},
|
|
1257
|
-
/**
|
|
1258
|
-
* Enables a task.
|
|
1259
|
-
*
|
|
1260
|
-
* Required API Key ACLs:
|
|
1261
|
-
* - addObject
|
|
1262
|
-
* - deleteIndex
|
|
1263
|
-
* - editSettings.
|
|
1264
|
-
*
|
|
1265
|
-
* @param enableTask - The enableTask object.
|
|
1266
|
-
* @param enableTask.taskID - Unique identifier of a task.
|
|
1267
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1268
|
-
*/
|
|
1269
|
-
enableTask({ taskID }, requestOptions) {
|
|
1270
|
-
if (!taskID) {
|
|
1271
|
-
throw new Error('Parameter `taskID` is required when calling `enableTask`.');
|
|
1272
|
-
}
|
|
1273
|
-
const requestPath = '/2/tasks/{taskID}/enable'.replace('{taskID}', encodeURIComponent(taskID));
|
|
1274
|
-
const headers = {};
|
|
1275
|
-
const queryParameters = {};
|
|
1276
|
-
const request = {
|
|
1277
|
-
method: 'PUT',
|
|
1278
|
-
path: requestPath,
|
|
1279
|
-
queryParameters,
|
|
1280
|
-
headers,
|
|
1281
|
-
};
|
|
1282
|
-
return transporter.request(request, requestOptions);
|
|
1283
|
-
},
|
|
1284
|
-
/**
|
|
1285
|
-
* Enables a task using the v1 endpoint, please use `enableTask` instead.
|
|
1286
|
-
*
|
|
1287
|
-
* Required API Key ACLs:
|
|
1288
|
-
* - addObject
|
|
1289
|
-
* - deleteIndex
|
|
1290
|
-
* - editSettings.
|
|
1291
|
-
*
|
|
1292
|
-
* @param enableTaskV1 - The enableTaskV1 object.
|
|
1293
|
-
* @param enableTaskV1.taskID - Unique identifier of a task.
|
|
1294
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1295
|
-
*/
|
|
1296
|
-
enableTaskV1({ taskID }, requestOptions) {
|
|
1297
|
-
if (!taskID) {
|
|
1298
|
-
throw new Error('Parameter `taskID` is required when calling `enableTaskV1`.');
|
|
1299
|
-
}
|
|
1300
|
-
const requestPath = '/1/tasks/{taskID}/enable'.replace('{taskID}', encodeURIComponent(taskID));
|
|
1301
|
-
const headers = {};
|
|
1302
|
-
const queryParameters = {};
|
|
1303
|
-
const request = {
|
|
1304
|
-
method: 'PUT',
|
|
1305
|
-
path: requestPath,
|
|
1306
|
-
queryParameters,
|
|
1307
|
-
headers,
|
|
1308
|
-
};
|
|
1309
|
-
return transporter.request(request, requestOptions);
|
|
1310
|
-
},
|
|
1311
|
-
/**
|
|
1312
|
-
* Generates code for the selected model based on the given prompt.
|
|
1313
|
-
*
|
|
1314
|
-
* Required API Key ACLs:
|
|
1315
|
-
* - addObject
|
|
1316
|
-
* - deleteIndex
|
|
1317
|
-
* - editSettings.
|
|
1318
|
-
*
|
|
1319
|
-
* @param generateTransformationCodePayload - The generateTransformationCodePayload object.
|
|
1320
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1321
|
-
*/
|
|
1322
|
-
generateTransformationCode(generateTransformationCodePayload, requestOptions) {
|
|
1323
|
-
if (!generateTransformationCodePayload) {
|
|
1324
|
-
throw new Error('Parameter `generateTransformationCodePayload` is required when calling `generateTransformationCode`.');
|
|
1325
|
-
}
|
|
1326
|
-
if (!generateTransformationCodePayload.id) {
|
|
1327
|
-
throw new Error('Parameter `generateTransformationCodePayload.id` is required when calling `generateTransformationCode`.');
|
|
1328
|
-
}
|
|
1329
|
-
if (!generateTransformationCodePayload.userPrompt) {
|
|
1330
|
-
throw new Error('Parameter `generateTransformationCodePayload.userPrompt` is required when calling `generateTransformationCode`.');
|
|
1331
|
-
}
|
|
1332
|
-
const requestPath = '/1/transformations/models';
|
|
1333
|
-
const headers = {};
|
|
1334
|
-
const queryParameters = {};
|
|
1335
|
-
const request = {
|
|
1336
|
-
method: 'POST',
|
|
1337
|
-
path: requestPath,
|
|
1338
|
-
queryParameters,
|
|
1339
|
-
headers,
|
|
1340
|
-
data: generateTransformationCodePayload,
|
|
1341
|
-
};
|
|
1342
|
-
return transporter.request(request, requestOptions);
|
|
1343
|
-
},
|
|
1344
|
-
/**
|
|
1345
|
-
* Retrieves an authentication resource by its ID.
|
|
1346
|
-
*
|
|
1347
|
-
* Required API Key ACLs:
|
|
1348
|
-
* - addObject
|
|
1349
|
-
* - deleteIndex
|
|
1350
|
-
* - editSettings.
|
|
1351
|
-
*
|
|
1352
|
-
* @param getAuthentication - The getAuthentication object.
|
|
1353
|
-
* @param getAuthentication.authenticationID - Unique identifier of an authentication resource.
|
|
1354
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1355
|
-
*/
|
|
1356
|
-
getAuthentication({ authenticationID }, requestOptions) {
|
|
1357
|
-
if (!authenticationID) {
|
|
1358
|
-
throw new Error('Parameter `authenticationID` is required when calling `getAuthentication`.');
|
|
1359
|
-
}
|
|
1360
|
-
const requestPath = '/1/authentications/{authenticationID}'.replace('{authenticationID}', encodeURIComponent(authenticationID));
|
|
1361
|
-
const headers = {};
|
|
1362
|
-
const queryParameters = {};
|
|
1363
|
-
const request = {
|
|
1364
|
-
method: 'GET',
|
|
1365
|
-
path: requestPath,
|
|
1366
|
-
queryParameters,
|
|
1367
|
-
headers,
|
|
1368
|
-
};
|
|
1369
|
-
return transporter.request(request, requestOptions);
|
|
1370
|
-
},
|
|
1371
|
-
/**
|
|
1372
|
-
* Retrieves a destination by its ID.
|
|
1373
|
-
*
|
|
1374
|
-
* Required API Key ACLs:
|
|
1375
|
-
* - addObject
|
|
1376
|
-
* - deleteIndex
|
|
1377
|
-
* - editSettings.
|
|
1378
|
-
*
|
|
1379
|
-
* @param getDestination - The getDestination object.
|
|
1380
|
-
* @param getDestination.destinationID - Unique identifier of a destination.
|
|
1381
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1382
|
-
*/
|
|
1383
|
-
getDestination({ destinationID }, requestOptions) {
|
|
1384
|
-
if (!destinationID) {
|
|
1385
|
-
throw new Error('Parameter `destinationID` is required when calling `getDestination`.');
|
|
1386
|
-
}
|
|
1387
|
-
const requestPath = '/1/destinations/{destinationID}'.replace('{destinationID}', encodeURIComponent(destinationID));
|
|
1388
|
-
const headers = {};
|
|
1389
|
-
const queryParameters = {};
|
|
1390
|
-
const request = {
|
|
1391
|
-
method: 'GET',
|
|
1392
|
-
path: requestPath,
|
|
1393
|
-
queryParameters,
|
|
1394
|
-
headers,
|
|
1395
|
-
};
|
|
1396
|
-
return transporter.request(request, requestOptions);
|
|
1397
|
-
},
|
|
1398
|
-
/**
|
|
1399
|
-
* Retrieves a single task run event by its ID.
|
|
1400
|
-
*
|
|
1401
|
-
* Required API Key ACLs:
|
|
1402
|
-
* - addObject
|
|
1403
|
-
* - deleteIndex
|
|
1404
|
-
* - editSettings.
|
|
1405
|
-
*
|
|
1406
|
-
* @param getEvent - The getEvent object.
|
|
1407
|
-
* @param getEvent.runID - Unique identifier of a task run.
|
|
1408
|
-
* @param getEvent.eventID - Unique identifier of an event.
|
|
1409
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1410
|
-
*/
|
|
1411
|
-
getEvent({ runID, eventID }, requestOptions) {
|
|
1412
|
-
if (!runID) {
|
|
1413
|
-
throw new Error('Parameter `runID` is required when calling `getEvent`.');
|
|
1414
|
-
}
|
|
1415
|
-
if (!eventID) {
|
|
1416
|
-
throw new Error('Parameter `eventID` is required when calling `getEvent`.');
|
|
1417
|
-
}
|
|
1418
|
-
const requestPath = '/1/runs/{runID}/events/{eventID}'
|
|
1419
|
-
.replace('{runID}', encodeURIComponent(runID))
|
|
1420
|
-
.replace('{eventID}', encodeURIComponent(eventID));
|
|
1421
|
-
const headers = {};
|
|
1422
|
-
const queryParameters = {};
|
|
1423
|
-
const request = {
|
|
1424
|
-
method: 'GET',
|
|
1425
|
-
path: requestPath,
|
|
1426
|
-
queryParameters,
|
|
1427
|
-
headers,
|
|
1428
|
-
};
|
|
1429
|
-
return transporter.request(request, requestOptions);
|
|
1430
|
-
},
|
|
1431
|
-
/**
|
|
1432
|
-
* Retrieve a single task run by its ID.
|
|
1433
|
-
*
|
|
1434
|
-
* Required API Key ACLs:
|
|
1435
|
-
* - addObject
|
|
1436
|
-
* - deleteIndex
|
|
1437
|
-
* - editSettings.
|
|
1438
|
-
*
|
|
1439
|
-
* @param getRun - The getRun object.
|
|
1440
|
-
* @param getRun.runID - Unique identifier of a task run.
|
|
1441
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1442
|
-
*/
|
|
1443
|
-
getRun({ runID }, requestOptions) {
|
|
1444
|
-
if (!runID) {
|
|
1445
|
-
throw new Error('Parameter `runID` is required when calling `getRun`.');
|
|
1446
|
-
}
|
|
1447
|
-
const requestPath = '/1/runs/{runID}'.replace('{runID}', encodeURIComponent(runID));
|
|
1448
|
-
const headers = {};
|
|
1449
|
-
const queryParameters = {};
|
|
1450
|
-
const request = {
|
|
1451
|
-
method: 'GET',
|
|
1452
|
-
path: requestPath,
|
|
1453
|
-
queryParameters,
|
|
1454
|
-
headers,
|
|
1455
|
-
};
|
|
1456
|
-
return transporter.request(request, requestOptions);
|
|
1457
|
-
},
|
|
1458
|
-
/**
|
|
1459
|
-
* Retrieve a source by its ID.
|
|
1460
|
-
*
|
|
1461
|
-
* Required API Key ACLs:
|
|
1462
|
-
* - addObject
|
|
1463
|
-
* - deleteIndex
|
|
1464
|
-
* - editSettings.
|
|
1465
|
-
*
|
|
1466
|
-
* @param getSource - The getSource object.
|
|
1467
|
-
* @param getSource.sourceID - Unique identifier of a source.
|
|
1468
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1469
|
-
*/
|
|
1470
|
-
getSource({ sourceID }, requestOptions) {
|
|
1471
|
-
if (!sourceID) {
|
|
1472
|
-
throw new Error('Parameter `sourceID` is required when calling `getSource`.');
|
|
1473
|
-
}
|
|
1474
|
-
const requestPath = '/1/sources/{sourceID}'.replace('{sourceID}', encodeURIComponent(sourceID));
|
|
1475
|
-
const headers = {};
|
|
1476
|
-
const queryParameters = {};
|
|
1477
|
-
const request = {
|
|
1478
|
-
method: 'GET',
|
|
1479
|
-
path: requestPath,
|
|
1480
|
-
queryParameters,
|
|
1481
|
-
headers,
|
|
1482
|
-
};
|
|
1483
|
-
return transporter.request(request, requestOptions);
|
|
1484
|
-
},
|
|
1485
|
-
/**
|
|
1486
|
-
* Retrieves a task by its ID.
|
|
1487
|
-
*
|
|
1488
|
-
* Required API Key ACLs:
|
|
1489
|
-
* - addObject
|
|
1490
|
-
* - deleteIndex
|
|
1491
|
-
* - editSettings.
|
|
1492
|
-
*
|
|
1493
|
-
* @param getTask - The getTask object.
|
|
1494
|
-
* @param getTask.taskID - Unique identifier of a task.
|
|
1495
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1496
|
-
*/
|
|
1497
|
-
getTask({ taskID }, requestOptions) {
|
|
1498
|
-
if (!taskID) {
|
|
1499
|
-
throw new Error('Parameter `taskID` is required when calling `getTask`.');
|
|
1500
|
-
}
|
|
1501
|
-
const requestPath = '/2/tasks/{taskID}'.replace('{taskID}', encodeURIComponent(taskID));
|
|
1502
|
-
const headers = {};
|
|
1503
|
-
const queryParameters = {};
|
|
1504
|
-
const request = {
|
|
1505
|
-
method: 'GET',
|
|
1506
|
-
path: requestPath,
|
|
1507
|
-
queryParameters,
|
|
1508
|
-
headers,
|
|
1509
|
-
};
|
|
1510
|
-
return transporter.request(request, requestOptions);
|
|
1511
|
-
},
|
|
1512
|
-
/**
|
|
1513
|
-
* Retrieves a task by its ID using the v1 endpoint, please use `getTask` instead.
|
|
1514
|
-
*
|
|
1515
|
-
* Required API Key ACLs:
|
|
1516
|
-
* - addObject
|
|
1517
|
-
* - deleteIndex
|
|
1518
|
-
* - editSettings.
|
|
1519
|
-
*
|
|
1520
|
-
* @param getTaskV1 - The getTaskV1 object.
|
|
1521
|
-
* @param getTaskV1.taskID - Unique identifier of a task.
|
|
1522
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1523
|
-
*/
|
|
1524
|
-
getTaskV1({ taskID }, requestOptions) {
|
|
1525
|
-
if (!taskID) {
|
|
1526
|
-
throw new Error('Parameter `taskID` is required when calling `getTaskV1`.');
|
|
1527
|
-
}
|
|
1528
|
-
const requestPath = '/1/tasks/{taskID}'.replace('{taskID}', encodeURIComponent(taskID));
|
|
1529
|
-
const headers = {};
|
|
1530
|
-
const queryParameters = {};
|
|
1531
|
-
const request = {
|
|
1532
|
-
method: 'GET',
|
|
1533
|
-
path: requestPath,
|
|
1534
|
-
queryParameters,
|
|
1535
|
-
headers,
|
|
1536
|
-
};
|
|
1537
|
-
return transporter.request(request, requestOptions);
|
|
1538
|
-
},
|
|
1539
|
-
/**
|
|
1540
|
-
* Retrieves a transformation by its ID.
|
|
1541
|
-
*
|
|
1542
|
-
* Required API Key ACLs:
|
|
1543
|
-
* - addObject
|
|
1544
|
-
* - deleteIndex
|
|
1545
|
-
* - editSettings.
|
|
1546
|
-
*
|
|
1547
|
-
* @param getTransformation - The getTransformation object.
|
|
1548
|
-
* @param getTransformation.transformationID - Unique identifier of a transformation.
|
|
1549
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1550
|
-
*/
|
|
1551
|
-
getTransformation({ transformationID }, requestOptions) {
|
|
1552
|
-
if (!transformationID) {
|
|
1553
|
-
throw new Error('Parameter `transformationID` is required when calling `getTransformation`.');
|
|
1554
|
-
}
|
|
1555
|
-
const requestPath = '/1/transformations/{transformationID}'.replace('{transformationID}', encodeURIComponent(transformationID));
|
|
1556
|
-
const headers = {};
|
|
1557
|
-
const queryParameters = {};
|
|
1558
|
-
const request = {
|
|
1559
|
-
method: 'GET',
|
|
1560
|
-
path: requestPath,
|
|
1561
|
-
queryParameters,
|
|
1562
|
-
headers,
|
|
1563
|
-
};
|
|
1564
|
-
return transporter.request(request, requestOptions);
|
|
1565
|
-
},
|
|
1566
|
-
/**
|
|
1567
|
-
* Retrieves a list of all authentication resources.
|
|
1568
|
-
*
|
|
1569
|
-
* Required API Key ACLs:
|
|
1570
|
-
* - addObject
|
|
1571
|
-
* - deleteIndex
|
|
1572
|
-
* - editSettings.
|
|
1573
|
-
*
|
|
1574
|
-
* @param listAuthentications - The listAuthentications object.
|
|
1575
|
-
* @param listAuthentications.itemsPerPage - Number of items per page.
|
|
1576
|
-
* @param listAuthentications.page - Page number of the paginated API response.
|
|
1577
|
-
* @param listAuthentications.type - Type of authentication resource to retrieve.
|
|
1578
|
-
* @param listAuthentications.platform - Ecommerce platform for which to retrieve authentication resources.
|
|
1579
|
-
* @param listAuthentications.sort - Property by which to sort the list of authentication resources.
|
|
1580
|
-
* @param listAuthentications.order - Sort order of the response, ascending or descending.
|
|
1581
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1582
|
-
*/
|
|
1583
|
-
listAuthentications({ itemsPerPage, page, type, platform, sort, order } = {}, requestOptions = undefined) {
|
|
1584
|
-
const requestPath = '/1/authentications';
|
|
1585
|
-
const headers = {};
|
|
1586
|
-
const queryParameters = {};
|
|
1587
|
-
if (itemsPerPage !== undefined) {
|
|
1588
|
-
queryParameters.itemsPerPage = itemsPerPage.toString();
|
|
1589
|
-
}
|
|
1590
|
-
if (page !== undefined) {
|
|
1591
|
-
queryParameters.page = page.toString();
|
|
1592
|
-
}
|
|
1593
|
-
if (type !== undefined) {
|
|
1594
|
-
queryParameters.type = type.toString();
|
|
1595
|
-
}
|
|
1596
|
-
if (platform !== undefined) {
|
|
1597
|
-
queryParameters.platform = platform.toString();
|
|
1598
|
-
}
|
|
1599
|
-
if (sort !== undefined) {
|
|
1600
|
-
queryParameters.sort = sort.toString();
|
|
1601
|
-
}
|
|
1602
|
-
if (order !== undefined) {
|
|
1603
|
-
queryParameters.order = order.toString();
|
|
1604
|
-
}
|
|
1605
|
-
const request = {
|
|
1606
|
-
method: 'GET',
|
|
1607
|
-
path: requestPath,
|
|
1608
|
-
queryParameters,
|
|
1609
|
-
headers,
|
|
1610
|
-
};
|
|
1611
|
-
return transporter.request(request, requestOptions);
|
|
1612
|
-
},
|
|
1613
|
-
/**
|
|
1614
|
-
* Retrieves a list of destinations.
|
|
1615
|
-
*
|
|
1616
|
-
* Required API Key ACLs:
|
|
1617
|
-
* - addObject
|
|
1618
|
-
* - deleteIndex
|
|
1619
|
-
* - editSettings.
|
|
1620
|
-
*
|
|
1621
|
-
* @param listDestinations - The listDestinations object.
|
|
1622
|
-
* @param listDestinations.itemsPerPage - Number of items per page.
|
|
1623
|
-
* @param listDestinations.page - Page number of the paginated API response.
|
|
1624
|
-
* @param listDestinations.type - Destination type.
|
|
1625
|
-
* @param listDestinations.authenticationID - Authentication ID used by destinations.
|
|
1626
|
-
* @param listDestinations.sort - Property by which to sort the destinations.
|
|
1627
|
-
* @param listDestinations.order - Sort order of the response, ascending or descending.
|
|
1628
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1629
|
-
*/
|
|
1630
|
-
listDestinations({ itemsPerPage, page, type, authenticationID, sort, order } = {}, requestOptions = undefined) {
|
|
1631
|
-
const requestPath = '/1/destinations';
|
|
1632
|
-
const headers = {};
|
|
1633
|
-
const queryParameters = {};
|
|
1634
|
-
if (itemsPerPage !== undefined) {
|
|
1635
|
-
queryParameters.itemsPerPage = itemsPerPage.toString();
|
|
1636
|
-
}
|
|
1637
|
-
if (page !== undefined) {
|
|
1638
|
-
queryParameters.page = page.toString();
|
|
1639
|
-
}
|
|
1640
|
-
if (type !== undefined) {
|
|
1641
|
-
queryParameters.type = type.toString();
|
|
1642
|
-
}
|
|
1643
|
-
if (authenticationID !== undefined) {
|
|
1644
|
-
queryParameters.authenticationID = authenticationID.toString();
|
|
1645
|
-
}
|
|
1646
|
-
if (sort !== undefined) {
|
|
1647
|
-
queryParameters.sort = sort.toString();
|
|
1648
|
-
}
|
|
1649
|
-
if (order !== undefined) {
|
|
1650
|
-
queryParameters.order = order.toString();
|
|
1651
|
-
}
|
|
1652
|
-
const request = {
|
|
1653
|
-
method: 'GET',
|
|
1654
|
-
path: requestPath,
|
|
1655
|
-
queryParameters,
|
|
1656
|
-
headers,
|
|
1657
|
-
};
|
|
1658
|
-
return transporter.request(request, requestOptions);
|
|
1659
|
-
},
|
|
1660
|
-
/**
|
|
1661
|
-
* Retrieves a list of events for a task run, identified by it\'s ID.
|
|
1662
|
-
*
|
|
1663
|
-
* Required API Key ACLs:
|
|
1664
|
-
* - addObject
|
|
1665
|
-
* - deleteIndex
|
|
1666
|
-
* - editSettings.
|
|
1667
|
-
*
|
|
1668
|
-
* @param listEvents - The listEvents object.
|
|
1669
|
-
* @param listEvents.runID - Unique identifier of a task run.
|
|
1670
|
-
* @param listEvents.itemsPerPage - Number of items per page.
|
|
1671
|
-
* @param listEvents.page - Page number of the paginated API response.
|
|
1672
|
-
* @param listEvents.status - Event status for filtering the list of task runs.
|
|
1673
|
-
* @param listEvents.type - Event type for filtering the list of task runs.
|
|
1674
|
-
* @param listEvents.sort - Property by which to sort the list of task run events.
|
|
1675
|
-
* @param listEvents.order - Sort order of the response, ascending or descending.
|
|
1676
|
-
* @param listEvents.startDate - Date and time in RFC 3339 format for the earliest events to retrieve. By default, the current time minus three hours is used.
|
|
1677
|
-
* @param listEvents.endDate - Date and time in RFC 3339 format for the latest events to retrieve. By default, the current time is used.
|
|
1678
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1679
|
-
*/
|
|
1680
|
-
listEvents({ runID, itemsPerPage, page, status, type, sort, order, startDate, endDate }, requestOptions) {
|
|
1681
|
-
if (!runID) {
|
|
1682
|
-
throw new Error('Parameter `runID` is required when calling `listEvents`.');
|
|
1683
|
-
}
|
|
1684
|
-
const requestPath = '/1/runs/{runID}/events'.replace('{runID}', encodeURIComponent(runID));
|
|
1685
|
-
const headers = {};
|
|
1686
|
-
const queryParameters = {};
|
|
1687
|
-
if (itemsPerPage !== undefined) {
|
|
1688
|
-
queryParameters.itemsPerPage = itemsPerPage.toString();
|
|
1689
|
-
}
|
|
1690
|
-
if (page !== undefined) {
|
|
1691
|
-
queryParameters.page = page.toString();
|
|
1692
|
-
}
|
|
1693
|
-
if (status !== undefined) {
|
|
1694
|
-
queryParameters.status = status.toString();
|
|
1695
|
-
}
|
|
1696
|
-
if (type !== undefined) {
|
|
1697
|
-
queryParameters.type = type.toString();
|
|
1698
|
-
}
|
|
1699
|
-
if (sort !== undefined) {
|
|
1700
|
-
queryParameters.sort = sort.toString();
|
|
1701
|
-
}
|
|
1702
|
-
if (order !== undefined) {
|
|
1703
|
-
queryParameters.order = order.toString();
|
|
1704
|
-
}
|
|
1705
|
-
if (startDate !== undefined) {
|
|
1706
|
-
queryParameters.startDate = startDate.toString();
|
|
1707
|
-
}
|
|
1708
|
-
if (endDate !== undefined) {
|
|
1709
|
-
queryParameters.endDate = endDate.toString();
|
|
1710
|
-
}
|
|
1711
|
-
const request = {
|
|
1712
|
-
method: 'GET',
|
|
1713
|
-
path: requestPath,
|
|
1714
|
-
queryParameters,
|
|
1715
|
-
headers,
|
|
1716
|
-
};
|
|
1717
|
-
return transporter.request(request, requestOptions);
|
|
1718
|
-
},
|
|
1719
|
-
/**
|
|
1720
|
-
* Retrieve a list of task runs.
|
|
1721
|
-
*
|
|
1722
|
-
* Required API Key ACLs:
|
|
1723
|
-
* - addObject
|
|
1724
|
-
* - deleteIndex
|
|
1725
|
-
* - editSettings.
|
|
1726
|
-
*
|
|
1727
|
-
* @param listRuns - The listRuns object.
|
|
1728
|
-
* @param listRuns.itemsPerPage - Number of items per page.
|
|
1729
|
-
* @param listRuns.page - Page number of the paginated API response.
|
|
1730
|
-
* @param listRuns.status - Run status for filtering the list of task runs.
|
|
1731
|
-
* @param listRuns.type - Run type for filtering the list of task runs.
|
|
1732
|
-
* @param listRuns.taskID - Task ID for filtering the list of task runs.
|
|
1733
|
-
* @param listRuns.sort - Property by which to sort the list of task runs.
|
|
1734
|
-
* @param listRuns.order - Sort order of the response, ascending or descending.
|
|
1735
|
-
* @param listRuns.startDate - Date in RFC 3339 format for the earliest run to retrieve. By default, the current day minus seven days is used.
|
|
1736
|
-
* @param listRuns.endDate - Date in RFC 3339 format for the latest run to retrieve. By default, the current day is used.
|
|
1737
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1738
|
-
*/
|
|
1739
|
-
listRuns({ itemsPerPage, page, status, type, taskID, sort, order, startDate, endDate } = {}, requestOptions = undefined) {
|
|
1740
|
-
const requestPath = '/1/runs';
|
|
1741
|
-
const headers = {};
|
|
1742
|
-
const queryParameters = {};
|
|
1743
|
-
if (itemsPerPage !== undefined) {
|
|
1744
|
-
queryParameters.itemsPerPage = itemsPerPage.toString();
|
|
1745
|
-
}
|
|
1746
|
-
if (page !== undefined) {
|
|
1747
|
-
queryParameters.page = page.toString();
|
|
1748
|
-
}
|
|
1749
|
-
if (status !== undefined) {
|
|
1750
|
-
queryParameters.status = status.toString();
|
|
1751
|
-
}
|
|
1752
|
-
if (type !== undefined) {
|
|
1753
|
-
queryParameters.type = type.toString();
|
|
1754
|
-
}
|
|
1755
|
-
if (taskID !== undefined) {
|
|
1756
|
-
queryParameters.taskID = taskID.toString();
|
|
1757
|
-
}
|
|
1758
|
-
if (sort !== undefined) {
|
|
1759
|
-
queryParameters.sort = sort.toString();
|
|
1760
|
-
}
|
|
1761
|
-
if (order !== undefined) {
|
|
1762
|
-
queryParameters.order = order.toString();
|
|
1763
|
-
}
|
|
1764
|
-
if (startDate !== undefined) {
|
|
1765
|
-
queryParameters.startDate = startDate.toString();
|
|
1766
|
-
}
|
|
1767
|
-
if (endDate !== undefined) {
|
|
1768
|
-
queryParameters.endDate = endDate.toString();
|
|
1769
|
-
}
|
|
1770
|
-
const request = {
|
|
1771
|
-
method: 'GET',
|
|
1772
|
-
path: requestPath,
|
|
1773
|
-
queryParameters,
|
|
1774
|
-
headers,
|
|
1775
|
-
};
|
|
1776
|
-
return transporter.request(request, requestOptions);
|
|
1777
|
-
},
|
|
1778
|
-
/**
|
|
1779
|
-
* Retrieves a list of sources.
|
|
1780
|
-
*
|
|
1781
|
-
* Required API Key ACLs:
|
|
1782
|
-
* - addObject
|
|
1783
|
-
* - deleteIndex
|
|
1784
|
-
* - editSettings.
|
|
1785
|
-
*
|
|
1786
|
-
* @param listSources - The listSources object.
|
|
1787
|
-
* @param listSources.itemsPerPage - Number of items per page.
|
|
1788
|
-
* @param listSources.page - Page number of the paginated API response.
|
|
1789
|
-
* @param listSources.type - Source type. Some sources require authentication.
|
|
1790
|
-
* @param listSources.authenticationID - Authentication IDs of the sources to retrieve. \'none\' returns sources that doesn\'t have an authentication resource.
|
|
1791
|
-
* @param listSources.sort - Property by which to sort the list of sources.
|
|
1792
|
-
* @param listSources.order - Sort order of the response, ascending or descending.
|
|
1793
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1794
|
-
*/
|
|
1795
|
-
listSources({ itemsPerPage, page, type, authenticationID, sort, order } = {}, requestOptions = undefined) {
|
|
1796
|
-
const requestPath = '/1/sources';
|
|
1797
|
-
const headers = {};
|
|
1798
|
-
const queryParameters = {};
|
|
1799
|
-
if (itemsPerPage !== undefined) {
|
|
1800
|
-
queryParameters.itemsPerPage = itemsPerPage.toString();
|
|
1801
|
-
}
|
|
1802
|
-
if (page !== undefined) {
|
|
1803
|
-
queryParameters.page = page.toString();
|
|
1804
|
-
}
|
|
1805
|
-
if (type !== undefined) {
|
|
1806
|
-
queryParameters.type = type.toString();
|
|
1807
|
-
}
|
|
1808
|
-
if (authenticationID !== undefined) {
|
|
1809
|
-
queryParameters.authenticationID = authenticationID.toString();
|
|
1810
|
-
}
|
|
1811
|
-
if (sort !== undefined) {
|
|
1812
|
-
queryParameters.sort = sort.toString();
|
|
1813
|
-
}
|
|
1814
|
-
if (order !== undefined) {
|
|
1815
|
-
queryParameters.order = order.toString();
|
|
1816
|
-
}
|
|
1817
|
-
const request = {
|
|
1818
|
-
method: 'GET',
|
|
1819
|
-
path: requestPath,
|
|
1820
|
-
queryParameters,
|
|
1821
|
-
headers,
|
|
1822
|
-
};
|
|
1823
|
-
return transporter.request(request, requestOptions);
|
|
1824
|
-
},
|
|
1825
|
-
/**
|
|
1826
|
-
* Retrieves a list of tasks.
|
|
1827
|
-
*
|
|
1828
|
-
* Required API Key ACLs:
|
|
1829
|
-
* - addObject
|
|
1830
|
-
* - deleteIndex
|
|
1831
|
-
* - editSettings.
|
|
1832
|
-
*
|
|
1833
|
-
* @param listTasks - The listTasks object.
|
|
1834
|
-
* @param listTasks.itemsPerPage - Number of items per page.
|
|
1835
|
-
* @param listTasks.page - Page number of the paginated API response.
|
|
1836
|
-
* @param listTasks.action - Actions for filtering the list of tasks.
|
|
1837
|
-
* @param listTasks.enabled - Whether to filter the list of tasks by the `enabled` status.
|
|
1838
|
-
* @param listTasks.sourceID - Source IDs for filtering the list of tasks.
|
|
1839
|
-
* @param listTasks.destinationID - Destination IDs for filtering the list of tasks.
|
|
1840
|
-
* @param listTasks.triggerType - Type of task trigger for filtering the list of tasks.
|
|
1841
|
-
* @param listTasks.sort - Property by which to sort the list of tasks.
|
|
1842
|
-
* @param listTasks.order - Sort order of the response, ascending or descending.
|
|
1843
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1844
|
-
*/
|
|
1845
|
-
listTasks({ itemsPerPage, page, action, enabled, sourceID, destinationID, triggerType, sort, order } = {}, requestOptions = undefined) {
|
|
1846
|
-
const requestPath = '/2/tasks';
|
|
1847
|
-
const headers = {};
|
|
1848
|
-
const queryParameters = {};
|
|
1849
|
-
if (itemsPerPage !== undefined) {
|
|
1850
|
-
queryParameters.itemsPerPage = itemsPerPage.toString();
|
|
1851
|
-
}
|
|
1852
|
-
if (page !== undefined) {
|
|
1853
|
-
queryParameters.page = page.toString();
|
|
1854
|
-
}
|
|
1855
|
-
if (action !== undefined) {
|
|
1856
|
-
queryParameters.action = action.toString();
|
|
1857
|
-
}
|
|
1858
|
-
if (enabled !== undefined) {
|
|
1859
|
-
queryParameters.enabled = enabled.toString();
|
|
1860
|
-
}
|
|
1861
|
-
if (sourceID !== undefined) {
|
|
1862
|
-
queryParameters.sourceID = sourceID.toString();
|
|
1863
|
-
}
|
|
1864
|
-
if (destinationID !== undefined) {
|
|
1865
|
-
queryParameters.destinationID = destinationID.toString();
|
|
1866
|
-
}
|
|
1867
|
-
if (triggerType !== undefined) {
|
|
1868
|
-
queryParameters.triggerType = triggerType.toString();
|
|
1869
|
-
}
|
|
1870
|
-
if (sort !== undefined) {
|
|
1871
|
-
queryParameters.sort = sort.toString();
|
|
1872
|
-
}
|
|
1873
|
-
if (order !== undefined) {
|
|
1874
|
-
queryParameters.order = order.toString();
|
|
1875
|
-
}
|
|
1876
|
-
const request = {
|
|
1877
|
-
method: 'GET',
|
|
1878
|
-
path: requestPath,
|
|
1879
|
-
queryParameters,
|
|
1880
|
-
headers,
|
|
1881
|
-
};
|
|
1882
|
-
return transporter.request(request, requestOptions);
|
|
1883
|
-
},
|
|
1884
|
-
/**
|
|
1885
|
-
* Retrieves a list of tasks using the v1 endpoint, please use `getTasks` instead.
|
|
1886
|
-
*
|
|
1887
|
-
* Required API Key ACLs:
|
|
1888
|
-
* - addObject
|
|
1889
|
-
* - deleteIndex
|
|
1890
|
-
* - editSettings.
|
|
1891
|
-
*
|
|
1892
|
-
* @param listTasksV1 - The listTasksV1 object.
|
|
1893
|
-
* @param listTasksV1.itemsPerPage - Number of items per page.
|
|
1894
|
-
* @param listTasksV1.page - Page number of the paginated API response.
|
|
1895
|
-
* @param listTasksV1.action - Actions for filtering the list of tasks.
|
|
1896
|
-
* @param listTasksV1.enabled - Whether to filter the list of tasks by the `enabled` status.
|
|
1897
|
-
* @param listTasksV1.sourceID - Source IDs for filtering the list of tasks.
|
|
1898
|
-
* @param listTasksV1.destinationID - Destination IDs for filtering the list of tasks.
|
|
1899
|
-
* @param listTasksV1.triggerType - Type of task trigger for filtering the list of tasks.
|
|
1900
|
-
* @param listTasksV1.sort - Property by which to sort the list of tasks.
|
|
1901
|
-
* @param listTasksV1.order - Sort order of the response, ascending or descending.
|
|
1902
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1903
|
-
*/
|
|
1904
|
-
listTasksV1({ itemsPerPage, page, action, enabled, sourceID, destinationID, triggerType, sort, order } = {}, requestOptions = undefined) {
|
|
1905
|
-
const requestPath = '/1/tasks';
|
|
1906
|
-
const headers = {};
|
|
1907
|
-
const queryParameters = {};
|
|
1908
|
-
if (itemsPerPage !== undefined) {
|
|
1909
|
-
queryParameters.itemsPerPage = itemsPerPage.toString();
|
|
1910
|
-
}
|
|
1911
|
-
if (page !== undefined) {
|
|
1912
|
-
queryParameters.page = page.toString();
|
|
1913
|
-
}
|
|
1914
|
-
if (action !== undefined) {
|
|
1915
|
-
queryParameters.action = action.toString();
|
|
1916
|
-
}
|
|
1917
|
-
if (enabled !== undefined) {
|
|
1918
|
-
queryParameters.enabled = enabled.toString();
|
|
1919
|
-
}
|
|
1920
|
-
if (sourceID !== undefined) {
|
|
1921
|
-
queryParameters.sourceID = sourceID.toString();
|
|
1922
|
-
}
|
|
1923
|
-
if (destinationID !== undefined) {
|
|
1924
|
-
queryParameters.destinationID = destinationID.toString();
|
|
1925
|
-
}
|
|
1926
|
-
if (triggerType !== undefined) {
|
|
1927
|
-
queryParameters.triggerType = triggerType.toString();
|
|
1928
|
-
}
|
|
1929
|
-
if (sort !== undefined) {
|
|
1930
|
-
queryParameters.sort = sort.toString();
|
|
1931
|
-
}
|
|
1932
|
-
if (order !== undefined) {
|
|
1933
|
-
queryParameters.order = order.toString();
|
|
1934
|
-
}
|
|
1935
|
-
const request = {
|
|
1936
|
-
method: 'GET',
|
|
1937
|
-
path: requestPath,
|
|
1938
|
-
queryParameters,
|
|
1939
|
-
headers,
|
|
1940
|
-
};
|
|
1941
|
-
return transporter.request(request, requestOptions);
|
|
1942
|
-
},
|
|
1943
|
-
/**
|
|
1944
|
-
* Retrieves a list of existing LLM transformation helpers.
|
|
1945
|
-
*
|
|
1946
|
-
* Required API Key ACLs:
|
|
1947
|
-
* - addObject
|
|
1948
|
-
* - deleteIndex
|
|
1949
|
-
* - editSettings.
|
|
1950
|
-
*
|
|
1951
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1952
|
-
*/
|
|
1953
|
-
listTransformationModels(requestOptions) {
|
|
1954
|
-
const requestPath = '/1/transformations/models';
|
|
1955
|
-
const headers = {};
|
|
1956
|
-
const queryParameters = {};
|
|
1957
|
-
const request = {
|
|
1958
|
-
method: 'GET',
|
|
1959
|
-
path: requestPath,
|
|
1960
|
-
queryParameters,
|
|
1961
|
-
headers,
|
|
1962
|
-
};
|
|
1963
|
-
return transporter.request(request, requestOptions);
|
|
1964
|
-
},
|
|
1965
|
-
/**
|
|
1966
|
-
* Retrieves a list of transformations.
|
|
1967
|
-
*
|
|
1968
|
-
* Required API Key ACLs:
|
|
1969
|
-
* - addObject
|
|
1970
|
-
* - deleteIndex
|
|
1971
|
-
* - editSettings.
|
|
1972
|
-
*
|
|
1973
|
-
* @param listTransformations - The listTransformations object.
|
|
1974
|
-
* @param listTransformations.itemsPerPage - Number of items per page.
|
|
1975
|
-
* @param listTransformations.page - Page number of the paginated API response.
|
|
1976
|
-
* @param listTransformations.sort - Property by which to sort the list.
|
|
1977
|
-
* @param listTransformations.order - Sort order of the response, ascending or descending.
|
|
1978
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1979
|
-
*/
|
|
1980
|
-
listTransformations({ itemsPerPage, page, sort, order } = {}, requestOptions = undefined) {
|
|
1981
|
-
const requestPath = '/1/transformations';
|
|
1982
|
-
const headers = {};
|
|
1983
|
-
const queryParameters = {};
|
|
1984
|
-
if (itemsPerPage !== undefined) {
|
|
1985
|
-
queryParameters.itemsPerPage = itemsPerPage.toString();
|
|
1986
|
-
}
|
|
1987
|
-
if (page !== undefined) {
|
|
1988
|
-
queryParameters.page = page.toString();
|
|
1989
|
-
}
|
|
1990
|
-
if (sort !== undefined) {
|
|
1991
|
-
queryParameters.sort = sort.toString();
|
|
1992
|
-
}
|
|
1993
|
-
if (order !== undefined) {
|
|
1994
|
-
queryParameters.order = order.toString();
|
|
1995
|
-
}
|
|
1996
|
-
const request = {
|
|
1997
|
-
method: 'GET',
|
|
1998
|
-
path: requestPath,
|
|
1999
|
-
queryParameters,
|
|
2000
|
-
headers,
|
|
2001
|
-
};
|
|
2002
|
-
return transporter.request(request, requestOptions);
|
|
2003
|
-
},
|
|
2004
|
-
/**
|
|
2005
|
-
* Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints.
|
|
2006
|
-
*
|
|
2007
|
-
* Required API Key ACLs:
|
|
2008
|
-
* - addObject
|
|
2009
|
-
* - deleteIndex
|
|
2010
|
-
* - editSettings.
|
|
2011
|
-
*
|
|
2012
|
-
* @param pushTask - The pushTask object.
|
|
2013
|
-
* @param pushTask.taskID - Unique identifier of a task.
|
|
2014
|
-
* @param pushTask.pushTaskPayload - Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
|
|
2015
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2016
|
-
*/
|
|
2017
|
-
pushTask({ taskID, pushTaskPayload }, requestOptions) {
|
|
2018
|
-
if (!taskID) {
|
|
2019
|
-
throw new Error('Parameter `taskID` is required when calling `pushTask`.');
|
|
2020
|
-
}
|
|
2021
|
-
if (!pushTaskPayload) {
|
|
2022
|
-
throw new Error('Parameter `pushTaskPayload` is required when calling `pushTask`.');
|
|
2023
|
-
}
|
|
2024
|
-
if (!pushTaskPayload.action) {
|
|
2025
|
-
throw new Error('Parameter `pushTaskPayload.action` is required when calling `pushTask`.');
|
|
2026
|
-
}
|
|
2027
|
-
if (!pushTaskPayload.records) {
|
|
2028
|
-
throw new Error('Parameter `pushTaskPayload.records` is required when calling `pushTask`.');
|
|
2029
|
-
}
|
|
2030
|
-
const requestPath = '/2/tasks/{taskID}/push'.replace('{taskID}', encodeURIComponent(taskID));
|
|
2031
|
-
const headers = {};
|
|
2032
|
-
const queryParameters = {};
|
|
2033
|
-
const request = {
|
|
2034
|
-
method: 'POST',
|
|
2035
|
-
path: requestPath,
|
|
2036
|
-
queryParameters,
|
|
2037
|
-
headers,
|
|
2038
|
-
data: pushTaskPayload,
|
|
2039
|
-
};
|
|
2040
|
-
return transporter.request(request, requestOptions);
|
|
2041
|
-
},
|
|
2042
|
-
/**
|
|
2043
|
-
* Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task.
|
|
2044
|
-
*
|
|
2045
|
-
* Required API Key ACLs:
|
|
2046
|
-
* - addObject
|
|
2047
|
-
* - deleteIndex
|
|
2048
|
-
* - editSettings.
|
|
2049
|
-
*
|
|
2050
|
-
* @param runSource - The runSource object.
|
|
2051
|
-
* @param runSource.sourceID - Unique identifier of a source.
|
|
2052
|
-
* @param runSource.runSourcePayload -.
|
|
2053
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2054
|
-
*/
|
|
2055
|
-
runSource({ sourceID, runSourcePayload }, requestOptions) {
|
|
2056
|
-
if (!sourceID) {
|
|
2057
|
-
throw new Error('Parameter `sourceID` is required when calling `runSource`.');
|
|
2058
|
-
}
|
|
2059
|
-
const requestPath = '/1/sources/{sourceID}/run'.replace('{sourceID}', encodeURIComponent(sourceID));
|
|
2060
|
-
const headers = {};
|
|
2061
|
-
const queryParameters = {};
|
|
2062
|
-
const request = {
|
|
2063
|
-
method: 'POST',
|
|
2064
|
-
path: requestPath,
|
|
2065
|
-
queryParameters,
|
|
2066
|
-
headers,
|
|
2067
|
-
data: runSourcePayload ? runSourcePayload : {},
|
|
2068
|
-
};
|
|
2069
|
-
return transporter.request(request, requestOptions);
|
|
2070
|
-
},
|
|
2071
|
-
/**
|
|
2072
|
-
* Runs a task. You can check the status of task runs with the observability endpoints.
|
|
2073
|
-
*
|
|
2074
|
-
* Required API Key ACLs:
|
|
2075
|
-
* - addObject
|
|
2076
|
-
* - deleteIndex
|
|
2077
|
-
* - editSettings.
|
|
2078
|
-
*
|
|
2079
|
-
* @param runTask - The runTask object.
|
|
2080
|
-
* @param runTask.taskID - Unique identifier of a task.
|
|
2081
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2082
|
-
*/
|
|
2083
|
-
runTask({ taskID }, requestOptions) {
|
|
2084
|
-
if (!taskID) {
|
|
2085
|
-
throw new Error('Parameter `taskID` is required when calling `runTask`.');
|
|
2086
|
-
}
|
|
2087
|
-
const requestPath = '/2/tasks/{taskID}/run'.replace('{taskID}', encodeURIComponent(taskID));
|
|
2088
|
-
const headers = {};
|
|
2089
|
-
const queryParameters = {};
|
|
2090
|
-
const request = {
|
|
2091
|
-
method: 'POST',
|
|
2092
|
-
path: requestPath,
|
|
2093
|
-
queryParameters,
|
|
2094
|
-
headers,
|
|
2095
|
-
};
|
|
2096
|
-
return transporter.request(request, requestOptions);
|
|
2097
|
-
},
|
|
2098
|
-
/**
|
|
2099
|
-
* Runs a task using the v1 endpoint, please use `runTask` instead. You can check the status of task runs with the observability endpoints.
|
|
2100
|
-
*
|
|
2101
|
-
* Required API Key ACLs:
|
|
2102
|
-
* - addObject
|
|
2103
|
-
* - deleteIndex
|
|
2104
|
-
* - editSettings.
|
|
2105
|
-
*
|
|
2106
|
-
* @param runTaskV1 - The runTaskV1 object.
|
|
2107
|
-
* @param runTaskV1.taskID - Unique identifier of a task.
|
|
2108
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2109
|
-
*/
|
|
2110
|
-
runTaskV1({ taskID }, requestOptions) {
|
|
2111
|
-
if (!taskID) {
|
|
2112
|
-
throw new Error('Parameter `taskID` is required when calling `runTaskV1`.');
|
|
2113
|
-
}
|
|
2114
|
-
const requestPath = '/1/tasks/{taskID}/run'.replace('{taskID}', encodeURIComponent(taskID));
|
|
2115
|
-
const headers = {};
|
|
2116
|
-
const queryParameters = {};
|
|
2117
|
-
const request = {
|
|
2118
|
-
method: 'POST',
|
|
2119
|
-
path: requestPath,
|
|
2120
|
-
queryParameters,
|
|
2121
|
-
headers,
|
|
2122
|
-
};
|
|
2123
|
-
return transporter.request(request, requestOptions);
|
|
2124
|
-
},
|
|
2125
|
-
/**
|
|
2126
|
-
* Searches for authentication resources.
|
|
2127
|
-
*
|
|
2128
|
-
* Required API Key ACLs:
|
|
2129
|
-
* - addObject
|
|
2130
|
-
* - deleteIndex
|
|
2131
|
-
* - editSettings.
|
|
2132
|
-
*
|
|
2133
|
-
* @param authenticationSearch - The authenticationSearch object.
|
|
2134
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2135
|
-
*/
|
|
2136
|
-
searchAuthentications(authenticationSearch, requestOptions) {
|
|
2137
|
-
if (!authenticationSearch) {
|
|
2138
|
-
throw new Error('Parameter `authenticationSearch` is required when calling `searchAuthentications`.');
|
|
2139
|
-
}
|
|
2140
|
-
if (!authenticationSearch.authenticationIDs) {
|
|
2141
|
-
throw new Error('Parameter `authenticationSearch.authenticationIDs` is required when calling `searchAuthentications`.');
|
|
2142
|
-
}
|
|
2143
|
-
const requestPath = '/1/authentications/search';
|
|
2144
|
-
const headers = {};
|
|
2145
|
-
const queryParameters = {};
|
|
2146
|
-
const request = {
|
|
2147
|
-
method: 'POST',
|
|
2148
|
-
path: requestPath,
|
|
2149
|
-
queryParameters,
|
|
2150
|
-
headers,
|
|
2151
|
-
data: authenticationSearch,
|
|
2152
|
-
};
|
|
2153
|
-
return transporter.request(request, requestOptions);
|
|
2154
|
-
},
|
|
2155
|
-
/**
|
|
2156
|
-
* Searches for destinations.
|
|
2157
|
-
*
|
|
2158
|
-
* Required API Key ACLs:
|
|
2159
|
-
* - addObject
|
|
2160
|
-
* - deleteIndex
|
|
2161
|
-
* - editSettings.
|
|
2162
|
-
*
|
|
2163
|
-
* @param destinationSearch - The destinationSearch object.
|
|
2164
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2165
|
-
*/
|
|
2166
|
-
searchDestinations(destinationSearch, requestOptions) {
|
|
2167
|
-
if (!destinationSearch) {
|
|
2168
|
-
throw new Error('Parameter `destinationSearch` is required when calling `searchDestinations`.');
|
|
2169
|
-
}
|
|
2170
|
-
if (!destinationSearch.destinationIDs) {
|
|
2171
|
-
throw new Error('Parameter `destinationSearch.destinationIDs` is required when calling `searchDestinations`.');
|
|
2172
|
-
}
|
|
2173
|
-
const requestPath = '/1/destinations/search';
|
|
2174
|
-
const headers = {};
|
|
2175
|
-
const queryParameters = {};
|
|
2176
|
-
const request = {
|
|
2177
|
-
method: 'POST',
|
|
2178
|
-
path: requestPath,
|
|
2179
|
-
queryParameters,
|
|
2180
|
-
headers,
|
|
2181
|
-
data: destinationSearch,
|
|
2182
|
-
};
|
|
2183
|
-
return transporter.request(request, requestOptions);
|
|
2184
|
-
},
|
|
2185
|
-
/**
|
|
2186
|
-
* Searches for sources.
|
|
2187
|
-
*
|
|
2188
|
-
* Required API Key ACLs:
|
|
2189
|
-
* - addObject
|
|
2190
|
-
* - deleteIndex
|
|
2191
|
-
* - editSettings.
|
|
2192
|
-
*
|
|
2193
|
-
* @param sourceSearch - The sourceSearch object.
|
|
2194
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2195
|
-
*/
|
|
2196
|
-
searchSources(sourceSearch, requestOptions) {
|
|
2197
|
-
if (!sourceSearch) {
|
|
2198
|
-
throw new Error('Parameter `sourceSearch` is required when calling `searchSources`.');
|
|
2199
|
-
}
|
|
2200
|
-
if (!sourceSearch.sourceIDs) {
|
|
2201
|
-
throw new Error('Parameter `sourceSearch.sourceIDs` is required when calling `searchSources`.');
|
|
2202
|
-
}
|
|
2203
|
-
const requestPath = '/1/sources/search';
|
|
2204
|
-
const headers = {};
|
|
2205
|
-
const queryParameters = {};
|
|
2206
|
-
const request = {
|
|
2207
|
-
method: 'POST',
|
|
2208
|
-
path: requestPath,
|
|
2209
|
-
queryParameters,
|
|
2210
|
-
headers,
|
|
2211
|
-
data: sourceSearch,
|
|
2212
|
-
};
|
|
2213
|
-
return transporter.request(request, requestOptions);
|
|
2214
|
-
},
|
|
2215
|
-
/**
|
|
2216
|
-
* Searches for tasks.
|
|
2217
|
-
*
|
|
2218
|
-
* Required API Key ACLs:
|
|
2219
|
-
* - addObject
|
|
2220
|
-
* - deleteIndex
|
|
2221
|
-
* - editSettings.
|
|
2222
|
-
*
|
|
2223
|
-
* @param taskSearch - The taskSearch object.
|
|
2224
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2225
|
-
*/
|
|
2226
|
-
searchTasks(taskSearch, requestOptions) {
|
|
2227
|
-
if (!taskSearch) {
|
|
2228
|
-
throw new Error('Parameter `taskSearch` is required when calling `searchTasks`.');
|
|
2229
|
-
}
|
|
2230
|
-
if (!taskSearch.taskIDs) {
|
|
2231
|
-
throw new Error('Parameter `taskSearch.taskIDs` is required when calling `searchTasks`.');
|
|
2232
|
-
}
|
|
2233
|
-
const requestPath = '/2/tasks/search';
|
|
2234
|
-
const headers = {};
|
|
2235
|
-
const queryParameters = {};
|
|
2236
|
-
const request = {
|
|
2237
|
-
method: 'POST',
|
|
2238
|
-
path: requestPath,
|
|
2239
|
-
queryParameters,
|
|
2240
|
-
headers,
|
|
2241
|
-
data: taskSearch,
|
|
2242
|
-
};
|
|
2243
|
-
return transporter.request(request, requestOptions);
|
|
2244
|
-
},
|
|
2245
|
-
/**
|
|
2246
|
-
* Searches for tasks using the v1 endpoint, please use `searchTasks` instead.
|
|
2247
|
-
*
|
|
2248
|
-
* Required API Key ACLs:
|
|
2249
|
-
* - addObject
|
|
2250
|
-
* - deleteIndex
|
|
2251
|
-
* - editSettings.
|
|
2252
|
-
*
|
|
2253
|
-
* @param taskSearch - The taskSearch object.
|
|
2254
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2255
|
-
*/
|
|
2256
|
-
searchTasksV1(taskSearch, requestOptions) {
|
|
2257
|
-
if (!taskSearch) {
|
|
2258
|
-
throw new Error('Parameter `taskSearch` is required when calling `searchTasksV1`.');
|
|
2259
|
-
}
|
|
2260
|
-
if (!taskSearch.taskIDs) {
|
|
2261
|
-
throw new Error('Parameter `taskSearch.taskIDs` is required when calling `searchTasksV1`.');
|
|
2262
|
-
}
|
|
2263
|
-
const requestPath = '/1/tasks/search';
|
|
2264
|
-
const headers = {};
|
|
2265
|
-
const queryParameters = {};
|
|
2266
|
-
const request = {
|
|
2267
|
-
method: 'POST',
|
|
2268
|
-
path: requestPath,
|
|
2269
|
-
queryParameters,
|
|
2270
|
-
headers,
|
|
2271
|
-
data: taskSearch,
|
|
2272
|
-
};
|
|
2273
|
-
return transporter.request(request, requestOptions);
|
|
2274
|
-
},
|
|
2275
|
-
/**
|
|
2276
|
-
* Searches for transformations.
|
|
2277
|
-
*
|
|
2278
|
-
* Required API Key ACLs:
|
|
2279
|
-
* - addObject
|
|
2280
|
-
* - deleteIndex
|
|
2281
|
-
* - editSettings.
|
|
2282
|
-
*
|
|
2283
|
-
* @param transformationSearch - The transformationSearch object.
|
|
2284
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2285
|
-
*/
|
|
2286
|
-
searchTransformations(transformationSearch, requestOptions) {
|
|
2287
|
-
if (!transformationSearch) {
|
|
2288
|
-
throw new Error('Parameter `transformationSearch` is required when calling `searchTransformations`.');
|
|
2289
|
-
}
|
|
2290
|
-
if (!transformationSearch.transformationIDs) {
|
|
2291
|
-
throw new Error('Parameter `transformationSearch.transformationIDs` is required when calling `searchTransformations`.');
|
|
2292
|
-
}
|
|
2293
|
-
const requestPath = '/1/transformations/search';
|
|
2294
|
-
const headers = {};
|
|
2295
|
-
const queryParameters = {};
|
|
2296
|
-
const request = {
|
|
2297
|
-
method: 'POST',
|
|
2298
|
-
path: requestPath,
|
|
2299
|
-
queryParameters,
|
|
2300
|
-
headers,
|
|
2301
|
-
data: transformationSearch,
|
|
2302
|
-
};
|
|
2303
|
-
return transporter.request(request, requestOptions);
|
|
2304
|
-
},
|
|
2305
|
-
/**
|
|
2306
|
-
* Triggers a stream-listing request for a source. Triggering stream-listing requests only works with sources with `type: docker` and `imageType: singer`.
|
|
2307
|
-
*
|
|
2308
|
-
* Required API Key ACLs:
|
|
2309
|
-
* - addObject
|
|
2310
|
-
* - deleteIndex
|
|
2311
|
-
* - editSettings.
|
|
2312
|
-
*
|
|
2313
|
-
* @param triggerDockerSourceDiscover - The triggerDockerSourceDiscover object.
|
|
2314
|
-
* @param triggerDockerSourceDiscover.sourceID - Unique identifier of a source.
|
|
2315
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2316
|
-
*/
|
|
2317
|
-
triggerDockerSourceDiscover({ sourceID }, requestOptions) {
|
|
2318
|
-
if (!sourceID) {
|
|
2319
|
-
throw new Error('Parameter `sourceID` is required when calling `triggerDockerSourceDiscover`.');
|
|
2320
|
-
}
|
|
2321
|
-
const requestPath = '/1/sources/{sourceID}/discover'.replace('{sourceID}', encodeURIComponent(sourceID));
|
|
2322
|
-
const headers = {};
|
|
2323
|
-
const queryParameters = {};
|
|
2324
|
-
const request = {
|
|
2325
|
-
method: 'POST',
|
|
2326
|
-
path: requestPath,
|
|
2327
|
-
queryParameters,
|
|
2328
|
-
headers,
|
|
2329
|
-
};
|
|
2330
|
-
return transporter.request(request, requestOptions);
|
|
2331
|
-
},
|
|
2332
|
-
/**
|
|
2333
|
-
* Try a transformation before creating it.
|
|
2334
|
-
*
|
|
2335
|
-
* Required API Key ACLs:
|
|
2336
|
-
* - addObject
|
|
2337
|
-
* - deleteIndex
|
|
2338
|
-
* - editSettings.
|
|
2339
|
-
*
|
|
2340
|
-
* @param transformationTry - The transformationTry object.
|
|
2341
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2342
|
-
*/
|
|
2343
|
-
tryTransformation(transformationTry, requestOptions) {
|
|
2344
|
-
if (!transformationTry) {
|
|
2345
|
-
throw new Error('Parameter `transformationTry` is required when calling `tryTransformation`.');
|
|
2346
|
-
}
|
|
2347
|
-
if (!transformationTry.code) {
|
|
2348
|
-
throw new Error('Parameter `transformationTry.code` is required when calling `tryTransformation`.');
|
|
2349
|
-
}
|
|
2350
|
-
if (!transformationTry.sampleRecord) {
|
|
2351
|
-
throw new Error('Parameter `transformationTry.sampleRecord` is required when calling `tryTransformation`.');
|
|
2352
|
-
}
|
|
2353
|
-
const requestPath = '/1/transformations/try';
|
|
2354
|
-
const headers = {};
|
|
2355
|
-
const queryParameters = {};
|
|
2356
|
-
const request = {
|
|
2357
|
-
method: 'POST',
|
|
2358
|
-
path: requestPath,
|
|
2359
|
-
queryParameters,
|
|
2360
|
-
headers,
|
|
2361
|
-
data: transformationTry,
|
|
2362
|
-
};
|
|
2363
|
-
return transporter.request(request, requestOptions);
|
|
2364
|
-
},
|
|
2365
|
-
/**
|
|
2366
|
-
* Try a transformation before updating it.
|
|
2367
|
-
*
|
|
2368
|
-
* Required API Key ACLs:
|
|
2369
|
-
* - addObject
|
|
2370
|
-
* - deleteIndex
|
|
2371
|
-
* - editSettings.
|
|
2372
|
-
*
|
|
2373
|
-
* @param tryTransformationBeforeUpdate - The tryTransformationBeforeUpdate object.
|
|
2374
|
-
* @param tryTransformationBeforeUpdate.transformationID - Unique identifier of a transformation.
|
|
2375
|
-
* @param tryTransformationBeforeUpdate.transformationTry - The transformationTry object.
|
|
2376
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2377
|
-
*/
|
|
2378
|
-
tryTransformationBeforeUpdate({ transformationID, transformationTry }, requestOptions) {
|
|
2379
|
-
if (!transformationID) {
|
|
2380
|
-
throw new Error('Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.');
|
|
2381
|
-
}
|
|
2382
|
-
if (!transformationTry) {
|
|
2383
|
-
throw new Error('Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.');
|
|
2384
|
-
}
|
|
2385
|
-
if (!transformationTry.code) {
|
|
2386
|
-
throw new Error('Parameter `transformationTry.code` is required when calling `tryTransformationBeforeUpdate`.');
|
|
2387
|
-
}
|
|
2388
|
-
if (!transformationTry.sampleRecord) {
|
|
2389
|
-
throw new Error('Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`.');
|
|
2390
|
-
}
|
|
2391
|
-
const requestPath = '/1/transformations/{transformationID}/try'.replace('{transformationID}', encodeURIComponent(transformationID));
|
|
2392
|
-
const headers = {};
|
|
2393
|
-
const queryParameters = {};
|
|
2394
|
-
const request = {
|
|
2395
|
-
method: 'POST',
|
|
2396
|
-
path: requestPath,
|
|
2397
|
-
queryParameters,
|
|
2398
|
-
headers,
|
|
2399
|
-
data: transformationTry,
|
|
2400
|
-
};
|
|
2401
|
-
return transporter.request(request, requestOptions);
|
|
2402
|
-
},
|
|
2403
|
-
/**
|
|
2404
|
-
* Updates an authentication resource.
|
|
2405
|
-
*
|
|
2406
|
-
* Required API Key ACLs:
|
|
2407
|
-
* - addObject
|
|
2408
|
-
* - deleteIndex
|
|
2409
|
-
* - editSettings.
|
|
2410
|
-
*
|
|
2411
|
-
* @param updateAuthentication - The updateAuthentication object.
|
|
2412
|
-
* @param updateAuthentication.authenticationID - Unique identifier of an authentication resource.
|
|
2413
|
-
* @param updateAuthentication.authenticationUpdate - The authenticationUpdate object.
|
|
2414
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2415
|
-
*/
|
|
2416
|
-
updateAuthentication({ authenticationID, authenticationUpdate }, requestOptions) {
|
|
2417
|
-
if (!authenticationID) {
|
|
2418
|
-
throw new Error('Parameter `authenticationID` is required when calling `updateAuthentication`.');
|
|
2419
|
-
}
|
|
2420
|
-
if (!authenticationUpdate) {
|
|
2421
|
-
throw new Error('Parameter `authenticationUpdate` is required when calling `updateAuthentication`.');
|
|
2422
|
-
}
|
|
2423
|
-
const requestPath = '/1/authentications/{authenticationID}'.replace('{authenticationID}', encodeURIComponent(authenticationID));
|
|
2424
|
-
const headers = {};
|
|
2425
|
-
const queryParameters = {};
|
|
2426
|
-
const request = {
|
|
2427
|
-
method: 'PATCH',
|
|
2428
|
-
path: requestPath,
|
|
2429
|
-
queryParameters,
|
|
2430
|
-
headers,
|
|
2431
|
-
data: authenticationUpdate,
|
|
2432
|
-
};
|
|
2433
|
-
return transporter.request(request, requestOptions);
|
|
2434
|
-
},
|
|
2435
|
-
/**
|
|
2436
|
-
* Updates the destination by its ID.
|
|
2437
|
-
*
|
|
2438
|
-
* Required API Key ACLs:
|
|
2439
|
-
* - addObject
|
|
2440
|
-
* - deleteIndex
|
|
2441
|
-
* - editSettings.
|
|
2442
|
-
*
|
|
2443
|
-
* @param updateDestination - The updateDestination object.
|
|
2444
|
-
* @param updateDestination.destinationID - Unique identifier of a destination.
|
|
2445
|
-
* @param updateDestination.destinationUpdate - The destinationUpdate object.
|
|
2446
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2447
|
-
*/
|
|
2448
|
-
updateDestination({ destinationID, destinationUpdate }, requestOptions) {
|
|
2449
|
-
if (!destinationID) {
|
|
2450
|
-
throw new Error('Parameter `destinationID` is required when calling `updateDestination`.');
|
|
2451
|
-
}
|
|
2452
|
-
if (!destinationUpdate) {
|
|
2453
|
-
throw new Error('Parameter `destinationUpdate` is required when calling `updateDestination`.');
|
|
2454
|
-
}
|
|
2455
|
-
const requestPath = '/1/destinations/{destinationID}'.replace('{destinationID}', encodeURIComponent(destinationID));
|
|
2456
|
-
const headers = {};
|
|
2457
|
-
const queryParameters = {};
|
|
2458
|
-
const request = {
|
|
2459
|
-
method: 'PATCH',
|
|
2460
|
-
path: requestPath,
|
|
2461
|
-
queryParameters,
|
|
2462
|
-
headers,
|
|
2463
|
-
data: destinationUpdate,
|
|
2464
|
-
};
|
|
2465
|
-
return transporter.request(request, requestOptions);
|
|
2466
|
-
},
|
|
2467
|
-
/**
|
|
2468
|
-
* Updates a source by its ID.
|
|
2469
|
-
*
|
|
2470
|
-
* Required API Key ACLs:
|
|
2471
|
-
* - addObject
|
|
2472
|
-
* - deleteIndex
|
|
2473
|
-
* - editSettings.
|
|
2474
|
-
*
|
|
2475
|
-
* @param updateSource - The updateSource object.
|
|
2476
|
-
* @param updateSource.sourceID - Unique identifier of a source.
|
|
2477
|
-
* @param updateSource.sourceUpdate - The sourceUpdate object.
|
|
2478
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2479
|
-
*/
|
|
2480
|
-
updateSource({ sourceID, sourceUpdate }, requestOptions) {
|
|
2481
|
-
if (!sourceID) {
|
|
2482
|
-
throw new Error('Parameter `sourceID` is required when calling `updateSource`.');
|
|
2483
|
-
}
|
|
2484
|
-
if (!sourceUpdate) {
|
|
2485
|
-
throw new Error('Parameter `sourceUpdate` is required when calling `updateSource`.');
|
|
2486
|
-
}
|
|
2487
|
-
const requestPath = '/1/sources/{sourceID}'.replace('{sourceID}', encodeURIComponent(sourceID));
|
|
2488
|
-
const headers = {};
|
|
2489
|
-
const queryParameters = {};
|
|
2490
|
-
const request = {
|
|
2491
|
-
method: 'PATCH',
|
|
2492
|
-
path: requestPath,
|
|
2493
|
-
queryParameters,
|
|
2494
|
-
headers,
|
|
2495
|
-
data: sourceUpdate,
|
|
2496
|
-
};
|
|
2497
|
-
return transporter.request(request, requestOptions);
|
|
2498
|
-
},
|
|
2499
|
-
/**
|
|
2500
|
-
* Updates a task by its ID.
|
|
2501
|
-
*
|
|
2502
|
-
* @param updateTask - The updateTask object.
|
|
2503
|
-
* @param updateTask.taskID - Unique identifier of a task.
|
|
2504
|
-
* @param updateTask.taskUpdate - The taskUpdate object.
|
|
2505
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2506
|
-
*/
|
|
2507
|
-
updateTask({ taskID, taskUpdate }, requestOptions) {
|
|
2508
|
-
if (!taskID) {
|
|
2509
|
-
throw new Error('Parameter `taskID` is required when calling `updateTask`.');
|
|
2510
|
-
}
|
|
2511
|
-
if (!taskUpdate) {
|
|
2512
|
-
throw new Error('Parameter `taskUpdate` is required when calling `updateTask`.');
|
|
2513
|
-
}
|
|
2514
|
-
const requestPath = '/2/tasks/{taskID}'.replace('{taskID}', encodeURIComponent(taskID));
|
|
2515
|
-
const headers = {};
|
|
2516
|
-
const queryParameters = {};
|
|
2517
|
-
const request = {
|
|
2518
|
-
method: 'PATCH',
|
|
2519
|
-
path: requestPath,
|
|
2520
|
-
queryParameters,
|
|
2521
|
-
headers,
|
|
2522
|
-
data: taskUpdate,
|
|
2523
|
-
};
|
|
2524
|
-
return transporter.request(request, requestOptions);
|
|
2525
|
-
},
|
|
2526
|
-
/**
|
|
2527
|
-
* Updates a task by its ID using the v1 endpoint, please use `updateTask` instead.
|
|
2528
|
-
*
|
|
2529
|
-
* @param updateTaskV1 - The updateTaskV1 object.
|
|
2530
|
-
* @param updateTaskV1.taskID - Unique identifier of a task.
|
|
2531
|
-
* @param updateTaskV1.taskUpdate - The taskUpdate object.
|
|
2532
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2533
|
-
*/
|
|
2534
|
-
updateTaskV1({ taskID, taskUpdate }, requestOptions) {
|
|
2535
|
-
if (!taskID) {
|
|
2536
|
-
throw new Error('Parameter `taskID` is required when calling `updateTaskV1`.');
|
|
2537
|
-
}
|
|
2538
|
-
if (!taskUpdate) {
|
|
2539
|
-
throw new Error('Parameter `taskUpdate` is required when calling `updateTaskV1`.');
|
|
2540
|
-
}
|
|
2541
|
-
const requestPath = '/1/tasks/{taskID}'.replace('{taskID}', encodeURIComponent(taskID));
|
|
2542
|
-
const headers = {};
|
|
2543
|
-
const queryParameters = {};
|
|
2544
|
-
const request = {
|
|
2545
|
-
method: 'PATCH',
|
|
2546
|
-
path: requestPath,
|
|
2547
|
-
queryParameters,
|
|
2548
|
-
headers,
|
|
2549
|
-
data: taskUpdate,
|
|
2550
|
-
};
|
|
2551
|
-
return transporter.request(request, requestOptions);
|
|
2552
|
-
},
|
|
2553
|
-
/**
|
|
2554
|
-
* Updates a transformation by its ID.
|
|
2555
|
-
*
|
|
2556
|
-
* @param updateTransformation - The updateTransformation object.
|
|
2557
|
-
* @param updateTransformation.transformationID - Unique identifier of a transformation.
|
|
2558
|
-
* @param updateTransformation.transformationCreate - The transformationCreate object.
|
|
2559
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2560
|
-
*/
|
|
2561
|
-
updateTransformation({ transformationID, transformationCreate }, requestOptions) {
|
|
2562
|
-
if (!transformationID) {
|
|
2563
|
-
throw new Error('Parameter `transformationID` is required when calling `updateTransformation`.');
|
|
2564
|
-
}
|
|
2565
|
-
if (!transformationCreate) {
|
|
2566
|
-
throw new Error('Parameter `transformationCreate` is required when calling `updateTransformation`.');
|
|
2567
|
-
}
|
|
2568
|
-
if (!transformationCreate.code) {
|
|
2569
|
-
throw new Error('Parameter `transformationCreate.code` is required when calling `updateTransformation`.');
|
|
2570
|
-
}
|
|
2571
|
-
if (!transformationCreate.name) {
|
|
2572
|
-
throw new Error('Parameter `transformationCreate.name` is required when calling `updateTransformation`.');
|
|
2573
|
-
}
|
|
2574
|
-
const requestPath = '/1/transformations/{transformationID}'.replace('{transformationID}', encodeURIComponent(transformationID));
|
|
2575
|
-
const headers = {};
|
|
2576
|
-
const queryParameters = {};
|
|
2577
|
-
const request = {
|
|
2578
|
-
method: 'PUT',
|
|
2579
|
-
path: requestPath,
|
|
2580
|
-
queryParameters,
|
|
2581
|
-
headers,
|
|
2582
|
-
data: transformationCreate,
|
|
2583
|
-
};
|
|
2584
|
-
return transporter.request(request, requestOptions);
|
|
2585
|
-
},
|
|
2586
|
-
/**
|
|
2587
|
-
* Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
|
|
2588
|
-
*
|
|
2589
|
-
* Required API Key ACLs:
|
|
2590
|
-
* - addObject
|
|
2591
|
-
* - deleteIndex
|
|
2592
|
-
* - editSettings.
|
|
2593
|
-
*
|
|
2594
|
-
* @param sourceCreate -.
|
|
2595
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2596
|
-
*/
|
|
2597
|
-
validateSource(sourceCreate, requestOptions = undefined) {
|
|
2598
|
-
const requestPath = '/1/sources/validate';
|
|
2599
|
-
const headers = {};
|
|
2600
|
-
const queryParameters = {};
|
|
2601
|
-
const request = {
|
|
2602
|
-
method: 'POST',
|
|
2603
|
-
path: requestPath,
|
|
2604
|
-
queryParameters,
|
|
2605
|
-
headers,
|
|
2606
|
-
data: sourceCreate ? sourceCreate : {},
|
|
2607
|
-
};
|
|
2608
|
-
return transporter.request(request, requestOptions);
|
|
2609
|
-
},
|
|
2610
|
-
/**
|
|
2611
|
-
* Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
|
|
2612
|
-
*
|
|
2613
|
-
* Required API Key ACLs:
|
|
2614
|
-
* - addObject
|
|
2615
|
-
* - deleteIndex
|
|
2616
|
-
* - editSettings.
|
|
2617
|
-
*
|
|
2618
|
-
* @param validateSourceBeforeUpdate - The validateSourceBeforeUpdate object.
|
|
2619
|
-
* @param validateSourceBeforeUpdate.sourceID - Unique identifier of a source.
|
|
2620
|
-
* @param validateSourceBeforeUpdate.sourceUpdate - The sourceUpdate object.
|
|
2621
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2622
|
-
*/
|
|
2623
|
-
validateSourceBeforeUpdate({ sourceID, sourceUpdate }, requestOptions) {
|
|
2624
|
-
if (!sourceID) {
|
|
2625
|
-
throw new Error('Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.');
|
|
2626
|
-
}
|
|
2627
|
-
if (!sourceUpdate) {
|
|
2628
|
-
throw new Error('Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.');
|
|
2629
|
-
}
|
|
2630
|
-
const requestPath = '/1/sources/{sourceID}/validate'.replace('{sourceID}', encodeURIComponent(sourceID));
|
|
2631
|
-
const headers = {};
|
|
2632
|
-
const queryParameters = {};
|
|
2633
|
-
const request = {
|
|
2634
|
-
method: 'POST',
|
|
2635
|
-
path: requestPath,
|
|
2636
|
-
queryParameters,
|
|
2637
|
-
headers,
|
|
2638
|
-
data: sourceUpdate,
|
|
2639
|
-
};
|
|
2640
|
-
return transporter.request(request, requestOptions);
|
|
2641
|
-
},
|
|
2642
|
-
};
|
|
2643
|
-
}
|
|
2644
|
-
|
|
2645
|
-
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2646
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
2647
|
-
function ingestionClient(appId, apiKey, region, options) {
|
|
2648
|
-
if (!appId || typeof appId !== 'string') {
|
|
2649
|
-
throw new Error('`appId` is missing.');
|
|
2650
|
-
}
|
|
2651
|
-
if (!apiKey || typeof apiKey !== 'string') {
|
|
2652
|
-
throw new Error('`apiKey` is missing.');
|
|
2653
|
-
}
|
|
2654
|
-
if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {
|
|
2655
|
-
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
|
|
2656
|
-
}
|
|
2657
|
-
return createIngestionClient({
|
|
2658
|
-
appId,
|
|
2659
|
-
apiKey,
|
|
2660
|
-
region,
|
|
2661
|
-
timeouts: {
|
|
2662
|
-
connect: DEFAULT_CONNECT_TIMEOUT_BROWSER,
|
|
2663
|
-
read: DEFAULT_READ_TIMEOUT_BROWSER,
|
|
2664
|
-
write: DEFAULT_WRITE_TIMEOUT_BROWSER,
|
|
2665
|
-
},
|
|
2666
|
-
requester: createXhrRequester(),
|
|
2667
|
-
algoliaAgents: [{ segment: 'Browser' }],
|
|
2668
|
-
authMode: 'WithinQueryParameters',
|
|
2669
|
-
responsesCache: createMemoryCache(),
|
|
2670
|
-
requestsCache: createMemoryCache({ serializable: false }),
|
|
2671
|
-
hostsCache: createFallbackableCache({
|
|
2672
|
-
caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],
|
|
2673
|
-
}),
|
|
2674
|
-
...options,
|
|
2675
|
-
});
|
|
2676
|
-
}
|
|
2677
|
-
|
|
2678
|
-
export { apiClientVersion, ingestionClient, isOnDemandTrigger, isScheduleTrigger, isSubscriptionTrigger };
|