Edits history of script submission #20315 for ' Update an existing custom integration (sentry)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Update an existing custom integration
     * Update an existing custom integration.
     */
    export async function main(auth: RT.Sentry, sentry_app_id_or_slug: string, body: Body) {
    	const url = new URL(
    		`https://${auth.region}.sentry.io/api/0/sentry-apps/${sentry_app_id_or_slug}/`
    	)
    
    	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.json()
    }
    
    /* 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 {
    	/**
    	 * The name of the custom integration.
    	 */
    	name: string
    	/**
    	 * The custom integration's permission scopes for API access.
    	 */
    	scopes: string[]
    	/**
    	 * The custom integration's author.
    	 */
    	author?: string
    	/**
    	 * Webhook events the custom integration is subscribed to.
    	 */
    	events?: string[]
    	/**
    	 * The UI components schema, used to render the custom integration's configuration UI elements. See our [schema docs](https://docs.sentry.io/organization/integrations/integration-platform/ui-components/) for more information.
    	 */
    	schema?: {
    		[k: string]: unknown
    	}
    	/**
    	 * The webhook destination URL.
    	 */
    	webhookUrl?: string
    	/**
    	 * The post-installation redirect URL.
    	 */
    	redirectUrl?: string
    	/**
    	 * Whether or not the integration is internal only. False means the integration is public.
    	 */
    	isInternal?: boolean
    	/**
    	 * Marks whether or not the custom integration can be used in an alert rule.
    	 */
    	isAlertable?: boolean
    	/**
    	 * The custom integration's description.
    	 */
    	overview?: string
    	/**
    	 * Whether or not an installation of the custom integration should be verified.
    	 */
    	verifyInstall?: boolean
    	/**
    	 * The list of allowed origins for CORS.
    	 */
    	allowedOrigins?: string[]
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago