Edits history of script submission #18548 for ' Get ReadMe's outbound IP addresses (readme)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Get ReadMe's outbound IP addresses
     * Get all of ReadMe's IP addresses used for outbound webhook requests and the "Try It!" button on the API Explorer.
    
    Although ReadMe's outbound IP addresses may change, the IPs in this API response will be valid for at least 7 days. If you configure your API or webhooks to limit access based on these IPs, you should refresh the IP list from this endpoint weekly.
     */
    export async function main(auth: RT.Readme) {
    	const url = new URL(`https://api.readme.com/v2/outbound_ips`)
    
    	const response = await fetch(url, {
    		method: 'GET',
    		headers: {
    			Authorization: 'Bearer ' + auth.apiKey
    		},
    		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