export type CreateApiMliConfigurationLevelsLevelIdUsersUserIdLocationsLocationIdArgs = {levelId: number, userId: number, locationId: number}; export type CreateApiMliConfigurationLevelsLevelIdUsersUserIdLocationsLocationIdOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add a location to a user’s MLI level * * POST /MliConfiguration/Levels/{levelId}/Users/{userId}/Locations/{locationId} */ export const createApiMliConfigurationLevelsLevelIdUsersUserIdLocationsLocationId = async (args: CreateApiMliConfigurationLevelsLevelIdUsersUserIdLocationsLocationIdArgs, options?: CreateApiMliConfigurationLevelsLevelIdUsersUserIdLocationsLocationIdOptions) => { const {baseUrl = "https://sb2api.servicechannel.com/v3", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/MliConfiguration/Levels/${encodeURIComponent(String(args.levelId))}/Users/${encodeURIComponent(String(args.userId))}/Locations/${encodeURIComponent(String(args.locationId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };