export type UpdateApiAttributeLabelUserTokenEndpointTokenAttrSetTokenArgs = {'Idempotency-Key'?: string | undefined, body: {label: string}}; export type UpdateApiAttributeLabelUserTokenEndpointTokenAttrSetTokenOptions = {baseUrl?: string | undefined, AUTHORIZERNAME?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set or Update Label for Attribute Set * * PUT /attribute/label/{user_token}/{endpoint_token}/{attr_set_token} * * Also accepts auth: api_key */ export const updateApiAttributeLabelUserTokenEndpointTokenAttrSetToken = async (args: UpdateApiAttributeLabelUserTokenEndpointTokenAttrSetTokenArgs, options?: UpdateApiAttributeLabelUserTokenEndpointTokenAttrSetTokenOptions) => { const {baseUrl = "https://api.masspay.io/v1.0.0", fetch: fetchFn = fetch, AUTHORIZERNAME} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Idempotency-Key'] != null) headers.set("Idempotency-Key", String(args['Idempotency-Key'])) if (AUTHORIZERNAME !== undefined) headers.set("Authorization", AUTHORIZERNAME) const url = `${baseUrl.replace(/\/+$/, '')}/attribute/label/${encodeURIComponent(String(args.user_token))}/${encodeURIComponent(String(args.endpoint_token))}/${encodeURIComponent(String(args.attr_set_token))}${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 };