<commit_before>(function (angular) {
    'use strict';

    angular.module('Notepads.services', [])

        .service('Api', [
            '$http',
            function ($http) {
                var apiBase = '/api/v1';
                return {
                    notepads: {
                        list: function() {
                            return $http({
                                url: apiBase + '/notepads?insidecats=1',
                                method: 'GET',
                                cache: false
                            });
                        },
                        getById: function (id) {
                            return $http({
                                url: apiBase + '/notepads/' + id,
                                method: 'GET',
                                cache: false
                            });
                        },
                        add: function(notepad) {
                            return $http({
                                url: apiBase + '/notepads',
                                data: notepad,
                                method: 'POST',
                                cache: false
                            });
                        },
                        update: function(notepad) {
                            return $http({
                                url: apiBase + '/notepads/' + notepad._id,
                                data: notepad,
                                method: 'PUT',
                                cache: false
                            });
                        },
                        remove: function(id) {
                            return $http({
                                url: apiBase + '/notepads/' + id,
                                method: 'DELETE',
                                cache: false
                            });
                        }
                    },
                    categories: {
                        list: function() {
                            return $http({
                                url: apiBase + '/categories',
                                method: 'GET',
                                cache: false
                            });
                        },
                        getById: function (id) {
                            return $http({
                                url: apiBase + '/categories/' + id,
                                method: 'GET',
                                cache: false
                            });
                        },
                        add: function(category) {
                            return $http({
                                url: apiBase + '/categories',
                                data: category,
                                method: 'POST',
                                cache: false
                            });
                        },
                        update: function(category) {
                            return $http({
                                url: apiBase + '/categories/' + category._id,
                                data: category,
                                method: 'PUT',
                                cache: false
                            });
                        },
                        remove: function(id) {
                            return $http({
                                url: apiBase + '/categories/' + id,
                                method: 'DELETE',
                                cache: false
                            });
                        }
                    }
                };
            }
        ])

        .factory('flash', [
            '$rootScope',
            function ($rootScope) {
                //TODO: use the queue and show many messages (with timeout)
                var messages = [],
                    currentMessage = {};

                $rootScope.$on('$routeChangeSuccess', function () {
                    if (messages.length > 0) {
                        currentMessage = messages.shift();
                    } else {
                        currentMessage = {};
                    }
                });

                return {
                    set: function (message) {
                        messages.push(message);
                    },
                    get: function () {
                        return currentMessage;
                    },
                    clear: function () {
                        messages = [];
                        currentMessage = {};
                    }
                };
            }
        ]);

})(angular);<commit_msg>added a Loading service, commented for now<commit_after>(function (angular) {
    'use strict';

    angular.module('Notepads.services', [])

        .service('Api', [
            '$http',
            function ($http) {
                var apiBase = '/api/v1';
                return {
                    notepads: {
                        list: function() {
                            return $http({
                                url: apiBase + '/notepads?insidecats=1',
                                method: 'GET',
                                cache: false
                            });
                        },
                        getById: function (id) {
                            return $http({
                                url: apiBase + '/notepads/' + id,
                                method: 'GET',
                                cache: false
                            });
                        },
                        add: function(notepad) {
                            return $http({
                                url: apiBase + '/notepads',
                                data: notepad,
                                method: 'POST',
                                cache: false
                            });
                        },
                        update: function(notepad) {
                            return $http({
                                url: apiBase + '/notepads/' + notepad._id,
                                data: notepad,
                                method: 'PUT',
                                cache: false
                            });
                        },
                        remove: function(id) {
                            return $http({
                                url: apiBase + '/notepads/' + id,
                                method: 'DELETE',
                                cache: false
                            });
                        }
                    },
                    categories: {
                        list: function() {
                            return $http({
                                url: apiBase + '/categories',
                                method: 'GET',
                                cache: false
                            });
                        },
                        getById: function (id) {
                            return $http({
                                url: apiBase + '/categories/' + id,
                                method: 'GET',
                                cache: false
                            });
                        },
                        add: function(category) {
                            return $http({
                                url: apiBase + '/categories',
                                data: category,
                                method: 'POST',
                                cache: false
                            });
                        },
                        update: function(category) {
                            return $http({
                                url: apiBase + '/categories/' + category._id,
                                data: category,
                                method: 'PUT',
                                cache: false
                            });
                        },
                        remove: function(id) {
                            return $http({
                                url: apiBase + '/categories/' + id,
                                method: 'DELETE',
                                cache: false
                            });
                        }
                    }
                };
            }
        ])

        .factory('flash', [
            '$rootScope',
            function ($rootScope) {
                //TODO: use the queue and show many messages (with timeout)
                var messages = [],
                    currentMessage = {};

                $rootScope.$on('$routeChangeSuccess', function () {
                    if (messages.length > 0) {
                        currentMessage = messages.shift();
                    } else {
                        currentMessage = {};
                    }
                });

                return {
                    set: function (message) {
                        messages.push(message);
                    },
                    get: function () {
                        return currentMessage;
                    },
                    clear: function () {
                        messages = [];
                        currentMessage = {};
                    }
                };
            }
        ])

        /*.service('Loading', [
            function () {
                return {
                    show: function () {

                    },
                    hide: function () {

                    }
                };
            }
        ])*/

    ;

})(angular);
{'fraction_non_alphanumeric': 0.08658410732714138, 'fraction_numerical': 0.0006191950464396285, 'mean_word_length': 0.5087965125330842, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2068801', 'n_tokens_mistral': 1910, 'n_tokens_neox': 1715, 'n_words': 374}