export type DimensionType = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 100 | 198 | 199 | 200; export type ItemCondition = {propertyKey?: (string | null) | undefined, propertyValue?: (string | null) | undefined}; export type UpdateDimensionRequest = {accountId?: (number | null) | undefined, name?: (string | null) | undefined, shortName?: (string | null) | undefined, type?: DimensionType | undefined, rank?: number | undefined, properties?: ({[key: string]: string} | null) | undefined, itemCondition?: ItemCondition | undefined}; export type UpdateApiV1DimensionsIdArgs = {id: number, Account: unknown, body: UpdateDimensionRequest}; export type UpdateApiV1DimensionsIdOptions = {baseUrl: string, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update dimension * * PUT /v1/Dimensions/{id} */ export const updateApiV1DimensionsId = async (args: UpdateApiV1DimensionsIdArgs, options: UpdateApiV1DimensionsIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json-patch+json; x-api-version=1.0") if (args.Account != null) query.append("Account", String(args.Account)) if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/Dimensions/${encodeURIComponent(String(args.id))}${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 };