blob: 47001e9c9cb7a52f5aec309a8894a7b18c21f863 [file] [log] [blame]
Michael Landoed64b5e2017-06-09 03:19:04 +03001'use strict';
2import {Distribution} from "../models/distribution";
3import {IAppConfigurtaion, IApi} from "../models/app-config";
4
5export interface ISdcVersionService {
6 getVersion():ng.IPromise<any>;
7}
8export class SdcVersionService implements ISdcVersionService {
9
10 static '$inject' = ['$http', '$q', 'sdcConfig'];
11 private api:IApi;
12
13 constructor(private $http:ng.IHttpService, private $q:ng.IQService, sdcConfig:IAppConfigurtaion) {
14 this.api = sdcConfig.api;
15 }
16
17 public getVersion():ng.IPromise<any> {
18 let defer = this.$q.defer<Array<Distribution>>();
19 this.$http.get(this.api.root + this.api.GET_SDC_Version)
20 .then((version:any) => {
21 defer.resolve(version.data);
22 });
23 return defer.promise;
24 }
25}
26