Revert "Renaming Files having BluePrint to have Blueprint"
[ccsdk/cds.git] / cds-ui / designer-client / src / app / modules / feature-modules / packages / designer / designer.service.ts
1 /*
2 ============LICENSE_START==========================================
3 ===================================================================
4 Copyright (C) 2019 Orange. All rights reserved.
5 ===================================================================
6 Modification Copyright (c) 2020 IBM
7 ===================================================================
8
9 Unless otherwise specified, all software contained herein is licensed
10 under the Apache License, Version 2.0 (the License);
11 you may not use this software except in compliance with the License.
12 You may obtain a copy of the License at
13
14     http://www.apache.org/licenses/LICENSE-2.0
15
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
21 ============LICENSE_END============================================
22 */
23
24 import { Injectable } from '@angular/core';
25 import { Observable } from 'rxjs';
26 import { ApiService } from '../../../../common/core/services/api.typed.service';
27 import { ResourceDictionaryURLs, BlueprintURLs } from '../../../../common/constants/app-constants';
28 import { ModelType } from './model/ModelType.model';
29 import { BluePrintDetailModel } from '../model/BluePrint.detail.model';
30
31
32 @Injectable({
33     providedIn: 'root'
34 })
35 export class DesignerService {
36
37     constructor(
38         private api: ApiService<ModelType>,
39         private api2: ApiService<BluePrintDetailModel>
40     ) {
41     }
42
43     getFunctions(modelDefinitionType: string): Observable<ModelType[]> {
44         return this.api.get(ResourceDictionaryURLs.getResourceDictionary + '/' + modelDefinitionType);
45     }
46
47     private getBluePrintModel(id: string): Observable<BluePrintDetailModel> {
48         return this.api2.getOne(BlueprintURLs.getOneBlueprint + '/' + id);
49     }
50
51     getPagedPackages(id: string) {
52         return this.getBluePrintModel(id);
53     }
54
55     publishBlueprint(body: any | null, options?: any): Observable<any> {
56
57         return this.api.post(BlueprintURLs.publish, body, { responseType: 'text' });
58     }
59
60 }