export type PublishFeatureParameters = {region: 'US' | 'EU', salesforce_id: string}; export type PublishFeature = {feature: 'WM_PUBLISH_PANEL', parameters: PublishFeatureParameters}; export type EnableSystemDomainFeatureSchema = {config: PublishFeature}; export type CreateApiV1SystemDomainsSystemDomainIdFeaturesArgs = {'App-ID': string, 'Auth-Token': string, system_domain_id: string, body: EnableSystemDomainFeatureSchema}; export type CreateApiV1SystemDomainsSystemDomainIdFeaturesOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Enable specified feature on a system domain * * POST /v1/system_domains/{system_domain_id}/features/ */ export const createApiV1SystemDomainsSystemDomainIdFeatures = async (args: CreateApiV1SystemDomainsSystemDomainIdFeaturesArgs, options: CreateApiV1SystemDomainsSystemDomainIdFeaturesOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['App-ID'] != null) headers.set("App-ID", String(args['App-ID'])) if (args['Auth-Token'] != null) headers.set("Auth-Token", String(args['Auth-Token'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/system_domains/${encodeURIComponent(String(args.system_domain_id))}/features/${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 };