firebase

package module
v0.0.0-...-36ff2a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {

	//Connect - init all the requires clients
	Connect(
		ctx context.Context,
		jsonAdminPath string,
	) error

	//GetFirestoreClient - return the firestore client
	GetFirestoreClient() *firestore.Client

	//GetAuthClient - return the auth client
	GetAuthClient() *auth.Client

	//GetMessagingClient - return the messaging client
	GetMessagingClient() *messaging.Client

	//FirestoreDocExists checks if the doc exists
	FirestoreDocExists(
		ctx context.Context,
		collection string,
		docID string,
	) (bool, error)

	//FirestoreGet - get a document from collection and ID
	FirestoreGet(
		ctx context.Context,
		collection string,
		docID string,
	) (map[string]interface{}, error)

	//FirestoreGetType - get a document from collection and ID into a typed param
	FirestoreGetType(
		ctx context.Context,
		collection string,
		docID string,
		dataTo interface{},
	) error

	//FirestoreSet - Set a document given collection and ID
	FirestoreSet(
		ctx context.Context,
		collection,
		docID string,
		data map[string]interface{},
		merge bool,
	) error

	//FirestoreSet - Set a document given collection and ID
	FirestoreSetType(
		ctx context.Context,
		collection,
		docID string,
		dataTo interface{},
		merge bool,
	) error

	//SendMessageTopic - Send message on topic
	SendMessageTopic(
		ctx context.Context,
		topic string,
		data map[string]string,
	) error

	//VerifyToken - verify auth token
	VerifyToken(
		ctx context.Context,
		token string,
	) (string, error)

	//ListenQueryAsync - listen for query updates
	ListenQueryAsync(
		ctx context.Context,
		collection string,
		path string,
		operation string,
		value interface{},
		Listener QueryListener,
	) error
}

Client - The client interface with all implemented requests and subs ~WIP

func NewFirebaseClient

func NewFirebaseClient(firestore, auth, messaging bool) Client

NewFirebaseClient - return a new firebase client, call Connect after creation

type NoUIDFoundErr

type NoUIDFoundErr struct {
}

NoUIDFoundErr - No uid found after token verification

func (*NoUIDFoundErr) Error

func (e *NoUIDFoundErr) Error() string

type QueryListener

type QueryListener func(update *QueryUpdate, err error)

QueryListener - listen for query updates rends a response or an error

type QueryUpdate

type QueryUpdate struct {
	Update *firestore.QuerySnapshot
}

QueryUpdate -

type UnexpectedUseAuthErr

type UnexpectedUseAuthErr struct {
}

UnexpectedUseAuthErr - Attempt at using auth without initialization pass the param auth = true on Connect

func (*UnexpectedUseAuthErr) Error

func (e *UnexpectedUseAuthErr) Error() string

type UnexpectedUseFirestoreErr

type UnexpectedUseFirestoreErr struct {
}

UnexpectedUseFirestoreErr - Attempt at using firebase without initialization pass the param firebase = true on Connect

func (*UnexpectedUseFirestoreErr) Error

func (e *UnexpectedUseFirestoreErr) Error() string

type UnexpectedUseMessagingErr

type UnexpectedUseMessagingErr struct {
}

UnexpectedUseMessagingErr - Attempt at using messaging without initialization pass the param messaging = true on Connect

func (*UnexpectedUseMessagingErr) Error

func (e *UnexpectedUseMessagingErr) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL