export type BetConstructSSOAuthAPIViewModelsApiScopeViewModel = {id?: number | undefined, name: string, displayName?: (string | null) | undefined, description?: (string | null) | undefined, required?: boolean | undefined, emphasize?: boolean | undefined, showInDiscoveryDocument?: boolean | undefined, apiResourceId?: number | undefined}; export type CreateApiV1ApiResourcesResIdApiScopesArgs = {resId: number, body: BetConstructSSOAuthAPIViewModelsApiScopeViewModel}; export type CreateApiV1ApiResourcesResIdApiScopesOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /V1/apiResources/{resId}/apiScopes */ export const createApiV1ApiResourcesResIdApiScopes = async (args: CreateApiV1ApiResourcesResIdApiScopesArgs, options: CreateApiV1ApiResourcesResIdApiScopesOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/V1/apiResources/${encodeURIComponent(String(args.resId))}/apiScopes${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 };