webhook
Module webhook
API
Declarations
projzone/webhook
Module overview
This module impelements a custom webhook for ProjZone
.
The projzone/webhook
module defines three kinds of services (BugDiscussionService
, ImprovementDiscussionService
, and/or FeatureRequestDiscussionService
) that can be attached to the listener defined in the module.
The listener looks at the attached services and sends subscription requests on behalf of the user. For example, if only a BugDiscussionService
is declared with a projzone/webhook
listener, the subscription will be only for bug discussions.
import projzone/webhook; configurable int port = ?; configurable string orgName = ?; configurable string projName = ?; configurable string secret = ?; configurable string hub = ?; listener webhook:Listener ln = new (port, orgName, projName, secret, hub); service webhook:BugDiscussionService on ln { remote function onDiscussionClosed(webhook:BugDiscussionEvent event) { // Implement necessary logic if it is required to perform // a certain action when a bug discussion is opened. } remote function onDiscussionCommented(webhook:BugDiscussionOpenedOrCommentedEvent event) { } remote function onDiscussionLabeled(webhook:BugDiscussionLabeledEvent event) { } remote function onDiscussionOpened(webhook:BugDiscussionOpenedOrCommentedEvent event) { } }
Enums
webhook: Action
The action performed.
Members
webhook: Impact
The impact of an improvement.
Members
webhook: Kind
The discussion kind.
Members
webhook: Severity
The severity of a bug.
Members
webhook: Version
The affected/applicable version.
Members
Listeners
webhook: Listener
The listener to which services can be attached to receive ProjZone
notifications
for bug, improvement, and/or feature request discussions.
Constructor
The init
method for the listener.
init (int|Listener listenOn, string orgName, string projectName, string secret, string hub, string? callback)
attach
function attach(GenericServiceType serviceRef, () attachPoint) returns error?
detach
function detach(GenericServiceType serviceRef) returns error?
Parameters
- serviceRef GenericServiceType -
'start
function 'start() returns error?
gracefulStop
function gracefulStop() returns error?
immediateStop
function immediateStop() returns error?
Records
webhook: BugDiscussionEvent
Record reprenting the mandatory fields in all bug discussion events.
Fields
- Fields Included from *DiscussionEvent
- kind BUG(default BUG) - The kind of the bug discussion
- severity Severity - The severity of the bug
webhook: BugDiscussionLabeledEvent
Record reprenting the mandatory fields in all bug discussion labeled events.
Fields
- Fields Included from *BugDiscussionEvent
- new_label string - The newly added label
webhook: BugDiscussionOpenedOrCommentedEvent
Record reprenting the mandatory fields in all bug discussion opened or commented events.
Fields
- Fields Included from *BugDiscussionEvent
- content string - The content specified when creating the discussion or commenting on it
webhook: DiscussionEvent
Record reprenting the mandatory fields in all discussion events.
Fields
- name string - The name of the project for which the discussion was created
- kind Kind - The kind of discussion
- title string - The title of the discussion
- action Action - The action performed on the discussion
- actor string - The user who performed the action on the discussion
- time string - The time at which the action was performed on the discussion
- labels string[] - The labels specified on the discussion
- 'version Version - The affected/applicable version for the discussion
webhook: FeatureRequestDiscussionLabeledEvent
Record reprenting the mandatory fields in all feature request discussion labeled events.
Fields
- Fields Included from *DiscussionEvent
- kind FEATURE_REQUEST(default FEATURE_REQUEST) - The kind of the feature request discussion
- new_label string - The newly added label
webhook: FeatureRequestDiscussionOpenedOrCommentedEvent
Record reprenting the mandatory fields in all feature request discussion opened or commented events.
Fields
- Fields Included from *DiscussionEvent
- kind FEATURE_REQUEST(default FEATURE_REQUEST) - The kind of the feature request discussion
- content string - The content specified when creating the discussion or commenting on it
webhook: ImprovementDiscussionEvent
Record reprenting the mandatory fields in all improvement discussion events.
Fields
- Fields Included from *DiscussionEvent
- kind IMPROVEMENT(default IMPROVEMENT) - The kind of the improvement discussion
- impact Impact - The impact of the improvement
webhook: ImprovementDiscussionLabeledEvent
Record reprenting the mandatory fields in all improvement discussion labeled events.
Fields
- Fields Included from *ImprovementDiscussionEvent
- new_label string - The newly added label
webhook: ImprovementDiscussionOpenedOrCommentedEvent
Record reprenting the mandatory fields in all improvement discussion opened or commented events.
Fields
- Fields Included from *ImprovementDiscussionEvent
- content string - The content specified when creating the discussion or commenting on it
Object types
webhook: BugDiscussionService
The type representing services that can be declared to receive updates regarding bug discussions.
onDiscussionOpened
function onDiscussionOpened(BugDiscussionOpenedOrCommentedEvent event)
The remote method that will be called when a bug discussion is opened.
Parameters
- event BugDiscussionOpenedOrCommentedEvent - the event notification payload
onDiscussionCommented
function onDiscussionCommented(BugDiscussionOpenedOrCommentedEvent event)
The remote method that will be called when a bug discussion is commented on.
Parameters
- event BugDiscussionOpenedOrCommentedEvent - the event notification payload
onDiscussionLabeled
function onDiscussionLabeled(BugDiscussionLabeledEvent event)
The remote method that will be called when a bug discussion is labeled.
Parameters
- event BugDiscussionLabeledEvent - the event notification payload
onDiscussionClosed
function onDiscussionClosed(BugDiscussionEvent event)
The remote method that will be called when a bug discussion is closed.
Parameters
- event BugDiscussionEvent - the event notification payload
webhook: FeatureRequestDiscussionService
The type representing services that can be declared to receive updates regarding feature request discussions.
onDiscussionOpened
function onDiscussionOpened(FeatureRequestDiscussionOpenedOrCommentedEvent event)
The remote method that will be called when a feature request discussion is opened.
Parameters
- event FeatureRequestDiscussionOpenedOrCommentedEvent - the event notification payload
onDiscussionCommented
function onDiscussionCommented(FeatureRequestDiscussionOpenedOrCommentedEvent event)
The remote method that will be called when a feature request discussion is commented on.
Parameters
- event FeatureRequestDiscussionOpenedOrCommentedEvent - the event notification payload
onDiscussionLabeled
function onDiscussionLabeled(FeatureRequestDiscussionLabeledEvent event)
The remote method that will be called when a feature request discussion is labeled.
Parameters
- event FeatureRequestDiscussionLabeledEvent - the event notification payload
onDiscussionClosed
function onDiscussionClosed(DiscussionEvent event)
The remote method that will be called when a feature request discussion is closed.
Parameters
- event DiscussionEvent - the event notification payload
webhook: ImprovementDiscussionService
The type representing services that can be declared to receive updates regarding improvement discussions.
onDiscussionOpened
function onDiscussionOpened(ImprovementDiscussionOpenedOrCommentedEvent event)
The remote method that will be called when an improvement discussion is opened.
Parameters
- event ImprovementDiscussionOpenedOrCommentedEvent - the event notification payload
onDiscussionCommented
function onDiscussionCommented(ImprovementDiscussionOpenedOrCommentedEvent event)
The remote method that will be called when an improvement discussion is commented on.
Parameters
- event ImprovementDiscussionOpenedOrCommentedEvent - the event notification payload
onDiscussionLabeled
function onDiscussionLabeled(ImprovementDiscussionLabeledEvent event)
The remote method that will be called when an improvement discussion is labeled.
Parameters
- event ImprovementDiscussionLabeledEvent - the event notification payload
onDiscussionClosed
function onDiscussionClosed(ImprovementDiscussionEvent event)
The remote method that will be called when an improvement discussion is closed.
Parameters
- event ImprovementDiscussionEvent - the event notification payload
Union types
webhook: GenericServiceType
GenericServiceType
Import
import projzone/webhook;
Metadata
Released date: over 2 years ago
Version: 0.1.0
Compatibility
Platform: any
Ballerina version: 2201.0.2
GraalVM compatible: Yes
Pull count
Total: 8346
Current verison: 330
Weekly downloads
Dependencies