1 | |
2 | |
3 | * Create a new project |
4 | * Create a new project bound to a team. |
5 |
|
6 | Note: If your organization has disabled member project creation, the `org:write` or `team:admin` scope is required. |
7 | |
8 | */ |
9 | export async function main(auth: RT.Sentry, team_id_or_slug: string, body: Body) { |
10 | const url = new URL( |
11 | `https://${auth.region}.sentry.io/api/0/teams/${auth.organizationSlug}/${team_id_or_slug}/projects/` |
12 | ) |
13 |
|
14 | const response = await fetch(url, { |
15 | method: 'POST', |
16 | headers: { |
17 | 'Content-Type': 'application/json', |
18 | Authorization: 'Bearer ' + auth.token |
19 | }, |
20 | body: JSON.stringify(body) |
21 | }) |
22 | if (!response.ok) { |
23 | const text = await response.text() |
24 | throw new Error(`${response.status} ${text}`) |
25 | } |
26 | return await response.json() |
27 | } |
28 |
|
29 | |
30 | |
31 | * This file was automatically generated by json-schema-to-typescript. |
32 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
33 | * and run json-schema-to-typescript to regenerate this file. |
34 | */ |
35 |
|
36 | export interface Body { |
37 | |
38 | * The name for the project. |
39 | */ |
40 | name: string |
41 | |
42 | * Uniquely identifies a project and is used for the interface. |
43 | * If not provided, it is automatically generated from the name. |
44 | */ |
45 | slug?: string |
46 | |
47 | * The platform for the project. |
48 | */ |
49 | platform?: string |
50 | |
51 | * |
52 | * Defaults to true where the behavior is to alert the user on every new |
53 | * issue. Setting this to false will turn this off and the user must create |
54 | * their own alerts to be notified of new issues. |
55 | * |
56 | */ |
57 | default_rules?: boolean |
58 | [k: string]: unknown |
59 | } |
60 |
|