export type MacProfilesX = {profileIds?: Array | undefined}; export type UpdateApiV2PartitionPartitionIdAccountAccountIdDeviceMacAddressProfilesArgs = {accountId: string, macAddress: string, partitionId: string, body: MacProfilesX}; export type UpdateApiV2PartitionPartitionIdAccountAccountIdDeviceMacAddressProfilesOptions = {baseUrl?: string | undefined, XAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Device (by mac) Profiles * * PUT /v2/partition/{partitionId}/account/{accountId}/device/{macAddress}/profiles */ export const updateApiV2PartitionPartitionIdAccountAccountIdDeviceMacAddressProfiles = async (args: UpdateApiV2PartitionPartitionIdAccountAccountIdDeviceMacAddressProfilesArgs, options?: UpdateApiV2PartitionPartitionIdAccountAccountIdDeviceMacAddressProfilesOptions) => { const {baseUrl = "https://api.alianza.com", fetch: fetchFn = fetch, XAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (XAuthToken !== undefined) headers.set("X-AUTH-TOKEN", XAuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/v2/partition/${encodeURIComponent(String(args.partitionId))}/account/${encodeURIComponent(String(args.accountId))}/device/${encodeURIComponent(String(args.macAddress))}/profiles${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };