firemore.core

clj->fire

(clj->fire document)
Returns a javascript object from the firemore `document` (a clojure map).

commit-batch!

create-batch

delete!

(delete! reference & [options])
Deletes the document at `reference` within the Firestore database.

Returns a channel. Iff an error occurs when deleting reference from Firestore,
then the error will be put upon the channel. The channel will then be closed.

Note:
channel -> `clojure.core.async/chan`
put     -> `clojure.core.async/put!`
closed  -> `clojure.core.async/close!`

delete-user!

(delete-user!)
Deletes the currently logged in user from Firestore.

This removes all sign-in providers for this user, as well as deleting the data in the
user information map returned by (get-user-atom). Note that this does NOT delete
information relating to the user from the actual Firestore database.

fire->clj

(fire->clj js-object)
Returns the clojure form of the `js-object` document from Firestore.

get

(get reference & [options])
Get the document at `reference` in the Firestore database.

Returns a channel. A map representing the data at this location will be put
on this channel. The channel will then be closed.

Note:
channel -> `clojure.core.async/chan`
put    -> `clojure.core.async/put!`
closed  -> `clojure.core.async/close!`

initialize

login-anonymously!

(login-anonymously!)

logout!

(logout!)

merge!

(merge! reference document & [options])
Merges `document` into the document at `reference` within the Firestore database.

Returns a channel. Updates (merges) the document at `reference` with `document`.
Iff an error occurs when writing `document` to Firestore, then the error will be put
upon the channel. The channel will then be closed.

Note:
channel -> `clojure.core.async/chan`
put     -> `clojure.core.async/put!`
closed  -> `clojure.core.async/close!`

push!

(push! reference document & [options])
Adds the `document` to collection `reference` within the Firestore database.

Returns a channel. Creates a new id for `document`. Either
{:id <document-id>} or {:error <error-msg>} will then be placed upon the
channel. The channel will then be closed.

supported-types

throw-if-unsupported

(throw-if-unsupported m)

transact!

(transact! update-fx)

uid

(uid)
Returns a channel that will have a uid put! upon it'

If you are currently logged in, uid will be the uid of the currently logged
in user. If you are not currently logged in, client will login with the
anonymous user, and then the uid will be the uid of the anonymous user.

Note:
channel -> `clojure.core.async/chan`
put!    -> `clojure.core.async/put!`

unwatch!

(unwatch! atm path)
Remove the `path` from the `atm`

unwatch-user

(unwatch-user atm)
Removes functionality on `atm` that may have been added by `watch-user`

user

(user)
Returns the last value returned from user-chan.

user-atom

(user-atom)
Return the atom that reflects the state of currently logged in user

user-chan

(user-chan)
Returns a channel. Will put! user map or :firemore/no-user as user state changes..

  {:uid <application_unique_id>
   :email <user_email_address>
   :name <user_identifier>
   :photo <url_to_a_photo_for_this_user>}

Note: :uid will always be present. :email, :name, :photo may be present depending
on sign-in provider and/or whether you have set their values.

watch

(watch reference & [options])
Watch the document at `reference` in the Firestore database.

Returns a channel. A map representing the data at this location will be put
on this channel. As the document at reference is updated through time, the
channel will put! the newest value of the document upon the channel.

Important: close! the channel to clean up the state machine feeding this
channel. Failure to close the channel will result in a memory leak.

Note:
channel -> `clojure.core.async/chan`
put     -> `clojure.core.async/put!`
closed  -> `clojure.core.async/close!`

watch!

(watch! atm reference path)
Sync the current value of `reference` at `path` within the `atm`

atm - A clojure atom.
path - a vector location within the `atm` where the Firestore `reference` will be written.
reference - a reference to a location in Firestore.

Note that the the {path reference} will show up under the :firemore key, and the
{path reference-value} will show up under the :firemore key in `atm`.

watch-user

(watch-user atm)
Add functionality to atom `atm` so that `:user` reflects latest value from `get-user`

write!

(write! reference document & [options])
Writes the `document` to `reference` within the Firestore database.

Returns a channel. Overwrites the document at `reference` with `document`.
Iff an error occurs when writing document to Firestore, then the error will
be put upon the channel. The channel will then be closed.

Note:
channel -> `clojure.core.async/chan`
put     -> `clojure.core.async/put!`
closed  -> `clojure.core.async/close!`