Edits history of script submission #15054 for ' Get data integrity status (codat)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Codat = {
    	encodedKey: string
    }
    /**
     * Get data integrity status
     * The *Get data integrity status* endpoint returns the [status](https://docs.
     */
    export async function main(
    	auth: Codat,
    	companyId: string,
    	dataType: 'banking-accounts' | 'banking-transactions' | 'bankAccounts' | 'accountTransactions'
    ) {
    	const url = new URL(
    		`https://api.codat.io/data/companies/${companyId}/assess/dataTypes/${dataType}/dataIntegrity/status`
    	)
    
    	const response = await fetch(url, {
    		method: 'GET',
    		headers: {
    			Authorization: `Basic ${auth.encodedKey}`
    		},
    		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