export type CreateApiV1ShopsShopIdResellerTiersArgs = {body: {name: string, discount_percentage: number, is_public: boolean, sort_order?: (number | null) | undefined, min_spent_usd?: number | undefined, min_sales_count?: number | undefined, image_id?: number | undefined}}; export type CreateApiV1ShopsShopIdResellerTiersOptions = {baseUrl?: string | undefined, defaultValue?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Tier * * POST /v1/shops/{shopId}/reseller-tiers */ export const createApiV1ShopsShopIdResellerTiers = async (args: CreateApiV1ShopsShopIdResellerTiersArgs, options?: CreateApiV1ShopsShopIdResellerTiersOptions) => { 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))}/reseller-tiers${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };