Edits history of script submission #20243 for ' Provision a new organization member (sentry)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Provision a new organization member
     * Create a new Organization Member via a SCIM Users POST Request.
    
    Note that this API does not support setting secondary emails.
     */
    export async function main(auth: RT.Sentry, body: Body) {
    	const url = new URL(
    		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/scim/v2/Users`
    	)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		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 SAML field used for email.
    	 */
    	userName: string
    	/**
    	 * The organization role of the member. If unspecified, this will be
    	 *                     set to the organization's default role. The options are:
    	 *
    	 * * `billing` - Can manage payment and compliance details.
    	 * * `member` - Can view and act on events, as well as view most other data within the organization.
    	 * * `manager` - Has full management access to all teams and projects. Can also manage
    	 *         the organization's membership.
    	 * * `admin` - Can edit global integrations, manage projects, and add/remove teams.
    	 *         They automatically assume the Team Admin role for teams they join.
    	 *         Note: This role can no longer be assigned in Business and Enterprise plans. Use `TeamRoles` instead.
    	 *
    	 */
    	sentryOrgRole?: 'billing' | 'member' | 'manager' | 'admin'
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago