import { IMineMeldAPIService , IMineMeldAPIResource } from './minemeldapi' ; export interface IMinemeldAAAUserAttributes { comment ? : string ; tags ? : string [ ] ; } export interface IMinemeldAAAUsers { enabled : boolean ; users : { [ key ] : IMinemeldAAAUserAttributes ; } ; } export interface IMinemeldAAAFeedAttributes { tags ? : string [ ] ; } export interface IMinemeldAAAFeeds { enabled : boolean ; feeds : { [ key ] : IMinemeldAAAFeedAttributes ; } ; } export interface IMinemeldCurrentUser { id : string ; read_write : boolean ; } export interface IMinemeldAAAService { getCurrentUser ( ) : angular . IPromise < IMinemeldCurrentUser > ; getUsers ( subsystem ) : angular . IPromise < IMinemeldAAAUsers > ; setUserPassword ( subsystem , username , password ) : angular . IPromise < any > ; setUserAttributes ( subsystem , username , attributes ) : angular . IPromise < any > ; deleteUser ( subsystem , username ) : angular . IPromise < any > ; getFeeds ( ) : angular . IPromise < IMinemeldAAAFeeds > ; setFeedAttributes ( feed , attributes ) : angular . IPromise < any > ; deleteFeed ( feed ) : angular . IPromise < any > ; getTags ( ) : angular . IPromise < string [ ] > ; } interface IMinemeldAAAResource extends angular . resource . IResourceClass < angular . resource . IResource < any > > { put ( params , putdata ) ; del ( params ) ; post ( params , postdata ) ; } export class MinemeldAAAService implements IMinemeldAAAService { $state : angular . ui . IStateService ; $q : angular . IQService ; MineMeldAPIService : IMineMeldAPIService ; ngInject constructor ( $state , $q , MineMeldAPIService ) { this . $state = $state ; this . $q = $q ; this . MineMeldAPIService = MineMeldAPIService ; } getCurrentUser ( ) { var api ; api = < IMineMeldAPIResource > ( this . MineMeldAPIService . getAPIResource ( '/aaa/users/current' , { } , { get : { method : 'GET' } } , false ) ) ; return api . get ( ) . $promise . then ( ( result ) => { return result . result ; } ) ; } getUsers ( subsystem ) { var r ; r = < IMinemeldAAAResource > ( this . MineMeldAPIService . getAPIResource ( '/aaa/users/:subsystem' , { subsystem : subsystem } , { get : { method : 'GET' } } ) ) ; return r . get ( ) . $promise . then ( ( result ) => { return result . result ; } ) ; } setUserPassword ( subsystem , username , password ) { var r ; r = < IMinemeldAAAResource > ( this . MineMeldAPIService . getAPIResource ( '/aaa/users/:subsystem/:username' , { subsystem : subsystem , username : username } , { put : { method : 'PUT' } } , false ) ) ; return r . put ( { } , JSON . stringify ( { password : password } ) ) . $promise . then ( ( result ) => { return result . result ; } ) ; } setUserAttributes ( subsystem , username , attributes ) { var r ; r = < IMinemeldAAAResource > ( this . MineMeldAPIService . getAPIResource ( '/aaa/users/:subsystem/:username/attributes' , { subsystem : subsystem , username : username } , { post : { method : 'POST' } } , false ) ) ; return r . post ( { } , JSON . stringify ( attributes ) ) . $promise . then ( ( result ) => { return result . result ; } ) ; } deleteUser ( subsystem , username ) { var r ; r = < IMinemeldAAAResource > ( this . MineMeldAPIService . getAPIResource ( '/aaa/users/:subsystem/:username' , { subsystem : subsystem , username : username } , { del : { method : 'DELETE' } } , false ) ) ; return r . del ( { } ) . $promise . then ( ( result ) => { return result . result ; } ) ; } getFeeds ( ) { var r ; r = < IMinemeldAAAResource > ( this . MineMeldAPIService . getAPIResource ( '/aaa/feeds' , { } , { get : { method : 'GET' } } ) ) ; return r . get ( ) . $promise . then ( ( result ) => { return result . result ; } ) ; } setFeedAttributes ( feed , attributes ) { var r ; r = < IMinemeldAAAResource > ( this . MineMeldAPIService . getAPIResource ( '/aaa/feeds/:feed/attributes' , { feed : feed } , { post : { method : 'POST' } } , false ) ) ; return r . post ( { } , JSON . stringify ( attributes ) ) . $promise . then ( ( result ) => { return result . result ; } ) ; } deleteFeed ( feed ) { var r ; r = < IMinemeldAAAResource > ( this . MineMeldAPIService . getAPIResource ( '/aaa/feeds/:feed' , { feed : feed } , { del : { method : 'DELETE' } } , false ) ) ; return r . del ( { } ) . $promise . then ( ( result ) => { return result . result ; } ) ; } getTags ( ) { var r ; r = < IMinemeldAAAResource > ( this . MineMeldAPIService . getAPIResource ( '/aaa/tags' , { } , { get : { method : 'GET' } } ) ) ; return r . get ( { } ) . $promise . then ( ( result ) => { return result . result ; } ) ; } }