@ -11,13 +11,16 @@ import {
ISonarrSettings ,
ILandingPageSettings ,
ICustomizationSettings ,
IRadarrSettings
IRadarrSettings ,
IAuthenticationSettings
} from '../interfaces/ISettings' ;
import {
IEmailNotificationSettings ,
IDiscordNotifcationSettings ,
IPushbulletNotificationSettings ,
ISlackNotificationSettings
ISlackNotificationSettings ,
IPushoverNotificationSettings ,
IMattermostNotifcationSettings
} from '../interfaces/INotifcationSettings' ;
@Injectable ( )
@ -31,23 +34,31 @@ export class SettingsService extends ServiceAuthHelpers {
}
saveOmbi ( settings : IOmbiSettings ) : Observable < boolean > {
return this . httpAuth . post ( ` ${ this . url } /Ombi/ ` , JSON . stringify ( settings ) , { headers : this.headers } ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth . post ( ` ${ this . url } /Ombi/ ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
resetOmbiApi ( ) : Observable < string > {
return this . httpAuth . post ( ` ${ this . url } /Ombi/resetApi ` , { headers : this.headers } ) . map ( this . extractData )
. catch ( this . handleError ) ;
}
getEmby ( ) : Observable < IEmbySettings > {
return this . httpAuth . get ( ` ${ this . url } /Emby/ ` ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth . get ( ` ${ this . url } /Emby/ ` ) . map ( this . extractData ) . catch ( this . handleError ) ;
}
saveEmby ( settings : IEmbySettings ) : Observable < boolean > {
return this . httpAuth . post ( ` ${ this . url } /Emby/ ` , JSON . stringify ( settings ) , { headers : this.headers } ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth . post ( ` ${ this . url } /Emby/ ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
getPlex ( ) : Observable < IPlexSettings > {
return this . httpAuth . get ( ` ${ this . url } /Plex/ ` ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth . get ( ` ${ this . url } /Plex/ ` ) . map ( this . extractData ) . catch ( this . handleError ) ;
}
savePlex ( settings : IPlexSettings ) : Observable < boolean > {
return this . httpAuth . post ( ` ${ this . url } /Plex/ ` , JSON . stringify ( settings ) , { headers : this.headers } ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth . post ( ` ${ this . url } /Plex/ ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
getSonarr ( ) : Observable < ISonarrSettings > {
@ -56,7 +67,8 @@ export class SettingsService extends ServiceAuthHelpers {
}
saveSonarr ( settings : ISonarrSettings ) : Observable < boolean > {
return this . httpAuth . post ( ` ${ this . url } /Sonarr ` , JSON . stringify ( settings ) , { headers : this.headers } ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth . post ( ` ${ this . url } /Sonarr ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
getRadarr ( ) : Observable < IRadarrSettings > {
@ -65,16 +77,29 @@ export class SettingsService extends ServiceAuthHelpers {
}
saveRadarr ( settings : IRadarrSettings ) : Observable < boolean > {
return this . httpAuth . post ( ` ${ this . url } /Radarr ` , JSON . stringify ( settings ) , { headers : this.headers } ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth . post ( ` ${ this . url } /Radarr ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
getAuthentication ( ) : Observable < IAuthenticationSettings > {
return this . httpAuth . get ( ` ${ this . url } /Authentication ` ) . map ( this . extractData )
. catch ( this . handleError ) ;
}
saveAuthentication ( settings : IAuthenticationSettings ) : Observable < boolean > {
return this . httpAuth . post ( ` ${ this . url } /Authentication ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
// Using http since we need it not to be authenticated to get the landing page settings
getLandingPage ( ) : Observable < ILandingPageSettings > {
return this . nonAuthHttp . get ( ` ${ this . url } /LandingPage ` ) . map ( this . extractData ) . catch ( this . handleError )
return this . nonAuthHttp . get ( ` ${ this . url } /LandingPage ` ) . map ( this . extractData ) . catch ( this . handleError ) ;
}
saveLandingPage ( settings : ILandingPageSettings ) : Observable < boolean > {
return this . httpAuth . post ( ` ${ this . url } /LandingPage ` , JSON . stringify ( settings ) , { headers : this.headers } ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth . post ( ` ${ this . url } /LandingPage ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
// Using http since we need it not to be authenticated to get the customization settings
@ -83,7 +108,8 @@ export class SettingsService extends ServiceAuthHelpers {
}
saveCustomization ( settings : ICustomizationSettings ) : Observable < boolean > {
return this . httpAuth . post ( ` ${ this . url } /customization ` , JSON . stringify ( settings ) , { headers : this.headers } ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth . post ( ` ${ this . url } /customization ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
getEmailNotificationSettings ( ) : Observable < IEmailNotificationSettings > {
@ -91,22 +117,46 @@ export class SettingsService extends ServiceAuthHelpers {
}
saveEmailNotificationSettings ( settings : IEmailNotificationSettings ) : Observable < boolean > {
return this . httpAuth . post ( ` ${ this . url } /notifications/email ` , JSON . stringify ( settings ) , { headers : this.headers } ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth
. post ( ` ${ this . url } /notifications/email ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
getDiscordNotificationSettings ( ) : Observable < IDiscordNotifcationSettings > {
return this . httpAuth . get ( ` ${ this . url } /notifications/discord ` ) . map ( this . extractData ) . catch ( this . handleError )
}
getMattermostNotificationSettings ( ) : Observable < IMattermostNotifcationSettings > {
return this . httpAuth . get ( ` ${ this . url } /notifications/mattermost ` ) . map ( this . extractData ) . catch ( this . handleError )
}
saveDiscordNotificationSettings ( settings : IDiscordNotifcationSettings ) : Observable < boolean > {
return this . httpAuth . post ( ` ${ this . url } /notifications/discord ` , JSON . stringify ( settings ) , { headers : this.headers } ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth
. post ( ` ${ this . url } /notifications/discord ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
saveMattermostNotificationSettings ( settings : IMattermostNotifcationSettings ) : Observable < boolean > {
return this . httpAuth
. post ( ` ${ this . url } /notifications/mattermost ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
getPushbulletNotificationSettings ( ) : Observable < IPushbulletNotificationSettings > {
return this . httpAuth . get ( ` ${ this . url } /notifications/pushbullet ` ) . map ( this . extractData ) . catch ( this . handleError )
}
getPushoverNotificationSettings ( ) : Observable < IPushoverNotificationSettings > {
return this . httpAuth . get ( ` ${ this . url } /notifications/pushover ` ) . map ( this . extractData ) . catch ( this . handleError )
}
savePushbulletNotificationSettings ( settings : IPushbulletNotificationSettings ) : Observable < boolean > {
return this . httpAuth . post ( ` ${ this . url } /notifications/pushbullet ` , JSON . stringify ( settings ) , { headers : this.headers } ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth
. post ( ` ${ this . url } /notifications/pushbullet ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
savePushoverNotificationSettings ( settings : IPushoverNotificationSettings ) : Observable < boolean > {
return this . httpAuth
. post ( ` ${ this . url } /notifications/pushover ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
getSlackNotificationSettings ( ) : Observable < ISlackNotificationSettings > {
@ -114,6 +164,8 @@ export class SettingsService extends ServiceAuthHelpers {
}
saveSlackNotificationSettings ( settings : ISlackNotificationSettings ) : Observable < boolean > {
return this . httpAuth . post ( ` ${ this . url } /notifications/slack ` , JSON . stringify ( settings ) , { headers : this.headers } ) . map ( this . extractData ) . catch ( this . handleError )
return this . httpAuth
. post ( ` ${ this . url } /notifications/slack ` , JSON . stringify ( settings ) , { headers : this.headers } )
. map ( this . extractData ) . catch ( this . handleError ) ;
}
}