From 9c7607b7cad5743a99ed006ee4334286e815b90b Mon Sep 17 00:00:00 2001 From: ogdbd3h5qze42igcv8wcrqk3 Date: Sun, 19 Mar 2023 13:29:57 +0100 Subject: [PATCH] [frontend] Regenerate openapi for frontend due to mastodon API changes --- .../src/app/core/api/.openapi-generator/FILES | 1 + .../src/app/core/api/api/admin.service.ts | 2 +- .../src/app/core/api/api/badwords.service.ts | 2 +- .../src/app/core/api/api/email.service.ts | 2 +- .../src/app/core/api/api/hoods.service.ts | 2 +- .../src/app/core/api/api/mastodon.service.ts | 53 +++++++------------ .../src/app/core/api/api/telegram.service.ts | 2 +- frontend/src/app/core/api/api/test.service.ts | 2 +- .../src/app/core/api/api/triggers.service.ts | 2 +- .../src/app/core/api/api/twitter.service.ts | 2 +- .../app/core/api/model/bodyMastodonAccount.ts | 19 +++++++ frontend/src/app/core/api/model/models.ts | 1 + 12 files changed, 49 insertions(+), 41 deletions(-) create mode 100644 frontend/src/app/core/api/model/bodyMastodonAccount.ts diff --git a/frontend/src/app/core/api/.openapi-generator/FILES b/frontend/src/app/core/api/.openapi-generator/FILES index f3d80a3..708d04f 100644 --- a/frontend/src/app/core/api/.openapi-generator/FILES +++ b/frontend/src/app/core/api/.openapi-generator/FILES @@ -20,6 +20,7 @@ model/bodyAdmin.ts model/bodyBadWord.ts model/bodyHood.ts model/bodyLogin.ts +model/bodyMastodonAccount.ts model/bodyPassword.ts model/bodySubscriber.ts model/bodyTelegram.ts diff --git a/frontend/src/app/core/api/api/admin.service.ts b/frontend/src/app/core/api/api/admin.service.ts index c8afa9f..1556c39 100644 --- a/frontend/src/app/core/api/api/admin.service.ts +++ b/frontend/src/app/core/api/api/admin.service.ts @@ -33,7 +33,7 @@ import { Configuration } from '../configurat }) export class AdminService { - protected basePath = 'http://localhost:8000/api'; + protected basePath = 'http://localhost/api'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); public encoder: HttpParameterCodec; diff --git a/frontend/src/app/core/api/api/badwords.service.ts b/frontend/src/app/core/api/api/badwords.service.ts index dea8e24..1959f28 100644 --- a/frontend/src/app/core/api/api/badwords.service.ts +++ b/frontend/src/app/core/api/api/badwords.service.ts @@ -30,7 +30,7 @@ import { Configuration } from '../configurat }) export class BadwordsService { - protected basePath = 'http://localhost:8000/api'; + protected basePath = 'http://localhost/api'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); public encoder: HttpParameterCodec; diff --git a/frontend/src/app/core/api/api/email.service.ts b/frontend/src/app/core/api/api/email.service.ts index c5c4e94..602ddc5 100644 --- a/frontend/src/app/core/api/api/email.service.ts +++ b/frontend/src/app/core/api/api/email.service.ts @@ -32,7 +32,7 @@ import { Configuration } from '../configurat }) export class EmailService { - protected basePath = 'http://localhost:8000/api'; + protected basePath = 'http://localhost/api'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); public encoder: HttpParameterCodec; diff --git a/frontend/src/app/core/api/api/hoods.service.ts b/frontend/src/app/core/api/api/hoods.service.ts index 30c4c8d..5450566 100644 --- a/frontend/src/app/core/api/api/hoods.service.ts +++ b/frontend/src/app/core/api/api/hoods.service.ts @@ -30,7 +30,7 @@ import { Configuration } from '../configurat }) export class HoodsService { - protected basePath = 'http://localhost:8000/api'; + protected basePath = 'http://localhost/api'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); public encoder: HttpParameterCodec; diff --git a/frontend/src/app/core/api/api/mastodon.service.ts b/frontend/src/app/core/api/api/mastodon.service.ts index 2cc0f48..17cc2e5 100644 --- a/frontend/src/app/core/api/api/mastodon.service.ts +++ b/frontend/src/app/core/api/api/mastodon.service.ts @@ -17,6 +17,7 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; +import { BodyMastodonAccount } from '../model/models'; import { HTTPValidationError } from '../model/models'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; @@ -29,7 +30,7 @@ import { Configuration } from '../configurat }) export class MastodonService { - protected basePath = 'http://localhost:8000/api'; + protected basePath = 'http://localhost/api'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); public encoder: HttpParameterCodec; @@ -86,43 +87,21 @@ export class MastodonService { /** * Mastodon Create - * Add a Mastodon Account to a Ticketfrei account. open questions: do we really get the username + password like this? can the instance_url have different ways of writing? :param: instance_url: the API base URL of the mastodon server :param: username: the username of the Mastodon account :param: password: the password of the Mastodon account :param: hood: the hood ORM object + * Add a Mastodon Account to a Ticketfrei account. open questions: can the instance_url have different ways of writing? :param: values: a BodyMastodonAccount object in json :param: hood: the hood ORM object * @param hoodId - * @param instanceUrl - * @param username - * @param password + * @param bodyMastodonAccount * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public createMastodon(hoodId: number, instanceUrl: any, username: any, password: any, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable; - public createMastodon(hoodId: number, instanceUrl: any, username: any, password: any, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable>; - public createMastodon(hoodId: number, instanceUrl: any, username: any, password: any, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable>; - public createMastodon(hoodId: number, instanceUrl: any, username: any, password: any, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable { + public createMastodon(hoodId: number, bodyMastodonAccount: BodyMastodonAccount, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable; + public createMastodon(hoodId: number, bodyMastodonAccount: BodyMastodonAccount, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable>; + public createMastodon(hoodId: number, bodyMastodonAccount: BodyMastodonAccount, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable>; + public createMastodon(hoodId: number, bodyMastodonAccount: BodyMastodonAccount, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable { if (hoodId === null || hoodId === undefined) { throw new Error('Required parameter hoodId was null or undefined when calling createMastodon.'); } - if (instanceUrl === null || instanceUrl === undefined) { - throw new Error('Required parameter instanceUrl was null or undefined when calling createMastodon.'); - } - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling createMastodon.'); - } - if (password === null || password === undefined) { - throw new Error('Required parameter password was null or undefined when calling createMastodon.'); - } - - let queryParameters = new HttpParams({encoder: this.encoder}); - if (instanceUrl !== undefined && instanceUrl !== null) { - queryParameters = this.addToHttpParams(queryParameters, - instanceUrl, 'instance_url'); - } - if (username !== undefined && username !== null) { - queryParameters = this.addToHttpParams(queryParameters, - username, 'username'); - } - if (password !== undefined && password !== null) { - queryParameters = this.addToHttpParams(queryParameters, - password, 'password'); + if (bodyMastodonAccount === null || bodyMastodonAccount === undefined) { + throw new Error('Required parameter bodyMastodonAccount was null or undefined when calling createMastodon.'); } let headers = this.defaultHeaders; @@ -147,15 +126,23 @@ export class MastodonService { } + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + let responseType: 'text' | 'json' = 'json'; if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { responseType = 'text'; } return this.httpClient.post(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/mastodon/`, - null, + bodyMastodonAccount, { - params: queryParameters, responseType: responseType, withCredentials: this.configuration.withCredentials, headers: headers, diff --git a/frontend/src/app/core/api/api/telegram.service.ts b/frontend/src/app/core/api/api/telegram.service.ts index ba88547..ef0ec80 100644 --- a/frontend/src/app/core/api/api/telegram.service.ts +++ b/frontend/src/app/core/api/api/telegram.service.ts @@ -30,7 +30,7 @@ import { Configuration } from '../configurat }) export class TelegramService { - protected basePath = 'http://localhost:8000/api'; + protected basePath = 'http://localhost/api'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); public encoder: HttpParameterCodec; diff --git a/frontend/src/app/core/api/api/test.service.ts b/frontend/src/app/core/api/api/test.service.ts index e5a5424..33c065d 100644 --- a/frontend/src/app/core/api/api/test.service.ts +++ b/frontend/src/app/core/api/api/test.service.ts @@ -30,7 +30,7 @@ import { Configuration } from '../configurat }) export class TestService { - protected basePath = 'http://localhost:8000/api'; + protected basePath = 'http://localhost/api'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); public encoder: HttpParameterCodec; diff --git a/frontend/src/app/core/api/api/triggers.service.ts b/frontend/src/app/core/api/api/triggers.service.ts index 8dc0e7c..f72c5c8 100644 --- a/frontend/src/app/core/api/api/triggers.service.ts +++ b/frontend/src/app/core/api/api/triggers.service.ts @@ -30,7 +30,7 @@ import { Configuration } from '../configurat }) export class TriggersService { - protected basePath = 'http://localhost:8000/api'; + protected basePath = 'http://localhost/api'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); public encoder: HttpParameterCodec; diff --git a/frontend/src/app/core/api/api/twitter.service.ts b/frontend/src/app/core/api/api/twitter.service.ts index c34a019..b686fe9 100644 --- a/frontend/src/app/core/api/api/twitter.service.ts +++ b/frontend/src/app/core/api/api/twitter.service.ts @@ -29,7 +29,7 @@ import { Configuration } from '../configurat }) export class TwitterService { - protected basePath = 'http://localhost:8000/api'; + protected basePath = 'http://localhost/api'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); public encoder: HttpParameterCodec; diff --git a/frontend/src/app/core/api/model/bodyMastodonAccount.ts b/frontend/src/app/core/api/model/bodyMastodonAccount.ts new file mode 100644 index 0000000..95c549c --- /dev/null +++ b/frontend/src/app/core/api/model/bodyMastodonAccount.ts @@ -0,0 +1,19 @@ +/** + * FastAPI + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface BodyMastodonAccount { + email: string; + instance_url: string; + password: string; +} + diff --git a/frontend/src/app/core/api/model/models.ts b/frontend/src/app/core/api/model/models.ts index bc00d4b..b8f2443 100644 --- a/frontend/src/app/core/api/model/models.ts +++ b/frontend/src/app/core/api/model/models.ts @@ -3,6 +3,7 @@ export * from './bodyAdmin'; export * from './bodyBadWord'; export * from './bodyHood'; export * from './bodyLogin'; +export * from './bodyMastodonAccount'; export * from './bodyPassword'; export * from './bodySubscriber'; export * from './bodyTelegram';