From 0ad8140e97933646af3607aea898339e91709652 Mon Sep 17 00:00:00 2001 From: Joe Hanley Date: Mon, 9 May 2022 11:54:00 -0700 Subject: [PATCH 1/4] Docs pass for v2.eventarc --- src/v2/providers/eventarc.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/v2/providers/eventarc.ts b/src/v2/providers/eventarc.ts index fd56e714f..245708b5f 100644 --- a/src/v2/providers/eventarc.ts +++ b/src/v2/providers/eventarc.ts @@ -28,7 +28,7 @@ import * as options from '../options'; /** Options that can be set on an Eventarc trigger. */ export interface EventarcTriggerOptions extends options.EventHandlerOptions { /** - * Type of the event. + * Type of the event to trigger on. */ eventType: string; @@ -54,14 +54,24 @@ export interface EventarcTriggerOptions extends options.EventHandlerOptions { filters?: Record; } +/** + * A function that takes a CloudEvent. + */ export type CloudEventHandler = (event: CloudEvent) => any | Promise; -/** Handle an Eventarc event published on the default channel. */ +/** Handle an Eventarc event published on the default channel. + * @param eventType Type of the event to trigger on. + * @param handler A function to execute when triggered. + */ export function onCustomEventPublished( eventType: string, handler: CloudEventHandler ): CloudFunction>; +/** Handle an Eventarc event. + * @param opts Options to set on this Cloud Function + * @param handler A function to execute when triggered. +*/ export function onCustomEventPublished( opts: EventarcTriggerOptions, handler: CloudEventHandler From de98950ffca6381bedcf97702d315f915d23adfd Mon Sep 17 00:00:00 2001 From: Joe Hanley Date: Mon, 9 May 2022 11:57:01 -0700 Subject: [PATCH 2/4] formats --- src/v2/providers/eventarc.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/v2/providers/eventarc.ts b/src/v2/providers/eventarc.ts index 245708b5f..26173756a 100644 --- a/src/v2/providers/eventarc.ts +++ b/src/v2/providers/eventarc.ts @@ -68,10 +68,10 @@ export function onCustomEventPublished( handler: CloudEventHandler ): CloudFunction>; -/** Handle an Eventarc event. +/** Handle an Eventarc event. * @param opts Options to set on this Cloud Function * @param handler A function to execute when triggered. -*/ + */ export function onCustomEventPublished( opts: EventarcTriggerOptions, handler: CloudEventHandler From 0cf6887f437996852b42baf18aa8b871593c4cad Mon Sep 17 00:00:00 2001 From: Joe Hanley Date: Mon, 9 May 2022 13:07:24 -0700 Subject: [PATCH 3/4] Style pass --- src/v2/providers/eventarc.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/v2/providers/eventarc.ts b/src/v2/providers/eventarc.ts index 26173756a..beb427091 100644 --- a/src/v2/providers/eventarc.ts +++ b/src/v2/providers/eventarc.ts @@ -59,18 +59,20 @@ export interface EventarcTriggerOptions extends options.EventHandlerOptions { */ export type CloudEventHandler = (event: CloudEvent) => any | Promise; -/** Handle an Eventarc event published on the default channel. - * @param eventType Type of the event to trigger on. - * @param handler A function to execute when triggered. +/** Handles an Eventarc event published on the default channel. + * @param eventType - Type of the event to trigger on. + * @param handler - A function to execute when triggered. + * @returns A Cloud Function that you can export and deploy. */ export function onCustomEventPublished( eventType: string, handler: CloudEventHandler ): CloudFunction>; -/** Handle an Eventarc event. - * @param opts Options to set on this Cloud Function - * @param handler A function to execute when triggered. +/** Handles an Eventarc event. + * @param opts - Options to set on this Cloud Function + * @param handler - A function to execute when triggered. + * @returns A Cloud Function that you can export and deploy. */ export function onCustomEventPublished( opts: EventarcTriggerOptions, From 68f2b5a67b3a1a73e53e22daa4c969f31003734f Mon Sep 17 00:00:00 2001 From: Joe Hanley Date: Mon, 9 May 2022 15:20:10 -0700 Subject: [PATCH 4/4] PR feedback --- src/v2/providers/eventarc.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/v2/providers/eventarc.ts b/src/v2/providers/eventarc.ts index beb427091..17750d34a 100644 --- a/src/v2/providers/eventarc.ts +++ b/src/v2/providers/eventarc.ts @@ -55,14 +55,14 @@ export interface EventarcTriggerOptions extends options.EventHandlerOptions { } /** - * A function that takes a CloudEvent. + * A function that takes a {@link CloudEvent}. */ export type CloudEventHandler = (event: CloudEvent) => any | Promise; /** Handles an Eventarc event published on the default channel. * @param eventType - Type of the event to trigger on. * @param handler - A function to execute when triggered. - * @returns A Cloud Function that you can export and deploy. + * @returns A function that you can export and deploy. */ export function onCustomEventPublished( eventType: string, @@ -70,9 +70,9 @@ export function onCustomEventPublished( ): CloudFunction>; /** Handles an Eventarc event. - * @param opts - Options to set on this Cloud Function + * @param opts - Options to set on this function * @param handler - A function to execute when triggered. - * @returns A Cloud Function that you can export and deploy. + * @returns A function that you can export and deploy. */ export function onCustomEventPublished( opts: EventarcTriggerOptions,