2 * Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 var AECBlueprintValidationUIApp = angular
18 .module('BlueprintValidationUIManagement');
20 AECBlueprintValidationUIApp.factory('restAPISvc', [
23 function($http, appContext) {
25 svc.getRestAPI = function(path, cb) {
28 url : appContext + path,
30 'Content-Type' : "application/json",
31 'Accept' : "application/json"
35 if (response.status == 200) {
38 /* eslint-disable no-console */
39 console.log("Get REST API error: "
40 + response.statusText);
41 /* eslint-enable no-console */
46 /* eslint-disable no-console */
47 console.log("Get REST API error: "
49 /* eslint-enable no-console */
53 svc.postRestAPI = function(path, json, cb) {
56 url : appContext + path,
58 'Content-Type' : "application/json",
59 'Accept' : "application/json"
64 if (response.status == 200
65 || response.status == 201) {
68 /* eslint-disable no-console */
69 console.log("Post REST API error: "
70 + response.statusText);
71 /* eslint-enable no-console */
76 /* eslint-disable no-console */
77 console.log("Post REST API error: "
79 /* eslint-enable no-console */
83 svc.deleteRestAPI = function(path, json) {
86 url : appContext + path,
88 'Content-Type' : "application/json",
89 'Accept' : "application/json"
94 if (response.status !== 200) {
95 /* eslint-disable no-console */
96 console.log("Delete REST API error: "
97 + response.statusText);
98 /* eslint-enable no-console */
102 /* eslint-disable no-console */
103 console.log("Delete REST API error: "
105 /* eslint-enable no-console */