Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Unleash Client SDK for Clojure

License

NotificationsYou must be signed in to change notification settings

AppsFlyer/unleash-client-clojure

Repository files navigation

Clojars ProjectCoverage Statuscljdoc badgeBuild Status

A Clojure library wrappingunleash java client

Usage

Getting feature toggles

(require '[unleash-client-clojure.unleash:as u]         '[unleash-client-clojure.builder:as b]);; a simple client(defunleash (u/build (b/app-name"app-name") (b/unleash-api"http://unleash.herokuapp.com/api/")));; simple toggle(u/enabled? unleash"Bit");; toggle with context(require '[unleash-client-clojure.context:as c])(defuser-context (c/build (c/user-id"user-id")))(u/enabled? unleash"toggle-name" user-contextfalse);; more configuration can be passed by using the functions in the builder namespace(require '[unleash-client-clojure.builder:as b])(defunleash (u/build"app-name""instance-id""http://unleash.herokuapp.com/api/" (b/environment"staging") (b/fetch-toggles-interval15)))

Variant support

(require '[unleash-client-clojure.variant:as v])(u/get-variant unleash"DemoVariantWithPayload")(let [x (u/get-variant unleash"DemoVariantWithPayload")]  [(v/get-name x)   (v/get-type x)   (v/variant-enabled? x)   (v/get-value x)])

Advanced client config

;; the builder namespace supports passing builder confgurations as functions(require '[unleash-client-clojure.builder:as b])(defunleash (u/build               (b/app-name"app-name")               (b/unleash-api"http://unleash.herokuapp.com/api/")               (b/environment"staging")               (b/fetch-toggles-interval1)));; see the builder namespace for more available options

Subscriber support

;; one a subscriber can be pased to the client builder by passing(b/subscriber my-subscriber);; the subscriber namespace has functions to help you build a subsriber(require '[unleash-client-clojure.subscriber:as s]);; pass a map with the keys [:on-error :on-event :toggle-evaluated;; :toggles-fetched :client-metrics :client-registered :toggles-backed-up;; :toggle-backup-restored] and callbacks you want to register.;; any missing key defaults to no-op;; this is a very noisy example:(defunleash  (u/build    (b/app-name"app-name")    (b/unleash-api"http://unleash.herokuapp.com/api/")    (b/subscriber      (s/build {:on-event println})))

TODO:

  • Integration testing

About

Unleash Client SDK for Clojure

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2026 Movatter.jp