Edits history of script submission #20318 for ' Update an inbound data filter (sentry)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Update an inbound data filter
     * Update various inbound data filters for a project.
     */
    export async function main(
    	auth: RT.Sentry,
    	project_id_or_slug: string,
    	filter_id: string,
    	body: Body
    ) {
    	const url = new URL(
    		`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/filters/${filter_id}/`
    	)
    
    	const response = await fetch(url, {
    		method: 'PUT',
    		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.text()
    }
    
    /* eslint-disable */
    /**
     * This file was automatically generated by json-schema-to-typescript.
     * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
     * and run json-schema-to-typescript to regenerate this file.
     */
    
    export interface Body {
    	/**
    	 * Toggle the browser-extensions, localhost, filtered-transaction, or web-crawlers filter on or off.
    	 */
    	active?: boolean
    	/**
    	 *
    	 * Specifies which legacy browser filters should be active. Anything excluded from the list will be
    	 * disabled. The options are:
    	 * - `ie` - Internet Explorer Version 11 and lower
    	 * - `edge` - Edge Version 18 and lower
    	 * - `safari` - Safari Version 11 and lower
    	 * - `firefox` - Firefox Version 66 and lower
    	 * - `chrome` - Chrome Version 62 and lower
    	 * - `opera` - Opera Version 50 and lower
    	 * - `android` - Android Version 3 and lower
    	 * - `opera_mini` - Opera Mini Version 34 and lower
    	 *
    	 * Deprecated options:
    	 * - `ie_pre_9` - Internet Explorer Version 8 and lower
    	 * - `ie9` - Internet Explorer Version 9
    	 * - `ie10` - Internet Explorer Version 10
    	 * - `ie11` - Internet Explorer Version 11
    	 * - `safari_pre_6` - Safari Version 5 and lower
    	 * - `opera_pre_15` - Opera Version 14 and lower
    	 * - `opera_mini_pre_8` - Opera Mini Version 8 and lower
    	 * - `android_pre_4` - Android Version 3 and lower
    	 * - `edge_pre_79` - Edge Version 18 and lower (non Chromium based)
    	 *
    	 */
    	subfilters?: (
    		| 'ie'
    		| 'edge'
    		| 'safari'
    		| 'firefox'
    		| 'chrome'
    		| 'opera'
    		| 'android'
    		| 'opera_mini'
    		| 'ie_pre_9'
    		| 'ie9'
    		| 'ie10'
    		| 'ie11'
    		| 'opera_pre_15'
    		| 'android_pre_4'
    		| 'safari_pre_6'
    		| 'opera_mini_pre_8'
    		| 'edge_pre_79'
    	)[]
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago