Skip to content

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

@adrianpdm

Description

@adrianpdm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions