1 | |
2 | |
3 | * Update a changelog entry |
4 | * Update an existing changelog entry in your ReadMe project. |
5 | */ |
6 | export async function main(auth: RT.Readme, identifier: string, body: Body) { |
7 | const url = new URL(`https://api.readme.com/v2/changelogs/${identifier}`) |
8 |
|
9 | const response = await fetch(url, { |
10 | method: 'PATCH', |
11 | headers: { |
12 | 'Content-Type': 'application/json', |
13 | Authorization: 'Bearer ' + auth.apiKey |
14 | }, |
15 | body: JSON.stringify(body) |
16 | }) |
17 | if (!response.ok) { |
18 | const text = await response.text() |
19 | throw new Error(`${response.status} ${text}`) |
20 | } |
21 | return await response.json() |
22 | } |
23 |
|
24 | |
25 | |
26 | * This file was automatically generated by json-schema-to-typescript. |
27 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
28 | * and run json-schema-to-typescript to regenerate this file. |
29 | */ |
30 |
|
31 | export interface Body { |
32 | author?: { |
33 | id?: string |
34 | name?: string |
35 | } |
36 | content?: { |
37 | body?: string |
38 | } |
39 | |
40 | * An ISO 8601 formatted date for when the changelog was created. |
41 | */ |
42 | created_at?: string |
43 | metadata?: { |
44 | description?: string |
45 | image?: { |
46 | uri?: string |
47 | url?: string |
48 | } |
49 | keywords?: string |
50 | title?: string |
51 | } |
52 | privacy?: { |
53 | |
54 | * The visibility of this changelog. |
55 | */ |
56 | view?: 'public' | 'anyone_with_link' |
57 | } |
58 | slug?: string |
59 | title?: string |
60 | |
61 | * The type of changelog that this is. |
62 | */ |
63 | type?: 'none' | 'added' | 'fixed' | 'improved' | 'deprecated' | 'removed' |
64 | } |
65 |
|