mirror of
https://github.com/sartography/cr-connect-bpmn.git
synced 2025-01-11 09:35:52 +00:00
Adds endpoints for adding/updating workflow spec and file.
This commit is contained in:
parent
915a5a45e7
commit
68226ee0a8
@ -29,6 +29,14 @@ export class ApiService {
|
||||
.pipe(catchError(this._handleError));
|
||||
}
|
||||
|
||||
addWorkflowSpecification(newSpec: WorkflowSpec): Observable<WorkflowSpec> {
|
||||
const url = this.apiUrl + '/workflow-specification';
|
||||
|
||||
return this.httpClient
|
||||
.post<WorkflowSpec>(url, newSpec)
|
||||
.pipe(catchError(this._handleError));
|
||||
}
|
||||
|
||||
listBpmnFiles(specId: string): Observable<FileMeta[]> {
|
||||
const url = this.apiUrl + '/file';
|
||||
const params = new HttpParams().set('spec_id', specId);
|
||||
@ -46,6 +54,29 @@ export class ApiService {
|
||||
.pipe(catchError(this._handleError));
|
||||
}
|
||||
|
||||
addFileMeta(fileMeta: FileMeta): Observable<FileMeta> {
|
||||
const url = this.apiUrl + '/file';
|
||||
const params = new HttpParams().set('spec_id', fileMeta.workflow_spec_id);
|
||||
const formData = new FormData();
|
||||
formData.append('workflow_spec_id', fileMeta.workflow_spec_id);
|
||||
formData.append('file', fileMeta.file);
|
||||
|
||||
return this.httpClient
|
||||
.post<FileMeta>(url, formData, {params: params})
|
||||
.pipe(catchError(this._handleError));
|
||||
}
|
||||
|
||||
updateFileMeta(fileMeta: FileMeta): Observable<FileMeta> {
|
||||
const url = this.apiUrl + '/file/' + fileMeta.id;
|
||||
const formData = new FormData();
|
||||
formData.append('workflow_spec_id', fileMeta.workflow_spec_id);
|
||||
formData.append('file', fileMeta.file);
|
||||
|
||||
return this.httpClient
|
||||
.put<FileMeta>(url, formData)
|
||||
.pipe(catchError(this._handleError));
|
||||
}
|
||||
|
||||
getBpmnXml(url: string): Observable<string> {
|
||||
return this.httpClient
|
||||
.get(url, {responseType: 'text'})
|
||||
@ -55,5 +86,4 @@ export class ApiService {
|
||||
private _handleError(error: ApiError) {
|
||||
return throwError(error.message || 'Could not complete your request; please try again later.');
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user