export type AccountID = number; export type ProjectID = string; export type IdempotencyKey = string; export type TargetGroupID = string; export type TargetGroupIds = Array; export type CreateBulkLaunchTargetGroupJobRequest = {target_group_ids: TargetGroupIds}; export type CreateApiDemandAccountsAccountIdProjectsProjectIdBatchJobsLaunchFieldingRunsByTargetGroupIdArgs = {account_id: AccountID, project_id: ProjectID, 'idempotency-key': IdempotencyKey, body: CreateBulkLaunchTargetGroupJobRequest}; export type CreateApiDemandAccountsAccountIdProjectsProjectIdBatchJobsLaunchFieldingRunsByTargetGroupIdOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Creates a job to launch multiple target groups * * POST /demand/accounts/{account_id}/projects/{project_id}/batch-jobs/launch-fielding-runs-by-target-group-id */ export const createApiDemandAccountsAccountIdProjectsProjectIdBatchJobsLaunchFieldingRunsByTargetGroupId = async (args: CreateApiDemandAccountsAccountIdProjectsProjectIdBatchJobsLaunchFieldingRunsByTargetGroupIdArgs, options?: CreateApiDemandAccountsAccountIdProjectsProjectIdBatchJobsLaunchFieldingRunsByTargetGroupIdOptions) => { const {baseUrl = "https://api.cint.com/v1", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['idempotency-key'] != null) headers.set("idempotency-key", String(args['idempotency-key'])) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/demand/accounts/${encodeURIComponent(String(args.account_id))}/projects/${encodeURIComponent(String(args.project_id))}/batch-jobs/launch-fielding-runs-by-target-group-id${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };