jsflagr icon indicating copy to clipboard operation
jsflagr copied to clipboard

Need documentation on how ApiClient is set for each exposed API classes.

Open adrianpdm opened this issue 3 years ago • 0 comments

Related Issue

#4 (How to set server Flagr endpoint)?

Issue

Current README.md contains no documentation on how to change server url, in which it is always default to http://localhost/v1/api.

Known solution

Setting basePath for each API.

Proposed solution

After looking at the source code, i found that each exposed API constructor receives ApiClient instance. For example, EvaluationApi.

https://github.com/checkr/jsflagr/blob/0c3775a62c0f85388de09e8e57d66a92f9e81a17/src/api/EvaluationApi.js#L46-L47

So, instead of setting api.apiClient.basePath for each API as mentioned in #4, we can do this:

const apiClient = new Jsflagr.ApiClient()
apiClient.basePath = '<SERVER_URL>'

const evaluationApi = new Jsflagr.EvaluationApi(apiClient)
const constraintApi = new Jsflagr.constraintApi(apiClient)
// ... and so on, and so forth

I believe both method, either setting url manually for each API or using constructor argument, must be documented.

adrianpdm avatar Jun 30 '21 17:06 adrianpdm