Skip to content

Commit

Permalink
Merge pull request #1097 from firebase/eg-itag-callable
Browse files Browse the repository at this point in the history
Adding snippet tags for callable and task queue sample imports
  • Loading branch information
egilmorez authored Aug 16, 2023
2 parents 385ab5e + 753b552 commit 3313875
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
7 changes: 6 additions & 1 deletion Node/quickstarts/callable-functions/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@
* limitations under the License.
*/

// [START imports]
// Dependencies for callable functions.
const {onCall, HttpsError} = require("firebase-functions/v2/https");
const {getDatabase} = require("firebase-admin/database");
const {logger} = require("firebase-functions/v2");

// Dependencies for the addMessage function.
const {getDatabase} = require("firebase-admin/database");
const sanitizer = require("./sanitizer");
// [END imports]

// [START v2allAdd]
// [START v2addFunctionTrigger]
Expand Down
14 changes: 9 additions & 5 deletions Node/taskqueues-backup-images/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@
* limitations under the License.
*/
"use strict";
const path = require("path");
const fetch = require("node-fetch");
const functions = require("firebase-functions");
// [START imports]
// Dependencies for task queue functions.
const {onTaskDispatched} = require("firebase-functions/v2/tasks");
const {onRequest} = require("firebase-functions/v2/https");
const {initializeApp} = require("firebase-admin/app");
const {getFunctions} = require("firebase-admin/functions");
const {logger} = require("firebase-functions/v2");

// Dependencies for image backup.
const path = require("path");
const fetch = require("node-fetch");
const {initializeApp} = require("firebase-admin/app");
const {getStorage} = require("firebase-admin/storage");
const {GoogleAuth} = require("google-auth-library");
const logger = functions.logger;
const HttpsError = functions.https.HttpsError;
// [END imports]
initializeApp();

const BACKUP_START_DATE = new Date("1995-06-17");
Expand Down
7 changes: 6 additions & 1 deletion Python/quickstarts/callable-functions/functions/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@
import re
from typing import Any

from firebase_admin import db, initialize_app
# [START v2imports]
# Dependencies for callable functions.
from firebase_functions import https_fn, options

# Dependencies for writing to Realtime Database.
from firebase_admin import db, initialize_app
# [END v2imports]

initialize_app()


Expand Down
14 changes: 9 additions & 5 deletions Python/taskqueues-backup-images/functions/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START v2imports]
# Dependencies for task queue functions.
from google.cloud import tasks_v2
import requests
from firebase_functions.options import RetryConfig, RateLimits, SupportedRegion

# Dependencies for image backup.
from datetime import datetime, timedelta
import json
import pathlib
from urllib.parse import urlparse

from firebase_admin import initialize_app, storage
from firebase_functions import https_fn, tasks_fn, params
from firebase_functions.options import RetryConfig, RateLimits, SupportedRegion

import google.auth
from google.auth.transport.requests import AuthorizedSession
from google.cloud import tasks_v2
import requests
# [END v2imports]


app = initialize_app()

Expand Down

0 comments on commit 3313875

Please sign in to comment.