Skip to content

Commit

Permalink
adding speech-kit to gutendex
Browse files Browse the repository at this point in the history
  • Loading branch information
mastashake08 committed Jan 20, 2023
1 parent e0e3feb commit 9048527
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
19 changes: 19 additions & 0 deletions classes/Gutendex.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import SpeechKit from '@mastashake08/speech-kit'
class Gutendex {
/*
* Returns a new instance of Gutendex.
Expand Down Expand Up @@ -58,6 +59,24 @@ class Gutendex {
alert(`${e.name} - ${e.message}`)
}
}

async getBooksByMimeType (type) {
try {
const res = await fetch(this.baseUrl + `?mime_type=${type}`)
return res
} catch (e) {
alert(`${e.name} - ${e.message}`)
}
}

async readBook (id) {
try {
const res = await fetch(this.baseUrl + `/${id}?mime_type=text%2F`)
return res
} catch (e) {
alert(`${e.name} - ${e.message}`)
}
}
}

export { Gutendex }
7 changes: 6 additions & 1 deletion package-lock.json

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

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gutendex",
"version": "0.0.3",
"version": "0.0.4",
"description": "npm package for interacting with the Project Gutenberg ebook metadata catalog using the Gutendex API. Can be sel-hosted or cloud.",
"main": "index.js",
"scripts": {
Expand All @@ -26,5 +26,8 @@
"homepage": "https://github.com/mastashake08/gutendex#readme",
"devDependencies": {
"jsdoc-to-markdown": "^8.0.0"
},
"dependencies": {
"@mastashake08/speech-kit": "^1.4.0"
}
}

0 comments on commit 9048527

Please sign in to comment.