0.1.0 • Published 7 years ago

reduxonfire v0.1.0

Weekly downloads
7
License
MIT
Repository
github
Last release
7 years ago

ReduxOnFire

Getting started

To install ReduxOnFire just go ahead and use

yarn add reduxonfire

or, if you don't use Yarn.

npm install reduxonfire

ReduxOnFire brings out the best of it's features when used alongside the - Abimis Framework.

API

ReduxOnFire is a project that contains a set of comprehensive API's that can be used in order to use Firebase alongside Redux.

Notifications

ReduxOnFire also provides a set of Notification management methods that can be used to create a custom notification manager which reacts to changes in the Redux state.

**Custom Notification manager integration docs are Work In Progress**

API reference

Auth

Realtime Database

Firebase Storage

Notifications


Auth

signup

Register a user to your platform by using an email and a password.

Params

NameTypeDescriptionRequired
emailstringThe email that the user is gonna use to sign upYes
passwordstringThe password that the user is gonna use to sign upYes

login

Logs an existing user into the platform using an email and a password.

Params

NameTypeDescriptionRequired
emailstringThe email that the user is gonna use to loginYes
passwordstringThe password that the user is gonna use to loginYes

watchAuth

Checks whether there is a signed in user in the local session.

passwordReset

Sends an email to the specified address with a link to reset the password.

Params

NameTypeDescriptionRequired
emailstringThe email that is going to receive the password resetting mailYes

facebook

Processes a user session using the Facebook identity provider. If there is no account linked to that Facebook account then a new user is created.

google

Processes a user session using the Google identity provider. If there is no account linked to that Google account then a new user is created.

logout

Terminates the current user session that's currently going on.

Realtime Database

watchRecords

Watches the records of the selected document for changes and returns the content of the document whenever it's updated.

Params

NameTypeDescriptionRequired
recordsNamestringThe name of the document that you want to watchYes
returnIdbooleanSet to true if you want the returned objects to have their id's as a key-value pairNo
reversebooleanSet to true if you want to reverse the order of the returned objectsNo

watchRecordsOrdered

Same as watchRecords but instead of returning them in a pseudorandom order, it orders them based on the specified parameter.

Params

NameTypeDescriptionRequired
recordsNamestringThe name of the document that you want to watchYes
returnIdbooleanSet to true if you want the returned objects to have their id's as a key-value pairNo
criteriastringSet to the name of the value to use as the criteria to order the returned objectsYes
reversebooleanSet to true if you want to reverse the order of the returned objectsNo

getRecordsFiltered

A method that returns the result of passing the content of a document through a custom filtering function.

Params

NameTypeDescriptionRequired
recordsNamestringThe name of the document that you want to filterYes
filterfunctionThe function that given the array of the objects of the document returns a filtered arrayYes

getRecordById

Returns a single object by searching for an object with the matching id.

Params

NameTypeDescriptionRequired
recordNamestringThe name of the document where you wanna look for the objectYes
recordIdstringThe id of the object to returnYes

getRecordByContent

Returns a single object by searching for an object with the matching content.

Params

NameTypeDescriptionRequired
recordNamestringThe name of the document where you wanna look for the objectYes
recordContentanyThe content of the object to returnYes

addRecord

Adds an object to the specified document with a pseudorandom ID and the provided content.

Params

NameTypeDescriptionRequired
recordNamestringThe name of the document where you wanna add the objectYes
recordContentanyThe content of the object to addYes

updateRecord

Updates the specified object by changing it's content from the old content to the one passed to the method.

Params

NameTypeDescriptionRequired
recordNamestringThe name of the document where you wanna update the objectYes
recordIdstringThe Id of the object that you want to updateYes
recordContentanyThe updated content of the objectYes

setRecord

Completely overrides the contents of a document by changing it with the passed content.

Params

NameTypeDescriptionRequired
recordNamestringThe name of the document that you want to overrideYes
recordContentanyThe new content of the documentYes

deleteRecord

Deletes the item that has the same Id as the one passed.

Params

NameTypeDescriptionRequired
recordNamestringThe name of the document where you want to delete an objectYes
recordIdstringThe id of the Object that has to be deletedYes

Firebase storage

uploadFile

Uploads an array of files to the specified location of the Firebase Storage.

Params

NameTypeDescriptionRequired
recordNamestringThe reference of the bucket that will be used to store the uploaded filesYes
filesArrayArray<Files> or Array<Blob>An array of File representing objects that will be uploaded to the Firebase StorageYes

deleteFile

Deletes a file by specifying it's full reference.

Params

NameTypeDescriptionRequired
recordNamestringThe reference of the bucket that stores the fileYes
fileRefstringThe name of the file that will be dleted comprehensive of it's extensionYes

Notifications

addNotification

Adds a notification to the notification manager.

Params

NameTypeDescriptionRequired
notificationObjectAn object that represents the notification that has to be added to the managerYes

removeNotification

Removes the specified notification from the manager.

Params

NameTypeDescriptionRequired
idstringThe ID of the notification that has to be removed from the managerYes

clearNotifications

Clears all of the notification that are currently displayed by the manager.