1 | |
2 | |
3 | * Update a teams attributes |
4 | * Update a team's attributes with a SCIM Group PATCH Request. |
5 | */ |
6 | export async function main(auth: RT.Sentry, team_id_or_slug: string, body: Body) { |
7 | const url = new URL( |
8 | `https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/scim/v2/Groups/${team_id_or_slug}` |
9 | ) |
10 |
|
11 | const response = await fetch(url, { |
12 | method: 'PATCH', |
13 | headers: { |
14 | 'Content-Type': 'application/json', |
15 | Authorization: 'Bearer ' + auth.token |
16 | }, |
17 | body: JSON.stringify(body) |
18 | }) |
19 | if (!response.ok) { |
20 | const text = await response.text() |
21 | throw new Error(`${response.status} ${text}`) |
22 | } |
23 | return await response.text() |
24 | } |
25 |
|
26 | |
27 | |
28 | * This file was automatically generated by json-schema-to-typescript. |
29 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
30 | * and run json-schema-to-typescript to regenerate this file. |
31 | */ |
32 |
|
33 | export interface Body { |
34 | |
35 | * The list of operations to perform. Valid operations are: |
36 | * * Renaming a team: |
37 | * ```json |
38 | * { |
39 | * "Operations": [{ |
40 | * "op": "replace", |
41 | * "value": { |
42 | * "id": 23, |
43 | * "displayName": "newName" |
44 | * } |
45 | * }] |
46 | * } |
47 | * ``` |
48 | * * Adding a member to a team: |
49 | * ```json |
50 | * { |
51 | * "Operations": [{ |
52 | * "op": "add", |
53 | * "path": "members", |
54 | * "value": [ |
55 | * { |
56 | * "value": 23, |
57 | * "display": "testexample@example.com" |
58 | * } |
59 | * ] |
60 | * }] |
61 | * } |
62 | * ``` |
63 | * * Removing a member from a team: |
64 | * ```json |
65 | * { |
66 | * "Operations": [{ |
67 | * "op": "remove", |
68 | * "path": "members[value eq "23"]" |
69 | * }] |
70 | * } |
71 | * ``` |
72 | * * Replacing an entire member set of a team: |
73 | * ```json |
74 | * { |
75 | * "Operations": [{ |
76 | * "op": "replace", |
77 | * "path": "members", |
78 | * "value": [ |
79 | * { |
80 | * "value": 23, |
81 | * "display": "testexample2@sentry.io" |
82 | * }, |
83 | * { |
84 | * "value": 24, |
85 | * "display": "testexample3@sentry.io" |
86 | * } |
87 | * ] |
88 | * }] |
89 | * } |
90 | * ``` |
91 | * |
92 | */ |
93 | Operations: { |
94 | op: string |
95 | value?: { |
96 | [k: string]: unknown |
97 | } |
98 | path?: string |
99 | [k: string]: unknown |
100 | }[] |
101 | [k: string]: unknown |
102 | } |
103 |
|