From c437d5360c75c1af5417c3681235a0f8015a9a85 Mon Sep 17 00:00:00 2001 From: liuwh7 Date: Wed, 15 Sep 2021 09:57:09 +0800 Subject: feat: add intent based service Signed-off-by: liuwh7 Change-Id: If63eb5e61f01751771ad090728f33214077edd6f Issue-ID: USECASEUI-605 --- .../src/app/core/services/intentBase.service.ts | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 usecaseui-portal/src/app/core/services/intentBase.service.ts (limited to 'usecaseui-portal/src/app/core/services') diff --git a/usecaseui-portal/src/app/core/services/intentBase.service.ts b/usecaseui-portal/src/app/core/services/intentBase.service.ts new file mode 100644 index 00000000..b8ead336 --- /dev/null +++ b/usecaseui-portal/src/app/core/services/intentBase.service.ts @@ -0,0 +1,81 @@ +/* + Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +import { HttpClient, HttpParams } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { baseUrl } from '../models/dataInterface'; + +@Injectable() +export class intentBaseService { + constructor(private http: HttpClient) { } + + baseUrl = baseUrl.baseUrl; + url = { + getInstanceId: this.baseUrl + "/intent/getInstanceId", + createIntentInstance: this.baseUrl + "/intent/createIntentInstance", + getInstanceList: this.baseUrl + "/intent/getInstanceList", + queryInstancePerformanceData: this.baseUrl + "/intent/queryInstancePerformanceData", + getFinishedInstanceInfo: this.baseUrl + "/intent/getFinishedInstanceInfo", + deleteIntentInstance: this.baseUrl + "/intent/deleteIntentInstance", + activeIntentInstance: this.baseUrl + "/intent/activeIntentInstance", + invalidIntentInstance: this.baseUrl + "/intent/invalidIntentInstance", + queryAccessNodeInfo: this.baseUrl + "/intent/queryAccessNodeInfo", + intentInstancePredict: this.baseUrl + "/intent/intentInstancePredict" + }; + + //The following APIs function are optimizable------------------------ + + /* Query data list */ + getInstanceId() { + return this.http.get(this.url["getInstanceId"]); + } + + createIntentInstance(requestBody) { + return this.http.post(this.url["createIntentInstance"], requestBody); + } + + getInstanceList(requestBody) { + return this.http.post(this.url["getInstanceList"], requestBody); + } + + queryInstancePerformanceData(requestBody) { + return this.http.post(this.url["queryInstancePerformanceData"], requestBody); + } + + getFinishedInstanceInfo() { + return this.http.get(this.url["getFinishedInstanceInfo"]); + } + + deleteIntentInstance(instanceId) { + let params = new HttpParams({ fromObject: { "instanceId": instanceId } }); + return this.http.delete(this.url.deleteIntentInstance, { params }); + } + + activeIntentInstance(requestBody) { + return this.http.post(this.url["activeIntentInstance"], requestBody); + } + + invalidIntentInstance(requestBody) { + return this.http.post(this.url["invalidIntentInstance"], requestBody); + } + + queryAccessNodeInfo() { + return this.http.get(this.url["queryAccessNodeInfo"]); + } + + intentInstancePredict(requestBody) { + return this.http.post(this.url["intentInstancePredict"], requestBody); + } +} -- cgit 1.2.3-korg