export type RewardProgram = {buyerCondition?: string | undefined, companyId?: string | undefined, content?: string | undefined, createdAt?: string | undefined, creditSettings?: string | undefined, creditWeight?: number | undefined, csPhone?: string | undefined, endedAt?: string | undefined, id?: string | undefined, imageUrl?: string | undefined, maxQtyPerUser?: number | undefined, refundPolicy?: string | undefined, remainingQty?: number | undefined, rewardName?: string | undefined, rewardType?: ('EXPERIENCE' | 'PRODUCT' | 'VOUCHER') | undefined, startedAt?: string | undefined, status?: ('CANCELLED' | 'CLOSED' | 'DRAFT' | 'ENDED' | 'OPENED' | 'PENDING' | 'REGISTERED') | undefined, thumbnailUrl?: string | undefined, title?: string | undefined, totalQty?: number | undefined, unitCreditPrice?: number | undefined, updatedAt?: string | undefined, usableStores?: string | undefined, validPeriod?: string | undefined}; export type CreateApiBapiV3RewardsProgramsArgs = {body: RewardProgram}; export type CreateApiBapiV3RewardsProgramsOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * 리워드 프로그램 등록 * * POST /bapi/v3/rewards/programs */ export const createApiBapiV3RewardsPrograms = async (args: CreateApiBapiV3RewardsProgramsArgs, options?: CreateApiBapiV3RewardsProgramsOptions) => { const {baseUrl = "https://api.wincl.io:443", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/bapi/v3/rewards/programs${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 };