How to use baseServer method in Appium

Best JavaScript code snippet using appium

Run Appium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

BaseServer.js

Source: BaseServer.js Github

copy
1/*
2 * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
3 *  
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 
6 * to deal in the Software without restriction, including without limitation 
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
8 * and/or sell copies of the Software, and to permit persons to whom the 
9 * Software is furnished to do so, subject to the following conditions:
10 *  
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *  
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
20 * DEALINGS IN THE SOFTWARE.
21 * 
22 */
23
24/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, forin: true, maxerr: 50, regexp: true */
25/*global define, $ */
26
27define(function (require, exports, module) {
28    "use strict";
29
30    /**
31     * Base class for live preview servers
32     *
33     * Configuration parameters for this server:
34     * - baseUrl      - Optional base URL (populated by the current project)
35     * - pathResolver - Function to covert absolute native paths to project relative paths
36     * - root         - Native path to the project root (and base URL)
37     *
38     * @constructor
39     * @param {!{baseUrl: string, root: string, pathResolver: function(string): string}} config
40     */
41    function BaseServer(config) {
42        this._baseUrl       = config.baseUrl;
43        this._root          = config.root;          // ProjectManager.getProjectRoot().fullPath
44        this._pathResolver  = config.pathResolver;  // ProjectManager.makeProjectRelativeIfPossible(doc.file.fullPath)
45        this._liveDocuments = {};
46    }
47
48    /**
49     * Returns a base url for current project. 
50     *
51     * @return {string}
52     * Base url for current project.
53     */
54    BaseServer.prototype.getBaseUrl = function () {
55        return this._baseUrl;
56    };
57
58    /**
59     * @private
60     * Augments the given Brackets document with information that's useful for live development
61     * @param {Object} liveDocument
62     */
63    BaseServer.prototype._setDocInfo = function (liveDocument) {
64        var parentUrl,
65            matches,
66            doc = liveDocument.doc;
67
68        // FUTURE: some of these things should just be moved into core Document; others should
69        // be in a LiveDevelopment-specific object attached to the doc.
70        matches = /^(.*\/)(.+\.([^.]+))$/.exec(doc.file.fullPath);
71        if (!matches) {
72            return;
73        }
74
75        doc.extension = matches[3];
76
77        parentUrl = this.pathToUrl(matches[1]);
78        doc.url = parentUrl + encodeURI(matches[2]);
79
80        // the root represents the document that should be displayed in the browser
81        // for live development (the file for HTML files)
82        // TODO: Issue #2033 Improve how default page is determined
83        doc.root = { url: doc.url };
84
85        // TODO: Better workflow of liveDocument.doc.url assignment
86        // Force sync the browser after a URL is assigned
87        if (doc.isDirty && liveDocument._updateBrowser) {
88            liveDocument._updateBrowser();
89        }
90    };
91
92    /**
93     * Returns a URL for a given path
94     * @param {string} path Absolute path to covert to a URL
95     * @return {?string} Converts a path within the project root to a URL.
96     *  Returns null if the path is not a descendant of the project root.
97     */
98    BaseServer.prototype.pathToUrl = function (path) {
99        var baseUrl         = this.getBaseUrl(),
100            relativePath    = this._pathResolver(path);
101
102        // See if base url has been specified and path is within project
103        if (relativePath !== path) {
104            // Map to server url. Base url is already encoded, so don't encode again.
105            var encodedDocPath = encodeURI(path);
106            var encodedProjectPath = encodeURI(this._root);
107
108            return encodedDocPath.replace(encodedProjectPath, baseUrl);
109        }
110
111        return null;
112    };
113
114    /**
115     * Convert a URL to a local full file path
116     * @param {string} url
117     * @return {?string} The absolute path for given URL or null if the path is
118     *  not a descendant of the project.
119     */
120    BaseServer.prototype.urlToPath = function (url) {
121        var path,
122            baseUrl = "";
123
124        baseUrl = this.getBaseUrl();
125
126        if (baseUrl !== "" && url.indexOf(baseUrl) === 0) {
127            // Use base url to translate to local file path.
128            // Need to use encoded project path because it's decoded below.
129            path = url.replace(baseUrl, encodeURI(this._root));
130        
131            return decodeURI(path);
132        }
133
134        return null;
135    };
136
137    /**
138     * Called by LiveDevelopment before to prepare the server before navigating
139     * to the project's base URL. The provider returns a jQuery promise.
140     * The Live Development launch process waits until the promise
141     * is resolved or rejected. If the promise is rejected, an error window
142     * is shown and Live Development does not start..
143     *
144     * @return {jQuery.Promise} Promise that may be asynchronously resolved
145     *  when the server is ready to handle HTTP requests.
146     */
147    BaseServer.prototype.readyToServe = function () {
148        // Base implementation always resolves
149        return $.Deferred().resolve().promise();
150    };
151    
152    /**
153     * Determines if this server can serve local file. LiveDevServerManager
154     * calls this method when determining if a server can serve a file.
155     * @param {string} localPath A local path to file being served.
156     * @return {boolean} true When the file can be served, otherwise false.
157     */
158    BaseServer.prototype.canServe = function (localPath) {
159        return true;
160    };
161
162    BaseServer.prototype._documentKey = function (absolutePath) {
163        return "/" + encodeURI(this._pathResolver(absolutePath));
164    };
165
166    /**
167     * Adds a live document to server
168     * @param {Object} liveDocument
169     */
170    BaseServer.prototype.add = function (liveDocument) {
171        if (!liveDocument) {
172            return;
173        }
174        
175        // use the project relative path as a key to lookup requests
176        var key = this._documentKey(liveDocument.doc.file.fullPath);
177        
178        this._setDocInfo(liveDocument);
179        this._liveDocuments[key] = liveDocument;
180    };
181
182    /**
183     * Removes a live document from the server
184     * @param {Object} liveDocument
185     */
186    BaseServer.prototype.remove = function (liveDocument) {
187        if (!liveDocument) {
188            return;
189        }
190        
191        var key = this._liveDocuments[this._documentKey(liveDocument.doc.file.fullPath)];
192        
193        if (key) {
194            delete this._liveDocuments[key];
195        }
196    };
197
198    /**
199     * Lookup a live document using it's full path key
200     * @param {string} path Absolute path to covert to a URL
201     * @param {?Object} liveDocument Returns a live document or undefined if a
202     *     document does not exist for the path.
203     */
204    BaseServer.prototype.get = function (path) {
205        return this._liveDocuments[this._documentKey(path)];
206    };
207
208    /**
209     * Clears all live documents currently attached to the server
210     */
211    BaseServer.prototype.clear = function () {
212        this._liveDocuments = {};
213    };
214
215    /**
216     * Start the server
217     */
218    BaseServer.prototype.start = function () {
219        // do nothing
220    };
221
222    /**
223     * Stop the server
224     */
225    BaseServer.prototype.stop = function () {
226        // do nothing
227    };
228
229    exports.BaseServer = BaseServer;
230});
231
Full Screen

StudentServer.js

Source: StudentServer.js Github

copy
1import {baseServer} from '@/tools/servers'
2
3export class StudentServer {
4
5
6  static addStudent(requestDTO) {
7    let httpMethod = 'POST'
8    let body = baseServer.getArgs(this.addStudent, arguments, httpMethod)
9    return baseServer.connection(httpMethod, '/student/addStudent', body)
10  }
11
12
13  static delStudent(uid) {
14    let httpMethod = 'GET'
15    let body = baseServer.getArgs(this.delStudent, arguments, httpMethod)
16    return baseServer.connection(httpMethod, '/student/delStudentById', body)
17  }
18
19  static batchDeletion(requestDTO) {
20    let httpMethod = 'POST'
21    let body = baseServer.getArgs(this.batchDeletion, arguments, httpMethod)
22    return baseServer.connection(httpMethod, '/student/batchDeletion', body)
23  }
24
25
26
27  static updateStudent(requestDTO) {
28    let httpMethod = 'POST'
29    let body = baseServer.getArgs(this.updateStudent, arguments, httpMethod)
30    return baseServer.connection(httpMethod, '/student/updateStudent', body)
31  }
32
33  static getStudentListData(requestDTO) {
34    let httpMethod = 'POST'
35    let body = baseServer.getArgs(this.getStudentListData, arguments, httpMethod)
36    return baseServer.connection(httpMethod, '/student/getStudentListData', body)
37  }
38
39  static getStudentById(uid) {
40    let httpMethod = 'GET'
41    let body = baseServer.getArgs(this.getStudentById, arguments, httpMethod)
42    return baseServer.connection(httpMethod, '/student/getStudentById', body)
43  }
44
45
46}
47
Full Screen

data.factory.js

Source: data.factory.js Github

copy
1'use strict';
2
3angular.module('dmc.data', [])
4  .factory('dataFactory', function($window, $location) {
5    var baseServer = $window.apiUrl ? $window.apiUrl : '/static/?p=';
6    var baseServerStatic = $window.apiUrl ? $window.apiUrl.substring(0, $window.apiUrl.length - 5) + '/static' : '/static';
7    var localhost = ($location.$$absUrl.indexOf('http://localhost') != -1 || $location.$$absUrl.indexOf(':9000') != -1 ? 'http://localhost:3000/' : '');
8    //localhost = $window.apiUrl ? $window.apiUrl + '/' : localhost;
9    localhost = 'http://localhost:3000/';
10    console.log('localhost ' + localhost)
11    var urlSocketServer = 'http://localhost:3000/';
12    var appendId = function(id) {
13      return ($window.apiUrl && id ? '/' + id : '');
14    };
15    var webServiceUrl = function(path, action, id) {
16      var wsurl;
17      if ($window.apiUrl && id) {
18        wsurl = '/' + path + '/' + id;
19        wsurl += action ? '/' + action : '';
20      } else {
21        wsurl = '/' + action;
22      }
23      return wsurl;
24    };
25
26    var convertParams = function(params) {
27      return $.map(params, function(item, key) {
28        return key + '=' + item;
29      }).join('&');
30    };
31
32return {
33      get_result: function(data) {
34        var obj = {};
35        if ($window.apiUrl) {
36          if (data.length >= 1) {
37            obj.result = data;
38            obj.count = data.length;
39          } else {
40            obj.result = data;
41          }
42        } else {
43          obj = data;
44        }
45        return obj;
46      },
47      get_request_obj: function(source) {
48        var obj = {}
49        if ($window.apiUrl) {
50          obj = _.transform(source, function(result, value, key) {
51            if (value && key != 'projectId' && key != 'profileId' && key != 'companyId') {
52              result['_' + key] = value;
53            }
54          });
55        } else {
56          obj = source;
57        }
58        return obj;
59      },
60      url_php_server: function() {
61        return baseServer;
62      },
63      url_socket_server: function() {
64        return urlSocketServer;
65      },
66      getUrlAllServices: function(id) {
67        // return baseServer+'/services'+appendId(id);
68        return baseServer + webServiceUrl('projects', 'services', id);
69      },
70      getUrlChangeService: function(id) {
71        return baseServer + '/change_service' + appendId(id);
72      },
73      getStaticJSON: function(id) {
74        return baseServerStatic + '/staticJSON.php?title=' + id;
75      },
76      getUrlAllTasks: function(id) {
77        // return baseServer+'/tasks'+appendId(id);
78        return baseServer + webServiceUrl('projects', 'tasks', id);
79      },
80      getUrlChangeTask: function(id) {
81        return baseServer + '/change_tasks' + appendId(id);
82      },
83      getUrlAllDiscussions: function(id) {
84        // return baseServer+'/discussions'+appendId(id);
85        return baseServer + webServiceUrl('projects', 'all-discussions', id);
86      },
87      getUrlAllProjects: function(id) {
88        return baseServer + '/projects';
89      },
90      getWorspaceByName: function(name) {
91        return localhost + 'searchworkspace/' + name;
92      },
93      getUrlAllComponents: function(id) {
94        return baseServer + webServiceUrl('projects', 'components', id);
95      },
96      getUrlAllProducts: function() {
97        return baseServer + '/products';
98      },
99      getUrlAddToProject: function(id) {
100        return baseServer + '/add_to_project' + appendId(id);
101      },
102      getUrlRemoveFromProject: function(id) {
103        return baseServer + '/remove_from_project' + appendId(id);
104      },
105      getUrlAllDocuments: function(id) {
106        return baseServer + '/documents' + appendId(id);
107      },
108      getDocumentUpload: function(id) {
109        return baseServer + '/upload' + appendId(id);
110      },
111      documentUpload: function() {
112        return baseServer + '/upload';
113      },
114      getUrlCreateTask: function(id) {
115        var url = baseServer + '/create_task' + appendId(id);
116        if (window.apiUrl) {
117          url = baseServer + '/tasks/create';
118        }
119        return url
120      },
121      getProduct: function() {
122        return baseServer + '/product';
123      },
124      getProductReview: function() {
125        return baseServer + '/get_product_review';
126      },
127      addProductReview: function() {
128        return baseServer + '/add_product_review';
129      },
130      addLikeDislike: function() {
131        return baseServer + '/add_like_dislike';
132      },
133      editProduct: function() {
134        return baseServer + '/edit_product';
135      },
136      uploadAccountPictureUrl: function() {
137        return baseServer + '/upp';
138      },
139      uploadCompanyPictureUrl: function() {
140        return baseServer + '/ucp';
141      },
142      uploadCompanyLogoUrl: function() {
143        return baseServer + '/ucl';
144      },
145      uploadCompanyProfileImageUrl: function() {
146        return baseServer + '/uci';
147      },
148      uploadCompanyProfileSkillImageUrl: function() {
149        return baseServer + '/ucsi';
150      },
151      uploadProfilePictureUrl: function() {
152        return baseServer + '/uprpic';
153      },
154      removeCompanyImages: function() {
155        return baseServer + '/remove_company_images';
156      },
157      removeCompanySkillsImages: function() {
158        return baseServer + '/remove_company_skills_images';
159      },
160      getAccountUrl: function(id) {
161        return baseServer + '/get_account' + appendId(id);
162      },
163      getCompanyUrl: function(id) {
164        var idString = $window.apiUrl ? '' : '&id=' + id;
165        return baseServer + '/companies' + appendId(id) + idString;
166      },
167      getCompanyShortUrl: function(id){
168          return baseServer+'/companies/short';
169      },
170      getCompanyReviewUrl: function(id) {
171        // return baseServer+'/get_review_company';
172        return baseServer + webServiceUrl('companies', 'company_reviews', id);
173      },
174      addCompanyReviewUrl: function() {
175        return baseServer + '/add_review_company';
176      },
177      getFeaturesCompany: function(id) {
178        // return baseServer+'/company_featured';
179        return baseServer + webServiceUrl('companies', 'company_featured', id);
180      },
181      saveCompanyChanges: function() {
182        return baseServer + '/save_company_changes';
183      },
184      addProductToFavorite: function() {
185        return baseServer + '/add_product_to_favorite';
186      },
187      getProfile: function(id) {
188        return baseServer + '/profiles' + appendId(id);
189      },
190      editProfile: function() {
191        return baseServer + '/edit_profile';
192      },
193      getProfileReview: function(id) {
194        return baseServer + webServiceUrl('profiles', 'profile_reviews', id);
195      },
196      addProfileReview: function() {
197        return baseServer + '/add_profile_review';
198      },
199      updateFeaturesPosition: function() {
200        return baseServer + '/update_features_position';
201      },
202      addDiscussionLikeDislike: function() {
203        return baseServer + '/add_discussion_like_dislike';
204      },
205      logoutUrl: function(custom) {
206        var home = $window.location.origin;
207        return home + '/Shibboleth.sso/Logout?return=' + (custom || home);
208      },
209
210
211
212      // direct requests
213      shareService: function() {
214        return localhost + 'shared-services';
215      },
216      deleteService: function(id) {
217        return localhost + 'services/' + id;
218      },
219      followDiscussion: function() {
220        return localhost + 'follow_discussions';
221      },
222      isUserFollowedDiscussion: function(id) {
223        return localhost + 'accounts/' + id + '/follow_discussions';
224      },
225      unfollowDiscussion: function(id) {
226        return localhost + 'follow_discussions/' + id;
227      },
228      getChildren: function() {
229        return localhost + 'getChildren';
230      },
231      getModel: function() {
232        return localhost + 'getModel';
233      },
234      runModel: function() {
235        return localhost + 'model_run';
236      },
237      runModelWithFile: function() {
238        return localhost + 'model_run_file';
239      },
240      pollModel: function(id) {
241        return localhost + 'model_poll/' + id;
242      },
243      updateServiceStatus: function(id) {
244        return localhost + 'service_runs/' + id;
245      },
246      cancelServiceRun: function(id) {
247        return localhost + 'service_runs/cancel_run/' + id;
248      },
249      getServiceRun: function(id) {
250        return localhost + 'service_runs/' + id;
251      },
252      runService: function() {
253        return localhost + 'service_runs';
254      },
255      getServiceStatus: function(id) {
256        return localhost + 'services/' + id + '/service_runs';
257      },
258      createPublishService: function() {
259        return localhost + 'publish-services';
260      },
261      getFollowCompanies: function(id) {
262        return localhost + 'accounts/' + id + '/following_companies';
263      },
264      getFollowCompanyServices: function() {
265        return localhost + 'follow-company-services';
266      },
267      getServiceDocuments: function(id) {
268        return localhost + 'service/' + id + '/service_documents';
269      },
270      getProjectDocuments: function(id) {
271        return localhost + 'projects/' + id + '/project_documents';
272      },
273      addProjectDocument: function() {
274        return localhost + 'project_documents';
275      },
276      updateProjectDocument: function(id) {
277        return localhost + 'project_documents/' + id;
278      },
279      deleteProjectDocument: function(id) {
280        return localhost + 'project_documents/' + id;
281      },
282      addServiceToProject: function(id) {
283        return localhost + 'services/' + id;
284      },
285      getMembersUrl: function(id) {
286        return localhost + 'members';
287      },
288      getMembersToProject: function() {
289        return localhost + 'projects_members';
290      },
291      createMembersToProject: function() {
292        return localhost + 'projects_members';
293      },
294      acceptProject: function(projectId, memberId) {
295        return localhost + 'projects/' + projectId + '/accept/' + memberId;
296      },
297      declineProject: function(projectId, memberId) {
298        return localhost + 'projects/' + projectId + '/reject/' + memberId;
299      },
300      getProjectMembers: function(id) {
301        return localhost + 'projects_members';
302      },
303      getMembersToProjectById: function(id) {
304        return localhost + 'projects_members/' + id;
305      },
306      updateMembersToProject: function(id) {
307        return localhost + 'projects_members/' + id;
308      },
309      inviteToProject: function(pid, uid) {
310        return localhost + 'project/' + pid + '/invite/' + uid;
311      },
312      removeMembersToProject: function(id) {
313        return localhost + 'projects_members/' + id;
314      },
315      joinProject: function() {
316        return localhost + 'projects_join_requests';
317      },
318      joinProjectRequests: function(id) {
319        return localhost + 'projects/' + id + '/joinApprovalRequests';
320      },
321      manageJoinRequests: function(id) {
322        return {
323          accept: localhost + 'projectJoinApprovalRequests/' + id + '?action=approve',
324          decline: localhost + 'projectJoinApprovalRequests/' + id + '?action=decline'
325        };
326      },
327      getProjectsJoinRequests: function() {
328        return localhost + 'projects_join_requests';
329      },
330      getProjectJoinRequests: function(id) {
331        return localhost + 'projects/' + id + '/projects_join_requests';
332      },
333      deleteProjectJoinRequests: function(id) {
334        return localhost + 'projects_join_requests/' + id;
335      },
336      updateProjectJoinRequests: function(id) {
337        return localhost + 'projects_join_requests/' + id;
338      },
339      addCompanyJoinRequest: function() {
340        return localhost + 'companies_join_requests';
341      },
342      cancelCompanyJoinRequest: function(id) {
343        return localhost + 'companies_join_requests/' + id;
344      },
345      getProfileCompanyJoinRequest: function(id) {
346        return localhost + 'profiles/' + id + '/companies_join_requests';
347      },
348      addSuggestJoinCompany: function() {
349        return localhost + 'suggest_join_companies';
350      },
351      cancelSuggestJoinCompany: function(id) {
352        return localhost + 'suggest_join_companies/' + id;
353      },
354      getSuggestJoinCompany: function(id) {
355        return localhost + 'companies/' + id + '/suggest_join_companies';
356      },
357      followMember: function(id) {
358        return localhost + 'following_members' + (id ? '/' + id : '');
359      },
360      getAccountFollowedMembers: function(id) {
361        return localhost + 'accounts/' + id + '/following_members';
362      },
363      projectMembers: function(id) {
364        return localhost + 'projects/' + id + '/projects_members';
365      },
366      deleteProjectMember: function(id) {
367        return localhost + 'projects_members/' + id;
368      },
369      deleteProject: function(id) {
370        return localhost + 'projects/' + id;
371      },
372      getCreateProject: function() {
373        return localhost + 'projects/create';
374      },
375      getProjects: function(type) {
376        return localhost + (type == 'all-projects' ? 'projects/all' : 'projects');
377      },
378      getPublicProjects: function() {
379        return localhost + 'projects/public';
380      },
381      getMyProjects: function() {
382        return localhost + 'projects/my-projects';
383      },
384      getProject: function(id) {
385        return localhost + 'projects/' + id;
386      },
387      updateProject: function(id) {
388        return localhost + 'projects/' + id;
389      },
390      addProjectTag: function() {
391        return localhost + 'projects_tags';
392      },
393      getProjectsTags: function() {
394        return localhost + 'projects_tags';
395      },
396      deleteProjectTag: function(id) {
397        return localhost + 'projects_tags/' + id;
398      },
399      getProjectTags: function(id) {
400        return localhost + 'projects/' + id + '/projects_tags/';
401      },
402      getAssignUsers: function() {
403        return localhost + 'assign_users';
404      },
405      createTask: function() {
406        return localhost + 'tasks/create';
407      },
408      updateTask: function(id) {
409        return localhost + 'tasks/' + id;
410      },
411      getMyServices: function() {
412        return localhost + 'my-services';
413      },
414      getMyTasks: function() {
415        return localhost + 'my-tasks';
416      },
417      getTasks: function(projectId) {
418        if (projectId) {
419          return localhost + 'projects/' + projectId + '/tasks';
420        } else {
421          return localhost + 'tasks';
422        }
423      },
424      getTask: function(id) {
425        return localhost + 'tasks/' + id;
426      },
427      deleteTask: function(id) {
428        return localhost + 'tasks/' + id;
429      },
430      followCompany: function() {
431        return localhost + 'company/follow';
432      },
433      unfollowCompany: function(id) {
434        return localhost + 'company/unfollow/' + id;
435      },
436      getRelatedArticles: function(id) {
437        return localhost + 'faq_articles';
438      },
439      getFAQArticle: function(id) {
440        return localhost + 'faq_articles/' + id;
441      },
442      getFAQSubcategories: function() {
443        return localhost + 'faq_subcategories';
444      },
445      getFAQCategories: function() {
446        return localhost + 'faq_categories';
447      },
448      getEvents: function() {
449        return localhost + 'events';
450      },
451      getAnnouncements: function() {
452        return localhost + 'announcements';
453      },
454      getAnnouncementsComments: function(id) {
455        return localhost + 'announcements/' + id + '/announcement_comments';
456      },
457      updateCompanyFeaturedPosition: function(id) {
458        return localhost + 'company_featured/' + id + '/position';
459      },
460      addCompanyFeatured: function() {
461        return localhost + 'company_featured/add';
462      },
463      removeCompanyFeatured: function(id) {
464        return localhost + 'company_featured/' + id;
465      },
466      getCompanyFeatured: function(id) {
467        return localhost + 'companies/' + id + '/company_featured';
468      },
469      getCompanyServices: function(id) {
470        return localhost + 'companies/' + id + '/company_services';
471      },
472      getCompanyComponents: function(id) {
473        return localhost + 'companies/' + id + '/company_components';
474      },
475      getNewCompanyServices: function(id) {
476        return localhost + 'companies/' + id + '/new';
477      },
478      createStorefrontMessage: function() {
479        return localhost + 'messages';
480      },
481      userRole: function() {
482        return localhost + 'userRole';
483      },
484      updateUser: function() {
485        return localhost + 'user';
486      },
487      generateToken: function(id) {
488        return localhost + 'user/createtoken?userId=' + id;
489      },
490      emailToken: function(id, token) {
491        return localhost + 'users/' + id + '/email?token=' + token;
492      },
493      validateToken: function(id, token) {
494        return localhost + 'users/' + id + '?action=verify'
495      },
496      unverify: function(id) {
497        return localhost + 'users/' + id + '?action=unverify';
498      },
499      declineMember: function(id) {
500        return localhost + 'users/' + id + '?action=decline';
501      },
502      uploadApplication: function() {
503        return localhost + 'appSubmission';
504      },
505      getApplicationNames: function() {
506        return localhost + 'appSubmission/appName';
507      },
508      getDmdiiMemberTags: function() {
509        return localhost + 'tags/dmdiiMember';
510      },
511      getOrgTags: function() {
512        return localhost + 'tags/organization';
513      },
514      getUsersByOrganization: function(id) {
515        return localhost + 'user/organization/' + id
516        //add paged and filtered
517      },
518      changeUserOrganization: function(id) {
519        return localhost + 'users/' + id + '/organizations';
520      },
521      getOrganizationList: function() {
522        return localhost + 'organizations';
523      },
524      getOrganization: function(id) {
525        return localhost + 'organizations/' + id;
526      },
527      updateOrganization: function(id) {
528        return localhost + 'organizations/' + id;
529      },
530      createOrganization: function(id) {
531        return localhost + 'organizations/';
532      },
533      deleteOrganization: function(id) {
534        return localhost + 'organizations/' + id;
535      },
536      getDocument: function() {
537        return {
538          byType: localhost + 'documents/organization'
539        }
540      },
541      getDMDIIMember: function(id) {
542        return {
543          get: localhost + 'dmdiiMember/' + id,
544          all: localhost + 'dmdiiMember',
545          full: localhost + 'dmdiiMember/all',
546          search: localhost + 'dmdiiMember/search',
547          map: localhost + 'dmdiiMember/mapEntry'
548        }
549      },
550      dmdiiMemberNewsUrl: function(id) {
551        return {
552          get: localhost + 'dmdiiMember/news',
553          save: localhost + 'dmdiiMember/news',
554          delete: localhost + 'dmdiiMember/news/' + id
555        }
556      },
557      dmdiiMemberEventUrl: function(id) {
558        return {
559          get: localhost + 'dmdiiMember/events',
560          save: localhost + 'dmdiiMember/events',
561          delete: localhost + 'dmdiiMember/events/' + id
562        }
563      },
564      getDMDIIMemberProjects: function() {
565        return {
566          prime: localhost + 'dmdiiprojects/member',
567          contributing: localhost + 'contributingCompanies'
568        }
569      },
570      saveDMDIIMember: function() {
571        return {
572          member: localhost + 'dmdiiMember/save'
573        }
574      },
575      getDMDIIProject: function(id) {
576        return {
577          get: localhost + 'dmdiiProject/' + id,
578          all: localhost + 'dmdiiprojects',
579          delete: localhost + 'dmdiiProjects/' + id,
580          active: localhost + 'dmdiiprojects/member/active',
581          contributors: localhost + 'dmdiiproject/contributingcompanies',
582          search: localhost + 'dmdiiprojects/search'
583        }
584      },
585      getDMDIIEvents: function(id) {
586        return {
587          get: localhost + 'dmdiievent/' + id,
588          all: localhost + 'dmdiievents'
589        }
590      },
591      saveDMDIIProject: function() {
592        return {
593          project: localhost + 'dmdiiProject/save'
594        }
595      },
596      dmdiiProjectUpdateUrl: function(id) {
597        return {
598          get: localhost + 'dmdiiProjectUpdate',
599          save: localhost + 'dmdiiProjectUpdate',
600          delete: localhost + 'dmdiiProjectUpdate/' + id
601        }
602      },
603      dmdiiProjectEventUrl: function(id) {
604        return {
605          get: localhost + 'dmdiiProject/events',
606          save: localhost + 'dmdiiProject/events',
607          delete: localhost + 'dmdiiProject/events/' + id
608        }
609      },
610      dmdiiProjectNewsUrl: function(id) {
611        return {
612          get: localhost + 'dmdiiProject/news',
613          save: localhost + 'dmdiiProject/news',
614          delete: localhost + 'dmdiiProject/news/' + id
615        };
616      },
617      quicklinkUrl: function(id) {
618        return {
619          get: localhost + 'dmdiiquicklink',
620          save: localhost + 'dmdiiquicklink',
621          delete: localhost + 'dmdiiquicklink/' + id
622        };
623      },
624      payment: function(){
625        return {
626          pay: localhost + 'payment',
627          organizations: localhost + 'organizations/user'
628        };
629      },
630      getDMDIIDocuments: function(id) {
631        return {
632          all: localhost + 'dmdiidocuments',
633          single: localhost + 'dmdiidocument/' + id,
634          project: localhost + 'dmdiidocuments/dmdiiProjectId',
635          overview: localhost + 'staticdocument/1',
636          status: localhost + 'staticdocument/2',
637          projectDocument: localhost + 'dmdiidocument/filetype'
638        };
639      },
640      saveDMDIIDocument: function() {
641        return localhost + 'dmdiidocument';
642      },
643      deleteDMDIIDocument: function(id) {
644        return localhost + 'dmdiidocument/' + id;
645      },
646      documentsUrl: function(id, user, internal, email, url) {
647        return {
648          getSingle: localhost + 'documents/' + id,
649          getList: localhost + 'documents',
650          getListIds: localhost + 'documents?ids=' + id,
651          download: localhost + 'documents/' + id + '/download',
652          save: localhost + 'documents',
653          update: localhost + 'documents/' + id,
654          delete: localhost + 'documents/' + id,
655          versioned: localhost + 'documents/versions/' + id,
656          s_versioned: localhost + 'documents/s_versions/' + id,
657          // share: localhost + 'documents/'+id+'/user/'+userid
658          share: localhost + 'documents/' + id + '/share?user=' + user + '&internal=' + internal + '&email=' + email,
659          accept: localhost + 'documents/' + id + '/accept',
660          shareWs: localhost + 'documents/' + id + '/shareWs?ws=' + user,
661          // saveSr: localhost + 'documents/' + id + '/saveSr?url=' + user
662          saveSr: localhost + 'documents/' + id + '/saveSr'
663        }
664      },
665      directoriesUrl: function(id) {
666        var endpoint = 'directories/';
667        return {
668          get: localhost + endpoint + id,
669          list: localhost + endpoint,
670          save: localhost + endpoint,
671          update: localhost + endpoint + id,
672          delete: localhost + endpoint + id,
673          files: localhost + 'documents/' + endpoint + id,
674          s_files: localhost + 'documents/' + 's_' + endpoint + id
675        }
676      },
677      getApplicationTags: function() {
678        return localhost + 'applicationTag'
679      },
680      getDmdiiDocumentTags: function() {
681        return localhost + 'dmdiidocuments/getAllTags';
682      },
683      getDocumentTags: function() {
684        return localhost + 'documents/tags';
685      },
686      createDocumentTag: function() {
687        return localhost + 'dmdiidocuments/saveDocumentTag';
688      },
689      getNonDmdiiMembers: function() {
690        return localhost + 'organization/nonMember';
691      },
692      // companies ------------------
693      companyURL: function(id) {
694        var name = 'companies';
695        return {
696          get: localhost + name + '/' + id,
697          update: localhost + name + '/' + id,
698          delete: localhost + name + '/' + id,
699          create: localhost + name,
700          all: localhost + name,
701	        short : localhost+name+'/short',
702          reviews: localhost + name + '/' + id + '/company_reviews?reviewId=0',
703          addReviews: localhost + 'company_reviews',
704          get_review: localhost + 'company_reviews/' + id,
705          update_review: localhost + 'company_reviews/' + id,
706          getReply: localhost + 'company_reviews?reviewId=' + id,
707          getHelpful: localhost + 'company_reviews_helpful',
708          addHelpful: localhost + 'company_reviews_helpful',
709          updateHelpful: localhost + 'company_reviews_helpful/' + id,
710          getFlagged: localhost + 'company_reviews_flagged',
711          addFlagged: localhost + 'company_reviews_flagged',
712          history: localhost + name + '/' + id + '/company_history',
713          profiles: localhost + name + '/' + id + '/profiles',
714          get_removed_members: localhost + name + '/' + id + '/removed_company_members',
715          remove_member: localhost + 'removed_company_members',
716          remove_member_from_removed: localhost + 'removed_company_members/' + id,
717          get_member_requests: localhost + name + '/' + id + '/companies_join_requests',
718          approve_member: localhost + 'companies_join_requests/' + id,
719          decline_member: localhost + 'companies_join_requests/' + id,
720          add_contact_method: localhost + 'company_contact_methods',
721          get_contact_methods: localhost + name + '/' + id + '/company_contact_methods',
722          update_contact_method: localhost + 'company_contact_methods/' + id,
723          delete_contact_method: localhost + 'company_contact_methods/' + id
724        }
725      },
726      // ---------------------------
727      updateAccount: function(id) {
728        return localhost + 'accounts/' + id;
729      },
730      getAccount: function(id) {
731        return localhost + 'accounts/' + id;
732      },
733      // servers ------------------
734      serverURL: function(id) {
735        var name = 'account_servers';
736        return {
737          get: localhost + name + '/' + id,
738          update: localhost + name + '/' + id,
739          delete: localhost + name + '/' + id,
740          create: localhost + name,
741          all: localhost + name
742        }
743      },
744      getAccountServersUrl: function(id) {
745        return localhost + 'accounts/' + id + '/account_servers';
746      },
747      getServerSecureUrl: function(id) {
748        return localhost + 'accounts/' + id + '/servers';
749      },
750      // ---------------------------
751      getServices: function(projectId) {
752        if (projectId) {
753          return localhost + 'projects/' + projectId + '/services';
754        } else {
755          return localhost + 'services';
756        }
757      },
758      getComponents: function() {
759        return localhost + 'components';
760      },
761      getMarketPopularServices: function() {
762        return localhost + 'market/popular_services';
763      },
764      getMarketNewServices: function() {
765        return localhost + 'market/new_services';
766      },
767      getMarketServices: function() {
768        return localhost + 'market/new_services';
769      },
770      getMarketComponents: function() {
771        return localhost + 'market/components';
772      },
773      getMarketPlaceServices: function() {
774          return localhost + 'market/services';
775      },
776      getServicesTags: function() {
777        return localhost + 'service_tags';
778      },
779      getDefaultServices: function() {
780        return localhost + 'defaultServices';
781      },
782      getDefaultService: function(parentId) {
783        return localhost + 'defaultServices/' + parentId;
784      },
785      userFavorites: function(contentId, contentType) {
786          var name = 'userFavorites';
787          return {
788              get: localhost + name + ((contentType != null) ? '?contentType=' + contentType : ''),
789              create: localhost + name + '?contentId=' + contentId + '&contentType=' + contentType,
790              delete: localhost + name + '?contentId=' + contentId + '&contentType=' + contentType,
791          };
792      },
793      /// profiles -----------------
794      profiles: function(id) {
795        var name = 'profiles';
796        return {
797          get: localhost + name + '/' + id,
798          update: localhost + name + '/' + id,
799          reviews: localhost + name + '/' + id + '/profile_reviews?reviewId=0',
800          get_review: localhost + 'profile_reviews/' + id,
801          addReviews: localhost + 'profile_reviews',
802          update_review: localhost + 'profile_reviews/' + id,
803          getReply: localhost + 'profile_reviews?reviewId=' + id,
804          getHelpful: localhost + 'profile_reviews_helpful',
805          addHelpful: localhost + 'profile_reviews_helpful',
806          updateHelpful: localhost + 'profile_reviews_helpful/' + id,
807          getFlagged: localhost + 'profile_reviews_flagged',
808          addFlagged: localhost + 'profile_reviews_flagged',
809          history: localhost + name + '/' + id + '/profile_history',
810          all: localhost + name
811        }
812      },
813      getRecentUpdates: function() {
814        return localhost + 'recent_updates';
815      },
816      // ---------------------------
817
818
819      /// components -----------------
820      components: function(type, id) {
821        var name = type;
822        return {
823          get: localhost + name + '/' + id,
824          update: localhost + name + '/' + id,
825          all: localhost + name,
826          getReply: localhost + 'product_reviews?reviewId=' + id,
827          get_review: localhost + 'product_reviews/' + id,
828          update_review: localhost + 'product_reviews/' + id,
829          reviews: localhost + 'product/' + id + '/product_reviews?productType=' + type + '&reviewId=0',
830          addReviews: localhost + 'product_reviews',
831          getHelpful: localhost + 'product_reviews_helpful',
832          addHelpful: localhost + 'product_reviews_helpful',
833          updateHelpful: localhost + 'product_reviews_helpful/' + id,
834          getFlagged: localhost + 'product_reviews_flagged',
835          addFlagged: localhost + 'product_reviews_flagged',
836          get_included: localhost + 'included-services',
837          remove_included: localhost + 'included-services/' + id,
838          add_included: localhost + 'included-services',
839          get_tags: localhost + 'service_tags',
840          add_tags: localhost + 'service_tags',
841          get_images: localhost + name + '/' + id + '/service_images',
842          add_images: localhost + 'service_images',
843          remove_images: localhost + 'service_images/' + id,
844          remove_tags: localhost + 'service_tags/' + id,
845          edit_specifications: localhost + 'specifications/' + id,
846          get_array_specifications: localhost + 'array_specifications',
847          add_array_specifications: localhost + 'array_specifications'
848        }
849      },
850      // ---------------------------
851
852      /// services -----------------
853      services: function(id) {
854        var name = 'services';
855        return {
856          get: localhost + name + '/' + id,
857          getArray: localhost + name + "?id=" + id,
858          add: localhost + name,
859          get_for_project: localhost + 'projects/' + id + '/' + name,
860          update: localhost + name + '/' + id,
861          all: localhost + name,
862          getReply: localhost + 'product_reviews?reviewId=' + id,
863          reviews: localhost + 'product/' + id + '/product_reviews?reviewId=0',
864          get_review: localhost + 'product_reviews/' + id,
865          update_review: localhost + 'product_reviews/' + id,
866          addReviews: localhost + 'product_reviews',
867          getHelpful: localhost + 'product_reviews_helpful',
868          addHelpful: localhost + 'product_reviews_helpful',
869          updateHelpful: localhost + 'product_reviews_helpful/' + id,
870          getFlagged: localhost + 'product_reviews_flagged',
871          addFlagged: localhost + 'product_reviews_flagged',
872          get_authors: localhost + 'services/' + id + '/service_authors',
873          remove_authors: localhost + 'service_authors/' + id,
874          add_authors: localhost + 'service_authors',
875          get_tags: localhost + name + '/' + id + '/service_tags',
876          add_tags: localhost + 'service_tags',
877          remove_tags: localhost + 'service_tags/' + id,
878          update_tag: localhost + 'service_tags/' + id,
879          get_history: localhost + name + '/' + id + '/services_history',
880          get_run_history: localhost + 'service_runs' + '?serviceId=' + id,
881          get_servers: localhost + 'account_servers',
882          add_servers: localhost + 'services_servers',
883          get_array_specifications: localhost + 'array_specifications',
884          add_array_specifications: localhost + 'array_specifications',
885          get_specifications: localhost + name + '/' + id + '/specifications',
886          add_specifications: localhost + 'service/' + id + '/specifications',
887          update_specifications: localhost + '/specifications/' + id,
888          get_statistics: localhost + name + '/' + id + '/services_statistic',
889          add_interface: localhost + 'dome-interfaces',
890          get_interface: localhost + name + '/' + id + '/dome-interfaces',
891          update_interface: localhost + 'dome-interfaces/' + id,
892          get_position_inputs: localhost + name + '/' + id + '/input-positions',
893          update_position_inputs: localhost + 'input-positions/' + id,
894          add_position_inputs: localhost + 'input-positions'
895        }
896      },
897      // ---------------------------
898
899      uploadServiceImageUrl: function() {
900        return baseServer + '/uploadServiceImage';
901      },
902
903      getFavoriteProducts: function() {
904        return localhost + 'favorite_products';
905      },
906      deactivateAccount: function(id) {
907        return localhost + 'accounts' + (id ? '/' + id : '');
908      },
909      getDiscussions: function(projectId, dataTypeWidget) {
910        if (!projectId && !dataTypeWidget) {
911          return localhost + 'individual-discussions';
912        } else {
913          if (projectId) {
914            if (dataTypeWidget) {
915              switch (dataTypeWidget) {
916                case 'following':
917                  return localhost + 'projects/' + projectId + '/following_discussions';
918                default:
919                  return localhost + 'projects/' + projectId + '/individual-discussions';
920              }
921            } else {
922              return localhost + 'projects/' + projectId + '/individual-discussion';
923            }
924          } else if (dataTypeWidget) {
925            switch (dataTypeWidget) {
926              case 'following':
927                return localhost + 'following_discussions';
928              case 'popular':
929                return localhost + 'popular_discussions';
930              case 'follow-people':
931                return localhost + 'follow_people_discussions';
932              default:
933                return localhost + 'individual-discussion';
934            }
935          }
936        }
937      },
938      deleteCompanyLogo: function(id) {
939        return localhost + 'companies' + (id ? '/' + id : '');
940      },
941      saveChangedDiscussionComment: function(id) {
942        return localhost + 'individual-discussion-comments' + (id ? '/' + id : '');
943      },
944      addDiscussionTag: function() {
945        return localhost + 'individual-discussion-tags';
946      },
947      getLastDiscussionTagId: function() {
948        return localhost + 'individual-discussion-tags';
949      },
950      getDiscussionTags: function(id) {
951        return localhost + 'individual-discussion/' + id + '/individual-discussion-tags'
952      },
953      deleteDiscussionTag: function(id) {
954        return localhost + 'individual-discussion-tags' + (id ? '/' + id : '');
955      },
956      deleteDiscussionComment: function(id) {
957        return localhost + 'individual-discussion-comments' + (id ? '/' + id : '');
958      },
959      getDiscussionComments: function(id) {
960        return localhost + 'individual-discussion/' + id + '/individual-discussion-comments?commentId=0';
961      },
962      ///
963      getDiscussionsReply: function(id) {
964        return localhost + 'individual-discussion-comments?commentId=' + id;
965      },
966      getDiscussionCommentsHelpful: function() {
967        return localhost + 'individual-discussion-comments-helpful';
968      },
969      addDiscussionCommentsHelpful: function() {
970        return localhost + 'individual-discussion-comments-helpful';
971      },
972      updateDiscussionCommentsHelpful: function(id) {
973        return localhost + 'individual-discussion-comments-helpful/' + id;
974      },
975      getDiscussionCommentsFlagged: function() {
976        return localhost + 'individual-discussion-comments-flagged';
977      },
978      addDiscussionCommentsFlagged: function() {
979        return localhost + 'individual-discussion-comments-flagged';
980      },
981      ///
982      getIndividualDiscussion: function(id) {
983        return localhost + 'individual-discussion' + (id ? '/' + id : '');
984      },
985      getIndividualDiscussions: function() {
986        return localhost + 'individual-discussion';
987      },
988      addCommentIndividualDiscussion: function() {
989        return localhost + 'individual-discussion-comments'
990      },
991      getLastDiscussionCommentId: function() {
992        return localhost + 'individual-discussion-comments'
993      },
994      getLastDiscussionId: function() {
995        return localhost + 'individual-discussion'
996      },
997      addDiscussion: function() {
998        return localhost + 'individual-discussion'
999      },
1000      /*
1001      getCompanyImages : function(id){
1002          return localhost+'companies/'+id+'/company_images'
1003      },
1004      getCompanySkillsImages: function(id){
1005          return localhost+'companies/'+id+'/company_skill_images'
1006      },
1007      getCompanyVideos : function(id){
1008          return localhost+'companies/'+id+'/company_videos'
1009      },
1010      getCompanySkills : function(id){
1011          return localhost+'companies/'+id+'/company_skills'
1012      },
1013      */
1014      getCompanyMembers: function(id) {
1015        return localhost + 'companies/' + id + '/company_members'
1016      },
1017      getCompanyKeyContacts: function(id) {
1018        return localhost + 'companies/' + id + '/company_key_contacts'
1019      },
1020      addCompanySkill: function() {
1021        return localhost + 'company_skills'
1022      },
1023      getLastCompanySkillId: function() {
1024        return localhost + 'company_skills'
1025      },
1026      deleteCompanySkill: function(id) {
1027        return localhost + 'company_skills/' + id;
1028      },
1029      getLastCompanyContactId: function() {
1030        return localhost + 'company_key_contacts'
1031      },
1032      addCompanyContact: function() {
1033        return localhost + 'company_key_contacts'
1034      },
1035      updateCompany: function(id) {
1036        return localhost + 'companies/' + id;
1037      },
1038      updateCompanyProfile: function(id) {
1039        return localhost + 'companies/' + id;
1040      },
1041      getLastCompanyVideoId: function() {
1042        return localhost + 'company_videos';
1043      },
1044      addCompanyVideo: function() {
1045        return localhost + 'company_videos';
1046      },
1047      deleteCompanyVideo: function(id) {
1048        return localhost + 'company_videos/' + id;
1049      },
1050      deleteCompanyContact: function(id) {
1051        return localhost + 'company_key_contacts/' + id;
1052      },
1053      updateCompanyImage: function(id) {
1054        return localhost + 'company_images/' + id;
1055      },
1056      deleteCompanyImage: function(id) {
1057        return localhost + 'company_images/' + id;
1058      },
1059      updateCompanySkillsImage: function(id) {
1060        return localhost + 'company_skill_images/' + id;
1061      },
1062      deleteCompanySkillsImage: function(id) {
1063        return localhost + 'company_skill_images/' + id;
1064      },
1065      updateCompanyVideo: function(id) {
1066        return localhost + 'company_videos/' + id;
1067      },
1068      updateCompanyContact: function(id) {
1069        return localhost + 'company_key_contacts/' + id;
1070      },
1071      getService: function(id) {
1072        return localhost + 'services' + (id ? '/' + id : '');
1073      },
1074      getFavorites: function() {
1075        return localhost + 'favorite_products';
1076      },
1077      getFavoriteService: function(id) {
1078        return localhost + 'accounts/' + id + '/favorite_products';
1079      },
1080      getFavorite: function() {
1081        return localhost + 'favorite_products';
1082      },
1083      addFavorite: function() {
1084        return localhost + 'favorite_products';
1085      },
1086      deleteFavorite: function(id) {
1087        return localhost + 'favorite_products/' + id;
1088      },
1089      getUserList: function() {
1090        return localhost + 'users';
1091      },
1092      getUserUrl: function() {
1093        return localhost + 'user';
1094      },
1095      userAccount: function(id) {
1096        return {
1097          get: localhost + 'user/' + id
1098        }
1099      },
1100      getUserName: function(id) {
1101        return localhost + 'user/' + id + '/userName';
1102      },
1103      getOnboardingBasicInfoUrl: function() {
1104        return localhost + 'user-basic-information'
1105      },
1106      getUserAcceptTermsAndConditionsUrl: function() {
1107        return localhost + 'user-accept-terms-and-conditions'
1108      },
1109      getAccountNotificationCategoryItems: function() {
1110        return localhost + 'account-notification-category-items';
1111      },
1112      getAccountNotifications: function() {
1113        return localhost + 'account-notification-categories';
1114      },
1115      getUserAccountNotifications: function(account_id) {
1116        return localhost + 'accounts/' + account_id + '/account-notification-settings';
1117      },
1118      updateUserAccountNotification: function(id) {
1119        return localhost + 'account-notification-settings/' + id;
1120      },
1121      markNotificationRead: function(id, notification_id) {
1122        return localhost + 'users/' + id + '/notifications/' + notification_id + '?action=markNotificationRead';
1123      },
1124      markAllNotificationsRead: function(id) {
1125        return localhost + 'users/' + id + '/notifications?action=markAllRead';
1126      },
1127      requestVerification: function() {
1128        return localhost + 'notifications?action=requestVerification';
1129      },
1130      getNotificationsUser: function() {
1131        return localhost + 'notifications-user';
1132      },
1133      getNotificationsStatisticUser: function() {
1134        return localhost + 'notifications-user-statistic';
1135      },
1136      getNotificationsPm: function() {
1137        return localhost + 'notifications-pm';
1138      },
1139      addNotificationsPm: function() {
1140        return localhost + 'notifications-pm';
1141      },
1142      getNotificationsStatisticPm: function() {
1143        return localhost + 'notifications-pm-statistic';
1144      },
1145      //RESOURCES
1146      getAllResourceLabs: function() {
1147        return localhost + 'resource/lab';
1148      },
1149      getResourceLab: function(id) {
1150        return localhost + 'resource/lab/' + id;
1151      },
1152
1153      getAllResourceBays: function() {
1154        return localhost + 'resource/bay/';
1155      },
1156      getResourceBay: function(id) {
1157        return localhost + 'resource/bay/' + id;
1158      },
1159
1160
1161      getAllBayMachines: function(id) {
1162        return localhost + 'resource/machine/' + id;
1163      },
1164
1165
1166
1167      getResourceProject: function(id) {
1168        return localhost + 'resource/project/' + id;
1169      },
1170
1171      getAllResourceProjects: function() {
1172        return localhost + 'resource/project';
1173      },
1174
1175
1176      getAllCourses: function() {
1177        return localhost + 'resource/course';
1178      },
1179      getCourse: function(id) {
1180        return localhost + 'resource/course/' + id;
1181      },
1182
1183
1184      getAllJobs: function() {
1185        return localhost + 'resource/job';
1186      },
1187
1188      getJob: function(id) {
1189        return localhost + 'resource/job/' + id;
1190      },
1191
1192
1193      getAllAssessments: function() {
1194        return localhost + 'resource/assessment';
1195      },
1196
1197      getAssessment: function(id) {
1198        return localhost + 'resource/assessment/' + id;
1199      },
1200
1201      //END RESOURCES
1202
1203      searchMarketplace: function(text) {
1204        if ($window.apiUrl) {
1205          return localhost + 'searchServices/' + text;
1206        } else {
1207          return localhost + 'searchServices';
1208        }
1209      },
1210
1211      searchMembers: function(text) {
1212        console.log('data.factory.searchMembers: text=' + text);
1213        return localhost + 'searchMembers/' + text;
1214      },
1215
1216      markReadNotifications: function() {
1217        return localhost + 'mark-read-notifications';
1218      },
1219      clearNotification: function(id) {
1220        return localhost + 'clear-notification/' + id;
1221      },
1222      compare: function(id, type) {
1223        // type - services, members
1224        var name = 'compare_' + type;
1225        return {
1226          userCompares: localhost + 'profiles/' + id + '/' + name,
1227          get: localhost + name + '/' + id,
1228          delete: localhost + name + '/' + id,
1229          add: localhost + name
1230        }
1231      },
1232      getDateFormat: function() {
1233        return 'YYYY-MM-DD';
1234      },
1235      getTimeFormat: function() {
1236        return 'hh:mm:ss A';
1237      },
1238      getDateAndTimeFormat: function() {
1239        return this.getDateFormat() + ' ' + this.getTimeFormat();
1240      },
1241      // TODO -- make this a REST endpoint
1242      getDocAccessLevels: function() {
1243        return {
1244          'All Members': 'ALL_MEMBERS',
1245          'Project Participants': 'PROJECT_PARTICIPANTS',
1246          'Project Participants and Upper Tier Members': 'PROJECT_PARTICIPANTS_AND_UPPER_TIER_MEMBERS',
1247          'Project Participants VIPS': 'PROJECT_PARTICIPANT_VIPS',
1248          'Choose Organizations': 'ORG'
1249        }
1250      },
1251      getMyVPC: function() {
1252        return localhost + 'organizations/myVPC'
1253      }
1254    };
1255  })
1256
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run JavaScript Tests on LambdaTest Cloud Grid

Execute automation tests with Appium on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)