-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hi,
I am trying to use this promising Api and face several issues. For now at least, I think connected to mistakes in docs.
For example:
1.
ApiObjectTree helper
Alternative way to avoid string api (but there are no children option):import { ApiObjectTree } from '@apicase/services'
const api = new ApiTree(BaseService, {
getAllPosts: { url: '' },
createPost: { url: '', method: 'POST' },
getOnePost: { url: ':id', method: 'POST' },
updOnePost: { url: ':id', method: 'PUT' },
rmvOnePost: { url: ':id', method: 'DELETE' }
})
ApiObjectTree is not mentioned anywhere. Perhaps, it should be instead of ApiTree? Likewise, BaseService is not mentioned anywhere (neither in this sample, nor in previous examples), so it is unclear what it is.
- Then, in some examples you create ApiService passing adapter as first argument, in other examples you pass it as part of an object (with url param).
- Then there is ApiTree first example, where you don't pass adapter at all. But after that you say "You can also pass parent service instead of adapter" for ApiTree... where's that?
As it is, the docs are a mess, which makes it harder to use your Api. Please, clarify these points. And I'm sure there are more.
Right now I'm stuck right at the beginning:
const ApiRest = new ApiService(fetch, { url: '/api/rest/' })
var apiTableName = ApiRest.extend({ url: "table_name" })
const TableName = new ApiObjectTree(apiTableName, {
getTableName: { url: '', method: 'GET' },
}
)TableName.getTableName.doRequest()
Guess what? This fails. :(