Edits history of script submission #20319 for ' Update an issue (sentry)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Update an issue
     * Updates an individual issue's attributes.  Only the attributes submitted are modified.
     */
    export async function main(auth: RT.Sentry, issue_id: string, body: Body) {
    	const url = new URL(
    		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/issues/${issue_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.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 new status for the issues. Valid values are `"resolved"`, `"resolvedInNextRelease"`, `"unresolved"`, and `"ignored"`.
    	 */
    	status?: string
    	/**
    	 * Additional details about the resolution. Supported values are `"inRelease"`, `"inNextRelease"`, `"inCommit"`, `"ignoreDuration"`, `"ignoreCount"`, `"ignoreWindow"`, `"ignoreUserCount"`, and `"ignoreUserWindow"`.
    	 */
    	statusDetails?: {
    		/**
    		 * Indicates if the issue is resolved in the next release based on the last seen release of that issue.
    		 */
    		inNextRelease?: boolean
    		/**
    		 * The version of the release in which the issue is resolved.
    		 */
    		inRelease?: string
    		/**
    		 * The commit hash in which the issue is resolved.
    		 */
    		inCommit?: string
    		[k: string]: unknown
    	}
    	/**
    	 * The actor id (or username) of the user or team that should be assigned to this issue.
    	 */
    	assignedTo?: string
    	/**
    	 * In case this API call is invoked with a user context this allows changing of the flag that indicates if the user has seen the event.
    	 */
    	hasSeen?: boolean
    	/**
    	 * In case this API call is invoked with a user context this allows changing of the bookmark flag.
    	 */
    	isBookmarked?: boolean
    	/**
    	 * In case this API call is invoked with a user context this allows the user to subscribe to workflow notications for this issue.
    	 */
    	isSubscribed?: boolean
    	/**
    	 * Sets the issue to public or private.
    	 */
    	isPublic?: boolean
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago