1 | |
2 | type Miro = { |
3 | token: string; |
4 | }; |
5 | |
6 | * Update team settings |
7 | * Updates team settings of an existing team.Required scope organizations:teams:write Rate limiting Level 2 Enterprise only This API is available only for Enterprise plan users. You can only use this endpoint if you have the role of a Company Admin. You can request temporary access to Enterprise APIs using this form. |
8 | */ |
9 | export async function main( |
10 | auth: Miro, |
11 | org_id: string, |
12 | team_id: string, |
13 | body: { |
14 | teamAccountDiscoverySettings?: { |
15 | accountDiscovery?: "hidden" | "request" | "join"; |
16 | }; |
17 | teamCollaborationSettings?: { coOwnerRole?: "enabled" | "disabled" }; |
18 | teamCopyAccessLevelSettings?: { |
19 | copyAccessLevel?: |
20 | | "anyone" |
21 | | "team_members" |
22 | | "team_editors" |
23 | | "board_owner"; |
24 | copyAccessLevelLimitation?: "anyone" | "team_members"; |
25 | }; |
26 | teamInvitationSettings?: { |
27 | inviteExternalUsers?: "allowed" | "not_allowed"; |
28 | whoCanInvite?: "only_org_admins" | "admins" | "all_members"; |
29 | }; |
30 | teamSharingPolicySettings?: { |
31 | allowListedDomains?: string[]; |
32 | createAssetAccessLevel?: "admins" | "all_members" | "company_admins"; |
33 | defaultBoardAccess?: "private" | "view" | "comment" | "edit"; |
34 | defaultBoardSharingAccess?: |
35 | | "team_members_with_editing_rights" |
36 | | "owner_and_coowners"; |
37 | defaultOrganizationAccess?: "private" | "view" | "comment" | "edit"; |
38 | defaultProjectAccess?: "private" | "view"; |
39 | moveBoardToAccount?: "allowed" | "not_allowed"; |
40 | restrictAllowedDomains?: |
41 | | "enabled" |
42 | | "disabled" |
43 | | "enabled_with_external_user_access"; |
44 | sharingOnAccount?: "allowed" | "not_allowed"; |
45 | sharingOnOrganization?: |
46 | | "allowed" |
47 | | "not_allowed" |
48 | | "allowed_with_editing"; |
49 | sharingViaPublicLink?: "allowed" | "not_allowed" | "allowed_with_editing"; |
50 | }; |
51 | }, |
52 | ) { |
53 | const url = new URL( |
54 | `https://api.miro.com//v2/orgs/${org_id}/teams/${team_id}/settings`, |
55 | ); |
56 |
|
57 | const response = await fetch(url, { |
58 | method: "PATCH", |
59 | headers: { |
60 | "Content-Type": "application/json", |
61 | Authorization: "Bearer " + auth.token, |
62 | }, |
63 | body: JSON.stringify(body), |
64 | }); |
65 | if (!response.ok) { |
66 | const text = await response.text(); |
67 | throw new Error(`${response.status} ${text}`); |
68 | } |
69 | return await response.json(); |
70 | } |
71 |
|