Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
adrianpdm opened this issue Jun 30, 2021 · 0 comments

Comments

@adrianpdm
Copy link

adrianpdm commented Jun 30, 2021

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.

var exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant