<commit_before>/**
 * @ngdoc service
 * @name  core.service:WsApi
 * @requires ng.$q
 * @requires ng.$http
 * @requires core.service:WsService
 * @requires core.service:AuthServiceApi
 *
 * @description
 *  A service wrapper for the webservices api.
 * 
 */
core.service("WsApi", function($q, $http, WsService, AuthServiceApi) {

	var WsApi = this;

	/**
	 * @ngdoc method
	 * @name  core.service:WsApi#WsApi.listen
	 * @methodOf core.service:WsApi
	 * @param {object} apiReq
	 *  An apireq which containes the channel, controller and method
	 *  which should be listened to.
	 * @returns {Promsie} A promise from a websocket subscription subscription
	 *  
	 * @description 
	 *  This method gives a promise which is notified upon 
	 *  websocket communication on the desired channel
	 * 
	 */
	WsApi.listen = function(apiReq) {
		var request = '/ws/' + apiReq.controller + '/' + apiReq.method;
		var channel = apiReq.endpoint + "/" + apiReq.controller;
		
		if(apiReq.method) {
			channel +=  "/" + apiReq.method;
		}
		return WsService.subscribe(channel);
	};

	/**
	 * @ngdoc method
	 * @name  core.service:WsApi#WsApi.fetch
	 * @methodOf core.service:WsApi
	 * @param {object} apiReq
	 *  An apireq which containes the channel, controller and method
	 *  which should be listened to.
	 * @returns {Promsie} A promise from the WsService send method
	 *  
	 * @description 
	 *  This method gives a promise which is resolved by id upon 
	 *  websocket communication on the desired channel
	 * 
	 */
	WsApi.fetch = function(apiReq) {

		var request = '/ws/' + apiReq.controller + '/' + apiReq.method;	  
		var channel = apiReq.endpoint + "/" + apiReq.controller + "/" + apiReq.method;<commit_msg>Added a manifest argument to the fetch method<commit_after>/**
 * @ngdoc service
 * @name  core.service:WsApi
 * @requires ng.$q
 * @requires ng.$http
 * @requires core.service:WsService
 * @requires core.service:AuthServiceApi
 *
 * @description
 *  A service wrapper for the webservices api.
 * 
 */
core.service("WsApi", function($q, $http, WsService, AuthServiceApi) {

	var WsApi = this;

	/**
	 * @ngdoc method
	 * @name  core.service:WsApi#WsApi.listen
	 * @methodOf core.service:WsApi
	 * @param {object} apiReq
	 *  An apireq which containes the channel, controller and method
	 *  which should be listened to.
	 * @returns {Promsie} A promise from a websocket subscription subscription
	 *  
	 * @description 
	 *  This method gives a promise which is notified upon 
	 *  websocket communication on the desired channel
	 * 
	 */
	WsApi.listen = function(apiReq) {
		var request = '/ws/' + apiReq.controller + '/' + apiReq.method;
		var channel = apiReq.endpoint + "/" + apiReq.controller;
		
		if(apiReq.method) {
			channel +=  "/" + apiReq.method;
		}
		return WsService.subscribe(channel);
	};

	/**
	 * @ngdoc method
	 * @name  core.service:WsApi#WsApi.fetch
	 * @methodOf core.service:WsApi
	 * @param {object} apiReq
	 *  An apireq which containes the channel, controller and method
	 *  which should be listened to.
	 * @returns {Promsie} A promise from the WsService send method
	 *  
	 * @description 
	 *  This method gives a promise which is resolved by id upon 
	 *  websocket communication on the desired channel
	 * 
	 */
	WsApi.fetch = function(apiReq, manifest) {

		if(manifest && manifest.pathValues) {
			var templateKeys = Object.keys(manifest.pathValues);
			for(var i in templateKeys) {
				var key = templateKeys[i];
				var value = manifest.pathValues[key];
				apiReq.method=apiReq.method.replace(new RegExp(':'+key, 'g'), value);
			}
		}

		if(manifest && manifest.data) apiReq.data = manifest.data;

		var request = '/ws/' + apiReq.controller + '/' + apiReq.method;	  
		var channel = apiReq.endpoint + "/" + apiReq.controller + "/" + apiReq.method;
{'fraction_non_alphanumeric': 0.12073976221928666, 'fraction_numerical': 0.0, 'mean_word_length': 3.38702201622248, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '770710', 'n_tokens_mistral': 1305, 'n_tokens_neox': 1146, 'n_words': 340}