1 | |
2 | |
3 | * Create a new team |
4 | * Create a new team bound to an organization. Requires at least one of the `name` |
5 | or `slug` body params to be set. |
6 | */ |
7 | export async function main(auth: RT.Sentry, body: Body) { |
8 | const url = new URL( |
9 | `https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/teams/` |
10 | ) |
11 |
|
12 | const response = await fetch(url, { |
13 | method: 'POST', |
14 | headers: { |
15 | 'Content-Type': 'application/json', |
16 | Authorization: 'Bearer ' + auth.token |
17 | }, |
18 | body: JSON.stringify(body) |
19 | }) |
20 | if (!response.ok) { |
21 | const text = await response.text() |
22 | throw new Error(`${response.status} ${text}`) |
23 | } |
24 | return await response.json() |
25 | } |
26 |
|
27 | |
28 | |
29 | * This file was automatically generated by json-schema-to-typescript. |
30 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
31 | * and run json-schema-to-typescript to regenerate this file. |
32 | */ |
33 |
|
34 | export interface Body { |
35 | |
36 | * Uniquely identifies a team and is used for the interface. If not |
37 | * provided, it is automatically generated from the name. |
38 | */ |
39 | slug?: string |
40 | |
41 | * **`[DEPRECATED]`** The name for the team. If not provided, it is |
42 | * automatically generated from the slug |
43 | */ |
44 | name?: string |
45 | [k: string]: unknown |
46 | } |
47 |
|