Conversation
grant
left a comment
There was a problem hiding this comment.
LGTM, but 2 requested changes.
We usually refer to the signatures as event and cloudevent, where event has a data and context.
Using event and context may be confusing, as we have --signature-type=event already.
So let's stick to data, context for this PR.
| Google Cloud Functions [event](https://cloud.google.com/functions/docs/concepts/events-triggers#events) payloads to `event` and `context` objects. | ||
| These will be passed as arguments to your function when it receives a request. | ||
| Note that your function must use the `event`-style function signature: | ||
|
|
||
| ```python | ||
| def hello(data, context): | ||
| print(data) | ||
| def hello(event, context): | ||
| print(event) | ||
| print(context) | ||
| ``` |
There was a problem hiding this comment.
Usually, we refer to the whole event as an event, (like event and cloudevent), not the first param.
The event we refer to usually has two properties, data, and context. I suggest we keep the same terms here. This is like the docs are currently, and the Node Functions Framework. Although Java uses event.
If we want to use the term event, context, I suggest we do so in a separate PR and have a plan to update the docs at the same time.
There was a problem hiding this comment.
FWIW in most other language samples we use (message, context). I don't think it really matters much TBH
| # limitations under the License. | ||
|
|
||
|
|
||
| def hello(data, context): |
There was a problem hiding this comment.
I would not update this identifier in this PR. Maybe a separate PR.
| ```python | ||
| def hello(request): | ||
| return "Hello world!" | ||
| def hello(event, context): |
There was a problem hiding this comment.
I would stick to data, context to update this Pub/Sub quickstart. See other comments for more details.
|
@grant The change to |
| ```python | ||
| def hello(request): | ||
| return "Hello world!" | ||
| def hello(event, context): |
Fixes #23, closes #140.