Skip to content

Latest commit

 

History

History
383 lines (253 loc) · 8.57 KB

FlagApi.md

File metadata and controls

383 lines (253 loc) · 8.57 KB

Jsflagr.FlagApi

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

Method HTTP request Description
createFlag POST /flags
deleteFlag DELETE /flags/{flagID}
findFlags GET /flags
getFlag GET /flags/{flagID}
getFlagEntityTypes GET /flags/entity_types
getFlagSnapshots GET /flags/{flagID}/snapshots
putFlag PUT /flags/{flagID}
setFlagEnabled PUT /flags/{flagID}/enabled

createFlag

Flag createFlag(body)

Example

var Jsflagr = require('jsflagr');

var apiInstance = new Jsflagr.FlagApi();

var body = new Jsflagr.CreateFlagRequest(); // CreateFlagRequest | create a flag


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

Parameters

Name Type Description Notes
body CreateFlagRequest create a flag

Return type

Flag

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteFlag

deleteFlag(flagID)

Example

var Jsflagr = require('jsflagr');

var apiInstance = new Jsflagr.FlagApi();

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


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.deleteFlag(flagID, callback);

Parameters

Name Type Description Notes
flagID Number numeric ID of the flag

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

findFlags

[Flag] findFlags(opts)

Example

var Jsflagr = require('jsflagr');

var apiInstance = new Jsflagr.FlagApi();

var opts = { 
  'limit': 789, // Number | the numbers of flags to return
  'enabled': true, // Boolean | return flags having given enabled status
  'description': "description_example", // String | return flags exactly matching given description
  'tags': "tags_example", // String | return flags with the given tags (comma separated)
  'descriptionLike': "descriptionLike_example", // String | return flags partially matching given description
  'key': "key_example", // String | return flags matching given key
  'offset': 789, // Number | return flags given the offset, it should usually set together with limit
  'preload': true // Boolean | return flags with preloaded segments and variants
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.findFlags(opts, callback);

Parameters

Name Type Description Notes
limit Number the numbers of flags to return [optional]
enabled Boolean return flags having given enabled status [optional]
description String return flags exactly matching given description [optional]
tags String return flags with the given tags (comma separated) [optional]
descriptionLike String return flags partially matching given description [optional]
key String return flags matching given key [optional]
offset Number return flags given the offset, it should usually set together with limit [optional]
preload Boolean return flags with preloaded segments and variants [optional]

Return type

[Flag]

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getFlag

Flag getFlag(flagID)

Example

var Jsflagr = require('jsflagr');

var apiInstance = new Jsflagr.FlagApi();

var flagID = 789; // Number | numeric ID of the flag to get


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

Parameters

Name Type Description Notes
flagID Number numeric ID of the flag to get

Return type

Flag

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getFlagEntityTypes

['String'] getFlagEntityTypes()

Example

var Jsflagr = require('jsflagr');

var apiInstance = new Jsflagr.FlagApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getFlagEntityTypes(callback);

Parameters

This endpoint does not need any parameter.

Return type

['String']

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getFlagSnapshots

[FlagSnapshot] getFlagSnapshots(flagID)

Example

var Jsflagr = require('jsflagr');

var apiInstance = new Jsflagr.FlagApi();

var flagID = 789; // Number | numeric ID of the flag to get


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

Parameters

Name Type Description Notes
flagID Number numeric ID of the flag to get

Return type

[FlagSnapshot]

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

putFlag

Flag putFlag(flagID, body)

Example

var Jsflagr = require('jsflagr');

var apiInstance = new Jsflagr.FlagApi();

var flagID = 789; // Number | numeric ID of the flag to get

var body = new Jsflagr.PutFlagRequest(); // PutFlagRequest | update a flag


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

Parameters

Name Type Description Notes
flagID Number numeric ID of the flag to get
body PutFlagRequest update a flag

Return type

Flag

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

setFlagEnabled

Flag setFlagEnabled(flagID, body)

Example

var Jsflagr = require('jsflagr');

var apiInstance = new Jsflagr.FlagApi();

var flagID = 789; // Number | numeric ID of the flag to get

var body = new Jsflagr.SetFlagEnabledRequest(); // SetFlagEnabledRequest | set flag enabled state


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

Parameters

Name Type Description Notes
flagID Number numeric ID of the flag to get
body SetFlagEnabledRequest set flag enabled state

Return type

Flag

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json