//native
/**
* Create a new client key
* Create a new client key bound to a project. The key's secret and public key
are generated by the server.
*/
export async function main(auth: RT.Sentry, project_id_or_slug: string, body: Body) {
const url = new URL(
`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/keys/`
)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.token
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
export interface Body {
/**
* The optional name of the key. If not provided it will be automatically generated.
*/
name?: string
/**
* Applies a rate limit to cap the number of errors accepted during a given time window. To
* disable entirely set `rateLimit` to null.
* ```json
* {
* "rateLimit": {
* "window": 7200, // time in seconds
* "count": 1000 // error cap
* }
* }
* ```
*/
rateLimit?: {
count?: number
window?: number
[k: string]: unknown
}
/**
* * `user`
* * `profiling`
* * `escalating_issues`
* * `tempest`
* * `demo`
*/
useCase?: 'user' | 'profiling' | 'escalating_issues' | 'tempest' | 'demo'
[k: string]: unknown
}
Submitted by hugo697 235 days ago