3.3-api.md
3.3 API¶
LocalAPI for get data from server
Kind: global class
- LocalAPI
- .init(server,) ⇒
- .checkNet() ⇒
- .login(email, password) ⇒
object
- .getUsers() ⇒
array
- .getUserInfo(email) ⇒
- .addUser(email, name, password) ⇒
- .deleteUser(email) ⇒
- .updateUserPassword(password, user) ⇒
- .updateUserAvatar(avatar, user) ⇒
- .addNovel(name, cover_photo, author, detail, price, brief) ⇒
- .deleteNovel(id) ⇒
- .getNovelList() ⇒
- .getNovelDetail(id) ⇒
- .searchNovelByName(novel) ⇒
object
- .searchNovelByAuthor(author) ⇒
object
- .searchNovelByPrice(price) ⇒
object
- .searchNovel(novel, author, novel) ⇒
object
localAPI.init(server,) ⇒¶
init api
Kind: instance method of LocalAPI
Returns: API object
Param | Type | Description |
---|---|---|
server, | object | username, password, token |
localAPI.checkNet() ⇒¶
check internet is connect
Kind: instance method of LocalAPI
Returns: pong
localAPI.login(email, password) ⇒ object
¶
user login
Kind: instance method of LocalAPI
Returns: object
- response
Param | Type |
---|---|
string | |
password | string |
localAPI.getUsers() ⇒ array
¶
get all users in dabatase
Kind: instance method of LocalAPI
Returns: array
- user list
localAPI.getUserInfo(email) ⇒¶
get user info by email
Kind: instance method of LocalAPI
Returns: user object
Param | Type |
---|---|
string |
localAPI.addUser(email, name, password) ⇒¶
add new user
Kind: instance method of LocalAPI
Returns: boolean
Param | Type |
---|---|
string | |
name | string |
password | string |
localAPI.deleteUser(email) ⇒¶
delete user by email
Kind: instance method of LocalAPI
Returns: boolean
Param | Type |
---|---|
string |
localAPI.updateUserPassword(password, user) ⇒¶
change user password
Kind: instance method of LocalAPI
Returns: user object
Param | Type | Description |
---|---|---|
password | string | |
user | string |
localAPI.updateUserAvatar(avatar, user) ⇒¶
change user avatar
Kind: instance method of LocalAPI
Returns: user object
Param | Type | Description |
---|---|---|
avatar | string | image path |
user | string |
localAPI.addNovel(name, cover_photo, author, detail, price, brief) ⇒¶
add novel to dabatase
Kind: instance method of LocalAPI
Returns: success
Param | Type |
---|---|
name | string |
cover_photo | string |
author | string |
detail | string |
price | number |
brief | string |
localAPI.deleteNovel(id) ⇒¶
delete novel by id
Kind: instance method of LocalAPI
Returns: boolean
Param | Type |
---|---|
id | string |
localAPI.getNovelList() ⇒¶
get novels list
Kind: instance method of LocalAPI
Returns: novels
localAPI.getNovelDetail(id) ⇒¶
get novel detail by id
Kind: instance method of LocalAPI
Returns: novel
Param | Type |
---|---|
id | string |
localAPI.searchNovelByName(novel) ⇒ object
¶
search novel by novel name
Kind: instance method of LocalAPI
Returns: object
- novel
Param | Type | Description |
---|---|---|
novel | string | name |
localAPI.searchNovelByAuthor(author) ⇒ object
¶
search novel by author name
Kind: instance method of LocalAPI
Returns: object
- novel
Param | Type | Description |
---|---|---|
author | string | name |
localAPI.searchNovelByPrice(price) ⇒ object
¶
search novel by price
Kind: instance method of LocalAPI
Returns: object
- novel
Param | Type | Description |
---|---|---|
price | number | of searched novel |
localAPI.searchNovel(novel, author, novel) ⇒ object
¶
search novel
Kind: instance method of LocalAPI
Returns: object
- novel
Param | Type | Description |
---|---|---|
novel | string | name |
author | stribg | name |
novel | number | price |