firebase

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

README

Kubemq firebase target Connector

Kubemq gcp-firebase target connector allows services using kubemq server to access google firebase server.

Prerequisites

The following required to run the gcp-firebase target connector:

  • kubemq cluster
  • gcp-firebase set up
  • kubemq-targets deployment

Configuration

firebase target connector configuration properties:

Properties Key Required Description Example
project_id yes gcp firebase project_id "/myproject"
credentials yes gcp credentials files "<google json credentials"
db_client no initialize db client if true true/false
db_url no gcp db full path <google db url"
auth_client no initialize auth client if true true/false
messaging_client no initialize messaging client true/false
defaultmsg no default Firebase Cloud Messaging json
defaultmultimsg no default Firebase Cloud MulticastMessage json

*defaultmsg - can be used for common message settings *defaultmultimsg - can be used for common message settings

Example:

bindings:
  - name: kubemq-query-gcp-firebase
    source:
      kind: kubemq.query
      name: kubemq-query
      properties:
        address: "kubemq-cluster:50000"
        client_id: "kubemq-query-gcp-firebase-connector"
        auth_token: ""
        channel: "query.gcp.firebase"
        group:   ""
        auto_reconnect: "true"
        reconnect_interval_seconds: "1"
        max_reconnects: "0"
    target:
      kind: gcp.firebase
      name: gcp-firebase
      properties:
        project_id: "project_id"
        credentials: 'json'
        db_client: "true"
        db_url: "db_url"
        auth_client: "true"

Usage

##DB:

Get DB

Get DB metadata setting:

Metadata Key Required Description Possible values
method yes method type get_db
ref_path yes ref path for the data valid string
child_ref no path for child ref data valid string

Example:

{
  "metadata": {
    "method": "get_db",
    "ref_path": "string"
  },
  "data": null
}
Set DB

Set DB metadata setting:

Metadata Key Required Description Possible values
method yes method type set_db
ref_path yes ref path for the data valid string
child_ref no path for child ref data valid string

Example:

{
  "metadata": {
    "method": "get_db",
    "ref_path": "string"
  },
  "data": null
}
Update DB

Update DB metadata setting:

Metadata Key Required Description Possible values
method yes method type update_db
ref_path yes ref path for the data valid string
child_ref no path for child ref data valid string

Example:

{
  "metadata": {
    "method": "delete_db",
    "ref_path": "string"
  },
  "data": "updated_string"
}
Delete DB

Kubemq firebase target Connector

Kubemq gcp-firebase target connector allows services using kubemq server to access google firebase server.

Prerequisites

The following required to run the gcp-firebase target connector:

  • kubemq cluster
  • gcp-firebase set up
  • kubemq-targets deployment

Configuration

firebase target connector configuration properties:

Properties Key Required Description Example
project_id yes gcp firebase project_id "/myproject"
credentials yes gcp credentials files "<google json credentials"
db_client no initialize db client if true true/false
db_url no gcp db full path <google db url"
auth_client no initialize auth client if true true/false
messaging_client no initialize messaging client true/false
defaultmsg no default Firebase Cloud Messaging json
defaultmultimsg no default Firebase Cloud MulticastMessage json

*defaultmsg - can be used for common message settings *defaultmultimsg - can be used for common message settings

Example:

bindings:
  - name: kubemq-query-gcp-firebase
    source:
      kind: kubemq.query
      name: kubemq-query
      properties:
        address: "kubemq-cluster:50000"
        client_id: "kubemq-query-gcp-firebase-connector"
        auth_token: ""
        channel: "query.gcp.firebase"
        group:   ""
        auto_reconnect: "true"
        reconnect_interval_seconds: "1"
        max_reconnects: "0"
    target:
      kind:gcp.firebase
      name: gcp-firebase
      properties:
        project_id: "project_id"
        credentials: 'json'
        db_client: "true"
        db_url: "db_url"
        auth_client: "true"

Usage

##DB:

Get DB

Get DB metadata setting:

Metadata Key Required Description Possible values
method yes method type get_db
ref_path yes ref path for the data valid string
child_ref no path for child ref data valid string

Example:

{
  "metadata": {
    "method": "get_db",
    "ref_path": "string"
  },
  "data": null
}
Set DB

Set DB metadata setting:

Metadata Key Required Description Possible values
method yes method type set_db
ref_path yes ref path for the data valid string
child_ref no path for child ref data valid string

Example:

{
  "metadata": {
    "method": "get_db",
    "ref_path": "string"
  },
  "data": null
}
Update DB

Update DB metadata setting:

Metadata Key Required Description Possible values
method yes method type update_db
ref_path yes ref path for the data valid string
child_ref no path for child ref data valid string

Example:

{
  "metadata": {
    "method": "update_db",
    "ref_path": "string"
  },
  "data": "dXBkYXRlIGRiIHN0cmluZw=="
}
Delete DB

Delete DB metadata setting:

Metadata Key Required Description Possible values
method yes method type delete_db
ref_path yes ref path for the data valid string
child_ref no path for child ref data valid string

Example:

{
  "metadata": {
    "method": "delete_db",
    "ref_path": "string"
  },
  "data": null
}

User:

Create User

Create User metadata setting:

Metadata Key Required Description Possible values
method yes method type create_user

Example:

{
  "metadata": {
    "method": "create_user"
  },
  "data": "eyJlbWFpbCI6IkpvaG5AZHVlLmNvbSIsICJwYXNzd29yZCI6MzAsICJkaXNwbGF5X25hbWUiOiJKb2huIn0="
}
Retrieve User

Retrieve User metadata setting:

Metadata Key Required Description Possible values
method yes method type retrieve_user
retrieve_by yes type of retrieval by_email ,by_uid,by_phone
uid no valid unique string string
phone no valid phone number string
email no valid email string

Example:

{
  "metadata": {
    "method": "retrieve_user",
    "retrieve_by": "uid",
    "uid": "1223131"
  },
  "data": null
}
Delete User

Delete User metadata setting:

Metadata Key Required Description Possible values
method yes method type delete_user
uid yes valid unique string string

Example:

{
  "metadata": {
    "method": "delete_user",
    "uid": "1223131"
  },
  "data": null
}
Delete Multiple Users

Delete Multiple Users metadata setting:

Metadata Key Required Description Possible values
method yes method type delete_multiple_users

Example:

{
  "metadata": {
    "method": "delete_multiple_users"
  },
  "data": "WyAidXNlcjEiLCAidXNlcjIiLCAidXNlcjMiIF0="
}
Update User

Update User metadata setting:

Metadata Key Required Description Possible values
method yes method type update_user
uid yes valid unique string string

Example:

{
  "metadata": {
    "method": "update_user",
    "uid": "1223131"
  },
  "data": "eyJlbWFpbCI6IkpvaG5AZHVlLmNvbSIsICJwYXNzd29yZCI6MzAsICJkaXNwbGF5X25hbWUiOiJKb2huIn0="
}
List Users

List User metadata setting:

Metadata Key Required Description Possible values
method yes method type list_users

Example:

{
  "metadata": {
    "method": "list_users"
  },
  "data": null
}

Token:

Custom Token

Custom Token metadata setting:

Metadata Key Required Description Possible values
method yes method type custom_token
uid yes valid unique string string

Example:

{
  "metadata": {
    "method": "custom_token",
    "token_id": "some-uid"
  },
  "data": null
}
Verify Token

Verify Token metadata setting:

Metadata Key Required Description Possible values
method yes method type verify_token
uid yes valid unique string string

Example:

{
  "metadata": {
    "method": "verify_token",
    "token_id": "some-uid"
  },
  "data": null
}

Messaging:

Firebase messaging will send a FCM message or send the message to multiple devices.

Send Message

Create User metadata setting:

Metadata Key Required Description Possible values
method yes method type send_message/send_multi

Example: send_message

{
  "metadata": {
    "method": "send_message"
  },
  "data": "ewoiVG9waWMiOiJ0ZXN0IiwKImRhdGEiOiB7ImtleTEiOiJ2YWx1ZTEifQp9"
}

* data value is base64  {
  "Topic":"test",
  "data": {"key1":"value1"}
  }

Example: send_multi

{
  "metadata": {
    "method": "send_multi"
  },
  "data": "ewogICAgInRvcGljIjoiYXBwIHRvcGljIiwKICAgICAiZGF0YSI6eyJUb2tlbnMiOlsiMTIzIiwiNDU2Il0sIkRhdGEiOnsia2V5IjoidmFsIn0sIk5vdGlmaWNhdGlvbiI6eyJ0aXRsZSI6InRpdGxlIn19CiB9"
}

* data value is base64  {
    "topic":"app_topic",
     "data":{"Tokens":["123","456"],"Data":{"key":"val"},"Notification":{"title":"title"}}
  }

Documentation

Index

Constants

View Source
const (
	Unassigned  = iota // c0 == 0
	SendMessage = iota // c1 == 1
	SendBatch   = iota // c2 == 2
)

Variables

This section is empty.

Functions

func Connector

func Connector() *common.Connector

func DeepCopy

func DeepCopy(a, b interface{}) error

DeepCopy deepcopies a to b using json marshaling

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New() *Client

func (*Client) Connector

func (c *Client) Connector() *common.Connector

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *types.Request) (*types.Response, error)

func (*Client) Init

func (c *Client) Init(ctx context.Context, cfg config.Spec, log *logger.Logger) error

func (*Client) Stop

func (c *Client) Stop() error

Jump to

Keyboard shortcuts

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