1 | |
2 | |
3 | * Update a client key |
4 | * Update various settings for a client key. |
5 | */ |
6 | export async function main( |
7 | auth: RT.Sentry, |
8 | project_id_or_slug: string, |
9 | key_id: string, |
10 | body: Body |
11 | ) { |
12 | const url = new URL( |
13 | `https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/keys/${key_id}/` |
14 | ) |
15 |
|
16 | const response = await fetch(url, { |
17 | method: 'PUT', |
18 | headers: { |
19 | 'Content-Type': 'application/json', |
20 | Authorization: 'Bearer ' + auth.token |
21 | }, |
22 | body: JSON.stringify(body) |
23 | }) |
24 | if (!response.ok) { |
25 | const text = await response.text() |
26 | throw new Error(`${response.status} ${text}`) |
27 | } |
28 | return await response.json() |
29 | } |
30 |
|
31 | |
32 | |
33 | * This file was automatically generated by json-schema-to-typescript. |
34 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
35 | * and run json-schema-to-typescript to regenerate this file. |
36 | */ |
37 |
|
38 | export interface Body { |
39 | |
40 | * The name for the client key |
41 | */ |
42 | name?: string |
43 | |
44 | * Activate or deactivate the client key. |
45 | */ |
46 | isActive?: boolean |
47 | |
48 | * Applies a rate limit to cap the number of errors accepted during a given time window. To |
49 | * disable entirely set `rateLimit` to null. |
50 | * ```json |
51 | * { |
52 | * "rateLimit": { |
53 | * "window": 7200, // time in seconds |
54 | * "count": 1000 // error cap |
55 | * } |
56 | * } |
57 | * ``` |
58 | */ |
59 | rateLimit?: { |
60 | count?: number |
61 | window?: number |
62 | [k: string]: unknown |
63 | } |
64 | |
65 | * The Sentry Javascript SDK version to use. The currently supported options are: |
66 | * |
67 | * * `latest` - Most recent version |
68 | * * `7.x` - Version 7 releases |
69 | */ |
70 | browserSdkVersion?: 'latest' | '7.x' |
71 | |
72 | * Configures multiple options for the Javascript Loader Script. |
73 | * - `Performance Monitoring` |
74 | * - `Debug Bundles & Logging` |
75 | * - `Session Replay` - Note that the loader will load the ES6 bundle instead of the ES5 bundle. |
76 | * ```json |
77 | * { |
78 | * "dynamicSdkLoaderOptions": { |
79 | * "hasReplay": true, |
80 | * "hasPerformance": true, |
81 | * "hasDebug": true |
82 | * } |
83 | * } |
84 | * ``` |
85 | */ |
86 | dynamicSdkLoaderOptions?: { |
87 | hasReplay?: boolean |
88 | hasPerformance?: boolean |
89 | hasDebug?: boolean |
90 | [k: string]: unknown |
91 | } |
92 | [k: string]: unknown |
93 | } |
94 |
|