@segment/public-api-sdk-typescript 1.0.1 → 1.0.2-b1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (509) hide show
  1. package/README.md +1 -1
  2. package/api/aPICallsApi.ts +1176 -0
  3. package/api/apis.ts +178 -0
  4. package/api/auditTrailApi.ts +714 -0
  5. package/api/catalogApi.ts +2916 -0
  6. package/api/deletionAndSuppressionApi.ts +4298 -0
  7. package/api/destinationFiltersApi.ts +3262 -0
  8. package/api/destinationsApi.ts +3494 -0
  9. package/api/edgeFunctionsApi.ts +593 -0
  10. package/api/eventsApi.ts +922 -0
  11. package/api/functionsApi.ts +3036 -0
  12. package/api/iAMGroupsApi.ts +6204 -0
  13. package/api/iAMRolesApi.ts +566 -0
  14. package/api/iAMUsersApi.ts +4486 -0
  15. package/api/labelsApi.ts +1488 -0
  16. package/api/monthlyTrackedUsersApi.ts +1178 -0
  17. package/api/selectiveSyncApi.ts +3321 -0
  18. package/api/sourcesApi.ts +5602 -0
  19. package/api/spacesApi.ts +489 -0
  20. package/api/testingApi.ts +568 -0
  21. package/api/trackingPlansApi.ts +6238 -0
  22. package/api/transformationsApi.ts +1316 -0
  23. package/api/warehousesApi.ts +5004 -0
  24. package/api/workspacesApi.ts +513 -0
  25. package/api.ts +3 -0
  26. package/dist/model/contact.d.ts +17 -0
  27. package/dist/model/contact.js +36 -0
  28. package/dist/model/contact.js.map +1 -0
  29. package/dist/model/destinationMetadata.d.ts +3 -0
  30. package/dist/model/destinationMetadata.js +10 -0
  31. package/dist/model/destinationMetadata.js.map +1 -1
  32. package/dist/model/destinationMetadataV1.d.ts +3 -0
  33. package/dist/model/destinationMetadataV1.js +10 -0
  34. package/dist/model/destinationMetadataV1.js.map +1 -1
  35. package/dist/model/metadata.d.ts +3 -0
  36. package/dist/model/metadata.js +10 -0
  37. package/dist/model/metadata.js.map +1 -1
  38. package/dist/model/models.d.ts +1 -0
  39. package/dist/model/models.js +3 -0
  40. package/dist/model/models.js.map +1 -1
  41. package/jest.config.js +10 -0
  42. package/model/aPICallSnapshotV1.ts +50 -0
  43. package/model/accessPermissionV1.ts +60 -0
  44. package/model/addConnectionFromSourceToWarehouse200Response.ts +36 -0
  45. package/model/addConnectionFromSourceToWarehouseV1Output.ts +48 -0
  46. package/model/addLabelsToSource200Response.ts +36 -0
  47. package/model/addLabelsToSource200Response1.ts +36 -0
  48. package/model/addLabelsToSourceAlphaInput.ts +42 -0
  49. package/model/addLabelsToSourceAlphaOutput.ts +42 -0
  50. package/model/addLabelsToSourceV1Input.ts +42 -0
  51. package/model/addLabelsToSourceV1Output.ts +42 -0
  52. package/model/addPermissionsToUser200Response.ts +36 -0
  53. package/model/addPermissionsToUserGroup200Response.ts +36 -0
  54. package/model/addPermissionsToUserGroupV1Input.ts +42 -0
  55. package/model/addPermissionsToUserGroupV1Output.ts +42 -0
  56. package/model/addPermissionsToUserV1Input.ts +42 -0
  57. package/model/addPermissionsToUserV1Output.ts +42 -0
  58. package/model/addSourceToTrackingPlan200Response.ts +36 -0
  59. package/model/addSourceToTrackingPlanV1Input.ts +41 -0
  60. package/model/addSourceToTrackingPlanV1Output.ts +47 -0
  61. package/model/addUsersToUserGroup200Response.ts +36 -0
  62. package/model/addUsersToUserGroupV1Input.ts +41 -0
  63. package/model/addUsersToUserGroupV1Output.ts +39 -0
  64. package/model/advancedWarehouseSyncScheduleV1Input.ts +51 -0
  65. package/model/advancedWarehouseSyncScheduleV1Output.ts +51 -0
  66. package/model/allowedLabelBeta.ts +59 -0
  67. package/model/auditEventV1.ts +95 -0
  68. package/model/batchQueryMessagingSubscriptionsForSpace200Response.ts +36 -0
  69. package/model/batchQueryMessagingSubscriptionsForSpaceAlphaInput.ts +42 -0
  70. package/model/batchQueryMessagingSubscriptionsForSpaceAlphaOutput.ts +69 -0
  71. package/model/breakdownBeta.ts +50 -0
  72. package/model/commonSourceSettingsV1.ts +68 -0
  73. package/model/contact.ts +68 -0
  74. package/model/createCloudSourceRegulation200Response.ts +36 -0
  75. package/model/createCloudSourceRegulationV1Input.ts +82 -0
  76. package/model/createCloudSourceRegulationV1Output.ts +41 -0
  77. package/model/createDestination200Response.ts +36 -0
  78. package/model/createDestinationSubscription200Response.ts +36 -0
  79. package/model/createDestinationSubscriptionAlphaInput.ts +77 -0
  80. package/model/createDestinationSubscriptionAlphaOutput.ts +39 -0
  81. package/model/createDestinationV1Input.ts +77 -0
  82. package/model/createDestinationV1Output.ts +39 -0
  83. package/model/createEdgeFunctions200Response.ts +36 -0
  84. package/model/createEdgeFunctionsAlphaInput.ts +41 -0
  85. package/model/createEdgeFunctionsAlphaOutput.ts +39 -0
  86. package/model/createFilterForDestination200Response.ts +36 -0
  87. package/model/createFilterForDestinationV1Input.ts +87 -0
  88. package/model/createFilterForDestinationV1Output.ts +39 -0
  89. package/model/createFunction200Response.ts +36 -0
  90. package/model/createFunctionDeployment200Response.ts +36 -0
  91. package/model/createFunctionDeploymentV1Output.ts +39 -0
  92. package/model/createFunctionV1Input.ts +94 -0
  93. package/model/createFunctionV1Output.ts +39 -0
  94. package/model/createInvites200Response.ts +36 -0
  95. package/model/createInvitesV1Input.ts +42 -0
  96. package/model/createInvitesV1Output.ts +41 -0
  97. package/model/createLabel200Response.ts +36 -0
  98. package/model/createLabel200Response1.ts +36 -0
  99. package/model/createLabelAlphaInput.ts +39 -0
  100. package/model/createLabelAlphaOutput.ts +42 -0
  101. package/model/createLabelV1Input.ts +39 -0
  102. package/model/createLabelV1Output.ts +39 -0
  103. package/model/createSource200Response.ts +36 -0
  104. package/model/createSource200Response1.ts +36 -0
  105. package/model/createSourceAlphaInput.ts +77 -0
  106. package/model/createSourceAlphaOutput.ts +39 -0
  107. package/model/createSourceRegulation200Response.ts +36 -0
  108. package/model/createSourceRegulationV1Input.ts +73 -0
  109. package/model/createSourceRegulationV1Output.ts +41 -0
  110. package/model/createSourceV1Input.ts +68 -0
  111. package/model/createSourceV1Output.ts +39 -0
  112. package/model/createTrackingPlan200Response.ts +36 -0
  113. package/model/createTrackingPlanV1Input.ts +68 -0
  114. package/model/createTrackingPlanV1Output.ts +39 -0
  115. package/model/createTransformation200Response.ts +36 -0
  116. package/model/createTransformationBetaInput.ts +96 -0
  117. package/model/createTransformationBetaOutput.ts +39 -0
  118. package/model/createUserGroup200Response.ts +36 -0
  119. package/model/createUserGroupV1Input.ts +41 -0
  120. package/model/createUserGroupV1Output.ts +39 -0
  121. package/model/createValidationInWarehouse200Response.ts +36 -0
  122. package/model/createValidationInWarehouseV1Input.ts +50 -0
  123. package/model/createValidationInWarehouseV1Output.ts +48 -0
  124. package/model/createWarehouse200Response.ts +36 -0
  125. package/model/createWarehouseV1Input.ts +68 -0
  126. package/model/createWarehouseV1Output.ts +39 -0
  127. package/model/createWorkspaceRegulation200Response.ts +36 -0
  128. package/model/createWorkspaceRegulationV1Input.ts +74 -0
  129. package/model/createWorkspaceRegulationV1Output.ts +41 -0
  130. package/model/deleteDestination200Response.ts +36 -0
  131. package/model/deleteDestinationV1Output.ts +47 -0
  132. package/model/deleteFunction200Response.ts +36 -0
  133. package/model/deleteFunctionV1Output.ts +47 -0
  134. package/model/deleteInvites200Response.ts +36 -0
  135. package/model/deleteInvitesV1Output.ts +47 -0
  136. package/model/deleteLabel200Response.ts +36 -0
  137. package/model/deleteLabel200Response1.ts +36 -0
  138. package/model/deleteLabelAlphaOutput.ts +47 -0
  139. package/model/deleteLabelV1Output.ts +47 -0
  140. package/model/deleteRegulation200Response.ts +36 -0
  141. package/model/deleteRegulationV1Output.ts +47 -0
  142. package/model/deleteSource200Response.ts +36 -0
  143. package/model/deleteSource200Response1.ts +36 -0
  144. package/model/deleteSourceAlphaOutput.ts +47 -0
  145. package/model/deleteSourceV1Output.ts +47 -0
  146. package/model/deleteTrackingPlan200Response.ts +36 -0
  147. package/model/deleteTrackingPlanV1Output.ts +47 -0
  148. package/model/deleteTransformation200Response.ts +36 -0
  149. package/model/deleteTransformationBetaOutput.ts +47 -0
  150. package/model/deleteUserGroup200Response.ts +36 -0
  151. package/model/deleteUserGroupV1Output.ts +47 -0
  152. package/model/deleteUsers200Response.ts +36 -0
  153. package/model/deleteUsersV1Output.ts +47 -0
  154. package/model/deleteWarehouse200Response.ts +36 -0
  155. package/model/deleteWarehouseV1Output.ts +47 -0
  156. package/model/deliveryMetricsSummary.ts +60 -0
  157. package/model/deliveryMetricsSummaryBeta.ts +60 -0
  158. package/model/destination.ts +84 -0
  159. package/model/destination1.ts +84 -0
  160. package/model/destination2.ts +84 -0
  161. package/model/destinationFilterActionV1.ts +77 -0
  162. package/model/destinationFilterV1.ts +123 -0
  163. package/model/destinationMetadata.ts +203 -0
  164. package/model/destinationMetadataActionFieldV1.ts +163 -0
  165. package/model/destinationMetadataActionV1.ts +113 -0
  166. package/model/destinationMetadataComponentV1.ts +72 -0
  167. package/model/destinationMetadataFeaturesV1.ts +93 -0
  168. package/model/destinationMetadataMethodsV1.ts +77 -0
  169. package/model/destinationMetadataPlatformsV1.ts +59 -0
  170. package/model/destinationMetadataSubscriptionPresetV1.ts +68 -0
  171. package/model/destinationMetadataV1.ts +203 -0
  172. package/model/destinationStatusV1.ts +74 -0
  173. package/model/destinationSubscription.ts +104 -0
  174. package/model/destinationSubscriptionUpdateInput.ts +68 -0
  175. package/model/destinationV1.ts +84 -0
  176. package/model/disableEdgeFunctions200Response.ts +36 -0
  177. package/model/disableEdgeFunctionsAlphaOutput.ts +39 -0
  178. package/model/echo200Response.ts +36 -0
  179. package/model/echo200Response1.ts +36 -0
  180. package/model/echoAlphaOutput.ts +66 -0
  181. package/model/echoV1Output.ts +66 -0
  182. package/model/edgeFunctions.ts +86 -0
  183. package/model/edgeFunctions1.ts +86 -0
  184. package/model/edgeFunctionsAlpha.ts +86 -0
  185. package/model/eventSourceV1.ts +59 -0
  186. package/model/filter.ts +51 -0
  187. package/model/filter1.ts +123 -0
  188. package/model/filter2.ts +123 -0
  189. package/model/filter3.ts +123 -0
  190. package/model/function.ts +166 -0
  191. package/model/function1.ts +166 -0
  192. package/model/function2.ts +166 -0
  193. package/model/functionDeployment.ts +44 -0
  194. package/model/functionSettingV1.ts +92 -0
  195. package/model/functionV1.ts +166 -0
  196. package/model/generateUploadURLForEdgeFunctions200Response.ts +36 -0
  197. package/model/generateUploadURLForEdgeFunctionsAlphaOutput.ts +41 -0
  198. package/model/getAdvancedSyncScheduleFromWarehouse200Response.ts +36 -0
  199. package/model/getAdvancedSyncScheduleFromWarehouseV1Output.ts +48 -0
  200. package/model/getConnectionStateFromWarehouse200Response.ts +36 -0
  201. package/model/getConnectionStateFromWarehouseV1Output.ts +48 -0
  202. package/model/getDailyPerSourceAPICallsUsage200Response.ts +36 -0
  203. package/model/getDailyPerSourceAPICallsUsageV1Output.ts +49 -0
  204. package/model/getDailyPerSourceMTUUsage200Response.ts +36 -0
  205. package/model/getDailyPerSourceMTUUsageV1Output.ts +49 -0
  206. package/model/getDailyWorkspaceAPICallsUsage200Response.ts +36 -0
  207. package/model/getDailyWorkspaceAPICallsUsageV1Output.ts +49 -0
  208. package/model/getDailyWorkspaceMTUUsage200Response.ts +36 -0
  209. package/model/getDailyWorkspaceMTUUsageV1Output.ts +49 -0
  210. package/model/getDestination200Response.ts +36 -0
  211. package/model/getDestinationMetadata200Response.ts +36 -0
  212. package/model/getDestinationMetadataV1Output.ts +39 -0
  213. package/model/getDestinationV1Output.ts +39 -0
  214. package/model/getDestinationsCatalog200Response.ts +36 -0
  215. package/model/getDestinationsCatalogV1Output.ts +49 -0
  216. package/model/getEventsVolumeFromWorkspace200Response.ts +36 -0
  217. package/model/getEventsVolumeFromWorkspaceV1Output.ts +49 -0
  218. package/model/getFilterInDestination200Response.ts +36 -0
  219. package/model/getFilterInDestinationV1Output.ts +39 -0
  220. package/model/getFunction200Response.ts +36 -0
  221. package/model/getFunctionV1Output.ts +39 -0
  222. package/model/getLatestFromEdgeFunctions200Response.ts +36 -0
  223. package/model/getLatestFromEdgeFunctionsAlphaOutput.ts +39 -0
  224. package/model/getMessagingSubscriptionFailureResponse.ts +57 -0
  225. package/model/getMessagingSubscriptionSuccessResponse.ts +68 -0
  226. package/model/getRegulation200Response.ts +36 -0
  227. package/model/getRegulationV1Output.ts +39 -0
  228. package/model/getSource200Response.ts +36 -0
  229. package/model/getSource200Response1.ts +36 -0
  230. package/model/getSourceAlphaOutput.ts +39 -0
  231. package/model/getSourceMetadata200Response.ts +36 -0
  232. package/model/getSourceMetadataV1Output.ts +39 -0
  233. package/model/getSourceV1Output.ts +39 -0
  234. package/model/getSourcesCatalog200Response.ts +36 -0
  235. package/model/getSourcesCatalogV1Output.ts +49 -0
  236. package/model/getSpace200Response.ts +36 -0
  237. package/model/getSpaceAlphaOutput.ts +39 -0
  238. package/model/getSubscriptionFromDestination200Response.ts +36 -0
  239. package/model/getSubscriptionFromDestinationAlphaOutput.ts +39 -0
  240. package/model/getSubscriptionRequest.ts +54 -0
  241. package/model/getTrackingPlan200Response.ts +36 -0
  242. package/model/getTrackingPlanV1Output.ts +39 -0
  243. package/model/getTransformation200Response.ts +36 -0
  244. package/model/getTransformationBetaOutput.ts +39 -0
  245. package/model/getUser200Response.ts +36 -0
  246. package/model/getUserGroup200Response.ts +36 -0
  247. package/model/getUserGroupV1Output.ts +39 -0
  248. package/model/getUserV1Output.ts +39 -0
  249. package/model/getWarehouse200Response.ts +36 -0
  250. package/model/getWarehouseMetadata200Response.ts +36 -0
  251. package/model/getWarehouseMetadataV1Output.ts +39 -0
  252. package/model/getWarehouseV1Output.ts +39 -0
  253. package/model/getWarehousesCatalog200Response.ts +36 -0
  254. package/model/getWarehousesCatalogV1Output.ts +49 -0
  255. package/model/getWorkspace200Response.ts +36 -0
  256. package/model/getWorkspaceV1Output.ts +39 -0
  257. package/model/group.ts +67 -0
  258. package/model/groupSourceSettingsV1.ts +64 -0
  259. package/model/identify.ts +67 -0
  260. package/model/identifySourceSettingsV1.ts +64 -0
  261. package/model/input.ts +68 -0
  262. package/model/integrationOptionBeta.ts +86 -0
  263. package/model/invitePermissionV1.ts +61 -0
  264. package/model/inviteV1.ts +51 -0
  265. package/model/label.ts +59 -0
  266. package/model/label1.ts +59 -0
  267. package/model/label2.ts +59 -0
  268. package/model/labelAlpha.ts +59 -0
  269. package/model/labelV1.ts +59 -0
  270. package/model/listAuditEvents200Response.ts +36 -0
  271. package/model/listAuditEventsV1Output.ts +49 -0
  272. package/model/listConnectedDestinationsFromSource200Response.ts +36 -0
  273. package/model/listConnectedDestinationsFromSource200Response1.ts +36 -0
  274. package/model/listConnectedDestinationsFromSourceAlphaOutput.ts +49 -0
  275. package/model/listConnectedDestinationsFromSourceV1Output.ts +49 -0
  276. package/model/listConnectedSourcesFromWarehouse200Response.ts +36 -0
  277. package/model/listConnectedSourcesFromWarehouseV1Output.ts +49 -0
  278. package/model/listConnectedWarehousesFromSource200Response.ts +36 -0
  279. package/model/listConnectedWarehousesFromSource200Response1.ts +36 -0
  280. package/model/listConnectedWarehousesFromSourceAlphaOutput.ts +49 -0
  281. package/model/listConnectedWarehousesFromSourceV1Output.ts +49 -0
  282. package/model/listDeliveryMetricsSummaryFromDestination200Response.ts +36 -0
  283. package/model/listDeliveryMetricsSummaryFromDestinationBetaOutput.ts +39 -0
  284. package/model/listDestinations200Response.ts +36 -0
  285. package/model/listDestinationsV1Output.ts +49 -0
  286. package/model/listFiltersFromDestination200Response.ts +36 -0
  287. package/model/listFiltersFromDestinationV1Output.ts +49 -0
  288. package/model/listFunctionItemV1.ts +111 -0
  289. package/model/listFunctions200Response.ts +36 -0
  290. package/model/listFunctionsV1Output.ts +49 -0
  291. package/model/listInvites200Response.ts +36 -0
  292. package/model/listInvitesFromUserGroup200Response.ts +36 -0
  293. package/model/listInvitesFromUserGroupV1Output.ts +48 -0
  294. package/model/listInvitesV1Output.ts +48 -0
  295. package/model/listLabels200Response.ts +36 -0
  296. package/model/listLabels200Response1.ts +36 -0
  297. package/model/listLabelsAlphaOutput.ts +42 -0
  298. package/model/listLabelsV1Output.ts +42 -0
  299. package/model/listRegulationsFromSource200Response.ts +36 -0
  300. package/model/listRegulationsFromSourceV1Output.ts +42 -0
  301. package/model/listRoles200Response.ts +36 -0
  302. package/model/listRolesV1Output.ts +49 -0
  303. package/model/listRulesFromTrackingPlan200Response.ts +36 -0
  304. package/model/listRulesFromTrackingPlanV1Output.ts +49 -0
  305. package/model/listSchemaSettingsInSource200Response.ts +36 -0
  306. package/model/listSchemaSettingsInSourceV1Output.ts +48 -0
  307. package/model/listSelectiveSyncsFromWarehouseAndSource200Response.ts +36 -0
  308. package/model/listSelectiveSyncsFromWarehouseAndSourceV1Output.ts +49 -0
  309. package/model/listSources200Response.ts +36 -0
  310. package/model/listSources200Response1.ts +36 -0
  311. package/model/listSourcesAlphaOutput.ts +49 -0
  312. package/model/listSourcesFromTrackingPlan200Response.ts +36 -0
  313. package/model/listSourcesFromTrackingPlanV1Output.ts +49 -0
  314. package/model/listSourcesV1Output.ts +49 -0
  315. package/model/listSubscriptionsFromDestination200Response.ts +36 -0
  316. package/model/listSubscriptionsFromDestinationAlphaOutput.ts +49 -0
  317. package/model/listSuppressions200Response.ts +36 -0
  318. package/model/listSuppressionsV1Output.ts +49 -0
  319. package/model/listSyncsFromWarehouse200Response.ts +36 -0
  320. package/model/listSyncsFromWarehouseAndSource200Response.ts +36 -0
  321. package/model/listSyncsFromWarehouseAndSourceV1Output.ts +49 -0
  322. package/model/listSyncsFromWarehouseV1Output.ts +49 -0
  323. package/model/listTrackingPlans200Response.ts +36 -0
  324. package/model/listTrackingPlansV1Output.ts +49 -0
  325. package/model/listTransformations200Response.ts +36 -0
  326. package/model/listTransformationsBetaOutput.ts +49 -0
  327. package/model/listUserGroups200Response.ts +36 -0
  328. package/model/listUserGroupsFromUser200Response.ts +36 -0
  329. package/model/listUserGroupsFromUserV1Output.ts +49 -0
  330. package/model/listUserGroupsV1Output.ts +49 -0
  331. package/model/listUsers200Response.ts +36 -0
  332. package/model/listUsersFromUserGroup200Response.ts +36 -0
  333. package/model/listUsersFromUserGroupV1Output.ts +49 -0
  334. package/model/listUsersV1Output.ts +49 -0
  335. package/model/listWarehouses200Response.ts +36 -0
  336. package/model/listWarehousesV1Output.ts +49 -0
  337. package/model/listWorkspaceRegulations200Response.ts +36 -0
  338. package/model/listWorkspaceRegulationsV1Output.ts +49 -0
  339. package/model/logos.ts +59 -0
  340. package/model/logos1.ts +59 -0
  341. package/model/logos2.ts +59 -0
  342. package/model/logosBeta.ts +59 -0
  343. package/model/messageSubscriptionResponse.ts +78 -0
  344. package/model/messageSubscriptionResponseError.ts +47 -0
  345. package/model/messagesSubscriptionRequest.ts +68 -0
  346. package/model/metadata.ts +203 -0
  347. package/model/metadata1.ts +103 -0
  348. package/model/metadata2.ts +85 -0
  349. package/model/metricBeta.ts +60 -0
  350. package/model/minimalUserGroupV1.ts +50 -0
  351. package/model/minimalUserV1.ts +59 -0
  352. package/model/models.ts +1838 -0
  353. package/model/mtuSnapshotV1.ts +95 -0
  354. package/model/pagination.ts +68 -0
  355. package/model/paginationInput.ts +50 -0
  356. package/model/paginationOutput.ts +68 -0
  357. package/model/permissionInputV1.ts +51 -0
  358. package/model/permissionResourceV1.ts +70 -0
  359. package/model/permissionV1.ts +70 -0
  360. package/model/previewDestinationFilter200Response.ts +36 -0
  361. package/model/previewDestinationFilterV1.ts +51 -0
  362. package/model/previewDestinationFilterV1Input.ts +48 -0
  363. package/model/previewDestinationFilterV1Output.ts +50 -0
  364. package/model/propertyRenameBeta.ts +47 -0
  365. package/model/regulation.ts +99 -0
  366. package/model/regulationListEntryV1.ts +77 -0
  367. package/model/removeFilterFromDestination200Response.ts +36 -0
  368. package/model/removeFilterFromDestinationV1Output.ts +47 -0
  369. package/model/removeRuleV1.ts +61 -0
  370. package/model/removeRulesFromTrackingPlan200Response.ts +36 -0
  371. package/model/removeRulesFromTrackingPlanV1Output.ts +47 -0
  372. package/model/removeSourceConnectionFromWarehouse200Response.ts +36 -0
  373. package/model/removeSourceConnectionFromWarehouseV1Output.ts +47 -0
  374. package/model/removeSourceFromTrackingPlan200Response.ts +36 -0
  375. package/model/removeSourceFromTrackingPlanV1Output.ts +47 -0
  376. package/model/removeSubscriptionFromDestination200Response.ts +36 -0
  377. package/model/removeSubscriptionFromDestinationAlphaOutput.ts +47 -0
  378. package/model/removeUsersFromUserGroup200Response.ts +36 -0
  379. package/model/removeUsersFromUserGroupV1Output.ts +47 -0
  380. package/model/replaceAdvancedSyncScheduleForWarehouse200Response.ts +36 -0
  381. package/model/replaceAdvancedSyncScheduleForWarehouseV1Input.ts +48 -0
  382. package/model/replaceAdvancedSyncScheduleForWarehouseV1Output.ts +48 -0
  383. package/model/replaceLabelsInSource200Response.ts +36 -0
  384. package/model/replaceLabelsInSource200Response1.ts +36 -0
  385. package/model/replaceLabelsInSourceAlphaInput.ts +42 -0
  386. package/model/replaceLabelsInSourceAlphaOutput.ts +42 -0
  387. package/model/replaceLabelsInSourceV1Input.ts +42 -0
  388. package/model/replaceLabelsInSourceV1Output.ts +42 -0
  389. package/model/replaceMessagingSubscriptionsInSpaces200Response.ts +36 -0
  390. package/model/replaceMessagingSubscriptionsInSpacesAlphaInput.ts +42 -0
  391. package/model/replaceMessagingSubscriptionsInSpacesAlphaOutput.ts +58 -0
  392. package/model/replacePermissionsForUser200Response.ts +36 -0
  393. package/model/replacePermissionsForUserGroup200Response.ts +36 -0
  394. package/model/replacePermissionsForUserGroupV1Input.ts +42 -0
  395. package/model/replacePermissionsForUserGroupV1Output.ts +42 -0
  396. package/model/replacePermissionsForUserV1Input.ts +42 -0
  397. package/model/replacePermissionsForUserV1Output.ts +42 -0
  398. package/model/replaceRulesInTrackingPlan200Response.ts +36 -0
  399. package/model/replaceRulesInTrackingPlanV1Input.ts +42 -0
  400. package/model/replaceRulesInTrackingPlanV1Output.ts +47 -0
  401. package/model/replaceUsersInUserGroup200Response.ts +36 -0
  402. package/model/replaceUsersInUserGroupV1Input.ts +41 -0
  403. package/model/replaceUsersInUserGroupV1Output.ts +39 -0
  404. package/model/requestError.ts +77 -0
  405. package/model/requestErrorEnvelope.ts +39 -0
  406. package/model/resourceV1.ts +60 -0
  407. package/model/roleV1.ts +59 -0
  408. package/model/ruleV1.ts +106 -0
  409. package/model/schedule.ts +51 -0
  410. package/model/schedule1.ts +51 -0
  411. package/model/schedule2.ts +51 -0
  412. package/model/settings.ts +71 -0
  413. package/model/settings1.ts +71 -0
  414. package/model/source.ts +59 -0
  415. package/model/source1.ts +112 -0
  416. package/model/source2.ts +112 -0
  417. package/model/source3.ts +112 -0
  418. package/model/source4.ts +112 -0
  419. package/model/source5.ts +112 -0
  420. package/model/source6.ts +112 -0
  421. package/model/sourceAPICallSnapshotV1.ts +59 -0
  422. package/model/sourceAlpha.ts +112 -0
  423. package/model/sourceEventVolumeDatapointV1.ts +50 -0
  424. package/model/sourceEventVolumeV1.ts +76 -0
  425. package/model/sourceMetadata.ts +103 -0
  426. package/model/sourceMetadataV1.ts +103 -0
  427. package/model/sourceSettingsOutputV1.ts +71 -0
  428. package/model/sourceV1.ts +112 -0
  429. package/model/space.ts +50 -0
  430. package/model/streamStatusV1.ts +45 -0
  431. package/model/subscription.ts +104 -0
  432. package/model/supportedFeatures.ts +93 -0
  433. package/model/supportedMethods.ts +77 -0
  434. package/model/supportedPlatforms.ts +59 -0
  435. package/model/suppressedInner.ts +41 -0
  436. package/model/syncNoticeV1.ts +59 -0
  437. package/model/syncV1.ts +105 -0
  438. package/model/track.ts +85 -0
  439. package/model/trackSourceSettingsV1.ts +82 -0
  440. package/model/trackingPlan.ts +104 -0
  441. package/model/trackingPlan1.ts +104 -0
  442. package/model/trackingPlanV1.ts +104 -0
  443. package/model/transformation.ts +105 -0
  444. package/model/transformation1.ts +105 -0
  445. package/model/transformation2.ts +105 -0
  446. package/model/transformationBeta.ts +105 -0
  447. package/model/updateDestination200Response.ts +36 -0
  448. package/model/updateDestinationV1Input.ts +59 -0
  449. package/model/updateDestinationV1Output.ts +39 -0
  450. package/model/updateFilterForDestination200Response.ts +36 -0
  451. package/model/updateFilterForDestinationV1Input.ts +78 -0
  452. package/model/updateFilterForDestinationV1Output.ts +39 -0
  453. package/model/updateFunction200Response.ts +36 -0
  454. package/model/updateFunctionV1Input.ts +78 -0
  455. package/model/updateFunctionV1Output.ts +39 -0
  456. package/model/updateRulesInTrackingPlan200Response.ts +36 -0
  457. package/model/updateRulesInTrackingPlanV1Input.ts +42 -0
  458. package/model/updateRulesInTrackingPlanV1Output.ts +47 -0
  459. package/model/updateSchemaSettingsInSource200Response.ts +36 -0
  460. package/model/updateSchemaSettingsInSourceV1Input.ts +71 -0
  461. package/model/updateSchemaSettingsInSourceV1Output.ts +48 -0
  462. package/model/updateSelectiveSyncForWarehouse200Response.ts +36 -0
  463. package/model/updateSelectiveSyncForWarehouseV1Input.ts +42 -0
  464. package/model/updateSelectiveSyncForWarehouseV1Output.ts +57 -0
  465. package/model/updateSource200Response.ts +36 -0
  466. package/model/updateSource200Response1.ts +36 -0
  467. package/model/updateSourceAlphaInput.ts +68 -0
  468. package/model/updateSourceAlphaOutput.ts +39 -0
  469. package/model/updateSourceV1Input.ts +68 -0
  470. package/model/updateSourceV1Output.ts +39 -0
  471. package/model/updateSubscriptionForDestination200Response.ts +36 -0
  472. package/model/updateSubscriptionForDestinationAlphaInput.ts +39 -0
  473. package/model/updateSubscriptionForDestinationAlphaOutput.ts +39 -0
  474. package/model/updateTrackingPlan200Response.ts +36 -0
  475. package/model/updateTrackingPlanV1Input.ts +50 -0
  476. package/model/updateTrackingPlanV1Output.ts +47 -0
  477. package/model/updateTransformation200Response.ts +36 -0
  478. package/model/updateTransformationBetaInput.ts +96 -0
  479. package/model/updateTransformationBetaOutput.ts +39 -0
  480. package/model/updateUserGroup200Response.ts +36 -0
  481. package/model/updateUserGroupV1Input.ts +41 -0
  482. package/model/updateUserGroupV1Output.ts +39 -0
  483. package/model/updateWarehouse200Response.ts +36 -0
  484. package/model/updateWarehouseV1Input.ts +59 -0
  485. package/model/updateWarehouseV1Output.ts +39 -0
  486. package/model/upsertRuleV1.ts +112 -0
  487. package/model/user.ts +69 -0
  488. package/model/userGroup.ts +69 -0
  489. package/model/userGroup1.ts +69 -0
  490. package/model/userGroup2.ts +69 -0
  491. package/model/userGroup3.ts +69 -0
  492. package/model/userGroupV1.ts +69 -0
  493. package/model/userV1.ts +69 -0
  494. package/model/usersPerSourceSnapshotV1.ts +104 -0
  495. package/model/warehouse.ts +75 -0
  496. package/model/warehouse1.ts +75 -0
  497. package/model/warehouse2.ts +75 -0
  498. package/model/warehouseAdvancedSyncV1.ts +50 -0
  499. package/model/warehouseMetadata.ts +85 -0
  500. package/model/warehouseMetadataV1.ts +85 -0
  501. package/model/warehouseSelectiveSyncItemV1.ts +68 -0
  502. package/model/warehouseSyncOverrideV1.ts +68 -0
  503. package/model/warehouseV1.ts +75 -0
  504. package/model/workspace.ts +59 -0
  505. package/model/workspaceV1.ts +59 -0
  506. package/package.json +1 -2
  507. package/tests/__snapshots__/smoke.test.ts.snap +889 -0
  508. package/tests/smoke.test.ts +267 -0
  509. package/tsconfig.json +20 -0
@@ -0,0 +1,3262 @@
1
+ /**
2
+ * Segment Public API
3
+ * The Segment Public API helps you manage your Segment Workspaces and its resources. You can use the API to perform CRUD (create, read, update, delete) operations at no extra charge. This includes working with resources such as Sources, Destinations, Warehouses, Tracking Plans, and the Segment Destinations and Sources Catalogs. All CRUD endpoints in the API follow REST conventions and use standard HTTP methods. Different URL endpoints represent different resources in a Workspace. See the next sections for more information on how to use the Segment Public API.
4
+ *
5
+ * The version of the OpenAPI document: 32.0.2
6
+ * Contact: friends@segment.com
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+ import localVarRequest from 'request';
14
+ import http from 'http';
15
+
16
+ /* tslint:disable:no-unused-locals */
17
+ import { CreateFilterForDestination200Response } from '../model/createFilterForDestination200Response';
18
+ import { CreateFilterForDestinationV1Input } from '../model/createFilterForDestinationV1Input';
19
+ import { GetFilterInDestination200Response } from '../model/getFilterInDestination200Response';
20
+ import { ListFiltersFromDestination200Response } from '../model/listFiltersFromDestination200Response';
21
+ import { PaginationInput } from '../model/paginationInput';
22
+ import { PreviewDestinationFilter200Response } from '../model/previewDestinationFilter200Response';
23
+ import { PreviewDestinationFilterV1Input } from '../model/previewDestinationFilterV1Input';
24
+ import { RemoveFilterFromDestination200Response } from '../model/removeFilterFromDestination200Response';
25
+ import { RequestErrorEnvelope } from '../model/requestErrorEnvelope';
26
+ import { UpdateFilterForDestination200Response } from '../model/updateFilterForDestination200Response';
27
+ import { UpdateFilterForDestinationV1Input } from '../model/updateFilterForDestinationV1Input';
28
+
29
+ import {
30
+ ObjectSerializer,
31
+ Authentication,
32
+ VoidAuth,
33
+ Interceptor,
34
+ } from '../model/models';
35
+ import {
36
+ HttpBasicAuth,
37
+ HttpBearerAuth,
38
+ ApiKeyAuth,
39
+ OAuth,
40
+ } from '../model/models';
41
+
42
+ import { HttpError, RequestFile } from './apis';
43
+
44
+ let defaultBasePath = 'https://api.segmentapis.com';
45
+
46
+ // ===============================================
47
+ // This file is autogenerated - Please do not edit
48
+ // ===============================================
49
+
50
+ export enum DestinationFiltersApiApiKeys {}
51
+
52
+ export class DestinationFiltersApi {
53
+ protected _basePath = defaultBasePath;
54
+ protected _defaultHeaders: any = {};
55
+ protected _useQuerystring: boolean = false;
56
+
57
+ protected authentications = {
58
+ default: <Authentication>new VoidAuth(),
59
+ token: new HttpBearerAuth(),
60
+ };
61
+
62
+ protected interceptors: Interceptor[] = [];
63
+
64
+ constructor(basePath?: string);
65
+ constructor(
66
+ basePathOrUsername: string,
67
+ password?: string,
68
+ basePath?: string
69
+ ) {
70
+ if (password) {
71
+ if (basePath) {
72
+ this.basePath = basePath;
73
+ }
74
+ } else {
75
+ if (basePathOrUsername) {
76
+ this.basePath = basePathOrUsername;
77
+ }
78
+ }
79
+ }
80
+
81
+ set useQuerystring(value: boolean) {
82
+ this._useQuerystring = value;
83
+ }
84
+
85
+ set basePath(basePath: string) {
86
+ this._basePath = basePath;
87
+ }
88
+
89
+ set defaultHeaders(defaultHeaders: any) {
90
+ this._defaultHeaders = defaultHeaders;
91
+ }
92
+
93
+ get defaultHeaders() {
94
+ return this._defaultHeaders;
95
+ }
96
+
97
+ get basePath() {
98
+ return this._basePath;
99
+ }
100
+
101
+ public setDefaultAuthentication(auth: Authentication) {
102
+ this.authentications.default = auth;
103
+ }
104
+
105
+ public setApiKey(key: DestinationFiltersApiApiKeys, value: string) {
106
+ (this.authentications as any)[
107
+ DestinationFiltersApiApiKeys[key]
108
+ ].apiKey = value;
109
+ }
110
+
111
+ set accessToken(accessToken: string | (() => string)) {
112
+ this.authentications.token.accessToken = accessToken;
113
+ }
114
+
115
+ public addInterceptor(interceptor: Interceptor) {
116
+ this.interceptors.push(interceptor);
117
+ }
118
+
119
+ /**
120
+ * Creates a filter in a Destination. When called, this endpoint may generate the `Destination Filter Created` [Audit Trail](/tag/Audit-Trail) event.
121
+ * @summary Create Filter for Destination
122
+ * @param destinationId
123
+ * @param CreateFilterForDestinationV1Input
124
+ */
125
+ public async createFilterForDestinationAlpha(
126
+ destinationId: string,
127
+ CreateFilterForDestinationV1Input: CreateFilterForDestinationV1Input,
128
+ options: { headers: { [name: string]: string } } = { headers: {} }
129
+ ): Promise<{
130
+ response: http.IncomingMessage;
131
+ body: CreateFilterForDestination200Response;
132
+ }> {
133
+ const localVarPath =
134
+ this.basePath +
135
+ '/destination/{destinationId}/filters'.replace(
136
+ '{' + 'destinationId' + '}',
137
+ encodeURIComponent(String(destinationId))
138
+ );
139
+ let localVarQueryParameters: any = {};
140
+ let localVarHeaderParams: any = (<any>Object).assign(
141
+ {},
142
+ this._defaultHeaders
143
+ );
144
+ const produces = [
145
+ 'application/vnd.segment.v1alpha+json',
146
+ 'application/json',
147
+ ];
148
+ if (produces.indexOf('application/json') >= 0) {
149
+ localVarHeaderParams.Accept = produces[0];
150
+ } else {
151
+ localVarHeaderParams.Accept = 'application/json';
152
+ }
153
+ let localVarFormParams: any = {};
154
+
155
+ // verify required parameter 'destinationId' is not null or undefined
156
+ if (destinationId === null || destinationId === undefined) {
157
+ throw new Error(
158
+ 'Required parameter destinationId was null or undefined when calling createFilterForDestinationAlpha.'
159
+ );
160
+ }
161
+
162
+ // verify required parameter 'CreateFilterForDestinationV1Input' is not null or undefined
163
+ if (
164
+ CreateFilterForDestinationV1Input === null ||
165
+ CreateFilterForDestinationV1Input === undefined
166
+ ) {
167
+ throw new Error(
168
+ 'Required parameter CreateFilterForDestinationV1Input was null or undefined when calling createFilterForDestinationAlpha.'
169
+ );
170
+ }
171
+
172
+ (<any>Object).assign(localVarHeaderParams, options.headers);
173
+
174
+ let localVarUseFormData = false;
175
+
176
+ let localVarRequestOptions: localVarRequest.Options = {
177
+ method: 'POST',
178
+ qs: localVarQueryParameters,
179
+ headers: localVarHeaderParams,
180
+ uri: localVarPath,
181
+ useQuerystring: this._useQuerystring,
182
+ json: true,
183
+ body: ObjectSerializer.serialize(
184
+ CreateFilterForDestinationV1Input,
185
+ 'CreateFilterForDestinationV1Input'
186
+ ),
187
+ };
188
+
189
+ let authenticationPromise = Promise.resolve();
190
+ if (this.authentications.token.accessToken) {
191
+ authenticationPromise = authenticationPromise.then(() =>
192
+ this.authentications.token.applyToRequest(
193
+ localVarRequestOptions
194
+ )
195
+ );
196
+ }
197
+ authenticationPromise = authenticationPromise.then(() =>
198
+ this.authentications.default.applyToRequest(localVarRequestOptions)
199
+ );
200
+
201
+ let interceptorPromise = authenticationPromise;
202
+ for (const interceptor of this.interceptors) {
203
+ interceptorPromise = interceptorPromise.then(() =>
204
+ interceptor(localVarRequestOptions)
205
+ );
206
+ }
207
+
208
+ return interceptorPromise.then(() => {
209
+ if (Object.keys(localVarFormParams).length) {
210
+ if (localVarUseFormData) {
211
+ (<any>localVarRequestOptions).formData = localVarFormParams;
212
+ } else {
213
+ localVarRequestOptions.form = localVarFormParams;
214
+ }
215
+ }
216
+ return new Promise<{
217
+ response: http.IncomingMessage;
218
+ body: CreateFilterForDestination200Response;
219
+ }>((resolve, reject) => {
220
+ localVarRequest(
221
+ localVarRequestOptions,
222
+ (error, response, body) => {
223
+ if (error) {
224
+ reject(error);
225
+ } else {
226
+ if (
227
+ response.statusCode &&
228
+ response.statusCode >= 200 &&
229
+ response.statusCode <= 299
230
+ ) {
231
+ body = ObjectSerializer.deserialize(
232
+ body,
233
+ 'CreateFilterForDestination200Response'
234
+ );
235
+ resolve({ response: response, body: body });
236
+ } else {
237
+ reject(
238
+ new HttpError(
239
+ response,
240
+ body,
241
+ response.statusCode
242
+ )
243
+ );
244
+ }
245
+ }
246
+ }
247
+ );
248
+ });
249
+ });
250
+ }
251
+ /**
252
+ * Creates a filter in a Destination. When called, this endpoint may generate the `Destination Filter Created` [Audit Trail](/tag/Audit-Trail) event.
253
+ * @summary Create Filter for Destination
254
+ * @param destinationId
255
+ * @param CreateFilterForDestinationV1Input
256
+ */
257
+ public async createFilterForDestinationBeta(
258
+ destinationId: string,
259
+ CreateFilterForDestinationV1Input: CreateFilterForDestinationV1Input,
260
+ options: { headers: { [name: string]: string } } = { headers: {} }
261
+ ): Promise<{
262
+ response: http.IncomingMessage;
263
+ body: CreateFilterForDestination200Response;
264
+ }> {
265
+ const localVarPath =
266
+ this.basePath +
267
+ '/destination/{destinationId}/filters'.replace(
268
+ '{' + 'destinationId' + '}',
269
+ encodeURIComponent(String(destinationId))
270
+ );
271
+ let localVarQueryParameters: any = {};
272
+ let localVarHeaderParams: any = (<any>Object).assign(
273
+ {},
274
+ this._defaultHeaders
275
+ );
276
+ const produces = [
277
+ 'application/vnd.segment.v1beta+json',
278
+ 'application/json',
279
+ ];
280
+ if (produces.indexOf('application/json') >= 0) {
281
+ localVarHeaderParams.Accept = produces[0];
282
+ } else {
283
+ localVarHeaderParams.Accept = 'application/json';
284
+ }
285
+ let localVarFormParams: any = {};
286
+
287
+ // verify required parameter 'destinationId' is not null or undefined
288
+ if (destinationId === null || destinationId === undefined) {
289
+ throw new Error(
290
+ 'Required parameter destinationId was null or undefined when calling createFilterForDestinationBeta.'
291
+ );
292
+ }
293
+
294
+ // verify required parameter 'CreateFilterForDestinationV1Input' is not null or undefined
295
+ if (
296
+ CreateFilterForDestinationV1Input === null ||
297
+ CreateFilterForDestinationV1Input === undefined
298
+ ) {
299
+ throw new Error(
300
+ 'Required parameter CreateFilterForDestinationV1Input was null or undefined when calling createFilterForDestinationBeta.'
301
+ );
302
+ }
303
+
304
+ (<any>Object).assign(localVarHeaderParams, options.headers);
305
+
306
+ let localVarUseFormData = false;
307
+
308
+ let localVarRequestOptions: localVarRequest.Options = {
309
+ method: 'POST',
310
+ qs: localVarQueryParameters,
311
+ headers: localVarHeaderParams,
312
+ uri: localVarPath,
313
+ useQuerystring: this._useQuerystring,
314
+ json: true,
315
+ body: ObjectSerializer.serialize(
316
+ CreateFilterForDestinationV1Input,
317
+ 'CreateFilterForDestinationV1Input'
318
+ ),
319
+ };
320
+
321
+ let authenticationPromise = Promise.resolve();
322
+ if (this.authentications.token.accessToken) {
323
+ authenticationPromise = authenticationPromise.then(() =>
324
+ this.authentications.token.applyToRequest(
325
+ localVarRequestOptions
326
+ )
327
+ );
328
+ }
329
+ authenticationPromise = authenticationPromise.then(() =>
330
+ this.authentications.default.applyToRequest(localVarRequestOptions)
331
+ );
332
+
333
+ let interceptorPromise = authenticationPromise;
334
+ for (const interceptor of this.interceptors) {
335
+ interceptorPromise = interceptorPromise.then(() =>
336
+ interceptor(localVarRequestOptions)
337
+ );
338
+ }
339
+
340
+ return interceptorPromise.then(() => {
341
+ if (Object.keys(localVarFormParams).length) {
342
+ if (localVarUseFormData) {
343
+ (<any>localVarRequestOptions).formData = localVarFormParams;
344
+ } else {
345
+ localVarRequestOptions.form = localVarFormParams;
346
+ }
347
+ }
348
+ return new Promise<{
349
+ response: http.IncomingMessage;
350
+ body: CreateFilterForDestination200Response;
351
+ }>((resolve, reject) => {
352
+ localVarRequest(
353
+ localVarRequestOptions,
354
+ (error, response, body) => {
355
+ if (error) {
356
+ reject(error);
357
+ } else {
358
+ if (
359
+ response.statusCode &&
360
+ response.statusCode >= 200 &&
361
+ response.statusCode <= 299
362
+ ) {
363
+ body = ObjectSerializer.deserialize(
364
+ body,
365
+ 'CreateFilterForDestination200Response'
366
+ );
367
+ resolve({ response: response, body: body });
368
+ } else {
369
+ reject(
370
+ new HttpError(
371
+ response,
372
+ body,
373
+ response.statusCode
374
+ )
375
+ );
376
+ }
377
+ }
378
+ }
379
+ );
380
+ });
381
+ });
382
+ }
383
+ /**
384
+ * Creates a filter in a Destination. When called, this endpoint may generate the `Destination Filter Created` [Audit Trail](/tag/Audit-Trail) event.
385
+ * @summary Create Filter for Destination
386
+ * @param destinationId
387
+ * @param CreateFilterForDestinationV1Input
388
+ */
389
+ public async createFilterForDestinationCurrent(
390
+ destinationId: string,
391
+ CreateFilterForDestinationV1Input: CreateFilterForDestinationV1Input,
392
+ options: { headers: { [name: string]: string } } = { headers: {} }
393
+ ): Promise<{
394
+ response: http.IncomingMessage;
395
+ body: CreateFilterForDestination200Response;
396
+ }> {
397
+ const localVarPath =
398
+ this.basePath +
399
+ '/destination/{destinationId}/filters'.replace(
400
+ '{' + 'destinationId' + '}',
401
+ encodeURIComponent(String(destinationId))
402
+ );
403
+ let localVarQueryParameters: any = {};
404
+ let localVarHeaderParams: any = (<any>Object).assign(
405
+ {},
406
+ this._defaultHeaders
407
+ );
408
+ const produces = [
409
+ 'application/vnd.segment.v1+json',
410
+ 'application/json',
411
+ ];
412
+ if (produces.indexOf('application/json') >= 0) {
413
+ localVarHeaderParams.Accept = produces[0];
414
+ } else {
415
+ localVarHeaderParams.Accept = 'application/json';
416
+ }
417
+ let localVarFormParams: any = {};
418
+
419
+ // verify required parameter 'destinationId' is not null or undefined
420
+ if (destinationId === null || destinationId === undefined) {
421
+ throw new Error(
422
+ 'Required parameter destinationId was null or undefined when calling createFilterForDestinationCurrent.'
423
+ );
424
+ }
425
+
426
+ // verify required parameter 'CreateFilterForDestinationV1Input' is not null or undefined
427
+ if (
428
+ CreateFilterForDestinationV1Input === null ||
429
+ CreateFilterForDestinationV1Input === undefined
430
+ ) {
431
+ throw new Error(
432
+ 'Required parameter CreateFilterForDestinationV1Input was null or undefined when calling createFilterForDestinationCurrent.'
433
+ );
434
+ }
435
+
436
+ (<any>Object).assign(localVarHeaderParams, options.headers);
437
+
438
+ let localVarUseFormData = false;
439
+
440
+ let localVarRequestOptions: localVarRequest.Options = {
441
+ method: 'POST',
442
+ qs: localVarQueryParameters,
443
+ headers: localVarHeaderParams,
444
+ uri: localVarPath,
445
+ useQuerystring: this._useQuerystring,
446
+ json: true,
447
+ body: ObjectSerializer.serialize(
448
+ CreateFilterForDestinationV1Input,
449
+ 'CreateFilterForDestinationV1Input'
450
+ ),
451
+ };
452
+
453
+ let authenticationPromise = Promise.resolve();
454
+ if (this.authentications.token.accessToken) {
455
+ authenticationPromise = authenticationPromise.then(() =>
456
+ this.authentications.token.applyToRequest(
457
+ localVarRequestOptions
458
+ )
459
+ );
460
+ }
461
+ authenticationPromise = authenticationPromise.then(() =>
462
+ this.authentications.default.applyToRequest(localVarRequestOptions)
463
+ );
464
+
465
+ let interceptorPromise = authenticationPromise;
466
+ for (const interceptor of this.interceptors) {
467
+ interceptorPromise = interceptorPromise.then(() =>
468
+ interceptor(localVarRequestOptions)
469
+ );
470
+ }
471
+
472
+ return interceptorPromise.then(() => {
473
+ if (Object.keys(localVarFormParams).length) {
474
+ if (localVarUseFormData) {
475
+ (<any>localVarRequestOptions).formData = localVarFormParams;
476
+ } else {
477
+ localVarRequestOptions.form = localVarFormParams;
478
+ }
479
+ }
480
+ return new Promise<{
481
+ response: http.IncomingMessage;
482
+ body: CreateFilterForDestination200Response;
483
+ }>((resolve, reject) => {
484
+ localVarRequest(
485
+ localVarRequestOptions,
486
+ (error, response, body) => {
487
+ if (error) {
488
+ reject(error);
489
+ } else {
490
+ if (
491
+ response.statusCode &&
492
+ response.statusCode >= 200 &&
493
+ response.statusCode <= 299
494
+ ) {
495
+ body = ObjectSerializer.deserialize(
496
+ body,
497
+ 'CreateFilterForDestination200Response'
498
+ );
499
+ resolve({ response: response, body: body });
500
+ } else {
501
+ reject(
502
+ new HttpError(
503
+ response,
504
+ body,
505
+ response.statusCode
506
+ )
507
+ );
508
+ }
509
+ }
510
+ }
511
+ );
512
+ });
513
+ });
514
+ }
515
+ /**
516
+ * Creates a filter in a Destination. When called, this endpoint may generate the `Destination Filter Created` [Audit Trail](/tag/Audit-Trail) event.
517
+ * @summary Create Filter for Destination
518
+ * @param destinationId
519
+ * @param CreateFilterForDestinationV1Input
520
+ */
521
+ public async createFilterForDestinationV1(
522
+ destinationId: string,
523
+ CreateFilterForDestinationV1Input: CreateFilterForDestinationV1Input,
524
+ options: { headers: { [name: string]: string } } = { headers: {} }
525
+ ): Promise<{
526
+ response: http.IncomingMessage;
527
+ body: CreateFilterForDestination200Response;
528
+ }> {
529
+ const localVarPath =
530
+ this.basePath +
531
+ '/destination/{destinationId}/filters'.replace(
532
+ '{' + 'destinationId' + '}',
533
+ encodeURIComponent(String(destinationId))
534
+ );
535
+ let localVarQueryParameters: any = {};
536
+ let localVarHeaderParams: any = (<any>Object).assign(
537
+ {},
538
+ this._defaultHeaders
539
+ );
540
+ const produces = [
541
+ 'application/vnd.segment.v1+json',
542
+ 'application/json',
543
+ ];
544
+ if (produces.indexOf('application/json') >= 0) {
545
+ localVarHeaderParams.Accept = produces[0];
546
+ } else {
547
+ localVarHeaderParams.Accept = 'application/json';
548
+ }
549
+ let localVarFormParams: any = {};
550
+
551
+ // verify required parameter 'destinationId' is not null or undefined
552
+ if (destinationId === null || destinationId === undefined) {
553
+ throw new Error(
554
+ 'Required parameter destinationId was null or undefined when calling createFilterForDestinationV1.'
555
+ );
556
+ }
557
+
558
+ // verify required parameter 'CreateFilterForDestinationV1Input' is not null or undefined
559
+ if (
560
+ CreateFilterForDestinationV1Input === null ||
561
+ CreateFilterForDestinationV1Input === undefined
562
+ ) {
563
+ throw new Error(
564
+ 'Required parameter CreateFilterForDestinationV1Input was null or undefined when calling createFilterForDestinationV1.'
565
+ );
566
+ }
567
+
568
+ (<any>Object).assign(localVarHeaderParams, options.headers);
569
+
570
+ let localVarUseFormData = false;
571
+
572
+ let localVarRequestOptions: localVarRequest.Options = {
573
+ method: 'POST',
574
+ qs: localVarQueryParameters,
575
+ headers: localVarHeaderParams,
576
+ uri: localVarPath,
577
+ useQuerystring: this._useQuerystring,
578
+ json: true,
579
+ body: ObjectSerializer.serialize(
580
+ CreateFilterForDestinationV1Input,
581
+ 'CreateFilterForDestinationV1Input'
582
+ ),
583
+ };
584
+
585
+ let authenticationPromise = Promise.resolve();
586
+ if (this.authentications.token.accessToken) {
587
+ authenticationPromise = authenticationPromise.then(() =>
588
+ this.authentications.token.applyToRequest(
589
+ localVarRequestOptions
590
+ )
591
+ );
592
+ }
593
+ authenticationPromise = authenticationPromise.then(() =>
594
+ this.authentications.default.applyToRequest(localVarRequestOptions)
595
+ );
596
+
597
+ let interceptorPromise = authenticationPromise;
598
+ for (const interceptor of this.interceptors) {
599
+ interceptorPromise = interceptorPromise.then(() =>
600
+ interceptor(localVarRequestOptions)
601
+ );
602
+ }
603
+
604
+ return interceptorPromise.then(() => {
605
+ if (Object.keys(localVarFormParams).length) {
606
+ if (localVarUseFormData) {
607
+ (<any>localVarRequestOptions).formData = localVarFormParams;
608
+ } else {
609
+ localVarRequestOptions.form = localVarFormParams;
610
+ }
611
+ }
612
+ return new Promise<{
613
+ response: http.IncomingMessage;
614
+ body: CreateFilterForDestination200Response;
615
+ }>((resolve, reject) => {
616
+ localVarRequest(
617
+ localVarRequestOptions,
618
+ (error, response, body) => {
619
+ if (error) {
620
+ reject(error);
621
+ } else {
622
+ if (
623
+ response.statusCode &&
624
+ response.statusCode >= 200 &&
625
+ response.statusCode <= 299
626
+ ) {
627
+ body = ObjectSerializer.deserialize(
628
+ body,
629
+ 'CreateFilterForDestination200Response'
630
+ );
631
+ resolve({ response: response, body: body });
632
+ } else {
633
+ reject(
634
+ new HttpError(
635
+ response,
636
+ body,
637
+ response.statusCode
638
+ )
639
+ );
640
+ }
641
+ }
642
+ }
643
+ );
644
+ });
645
+ });
646
+ }
647
+ /**
648
+ * Gets a Destination filter by id.
649
+ * @summary Get Filter in Destination
650
+ * @param destinationId
651
+ * @param filterId
652
+ */
653
+ public async getFilterInDestinationAlpha(
654
+ destinationId: string,
655
+ filterId: string,
656
+ options: { headers: { [name: string]: string } } = { headers: {} }
657
+ ): Promise<{
658
+ response: http.IncomingMessage;
659
+ body: GetFilterInDestination200Response;
660
+ }> {
661
+ const localVarPath =
662
+ this.basePath +
663
+ '/destination/{destinationId}/filters/{filterId}'
664
+ .replace(
665
+ '{' + 'destinationId' + '}',
666
+ encodeURIComponent(String(destinationId))
667
+ )
668
+ .replace(
669
+ '{' + 'filterId' + '}',
670
+ encodeURIComponent(String(filterId))
671
+ );
672
+ let localVarQueryParameters: any = {};
673
+ let localVarHeaderParams: any = (<any>Object).assign(
674
+ {},
675
+ this._defaultHeaders
676
+ );
677
+ const produces = [
678
+ 'application/vnd.segment.v1alpha+json',
679
+ 'application/json',
680
+ ];
681
+ if (produces.indexOf('application/json') >= 0) {
682
+ localVarHeaderParams.Accept = produces[0];
683
+ } else {
684
+ localVarHeaderParams.Accept = 'application/json';
685
+ }
686
+ let localVarFormParams: any = {};
687
+
688
+ // verify required parameter 'destinationId' is not null or undefined
689
+ if (destinationId === null || destinationId === undefined) {
690
+ throw new Error(
691
+ 'Required parameter destinationId was null or undefined when calling getFilterInDestinationAlpha.'
692
+ );
693
+ }
694
+
695
+ // verify required parameter 'filterId' is not null or undefined
696
+ if (filterId === null || filterId === undefined) {
697
+ throw new Error(
698
+ 'Required parameter filterId was null or undefined when calling getFilterInDestinationAlpha.'
699
+ );
700
+ }
701
+
702
+ (<any>Object).assign(localVarHeaderParams, options.headers);
703
+
704
+ let localVarUseFormData = false;
705
+
706
+ let localVarRequestOptions: localVarRequest.Options = {
707
+ method: 'GET',
708
+ qs: localVarQueryParameters,
709
+ headers: localVarHeaderParams,
710
+ uri: localVarPath,
711
+ useQuerystring: this._useQuerystring,
712
+ json: true,
713
+ };
714
+
715
+ let authenticationPromise = Promise.resolve();
716
+ if (this.authentications.token.accessToken) {
717
+ authenticationPromise = authenticationPromise.then(() =>
718
+ this.authentications.token.applyToRequest(
719
+ localVarRequestOptions
720
+ )
721
+ );
722
+ }
723
+ authenticationPromise = authenticationPromise.then(() =>
724
+ this.authentications.default.applyToRequest(localVarRequestOptions)
725
+ );
726
+
727
+ let interceptorPromise = authenticationPromise;
728
+ for (const interceptor of this.interceptors) {
729
+ interceptorPromise = interceptorPromise.then(() =>
730
+ interceptor(localVarRequestOptions)
731
+ );
732
+ }
733
+
734
+ return interceptorPromise.then(() => {
735
+ if (Object.keys(localVarFormParams).length) {
736
+ if (localVarUseFormData) {
737
+ (<any>localVarRequestOptions).formData = localVarFormParams;
738
+ } else {
739
+ localVarRequestOptions.form = localVarFormParams;
740
+ }
741
+ }
742
+ return new Promise<{
743
+ response: http.IncomingMessage;
744
+ body: GetFilterInDestination200Response;
745
+ }>((resolve, reject) => {
746
+ localVarRequest(
747
+ localVarRequestOptions,
748
+ (error, response, body) => {
749
+ if (error) {
750
+ reject(error);
751
+ } else {
752
+ if (
753
+ response.statusCode &&
754
+ response.statusCode >= 200 &&
755
+ response.statusCode <= 299
756
+ ) {
757
+ body = ObjectSerializer.deserialize(
758
+ body,
759
+ 'GetFilterInDestination200Response'
760
+ );
761
+ resolve({ response: response, body: body });
762
+ } else {
763
+ reject(
764
+ new HttpError(
765
+ response,
766
+ body,
767
+ response.statusCode
768
+ )
769
+ );
770
+ }
771
+ }
772
+ }
773
+ );
774
+ });
775
+ });
776
+ }
777
+ /**
778
+ * Gets a Destination filter by id.
779
+ * @summary Get Filter in Destination
780
+ * @param destinationId
781
+ * @param filterId
782
+ */
783
+ public async getFilterInDestinationBeta(
784
+ destinationId: string,
785
+ filterId: string,
786
+ options: { headers: { [name: string]: string } } = { headers: {} }
787
+ ): Promise<{
788
+ response: http.IncomingMessage;
789
+ body: GetFilterInDestination200Response;
790
+ }> {
791
+ const localVarPath =
792
+ this.basePath +
793
+ '/destination/{destinationId}/filters/{filterId}'
794
+ .replace(
795
+ '{' + 'destinationId' + '}',
796
+ encodeURIComponent(String(destinationId))
797
+ )
798
+ .replace(
799
+ '{' + 'filterId' + '}',
800
+ encodeURIComponent(String(filterId))
801
+ );
802
+ let localVarQueryParameters: any = {};
803
+ let localVarHeaderParams: any = (<any>Object).assign(
804
+ {},
805
+ this._defaultHeaders
806
+ );
807
+ const produces = [
808
+ 'application/vnd.segment.v1beta+json',
809
+ 'application/json',
810
+ ];
811
+ if (produces.indexOf('application/json') >= 0) {
812
+ localVarHeaderParams.Accept = produces[0];
813
+ } else {
814
+ localVarHeaderParams.Accept = 'application/json';
815
+ }
816
+ let localVarFormParams: any = {};
817
+
818
+ // verify required parameter 'destinationId' is not null or undefined
819
+ if (destinationId === null || destinationId === undefined) {
820
+ throw new Error(
821
+ 'Required parameter destinationId was null or undefined when calling getFilterInDestinationBeta.'
822
+ );
823
+ }
824
+
825
+ // verify required parameter 'filterId' is not null or undefined
826
+ if (filterId === null || filterId === undefined) {
827
+ throw new Error(
828
+ 'Required parameter filterId was null or undefined when calling getFilterInDestinationBeta.'
829
+ );
830
+ }
831
+
832
+ (<any>Object).assign(localVarHeaderParams, options.headers);
833
+
834
+ let localVarUseFormData = false;
835
+
836
+ let localVarRequestOptions: localVarRequest.Options = {
837
+ method: 'GET',
838
+ qs: localVarQueryParameters,
839
+ headers: localVarHeaderParams,
840
+ uri: localVarPath,
841
+ useQuerystring: this._useQuerystring,
842
+ json: true,
843
+ };
844
+
845
+ let authenticationPromise = Promise.resolve();
846
+ if (this.authentications.token.accessToken) {
847
+ authenticationPromise = authenticationPromise.then(() =>
848
+ this.authentications.token.applyToRequest(
849
+ localVarRequestOptions
850
+ )
851
+ );
852
+ }
853
+ authenticationPromise = authenticationPromise.then(() =>
854
+ this.authentications.default.applyToRequest(localVarRequestOptions)
855
+ );
856
+
857
+ let interceptorPromise = authenticationPromise;
858
+ for (const interceptor of this.interceptors) {
859
+ interceptorPromise = interceptorPromise.then(() =>
860
+ interceptor(localVarRequestOptions)
861
+ );
862
+ }
863
+
864
+ return interceptorPromise.then(() => {
865
+ if (Object.keys(localVarFormParams).length) {
866
+ if (localVarUseFormData) {
867
+ (<any>localVarRequestOptions).formData = localVarFormParams;
868
+ } else {
869
+ localVarRequestOptions.form = localVarFormParams;
870
+ }
871
+ }
872
+ return new Promise<{
873
+ response: http.IncomingMessage;
874
+ body: GetFilterInDestination200Response;
875
+ }>((resolve, reject) => {
876
+ localVarRequest(
877
+ localVarRequestOptions,
878
+ (error, response, body) => {
879
+ if (error) {
880
+ reject(error);
881
+ } else {
882
+ if (
883
+ response.statusCode &&
884
+ response.statusCode >= 200 &&
885
+ response.statusCode <= 299
886
+ ) {
887
+ body = ObjectSerializer.deserialize(
888
+ body,
889
+ 'GetFilterInDestination200Response'
890
+ );
891
+ resolve({ response: response, body: body });
892
+ } else {
893
+ reject(
894
+ new HttpError(
895
+ response,
896
+ body,
897
+ response.statusCode
898
+ )
899
+ );
900
+ }
901
+ }
902
+ }
903
+ );
904
+ });
905
+ });
906
+ }
907
+ /**
908
+ * Gets a Destination filter by id.
909
+ * @summary Get Filter in Destination
910
+ * @param destinationId
911
+ * @param filterId
912
+ */
913
+ public async getFilterInDestinationCurrent(
914
+ destinationId: string,
915
+ filterId: string,
916
+ options: { headers: { [name: string]: string } } = { headers: {} }
917
+ ): Promise<{
918
+ response: http.IncomingMessage;
919
+ body: GetFilterInDestination200Response;
920
+ }> {
921
+ const localVarPath =
922
+ this.basePath +
923
+ '/destination/{destinationId}/filters/{filterId}'
924
+ .replace(
925
+ '{' + 'destinationId' + '}',
926
+ encodeURIComponent(String(destinationId))
927
+ )
928
+ .replace(
929
+ '{' + 'filterId' + '}',
930
+ encodeURIComponent(String(filterId))
931
+ );
932
+ let localVarQueryParameters: any = {};
933
+ let localVarHeaderParams: any = (<any>Object).assign(
934
+ {},
935
+ this._defaultHeaders
936
+ );
937
+ const produces = ['application/json'];
938
+ if (produces.indexOf('application/json') >= 0) {
939
+ localVarHeaderParams.Accept = produces[0];
940
+ } else {
941
+ localVarHeaderParams.Accept = 'application/json';
942
+ }
943
+ let localVarFormParams: any = {};
944
+
945
+ // verify required parameter 'destinationId' is not null or undefined
946
+ if (destinationId === null || destinationId === undefined) {
947
+ throw new Error(
948
+ 'Required parameter destinationId was null or undefined when calling getFilterInDestinationCurrent.'
949
+ );
950
+ }
951
+
952
+ // verify required parameter 'filterId' is not null or undefined
953
+ if (filterId === null || filterId === undefined) {
954
+ throw new Error(
955
+ 'Required parameter filterId was null or undefined when calling getFilterInDestinationCurrent.'
956
+ );
957
+ }
958
+
959
+ (<any>Object).assign(localVarHeaderParams, options.headers);
960
+
961
+ let localVarUseFormData = false;
962
+
963
+ let localVarRequestOptions: localVarRequest.Options = {
964
+ method: 'GET',
965
+ qs: localVarQueryParameters,
966
+ headers: localVarHeaderParams,
967
+ uri: localVarPath,
968
+ useQuerystring: this._useQuerystring,
969
+ json: true,
970
+ };
971
+
972
+ let authenticationPromise = Promise.resolve();
973
+ if (this.authentications.token.accessToken) {
974
+ authenticationPromise = authenticationPromise.then(() =>
975
+ this.authentications.token.applyToRequest(
976
+ localVarRequestOptions
977
+ )
978
+ );
979
+ }
980
+ authenticationPromise = authenticationPromise.then(() =>
981
+ this.authentications.default.applyToRequest(localVarRequestOptions)
982
+ );
983
+
984
+ let interceptorPromise = authenticationPromise;
985
+ for (const interceptor of this.interceptors) {
986
+ interceptorPromise = interceptorPromise.then(() =>
987
+ interceptor(localVarRequestOptions)
988
+ );
989
+ }
990
+
991
+ return interceptorPromise.then(() => {
992
+ if (Object.keys(localVarFormParams).length) {
993
+ if (localVarUseFormData) {
994
+ (<any>localVarRequestOptions).formData = localVarFormParams;
995
+ } else {
996
+ localVarRequestOptions.form = localVarFormParams;
997
+ }
998
+ }
999
+ return new Promise<{
1000
+ response: http.IncomingMessage;
1001
+ body: GetFilterInDestination200Response;
1002
+ }>((resolve, reject) => {
1003
+ localVarRequest(
1004
+ localVarRequestOptions,
1005
+ (error, response, body) => {
1006
+ if (error) {
1007
+ reject(error);
1008
+ } else {
1009
+ if (
1010
+ response.statusCode &&
1011
+ response.statusCode >= 200 &&
1012
+ response.statusCode <= 299
1013
+ ) {
1014
+ body = ObjectSerializer.deserialize(
1015
+ body,
1016
+ 'GetFilterInDestination200Response'
1017
+ );
1018
+ resolve({ response: response, body: body });
1019
+ } else {
1020
+ reject(
1021
+ new HttpError(
1022
+ response,
1023
+ body,
1024
+ response.statusCode
1025
+ )
1026
+ );
1027
+ }
1028
+ }
1029
+ }
1030
+ );
1031
+ });
1032
+ });
1033
+ }
1034
+ /**
1035
+ * Gets a Destination filter by id.
1036
+ * @summary Get Filter in Destination
1037
+ * @param destinationId
1038
+ * @param filterId
1039
+ */
1040
+ public async getFilterInDestinationV1(
1041
+ destinationId: string,
1042
+ filterId: string,
1043
+ options: { headers: { [name: string]: string } } = { headers: {} }
1044
+ ): Promise<{
1045
+ response: http.IncomingMessage;
1046
+ body: GetFilterInDestination200Response;
1047
+ }> {
1048
+ const localVarPath =
1049
+ this.basePath +
1050
+ '/destination/{destinationId}/filters/{filterId}'
1051
+ .replace(
1052
+ '{' + 'destinationId' + '}',
1053
+ encodeURIComponent(String(destinationId))
1054
+ )
1055
+ .replace(
1056
+ '{' + 'filterId' + '}',
1057
+ encodeURIComponent(String(filterId))
1058
+ );
1059
+ let localVarQueryParameters: any = {};
1060
+ let localVarHeaderParams: any = (<any>Object).assign(
1061
+ {},
1062
+ this._defaultHeaders
1063
+ );
1064
+ const produces = [
1065
+ 'application/vnd.segment.v1+json',
1066
+ 'application/json',
1067
+ ];
1068
+ if (produces.indexOf('application/json') >= 0) {
1069
+ localVarHeaderParams.Accept = produces[0];
1070
+ } else {
1071
+ localVarHeaderParams.Accept = 'application/json';
1072
+ }
1073
+ let localVarFormParams: any = {};
1074
+
1075
+ // verify required parameter 'destinationId' is not null or undefined
1076
+ if (destinationId === null || destinationId === undefined) {
1077
+ throw new Error(
1078
+ 'Required parameter destinationId was null or undefined when calling getFilterInDestinationV1.'
1079
+ );
1080
+ }
1081
+
1082
+ // verify required parameter 'filterId' is not null or undefined
1083
+ if (filterId === null || filterId === undefined) {
1084
+ throw new Error(
1085
+ 'Required parameter filterId was null or undefined when calling getFilterInDestinationV1.'
1086
+ );
1087
+ }
1088
+
1089
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1090
+
1091
+ let localVarUseFormData = false;
1092
+
1093
+ let localVarRequestOptions: localVarRequest.Options = {
1094
+ method: 'GET',
1095
+ qs: localVarQueryParameters,
1096
+ headers: localVarHeaderParams,
1097
+ uri: localVarPath,
1098
+ useQuerystring: this._useQuerystring,
1099
+ json: true,
1100
+ };
1101
+
1102
+ let authenticationPromise = Promise.resolve();
1103
+ if (this.authentications.token.accessToken) {
1104
+ authenticationPromise = authenticationPromise.then(() =>
1105
+ this.authentications.token.applyToRequest(
1106
+ localVarRequestOptions
1107
+ )
1108
+ );
1109
+ }
1110
+ authenticationPromise = authenticationPromise.then(() =>
1111
+ this.authentications.default.applyToRequest(localVarRequestOptions)
1112
+ );
1113
+
1114
+ let interceptorPromise = authenticationPromise;
1115
+ for (const interceptor of this.interceptors) {
1116
+ interceptorPromise = interceptorPromise.then(() =>
1117
+ interceptor(localVarRequestOptions)
1118
+ );
1119
+ }
1120
+
1121
+ return interceptorPromise.then(() => {
1122
+ if (Object.keys(localVarFormParams).length) {
1123
+ if (localVarUseFormData) {
1124
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1125
+ } else {
1126
+ localVarRequestOptions.form = localVarFormParams;
1127
+ }
1128
+ }
1129
+ return new Promise<{
1130
+ response: http.IncomingMessage;
1131
+ body: GetFilterInDestination200Response;
1132
+ }>((resolve, reject) => {
1133
+ localVarRequest(
1134
+ localVarRequestOptions,
1135
+ (error, response, body) => {
1136
+ if (error) {
1137
+ reject(error);
1138
+ } else {
1139
+ if (
1140
+ response.statusCode &&
1141
+ response.statusCode >= 200 &&
1142
+ response.statusCode <= 299
1143
+ ) {
1144
+ body = ObjectSerializer.deserialize(
1145
+ body,
1146
+ 'GetFilterInDestination200Response'
1147
+ );
1148
+ resolve({ response: response, body: body });
1149
+ } else {
1150
+ reject(
1151
+ new HttpError(
1152
+ response,
1153
+ body,
1154
+ response.statusCode
1155
+ )
1156
+ );
1157
+ }
1158
+ }
1159
+ }
1160
+ );
1161
+ });
1162
+ });
1163
+ }
1164
+ /**
1165
+ * Lists filters for a Destination.
1166
+ * @summary List Filters from Destination
1167
+ * @param destinationId
1168
+ * @param pagination Pagination options. This parameter exists in alpha.
1169
+ */
1170
+ public async listFiltersFromDestinationAlpha(
1171
+ destinationId: string,
1172
+ pagination: PaginationInput,
1173
+ options: { headers: { [name: string]: string } } = { headers: {} }
1174
+ ): Promise<{
1175
+ response: http.IncomingMessage;
1176
+ body: ListFiltersFromDestination200Response;
1177
+ }> {
1178
+ const localVarPath =
1179
+ this.basePath +
1180
+ '/destination/{destinationId}/filters'.replace(
1181
+ '{' + 'destinationId' + '}',
1182
+ encodeURIComponent(String(destinationId))
1183
+ );
1184
+ let localVarQueryParameters: any = {};
1185
+ let localVarHeaderParams: any = (<any>Object).assign(
1186
+ {},
1187
+ this._defaultHeaders
1188
+ );
1189
+ const produces = [
1190
+ 'application/vnd.segment.v1alpha+json',
1191
+ 'application/json',
1192
+ ];
1193
+ if (produces.indexOf('application/json') >= 0) {
1194
+ localVarHeaderParams.Accept = produces[0];
1195
+ } else {
1196
+ localVarHeaderParams.Accept = 'application/json';
1197
+ }
1198
+ let localVarFormParams: any = {};
1199
+
1200
+ // verify required parameter 'destinationId' is not null or undefined
1201
+ if (destinationId === null || destinationId === undefined) {
1202
+ throw new Error(
1203
+ 'Required parameter destinationId was null or undefined when calling listFiltersFromDestinationAlpha.'
1204
+ );
1205
+ }
1206
+
1207
+ // verify required parameter 'pagination' is not null or undefined
1208
+ if (pagination === null || pagination === undefined) {
1209
+ throw new Error(
1210
+ 'Required parameter pagination was null or undefined when calling listFiltersFromDestinationAlpha.'
1211
+ );
1212
+ }
1213
+
1214
+ if (pagination !== undefined) {
1215
+ localVarQueryParameters['pagination'] = ObjectSerializer.serialize(
1216
+ pagination,
1217
+ 'PaginationInput'
1218
+ );
1219
+ }
1220
+
1221
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1222
+
1223
+ let localVarUseFormData = false;
1224
+
1225
+ let localVarRequestOptions: localVarRequest.Options = {
1226
+ method: 'GET',
1227
+ qs: localVarQueryParameters,
1228
+ headers: localVarHeaderParams,
1229
+ uri: localVarPath,
1230
+ useQuerystring: this._useQuerystring,
1231
+ json: true,
1232
+ };
1233
+
1234
+ let authenticationPromise = Promise.resolve();
1235
+ if (this.authentications.token.accessToken) {
1236
+ authenticationPromise = authenticationPromise.then(() =>
1237
+ this.authentications.token.applyToRequest(
1238
+ localVarRequestOptions
1239
+ )
1240
+ );
1241
+ }
1242
+ authenticationPromise = authenticationPromise.then(() =>
1243
+ this.authentications.default.applyToRequest(localVarRequestOptions)
1244
+ );
1245
+
1246
+ let interceptorPromise = authenticationPromise;
1247
+ for (const interceptor of this.interceptors) {
1248
+ interceptorPromise = interceptorPromise.then(() =>
1249
+ interceptor(localVarRequestOptions)
1250
+ );
1251
+ }
1252
+
1253
+ return interceptorPromise.then(() => {
1254
+ if (Object.keys(localVarFormParams).length) {
1255
+ if (localVarUseFormData) {
1256
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1257
+ } else {
1258
+ localVarRequestOptions.form = localVarFormParams;
1259
+ }
1260
+ }
1261
+ return new Promise<{
1262
+ response: http.IncomingMessage;
1263
+ body: ListFiltersFromDestination200Response;
1264
+ }>((resolve, reject) => {
1265
+ localVarRequest(
1266
+ localVarRequestOptions,
1267
+ (error, response, body) => {
1268
+ if (error) {
1269
+ reject(error);
1270
+ } else {
1271
+ if (
1272
+ response.statusCode &&
1273
+ response.statusCode >= 200 &&
1274
+ response.statusCode <= 299
1275
+ ) {
1276
+ body = ObjectSerializer.deserialize(
1277
+ body,
1278
+ 'ListFiltersFromDestination200Response'
1279
+ );
1280
+ resolve({ response: response, body: body });
1281
+ } else {
1282
+ reject(
1283
+ new HttpError(
1284
+ response,
1285
+ body,
1286
+ response.statusCode
1287
+ )
1288
+ );
1289
+ }
1290
+ }
1291
+ }
1292
+ );
1293
+ });
1294
+ });
1295
+ }
1296
+ /**
1297
+ * Lists filters for a Destination.
1298
+ * @summary List Filters from Destination
1299
+ * @param destinationId
1300
+ * @param pagination Pagination options. This parameter exists in alpha.
1301
+ */
1302
+ public async listFiltersFromDestinationBeta(
1303
+ destinationId: string,
1304
+ pagination: PaginationInput,
1305
+ options: { headers: { [name: string]: string } } = { headers: {} }
1306
+ ): Promise<{
1307
+ response: http.IncomingMessage;
1308
+ body: ListFiltersFromDestination200Response;
1309
+ }> {
1310
+ const localVarPath =
1311
+ this.basePath +
1312
+ '/destination/{destinationId}/filters'.replace(
1313
+ '{' + 'destinationId' + '}',
1314
+ encodeURIComponent(String(destinationId))
1315
+ );
1316
+ let localVarQueryParameters: any = {};
1317
+ let localVarHeaderParams: any = (<any>Object).assign(
1318
+ {},
1319
+ this._defaultHeaders
1320
+ );
1321
+ const produces = [
1322
+ 'application/vnd.segment.v1beta+json',
1323
+ 'application/json',
1324
+ ];
1325
+ if (produces.indexOf('application/json') >= 0) {
1326
+ localVarHeaderParams.Accept = produces[0];
1327
+ } else {
1328
+ localVarHeaderParams.Accept = 'application/json';
1329
+ }
1330
+ let localVarFormParams: any = {};
1331
+
1332
+ // verify required parameter 'destinationId' is not null or undefined
1333
+ if (destinationId === null || destinationId === undefined) {
1334
+ throw new Error(
1335
+ 'Required parameter destinationId was null or undefined when calling listFiltersFromDestinationBeta.'
1336
+ );
1337
+ }
1338
+
1339
+ // verify required parameter 'pagination' is not null or undefined
1340
+ if (pagination === null || pagination === undefined) {
1341
+ throw new Error(
1342
+ 'Required parameter pagination was null or undefined when calling listFiltersFromDestinationBeta.'
1343
+ );
1344
+ }
1345
+
1346
+ if (pagination !== undefined) {
1347
+ localVarQueryParameters['pagination'] = ObjectSerializer.serialize(
1348
+ pagination,
1349
+ 'PaginationInput'
1350
+ );
1351
+ }
1352
+
1353
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1354
+
1355
+ let localVarUseFormData = false;
1356
+
1357
+ let localVarRequestOptions: localVarRequest.Options = {
1358
+ method: 'GET',
1359
+ qs: localVarQueryParameters,
1360
+ headers: localVarHeaderParams,
1361
+ uri: localVarPath,
1362
+ useQuerystring: this._useQuerystring,
1363
+ json: true,
1364
+ };
1365
+
1366
+ let authenticationPromise = Promise.resolve();
1367
+ if (this.authentications.token.accessToken) {
1368
+ authenticationPromise = authenticationPromise.then(() =>
1369
+ this.authentications.token.applyToRequest(
1370
+ localVarRequestOptions
1371
+ )
1372
+ );
1373
+ }
1374
+ authenticationPromise = authenticationPromise.then(() =>
1375
+ this.authentications.default.applyToRequest(localVarRequestOptions)
1376
+ );
1377
+
1378
+ let interceptorPromise = authenticationPromise;
1379
+ for (const interceptor of this.interceptors) {
1380
+ interceptorPromise = interceptorPromise.then(() =>
1381
+ interceptor(localVarRequestOptions)
1382
+ );
1383
+ }
1384
+
1385
+ return interceptorPromise.then(() => {
1386
+ if (Object.keys(localVarFormParams).length) {
1387
+ if (localVarUseFormData) {
1388
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1389
+ } else {
1390
+ localVarRequestOptions.form = localVarFormParams;
1391
+ }
1392
+ }
1393
+ return new Promise<{
1394
+ response: http.IncomingMessage;
1395
+ body: ListFiltersFromDestination200Response;
1396
+ }>((resolve, reject) => {
1397
+ localVarRequest(
1398
+ localVarRequestOptions,
1399
+ (error, response, body) => {
1400
+ if (error) {
1401
+ reject(error);
1402
+ } else {
1403
+ if (
1404
+ response.statusCode &&
1405
+ response.statusCode >= 200 &&
1406
+ response.statusCode <= 299
1407
+ ) {
1408
+ body = ObjectSerializer.deserialize(
1409
+ body,
1410
+ 'ListFiltersFromDestination200Response'
1411
+ );
1412
+ resolve({ response: response, body: body });
1413
+ } else {
1414
+ reject(
1415
+ new HttpError(
1416
+ response,
1417
+ body,
1418
+ response.statusCode
1419
+ )
1420
+ );
1421
+ }
1422
+ }
1423
+ }
1424
+ );
1425
+ });
1426
+ });
1427
+ }
1428
+ /**
1429
+ * Lists filters for a Destination.
1430
+ * @summary List Filters from Destination
1431
+ * @param destinationId
1432
+ * @param pagination Pagination options. This parameter exists in alpha.
1433
+ */
1434
+ public async listFiltersFromDestinationCurrent(
1435
+ destinationId: string,
1436
+ pagination: PaginationInput,
1437
+ options: { headers: { [name: string]: string } } = { headers: {} }
1438
+ ): Promise<{
1439
+ response: http.IncomingMessage;
1440
+ body: ListFiltersFromDestination200Response;
1441
+ }> {
1442
+ const localVarPath =
1443
+ this.basePath +
1444
+ '/destination/{destinationId}/filters'.replace(
1445
+ '{' + 'destinationId' + '}',
1446
+ encodeURIComponent(String(destinationId))
1447
+ );
1448
+ let localVarQueryParameters: any = {};
1449
+ let localVarHeaderParams: any = (<any>Object).assign(
1450
+ {},
1451
+ this._defaultHeaders
1452
+ );
1453
+ const produces = ['application/json'];
1454
+ if (produces.indexOf('application/json') >= 0) {
1455
+ localVarHeaderParams.Accept = produces[0];
1456
+ } else {
1457
+ localVarHeaderParams.Accept = 'application/json';
1458
+ }
1459
+ let localVarFormParams: any = {};
1460
+
1461
+ // verify required parameter 'destinationId' is not null or undefined
1462
+ if (destinationId === null || destinationId === undefined) {
1463
+ throw new Error(
1464
+ 'Required parameter destinationId was null or undefined when calling listFiltersFromDestinationCurrent.'
1465
+ );
1466
+ }
1467
+
1468
+ // verify required parameter 'pagination' is not null or undefined
1469
+ if (pagination === null || pagination === undefined) {
1470
+ throw new Error(
1471
+ 'Required parameter pagination was null or undefined when calling listFiltersFromDestinationCurrent.'
1472
+ );
1473
+ }
1474
+
1475
+ if (pagination !== undefined) {
1476
+ localVarQueryParameters['pagination'] = ObjectSerializer.serialize(
1477
+ pagination,
1478
+ 'PaginationInput'
1479
+ );
1480
+ }
1481
+
1482
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1483
+
1484
+ let localVarUseFormData = false;
1485
+
1486
+ let localVarRequestOptions: localVarRequest.Options = {
1487
+ method: 'GET',
1488
+ qs: localVarQueryParameters,
1489
+ headers: localVarHeaderParams,
1490
+ uri: localVarPath,
1491
+ useQuerystring: this._useQuerystring,
1492
+ json: true,
1493
+ };
1494
+
1495
+ let authenticationPromise = Promise.resolve();
1496
+ if (this.authentications.token.accessToken) {
1497
+ authenticationPromise = authenticationPromise.then(() =>
1498
+ this.authentications.token.applyToRequest(
1499
+ localVarRequestOptions
1500
+ )
1501
+ );
1502
+ }
1503
+ authenticationPromise = authenticationPromise.then(() =>
1504
+ this.authentications.default.applyToRequest(localVarRequestOptions)
1505
+ );
1506
+
1507
+ let interceptorPromise = authenticationPromise;
1508
+ for (const interceptor of this.interceptors) {
1509
+ interceptorPromise = interceptorPromise.then(() =>
1510
+ interceptor(localVarRequestOptions)
1511
+ );
1512
+ }
1513
+
1514
+ return interceptorPromise.then(() => {
1515
+ if (Object.keys(localVarFormParams).length) {
1516
+ if (localVarUseFormData) {
1517
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1518
+ } else {
1519
+ localVarRequestOptions.form = localVarFormParams;
1520
+ }
1521
+ }
1522
+ return new Promise<{
1523
+ response: http.IncomingMessage;
1524
+ body: ListFiltersFromDestination200Response;
1525
+ }>((resolve, reject) => {
1526
+ localVarRequest(
1527
+ localVarRequestOptions,
1528
+ (error, response, body) => {
1529
+ if (error) {
1530
+ reject(error);
1531
+ } else {
1532
+ if (
1533
+ response.statusCode &&
1534
+ response.statusCode >= 200 &&
1535
+ response.statusCode <= 299
1536
+ ) {
1537
+ body = ObjectSerializer.deserialize(
1538
+ body,
1539
+ 'ListFiltersFromDestination200Response'
1540
+ );
1541
+ resolve({ response: response, body: body });
1542
+ } else {
1543
+ reject(
1544
+ new HttpError(
1545
+ response,
1546
+ body,
1547
+ response.statusCode
1548
+ )
1549
+ );
1550
+ }
1551
+ }
1552
+ }
1553
+ );
1554
+ });
1555
+ });
1556
+ }
1557
+ /**
1558
+ * Lists filters for a Destination.
1559
+ * @summary List Filters from Destination
1560
+ * @param destinationId
1561
+ * @param pagination Pagination options. This parameter exists in alpha.
1562
+ */
1563
+ public async listFiltersFromDestinationV1(
1564
+ destinationId: string,
1565
+ pagination: PaginationInput,
1566
+ options: { headers: { [name: string]: string } } = { headers: {} }
1567
+ ): Promise<{
1568
+ response: http.IncomingMessage;
1569
+ body: ListFiltersFromDestination200Response;
1570
+ }> {
1571
+ const localVarPath =
1572
+ this.basePath +
1573
+ '/destination/{destinationId}/filters'.replace(
1574
+ '{' + 'destinationId' + '}',
1575
+ encodeURIComponent(String(destinationId))
1576
+ );
1577
+ let localVarQueryParameters: any = {};
1578
+ let localVarHeaderParams: any = (<any>Object).assign(
1579
+ {},
1580
+ this._defaultHeaders
1581
+ );
1582
+ const produces = [
1583
+ 'application/vnd.segment.v1+json',
1584
+ 'application/json',
1585
+ ];
1586
+ if (produces.indexOf('application/json') >= 0) {
1587
+ localVarHeaderParams.Accept = produces[0];
1588
+ } else {
1589
+ localVarHeaderParams.Accept = 'application/json';
1590
+ }
1591
+ let localVarFormParams: any = {};
1592
+
1593
+ // verify required parameter 'destinationId' is not null or undefined
1594
+ if (destinationId === null || destinationId === undefined) {
1595
+ throw new Error(
1596
+ 'Required parameter destinationId was null or undefined when calling listFiltersFromDestinationV1.'
1597
+ );
1598
+ }
1599
+
1600
+ // verify required parameter 'pagination' is not null or undefined
1601
+ if (pagination === null || pagination === undefined) {
1602
+ throw new Error(
1603
+ 'Required parameter pagination was null or undefined when calling listFiltersFromDestinationV1.'
1604
+ );
1605
+ }
1606
+
1607
+ if (pagination !== undefined) {
1608
+ localVarQueryParameters['pagination'] = ObjectSerializer.serialize(
1609
+ pagination,
1610
+ 'PaginationInput'
1611
+ );
1612
+ }
1613
+
1614
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1615
+
1616
+ let localVarUseFormData = false;
1617
+
1618
+ let localVarRequestOptions: localVarRequest.Options = {
1619
+ method: 'GET',
1620
+ qs: localVarQueryParameters,
1621
+ headers: localVarHeaderParams,
1622
+ uri: localVarPath,
1623
+ useQuerystring: this._useQuerystring,
1624
+ json: true,
1625
+ };
1626
+
1627
+ let authenticationPromise = Promise.resolve();
1628
+ if (this.authentications.token.accessToken) {
1629
+ authenticationPromise = authenticationPromise.then(() =>
1630
+ this.authentications.token.applyToRequest(
1631
+ localVarRequestOptions
1632
+ )
1633
+ );
1634
+ }
1635
+ authenticationPromise = authenticationPromise.then(() =>
1636
+ this.authentications.default.applyToRequest(localVarRequestOptions)
1637
+ );
1638
+
1639
+ let interceptorPromise = authenticationPromise;
1640
+ for (const interceptor of this.interceptors) {
1641
+ interceptorPromise = interceptorPromise.then(() =>
1642
+ interceptor(localVarRequestOptions)
1643
+ );
1644
+ }
1645
+
1646
+ return interceptorPromise.then(() => {
1647
+ if (Object.keys(localVarFormParams).length) {
1648
+ if (localVarUseFormData) {
1649
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1650
+ } else {
1651
+ localVarRequestOptions.form = localVarFormParams;
1652
+ }
1653
+ }
1654
+ return new Promise<{
1655
+ response: http.IncomingMessage;
1656
+ body: ListFiltersFromDestination200Response;
1657
+ }>((resolve, reject) => {
1658
+ localVarRequest(
1659
+ localVarRequestOptions,
1660
+ (error, response, body) => {
1661
+ if (error) {
1662
+ reject(error);
1663
+ } else {
1664
+ if (
1665
+ response.statusCode &&
1666
+ response.statusCode >= 200 &&
1667
+ response.statusCode <= 299
1668
+ ) {
1669
+ body = ObjectSerializer.deserialize(
1670
+ body,
1671
+ 'ListFiltersFromDestination200Response'
1672
+ );
1673
+ resolve({ response: response, body: body });
1674
+ } else {
1675
+ reject(
1676
+ new HttpError(
1677
+ response,
1678
+ body,
1679
+ response.statusCode
1680
+ )
1681
+ );
1682
+ }
1683
+ }
1684
+ }
1685
+ );
1686
+ });
1687
+ });
1688
+ }
1689
+ /**
1690
+ * Simulates the application of a Destination filter to a provided JSON payload.
1691
+ * @summary Preview Destination Filter
1692
+ * @param PreviewDestinationFilterV1Input
1693
+ */
1694
+ public async previewDestinationFilterAlpha(
1695
+ PreviewDestinationFilterV1Input: PreviewDestinationFilterV1Input,
1696
+ options: { headers: { [name: string]: string } } = { headers: {} }
1697
+ ): Promise<{
1698
+ response: http.IncomingMessage;
1699
+ body: PreviewDestinationFilter200Response;
1700
+ }> {
1701
+ const localVarPath = this.basePath + '/destination/filters/preview';
1702
+ let localVarQueryParameters: any = {};
1703
+ let localVarHeaderParams: any = (<any>Object).assign(
1704
+ {},
1705
+ this._defaultHeaders
1706
+ );
1707
+ const produces = [
1708
+ 'application/vnd.segment.v1alpha+json',
1709
+ 'application/json',
1710
+ ];
1711
+ if (produces.indexOf('application/json') >= 0) {
1712
+ localVarHeaderParams.Accept = produces[0];
1713
+ } else {
1714
+ localVarHeaderParams.Accept = 'application/json';
1715
+ }
1716
+ let localVarFormParams: any = {};
1717
+
1718
+ // verify required parameter 'PreviewDestinationFilterV1Input' is not null or undefined
1719
+ if (
1720
+ PreviewDestinationFilterV1Input === null ||
1721
+ PreviewDestinationFilterV1Input === undefined
1722
+ ) {
1723
+ throw new Error(
1724
+ 'Required parameter PreviewDestinationFilterV1Input was null or undefined when calling previewDestinationFilterAlpha.'
1725
+ );
1726
+ }
1727
+
1728
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1729
+
1730
+ let localVarUseFormData = false;
1731
+
1732
+ let localVarRequestOptions: localVarRequest.Options = {
1733
+ method: 'POST',
1734
+ qs: localVarQueryParameters,
1735
+ headers: localVarHeaderParams,
1736
+ uri: localVarPath,
1737
+ useQuerystring: this._useQuerystring,
1738
+ json: true,
1739
+ body: ObjectSerializer.serialize(
1740
+ PreviewDestinationFilterV1Input,
1741
+ 'PreviewDestinationFilterV1Input'
1742
+ ),
1743
+ };
1744
+
1745
+ let authenticationPromise = Promise.resolve();
1746
+ if (this.authentications.token.accessToken) {
1747
+ authenticationPromise = authenticationPromise.then(() =>
1748
+ this.authentications.token.applyToRequest(
1749
+ localVarRequestOptions
1750
+ )
1751
+ );
1752
+ }
1753
+ authenticationPromise = authenticationPromise.then(() =>
1754
+ this.authentications.default.applyToRequest(localVarRequestOptions)
1755
+ );
1756
+
1757
+ let interceptorPromise = authenticationPromise;
1758
+ for (const interceptor of this.interceptors) {
1759
+ interceptorPromise = interceptorPromise.then(() =>
1760
+ interceptor(localVarRequestOptions)
1761
+ );
1762
+ }
1763
+
1764
+ return interceptorPromise.then(() => {
1765
+ if (Object.keys(localVarFormParams).length) {
1766
+ if (localVarUseFormData) {
1767
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1768
+ } else {
1769
+ localVarRequestOptions.form = localVarFormParams;
1770
+ }
1771
+ }
1772
+ return new Promise<{
1773
+ response: http.IncomingMessage;
1774
+ body: PreviewDestinationFilter200Response;
1775
+ }>((resolve, reject) => {
1776
+ localVarRequest(
1777
+ localVarRequestOptions,
1778
+ (error, response, body) => {
1779
+ if (error) {
1780
+ reject(error);
1781
+ } else {
1782
+ if (
1783
+ response.statusCode &&
1784
+ response.statusCode >= 200 &&
1785
+ response.statusCode <= 299
1786
+ ) {
1787
+ body = ObjectSerializer.deserialize(
1788
+ body,
1789
+ 'PreviewDestinationFilter200Response'
1790
+ );
1791
+ resolve({ response: response, body: body });
1792
+ } else {
1793
+ reject(
1794
+ new HttpError(
1795
+ response,
1796
+ body,
1797
+ response.statusCode
1798
+ )
1799
+ );
1800
+ }
1801
+ }
1802
+ }
1803
+ );
1804
+ });
1805
+ });
1806
+ }
1807
+ /**
1808
+ * Simulates the application of a Destination filter to a provided JSON payload.
1809
+ * @summary Preview Destination Filter
1810
+ * @param PreviewDestinationFilterV1Input
1811
+ */
1812
+ public async previewDestinationFilterBeta(
1813
+ PreviewDestinationFilterV1Input: PreviewDestinationFilterV1Input,
1814
+ options: { headers: { [name: string]: string } } = { headers: {} }
1815
+ ): Promise<{
1816
+ response: http.IncomingMessage;
1817
+ body: PreviewDestinationFilter200Response;
1818
+ }> {
1819
+ const localVarPath = this.basePath + '/destination/filters/preview';
1820
+ let localVarQueryParameters: any = {};
1821
+ let localVarHeaderParams: any = (<any>Object).assign(
1822
+ {},
1823
+ this._defaultHeaders
1824
+ );
1825
+ const produces = [
1826
+ 'application/vnd.segment.v1beta+json',
1827
+ 'application/json',
1828
+ ];
1829
+ if (produces.indexOf('application/json') >= 0) {
1830
+ localVarHeaderParams.Accept = produces[0];
1831
+ } else {
1832
+ localVarHeaderParams.Accept = 'application/json';
1833
+ }
1834
+ let localVarFormParams: any = {};
1835
+
1836
+ // verify required parameter 'PreviewDestinationFilterV1Input' is not null or undefined
1837
+ if (
1838
+ PreviewDestinationFilterV1Input === null ||
1839
+ PreviewDestinationFilterV1Input === undefined
1840
+ ) {
1841
+ throw new Error(
1842
+ 'Required parameter PreviewDestinationFilterV1Input was null or undefined when calling previewDestinationFilterBeta.'
1843
+ );
1844
+ }
1845
+
1846
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1847
+
1848
+ let localVarUseFormData = false;
1849
+
1850
+ let localVarRequestOptions: localVarRequest.Options = {
1851
+ method: 'POST',
1852
+ qs: localVarQueryParameters,
1853
+ headers: localVarHeaderParams,
1854
+ uri: localVarPath,
1855
+ useQuerystring: this._useQuerystring,
1856
+ json: true,
1857
+ body: ObjectSerializer.serialize(
1858
+ PreviewDestinationFilterV1Input,
1859
+ 'PreviewDestinationFilterV1Input'
1860
+ ),
1861
+ };
1862
+
1863
+ let authenticationPromise = Promise.resolve();
1864
+ if (this.authentications.token.accessToken) {
1865
+ authenticationPromise = authenticationPromise.then(() =>
1866
+ this.authentications.token.applyToRequest(
1867
+ localVarRequestOptions
1868
+ )
1869
+ );
1870
+ }
1871
+ authenticationPromise = authenticationPromise.then(() =>
1872
+ this.authentications.default.applyToRequest(localVarRequestOptions)
1873
+ );
1874
+
1875
+ let interceptorPromise = authenticationPromise;
1876
+ for (const interceptor of this.interceptors) {
1877
+ interceptorPromise = interceptorPromise.then(() =>
1878
+ interceptor(localVarRequestOptions)
1879
+ );
1880
+ }
1881
+
1882
+ return interceptorPromise.then(() => {
1883
+ if (Object.keys(localVarFormParams).length) {
1884
+ if (localVarUseFormData) {
1885
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1886
+ } else {
1887
+ localVarRequestOptions.form = localVarFormParams;
1888
+ }
1889
+ }
1890
+ return new Promise<{
1891
+ response: http.IncomingMessage;
1892
+ body: PreviewDestinationFilter200Response;
1893
+ }>((resolve, reject) => {
1894
+ localVarRequest(
1895
+ localVarRequestOptions,
1896
+ (error, response, body) => {
1897
+ if (error) {
1898
+ reject(error);
1899
+ } else {
1900
+ if (
1901
+ response.statusCode &&
1902
+ response.statusCode >= 200 &&
1903
+ response.statusCode <= 299
1904
+ ) {
1905
+ body = ObjectSerializer.deserialize(
1906
+ body,
1907
+ 'PreviewDestinationFilter200Response'
1908
+ );
1909
+ resolve({ response: response, body: body });
1910
+ } else {
1911
+ reject(
1912
+ new HttpError(
1913
+ response,
1914
+ body,
1915
+ response.statusCode
1916
+ )
1917
+ );
1918
+ }
1919
+ }
1920
+ }
1921
+ );
1922
+ });
1923
+ });
1924
+ }
1925
+ /**
1926
+ * Simulates the application of a Destination filter to a provided JSON payload.
1927
+ * @summary Preview Destination Filter
1928
+ * @param PreviewDestinationFilterV1Input
1929
+ */
1930
+ public async previewDestinationFilterCurrent(
1931
+ PreviewDestinationFilterV1Input: PreviewDestinationFilterV1Input,
1932
+ options: { headers: { [name: string]: string } } = { headers: {} }
1933
+ ): Promise<{
1934
+ response: http.IncomingMessage;
1935
+ body: PreviewDestinationFilter200Response;
1936
+ }> {
1937
+ const localVarPath = this.basePath + '/destination/filters/preview';
1938
+ let localVarQueryParameters: any = {};
1939
+ let localVarHeaderParams: any = (<any>Object).assign(
1940
+ {},
1941
+ this._defaultHeaders
1942
+ );
1943
+ const produces = [
1944
+ 'application/vnd.segment.v1+json',
1945
+ 'application/json',
1946
+ ];
1947
+ if (produces.indexOf('application/json') >= 0) {
1948
+ localVarHeaderParams.Accept = produces[0];
1949
+ } else {
1950
+ localVarHeaderParams.Accept = 'application/json';
1951
+ }
1952
+ let localVarFormParams: any = {};
1953
+
1954
+ // verify required parameter 'PreviewDestinationFilterV1Input' is not null or undefined
1955
+ if (
1956
+ PreviewDestinationFilterV1Input === null ||
1957
+ PreviewDestinationFilterV1Input === undefined
1958
+ ) {
1959
+ throw new Error(
1960
+ 'Required parameter PreviewDestinationFilterV1Input was null or undefined when calling previewDestinationFilterCurrent.'
1961
+ );
1962
+ }
1963
+
1964
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1965
+
1966
+ let localVarUseFormData = false;
1967
+
1968
+ let localVarRequestOptions: localVarRequest.Options = {
1969
+ method: 'POST',
1970
+ qs: localVarQueryParameters,
1971
+ headers: localVarHeaderParams,
1972
+ uri: localVarPath,
1973
+ useQuerystring: this._useQuerystring,
1974
+ json: true,
1975
+ body: ObjectSerializer.serialize(
1976
+ PreviewDestinationFilterV1Input,
1977
+ 'PreviewDestinationFilterV1Input'
1978
+ ),
1979
+ };
1980
+
1981
+ let authenticationPromise = Promise.resolve();
1982
+ if (this.authentications.token.accessToken) {
1983
+ authenticationPromise = authenticationPromise.then(() =>
1984
+ this.authentications.token.applyToRequest(
1985
+ localVarRequestOptions
1986
+ )
1987
+ );
1988
+ }
1989
+ authenticationPromise = authenticationPromise.then(() =>
1990
+ this.authentications.default.applyToRequest(localVarRequestOptions)
1991
+ );
1992
+
1993
+ let interceptorPromise = authenticationPromise;
1994
+ for (const interceptor of this.interceptors) {
1995
+ interceptorPromise = interceptorPromise.then(() =>
1996
+ interceptor(localVarRequestOptions)
1997
+ );
1998
+ }
1999
+
2000
+ return interceptorPromise.then(() => {
2001
+ if (Object.keys(localVarFormParams).length) {
2002
+ if (localVarUseFormData) {
2003
+ (<any>localVarRequestOptions).formData = localVarFormParams;
2004
+ } else {
2005
+ localVarRequestOptions.form = localVarFormParams;
2006
+ }
2007
+ }
2008
+ return new Promise<{
2009
+ response: http.IncomingMessage;
2010
+ body: PreviewDestinationFilter200Response;
2011
+ }>((resolve, reject) => {
2012
+ localVarRequest(
2013
+ localVarRequestOptions,
2014
+ (error, response, body) => {
2015
+ if (error) {
2016
+ reject(error);
2017
+ } else {
2018
+ if (
2019
+ response.statusCode &&
2020
+ response.statusCode >= 200 &&
2021
+ response.statusCode <= 299
2022
+ ) {
2023
+ body = ObjectSerializer.deserialize(
2024
+ body,
2025
+ 'PreviewDestinationFilter200Response'
2026
+ );
2027
+ resolve({ response: response, body: body });
2028
+ } else {
2029
+ reject(
2030
+ new HttpError(
2031
+ response,
2032
+ body,
2033
+ response.statusCode
2034
+ )
2035
+ );
2036
+ }
2037
+ }
2038
+ }
2039
+ );
2040
+ });
2041
+ });
2042
+ }
2043
+ /**
2044
+ * Simulates the application of a Destination filter to a provided JSON payload.
2045
+ * @summary Preview Destination Filter
2046
+ * @param PreviewDestinationFilterV1Input
2047
+ */
2048
+ public async previewDestinationFilterV1(
2049
+ PreviewDestinationFilterV1Input: PreviewDestinationFilterV1Input,
2050
+ options: { headers: { [name: string]: string } } = { headers: {} }
2051
+ ): Promise<{
2052
+ response: http.IncomingMessage;
2053
+ body: PreviewDestinationFilter200Response;
2054
+ }> {
2055
+ const localVarPath = this.basePath + '/destination/filters/preview';
2056
+ let localVarQueryParameters: any = {};
2057
+ let localVarHeaderParams: any = (<any>Object).assign(
2058
+ {},
2059
+ this._defaultHeaders
2060
+ );
2061
+ const produces = [
2062
+ 'application/vnd.segment.v1+json',
2063
+ 'application/json',
2064
+ ];
2065
+ if (produces.indexOf('application/json') >= 0) {
2066
+ localVarHeaderParams.Accept = produces[0];
2067
+ } else {
2068
+ localVarHeaderParams.Accept = 'application/json';
2069
+ }
2070
+ let localVarFormParams: any = {};
2071
+
2072
+ // verify required parameter 'PreviewDestinationFilterV1Input' is not null or undefined
2073
+ if (
2074
+ PreviewDestinationFilterV1Input === null ||
2075
+ PreviewDestinationFilterV1Input === undefined
2076
+ ) {
2077
+ throw new Error(
2078
+ 'Required parameter PreviewDestinationFilterV1Input was null or undefined when calling previewDestinationFilterV1.'
2079
+ );
2080
+ }
2081
+
2082
+ (<any>Object).assign(localVarHeaderParams, options.headers);
2083
+
2084
+ let localVarUseFormData = false;
2085
+
2086
+ let localVarRequestOptions: localVarRequest.Options = {
2087
+ method: 'POST',
2088
+ qs: localVarQueryParameters,
2089
+ headers: localVarHeaderParams,
2090
+ uri: localVarPath,
2091
+ useQuerystring: this._useQuerystring,
2092
+ json: true,
2093
+ body: ObjectSerializer.serialize(
2094
+ PreviewDestinationFilterV1Input,
2095
+ 'PreviewDestinationFilterV1Input'
2096
+ ),
2097
+ };
2098
+
2099
+ let authenticationPromise = Promise.resolve();
2100
+ if (this.authentications.token.accessToken) {
2101
+ authenticationPromise = authenticationPromise.then(() =>
2102
+ this.authentications.token.applyToRequest(
2103
+ localVarRequestOptions
2104
+ )
2105
+ );
2106
+ }
2107
+ authenticationPromise = authenticationPromise.then(() =>
2108
+ this.authentications.default.applyToRequest(localVarRequestOptions)
2109
+ );
2110
+
2111
+ let interceptorPromise = authenticationPromise;
2112
+ for (const interceptor of this.interceptors) {
2113
+ interceptorPromise = interceptorPromise.then(() =>
2114
+ interceptor(localVarRequestOptions)
2115
+ );
2116
+ }
2117
+
2118
+ return interceptorPromise.then(() => {
2119
+ if (Object.keys(localVarFormParams).length) {
2120
+ if (localVarUseFormData) {
2121
+ (<any>localVarRequestOptions).formData = localVarFormParams;
2122
+ } else {
2123
+ localVarRequestOptions.form = localVarFormParams;
2124
+ }
2125
+ }
2126
+ return new Promise<{
2127
+ response: http.IncomingMessage;
2128
+ body: PreviewDestinationFilter200Response;
2129
+ }>((resolve, reject) => {
2130
+ localVarRequest(
2131
+ localVarRequestOptions,
2132
+ (error, response, body) => {
2133
+ if (error) {
2134
+ reject(error);
2135
+ } else {
2136
+ if (
2137
+ response.statusCode &&
2138
+ response.statusCode >= 200 &&
2139
+ response.statusCode <= 299
2140
+ ) {
2141
+ body = ObjectSerializer.deserialize(
2142
+ body,
2143
+ 'PreviewDestinationFilter200Response'
2144
+ );
2145
+ resolve({ response: response, body: body });
2146
+ } else {
2147
+ reject(
2148
+ new HttpError(
2149
+ response,
2150
+ body,
2151
+ response.statusCode
2152
+ )
2153
+ );
2154
+ }
2155
+ }
2156
+ }
2157
+ );
2158
+ });
2159
+ });
2160
+ }
2161
+ /**
2162
+ * Deletes a Destination filter. When called, this endpoint may generate the `Destination Filter Deleted` [Audit Trail](/tag/Audit-Trail) event.
2163
+ * @summary Remove Filter from Destination
2164
+ * @param destinationId
2165
+ * @param filterId
2166
+ */
2167
+ public async removeFilterFromDestinationAlpha(
2168
+ destinationId: string,
2169
+ filterId: string,
2170
+ options: { headers: { [name: string]: string } } = { headers: {} }
2171
+ ): Promise<{
2172
+ response: http.IncomingMessage;
2173
+ body: RemoveFilterFromDestination200Response;
2174
+ }> {
2175
+ const localVarPath =
2176
+ this.basePath +
2177
+ '/destination/{destinationId}/filters/{filterId}'
2178
+ .replace(
2179
+ '{' + 'destinationId' + '}',
2180
+ encodeURIComponent(String(destinationId))
2181
+ )
2182
+ .replace(
2183
+ '{' + 'filterId' + '}',
2184
+ encodeURIComponent(String(filterId))
2185
+ );
2186
+ let localVarQueryParameters: any = {};
2187
+ let localVarHeaderParams: any = (<any>Object).assign(
2188
+ {},
2189
+ this._defaultHeaders
2190
+ );
2191
+ const produces = [
2192
+ 'application/vnd.segment.v1alpha+json',
2193
+ 'application/json',
2194
+ ];
2195
+ if (produces.indexOf('application/json') >= 0) {
2196
+ localVarHeaderParams.Accept = produces[0];
2197
+ } else {
2198
+ localVarHeaderParams.Accept = 'application/json';
2199
+ }
2200
+ let localVarFormParams: any = {};
2201
+
2202
+ // verify required parameter 'destinationId' is not null or undefined
2203
+ if (destinationId === null || destinationId === undefined) {
2204
+ throw new Error(
2205
+ 'Required parameter destinationId was null or undefined when calling removeFilterFromDestinationAlpha.'
2206
+ );
2207
+ }
2208
+
2209
+ // verify required parameter 'filterId' is not null or undefined
2210
+ if (filterId === null || filterId === undefined) {
2211
+ throw new Error(
2212
+ 'Required parameter filterId was null or undefined when calling removeFilterFromDestinationAlpha.'
2213
+ );
2214
+ }
2215
+
2216
+ (<any>Object).assign(localVarHeaderParams, options.headers);
2217
+
2218
+ let localVarUseFormData = false;
2219
+
2220
+ let localVarRequestOptions: localVarRequest.Options = {
2221
+ method: 'DELETE',
2222
+ qs: localVarQueryParameters,
2223
+ headers: localVarHeaderParams,
2224
+ uri: localVarPath,
2225
+ useQuerystring: this._useQuerystring,
2226
+ json: true,
2227
+ };
2228
+
2229
+ let authenticationPromise = Promise.resolve();
2230
+ if (this.authentications.token.accessToken) {
2231
+ authenticationPromise = authenticationPromise.then(() =>
2232
+ this.authentications.token.applyToRequest(
2233
+ localVarRequestOptions
2234
+ )
2235
+ );
2236
+ }
2237
+ authenticationPromise = authenticationPromise.then(() =>
2238
+ this.authentications.default.applyToRequest(localVarRequestOptions)
2239
+ );
2240
+
2241
+ let interceptorPromise = authenticationPromise;
2242
+ for (const interceptor of this.interceptors) {
2243
+ interceptorPromise = interceptorPromise.then(() =>
2244
+ interceptor(localVarRequestOptions)
2245
+ );
2246
+ }
2247
+
2248
+ return interceptorPromise.then(() => {
2249
+ if (Object.keys(localVarFormParams).length) {
2250
+ if (localVarUseFormData) {
2251
+ (<any>localVarRequestOptions).formData = localVarFormParams;
2252
+ } else {
2253
+ localVarRequestOptions.form = localVarFormParams;
2254
+ }
2255
+ }
2256
+ return new Promise<{
2257
+ response: http.IncomingMessage;
2258
+ body: RemoveFilterFromDestination200Response;
2259
+ }>((resolve, reject) => {
2260
+ localVarRequest(
2261
+ localVarRequestOptions,
2262
+ (error, response, body) => {
2263
+ if (error) {
2264
+ reject(error);
2265
+ } else {
2266
+ if (
2267
+ response.statusCode &&
2268
+ response.statusCode >= 200 &&
2269
+ response.statusCode <= 299
2270
+ ) {
2271
+ body = ObjectSerializer.deserialize(
2272
+ body,
2273
+ 'RemoveFilterFromDestination200Response'
2274
+ );
2275
+ resolve({ response: response, body: body });
2276
+ } else {
2277
+ reject(
2278
+ new HttpError(
2279
+ response,
2280
+ body,
2281
+ response.statusCode
2282
+ )
2283
+ );
2284
+ }
2285
+ }
2286
+ }
2287
+ );
2288
+ });
2289
+ });
2290
+ }
2291
+ /**
2292
+ * Deletes a Destination filter. When called, this endpoint may generate the `Destination Filter Deleted` [Audit Trail](/tag/Audit-Trail) event.
2293
+ * @summary Remove Filter from Destination
2294
+ * @param destinationId
2295
+ * @param filterId
2296
+ */
2297
+ public async removeFilterFromDestinationBeta(
2298
+ destinationId: string,
2299
+ filterId: string,
2300
+ options: { headers: { [name: string]: string } } = { headers: {} }
2301
+ ): Promise<{
2302
+ response: http.IncomingMessage;
2303
+ body: RemoveFilterFromDestination200Response;
2304
+ }> {
2305
+ const localVarPath =
2306
+ this.basePath +
2307
+ '/destination/{destinationId}/filters/{filterId}'
2308
+ .replace(
2309
+ '{' + 'destinationId' + '}',
2310
+ encodeURIComponent(String(destinationId))
2311
+ )
2312
+ .replace(
2313
+ '{' + 'filterId' + '}',
2314
+ encodeURIComponent(String(filterId))
2315
+ );
2316
+ let localVarQueryParameters: any = {};
2317
+ let localVarHeaderParams: any = (<any>Object).assign(
2318
+ {},
2319
+ this._defaultHeaders
2320
+ );
2321
+ const produces = [
2322
+ 'application/vnd.segment.v1beta+json',
2323
+ 'application/json',
2324
+ ];
2325
+ if (produces.indexOf('application/json') >= 0) {
2326
+ localVarHeaderParams.Accept = produces[0];
2327
+ } else {
2328
+ localVarHeaderParams.Accept = 'application/json';
2329
+ }
2330
+ let localVarFormParams: any = {};
2331
+
2332
+ // verify required parameter 'destinationId' is not null or undefined
2333
+ if (destinationId === null || destinationId === undefined) {
2334
+ throw new Error(
2335
+ 'Required parameter destinationId was null or undefined when calling removeFilterFromDestinationBeta.'
2336
+ );
2337
+ }
2338
+
2339
+ // verify required parameter 'filterId' is not null or undefined
2340
+ if (filterId === null || filterId === undefined) {
2341
+ throw new Error(
2342
+ 'Required parameter filterId was null or undefined when calling removeFilterFromDestinationBeta.'
2343
+ );
2344
+ }
2345
+
2346
+ (<any>Object).assign(localVarHeaderParams, options.headers);
2347
+
2348
+ let localVarUseFormData = false;
2349
+
2350
+ let localVarRequestOptions: localVarRequest.Options = {
2351
+ method: 'DELETE',
2352
+ qs: localVarQueryParameters,
2353
+ headers: localVarHeaderParams,
2354
+ uri: localVarPath,
2355
+ useQuerystring: this._useQuerystring,
2356
+ json: true,
2357
+ };
2358
+
2359
+ let authenticationPromise = Promise.resolve();
2360
+ if (this.authentications.token.accessToken) {
2361
+ authenticationPromise = authenticationPromise.then(() =>
2362
+ this.authentications.token.applyToRequest(
2363
+ localVarRequestOptions
2364
+ )
2365
+ );
2366
+ }
2367
+ authenticationPromise = authenticationPromise.then(() =>
2368
+ this.authentications.default.applyToRequest(localVarRequestOptions)
2369
+ );
2370
+
2371
+ let interceptorPromise = authenticationPromise;
2372
+ for (const interceptor of this.interceptors) {
2373
+ interceptorPromise = interceptorPromise.then(() =>
2374
+ interceptor(localVarRequestOptions)
2375
+ );
2376
+ }
2377
+
2378
+ return interceptorPromise.then(() => {
2379
+ if (Object.keys(localVarFormParams).length) {
2380
+ if (localVarUseFormData) {
2381
+ (<any>localVarRequestOptions).formData = localVarFormParams;
2382
+ } else {
2383
+ localVarRequestOptions.form = localVarFormParams;
2384
+ }
2385
+ }
2386
+ return new Promise<{
2387
+ response: http.IncomingMessage;
2388
+ body: RemoveFilterFromDestination200Response;
2389
+ }>((resolve, reject) => {
2390
+ localVarRequest(
2391
+ localVarRequestOptions,
2392
+ (error, response, body) => {
2393
+ if (error) {
2394
+ reject(error);
2395
+ } else {
2396
+ if (
2397
+ response.statusCode &&
2398
+ response.statusCode >= 200 &&
2399
+ response.statusCode <= 299
2400
+ ) {
2401
+ body = ObjectSerializer.deserialize(
2402
+ body,
2403
+ 'RemoveFilterFromDestination200Response'
2404
+ );
2405
+ resolve({ response: response, body: body });
2406
+ } else {
2407
+ reject(
2408
+ new HttpError(
2409
+ response,
2410
+ body,
2411
+ response.statusCode
2412
+ )
2413
+ );
2414
+ }
2415
+ }
2416
+ }
2417
+ );
2418
+ });
2419
+ });
2420
+ }
2421
+ /**
2422
+ * Deletes a Destination filter. When called, this endpoint may generate the `Destination Filter Deleted` [Audit Trail](/tag/Audit-Trail) event.
2423
+ * @summary Remove Filter from Destination
2424
+ * @param destinationId
2425
+ * @param filterId
2426
+ */
2427
+ public async removeFilterFromDestinationCurrent(
2428
+ destinationId: string,
2429
+ filterId: string,
2430
+ options: { headers: { [name: string]: string } } = { headers: {} }
2431
+ ): Promise<{
2432
+ response: http.IncomingMessage;
2433
+ body: RemoveFilterFromDestination200Response;
2434
+ }> {
2435
+ const localVarPath =
2436
+ this.basePath +
2437
+ '/destination/{destinationId}/filters/{filterId}'
2438
+ .replace(
2439
+ '{' + 'destinationId' + '}',
2440
+ encodeURIComponent(String(destinationId))
2441
+ )
2442
+ .replace(
2443
+ '{' + 'filterId' + '}',
2444
+ encodeURIComponent(String(filterId))
2445
+ );
2446
+ let localVarQueryParameters: any = {};
2447
+ let localVarHeaderParams: any = (<any>Object).assign(
2448
+ {},
2449
+ this._defaultHeaders
2450
+ );
2451
+ const produces = ['application/json'];
2452
+ if (produces.indexOf('application/json') >= 0) {
2453
+ localVarHeaderParams.Accept = produces[0];
2454
+ } else {
2455
+ localVarHeaderParams.Accept = 'application/json';
2456
+ }
2457
+ let localVarFormParams: any = {};
2458
+
2459
+ // verify required parameter 'destinationId' is not null or undefined
2460
+ if (destinationId === null || destinationId === undefined) {
2461
+ throw new Error(
2462
+ 'Required parameter destinationId was null or undefined when calling removeFilterFromDestinationCurrent.'
2463
+ );
2464
+ }
2465
+
2466
+ // verify required parameter 'filterId' is not null or undefined
2467
+ if (filterId === null || filterId === undefined) {
2468
+ throw new Error(
2469
+ 'Required parameter filterId was null or undefined when calling removeFilterFromDestinationCurrent.'
2470
+ );
2471
+ }
2472
+
2473
+ (<any>Object).assign(localVarHeaderParams, options.headers);
2474
+
2475
+ let localVarUseFormData = false;
2476
+
2477
+ let localVarRequestOptions: localVarRequest.Options = {
2478
+ method: 'DELETE',
2479
+ qs: localVarQueryParameters,
2480
+ headers: localVarHeaderParams,
2481
+ uri: localVarPath,
2482
+ useQuerystring: this._useQuerystring,
2483
+ json: true,
2484
+ };
2485
+
2486
+ let authenticationPromise = Promise.resolve();
2487
+ if (this.authentications.token.accessToken) {
2488
+ authenticationPromise = authenticationPromise.then(() =>
2489
+ this.authentications.token.applyToRequest(
2490
+ localVarRequestOptions
2491
+ )
2492
+ );
2493
+ }
2494
+ authenticationPromise = authenticationPromise.then(() =>
2495
+ this.authentications.default.applyToRequest(localVarRequestOptions)
2496
+ );
2497
+
2498
+ let interceptorPromise = authenticationPromise;
2499
+ for (const interceptor of this.interceptors) {
2500
+ interceptorPromise = interceptorPromise.then(() =>
2501
+ interceptor(localVarRequestOptions)
2502
+ );
2503
+ }
2504
+
2505
+ return interceptorPromise.then(() => {
2506
+ if (Object.keys(localVarFormParams).length) {
2507
+ if (localVarUseFormData) {
2508
+ (<any>localVarRequestOptions).formData = localVarFormParams;
2509
+ } else {
2510
+ localVarRequestOptions.form = localVarFormParams;
2511
+ }
2512
+ }
2513
+ return new Promise<{
2514
+ response: http.IncomingMessage;
2515
+ body: RemoveFilterFromDestination200Response;
2516
+ }>((resolve, reject) => {
2517
+ localVarRequest(
2518
+ localVarRequestOptions,
2519
+ (error, response, body) => {
2520
+ if (error) {
2521
+ reject(error);
2522
+ } else {
2523
+ if (
2524
+ response.statusCode &&
2525
+ response.statusCode >= 200 &&
2526
+ response.statusCode <= 299
2527
+ ) {
2528
+ body = ObjectSerializer.deserialize(
2529
+ body,
2530
+ 'RemoveFilterFromDestination200Response'
2531
+ );
2532
+ resolve({ response: response, body: body });
2533
+ } else {
2534
+ reject(
2535
+ new HttpError(
2536
+ response,
2537
+ body,
2538
+ response.statusCode
2539
+ )
2540
+ );
2541
+ }
2542
+ }
2543
+ }
2544
+ );
2545
+ });
2546
+ });
2547
+ }
2548
+ /**
2549
+ * Deletes a Destination filter. When called, this endpoint may generate the `Destination Filter Deleted` [Audit Trail](/tag/Audit-Trail) event.
2550
+ * @summary Remove Filter from Destination
2551
+ * @param destinationId
2552
+ * @param filterId
2553
+ */
2554
+ public async removeFilterFromDestinationV1(
2555
+ destinationId: string,
2556
+ filterId: string,
2557
+ options: { headers: { [name: string]: string } } = { headers: {} }
2558
+ ): Promise<{
2559
+ response: http.IncomingMessage;
2560
+ body: RemoveFilterFromDestination200Response;
2561
+ }> {
2562
+ const localVarPath =
2563
+ this.basePath +
2564
+ '/destination/{destinationId}/filters/{filterId}'
2565
+ .replace(
2566
+ '{' + 'destinationId' + '}',
2567
+ encodeURIComponent(String(destinationId))
2568
+ )
2569
+ .replace(
2570
+ '{' + 'filterId' + '}',
2571
+ encodeURIComponent(String(filterId))
2572
+ );
2573
+ let localVarQueryParameters: any = {};
2574
+ let localVarHeaderParams: any = (<any>Object).assign(
2575
+ {},
2576
+ this._defaultHeaders
2577
+ );
2578
+ const produces = [
2579
+ 'application/vnd.segment.v1+json',
2580
+ 'application/json',
2581
+ ];
2582
+ if (produces.indexOf('application/json') >= 0) {
2583
+ localVarHeaderParams.Accept = produces[0];
2584
+ } else {
2585
+ localVarHeaderParams.Accept = 'application/json';
2586
+ }
2587
+ let localVarFormParams: any = {};
2588
+
2589
+ // verify required parameter 'destinationId' is not null or undefined
2590
+ if (destinationId === null || destinationId === undefined) {
2591
+ throw new Error(
2592
+ 'Required parameter destinationId was null or undefined when calling removeFilterFromDestinationV1.'
2593
+ );
2594
+ }
2595
+
2596
+ // verify required parameter 'filterId' is not null or undefined
2597
+ if (filterId === null || filterId === undefined) {
2598
+ throw new Error(
2599
+ 'Required parameter filterId was null or undefined when calling removeFilterFromDestinationV1.'
2600
+ );
2601
+ }
2602
+
2603
+ (<any>Object).assign(localVarHeaderParams, options.headers);
2604
+
2605
+ let localVarUseFormData = false;
2606
+
2607
+ let localVarRequestOptions: localVarRequest.Options = {
2608
+ method: 'DELETE',
2609
+ qs: localVarQueryParameters,
2610
+ headers: localVarHeaderParams,
2611
+ uri: localVarPath,
2612
+ useQuerystring: this._useQuerystring,
2613
+ json: true,
2614
+ };
2615
+
2616
+ let authenticationPromise = Promise.resolve();
2617
+ if (this.authentications.token.accessToken) {
2618
+ authenticationPromise = authenticationPromise.then(() =>
2619
+ this.authentications.token.applyToRequest(
2620
+ localVarRequestOptions
2621
+ )
2622
+ );
2623
+ }
2624
+ authenticationPromise = authenticationPromise.then(() =>
2625
+ this.authentications.default.applyToRequest(localVarRequestOptions)
2626
+ );
2627
+
2628
+ let interceptorPromise = authenticationPromise;
2629
+ for (const interceptor of this.interceptors) {
2630
+ interceptorPromise = interceptorPromise.then(() =>
2631
+ interceptor(localVarRequestOptions)
2632
+ );
2633
+ }
2634
+
2635
+ return interceptorPromise.then(() => {
2636
+ if (Object.keys(localVarFormParams).length) {
2637
+ if (localVarUseFormData) {
2638
+ (<any>localVarRequestOptions).formData = localVarFormParams;
2639
+ } else {
2640
+ localVarRequestOptions.form = localVarFormParams;
2641
+ }
2642
+ }
2643
+ return new Promise<{
2644
+ response: http.IncomingMessage;
2645
+ body: RemoveFilterFromDestination200Response;
2646
+ }>((resolve, reject) => {
2647
+ localVarRequest(
2648
+ localVarRequestOptions,
2649
+ (error, response, body) => {
2650
+ if (error) {
2651
+ reject(error);
2652
+ } else {
2653
+ if (
2654
+ response.statusCode &&
2655
+ response.statusCode >= 200 &&
2656
+ response.statusCode <= 299
2657
+ ) {
2658
+ body = ObjectSerializer.deserialize(
2659
+ body,
2660
+ 'RemoveFilterFromDestination200Response'
2661
+ );
2662
+ resolve({ response: response, body: body });
2663
+ } else {
2664
+ reject(
2665
+ new HttpError(
2666
+ response,
2667
+ body,
2668
+ response.statusCode
2669
+ )
2670
+ );
2671
+ }
2672
+ }
2673
+ }
2674
+ );
2675
+ });
2676
+ });
2677
+ }
2678
+ /**
2679
+ * Updates a filter in a Destination. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Destination Filter Enabled * Destination Filter Disabled
2680
+ * @summary Update Filter for Destination
2681
+ * @param destinationId
2682
+ * @param filterId
2683
+ * @param UpdateFilterForDestinationV1Input
2684
+ */
2685
+ public async updateFilterForDestinationAlpha(
2686
+ destinationId: string,
2687
+ filterId: string,
2688
+ UpdateFilterForDestinationV1Input: UpdateFilterForDestinationV1Input,
2689
+ options: { headers: { [name: string]: string } } = { headers: {} }
2690
+ ): Promise<{
2691
+ response: http.IncomingMessage;
2692
+ body: UpdateFilterForDestination200Response;
2693
+ }> {
2694
+ const localVarPath =
2695
+ this.basePath +
2696
+ '/destination/{destinationId}/filters/{filterId}'
2697
+ .replace(
2698
+ '{' + 'destinationId' + '}',
2699
+ encodeURIComponent(String(destinationId))
2700
+ )
2701
+ .replace(
2702
+ '{' + 'filterId' + '}',
2703
+ encodeURIComponent(String(filterId))
2704
+ );
2705
+ let localVarQueryParameters: any = {};
2706
+ let localVarHeaderParams: any = (<any>Object).assign(
2707
+ {},
2708
+ this._defaultHeaders
2709
+ );
2710
+ const produces = [
2711
+ 'application/vnd.segment.v1alpha+json',
2712
+ 'application/json',
2713
+ ];
2714
+ if (produces.indexOf('application/json') >= 0) {
2715
+ localVarHeaderParams.Accept = produces[0];
2716
+ } else {
2717
+ localVarHeaderParams.Accept = 'application/json';
2718
+ }
2719
+ let localVarFormParams: any = {};
2720
+
2721
+ // verify required parameter 'destinationId' is not null or undefined
2722
+ if (destinationId === null || destinationId === undefined) {
2723
+ throw new Error(
2724
+ 'Required parameter destinationId was null or undefined when calling updateFilterForDestinationAlpha.'
2725
+ );
2726
+ }
2727
+
2728
+ // verify required parameter 'filterId' is not null or undefined
2729
+ if (filterId === null || filterId === undefined) {
2730
+ throw new Error(
2731
+ 'Required parameter filterId was null or undefined when calling updateFilterForDestinationAlpha.'
2732
+ );
2733
+ }
2734
+
2735
+ // verify required parameter 'UpdateFilterForDestinationV1Input' is not null or undefined
2736
+ if (
2737
+ UpdateFilterForDestinationV1Input === null ||
2738
+ UpdateFilterForDestinationV1Input === undefined
2739
+ ) {
2740
+ throw new Error(
2741
+ 'Required parameter UpdateFilterForDestinationV1Input was null or undefined when calling updateFilterForDestinationAlpha.'
2742
+ );
2743
+ }
2744
+
2745
+ (<any>Object).assign(localVarHeaderParams, options.headers);
2746
+
2747
+ let localVarUseFormData = false;
2748
+
2749
+ let localVarRequestOptions: localVarRequest.Options = {
2750
+ method: 'PATCH',
2751
+ qs: localVarQueryParameters,
2752
+ headers: localVarHeaderParams,
2753
+ uri: localVarPath,
2754
+ useQuerystring: this._useQuerystring,
2755
+ json: true,
2756
+ body: ObjectSerializer.serialize(
2757
+ UpdateFilterForDestinationV1Input,
2758
+ 'UpdateFilterForDestinationV1Input'
2759
+ ),
2760
+ };
2761
+
2762
+ let authenticationPromise = Promise.resolve();
2763
+ if (this.authentications.token.accessToken) {
2764
+ authenticationPromise = authenticationPromise.then(() =>
2765
+ this.authentications.token.applyToRequest(
2766
+ localVarRequestOptions
2767
+ )
2768
+ );
2769
+ }
2770
+ authenticationPromise = authenticationPromise.then(() =>
2771
+ this.authentications.default.applyToRequest(localVarRequestOptions)
2772
+ );
2773
+
2774
+ let interceptorPromise = authenticationPromise;
2775
+ for (const interceptor of this.interceptors) {
2776
+ interceptorPromise = interceptorPromise.then(() =>
2777
+ interceptor(localVarRequestOptions)
2778
+ );
2779
+ }
2780
+
2781
+ return interceptorPromise.then(() => {
2782
+ if (Object.keys(localVarFormParams).length) {
2783
+ if (localVarUseFormData) {
2784
+ (<any>localVarRequestOptions).formData = localVarFormParams;
2785
+ } else {
2786
+ localVarRequestOptions.form = localVarFormParams;
2787
+ }
2788
+ }
2789
+ return new Promise<{
2790
+ response: http.IncomingMessage;
2791
+ body: UpdateFilterForDestination200Response;
2792
+ }>((resolve, reject) => {
2793
+ localVarRequest(
2794
+ localVarRequestOptions,
2795
+ (error, response, body) => {
2796
+ if (error) {
2797
+ reject(error);
2798
+ } else {
2799
+ if (
2800
+ response.statusCode &&
2801
+ response.statusCode >= 200 &&
2802
+ response.statusCode <= 299
2803
+ ) {
2804
+ body = ObjectSerializer.deserialize(
2805
+ body,
2806
+ 'UpdateFilterForDestination200Response'
2807
+ );
2808
+ resolve({ response: response, body: body });
2809
+ } else {
2810
+ reject(
2811
+ new HttpError(
2812
+ response,
2813
+ body,
2814
+ response.statusCode
2815
+ )
2816
+ );
2817
+ }
2818
+ }
2819
+ }
2820
+ );
2821
+ });
2822
+ });
2823
+ }
2824
+ /**
2825
+ * Updates a filter in a Destination. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Destination Filter Enabled * Destination Filter Disabled
2826
+ * @summary Update Filter for Destination
2827
+ * @param destinationId
2828
+ * @param filterId
2829
+ * @param UpdateFilterForDestinationV1Input
2830
+ */
2831
+ public async updateFilterForDestinationBeta(
2832
+ destinationId: string,
2833
+ filterId: string,
2834
+ UpdateFilterForDestinationV1Input: UpdateFilterForDestinationV1Input,
2835
+ options: { headers: { [name: string]: string } } = { headers: {} }
2836
+ ): Promise<{
2837
+ response: http.IncomingMessage;
2838
+ body: UpdateFilterForDestination200Response;
2839
+ }> {
2840
+ const localVarPath =
2841
+ this.basePath +
2842
+ '/destination/{destinationId}/filters/{filterId}'
2843
+ .replace(
2844
+ '{' + 'destinationId' + '}',
2845
+ encodeURIComponent(String(destinationId))
2846
+ )
2847
+ .replace(
2848
+ '{' + 'filterId' + '}',
2849
+ encodeURIComponent(String(filterId))
2850
+ );
2851
+ let localVarQueryParameters: any = {};
2852
+ let localVarHeaderParams: any = (<any>Object).assign(
2853
+ {},
2854
+ this._defaultHeaders
2855
+ );
2856
+ const produces = [
2857
+ 'application/vnd.segment.v1beta+json',
2858
+ 'application/json',
2859
+ ];
2860
+ if (produces.indexOf('application/json') >= 0) {
2861
+ localVarHeaderParams.Accept = produces[0];
2862
+ } else {
2863
+ localVarHeaderParams.Accept = 'application/json';
2864
+ }
2865
+ let localVarFormParams: any = {};
2866
+
2867
+ // verify required parameter 'destinationId' is not null or undefined
2868
+ if (destinationId === null || destinationId === undefined) {
2869
+ throw new Error(
2870
+ 'Required parameter destinationId was null or undefined when calling updateFilterForDestinationBeta.'
2871
+ );
2872
+ }
2873
+
2874
+ // verify required parameter 'filterId' is not null or undefined
2875
+ if (filterId === null || filterId === undefined) {
2876
+ throw new Error(
2877
+ 'Required parameter filterId was null or undefined when calling updateFilterForDestinationBeta.'
2878
+ );
2879
+ }
2880
+
2881
+ // verify required parameter 'UpdateFilterForDestinationV1Input' is not null or undefined
2882
+ if (
2883
+ UpdateFilterForDestinationV1Input === null ||
2884
+ UpdateFilterForDestinationV1Input === undefined
2885
+ ) {
2886
+ throw new Error(
2887
+ 'Required parameter UpdateFilterForDestinationV1Input was null or undefined when calling updateFilterForDestinationBeta.'
2888
+ );
2889
+ }
2890
+
2891
+ (<any>Object).assign(localVarHeaderParams, options.headers);
2892
+
2893
+ let localVarUseFormData = false;
2894
+
2895
+ let localVarRequestOptions: localVarRequest.Options = {
2896
+ method: 'PATCH',
2897
+ qs: localVarQueryParameters,
2898
+ headers: localVarHeaderParams,
2899
+ uri: localVarPath,
2900
+ useQuerystring: this._useQuerystring,
2901
+ json: true,
2902
+ body: ObjectSerializer.serialize(
2903
+ UpdateFilterForDestinationV1Input,
2904
+ 'UpdateFilterForDestinationV1Input'
2905
+ ),
2906
+ };
2907
+
2908
+ let authenticationPromise = Promise.resolve();
2909
+ if (this.authentications.token.accessToken) {
2910
+ authenticationPromise = authenticationPromise.then(() =>
2911
+ this.authentications.token.applyToRequest(
2912
+ localVarRequestOptions
2913
+ )
2914
+ );
2915
+ }
2916
+ authenticationPromise = authenticationPromise.then(() =>
2917
+ this.authentications.default.applyToRequest(localVarRequestOptions)
2918
+ );
2919
+
2920
+ let interceptorPromise = authenticationPromise;
2921
+ for (const interceptor of this.interceptors) {
2922
+ interceptorPromise = interceptorPromise.then(() =>
2923
+ interceptor(localVarRequestOptions)
2924
+ );
2925
+ }
2926
+
2927
+ return interceptorPromise.then(() => {
2928
+ if (Object.keys(localVarFormParams).length) {
2929
+ if (localVarUseFormData) {
2930
+ (<any>localVarRequestOptions).formData = localVarFormParams;
2931
+ } else {
2932
+ localVarRequestOptions.form = localVarFormParams;
2933
+ }
2934
+ }
2935
+ return new Promise<{
2936
+ response: http.IncomingMessage;
2937
+ body: UpdateFilterForDestination200Response;
2938
+ }>((resolve, reject) => {
2939
+ localVarRequest(
2940
+ localVarRequestOptions,
2941
+ (error, response, body) => {
2942
+ if (error) {
2943
+ reject(error);
2944
+ } else {
2945
+ if (
2946
+ response.statusCode &&
2947
+ response.statusCode >= 200 &&
2948
+ response.statusCode <= 299
2949
+ ) {
2950
+ body = ObjectSerializer.deserialize(
2951
+ body,
2952
+ 'UpdateFilterForDestination200Response'
2953
+ );
2954
+ resolve({ response: response, body: body });
2955
+ } else {
2956
+ reject(
2957
+ new HttpError(
2958
+ response,
2959
+ body,
2960
+ response.statusCode
2961
+ )
2962
+ );
2963
+ }
2964
+ }
2965
+ }
2966
+ );
2967
+ });
2968
+ });
2969
+ }
2970
+ /**
2971
+ * Updates a filter in a Destination. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Destination Filter Enabled * Destination Filter Disabled
2972
+ * @summary Update Filter for Destination
2973
+ * @param destinationId
2974
+ * @param filterId
2975
+ * @param UpdateFilterForDestinationV1Input
2976
+ */
2977
+ public async updateFilterForDestinationCurrent(
2978
+ destinationId: string,
2979
+ filterId: string,
2980
+ UpdateFilterForDestinationV1Input: UpdateFilterForDestinationV1Input,
2981
+ options: { headers: { [name: string]: string } } = { headers: {} }
2982
+ ): Promise<{
2983
+ response: http.IncomingMessage;
2984
+ body: UpdateFilterForDestination200Response;
2985
+ }> {
2986
+ const localVarPath =
2987
+ this.basePath +
2988
+ '/destination/{destinationId}/filters/{filterId}'
2989
+ .replace(
2990
+ '{' + 'destinationId' + '}',
2991
+ encodeURIComponent(String(destinationId))
2992
+ )
2993
+ .replace(
2994
+ '{' + 'filterId' + '}',
2995
+ encodeURIComponent(String(filterId))
2996
+ );
2997
+ let localVarQueryParameters: any = {};
2998
+ let localVarHeaderParams: any = (<any>Object).assign(
2999
+ {},
3000
+ this._defaultHeaders
3001
+ );
3002
+ const produces = [
3003
+ 'application/vnd.segment.v1+json',
3004
+ 'application/json',
3005
+ ];
3006
+ if (produces.indexOf('application/json') >= 0) {
3007
+ localVarHeaderParams.Accept = produces[0];
3008
+ } else {
3009
+ localVarHeaderParams.Accept = 'application/json';
3010
+ }
3011
+ let localVarFormParams: any = {};
3012
+
3013
+ // verify required parameter 'destinationId' is not null or undefined
3014
+ if (destinationId === null || destinationId === undefined) {
3015
+ throw new Error(
3016
+ 'Required parameter destinationId was null or undefined when calling updateFilterForDestinationCurrent.'
3017
+ );
3018
+ }
3019
+
3020
+ // verify required parameter 'filterId' is not null or undefined
3021
+ if (filterId === null || filterId === undefined) {
3022
+ throw new Error(
3023
+ 'Required parameter filterId was null or undefined when calling updateFilterForDestinationCurrent.'
3024
+ );
3025
+ }
3026
+
3027
+ // verify required parameter 'UpdateFilterForDestinationV1Input' is not null or undefined
3028
+ if (
3029
+ UpdateFilterForDestinationV1Input === null ||
3030
+ UpdateFilterForDestinationV1Input === undefined
3031
+ ) {
3032
+ throw new Error(
3033
+ 'Required parameter UpdateFilterForDestinationV1Input was null or undefined when calling updateFilterForDestinationCurrent.'
3034
+ );
3035
+ }
3036
+
3037
+ (<any>Object).assign(localVarHeaderParams, options.headers);
3038
+
3039
+ let localVarUseFormData = false;
3040
+
3041
+ let localVarRequestOptions: localVarRequest.Options = {
3042
+ method: 'PATCH',
3043
+ qs: localVarQueryParameters,
3044
+ headers: localVarHeaderParams,
3045
+ uri: localVarPath,
3046
+ useQuerystring: this._useQuerystring,
3047
+ json: true,
3048
+ body: ObjectSerializer.serialize(
3049
+ UpdateFilterForDestinationV1Input,
3050
+ 'UpdateFilterForDestinationV1Input'
3051
+ ),
3052
+ };
3053
+
3054
+ let authenticationPromise = Promise.resolve();
3055
+ if (this.authentications.token.accessToken) {
3056
+ authenticationPromise = authenticationPromise.then(() =>
3057
+ this.authentications.token.applyToRequest(
3058
+ localVarRequestOptions
3059
+ )
3060
+ );
3061
+ }
3062
+ authenticationPromise = authenticationPromise.then(() =>
3063
+ this.authentications.default.applyToRequest(localVarRequestOptions)
3064
+ );
3065
+
3066
+ let interceptorPromise = authenticationPromise;
3067
+ for (const interceptor of this.interceptors) {
3068
+ interceptorPromise = interceptorPromise.then(() =>
3069
+ interceptor(localVarRequestOptions)
3070
+ );
3071
+ }
3072
+
3073
+ return interceptorPromise.then(() => {
3074
+ if (Object.keys(localVarFormParams).length) {
3075
+ if (localVarUseFormData) {
3076
+ (<any>localVarRequestOptions).formData = localVarFormParams;
3077
+ } else {
3078
+ localVarRequestOptions.form = localVarFormParams;
3079
+ }
3080
+ }
3081
+ return new Promise<{
3082
+ response: http.IncomingMessage;
3083
+ body: UpdateFilterForDestination200Response;
3084
+ }>((resolve, reject) => {
3085
+ localVarRequest(
3086
+ localVarRequestOptions,
3087
+ (error, response, body) => {
3088
+ if (error) {
3089
+ reject(error);
3090
+ } else {
3091
+ if (
3092
+ response.statusCode &&
3093
+ response.statusCode >= 200 &&
3094
+ response.statusCode <= 299
3095
+ ) {
3096
+ body = ObjectSerializer.deserialize(
3097
+ body,
3098
+ 'UpdateFilterForDestination200Response'
3099
+ );
3100
+ resolve({ response: response, body: body });
3101
+ } else {
3102
+ reject(
3103
+ new HttpError(
3104
+ response,
3105
+ body,
3106
+ response.statusCode
3107
+ )
3108
+ );
3109
+ }
3110
+ }
3111
+ }
3112
+ );
3113
+ });
3114
+ });
3115
+ }
3116
+ /**
3117
+ * Updates a filter in a Destination. When called, this endpoint may generate one or more of the following [Audit Trail](/tag/Audit-Trail) events: * Destination Filter Enabled * Destination Filter Disabled
3118
+ * @summary Update Filter for Destination
3119
+ * @param destinationId
3120
+ * @param filterId
3121
+ * @param UpdateFilterForDestinationV1Input
3122
+ */
3123
+ public async updateFilterForDestinationV1(
3124
+ destinationId: string,
3125
+ filterId: string,
3126
+ UpdateFilterForDestinationV1Input: UpdateFilterForDestinationV1Input,
3127
+ options: { headers: { [name: string]: string } } = { headers: {} }
3128
+ ): Promise<{
3129
+ response: http.IncomingMessage;
3130
+ body: UpdateFilterForDestination200Response;
3131
+ }> {
3132
+ const localVarPath =
3133
+ this.basePath +
3134
+ '/destination/{destinationId}/filters/{filterId}'
3135
+ .replace(
3136
+ '{' + 'destinationId' + '}',
3137
+ encodeURIComponent(String(destinationId))
3138
+ )
3139
+ .replace(
3140
+ '{' + 'filterId' + '}',
3141
+ encodeURIComponent(String(filterId))
3142
+ );
3143
+ let localVarQueryParameters: any = {};
3144
+ let localVarHeaderParams: any = (<any>Object).assign(
3145
+ {},
3146
+ this._defaultHeaders
3147
+ );
3148
+ const produces = [
3149
+ 'application/vnd.segment.v1+json',
3150
+ 'application/json',
3151
+ ];
3152
+ if (produces.indexOf('application/json') >= 0) {
3153
+ localVarHeaderParams.Accept = produces[0];
3154
+ } else {
3155
+ localVarHeaderParams.Accept = 'application/json';
3156
+ }
3157
+ let localVarFormParams: any = {};
3158
+
3159
+ // verify required parameter 'destinationId' is not null or undefined
3160
+ if (destinationId === null || destinationId === undefined) {
3161
+ throw new Error(
3162
+ 'Required parameter destinationId was null or undefined when calling updateFilterForDestinationV1.'
3163
+ );
3164
+ }
3165
+
3166
+ // verify required parameter 'filterId' is not null or undefined
3167
+ if (filterId === null || filterId === undefined) {
3168
+ throw new Error(
3169
+ 'Required parameter filterId was null or undefined when calling updateFilterForDestinationV1.'
3170
+ );
3171
+ }
3172
+
3173
+ // verify required parameter 'UpdateFilterForDestinationV1Input' is not null or undefined
3174
+ if (
3175
+ UpdateFilterForDestinationV1Input === null ||
3176
+ UpdateFilterForDestinationV1Input === undefined
3177
+ ) {
3178
+ throw new Error(
3179
+ 'Required parameter UpdateFilterForDestinationV1Input was null or undefined when calling updateFilterForDestinationV1.'
3180
+ );
3181
+ }
3182
+
3183
+ (<any>Object).assign(localVarHeaderParams, options.headers);
3184
+
3185
+ let localVarUseFormData = false;
3186
+
3187
+ let localVarRequestOptions: localVarRequest.Options = {
3188
+ method: 'PATCH',
3189
+ qs: localVarQueryParameters,
3190
+ headers: localVarHeaderParams,
3191
+ uri: localVarPath,
3192
+ useQuerystring: this._useQuerystring,
3193
+ json: true,
3194
+ body: ObjectSerializer.serialize(
3195
+ UpdateFilterForDestinationV1Input,
3196
+ 'UpdateFilterForDestinationV1Input'
3197
+ ),
3198
+ };
3199
+
3200
+ let authenticationPromise = Promise.resolve();
3201
+ if (this.authentications.token.accessToken) {
3202
+ authenticationPromise = authenticationPromise.then(() =>
3203
+ this.authentications.token.applyToRequest(
3204
+ localVarRequestOptions
3205
+ )
3206
+ );
3207
+ }
3208
+ authenticationPromise = authenticationPromise.then(() =>
3209
+ this.authentications.default.applyToRequest(localVarRequestOptions)
3210
+ );
3211
+
3212
+ let interceptorPromise = authenticationPromise;
3213
+ for (const interceptor of this.interceptors) {
3214
+ interceptorPromise = interceptorPromise.then(() =>
3215
+ interceptor(localVarRequestOptions)
3216
+ );
3217
+ }
3218
+
3219
+ return interceptorPromise.then(() => {
3220
+ if (Object.keys(localVarFormParams).length) {
3221
+ if (localVarUseFormData) {
3222
+ (<any>localVarRequestOptions).formData = localVarFormParams;
3223
+ } else {
3224
+ localVarRequestOptions.form = localVarFormParams;
3225
+ }
3226
+ }
3227
+ return new Promise<{
3228
+ response: http.IncomingMessage;
3229
+ body: UpdateFilterForDestination200Response;
3230
+ }>((resolve, reject) => {
3231
+ localVarRequest(
3232
+ localVarRequestOptions,
3233
+ (error, response, body) => {
3234
+ if (error) {
3235
+ reject(error);
3236
+ } else {
3237
+ if (
3238
+ response.statusCode &&
3239
+ response.statusCode >= 200 &&
3240
+ response.statusCode <= 299
3241
+ ) {
3242
+ body = ObjectSerializer.deserialize(
3243
+ body,
3244
+ 'UpdateFilterForDestination200Response'
3245
+ );
3246
+ resolve({ response: response, body: body });
3247
+ } else {
3248
+ reject(
3249
+ new HttpError(
3250
+ response,
3251
+ body,
3252
+ response.statusCode
3253
+ )
3254
+ );
3255
+ }
3256
+ }
3257
+ }
3258
+ );
3259
+ });
3260
+ });
3261
+ }
3262
+ }