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