diff options
author | liuwh7 <liuwh7@asiainfo.com> | 2021-09-15 09:57:09 +0800 |
---|---|---|
committer | liu wenhao <liuwh7@asiainfo.com> | 2021-09-16 07:15:07 +0000 |
commit | c437d5360c75c1af5417c3681235a0f8015a9a85 (patch) | |
tree | 69059fede467020a0b964f08ae56a999f85ffeb2 /usecaseui-portal/src/app/core | |
parent | 9c8070280f88e0094acb83ee78251bb4f9690e2e (diff) |
feat: add intent based service
Signed-off-by: liuwh7 <liuwh7@asiainfo.com>
Change-Id: If63eb5e61f01751771ad090728f33214077edd6f
Issue-ID: USECASEUI-605
Diffstat (limited to 'usecaseui-portal/src/app/core')
-rw-r--r-- | usecaseui-portal/src/app/core/services/intentBase.service.ts | 81 |
1 files changed, 81 insertions, 0 deletions
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<any>(this.url["getInstanceId"]); + } + + createIntentInstance(requestBody) { + return this.http.post<any>(this.url["createIntentInstance"], requestBody); + } + + getInstanceList(requestBody) { + return this.http.post<any>(this.url["getInstanceList"], requestBody); + } + + queryInstancePerformanceData(requestBody) { + return this.http.post<any>(this.url["queryInstancePerformanceData"], requestBody); + } + + getFinishedInstanceInfo() { + return this.http.get<any>(this.url["getFinishedInstanceInfo"]); + } + + deleteIntentInstance(instanceId) { + let params = new HttpParams({ fromObject: { "instanceId": instanceId } }); + return this.http.delete<any>(this.url.deleteIntentInstance, { params }); + } + + activeIntentInstance(requestBody) { + return this.http.post<any>(this.url["activeIntentInstance"], requestBody); + } + + invalidIntentInstance(requestBody) { + return this.http.post<any>(this.url["invalidIntentInstance"], requestBody); + } + + queryAccessNodeInfo() { + return this.http.get<any>(this.url["queryAccessNodeInfo"]); + } + + intentInstancePredict(requestBody) { + return this.http.post<any>(this.url["intentInstancePredict"], requestBody); + } +} |