Adds a Label to an Issue, returns the created AddedLabelEvent, or null if the Label was already present on the Issue. Checks the authorization status, checks that the Label can be added to the Issue

Return

the saved created AddedLabelEvent or null if no event was created

Parameters

authorizationContext

used to check for the required permission

input

defines which Label to add to which Issue


suspend fun addLabelToIssue(issue: Issue, label: Label, atTime: OffsetDateTime, byUser: User): AddedLabelEvent

Adds a label to an issue at atTime as byUser and adds a AddedLabelEvent to the timeline. Creates the event even if the label was already on the issue. Only adds the label to the issue if no newer timeline item exists which removes it again. Does not check the authorization status. Checks if the label can be added to this issue. Does neither save the created AddedLabelEvent nor the issue. It is necessary to save the issue or returned AddedLabelEvent afterwards.

Parameters

issue

the Issue where label is added to

label

the Label to add

atTime

the point in time when the modification happened, updates Issue.lastUpdatedAt if necessary

byUser

the User who caused the update, updates Issue.participants if necessary

Throws

if label cannot be added to issue