export type ConditionDto = {conditionId?: string | undefined, name: 'Email Open Count' | 'Replied' | 'Reply Body Contains' | 'Link Click' | 'Prospect Outcome' | 'Last Step Completed' | 'Prospect Tag', operation: 'greater than' | 'less than' | 'greater than or equals' | 'less than or equals' | 'is' | 'is not' | 'is any' | 'is not any' | 'contains', value?: (number | boolean | Array | Array) | undefined}; export type CreateSubsequenceDto = {title: string, scheduleId?: number | undefined, firstStepRelativeDays?: number | undefined, conditions: Array}; export type CreateApiV1SequencesSequenceIdSubsequenceArgs = {sequenceId: string, body: CreateSubsequenceDto}; export type CreateApiV1SequencesSequenceIdSubsequenceOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a new subsequence under a parent sequence * * POST /v1/sequences/{sequenceId}/subsequence */ export const createApiV1SequencesSequenceIdSubsequence = async (args: CreateApiV1SequencesSequenceIdSubsequenceArgs, options: CreateApiV1SequencesSequenceIdSubsequenceOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/sequences/${encodeURIComponent(String(args.sequenceId))}/subsequence${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 };