From 47ec62d859028fb0d75799d537cf992a141addad Mon Sep 17 00:00:00 2001 From: Georg Dangl Date: Tue, 30 Apr 2024 12:17:45 +0200 Subject: [PATCH] Regenrate frontend client to include teams endpoint --- .../app/generated-client/generated-client.ts | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/src/ipa-bcfier-ui/src/app/generated-client/generated-client.ts b/src/ipa-bcfier-ui/src/app/generated-client/generated-client.ts index cdff22c..fc0a0bd 100644 --- a/src/ipa-bcfier-ui/src/app/generated-client/generated-client.ts +++ b/src/ipa-bcfier-ui/src/app/generated-client/generated-client.ts @@ -1043,6 +1043,78 @@ export class SettingsClient implements ISettingsClient { } } +export interface ITeamsMessagesClient { + announceNewCommentInProjectTopic(projectId: string, topicId: string, model: TeamsMessagePost): Observable; +} + +@Injectable({ + providedIn: 'root' +}) +export class TeamsMessagesClient implements ITeamsMessagesClient { + private http: HttpClient; + private baseUrl: string; + protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; + + constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) { + this.http = http; + this.baseUrl = baseUrl ?? ""; + } + + announceNewCommentInProjectTopic(projectId: string, topicId: string, model: TeamsMessagePost): Observable { + let url_ = this.baseUrl + "/api/teams-messages/projects/{projectId}/topics/{topicId}/comments"; + if (projectId === undefined || projectId === null) + throw new Error("The parameter 'projectId' must be defined."); + url_ = url_.replace("{projectId}", encodeURIComponent("" + projectId)); + if (topicId === undefined || topicId === null) + throw new Error("The parameter 'topicId' must be defined."); + url_ = url_.replace("{topicId}", encodeURIComponent("" + topicId)); + url_ = url_.replace(/[?&]$/, ""); + + const content_ = JSON.stringify(model); + + let options_ : any = { + body: content_, + observe: "response", + responseType: "blob", + headers: new HttpHeaders({ + "Content-Type": "application/json", + }) + }; + + return this.http.request("post", url_, options_).pipe(_observableMergeMap((response_ : any) => { + return this.processAnnounceNewCommentInProjectTopic(response_); + })).pipe(_observableCatch((response_: any) => { + if (response_ instanceof HttpResponseBase) { + try { + return this.processAnnounceNewCommentInProjectTopic(response_ as any); + } catch (e) { + return _observableThrow(e) as any as Observable; + } + } else + return _observableThrow(response_) as any as Observable; + })); + } + + protected processAnnounceNewCommentInProjectTopic(response: HttpResponseBase): Observable { + const status = response.status; + const responseBlob = + response instanceof HttpResponse ? response.body : + (response as any).error instanceof Blob ? (response as any).error : undefined; + + let _headers: any = {}; if (response.headers) { for (let key of response.headers.keys()) { _headers[key] = response.headers.get(key); }} + if (status === 204) { + return blobToText(responseBlob).pipe(_observableMergeMap((_responseText: string) => { + return _observableOf(null as any); + })); + } else if (status !== 200 && status !== 204) { + return blobToText(responseBlob).pipe(_observableMergeMap((_responseText: string) => { + return throwException("An unexpected server error occurred.", status, _responseText, _headers); + })); + } + return _observableOf(null as any); + } +} + export interface IViewpointsClient { showViewpoint(viewpoint: BcfViewpoint): Observable; createViewpoint(): Observable; @@ -1383,6 +1455,13 @@ export interface Settings { mainDatabaseLocation?: string | null; } +export interface TeamsMessagePost { + topicTitle?: string | null; + comment?: string | null; + viewpointBase64?: string | null; + username: string; +} + export interface FileResponse { data: Blob; status: number;