export type ProjectId = number; export type RawGCSPipeline = {project_id?: ProjectId | undefined, type: string, trial?: boolean | undefined, data_source?: 'events' | undefined, from_date: string, to_date?: string | undefined, frequency?: ('daily' | 'hourly') | undefined, events?: string | undefined, where?: string | undefined, data_format?: 'json' | undefined, gcs_bucket: string, gcs_prefix?: string | undefined, gcs_region: 'northamerica-northeast1' | 'us-central1' | 'us-east1' | 'us-east4' | 'us-west1' | 'us-west2' | 'southamerica-east1' | 'europe-north1' | 'europe-west1' | 'europe-west2' | 'europe-west3' | 'europe-west4' | 'europe-west6' | 'asia-east1' | 'asia-east2' | 'asia-northeast1' | 'asia-northeast2' | 'asia-northeast3' | 'asia-south1' | 'asia-southeast1' | 'australia-southeast1'}; export type RawAmazonS3Pipeline = {project_id?: ProjectId | undefined, type: string, trial?: boolean | undefined, data_source?: 'events' | undefined, from_date: string, to_date?: string | undefined, frequency?: ('daily' | 'hourly') | undefined, events?: string | undefined, where?: string | undefined, data_format?: 'json' | undefined, s3_bucket: string, s3_region: 'us-east-1' | 'us-east-2' | 'us-west-1' | 'us-west-2' | 'ap-northeast-1' | 'ap-northeast-2' | 'ap-northeast-3' | 'ap-southeast-1' | 'ap-southeast-2' | 'ap-south-1' | 'ca-central-1' | 'cn-north-1' | 'cn-northwest-1' | 'eu-central-1' | 'eu-north-1' | 'eu-west-1' | 'eu-west-2' | 'eu-west-3' | 'sa-east-1' | 'me-south-1', s3_role: string, s3_prefix?: string | undefined, s3_encryption?: ('none' | 'aes' | 'kms') | undefined, s3_kms_key_id?: string | undefined}; export type RawAzurePipeline = {project_id?: ProjectId | undefined, type: string, trial?: boolean | undefined, data_source?: 'events' | undefined, from_date: string, to_date?: string | undefined, frequency?: ('daily' | 'hourly') | undefined, events?: string | undefined, where?: string | undefined, data_format?: 'json' | undefined, storage_account: string, container_name: string, prefix?: string | undefined, client_id: string, client_secret: string, tenant_id: string}; export type SchematizedBigQueryPipeline = {project_id?: ProjectId | undefined, type: string, trial?: boolean | undefined, schema_type: 'monoschema' | 'multischema', data_source?: ('events' | 'people') | undefined, sync: true, from_date: string, to_date?: string | undefined, frequency?: ('daily' | 'hourly') | undefined, events?: string | undefined, where?: string | undefined, bq_region: 'US' | 'US_CENTRAL_1' | 'US_EAST_1' | 'US_WEST_1' | 'US_WEST_2' | 'US_EAST_4' | 'NORTH_AMERICA_NORTHEAST_1' | 'SOUTH_AMERICA_EAST_1' | 'EU' | 'EUROPE_NORTH_1' | 'EUROPE_WEST_2' | 'EUROPE_WEST_3' | 'EUROPE_WEST_4' | 'EUROPE_WEST_6' | 'ASIA_SOUTH_1' | 'ASIA_EAST_1' | 'ASIA_EAST_2' | 'ASIA_NORTHEAST_1' | 'ASIA_NORTHEAST_2' | 'ASIA_NORTHEAST_3' | 'ASIA_SOUTHEAST_1' | 'ASIA_SOUTHEAST_2' | 'AUSTRALIA_SOUTHEAST_1', bq_prefix?: string | undefined, gcp_project: string, bq_dataset_name: string}; export type SchematizedSnowflakePipeline = {project_id?: ProjectId | undefined, type: string, trial?: boolean | undefined, schema_type: 'monoschema' | 'multischema', data_source?: ('events' | 'people') | undefined, sync: true, from_date: string, to_date?: string | undefined, frequency?: ('daily' | 'hourly') | undefined, events?: string | undefined, where?: string | undefined, snowflake_prefix?: string | undefined, snowflake_account_name: string, snowflake_warehouse: string, snowflake_storage_integration: string, snowflake_user: string, snowflake_password: string, snowflake_role: string, snowflake_database: string, snowflake_schema: string}; export type SchematizedAWSPipeline = {project_id?: ProjectId | undefined, type: string, trial?: boolean | undefined, schema_type: 'monoschema' | 'multischema', data_source?: ('events' | 'people') | undefined, sync: true, from_date: string, to_date?: string | undefined, frequency?: ('daily' | 'hourly') | undefined, events?: string | undefined, where?: string | undefined, data_format?: ('json' | 'parquet') | undefined, s3_bucket: string, s3_region: 'us-east-1' | 'us-east-2' | 'us-west-1' | 'us-west-2' | 'ap-northeast-1' | 'ap-northeast-2' | 'ap-northeast-3' | 'ap-southeast-1' | 'ap-southeast-2' | 'ap-south-1' | 'ca-central-1' | 'cn-north-1' | 'cn-northwest-1' | 'eu-central-1' | 'eu-north-1' | 'eu-west-1' | 'eu-west-2' | 'eu-west-3' | 'sa-east-1', s3_role: string, s3_prefix?: string | undefined, s3_encryption?: ('none' | 'aes' | 'kms') | undefined, s3_kms_key_id?: string | undefined, use_glue?: boolean | undefined, glue_database?: string | undefined, glue_role?: string | undefined, glue_table_prefix?: string | undefined}; export type SchematizedAzurePipeline = {project_id?: ProjectId | undefined, type: string, trial?: boolean | undefined, schema_type: 'monoschema' | 'multischema', data_source?: ('events' | 'people') | undefined, sync: true, from_date: string, to_date?: string | undefined, frequency?: ('daily' | 'hourly') | undefined, events?: string | undefined, where?: string | undefined, data_format?: ('json' | 'parquet') | undefined, storage_account: string, container_name: string, prefix?: string | undefined, client_id: string, client_secret: string, tenant_id: string}; export type SchematizedGCSPipeline = {project_id?: ProjectId | undefined, type: string, trial?: boolean | undefined, schema_type: 'monoschema' | 'multischema', data_source?: ('events' | 'people') | undefined, sync: true, from_date: string, to_date?: string | undefined, frequency?: ('daily' | 'hourly') | undefined, events?: string | undefined, where?: string | undefined, data_format?: ('json' | 'parquet') | undefined, gcs_bucket: string, gcs_prefix?: string | undefined, gcs_region: 'northamerica-northeast1' | 'us-central1' | 'us-east1' | 'us-east4' | 'us-west1' | 'us-west2' | 'southamerica-east1' | 'europe-north1' | 'europe-west1' | 'europe-west2' | 'europe-west3' | 'europe-west4' | 'europe-west6' | 'asia-east1' | 'asia-east2' | 'asia-northeast1' | 'asia-northeast2' | 'asia-northeast3' | 'asia-south1' | 'asia-southeast1' | 'australia-southeast1'}; export type CreateApiNessiePipelineCreateArgs = {body: RawGCSPipeline | RawAmazonS3Pipeline | RawAzurePipeline | SchematizedBigQueryPipeline | SchematizedSnowflakePipeline | SchematizedAWSPipeline | SchematizedAzurePipeline | SchematizedGCSPipeline}; export type CreateApiNessiePipelineCreateOptions = {baseUrl?: string | undefined, ServiceAccount?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Create Pipeline * * POST /nessie/pipeline/create * * Also accepts auth: ProjectSecret */ export const createApiNessiePipelineCreate = async (args: CreateApiNessiePipelineCreateArgs, options?: CreateApiNessiePipelineCreateOptions) => { const {baseUrl = "https://mixpanel.com/api/query", fetch: fetchFn = fetch, ServiceAccount} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/x-www-form-urlencoded") headers.set('accept', "application/json") if (ServiceAccount !== undefined) headers.set('authorization', `Basic ${btoa(`${ServiceAccount.username}:${ServiceAccount.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/nessie/pipeline/create${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: new URLSearchParams(Object.entries(args.body).flatMap(([key, value]) => (value == null ? [] : [[key, String(value)]])))}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return (await res.json()) as unknown };