Skip to content

Commit e5548d2

Browse files
committed
formatting
1 parent 0ccd4d5 commit e5548d2

File tree

7 files changed

+47
-50
lines changed

7 files changed

+47
-50
lines changed

README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ npm i @tsukiroku/gist
1515
> Account token required. See [Docs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
1616
1717
```ts
18-
import Gist from "@tsukiroku/gist";
18+
import Gist from '@tsukiroku/gist';
1919

20-
const gist = new Gist("token");
20+
const gist = new Gist('token');
2121
```
2222

2323
<br>
2424

2525
## Create Gist
2626

27-
| Parameter | Type |
28-
| ------------- | ----------- |
29-
| `files` |`GistFile` |
30-
| `description` |`string` |
31-
| `options` |`GistOptions`|
27+
| Parameter | Type |
28+
| ------------- | ------------- |
29+
| `files` | `GistFile` |
30+
| `description` | `string` |
31+
| `options` | `GistOptions` |
3232

3333
> **GistFile**
3434
>
@@ -50,10 +50,10 @@ const gist = new Gist("token");
5050
await gist
5151
.create(
5252
{
53-
file_name: { content: "File Content" },
54-
file_name_2: { content: "File Content 2" },
53+
file_name: { content: 'File Content' },
54+
file_name_2: { content: 'File Content 2' },
5555
},
56-
"test file"
56+
'test file'
5757
// { secret: true }
5858
)
5959
.then((res) => {
@@ -66,15 +66,15 @@ await gist
6666

6767
## Get Gist
6868

69-
| Parameter | Type |
70-
| --------- | ------ |
71-
| `id` |`number`|
69+
| Parameter | Type |
70+
| --------- | -------- |
71+
| `id` | `number` |
7272

7373
> **return:** [`Promise<GistResponse>`](./src/types.ts)
7474
7575
```ts
7676
await gist
77-
.get("gist id")
77+
.get('gist id')
7878
.then((res) => console.log(`gist description: ${res.description}`))
7979
.catch((err) => console.log(err));
8080
```
@@ -83,14 +83,14 @@ await gist
8383

8484
## Delete Gist
8585

86-
| Parameter | Type |
87-
| --------- | ------ |
88-
| `id` |`number`|
86+
| Parameter | Type |
87+
| --------- | -------- |
88+
| `id` | `number` |
8989

9090
```ts
9191
await gist
92-
.delete("gist id")
93-
.then((_) => console.log("deleted"))
92+
.delete('gist id')
93+
.then((_) => console.log('deleted'))
9494
.catch((err) => console.log(err));
9595
```
9696

@@ -103,20 +103,20 @@ await gist
103103
# Example
104104

105105
```ts
106-
import Gist from "@tsukiroku/gist";
106+
import Gist from '@tsukiroku/gist';
107107

108108
(async () => {
109-
const gist = new Gist("token");
109+
const gist = new Gist('token');
110110

111-
let gist_id: string = "";
111+
let gist_id: string = '';
112112

113113
await gist
114114
.create(
115115
{
116-
"index.ts": { content: "console.log('Hello, World!');" },
117-
"main.rs": { content: "fn main() {}" },
116+
'index.ts': { content: "console.log('Hello, World!');" },
117+
'main.rs': { content: 'fn main() {}' },
118118
},
119-
"test gist",
119+
'test gist',
120120
{ secret: true }
121121
)
122122
.then((res) => {
@@ -132,7 +132,7 @@ import Gist from "@tsukiroku/gist";
132132

133133
await gist
134134
.delete(gist_id)
135-
.then((_) => console.log("deleted"))
135+
.then((_) => console.log('deleted'))
136136
.catch((err) => console.log(err));
137137
})();
138138
```

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import Gist from './src/index';
22

3-
export default Gist;
3+
export default Gist;

src/createGist.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import request from "./structures/request";
2-
import { GistFile, GistOptions, GistResponse } from "./types";
1+
import request from './structures/request';
2+
import { GistFile, GistOptions, GistResponse } from './types';
33

44
export default async (
55
files: GistFile,
@@ -8,16 +8,16 @@ export default async (
88
options?: GistOptions
99
): Promise<GistResponse> => {
1010
return await request<GistResponse>(
11-
"https://api.github.com/gists",
11+
'https://api.github.com/gists',
1212
token,
13-
"POST",
13+
'POST',
1414
{
1515
data: {
1616
description: description,
1717
files: {
1818
...files,
1919
},
20-
public: options?.secret ? true : false
20+
public: options?.secret ? true : false,
2121
},
2222
}
2323
)

src/deleteGist.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import request from "./structures/request";
1+
import request from './structures/request';
22

3-
export default async (
4-
id: string,
5-
token: string
6-
): Promise<{}> => {
3+
export default async (id: string, token: string): Promise<{}> => {
74
return await request<{}>(
85
`https://api.github.com/gists/${id}`,
96
token,
10-
"DELETE",
7+
'DELETE',
118
{}
129
)
1310
.then((response) => {

src/getGist.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import request from "./structures/request";
2-
import { GistResponse } from "./types";
1+
import request from './structures/request';
2+
import { GistResponse } from './types';
33

44
export default async (id: string, token: string): Promise<GistResponse> => {
55
return await request<GistResponse>(
66
`https://api.github.com/gists/${id}`,
77
token,
8-
"GET",
8+
'GET',
99
{}
1010
)
1111
.then((response) => {

src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { GistFile, GistOptions, GistResponse, IGist } from "./types";
2-
import createGist from "./createGist";
3-
import deleteGist from "./deleteGist";
4-
import getGist from "./getGist";
1+
import { GistFile, GistOptions, GistResponse, IGist } from './types';
2+
import createGist from './createGist';
3+
import deleteGist from './deleteGist';
4+
import getGist from './getGist';
55

66
export default class Gist implements IGist {
77
public readonly token: string;
88

99
constructor(token: string) {
10-
if (!token || token === "token") {
11-
throw new Error("Token required");
10+
if (!token || token === 'token') {
11+
throw new Error('Token required');
1212
}
1313
this.token = token;
1414
}

src/structures/request.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import axios, { AxiosRequestConfig, Method } from "axios";
1+
import axios, { AxiosRequestConfig, Method } from 'axios';
22

33
export default async <T>(
44
url: string,
@@ -11,8 +11,8 @@ export default async <T>(
1111
url,
1212
method,
1313
headers: {
14-
"content-type": "application/json",
15-
accept: "application/vnd.github.v3+json",
14+
'content-type': 'application/json',
15+
accept: 'application/vnd.github.v3+json',
1616
Authorization: `Bearer ${token}`,
1717
},
1818
...options,

0 commit comments

Comments
 (0)