Skip to content

Commit cd1004c

Browse files
committed
Create create.ts
1 parent 6de6f13 commit cd1004c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/gist/create.ts

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

0 commit comments

Comments
 (0)