Skip to content

samcschneider/yaas-essentials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yaas-essentials

Getting Started

From within YaaS.io:

Next...

  • Clone this repo
  • Update network.cljs with your client ID and client Secret (obtainable from the yaas.io builder UI)
  • Change the tenant to your project id / tenant in product.cljs
  • Run lein figwheel from the root of this project. This should open up a browser, if not go to: http://localhost:3449/cards.html#!/yaas_essentials.core

Fun things you can do within the Clojurescript repl (launches with lein figwheel)

    (in-ns 'yaas-essentials.product-ui-state)
    
    ;; define a few inspection helper functions

    (require 'cljs.pprint)
    
    (defn p[o] (cjjs.pprint/pprint o))

    (defn pc[o] (.log js/console (with-out-str (cljs.pprint/pprint o))))
    
    ;; print latest result from product call
    (p @product)
    
    ;; print to javascript console
    (pc @product)
    
    ;; after fetching products, you can inspect them and extract various components
    (map (comp :description :product) (get-in @product [:response :body]))
    
    ;; alternatively, save this value and print it to the console (or do something else with it...)
    (def last-products-descriptions (map (comp :description :product) (get-in @product [:response :body])))
    
    (pc last-products-descriptions)
    
    ;; you can also inspect other namespaces
    
    (require '[yaas-essentials.network :as ynet])
    
    (p ynet/token-url)
    
    (p @ynet/bearer)
    
    ;; or just evaluate a symbol from the prompt
    
    @ynet/bearer
    
    ;; you can evaluate symbols which invoke functions, of course!
    
    (require '[yaas-essentials.product :as prod])
    
    (:scopes prod/product-config)
    
    ;; now ask for a new token
    
    (def last-token @ynet/bearer)
    (ynet/renew-token (:scopes prod/product-config) #())
    
    ;; verify that your token is now different
    (p last-token)
    
    ;; remember: the call to renew-token is async and the bearer make take a moment to contain the new value
    (p @ynet/bearer)
    

About

Sample Clojurescript client code for interacting with YaaS (https://yaas.io)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors