export type DeleteApiV1ApplicationsApplicationIdCampaignsCampaignIdCouponsArgs = {applicationId: number, campaignId: number, value?: string | undefined, createdBefore?: string | undefined, createdAfter?: string | undefined, startsAfter?: string | undefined, startsBefore?: string | undefined, expiresAfter?: string | undefined, expiresBefore?: string | undefined, valid?: ('expired' | 'validNow' | 'validFuture') | undefined, batchId?: string | undefined, usable?: ('true' | 'false') | undefined, referralId?: number | undefined, recipientIntegrationId?: string | undefined, exactMatch?: boolean | undefined}; export type DeleteApiV1ApplicationsApplicationIdCampaignsCampaignIdCouponsOptions = {baseUrl?: string | undefined, managerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete coupons * * DELETE /v1/applications/{applicationId}/campaigns/{campaignId}/coupons * * Also accepts auth: management_key */ export const deleteApiV1ApplicationsApplicationIdCampaignsCampaignIdCoupons = async (args: DeleteApiV1ApplicationsApplicationIdCampaignsCampaignIdCouponsArgs, options?: DeleteApiV1ApplicationsApplicationIdCampaignsCampaignIdCouponsOptions) => { const {baseUrl = "https://yourbaseurl.talon.one", fetch: fetchFn = fetch, managerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.value != null) query.append("value", String(args.value)) if (args.createdBefore != null) query.append("createdBefore", String(args.createdBefore)) if (args.createdAfter != null) query.append("createdAfter", String(args.createdAfter)) if (args.startsAfter != null) query.append("startsAfter", String(args.startsAfter)) if (args.startsBefore != null) query.append("startsBefore", String(args.startsBefore)) if (args.expiresAfter != null) query.append("expiresAfter", String(args.expiresAfter)) if (args.expiresBefore != null) query.append("expiresBefore", String(args.expiresBefore)) if (args.valid != null) query.append("valid", String(args.valid)) if (args.batchId != null) query.append("batchId", String(args.batchId)) if (args.usable != null) query.append("usable", String(args.usable)) if (args.referralId != null) query.append("referralId", String(args.referralId)) if (args.recipientIntegrationId != null) query.append("recipientIntegrationId", String(args.recipientIntegrationId)) if (args.exactMatch != null) query.append("exactMatch", String(args.exactMatch)) if (managerAuth !== undefined) headers.set("Authorization", managerAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/applications/${encodeURIComponent(String(args.applicationId))}/campaigns/${encodeURIComponent(String(args.campaignId))}/coupons${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };