export * from './accountsApi'; import { AccountsApi } from './accountsApi'; export * from './campaignsApi'; import { CampaignsApi } from './campaignsApi'; export * from './catalogsApi'; import { CatalogsApi } from './catalogsApi'; export * from './conversationsApi'; import { ConversationsApi } from './conversationsApi'; export * from './couponsApi'; import { CouponsApi } from './couponsApi'; export * from './customObjectsApi'; import { CustomObjectsApi } from './customObjectsApi'; export * from './dataPrivacyApi'; import { DataPrivacyApi } from './dataPrivacyApi'; export * from './eventsApi'; import { EventsApi } from './eventsApi'; export * from './flowsApi'; import { FlowsApi } from './flowsApi'; export * from './formsApi'; import { FormsApi } from './formsApi'; export * from './imagesApi'; import { ImagesApi } from './imagesApi'; export * from './listsApi'; import { ListsApi } from './listsApi'; export * from './metricsApi'; import { MetricsApi } from './metricsApi'; export * from './profilesApi'; import { ProfilesApi } from './profilesApi'; export * from './reportingApi'; import { ReportingApi } from './reportingApi'; export * from './reviewsApi'; import { ReviewsApi } from './reviewsApi'; export * from './segmentsApi'; import { SegmentsApi } from './segmentsApi'; export * from './tagsApi'; import { TagsApi } from './tagsApi'; export * from './templatesApi'; import { TemplatesApi } from './templatesApi'; export * from './trackingSettingsApi'; import { TrackingSettingsApi } from './trackingSettingsApi'; export * from './webFeedsApi'; import { WebFeedsApi } from './webFeedsApi'; export * from './webhooksApi'; import { WebhooksApi } from './webhooksApi'; import { AxiosRequestConfig, AxiosResponse } from "axios"; export { RequestFile } from '../model/models'; export declare class RetryWithExponentialBackoff { baseInterval: number; randFactor: number; multiplier: number; retryCodes: number[]; numRetries: number; maxInterval: number; constructor(config?: { retryCodes?: Array; numRetries?: number; maxInterval?: number; }); requestWithRetry(config: AxiosRequestConfig): Promise; exponentialBackoff(iteration: number): number; sleep(seconds: number): Promise; } export declare function queryParamPreProcessor(queryParams: any): void; export declare class GlobalApiKeySettings { static apiKey: string; static retryWithExponentialBackoff: RetryWithExponentialBackoff; constructor(apiKey: string, retryWithExponentialBackoff?: RetryWithExponentialBackoff); } export interface Session { applyToRequest(requestOptions: AxiosRequestConfig): Promise | void; requestWithRetry(config: AxiosRequestConfig, retried?: boolean): Promise; refreshAndRetry(error: unknown, retried: boolean): Promise | boolean; } export declare class ApiKeySession implements Session { apiKey: string; protected _apiKeyPrefix: string; retryWithExponentialBackoff: RetryWithExponentialBackoff; constructor(apiKey: string, retryWithExponentialBackoff?: RetryWithExponentialBackoff); applyToRequest(requestOptions: AxiosRequestConfig): void; requestWithRetry(config: AxiosRequestConfig): Promise; refreshAndRetry(error: unknown, retried: boolean): boolean; } export declare class GlobalApiKeySession implements Session { protected _apiKeyPrefix: string; applyToRequest(requestOptions: AxiosRequestConfig): void; requestWithRetry(config: AxiosRequestConfig): Promise; refreshAndRetry(error: unknown, retried: boolean): boolean; } export declare function ConfigWrapper(apiKey: string, opts?: { retryCodes?: Array; numRetries?: number; maxInterval?: number; }): ApiKeySession; export declare class OAuthSession implements Session { protected customerIdentifier: string; protected oAuthApi: OAuthApi; protected _prefix: string; retryWithExponentialBackoff: RetryWithExponentialBackoff; constructor(customerIdentifier: string, oAuthApi: OAuthApi, retryWithExponentialBackoff?: RetryWithExponentialBackoff); applyToRequest(requestOptions: AxiosRequestConfig): Promise; requestWithRetry(config: AxiosRequestConfig): Promise; refreshAndRetry(error: unknown, retried: boolean): Promise; } export declare class OAuthBasicSession implements Session { accessToken: string; protected _prefix: string; retryWithExponentialBackoff: RetryWithExponentialBackoff; constructor(accessToken: string, retryWithExponentialBackoff?: RetryWithExponentialBackoff); applyToRequest(requestOptions: AxiosRequestConfig): void; refreshAndRetry(error: unknown, retried: boolean): boolean; requestWithRetry(config: AxiosRequestConfig): Promise; } export declare enum KlaviyoErrorName { saveError = "SAVE_TOKEN_ERROR", createError = "CREATE_TOKEN_ERROR", retrieveError = "RETRIEVE_TOKEN_ERROR", refreshError = "REFRESH_TOKEN_ERROR" } export declare class KlaviyoTokenError extends Error { readonly name: KlaviyoErrorName; readonly message: string; readonly cause?: any; constructor(name: KlaviyoErrorName, message: string, cause?: any); } export declare function isKlaviyoTokenError(error: any): error is KlaviyoTokenError; export interface RetrievedTokens { accessToken: string; refreshToken: string; expiresAt?: Date; } export interface CreatedTokens { accessToken: string; refreshToken: string; expiresAt: Date; } export interface TokenStorage { retrieve(customerIdentifier: string): Promise | RetrievedTokens; save(customerIdentifier: string, tokens: CreatedTokens): Promise | void; } export declare class OAuthApi { readonly clientId: string; readonly clientSecret: string; readonly tokenStorage: TokenStorage; protected authorizeUrl: string; protected tokenUrl: string; constructor(clientId: string, clientSecret: string, tokenStorage: TokenStorage); generateAuthorizeUrl(state: string, scopes: string, codeChallenge: string, redirectUrl: string): string; createTokens(customerIdentifier: string, codeVerifier: string, authorizationCode: string, redirectUrl: string): Promise; refreshTokens(customerIdentifier: string, refreshToken?: string): Promise; private createHeaders; private saveToken; private populateErrorMessage; } export interface OAuthCallbackQueryParams { code?: string; state?: string; error?: string; error_description?: string; } export declare namespace Pkce { interface Codes { codeVerifier: string; codeChallenge: string; } function generateCodes(): { codeVerifier: any; codeChallenge: any; }; interface CodeStorage { retrieve(customerIdentifier: string): Promise; save(customerIdentifier: string, verifierCode: string): Promise; remove(customerIdentifier: string): Promise; } } export declare const Accounts: AccountsApi; export declare const Campaigns: CampaignsApi; export declare const Catalogs: CatalogsApi; export declare const Conversations: ConversationsApi; export declare const Coupons: CouponsApi; export declare const CustomObjects: CustomObjectsApi; export declare const DataPrivacy: DataPrivacyApi; export declare const Events: EventsApi; export declare const Flows: FlowsApi; export declare const Forms: FormsApi; export declare const Images: ImagesApi; export declare const Lists: ListsApi; export declare const Metrics: MetricsApi; export declare const Profiles: ProfilesApi; export declare const Reporting: ReportingApi; export declare const Reviews: ReviewsApi; export declare const Segments: SegmentsApi; export declare const Tags: TagsApi; export declare const Templates: TemplatesApi; export declare const TrackingSettings: TrackingSettingsApi; export declare const WebFeeds: WebFeedsApi; export declare const Webhooks: WebhooksApi; export declare const Auth: { ApiKeySession: typeof ApiKeySession; GlobalApiKeySession: typeof GlobalApiKeySession; GlobalApiKeySettings: typeof GlobalApiKeySettings; RetryWithExponentialBackoff: typeof RetryWithExponentialBackoff; OAuthApi: typeof OAuthApi; OAuthBasicSession: typeof OAuthBasicSession; OAuthSession: typeof OAuthSession; Pkce: typeof Pkce; }; export declare const Klaviyo: { Auth: { ApiKeySession: typeof ApiKeySession; GlobalApiKeySession: typeof GlobalApiKeySession; GlobalApiKeySettings: typeof GlobalApiKeySettings; RetryWithExponentialBackoff: typeof RetryWithExponentialBackoff; OAuthApi: typeof OAuthApi; OAuthBasicSession: typeof OAuthBasicSession; OAuthSession: typeof OAuthSession; Pkce: typeof Pkce; }; AccountsApi: typeof AccountsApi; Accounts: AccountsApi; CampaignsApi: typeof CampaignsApi; Campaigns: CampaignsApi; CatalogsApi: typeof CatalogsApi; Catalogs: CatalogsApi; ConversationsApi: typeof ConversationsApi; Conversations: ConversationsApi; CouponsApi: typeof CouponsApi; Coupons: CouponsApi; CustomObjectsApi: typeof CustomObjectsApi; CustomObjects: CustomObjectsApi; DataPrivacyApi: typeof DataPrivacyApi; DataPrivacy: DataPrivacyApi; EventsApi: typeof EventsApi; Events: EventsApi; FlowsApi: typeof FlowsApi; Flows: FlowsApi; FormsApi: typeof FormsApi; Forms: FormsApi; ImagesApi: typeof ImagesApi; Images: ImagesApi; ListsApi: typeof ListsApi; Lists: ListsApi; MetricsApi: typeof MetricsApi; Metrics: MetricsApi; ProfilesApi: typeof ProfilesApi; Profiles: ProfilesApi; ReportingApi: typeof ReportingApi; Reporting: ReportingApi; ReviewsApi: typeof ReviewsApi; Reviews: ReviewsApi; SegmentsApi: typeof SegmentsApi; Segments: SegmentsApi; TagsApi: typeof TagsApi; Tags: TagsApi; TemplatesApi: typeof TemplatesApi; Templates: TemplatesApi; TrackingSettingsApi: typeof TrackingSettingsApi; TrackingSettings: TrackingSettingsApi; WebFeedsApi: typeof WebFeedsApi; WebFeeds: WebFeedsApi; WebhooksApi: typeof WebhooksApi; Webhooks: WebhooksApi; };