export type UpdateApiV1ShopsShopIdAffiliatesCustomerIdTierArgs = {body: {tier_id?: number | undefined}}; export type UpdateApiV1ShopsShopIdAffiliatesCustomerIdTierOptions = {baseUrl?: string | undefined, defaultValue?: string | undefined, fetch?: typeof fetch | undefined}; /** * Assign Tier * * PUT /v1/shops/{shopId}/affiliates/{customerId}/tier */ export const updateApiV1ShopsShopIdAffiliatesCustomerIdTier = async (args: UpdateApiV1ShopsShopIdAffiliatesCustomerIdTierArgs, options?: UpdateApiV1ShopsShopIdAffiliatesCustomerIdTierOptions) => { const {baseUrl = "https://api.sellauth.com", fetch: fetchFn = fetch, defaultValue} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (defaultValue !== undefined) headers.set('authorization', `Bearer ${defaultValue}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/shops/${encodeURIComponent(String(args.shopId))}/affiliates/${encodeURIComponent(String(args.customerId))}/tier${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 };