Skip to content

Commit

Permalink
Add config support for all instance methods
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdong262 committed Oct 20, 2021
1 parent a85f0d9 commit 090cc19
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gist-wrapper",
"version": "0.3.0",
"version": "0.4.0",
"description": "Github gist API wrapper.",
"author": "ZHAO Xudong <[email protected]>",
"license": "MIT",
Expand Down
16 changes: 8 additions & 8 deletions src/gist-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,20 @@ class GistClient {
return this.request({ ...config, method: 'patch', url, data })
}

create (data: Data) {
return this.post('/gists', data)
create (data: Data, conf: Config | undefined) {
return this.post('/gists', data, conf)
}

update (gistId: string, data: Data) {
return this.patch(`/gists/${gistId}`, data)
update (gistId: string, data: Data, conf: Config | undefined) {
return this.patch(`/gists/${gistId}`, data, conf)
}

getOne (gistId: string) {
return this.get(`/gists/${gistId}`)
getOne (gistId: string, conf: Config | undefined) {
return this.get(`/gists/${gistId}`, conf)
}

delOne (gistId: string) {
return this.delete(`/gists/${gistId}`)
delOne (gistId: string, conf: Config | undefined) {
return this.delete(`/gists/${gistId}`, conf)
}

_patchHeaders (headers: Data) {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"module": "commonjs",
"outDir": "./dist",
"declaration": true,
"useUnknownInCatchVariables": false,
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
Expand Down

0 comments on commit 090cc19

Please sign in to comment.