Edits history of script submission #15128 for ' List bank feed account mappings (codat)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Codat = {
    	encodedKey: string
    }
    /**
     * List bank feed account mappings
     * The *List bank accounts* endpoint returns information about a source bank account and any current or potential target mapping accounts.
    
    A bank feed account mapping is a specified link between the source account (provided by the Codat user) and the target account (the end user's account in the underlying software).
    
    > **For custom builds only**
    > 
    > Only use this endpoint if you are building your own account management UI.
     */
    export async function main(auth: Codat, companyId: string, connectionId: string) {
    	const url = new URL(
    		`https://api.codat.io/companies/${companyId}/connections/${connectionId}/bankFeedAccounts/mapping`
    	)
    
    	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