export type BetConstructSSOAuthAPIViewModelsCreateViewModelsApiSecretCreationViewModel = {id?: number | undefined, description?: (string | null) | undefined, value: string, expiration?: (string | null) | undefined}; export type CreateApiV1ApiResourcesResIdApiSecretsArgs = {resId: number, body: BetConstructSSOAuthAPIViewModelsCreateViewModelsApiSecretCreationViewModel}; export type CreateApiV1ApiResourcesResIdApiSecretsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /V1/apiResources/{resId}/apiSecrets */ export const createApiV1ApiResourcesResIdApiSecrets = async (args: CreateApiV1ApiResourcesResIdApiSecretsArgs, options: CreateApiV1ApiResourcesResIdApiSecretsOptions) => { 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))}/apiSecrets${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 };