{"size": 2990, "ext": "js", "max_stars_repo_path": "app/scripts/services/options.js", "max_stars_repo_name": "thanhson1085/angular-admin-seed", "max_stars_repo_stars_event_min_datetime": "2015-08-08T15:36:47.000Z", "max_stars_repo_stars_event_max_datetime": "2018-09-21T06:40:08.000Z", "max_issues_repo_path": "app/scripts/services/options.js", "max_issues_repo_name": "thanhson1085/angular-admin-seed", "max_issues_repo_issues_event_min_datetime": "2016-01-15T15:34:50.000Z", "max_issues_repo_issues_event_max_datetime": "2016-01-16T11:11:57.000Z", "max_forks_repo_path": "app/scripts/services/options.js", "max_forks_repo_name": "thanhson1085/angular-admin-seed", "max_forks_repo_forks_event_min_datetime": "2015-08-09T15:17:46.000Z", "max_forks_repo_forks_event_max_datetime": "2018-03-13T09:25:05.000Z"}
{"max_stars_count": 11, "max_issues_count": 1, "max_forks_count": 4, "avg_line_length": 33.9772727273, "max_line_length": 96, "alphanum_fraction": 0.4635451505}
'use strict';
angular.module('sbAdminApp').factory('Options', function(Helper, $http, httpi, $q, APP_CONFIG) {
    return {
        list: function(page, limit){
            var deferred = $q.defer();
            var url = APP_CONFIG.services.options.list;
            var data = {
                page: page,
                limit: limit
            };
            httpi({
                method: 'GET',
                url: url,
                data: data
            }).success(function(data) {
                deferred.resolve(data);
            }).error(deferred.reject);
            return deferred.promise;
        },
        get: function(id){
            var deferred = $q.defer();
            var url = APP_CONFIG.services.options.get;
            httpi({
                method: 'GET',
                url: url,
                data: {
                    id: id
                }
            }).success(function(data) {
                deferred.resolve(data);
            }).error(deferred.reject);
            return deferred.promise;
        },
        install: function(data){
            var deferred = $q.defer();
            var url = APP_CONFIG.services.options.install;
            httpi({
                method: 'POST',
                url: url,
                data: data,
                transformRequest: Helper.transformRequestEncodeURI,
                headers: {'Content-Type': 'application/x-www-form-urlencoded'}
            }).success(function(data) {
                deferred.resolve(data);
            }).error(deferred.reject);
            return deferred.promise;
        },
        create: function(data){
            var deferred = $q.defer();
            var url = APP_CONFIG.services.options.create;
            httpi({
                method: 'POST',
                url: url,
                data: data,
                transformRequest: Helper.transformRequestEncodeURI,
                headers: {'Content-Type': 'application/x-www-form-urlencoded'}
            }).success(function(data) {
                deferred.resolve(data);
            }).error(deferred.reject);
            return deferred.promise;
        },
        update: function(data){
            var deferred = $q.defer();
            var url = APP_CONFIG.services.options.update;
            httpi({
                method: 'PUT',
                url: url,
                data: data
            }).success(function(data) {
                deferred.resolve(data);
            }).error(deferred.reject);
            return deferred.promise;
        },
        updateByOptionKey: function(data){
            var deferred = $q.defer();
            var url = APP_CONFIG.services.options.updateByOptionKey;
            httpi({
                method: 'PUT',
                url: url,
                data: data
            }).success(function(data) {
                deferred.resolve(data);
            }).error(deferred.reject);
            return deferred.promise;
        }
    };
});
