Skip to content

Cloud Functions

Nicolò Santilio edited this page Jun 15, 2022 · 7 revisions

Contents on this page:


Class Table

Class Description
FirebaseFunctions Cloud Functions module, lets user execute cloud function through Rest API interface.
FunctionTask Result of any request issued through Cloud Functions. Processes the request, emits signals and returns a result.


Firestore

Firebase.Firestore

Functions Description
collection(collection_path : String) -> FirestoreCollection Create a reference to a collection inside Firestore. Returns a reference to a collection.
list(collection_path : String) -> FirestoreTask List all contents of a collection in Firestore.
Returns a FirestoreTask issuing the request.
query(firestore_query : FirestoreQuery) -> FirestoreTask Issue a query on Firestore.
Returns a FirestoreTask issuing the request.

Properties Description
collections : Dictionary A Dictionary containing all referenced collections.
auth : Dictionary A Dictionary containing all auth info for the current authenticated user.

Signals Description
listed_documents(documents : Array) Emitted when the list() request is processed successfully by a FirestoreTask.
result_query(result : Array) Emitted when the query() request is processed successfully by a FirestoreTask.
error(error : Dictionary) Emitted when a query() or list() request is not processed successfully by a FirestoreTask.

***

FirestoreTask

returned by a Firestore request

Functions Description

Properties Description
data : Variant Contains the result of a processed Task.
action : int Contains the action the task is processing or has processed.

Signals Description
task_finished(result : Variant) Emitted when a Task has been processed. Returns the result of the request as a parameter. This is a lower level of signal communication between FirestoreTasks, Firestore and your application.
listed_documents(documents : Array) Emitted when the list() request is processed successfully.
result_query(result : Array) Emitted when the query() request is processed successfully.
error(error : Dictionary) Emitted when a query() or list() request is not processed successfully.
add_document(document_added : FirestoreDocument) Emitted when the add() request is processed.
update_document(document_updated : FirestoreDocument) Emitted when the update() request is processed.
get_document(document_got : FirestoreDocument) Emitted when the get() request is processed.
delete_document() Emitted when the delete() request is processed.
error(code, status, message) Emitted when a request has not processed correctly.

***

Back


Connect To A Collection

Note you need to be authenticated for this to work

Firebase.Firestore.collection('COLLECTION_NAME')

The following will return a collection from Firestore called firestore_collection. This collection can be called on later when adding or getting documents from it.

var firestore_collection : FirestoreCollection = Firebase.Firestore.collection('COLLECTION_NAME')

Back


Turn Off Local Cache

If you need to disable the local cache of the Firebase Plugin, you will need to change the following line in the firestore.gd file to false

addons > godot-firebase > firestore > firestore.gd

var persistence_enabled : bool = false

Back


Back

Clone this wiki locally