Skip to content

Commit 6beef45

Browse files
committed
Create update.ts
1 parent a272385 commit 6beef45

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/gist/update.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import request from '../structures/request';
2+
import { GistFile, GistOptions, ReqRet } from '../types';
3+
4+
export default async (
5+
id: string,
6+
files: GistFile,
7+
description: string,
8+
token: string,
9+
options?: GistOptions
10+
): Promise<ReqRet<{}>> =>
11+
await request<{}>(`https://api.github.com/gists/${id}`, token, 'PATCH', {
12+
data: {
13+
description: description,
14+
files: {
15+
...files,
16+
},
17+
public: options?.secret ? true : false,
18+
},
19+
})
20+
.then((response) =>
21+
Promise.resolve({
22+
status: response.status,
23+
})
24+
)
25+
.catch((err) => Promise.reject(err));

0 commit comments

Comments
 (0)