1 | |
2 | |
3 | * Edit a git token |
4 | * |
5 | */ |
6 | export async function main( |
7 | auth: RT.Qovery, |
8 | organizationId: string, |
9 | gitTokenId: string, |
10 | body: Body |
11 | ) { |
12 | const url = new URL( |
13 | `https://api.qovery.com/organization/${organizationId}/gitToken/${gitTokenId}` |
14 | ) |
15 |
|
16 | const response = await fetch(url, { |
17 | method: 'PUT', |
18 | headers: { |
19 | 'Content-Type': 'application/json', |
20 | Authorization: 'Token ' + auth.apiKey |
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 | name: string |
40 | description?: string |
41 | type: 'BITBUCKET' | 'GITHUB' | 'GITLAB' |
42 | |
43 | * The token from your git provider side |
44 | */ |
45 | token: string |
46 | |
47 | * Mandatory only for BITBUCKET git provider, to allow us to fetch repositories at creation/edition of a service |
48 | */ |
49 | workspace?: string |
50 | |
51 | * custom git api url for the given git provider/type. |
52 | * I.e: Self-hosted version of Gitlab |
53 | */ |
54 | git_api_url?: string |
55 | [k: string]: unknown |
56 | } |
57 |
|