//native
/**
* Add a member to an organization
* Add or invite a member to an organization.
*/
export async function main(auth: RT.Sentry, body: Body) {
const url = new URL(
`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/members/`
)
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 email address to send the invitation to.
*/
email: string
/**
* The organization-level role of the new member. Roles include:
*
* * `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.
* * `owner` - Has unrestricted access to the organization, its data, and its
* settings. Can add, modify, and delete projects and members, as well as
* make billing and plan changes.
* * `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.
*
*/
orgRole?: 'billing' | 'member' | 'manager' | 'owner' | 'admin'
/**
* The team and team-roles assigned to the member. Team roles can be either:
* - `contributor` - Can view and act on issues. Depending on organization settings, they can also add team members.
* - `admin` - Has full management access to their team's membership and projects.
*/
teamRoles?: {
[k: string]: unknown
}[]
/**
* Whether or not to send an invite notification through email. Defaults to True.
*/
sendInvite?: boolean
/**
* Whether or not to re-invite a user who has already been invited to the organization. Defaults to True.
*/
reinvite?: boolean
[k: string]: unknown
}
Submitted by hugo697 235 days ago