From 1f53b3002f813b206042f0238d5e4bcf71df084a Mon Sep 17 00:00:00 2001 From: sarojpoudel Date: Thu, 8 Aug 2024 16:52:14 -0400 Subject: [PATCH 1/3] add profile sync --- api/apis.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/apis.ts b/api/apis.ts index 9dfd159d6..9b9f19420 100644 --- a/api/apis.ts +++ b/api/apis.ts @@ -112,6 +112,7 @@ export interface Apis { iamUsers: IAMUsersApi; labels: LabelsApi; monthlyTrackedUsers: MonthlyTrackedUsersApi; + profilesSync: ProfilesSyncApi; selectiveSync: SelectiveSyncApi; sources: SourcesApi; spaces: SpacesApi; @@ -147,6 +148,7 @@ export function configureApis( iamUsers: new IAMUsersApi(), labels: new LabelsApi(), monthlyTrackedUsers: new MonthlyTrackedUsersApi(), + profilesSync: new ProfilesSyncApi(), selectiveSync: new SelectiveSyncApi(), sources: new SourcesApi(), spaces: new SpacesApi(), From ce37578ae9c9ae63f6dfbf39aa57edf286517d20 Mon Sep 17 00:00:00 2001 From: sarojpoudel Date: Fri, 9 Aug 2024 10:00:56 -0400 Subject: [PATCH 2/3] add profilesSync to configureEuApis --- api/apis.ts | 389 ++++++++++++++++++++++++++-------------------------- 1 file changed, 195 insertions(+), 194 deletions(-) diff --git a/api/apis.ts b/api/apis.ts index 9b9f19420..8ed80c83e 100644 --- a/api/apis.ts +++ b/api/apis.ts @@ -1,126 +1,126 @@ -export * from './aPICallsApi'; -import { APICallsApi } from './aPICallsApi'; -export * from './audiencesApi'; -import { AudiencesApi } from './audiencesApi'; -export * from './auditTrailApi'; -import { AuditTrailApi } from './auditTrailApi'; -export * from './catalogApi'; -import { CatalogApi } from './catalogApi'; -export * from './computedTraitsApi'; -import { ComputedTraitsApi } from './computedTraitsApi'; -export * from './deletionAndSuppressionApi'; -import { DeletionAndSuppressionApi } from './deletionAndSuppressionApi'; -export * from './deliveryOverviewApi'; -import { DeliveryOverviewApi } from './deliveryOverviewApi'; -export * from './destinationFiltersApi'; -import { DestinationFiltersApi } from './destinationFiltersApi'; -export * from './destinationsApi'; -import { DestinationsApi } from './destinationsApi'; -export * from './edgeFunctionsApi'; -import { EdgeFunctionsApi } from './edgeFunctionsApi'; -export * from './eventsApi'; -import { EventsApi } from './eventsApi'; -export * from './functionsApi'; -import { FunctionsApi } from './functionsApi'; -export * from './iAMGroupsApi'; -import { IAMGroupsApi } from './iAMGroupsApi'; -export * from './iAMRolesApi'; -import { IAMRolesApi } from './iAMRolesApi'; -export * from './iAMUsersApi'; -import { IAMUsersApi } from './iAMUsersApi'; -export * from './labelsApi'; -import { LabelsApi } from './labelsApi'; -export * from './monthlyTrackedUsersApi'; -import { MonthlyTrackedUsersApi } from './monthlyTrackedUsersApi'; -export * from './profilesSyncApi'; -import { ProfilesSyncApi } from './profilesSyncApi'; -export * from './reverseETLApi'; -import { ReverseETLApi } from './reverseETLApi'; -export * from './selectiveSyncApi'; -import { SelectiveSyncApi } from './selectiveSyncApi'; -export * from './sourcesApi'; -import { SourcesApi } from './sourcesApi'; -export * from './spacesApi'; -import { SpacesApi } from './spacesApi'; -export * from './testingApi'; -import { TestingApi } from './testingApi'; -export * from './trackingPlansApi'; -import { TrackingPlansApi } from './trackingPlansApi'; -export * from './transformationsApi'; -import { TransformationsApi } from './transformationsApi'; -export * from './warehousesApi'; -import { WarehousesApi } from './warehousesApi'; -export * from './workspacesApi'; -import { WorkspacesApi } from './workspacesApi'; -import * as http from 'http'; +export * from "./aPICallsApi"; +import { APICallsApi } from "./aPICallsApi"; +export * from "./audiencesApi"; +import { AudiencesApi } from "./audiencesApi"; +export * from "./auditTrailApi"; +import { AuditTrailApi } from "./auditTrailApi"; +export * from "./catalogApi"; +import { CatalogApi } from "./catalogApi"; +export * from "./computedTraitsApi"; +import { ComputedTraitsApi } from "./computedTraitsApi"; +export * from "./deletionAndSuppressionApi"; +import { DeletionAndSuppressionApi } from "./deletionAndSuppressionApi"; +export * from "./deliveryOverviewApi"; +import { DeliveryOverviewApi } from "./deliveryOverviewApi"; +export * from "./destinationFiltersApi"; +import { DestinationFiltersApi } from "./destinationFiltersApi"; +export * from "./destinationsApi"; +import { DestinationsApi } from "./destinationsApi"; +export * from "./edgeFunctionsApi"; +import { EdgeFunctionsApi } from "./edgeFunctionsApi"; +export * from "./eventsApi"; +import { EventsApi } from "./eventsApi"; +export * from "./functionsApi"; +import { FunctionsApi } from "./functionsApi"; +export * from "./iAMGroupsApi"; +import { IAMGroupsApi } from "./iAMGroupsApi"; +export * from "./iAMRolesApi"; +import { IAMRolesApi } from "./iAMRolesApi"; +export * from "./iAMUsersApi"; +import { IAMUsersApi } from "./iAMUsersApi"; +export * from "./labelsApi"; +import { LabelsApi } from "./labelsApi"; +export * from "./monthlyTrackedUsersApi"; +import { MonthlyTrackedUsersApi } from "./monthlyTrackedUsersApi"; +export * from "./profilesSyncApi"; +import { ProfilesSyncApi } from "./profilesSyncApi"; +export * from "./reverseETLApi"; +import { ReverseETLApi } from "./reverseETLApi"; +export * from "./selectiveSyncApi"; +import { SelectiveSyncApi } from "./selectiveSyncApi"; +export * from "./sourcesApi"; +import { SourcesApi } from "./sourcesApi"; +export * from "./spacesApi"; +import { SpacesApi } from "./spacesApi"; +export * from "./testingApi"; +import { TestingApi } from "./testingApi"; +export * from "./trackingPlansApi"; +import { TrackingPlansApi } from "./trackingPlansApi"; +export * from "./transformationsApi"; +import { TransformationsApi } from "./transformationsApi"; +export * from "./warehousesApi"; +import { WarehousesApi } from "./warehousesApi"; +export * from "./workspacesApi"; +import { WorkspacesApi } from "./workspacesApi"; +import * as http from "http"; export class HttpError extends Error { - constructor( - public response: http.IncomingMessage, - public body: any, - public statusCode?: number - ) { - super('HTTP request failed'); - this.name = 'HttpError'; - } + constructor( + public response: http.IncomingMessage, + public body: any, + public statusCode?: number + ) { + super("HTTP request failed"); + this.name = "HttpError"; + } } -export { RequestFile } from '../model/models'; +export { RequestFile } from "../model/models"; export const APIS = [ - APICallsApi, - AudiencesApi, - AuditTrailApi, - CatalogApi, - ComputedTraitsApi, - DeletionAndSuppressionApi, - DeliveryOverviewApi, - DestinationFiltersApi, - DestinationsApi, - EdgeFunctionsApi, - EventsApi, - FunctionsApi, - IAMGroupsApi, - IAMRolesApi, - IAMUsersApi, - LabelsApi, - MonthlyTrackedUsersApi, - ProfilesSyncApi, - ReverseETLApi, - SelectiveSyncApi, - SourcesApi, - SpacesApi, - TestingApi, - TrackingPlansApi, - TransformationsApi, - WarehousesApi, - WorkspacesApi, + APICallsApi, + AudiencesApi, + AuditTrailApi, + CatalogApi, + ComputedTraitsApi, + DeletionAndSuppressionApi, + DeliveryOverviewApi, + DestinationFiltersApi, + DestinationsApi, + EdgeFunctionsApi, + EventsApi, + FunctionsApi, + IAMGroupsApi, + IAMRolesApi, + IAMUsersApi, + LabelsApi, + MonthlyTrackedUsersApi, + ProfilesSyncApi, + ReverseETLApi, + SelectiveSyncApi, + SourcesApi, + SpacesApi, + TestingApi, + TrackingPlansApi, + TransformationsApi, + WarehousesApi, + WorkspacesApi, ]; export interface Apis { - apiCalls: APICallsApi; - auditTrail: AuditTrailApi; - catalog: CatalogApi; - deletionAndSuppresion: DeletionAndSuppressionApi; - destinationFilters: DestinationFiltersApi; - destinations: DestinationsApi; - edgeFunctions: EdgeFunctionsApi; - events: EventsApi; - functions: FunctionsApi; - iamGroups: IAMGroupsApi; - iamRoles: IAMRolesApi; - iamUsers: IAMUsersApi; - labels: LabelsApi; - monthlyTrackedUsers: MonthlyTrackedUsersApi; - profilesSync: ProfilesSyncApi; - selectiveSync: SelectiveSyncApi; - sources: SourcesApi; - spaces: SpacesApi; - testing: TestingApi; - trackingPlans: TrackingPlansApi; - transformations: TransformationsApi; - warehouses: WarehousesApi; - workspaces: WorkspacesApi; + apiCalls: APICallsApi; + auditTrail: AuditTrailApi; + catalog: CatalogApi; + deletionAndSuppresion: DeletionAndSuppressionApi; + destinationFilters: DestinationFiltersApi; + destinations: DestinationsApi; + edgeFunctions: EdgeFunctionsApi; + events: EventsApi; + functions: FunctionsApi; + iamGroups: IAMGroupsApi; + iamRoles: IAMRolesApi; + iamUsers: IAMUsersApi; + labels: LabelsApi; + monthlyTrackedUsers: MonthlyTrackedUsersApi; + profilesSync: ProfilesSyncApi; + selectiveSync: SelectiveSyncApi; + sources: SourcesApi; + spaces: SpacesApi; + testing: TestingApi; + trackingPlans: TrackingPlansApi; + transformations: TransformationsApi; + warehouses: WarehousesApi; + workspaces: WorkspacesApi; } /** @@ -130,43 +130,43 @@ export interface Apis { * @returns The consolidated client */ export function configureApis( - token: string, - headers: Record = {} + token: string, + headers: Record = {} ): Apis { - const apis = { - apiCalls: new APICallsApi(), - auditTrail: new AuditTrailApi(), - catalog: new CatalogApi(), - deletionAndSuppresion: new DeletionAndSuppressionApi(), - destinationFilters: new DestinationFiltersApi(), - destinations: new DestinationsApi(), - edgeFunctions: new EdgeFunctionsApi(), - events: new EventsApi(), - functions: new FunctionsApi(), - iamGroups: new IAMGroupsApi(), - iamRoles: new IAMRolesApi(), - iamUsers: new IAMUsersApi(), - labels: new LabelsApi(), - monthlyTrackedUsers: new MonthlyTrackedUsersApi(), - profilesSync: new ProfilesSyncApi(), - selectiveSync: new SelectiveSyncApi(), - sources: new SourcesApi(), - spaces: new SpacesApi(), - testing: new TestingApi(), - trackingPlans: new TrackingPlansApi(), - transformations: new TransformationsApi(), - warehouses: new WarehousesApi(), - workspaces: new WorkspacesApi(), - }; + const apis = { + apiCalls: new APICallsApi(), + auditTrail: new AuditTrailApi(), + catalog: new CatalogApi(), + deletionAndSuppresion: new DeletionAndSuppressionApi(), + destinationFilters: new DestinationFiltersApi(), + destinations: new DestinationsApi(), + edgeFunctions: new EdgeFunctionsApi(), + events: new EventsApi(), + functions: new FunctionsApi(), + iamGroups: new IAMGroupsApi(), + iamRoles: new IAMRolesApi(), + iamUsers: new IAMUsersApi(), + labels: new LabelsApi(), + monthlyTrackedUsers: new MonthlyTrackedUsersApi(), + profilesSync: new ProfilesSyncApi(), + selectiveSync: new SelectiveSyncApi(), + sources: new SourcesApi(), + spaces: new SpacesApi(), + testing: new TestingApi(), + trackingPlans: new TrackingPlansApi(), + transformations: new TransformationsApi(), + warehouses: new WarehousesApi(), + workspaces: new WorkspacesApi(), + }; - for (const k of Object.keys(apis)) { - const key = k as keyof typeof apis; - headers['User-Agent'] = 'Public API SDK 52.0.0 (TypeScript)'; - apis[key].accessToken = token; - apis[key].defaultHeaders = headers; - } + for (const k of Object.keys(apis)) { + const key = k as keyof typeof apis; + headers["User-Agent"] = "Public API SDK 52.0.0 (TypeScript)"; + apis[key].accessToken = token; + apis[key].defaultHeaders = headers; + } - return apis; + return apis; } /** @@ -176,44 +176,45 @@ export function configureApis( * @returns The consolidated client */ export function configureEuApis( - token: string, - headers: Record = {} + token: string, + headers: Record = {} ): Apis { - const basePath = 'https://eu1.api.segmentapis.com'; + const basePath = "https://eu1.api.segmentapis.com"; - const apis = { - apiCalls: new APICallsApi(basePath), - auditTrail: new AuditTrailApi(basePath), - catalog: new CatalogApi(basePath), - deletionAndSuppresion: new DeletionAndSuppressionApi(basePath), - destinationFilters: new DestinationFiltersApi(basePath), - destinations: new DestinationsApi(basePath), - edgeFunctions: new EdgeFunctionsApi(basePath), - events: new EventsApi(basePath), - functions: new FunctionsApi(basePath), - iamGroups: new IAMGroupsApi(basePath), - iamRoles: new IAMRolesApi(basePath), - iamUsers: new IAMUsersApi(basePath), - labels: new LabelsApi(basePath), - monthlyTrackedUsers: new MonthlyTrackedUsersApi(basePath), - selectiveSync: new SelectiveSyncApi(basePath), - sources: new SourcesApi(basePath), - spaces: new SpacesApi(basePath), - testing: new TestingApi(basePath), - trackingPlans: new TrackingPlansApi(basePath), - transformations: new TransformationsApi(basePath), - warehouses: new WarehousesApi(basePath), - workspaces: new WorkspacesApi(basePath), - }; + const apis = { + apiCalls: new APICallsApi(basePath), + auditTrail: new AuditTrailApi(basePath), + catalog: new CatalogApi(basePath), + deletionAndSuppresion: new DeletionAndSuppressionApi(basePath), + destinationFilters: new DestinationFiltersApi(basePath), + destinations: new DestinationsApi(basePath), + edgeFunctions: new EdgeFunctionsApi(basePath), + events: new EventsApi(basePath), + functions: new FunctionsApi(basePath), + iamGroups: new IAMGroupsApi(basePath), + iamRoles: new IAMRolesApi(basePath), + iamUsers: new IAMUsersApi(basePath), + labels: new LabelsApi(basePath), + monthlyTrackedUsers: new MonthlyTrackedUsersApi(basePath), + profilesSync: new ProfilesSyncApi(basePath), + selectiveSync: new SelectiveSyncApi(basePath), + sources: new SourcesApi(basePath), + spaces: new SpacesApi(basePath), + testing: new TestingApi(basePath), + trackingPlans: new TrackingPlansApi(basePath), + transformations: new TransformationsApi(basePath), + warehouses: new WarehousesApi(basePath), + workspaces: new WorkspacesApi(basePath), + }; - for (const k of Object.keys(apis)) { - const key = k as keyof typeof apis; - headers['User-Agent'] = 'Public API SDK 52.0.0 (TypeScript)'; - apis[key].accessToken = token; - apis[key].defaultHeaders = headers; - } + for (const k of Object.keys(apis)) { + const key = k as keyof typeof apis; + headers["User-Agent"] = "Public API SDK 52.0.0 (TypeScript)"; + apis[key].accessToken = token; + apis[key].defaultHeaders = headers; + } - return apis; + return apis; } /** @@ -225,19 +226,19 @@ export function configureEuApis( * @returns the unwrapped data */ export async function unwrap( - promise: Promise<{ - body: { data?: T }; - }>, - fallback?: string + promise: Promise<{ + body: { data?: T }; + }>, + fallback?: string ): Promise { - const response = await promise.catch((e: HttpError) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - throw e.body.errors[0]; - }); + const response = await promise.catch((e: HttpError) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + throw e.body.errors[0]; + }); - if (response.body === undefined || response.body.data === undefined) { - throw new Error(fallback ?? 'Could not load data'); - } + if (response.body === undefined || response.body.data === undefined) { + throw new Error(fallback ?? "Could not load data"); + } - return response.body.data; + return response.body.data; } From 140d81ed97749f164c9737e36be9d6411efb27e1 Mon Sep 17 00:00:00 2001 From: sarojpoudel Date: Fri, 9 Aug 2024 10:43:53 -0400 Subject: [PATCH 3/3] ignore format --- api/apis.ts | 390 ++++++++++++++++++++++++++-------------------------- 1 file changed, 195 insertions(+), 195 deletions(-) diff --git a/api/apis.ts b/api/apis.ts index 8ed80c83e..f4be59ce7 100644 --- a/api/apis.ts +++ b/api/apis.ts @@ -1,126 +1,126 @@ -export * from "./aPICallsApi"; -import { APICallsApi } from "./aPICallsApi"; -export * from "./audiencesApi"; -import { AudiencesApi } from "./audiencesApi"; -export * from "./auditTrailApi"; -import { AuditTrailApi } from "./auditTrailApi"; -export * from "./catalogApi"; -import { CatalogApi } from "./catalogApi"; -export * from "./computedTraitsApi"; -import { ComputedTraitsApi } from "./computedTraitsApi"; -export * from "./deletionAndSuppressionApi"; -import { DeletionAndSuppressionApi } from "./deletionAndSuppressionApi"; -export * from "./deliveryOverviewApi"; -import { DeliveryOverviewApi } from "./deliveryOverviewApi"; -export * from "./destinationFiltersApi"; -import { DestinationFiltersApi } from "./destinationFiltersApi"; -export * from "./destinationsApi"; -import { DestinationsApi } from "./destinationsApi"; -export * from "./edgeFunctionsApi"; -import { EdgeFunctionsApi } from "./edgeFunctionsApi"; -export * from "./eventsApi"; -import { EventsApi } from "./eventsApi"; -export * from "./functionsApi"; -import { FunctionsApi } from "./functionsApi"; -export * from "./iAMGroupsApi"; -import { IAMGroupsApi } from "./iAMGroupsApi"; -export * from "./iAMRolesApi"; -import { IAMRolesApi } from "./iAMRolesApi"; -export * from "./iAMUsersApi"; -import { IAMUsersApi } from "./iAMUsersApi"; -export * from "./labelsApi"; -import { LabelsApi } from "./labelsApi"; -export * from "./monthlyTrackedUsersApi"; -import { MonthlyTrackedUsersApi } from "./monthlyTrackedUsersApi"; -export * from "./profilesSyncApi"; -import { ProfilesSyncApi } from "./profilesSyncApi"; -export * from "./reverseETLApi"; -import { ReverseETLApi } from "./reverseETLApi"; -export * from "./selectiveSyncApi"; -import { SelectiveSyncApi } from "./selectiveSyncApi"; -export * from "./sourcesApi"; -import { SourcesApi } from "./sourcesApi"; -export * from "./spacesApi"; -import { SpacesApi } from "./spacesApi"; -export * from "./testingApi"; -import { TestingApi } from "./testingApi"; -export * from "./trackingPlansApi"; -import { TrackingPlansApi } from "./trackingPlansApi"; -export * from "./transformationsApi"; -import { TransformationsApi } from "./transformationsApi"; -export * from "./warehousesApi"; -import { WarehousesApi } from "./warehousesApi"; -export * from "./workspacesApi"; -import { WorkspacesApi } from "./workspacesApi"; -import * as http from "http"; +export * from './aPICallsApi'; +import { APICallsApi } from './aPICallsApi'; +export * from './audiencesApi'; +import { AudiencesApi } from './audiencesApi'; +export * from './auditTrailApi'; +import { AuditTrailApi } from './auditTrailApi'; +export * from './catalogApi'; +import { CatalogApi } from './catalogApi'; +export * from './computedTraitsApi'; +import { ComputedTraitsApi } from './computedTraitsApi'; +export * from './deletionAndSuppressionApi'; +import { DeletionAndSuppressionApi } from './deletionAndSuppressionApi'; +export * from './deliveryOverviewApi'; +import { DeliveryOverviewApi } from './deliveryOverviewApi'; +export * from './destinationFiltersApi'; +import { DestinationFiltersApi } from './destinationFiltersApi'; +export * from './destinationsApi'; +import { DestinationsApi } from './destinationsApi'; +export * from './edgeFunctionsApi'; +import { EdgeFunctionsApi } from './edgeFunctionsApi'; +export * from './eventsApi'; +import { EventsApi } from './eventsApi'; +export * from './functionsApi'; +import { FunctionsApi } from './functionsApi'; +export * from './iAMGroupsApi'; +import { IAMGroupsApi } from './iAMGroupsApi'; +export * from './iAMRolesApi'; +import { IAMRolesApi } from './iAMRolesApi'; +export * from './iAMUsersApi'; +import { IAMUsersApi } from './iAMUsersApi'; +export * from './labelsApi'; +import { LabelsApi } from './labelsApi'; +export * from './monthlyTrackedUsersApi'; +import { MonthlyTrackedUsersApi } from './monthlyTrackedUsersApi'; +export * from './profilesSyncApi'; +import { ProfilesSyncApi } from './profilesSyncApi'; +export * from './reverseETLApi'; +import { ReverseETLApi } from './reverseETLApi'; +export * from './selectiveSyncApi'; +import { SelectiveSyncApi } from './selectiveSyncApi'; +export * from './sourcesApi'; +import { SourcesApi } from './sourcesApi'; +export * from './spacesApi'; +import { SpacesApi } from './spacesApi'; +export * from './testingApi'; +import { TestingApi } from './testingApi'; +export * from './trackingPlansApi'; +import { TrackingPlansApi } from './trackingPlansApi'; +export * from './transformationsApi'; +import { TransformationsApi } from './transformationsApi'; +export * from './warehousesApi'; +import { WarehousesApi } from './warehousesApi'; +export * from './workspacesApi'; +import { WorkspacesApi } from './workspacesApi'; +import * as http from 'http'; export class HttpError extends Error { - constructor( - public response: http.IncomingMessage, - public body: any, - public statusCode?: number - ) { - super("HTTP request failed"); - this.name = "HttpError"; - } + constructor( + public response: http.IncomingMessage, + public body: any, + public statusCode?: number + ) { + super('HTTP request failed'); + this.name = 'HttpError'; + } } -export { RequestFile } from "../model/models"; +export { RequestFile } from '../model/models'; export const APIS = [ - APICallsApi, - AudiencesApi, - AuditTrailApi, - CatalogApi, - ComputedTraitsApi, - DeletionAndSuppressionApi, - DeliveryOverviewApi, - DestinationFiltersApi, - DestinationsApi, - EdgeFunctionsApi, - EventsApi, - FunctionsApi, - IAMGroupsApi, - IAMRolesApi, - IAMUsersApi, - LabelsApi, - MonthlyTrackedUsersApi, - ProfilesSyncApi, - ReverseETLApi, - SelectiveSyncApi, - SourcesApi, - SpacesApi, - TestingApi, - TrackingPlansApi, - TransformationsApi, - WarehousesApi, - WorkspacesApi, + APICallsApi, + AudiencesApi, + AuditTrailApi, + CatalogApi, + ComputedTraitsApi, + DeletionAndSuppressionApi, + DeliveryOverviewApi, + DestinationFiltersApi, + DestinationsApi, + EdgeFunctionsApi, + EventsApi, + FunctionsApi, + IAMGroupsApi, + IAMRolesApi, + IAMUsersApi, + LabelsApi, + MonthlyTrackedUsersApi, + ProfilesSyncApi, + ReverseETLApi, + SelectiveSyncApi, + SourcesApi, + SpacesApi, + TestingApi, + TrackingPlansApi, + TransformationsApi, + WarehousesApi, + WorkspacesApi, ]; export interface Apis { - apiCalls: APICallsApi; - auditTrail: AuditTrailApi; - catalog: CatalogApi; - deletionAndSuppresion: DeletionAndSuppressionApi; - destinationFilters: DestinationFiltersApi; - destinations: DestinationsApi; - edgeFunctions: EdgeFunctionsApi; - events: EventsApi; - functions: FunctionsApi; - iamGroups: IAMGroupsApi; - iamRoles: IAMRolesApi; - iamUsers: IAMUsersApi; - labels: LabelsApi; - monthlyTrackedUsers: MonthlyTrackedUsersApi; - profilesSync: ProfilesSyncApi; - selectiveSync: SelectiveSyncApi; - sources: SourcesApi; - spaces: SpacesApi; - testing: TestingApi; - trackingPlans: TrackingPlansApi; - transformations: TransformationsApi; - warehouses: WarehousesApi; - workspaces: WorkspacesApi; + apiCalls: APICallsApi; + auditTrail: AuditTrailApi; + catalog: CatalogApi; + deletionAndSuppresion: DeletionAndSuppressionApi; + destinationFilters: DestinationFiltersApi; + destinations: DestinationsApi; + edgeFunctions: EdgeFunctionsApi; + events: EventsApi; + functions: FunctionsApi; + iamGroups: IAMGroupsApi; + iamRoles: IAMRolesApi; + iamUsers: IAMUsersApi; + labels: LabelsApi; + monthlyTrackedUsers: MonthlyTrackedUsersApi; + profilesSync: ProfilesSyncApi; + selectiveSync: SelectiveSyncApi; + sources: SourcesApi; + spaces: SpacesApi; + testing: TestingApi; + trackingPlans: TrackingPlansApi; + transformations: TransformationsApi; + warehouses: WarehousesApi; + workspaces: WorkspacesApi; } /** @@ -130,43 +130,43 @@ export interface Apis { * @returns The consolidated client */ export function configureApis( - token: string, - headers: Record = {} + token: string, + headers: Record = {} ): Apis { - const apis = { - apiCalls: new APICallsApi(), - auditTrail: new AuditTrailApi(), - catalog: new CatalogApi(), - deletionAndSuppresion: new DeletionAndSuppressionApi(), - destinationFilters: new DestinationFiltersApi(), - destinations: new DestinationsApi(), - edgeFunctions: new EdgeFunctionsApi(), - events: new EventsApi(), - functions: new FunctionsApi(), - iamGroups: new IAMGroupsApi(), - iamRoles: new IAMRolesApi(), - iamUsers: new IAMUsersApi(), - labels: new LabelsApi(), - monthlyTrackedUsers: new MonthlyTrackedUsersApi(), - profilesSync: new ProfilesSyncApi(), - selectiveSync: new SelectiveSyncApi(), - sources: new SourcesApi(), - spaces: new SpacesApi(), - testing: new TestingApi(), - trackingPlans: new TrackingPlansApi(), - transformations: new TransformationsApi(), - warehouses: new WarehousesApi(), - workspaces: new WorkspacesApi(), - }; + const apis = { + apiCalls: new APICallsApi(), + auditTrail: new AuditTrailApi(), + catalog: new CatalogApi(), + deletionAndSuppresion: new DeletionAndSuppressionApi(), + destinationFilters: new DestinationFiltersApi(), + destinations: new DestinationsApi(), + edgeFunctions: new EdgeFunctionsApi(), + events: new EventsApi(), + functions: new FunctionsApi(), + iamGroups: new IAMGroupsApi(), + iamRoles: new IAMRolesApi(), + iamUsers: new IAMUsersApi(), + labels: new LabelsApi(), + monthlyTrackedUsers: new MonthlyTrackedUsersApi(), + profilesSync: new ProfilesSyncApi(), + selectiveSync: new SelectiveSyncApi(), + sources: new SourcesApi(), + spaces: new SpacesApi(), + testing: new TestingApi(), + trackingPlans: new TrackingPlansApi(), + transformations: new TransformationsApi(), + warehouses: new WarehousesApi(), + workspaces: new WorkspacesApi(), + }; - for (const k of Object.keys(apis)) { - const key = k as keyof typeof apis; - headers["User-Agent"] = "Public API SDK 52.0.0 (TypeScript)"; - apis[key].accessToken = token; - apis[key].defaultHeaders = headers; - } + for (const k of Object.keys(apis)) { + const key = k as keyof typeof apis; + headers['User-Agent'] = 'Public API SDK 52.0.0 (TypeScript)'; + apis[key].accessToken = token; + apis[key].defaultHeaders = headers; + } - return apis; + return apis; } /** @@ -176,45 +176,45 @@ export function configureApis( * @returns The consolidated client */ export function configureEuApis( - token: string, - headers: Record = {} + token: string, + headers: Record = {} ): Apis { - const basePath = "https://eu1.api.segmentapis.com"; + const basePath = 'https://eu1.api.segmentapis.com'; - const apis = { - apiCalls: new APICallsApi(basePath), - auditTrail: new AuditTrailApi(basePath), - catalog: new CatalogApi(basePath), - deletionAndSuppresion: new DeletionAndSuppressionApi(basePath), - destinationFilters: new DestinationFiltersApi(basePath), - destinations: new DestinationsApi(basePath), - edgeFunctions: new EdgeFunctionsApi(basePath), - events: new EventsApi(basePath), - functions: new FunctionsApi(basePath), - iamGroups: new IAMGroupsApi(basePath), - iamRoles: new IAMRolesApi(basePath), - iamUsers: new IAMUsersApi(basePath), - labels: new LabelsApi(basePath), - monthlyTrackedUsers: new MonthlyTrackedUsersApi(basePath), - profilesSync: new ProfilesSyncApi(basePath), - selectiveSync: new SelectiveSyncApi(basePath), - sources: new SourcesApi(basePath), - spaces: new SpacesApi(basePath), - testing: new TestingApi(basePath), - trackingPlans: new TrackingPlansApi(basePath), - transformations: new TransformationsApi(basePath), - warehouses: new WarehousesApi(basePath), - workspaces: new WorkspacesApi(basePath), - }; + const apis = { + apiCalls: new APICallsApi(basePath), + auditTrail: new AuditTrailApi(basePath), + catalog: new CatalogApi(basePath), + deletionAndSuppresion: new DeletionAndSuppressionApi(basePath), + destinationFilters: new DestinationFiltersApi(basePath), + destinations: new DestinationsApi(basePath), + edgeFunctions: new EdgeFunctionsApi(basePath), + events: new EventsApi(basePath), + functions: new FunctionsApi(basePath), + iamGroups: new IAMGroupsApi(basePath), + iamRoles: new IAMRolesApi(basePath), + iamUsers: new IAMUsersApi(basePath), + labels: new LabelsApi(basePath), + monthlyTrackedUsers: new MonthlyTrackedUsersApi(basePath), + profilesSync: new ProfilesSyncApi(basePath), + selectiveSync: new SelectiveSyncApi(basePath), + sources: new SourcesApi(basePath), + spaces: new SpacesApi(basePath), + testing: new TestingApi(basePath), + trackingPlans: new TrackingPlansApi(basePath), + transformations: new TransformationsApi(basePath), + warehouses: new WarehousesApi(basePath), + workspaces: new WorkspacesApi(basePath), + }; - for (const k of Object.keys(apis)) { - const key = k as keyof typeof apis; - headers["User-Agent"] = "Public API SDK 52.0.0 (TypeScript)"; - apis[key].accessToken = token; - apis[key].defaultHeaders = headers; - } + for (const k of Object.keys(apis)) { + const key = k as keyof typeof apis; + headers['User-Agent'] = 'Public API SDK 52.0.0 (TypeScript)'; + apis[key].accessToken = token; + apis[key].defaultHeaders = headers; + } - return apis; + return apis; } /** @@ -226,19 +226,19 @@ export function configureEuApis( * @returns the unwrapped data */ export async function unwrap( - promise: Promise<{ - body: { data?: T }; - }>, - fallback?: string + promise: Promise<{ + body: { data?: T }; + }>, + fallback?: string ): Promise { - const response = await promise.catch((e: HttpError) => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - throw e.body.errors[0]; - }); + const response = await promise.catch((e: HttpError) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + throw e.body.errors[0]; + }); - if (response.body === undefined || response.body.data === undefined) { - throw new Error(fallback ?? "Could not load data"); - } + if (response.body === undefined || response.body.data === undefined) { + throw new Error(fallback ?? 'Could not load data'); + } - return response.body.data; + return response.body.data; }