export type CategoryId = string; export type AttributeId = string; export type AllowedValue = {value: string, display?: string | undefined, sort?: number | undefined}; export type Attribute = {attributeId: AttributeId, displayName: string, isMultipleAllowed?: boolean | undefined, type?: ('smalltext' | 'htmltext' | 'text' | 'integer' | 'decimal' | 'enum' | 'date' | 'boolean' | 'image' | 'document' | 'url' | 'label') | undefined, values?: Array | undefined, attributeValueValidation?: string | undefined, conditionalMandatoryBy?: (Array<{attributeId?: AttributeId | undefined, attributeValues?: Array | undefined}> | null) | undefined, conditionalOptionalBy?: (Array<{attributeId?: AttributeId | undefined, attributeValues?: Array | undefined}> | null) | undefined, required?: boolean | undefined, recommended?: boolean | undefined, section?: string | undefined, sectionPosition?: number | undefined, isRepeatableSubSection?: (boolean | null) | undefined, subSection?: string | undefined, subSectionPosition?: number | undefined, description?: string | undefined, isVariationDimension?: boolean | undefined, enumValues?: Array | undefined}; export type AttributeList = {attributeList?: Array | undefined}; export type UpdateApiV1ChannelAttributeCategoryCategoryIdArgs = {'Content-Encoding'?: 'gzip' | undefined, categoryId: CategoryId, body: AttributeList}; export type UpdateApiV1ChannelAttributeCategoryCategoryIdOptions = {baseUrl?: string | undefined, ChannelAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Category Attributes * * PUT /v1/channel/attribute/category/{categoryId} */ export const updateApiV1ChannelAttributeCategoryCategoryId = async (args: UpdateApiV1ChannelAttributeCategoryCategoryIdArgs, options?: UpdateApiV1ChannelAttributeCategoryCategoryIdOptions) => { const {baseUrl = "https://scx-sbx.api.jtl-software.com", fetch: fetchFn = fetch, ChannelAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Content-Encoding'] != null) headers.set("Content-Encoding", String(args['Content-Encoding'])) if (ChannelAuth !== undefined) headers.set('authorization', `Bearer ${ChannelAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/channel/attribute/category/${encodeURIComponent(String(args.categoryId))}${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 };