export type TriggerCreateBatchModel = {TriggerType?: (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 52 | 53 | 54 | 55 | 64) | undefined, TriggerTypeData?: string | undefined, TriggerTypeData2?: string | undefined, ValidFrom?: string | undefined, ValidTo?: string | undefined, DestinationType?: (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9) | undefined, DestinationData: string, DeliveryType?: (0 | 1 | 2 | 3) | undefined, IMEIConfigIds?: Array | undefined, TriggerTypeData3?: string | undefined}; export type CreateApiV1ResourceownerTriggersBatchArgs = {body: TriggerCreateBatchModel}; export type CreateApiV1ResourceownerTriggersBatchOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Creates a new triggers * * POST /v1/resourceowner/triggers/batch */ export const createApiV1ResourceownerTriggersBatch = async (args: CreateApiV1ResourceownerTriggersBatchArgs, options: CreateApiV1ResourceownerTriggersBatchOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/resourceowner/triggers/batch${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 };