import { Embed } from '../model/DiscordApi' ; import { DirectParseProvider } from '../provider/BaseProvider' ; /**
 * https://plugins.jenkins.io/notification
 */ export class Jenkins extends DirectParseProvider { private static capitalize ( str ) { const tmp = str . toLowerCase ( ) ; return tmp . charAt ( 0 ) . toUpperCase ( ) + tmp . slice ( 1 ) ; } public getName ( ) { return 'Jenkins-CI' ; } public getPath ( ) { return 'jenkins' ; } public async parseData ( ) { this . setEmbedColor ( 0xF0D6B7 ) ; const phase = this . body . build . phase ; const embed = { title : 'Project ' + this . body . name , url : this . body . build . full_url } ; switch ( phase ) { case 'STARTED' : embed . description = 'Started build #' + this . body . build . number ; break ; case 'COMPLETED' : case 'FINALIZED' : embed . description = Jenkins . capitalize ( phase ) + ' build #' + this . body . build . number + ' with status: ' + this . body . build . status ; break ; } this . addEmbed ( embed ) ; } }