-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
116 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import Gist from './src/index'; | ||
import Gist from './src/index' | ||
|
||
export default Gist; | ||
export default Gist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,12 @@ | ||
import request from '../structures/request'; | ||
import { GistResponse, ReqRet } from '../types'; | ||
import request from '../structures/request' | ||
import { GistResponse, ReqRet } from '../types' | ||
|
||
export default async ( | ||
id: string, | ||
token: string | ||
): Promise<ReqRet<GistResponse>> => | ||
await request<GistResponse>( | ||
`https://api.github.com/gists/${id}`, | ||
token, | ||
'GET', | ||
{} | ||
) | ||
export default async (id: string, token: string): Promise<ReqRet<GistResponse>> => | ||
await request<GistResponse>(`https://api.github.com/gists/${id}`, token, 'GET', {}) | ||
.then((response) => | ||
Promise.resolve({ | ||
data: response.data, | ||
status: response.status, | ||
}) | ||
) | ||
.catch((err) => Promise.reject(err)); | ||
.catch((err) => Promise.reject(err)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import _create from './create'; | ||
import _delete from './delete'; | ||
import _get from './get'; | ||
import _update from './update'; | ||
import _create from './create' | ||
import _delete from './delete' | ||
import _get from './get' | ||
import _update from './update' | ||
|
||
export { _create, _delete, _get, _update }; | ||
export { _create, _delete, _get, _update } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,27 @@ | ||
import { GistFile, GistOptions, GistResponse, IGist, ReqRet } from './types'; | ||
import { _create, _delete, _get, _update } from './gist'; | ||
import { GistFile, GistOptions, GistResponse, IGist, ReqRet } from './types' | ||
import { _create, _delete, _get, _update } from './gist' | ||
|
||
export default class Gist implements IGist { | ||
public readonly token: string; | ||
public readonly token: string | ||
|
||
constructor(token: string) { | ||
if (!token || token === 'token') { | ||
throw new Error('Token required'); | ||
} | ||
this.token = token; | ||
if (!token || token === 'token') throw new Error('Token required') | ||
this.token = token | ||
} | ||
|
||
public create( | ||
files: GistFile, | ||
description: string, | ||
options?: GistOptions | ||
): Promise<ReqRet<GistResponse>> { | ||
return _create(files, description, this.token, options); | ||
public create(files: GistFile, description: string, options?: GistOptions): Promise<ReqRet<GistResponse>> { | ||
return _create(files, description, this.token, options) | ||
} | ||
|
||
public delete(id: string): Promise<ReqRet<any>> { | ||
return _delete(id, this.token); | ||
return _delete(id, this.token) | ||
} | ||
|
||
public get(id: string): Promise<ReqRet<GistResponse>> { | ||
return _get(id, this.token); | ||
return _get(id, this.token) | ||
} | ||
|
||
public update( | ||
id: string, | ||
files: GistFile, | ||
description: string, | ||
options?: GistOptions | ||
): Promise<ReqRet<any>> { | ||
return _update(id, files, description, this.token, options); | ||
public update(id: string, files: GistFile, description: string, options?: GistOptions): Promise<ReqRet<any>> { | ||
return _update(id, files, description, this.token, options) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.