-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow updating address list of a wallet activity webhook #280
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ import { | |
WebhookEventTypeFilter, | ||
} from "../client/api"; | ||
import { Coinbase } from "./coinbase"; | ||
import { CreateWebhookOptions } from "./types"; | ||
import { CreateWebhookOptions, UpdateWebhookOptions } from "./types"; | ||
|
||
/** | ||
* A representation of a Webhook, | ||
|
@@ -163,15 +163,21 @@ export class Webhook { | |
} | ||
|
||
/** | ||
* Updates the webhook with a new notification URI. | ||
* Updates the webhook with a new notification URI, and optionally a new list of addresses to monitor. | ||
* | ||
* @param notificationUri - The new URI for webhook notifications. | ||
* @param options - The options to update webhook. | ||
* @param options.notificationUri - The new URI for webhook notifications. | ||
* @param options.eventTypeFilter - The new eventTypeFilter that contains a new list (replacement) of addresses to monitor for the webhook. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if eventTypeFilter can only contain replacement addresses, should this be called just addresses? Also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
* @returns A promise that resolves to the updated Webhook object. | ||
*/ | ||
public async update(notificationUri: string): Promise<Webhook> { | ||
public async update({ | ||
notificationUri, | ||
eventTypeFilter, | ||
}: UpdateWebhookOptions): Promise<Webhook> { | ||
Comment on lines
+173
to
+176
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a note that we're breaking back compat by changing the params here. Not sure if this would be an issue at this point, though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a good call out cc @jazz-cb not sure if it matters at this point or maybe we can make the param like this: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's note it in the release logs. For |
||
const result = await Coinbase.apiClients.webhook!.updateWebhook(this.getId()!, { | ||
notification_uri: notificationUri, | ||
event_filters: this.getEventFilters()!, | ||
event_type_filter: eventTypeFilter, | ||
}); | ||
|
||
this.model = result.data; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you also add the instructions to docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean this one ? https://github.cbhq.net/solutions-architecture/docs/pull/715/files#diff-e948e3fa52983fe8dee3cacd990a72989a39f539973f07fca0f2065dc7a0577dR15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if that is the place to put documentation then this change is documented. cc: @jazz-cb