Add Mastodon bot to Ticketfrei 3 #2

Merged
missytake merged 32 commits from mastodon into development 2023-03-19 19:31:03 +00:00
12 changed files with 49 additions and 41 deletions
Showing only changes of commit 9c7607b7ca - Show all commits

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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<any>;
public createMastodon(hoodId: number, instanceUrl: any, username: any, password: any, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
public createMastodon(hoodId: number, instanceUrl: any, username: any, password: any, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
public createMastodon(hoodId: number, instanceUrl: any, username: any, password: any, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
public createMastodon(hoodId: number, bodyMastodonAccount: BodyMastodonAccount, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<any>;
public createMastodon(hoodId: number, bodyMastodonAccount: BodyMastodonAccount, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
public createMastodon(hoodId: number, bodyMastodonAccount: BodyMastodonAccount, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
public createMastodon(hoodId: number, bodyMastodonAccount: BodyMastodonAccount, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
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,
<any>instanceUrl, 'instance_url');
}
if (username !== undefined && username !== null) {
queryParameters = this.addToHttpParams(queryParameters,
<any>username, 'username');
}
if (password !== undefined && password !== null) {
queryParameters = this.addToHttpParams(queryParameters,
<any>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<any>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/mastodon/`,
null,
bodyMastodonAccount,
{
params: queryParameters,
responseType: <any>responseType,
withCredentials: this.configuration.withCredentials,
headers: headers,

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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';