Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Node-1st-gen/ffmpeg-convert-audio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ To deploy and test the sample:
- Create a Firebase project on the [Firebase Console](https://console.firebase.google.com) and visit the **Storage** tab.
- Get the code, for instance using `git clone https://github.com/firebase/functions-samples`
- Enter the correct directory `cd functions-samples/ffmpeg-convert-audio`
- Setup the CLI to use your Firebase project using `firebase use --add` and select your Firebase project
- Set up the CLI to use your Firebase project using `firebase use --add` and select your Firebase project
- Deploy your project's code using `firebase deploy`
- Go to the Firebase Console **Storage** tab and upload an audio. After a short time a converted audio with the same name but a `_output.flac` suffix will be created in the same folder (make sure you refresh the UI to see the new file).

Expand Down
9 changes: 4 additions & 5 deletions Node-1st-gen/paypal/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Accept PayPal payment in functions firebase
# Accept PayPal payment in Firebase Functions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Accept PayPal payment in Firebase Functions
# Accept PayPal payment in Cloud Functions for Firebase

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion! I've updated the title as you requested.


This sample demonstrates how to use the Paypal-rest-sdk with a Google Cloud Functions.
This sample demonstrates how to use the Paypal-rest-sdk with Google Cloud Functions.


## Functions Code
Expand Down Expand Up @@ -55,10 +55,9 @@ To deploy and test on prod do:

## Contributing

We'd love that you contribute to the project. Before doing so please read our [Contributor guide](../CONTRIBUTING.md).
We'd love that you contribute to the project. Before doing so please read our [Contributor guide](../../CONTRIBUTING.md).


## License

© Google, 2017. Licensed under an [Apache-2](../LICENSE) license.

© Google, 2017. Licensed under an [Apache-2](../../LICENSE) license.
2 changes: 1 addition & 1 deletion Node/test-functions-jest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This quickstart demonstrates how to run unit tests on gen-2 functions.

## Setting up the sample

1. Clone or download this repo and open the `2nd-gen/test-functions-jest`
1. Clone or download this repo and open the `Node/test-functions-jest`
directory.
1. Install Cloud Functions dependencies locally by running:
`cd functions; npm install; cd -`
Expand Down
33 changes: 32 additions & 1 deletion Python/http-flask/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
# http-flask
# HTTP Flask Example

This sample demonstrates how to expose a Flask app as a single Cloud Function. The Flask app provides a simple CRUD interface for "widgets" stored in the Realtime Database.

## Functions Code

See file [functions/main.py](functions/main.py) for the code.

The sample creates a Flask app and defines two routes:

- `GET /widgets` and `GET /widgets/<id>`: These routes retrieve a list of all widgets or a single widget by its ID from the Realtime Database.
- `POST /widgets`: This route adds a new widget to the Realtime Database.

The entire Flask app is then exposed as a single Cloud Function called `httpsflaskexample` using `@https_fn.on_request()`.

## Trigger rules

The `httpsflaskexample` function is triggered by an HTTP request.

## Deploy and test

To deploy and test the sample:

1. Create a Firebase project on the [Firebase Console](https://console.firebase.google.com).
2. Get the code, for instance using `git clone https://github.com/firebase/functions-samples`
3. Enter the correct directory `cd functions-samples/Python/http-flask`
4. Set up the CLI to use your Firebase project using `firebase use --add` and select your Firebase project.
5. Deploy your project's code using `firebase deploy`.
6. Use a tool like `curl` to test the function:
- **Add a widget:** `curl -X POST -d "My new widget" https://us-central1-YOUR_PROJECT_ID.cloudfunctions.net/httpsflaskexample/widgets`
- **Get all widgets:** `curl https://us-central1-YOUR_PROJECT_ID.cloudfunctions.net/httpsflaskexample/widgets`
- **Get a specific widget:** `curl https://us-central1-YOUR_PROJECT_ID.cloudfunctions.net/httpsflaskexample/widgets/WIDGET_ID`
34 changes: 33 additions & 1 deletion Python/post-signup-event/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
# post-signup-event
# Post Sign-up Event with Google Calendar

This sample demonstrates how to use an [Auth blocking function](https://firebase.google.com/docs/functions/auth-blocking-events) to save a user's Google OAuth2 access token to Firestore upon sign-up. It then uses a [task queue](https://firebase.google.com/docs/functions/task-functions) to schedule a Cloud Function that uses this token to create a Google Calendar event for the user.

## Functions Code

See file [functions/main.py](functions/main.py) for the code.

The function `savegoogletoken` is an Auth blocking function that triggers before a user is created. If the user is signing up with Google, it saves their OAuth2 access token to a `user_info` collection in Firestore. It then creates a task to call the `scheduleonboarding` function.

The `scheduleonboarding` function is a task queue function that retrieves the user's access token from Firestore, creates a new event on their primary Google Calendar, and then deletes the access token from Firestore.

## Trigger rules

- The `savegoogletoken` function is triggered by `beforeUserCreated` Auth blocking event.
- The `scheduleonboarding` function is triggered by a task queue.

## Deploy and test

To deploy and test the sample:

1. Create a Firebase project on the [Firebase Console](https://console.firebase.google.com).
2. Enable the **Google Calendar API** for your project in the [Google Cloud Console](https://console.cloud.google.com/apis/library/calendar-json.googleapis.com).
3. Enable blocking functions for your project in the Firebase console:
- Go to the **Authentication** > **Settings** page.
- In the **Blocking functions** section, select **Before user creation (beforeCreate)** from the dropdown menu.
- Ensure that **Enable credential pass-through** is checked.
4. Get the code, for instance using `git clone https://github.com/firebase/functions-samples`
5. Enter the correct directory `cd functions-samples/Python/post-signup-event`
6. Set up the CLI to use your Firebase project using `firebase use --add` and select your Firebase project.
7. Deploy your project's code using `firebase deploy`.
8. Sign up for your app using a Google account.
9. After a minute, check your Google Calendar for a new "Onboarding with ExampleCo" event.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This repository contains a collection of samples showcasing some typical uses of [Cloud Functions for Firebase](https://firebase.google.com/features/functions).

Samples are available for the **Node** (2nd gen), **Python** (2nd gen), and Node (1st gen).
Samples are available for **Node** (1st and 2nd gen) and **Python** (2nd gen).

> Note: Python support in Cloud Functions for Firebase is a public preview. This means that the functionality might change in backward-incompatible ways. A preview release is not subject to any SLA or deprecation policy and may receive limited or no support.

Expand Down Expand Up @@ -55,7 +55,7 @@ This quickstart sample demonstrates using **Cloud Functions** triggered by **Rea

- [Node 1st gen](/Node-1st-gen/quickstarts/big-ben/)

This quickstart demonstrates using **Cloud Functions** with an HTTPS trigger that's triggered through a Firebase Hosting URL. The function will display a repeated number of "BONG"s depending on the hour of the day.
This quickstart demonstrates using **Cloud Functions** with an HTTPS trigger that's triggered by a Firebase Hosting URL. The function will display a repeated number of "BONG"s depending on the hour of the day.

### Cloud Storage trigger quickstart: Thumbnail generator

Expand Down Expand Up @@ -92,7 +92,7 @@ This quickstart sample demonstrates using **Cloud Functions** triggered by **Pub
### Test Lab trigger quickstart: Log when a matrix completes

- [Node 2nd gen](/Node/quickstarts/testlab-matrix-completed/)
- [Python](/Python/quickstarts/testlab-matrix-completed/)
- [Python](/Python/quickstarts/testlab-matrix-completed)

### Firebase Alerts trigger quickstart: Send crash reports to Discord

Expand Down