export type Status = {created_at?: string | undefined, created_by?: string | undefined, last_modified: string, last_modified_by?: string | undefined, locked_after?: string | undefined}; export type SecurityListPatchPutGet = {name: string, namespace: string, realtime?: boolean | undefined, securities: Array<{identifier_type: 'RIC' | 'secapi_name', identifier_value: string, security_type: string}>, id: string, status: Status}; export type UpdateApiSecurityListUuidArgs = {body: SecurityListPatchPutGet}; export type UpdateApiSecurityListUuidOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Replace a MerQube security_list * * PUT /security_list/{uuid} */ export const updateApiSecurityListUuid = async (args: UpdateApiSecurityListUuidArgs, options?: UpdateApiSecurityListUuidOptions) => { const {baseUrl = "https://api.merqube.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/security_list/${encodeURIComponent(String(args.uuid))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };