Edits history of script submission #20321 for ' Update an organization (sentry)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Update an organization
     * Update various attributes and configurable settings for the given organization.
     */
    export async function main(auth: RT.Sentry, body: Body) {
    	const url = new URL(
    		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/`
    	)
    
    	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 slug for the organization, which needs to be unique.
    	 */
    	slug?: string
    	/**
    	 * The new name for the organization.
    	 */
    	name?: string
    	/**
    	 * Specify `true` to opt-in to new features before they're released to the public.
    	 */
    	isEarlyAdopter?: boolean
    	/**
    	 * Specify `true` to hide AI features from the organization.
    	 */
    	hideAiFeatures?: boolean
    	/**
    	 * Specify `true` to enable Code Coverage Insights. This feature is only available for organizations on the Team plan and above. Learn more about Codecov [here](/product/codecov/).
    	 */
    	codecovAccess?: boolean
    	/**
    	 * The default role new members will receive.
    	 *
    	 * * `member` - Member
    	 * * `admin` - Admin
    	 * * `manager` - Manager
    	 * * `owner` - Owner
    	 */
    	defaultRole?: 'member' | 'admin' | 'manager' | 'owner'
    	/**
    	 * Specify `true` to allow organization members to freely join any team.
    	 */
    	openMembership?: boolean
    	/**
    	 * Specify `true` to allow members to delete events (including the delete & discard action) by granting them the `event:admin` scope.
    	 */
    	eventsMemberAdmin?: boolean
    	/**
    	 * Specify `true` to allow members to create, edit, and delete alert rules by granting them the `alerts:write` scope.
    	 */
    	alertsMemberWrite?: boolean
    	/**
    	 * The role required to download event attachments, such as native crash reports or log files.
    	 *
    	 * * `member` - Member
    	 * * `admin` - Admin
    	 * * `manager` - Manager
    	 * * `owner` - Owner
    	 */
    	attachmentsRole?: 'member' | 'admin' | 'manager' | 'owner'
    	/**
    	 * The role required to download debug information files, ProGuard mappings and source maps.
    	 *
    	 * * `member` - Member
    	 * * `admin` - Admin
    	 * * `manager` - Manager
    	 * * `owner` - Owner
    	 */
    	debugFilesRole?: 'member' | 'admin' | 'manager' | 'owner'
    	/**
    	 * The type of display picture for the organization.
    	 *
    	 * * `letter_avatar` - Use initials
    	 * * `upload` - Upload an image
    	 */
    	avatarType?: 'letter_avatar' | 'upload'
    	/**
    	 * The image to upload as the organization avatar, in base64. Required if `avatarType` is `upload`.
    	 */
    	avatar?: string
    	/**
    	 * Specify `true` to require and enforce two-factor authentication for all members.
    	 */
    	require2FA?: boolean
    	/**
    	 * Specify `true` to allow sharing of limited details on issues to anonymous users.
    	 */
    	allowSharedIssues?: boolean
    	/**
    	 * Specify `true` to enable enhanced privacy controls to limit personally identifiable information (PII) as well as source code in things like notifications.
    	 */
    	enhancedPrivacy?: boolean
    	/**
    	 * Specify `true` to allow Sentry to scrape missing JavaScript source context when possible.
    	 */
    	scrapeJavaScript?: boolean
    	/**
    	 * How many native crash reports (such as Minidumps for improved processing and download in issue details) to store per issue.
    	 *
    	 * * `0` - Disabled
    	 * * `1` - 1 per issue
    	 * * `5` - 5 per issue
    	 * * `10` - 10 per issue
    	 * * `20` - 20 per issue
    	 * * `50` - 50 per issue
    	 * * `100` - 100 per issue
    	 * * `-1` - Unlimited
    	 */
    	storeCrashReports?: 0 | 1 | 5 | 10 | 20 | 50 | 100 | -1
    	/**
    	 * Specify `true` to allow users to request to join your organization.
    	 */
    	allowJoinRequests?: boolean
    	/**
    	 * Specify `true` to require server-side data scrubbing for all projects.
    	 */
    	dataScrubber?: boolean
    	/**
    	 * Specify `true` to apply the default scrubbers to prevent things like passwords and credit cards from being stored for all projects.
    	 */
    	dataScrubberDefaults?: boolean
    	/**
    	 * A list of additional global field names to match against when scrubbing data for all projects.
    	 */
    	sensitiveFields?: string[]
    	/**
    	 * A list of global field names which data scrubbers should ignore.
    	 */
    	safeFields?: string[]
    	/**
    	 * Specify `true` to prevent IP addresses from being stored for new events on all projects.
    	 */
    	scrubIPAddresses?: boolean
    	/**
    	 * Advanced data scrubbing rules that can be configured for each project as a JSON string. The new rules will only apply to new incoming events. For more details on advanced data scrubbing, see our [full documentation](/security-legal-pii/scrubbing/advanced-datascrubbing/).
    	 *
    	 * > Warning: Calling this endpoint with this field fully overwrites the advanced data scrubbing rules.
    	 *
    	 * Below is an example of a payload for a set of advanced data scrubbing rules for masking credit card numbers from the log message (equivalent to `[Mask] [Credit card numbers] from [$message]` in the Sentry app) and removing a specific key called `foo` (equivalent to `[Remove] [Anything] from [extra.foo]` in the Sentry app):
    	 * ```json
    	 * {
    	 *     relayPiiConfig: "{\"rules":{\"0\":{\"type\":\"creditcard\",\"redaction\":{\"method\":\"mask\"}},\"1\":{\"type\":\"anything\",\"redaction\":{\"method\":\"remove\"}}},\"applications\":{\"$message\":[\"0\"],\"extra.foo\":[\"1\"]}}"
    	 * }
    	 * ```
    	 *
    	 */
    	relayPiiConfig?: string
    	/**
    	 * A list of local Relays (the name, public key, and description as a JSON) registered for the organization. This feature is only available for organizations on the Business and Enterprise plans. Read more about Relay [here](/product/relay/).
    	 *
    	 *                                           Below is an example of a list containing a single local Relay registered for the organization:
    	 *                                           ```json
    	 *                                           {
    	 *                                             trustedRelays: [
    	 *                                                 {
    	 *                                                     name: "my-relay",
    	 *                                                     publicKey: "eiwr9fdruw4erfh892qy4493reyf89ur34wefd90h",
    	 *                                                     description: "Configuration for my-relay."
    	 *                                                 }
    	 *                                             ]
    	 *                                           }
    	 *                                           ```
    	 *
    	 */
    	trustedRelays?: {
    		[k: string]: unknown
    	}[]
    	/**
    	 * Specify `true` to allow Sentry to comment on recent pull requests suspected of causing issues. Requires a GitHub integration.
    	 */
    	githubPRBot?: boolean
    	/**
    	 * Specify `true` to allow Sentry to comment on open pull requests to show recent error issues for the code being changed. Requires a GitHub integration.
    	 */
    	githubOpenPRBot?: boolean
    	/**
    	 * Specify `true` to allow Sentry to detect users committing to your GitHub repositories that are not part of your Sentry organization. Requires a GitHub integration.
    	 */
    	githubNudgeInvite?: boolean
    	/**
    	 * Specify `true` to allow Sentry to comment on recent pull requests suspected of causing issues. Requires a GitLab integration.
    	 */
    	gitlabPRBot?: boolean
    	/**
    	 * Specify `true` to allow Sentry to comment on open pull requests to show recent error issues for the code being changed. Requires a GitLab integration.
    	 */
    	gitlabOpenPRBot?: boolean
    	/**
    	 * Specify `true` to allow the Sentry Slack integration to post replies in threads for an Issue Alert notification. Requires a Slack integration.
    	 */
    	issueAlertsThreadFlag?: boolean
    	/**
    	 * Specify `true` to allow the Sentry Slack integration to post replies in threads for a Metric Alert notification. Requires a Slack integration.
    	 */
    	metricAlertsThreadFlag?: boolean
    	/**
    	 * Specify `true` to restore an organization that is pending deletion.
    	 */
    	cancelDeletion?: boolean
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago