lib/eco/api/session.rb in eco-helpers-2.5.10 vs lib/eco/api/session.rb in eco-helpers-2.6.0

- old
+ new

@@ -37,17 +37,32 @@ # @see Eco::API::Session::Config#login_providers def login_providers config.login_providers end + # @param live [Boolean] states preference of `live` tree if available over file. + # @param merge [Boolean] when in `live` mode, if mulitple trees, merge into one. # @see Eco::API::Session::Config#tagtree - def tagtree - config.tagtree(enviro: enviro) + # @see Eco::API::Session#live_trees + # @return [Eco::API::Organization::TagTree] + def tagtree(live: false, merge: false, include_archived: false, **kargs, &block) + if live && api?(version: :graphql) + return live_tree(include_archived: include_archived, **kargs, &block) unless merge + live_trees(include_archived: include_archived, **kargs, &block).inject(&:merge) + else + config.tagtree(enviro: enviro) + end end # @see Eco::API::Session::Config#live_tree + # @return [Eco::API::Organization::TagTree] def live_tree(id: nil, include_archived: false, **kargs, &block) config.live_tree(id: id, include_archived: include_archived, enviro: enviro, **kargs, &block) + end + + # @see Eco::API::Session::Config#live_tree + def live_trees(include_archived: false, **kargs, &block) + config.live_trees(include_archived: include_archived, **kargs, &block) end # @see Eco::API::Session::Config#schemas def schemas config.schemas