diff --git a/src/app/core/services/private-catalogs.service.ts b/src/app/core/services/private-catalogs.service.ts index 567c7be070fcd8293bf27d6ecdf1c9413fbe23f5..3c4e88c6fa497e0832ef3d3078d43d1254034e58 100644 --- a/src/app/core/services/private-catalogs.service.ts +++ b/src/app/core/services/private-catalogs.service.ts @@ -11,6 +11,7 @@ import { UserDetails, } from 'src/app/shared/models'; import { CreateRatingRequestPayload } from 'src/app/shared/models/request-payloads'; +import { MessageStatusModel } from 'src/app/shared/models/message-status.model'; @Injectable({ providedIn: 'root', @@ -123,7 +124,7 @@ export class PrivateCatalogsService { ); } - uploadFileToUrl( + uploadExistingModelLicenseProfile( loginUserID: string, solutionId: string, revisionId: string, @@ -141,8 +142,6 @@ export class PrivateCatalogsService { revisionId + '/' + versionId; - const uploadUrl = - 'https://dev02.ki-lab.nrw/api/license/upload/9b36ce33-ec9c-48e3-964f-5fd7e75ede6c/620ec698-4027-414a-8b9f-8d6503cbf35b/86e0f4fd-694a-4ba2-ba9f-bb3db1dc850f/1.0.0'; const formData = new FormData(); formData.append('file', file); @@ -155,6 +154,24 @@ export class PrivateCatalogsService { return this.http.request(req); } + uploadNewModelLicenseProfile(userId: string, file: File) { + const url = + apiConfig.apiBackendURL + + '/api/model/upload/' + + userId + + '/?licUploadFlag=' + + true; + const formData = new FormData(); + formData.append('file', file); + + const req = new HttpRequest('POST', url, formData, { + reportProgress: true, + responseType: 'json', + }); + + return this.http.request(req); + } + createUpdateLicenseProfile( loginUserID: string, solutionId: string, @@ -452,4 +469,62 @@ export class PrivateCatalogsService { }), ); } + + addCatalog( + userId: string, + solutionName: string, + dockerUrl: string, + ): Observable<string> { + const urlCreateFavorite = + apiConfig.apiBackendURL + apiConfig.urlAddToCatalog + '/' + userId; + + const addToReqObj = { + request_body: { + name: solutionName, + dockerfileURI: dockerUrl, + }, + }; + + return this._httpSharedService + .post(urlCreateFavorite, undefined, addToReqObj) + .pipe( + map((res) => res.response_detail), + catchError((error) => { + throw error; + }), + ); + } + uploadProtoBufFile(file: File) { + const url = + apiConfig.apiBackendURL + '/api/proto/upload/' + '?protoUploadFlag=true'; + + const formData = new FormData(); + formData.append('file', file); + + const req = new HttpRequest('POST', url, formData, { + reportProgress: true, + responseType: 'json', + }); + + return this.http.request(req); + } + + getMessagingStatus( + userId: string, + trackId: string, + ): Observable<MessageStatusModel[]> { + const url = + apiConfig.apiBackendURL + + apiConfig.urlMessagingStatus + + '/' + + userId + + '/' + + trackId; + return this._httpSharedService.post(url, undefined).pipe( + map((res) => res.response_body), + catchError((error) => { + throw error; + }), + ); + } }