export type SetPercentUptake = {bundle_id?: string | undefined, percent_uptake_drivable?: number | undefined, percent_uptake_towable?: number | undefined, rental_id?: number | undefined}; export type CreateApiUsersUserIdBundlesArgs = {body: SetPercentUptake}; export type CreateApiUsersUserIdBundlesOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Creates a bundle rule with the specified bundle and the specified uptake percents for the user (owner) who calls this endpoint * * POST /users/{user_id}/bundles * * Also accepts auth: API-Key */ export const createApiUsersUserIdBundles = async (args: CreateApiUsersUserIdBundlesArgs, options: CreateApiUsersUserIdBundlesOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/users/${encodeURIComponent(String(args.user_id))}/bundles${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 };