An open API service indexing awesome lists of open source software.

https://github.com/openflagr/jsflagr


https://github.com/openflagr/jsflagr

Last synced: 10 months ago
JSON representation

Awesome Lists containing this project

README

          

# jsflagr

Jsflagr - JavaScript client for jsflagr
Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\".
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: 1.1.10
- Package version: 1.1.10
- Build package: io.swagger.codegen.languages.JavascriptClientCodegen

## Installation

### For [Node.js](https://nodejs.org/)

#### npm

To publish the library as a [npm](https://www.npmjs.com/),
please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).

Then install it via:

```shell
npm install jsflagr --save
```

##### Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run:

```shell
npm install
```

Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:

```shell
npm link
```

Finally, switch to the directory you want to use your jsflagr from, and run:

```shell
npm link /path/to/
```

You should now be able to `require('jsflagr')` in javascript files from the directory you ran the last
command above from.

#### git
#
If the library is hosted at a git repository, e.g.
https://github.com/GIT_USER_ID/GIT_REPO_ID
then install it via:

```shell
npm install GIT_USER_ID/GIT_REPO_ID --save
```

### For browser

The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
the above steps with Node.js and installing browserify with `npm install -g browserify`,
perform the following (assuming *main.js* is your entry file, that's to say your javascript file where you actually
use this library):

```shell
browserify main.js > bundle.js
```

Then include *bundle.js* in the HTML pages.

### Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error:
Cannot resolve module", most certainly you should disable AMD loader. Add/merge
the following section to your webpack config:

```javascript
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
```

## Getting Started

Please follow the [installation](#installation) instruction and execute the following JS code:

```javascript
var Jsflagr = require('jsflagr');

var api = new Jsflagr.ConstraintApi()

var flagID = 789; // {Number} numeric ID of the flag

var segmentID = 789; // {Number} numeric ID of the segment

var body = new Jsflagr.CreateConstraintRequest(); // {CreateConstraintRequest} create a constraint

var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.createConstraint(flagID, segmentID, body, callback);

```

## Documentation for API Endpoints

All URIs are relative to *http://localhost/api/v1*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*Jsflagr.ConstraintApi* | [**createConstraint**](docs/ConstraintApi.md#createConstraint) | **POST** /flags/{flagID}/segments/{segmentID}/constraints |
*Jsflagr.ConstraintApi* | [**deleteConstraint**](docs/ConstraintApi.md#deleteConstraint) | **DELETE** /flags/{flagID}/segments/{segmentID}/constraints/{constraintID} |
*Jsflagr.ConstraintApi* | [**findConstraints**](docs/ConstraintApi.md#findConstraints) | **GET** /flags/{flagID}/segments/{segmentID}/constraints |
*Jsflagr.ConstraintApi* | [**putConstraint**](docs/ConstraintApi.md#putConstraint) | **PUT** /flags/{flagID}/segments/{segmentID}/constraints/{constraintID} |
*Jsflagr.DistributionApi* | [**findDistributions**](docs/DistributionApi.md#findDistributions) | **GET** /flags/{flagID}/segments/{segmentID}/distributions |
*Jsflagr.DistributionApi* | [**putDistributions**](docs/DistributionApi.md#putDistributions) | **PUT** /flags/{flagID}/segments/{segmentID}/distributions |
*Jsflagr.EvaluationApi* | [**postEvaluation**](docs/EvaluationApi.md#postEvaluation) | **POST** /evaluation |
*Jsflagr.EvaluationApi* | [**postEvaluationBatch**](docs/EvaluationApi.md#postEvaluationBatch) | **POST** /evaluation/batch |
*Jsflagr.ExportApi* | [**getExportEvalCacheJSON**](docs/ExportApi.md#getExportEvalCacheJSON) | **GET** /export/eval_cache/json |
*Jsflagr.ExportApi* | [**getExportSqlite**](docs/ExportApi.md#getExportSqlite) | **GET** /export/sqlite |
*Jsflagr.FlagApi* | [**createFlag**](docs/FlagApi.md#createFlag) | **POST** /flags |
*Jsflagr.FlagApi* | [**deleteFlag**](docs/FlagApi.md#deleteFlag) | **DELETE** /flags/{flagID} |
*Jsflagr.FlagApi* | [**findFlags**](docs/FlagApi.md#findFlags) | **GET** /flags |
*Jsflagr.FlagApi* | [**getFlag**](docs/FlagApi.md#getFlag) | **GET** /flags/{flagID} |
*Jsflagr.FlagApi* | [**getFlagEntityTypes**](docs/FlagApi.md#getFlagEntityTypes) | **GET** /flags/entity_types |
*Jsflagr.FlagApi* | [**getFlagSnapshots**](docs/FlagApi.md#getFlagSnapshots) | **GET** /flags/{flagID}/snapshots |
*Jsflagr.FlagApi* | [**putFlag**](docs/FlagApi.md#putFlag) | **PUT** /flags/{flagID} |
*Jsflagr.FlagApi* | [**setFlagEnabled**](docs/FlagApi.md#setFlagEnabled) | **PUT** /flags/{flagID}/enabled |
*Jsflagr.HealthApi* | [**getHealth**](docs/HealthApi.md#getHealth) | **GET** /health |
*Jsflagr.SegmentApi* | [**createSegment**](docs/SegmentApi.md#createSegment) | **POST** /flags/{flagID}/segments |
*Jsflagr.SegmentApi* | [**deleteSegment**](docs/SegmentApi.md#deleteSegment) | **DELETE** /flags/{flagID}/segments/{segmentID} |
*Jsflagr.SegmentApi* | [**findSegments**](docs/SegmentApi.md#findSegments) | **GET** /flags/{flagID}/segments |
*Jsflagr.SegmentApi* | [**putSegment**](docs/SegmentApi.md#putSegment) | **PUT** /flags/{flagID}/segments/{segmentID} |
*Jsflagr.SegmentApi* | [**putSegmentsReorder**](docs/SegmentApi.md#putSegmentsReorder) | **PUT** /flags/{flagID}/segments/reorder |
*Jsflagr.TagApi* | [**createTag**](docs/TagApi.md#createTag) | **POST** /flags/{flagID}/tags |
*Jsflagr.TagApi* | [**deleteTag**](docs/TagApi.md#deleteTag) | **DELETE** /flags/{flagID}/tags/{tagID} |
*Jsflagr.TagApi* | [**findAllTags**](docs/TagApi.md#findAllTags) | **GET** /tags |
*Jsflagr.TagApi* | [**findTags**](docs/TagApi.md#findTags) | **GET** /flags/{flagID}/tags |
*Jsflagr.VariantApi* | [**createVariant**](docs/VariantApi.md#createVariant) | **POST** /flags/{flagID}/variants |
*Jsflagr.VariantApi* | [**deleteVariant**](docs/VariantApi.md#deleteVariant) | **DELETE** /flags/{flagID}/variants/{variantID} |
*Jsflagr.VariantApi* | [**findVariants**](docs/VariantApi.md#findVariants) | **GET** /flags/{flagID}/variants |
*Jsflagr.VariantApi* | [**putVariant**](docs/VariantApi.md#putVariant) | **PUT** /flags/{flagID}/variants/{variantID} |

## Documentation for Models

- [Jsflagr.Constraint](docs/Constraint.md)
- [Jsflagr.CreateConstraintRequest](docs/CreateConstraintRequest.md)
- [Jsflagr.CreateFlagRequest](docs/CreateFlagRequest.md)
- [Jsflagr.CreateSegmentRequest](docs/CreateSegmentRequest.md)
- [Jsflagr.CreateTagRequest](docs/CreateTagRequest.md)
- [Jsflagr.CreateVariantRequest](docs/CreateVariantRequest.md)
- [Jsflagr.Distribution](docs/Distribution.md)
- [Jsflagr.Error](docs/Error.md)
- [Jsflagr.EvalContext](docs/EvalContext.md)
- [Jsflagr.EvalDebugLog](docs/EvalDebugLog.md)
- [Jsflagr.EvalResult](docs/EvalResult.md)
- [Jsflagr.EvaluationBatchRequest](docs/EvaluationBatchRequest.md)
- [Jsflagr.EvaluationBatchResponse](docs/EvaluationBatchResponse.md)
- [Jsflagr.EvaluationEntity](docs/EvaluationEntity.md)
- [Jsflagr.Flag](docs/Flag.md)
- [Jsflagr.FlagSnapshot](docs/FlagSnapshot.md)
- [Jsflagr.Health](docs/Health.md)
- [Jsflagr.PutDistributionsRequest](docs/PutDistributionsRequest.md)
- [Jsflagr.PutFlagRequest](docs/PutFlagRequest.md)
- [Jsflagr.PutSegmentReorderRequest](docs/PutSegmentReorderRequest.md)
- [Jsflagr.PutSegmentRequest](docs/PutSegmentRequest.md)
- [Jsflagr.PutVariantRequest](docs/PutVariantRequest.md)
- [Jsflagr.Segment](docs/Segment.md)
- [Jsflagr.SegmentDebugLog](docs/SegmentDebugLog.md)
- [Jsflagr.SetFlagEnabledRequest](docs/SetFlagEnabledRequest.md)
- [Jsflagr.Tag](docs/Tag.md)
- [Jsflagr.Variant](docs/Variant.md)

## Documentation for Authorization

All endpoints do not require authorization.