//native
type Phrase = {
token: string
baseUrl: string
}
/**
* Activate a Repo Sync
* Activate a deactivated Repo Sync. Active syncs can be used to import and export translations,
and imports to Phrase are automatically triggered by pushes to the repository, if configured.
*/
export async function main(auth: Phrase, account_id: string, id: string) {
const url = new URL(`${auth.baseUrl}/accounts/${account_id}/repo_syncs/${id}/activate`)
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: 'ApiToken ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago