export type StreemApiCompanyRoomOutcomeConfigEntry = {code?: string | undefined, label?: string | undefined, call_source_codes?: Array | undefined}; export type StreemApiCompanyRoomOutcomeConfigOption = {entry?: StreemApiCompanyRoomOutcomeConfigEntry | undefined, properties?: {[key: string]: string} | undefined}; export type StreemApiCompanyRoomOutcomeConfigSection = {options?: Array | undefined, call_source_codes?: Array | undefined}; export type StreemApiCreateCompanyRoomOutcomeConfigRequest = {company_sid?: string | undefined, diagnosis?: StreemApiCompanyRoomOutcomeConfigSection | undefined, disposition?: StreemApiCompanyRoomOutcomeConfigSection | undefined, custom_fields?: {[key: string]: StreemApiCompanyRoomOutcomeConfigSection} | undefined}; export type CreateApiV1CompaniesCompanyCodeOrSidRoomOutcomeConfigFileNameArgs = {company_code_or_sid: string, fileName: string, body: StreemApiCreateCompanyRoomOutcomeConfigRequest}; export type CreateApiV1CompaniesCompanyCodeOrSidRoomOutcomeConfigFileNameOptions = {baseUrl?: string | undefined, apiKey?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Create a configuration for Room Outcomes * * POST /v1/companies/{company_code_or_sid}/room-outcome-config/{fileName} * * Also accepts auth: bearer-auth */ export const createApiV1CompaniesCompanyCodeOrSidRoomOutcomeConfigFileName = async (args: CreateApiV1CompaniesCompanyCodeOrSidRoomOutcomeConfigFileNameArgs, options?: CreateApiV1CompaniesCompanyCodeOrSidRoomOutcomeConfigFileNameOptions) => { const {baseUrl = "https://api.prod-us.streem.cloud", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set('authorization', `Basic ${btoa(`${apiKey.username}:${apiKey.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/companies/${encodeURIComponent(String(args.company_code_or_sid))}/room-outcome-config/${encodeURIComponent(String(args.fileName))}${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 };