(as-map config)
If a string, will coerce as edn. If given a map, will return it unchanged.
If a string, will coerce as edn. If given a map, will return it unchanged.
(find-config)
Looks for HAPPYAPI_CONFIG in the environment, then a file happyapi.edn, then happyapi.edn resource, else nil
Looks for HAPPYAPI_CONFIG in the environment, then a file happyapi.edn, then happyapi.edn resource, else nil
(make-client config provider)
Returns a function that can make requests to an api.
If config
is nil, will attempt to find edn config in the environment HAPPYAPI_CONFIG,
or a file happyapi.edn
If specified, config
should be a map:
{:google {:deps [:clj-http :cheshire] ;; see happyapi.deps for alternatives
:fns {...} ;; if you prefer to provide your own dependencies
:client_id "MY_ID" ;; oauth2 client_id of your app
:client_secret "MY_SECRET" ;; oauth2 client_secret from your provider
:apikey "MY_API_KEY" ;; only when not using oauth2
:scopes [] ;; optional default scopes used when none present in requests
:keywordize-keys false ;; optional, defaults to true
:provider :google}} ;; optional, use another provider urls and settings
The provider
argument is required and should match a top level key to use (other configs may be present).
Returns a function that can make requests to an api. If `config` is nil, will attempt to find edn config in the environment HAPPYAPI_CONFIG, or a file happyapi.edn If specified, `config` should be a map: {:google {:deps [:clj-http :cheshire] ;; see happyapi.deps for alternatives :fns {...} ;; if you prefer to provide your own dependencies :client_id "MY_ID" ;; oauth2 client_id of your app :client_secret "MY_SECRET" ;; oauth2 client_secret from your provider :apikey "MY_API_KEY" ;; only when not using oauth2 :scopes [] ;; optional default scopes used when none present in requests :keywordize-keys false ;; optional, defaults to true :provider :google}} ;; optional, use another provider urls and settings The `provider` argument is required and should match a top level key to use (other configs may be present).
(prepare-config provider config)
Prepares configuration by resolving dependencies. Checks that the necessary configuration is present, throws an exception if not. See docstring for make-client for typical configuration inputs.
Prepares configuration by resolving dependencies. Checks that the necessary configuration is present, throws an exception if not. See docstring for make-client for typical configuration inputs.
(with-deps {:as config :keys [deps fns]})
Selection of implementation functions for http and json, based on either the :deps or :fns of the config.
Selection of implementation functions for http and json, based on either the :deps or :fns of the config.
cljdoc builds & hosts documentation for Clojure/Script libraries
Ctrl+k | Jump to recent docs |
← | Move to previous article |
→ | Move to next article |
Ctrl+/ | Jump to the search field |