//native
type Adrapid = {
token: string
}
export async function main(
auth: Adrapid,
body: {
sizeIds?: 'all' | string[]
sizes?: {}[]
templateId?: string
modes?: {
html5?: { packed?: false | true; felxible?: false | true }
amp?: false | true
png?: false | true
jpeg?: false | true
pdf?: false | true
webp?: false | true
video?: {
fps?: number
crf?: number
audio?: { offset?: number; src?: string }
}
gif?: { fps?: number; frames?: unknown[] }
}
clicktag?: string
overrides?: {
itemName?: {
text?: string
references?: { url?: string }
url?: string
css?: {}
}
}
templateData?: {}
sync?: false | true
editable?: false | true
excludeBaseSize?: false | true
}
) {
const url = new URL(`https://api.adrapid.com/banners`)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.token
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 16 days ago