//native
type Motimate = {
token: string
}
export async function main(
auth: Motimate,
body: {
badge_id: number
external_id?: string
default_language:
| 'cs'
| 'da'
| 'de'
| 'en'
| 'es'
| 'fi'
| 'fr'
| 'hr'
| 'hu'
| 'it'
| 'lt'
| 'lv'
| 'nb'
| 'nl'
| 'nn'
| 'pl'
| 'pt'
| 'ro'
| 'ru'
| 'se'
| 'sq'
| 'sr'
| 'sv'
| 'tr'
color: string
title: string
description?: string
locked_order?: false | true
folder_id?: number
approver_id?: number
approver_external_id?: number
tags?: string[]
category_ids?: string[]
category_external_ids?: string[]
}
) {
const url = new URL(`https://motimateapp.com/public_api/motis`)
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 581 days ago