Edits history of script submission #20307 for ' Update a project (sentry)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Update a project
     * Update various attributes and configurable settings for the given project.
    
    Note that solely having the **`project:read`** scope restricts updatable settings to
    `isBookmarked`, `autofixAutomationTuning`, and `seerScannerAutomation`.
     */
    export async function main(auth: RT.Sentry, project_id_or_slug: string, body: Body) {
    	const url = new URL(
    		`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_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 {
    	/**
    	 * Enables starring the project within the projects tab. Can be updated with **`project:read`** permission.
    	 */
    	isBookmarked?: boolean
    	/**
    	 * The name for the project
    	 */
    	name?: string
    	/**
    	 * Uniquely identifies a project and is used for the interface.
    	 */
    	slug?: string
    	/**
    	 * The platform for the project
    	 */
    	platform?: string
    	/**
    	 * Custom prefix for emails from this project.
    	 */
    	subjectPrefix?: string
    	/**
    	 * The email subject to use (excluding the prefix) for individual alerts. Here are the list of variables you can use:
    	 * - `$title`
    	 * - `$shortID`
    	 * - `$projectID`
    	 * - `$orgID`
    	 * - `${tag:key}` - such as `${tag:environment}` or `${tag:release}`.
    	 */
    	subjectTemplate?: string
    	/**
    	 * Automatically resolve an issue if it hasn't been seen for this many hours. Set to `0` to disable auto-resolve.
    	 */
    	resolveAge?: number
    	/**
    	 * A JSON mapping of context types to lists of strings for their keys.
    	 * E.g. `{'user': ['id', 'email']}`
    	 */
    	highlightContext?: {
    		[k: string]: unknown
    	}
    	/**
    	 * A list of strings with tag keys to highlight on this project's issues.
    	 * E.g. `['release', 'environment']`
    	 */
    	highlightTags?: string[]
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago