export type SegmentFolderRequest = {name: string}; export type UpdateApiChannelV1CompanyGroupsCompanyGroupIdArgs = {companyGroupId: string, body: SegmentFolderRequest}; export type UpdateApiChannelV1CompanyGroupsCompanyGroupIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update segment folders * * PUT /channel/v1/companyGroups/{companyGroupId} */ export const updateApiChannelV1CompanyGroupsCompanyGroupId = async (args: UpdateApiChannelV1CompanyGroupsCompanyGroupIdArgs, options?: UpdateApiChannelV1CompanyGroupsCompanyGroupIdOptions) => { const {baseUrl = "https://marketplace.appdirect.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/channel/v1/companyGroups/${encodeURIComponent(String(args.companyGroupId))}${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 };