[frontend] Generate services from openapi.json
This commit is contained in:
parent
87a315f340
commit
3eba5e2ac5
|
@ -2,6 +2,7 @@
|
|||
"name": "kibicara-frontend",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"openapi-generator": "openapi-generator generate -g typescript-angular --additional-properties=providedInRoot=true -o src/app/api -i http://localhost:8000/openapi.json",
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
|
@ -19,7 +20,6 @@
|
|||
"@angular/platform-browser": "~9.1.4",
|
||||
"@angular/platform-browser-dynamic": "~9.1.4",
|
||||
"@angular/router": "~9.1.4",
|
||||
"@openapitools/openapi-generator-cli": "^1.0.15-4.3.1",
|
||||
"rxjs": "~6.5.4",
|
||||
"tslib": "^1.10.0",
|
||||
"zone.js": "~0.10.2"
|
||||
|
@ -29,6 +29,7 @@
|
|||
"@angular/cli": "~9.1.4",
|
||||
"@angular/compiler-cli": "~9.1.4",
|
||||
"@angular/language-service": "~9.1.4",
|
||||
"@openapitools/openapi-generator-cli": "^1.0.15-4.3.1",
|
||||
"@types/node": "^12.11.1",
|
||||
"@types/jasmine": "~3.5.0",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
|
|
4
kibicara-frontend/src/app/api/.gitignore
vendored
Normal file
4
kibicara-frontend/src/app/api/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
wwwroot/*.js
|
||||
node_modules
|
||||
typings
|
||||
dist
|
23
kibicara-frontend/src/app/api/.openapi-generator-ignore
Normal file
23
kibicara-frontend/src/app/api/.openapi-generator-ignore
Normal file
|
@ -0,0 +1,23 @@
|
|||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
1
kibicara-frontend/src/app/api/.openapi-generator/VERSION
Normal file
1
kibicara-frontend/src/app/api/.openapi-generator/VERSION
Normal file
|
@ -0,0 +1 @@
|
|||
4.3.1
|
205
kibicara-frontend/src/app/api/README.md
Normal file
205
kibicara-frontend/src/app/api/README.md
Normal file
|
@ -0,0 +1,205 @@
|
|||
## @
|
||||
|
||||
### Building
|
||||
|
||||
To install the required dependencies and to build the typescript sources run:
|
||||
```
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
### publishing
|
||||
|
||||
First build the package then run ```npm publish```
|
||||
|
||||
### consuming
|
||||
|
||||
Navigate to the folder of your consuming project and run one of next commands.
|
||||
|
||||
_published:_
|
||||
|
||||
```
|
||||
npm install @ --save
|
||||
```
|
||||
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE/-.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE:
|
||||
```
|
||||
npm link
|
||||
```
|
||||
|
||||
In your project:
|
||||
```
|
||||
npm link
|
||||
```
|
||||
|
||||
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
|
||||
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
|
||||
Published packages are not effected by this issue.
|
||||
|
||||
|
||||
#### General usage
|
||||
|
||||
In your Angular project:
|
||||
|
||||
|
||||
```
|
||||
// without configuring providers
|
||||
import { ApiModule } from '';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
ApiModule,
|
||||
// make sure to import the HttpClientModule in the AppModule only,
|
||||
// see https://github.com/angular/angular/issues/20575
|
||||
HttpClientModule
|
||||
],
|
||||
declarations: [ AppComponent ],
|
||||
providers: [],
|
||||
bootstrap: [ AppComponent ]
|
||||
})
|
||||
export class AppModule {}
|
||||
```
|
||||
|
||||
```
|
||||
// configuring providers
|
||||
import { ApiModule, Configuration, ConfigurationParameters } from '';
|
||||
|
||||
export function apiConfigFactory (): Configuration => {
|
||||
const params: ConfigurationParameters = {
|
||||
// set configuration parameters here.
|
||||
}
|
||||
return new Configuration(params);
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
imports: [ ApiModule.forRoot(apiConfigFactory) ],
|
||||
declarations: [ AppComponent ],
|
||||
providers: [],
|
||||
bootstrap: [ AppComponent ]
|
||||
})
|
||||
export class AppModule {}
|
||||
```
|
||||
|
||||
```
|
||||
// configuring providers with an authentication service that manages your access tokens
|
||||
import { ApiModule, Configuration } from '';
|
||||
|
||||
@NgModule({
|
||||
imports: [ ApiModule ],
|
||||
declarations: [ AppComponent ],
|
||||
providers: [
|
||||
{
|
||||
provide: Configuration,
|
||||
useFactory: (authService: AuthService) => new Configuration(
|
||||
{
|
||||
basePath: environment.apiUrl,
|
||||
accessToken: authService.getAccessToken.bind(authService)
|
||||
}
|
||||
),
|
||||
deps: [AuthService],
|
||||
multi: false
|
||||
}
|
||||
],
|
||||
bootstrap: [ AppComponent ]
|
||||
})
|
||||
export class AppModule {}
|
||||
```
|
||||
|
||||
```
|
||||
import { DefaultApi } from '';
|
||||
|
||||
export class AppComponent {
|
||||
constructor(private apiGateway: DefaultApi) { }
|
||||
}
|
||||
```
|
||||
|
||||
Note: The ApiModule is restricted to being instantiated once app wide.
|
||||
This is to ensure that all services are treated as singletons.
|
||||
|
||||
#### Using multiple OpenAPI files / APIs / ApiModules
|
||||
In order to use multiple `ApiModules` generated from different OpenAPI files,
|
||||
you can create an alias name when importing the modules
|
||||
in order to avoid naming conflicts:
|
||||
```
|
||||
import { ApiModule } from 'my-api-path';
|
||||
import { ApiModule as OtherApiModule } from 'my-other-api-path';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
ApiModule,
|
||||
OtherApiModule,
|
||||
// make sure to import the HttpClientModule in the AppModule only,
|
||||
// see https://github.com/angular/angular/issues/20575
|
||||
HttpClientModule
|
||||
]
|
||||
})
|
||||
export class AppModule {
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Set service base path
|
||||
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
|
||||
|
||||
```
|
||||
import { BASE_PATH } from '';
|
||||
|
||||
bootstrap(AppComponent, [
|
||||
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
|
||||
]);
|
||||
```
|
||||
or
|
||||
|
||||
```
|
||||
import { BASE_PATH } from '';
|
||||
|
||||
@NgModule({
|
||||
imports: [],
|
||||
declarations: [ AppComponent ],
|
||||
providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
|
||||
bootstrap: [ AppComponent ]
|
||||
})
|
||||
export class AppModule {}
|
||||
```
|
||||
|
||||
|
||||
#### Using @angular/cli
|
||||
First extend your `src/environments/*.ts` files by adding the corresponding base path:
|
||||
|
||||
```
|
||||
export const environment = {
|
||||
production: false,
|
||||
API_BASE_PATH: 'http://127.0.0.1:8080'
|
||||
};
|
||||
```
|
||||
|
||||
In the src/app/app.module.ts:
|
||||
```
|
||||
import { BASE_PATH } from '';
|
||||
import { environment } from '../environments/environment';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
imports: [ ],
|
||||
providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
|
||||
bootstrap: [ AppComponent ]
|
||||
})
|
||||
export class AppModule { }
|
||||
```
|
39
kibicara-frontend/src/app/api/api.module.ts
Normal file
39
kibicara-frontend/src/app/api/api.module.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
|
||||
import { Configuration } from './configuration';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
|
||||
import { AdminService } from './api/admin.service';
|
||||
import { BadwordsService } from './api/badwords.service';
|
||||
import { EmailService } from './api/email.service';
|
||||
import { HoodsService } from './api/hoods.service';
|
||||
import { TelegramService } from './api/telegram.service';
|
||||
import { TestService } from './api/test.service';
|
||||
import { TriggersService } from './api/triggers.service';
|
||||
import { TwitterService } from './api/twitter.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [],
|
||||
declarations: [],
|
||||
exports: [],
|
||||
providers: []
|
||||
})
|
||||
export class ApiModule {
|
||||
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<ApiModule> {
|
||||
return {
|
||||
ngModule: ApiModule,
|
||||
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
|
||||
};
|
||||
}
|
||||
|
||||
constructor( @Optional() @SkipSelf() parentModule: ApiModule,
|
||||
@Optional() http: HttpClient) {
|
||||
if (parentModule) {
|
||||
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
|
||||
}
|
||||
if (!http) {
|
||||
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
|
||||
'See also https://github.com/angular/angular/issues/20575');
|
||||
}
|
||||
}
|
||||
}
|
346
kibicara-frontend/src/app/api/api/admin.service.ts
Normal file
346
kibicara-frontend/src/app/api/api/admin.service.ts
Normal file
|
@ -0,0 +1,346 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec } from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { AnyType } from '../model/models';
|
||||
import { BodyAccessToken } from '../model/models';
|
||||
import { BodyAdmin } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AdminService {
|
||||
|
||||
protected basePath = 'http://localhost';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param consumes string[] mime-types
|
||||
* @return true: consumes contains 'multipart/form-data', false: otherwise
|
||||
*/
|
||||
private canConsumeForm(consumes: string[]): boolean {
|
||||
const form = 'multipart/form-data';
|
||||
for (const consume of consumes) {
|
||||
if (form === consume) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||
if (typeof value === "object" && value instanceof Date === false) {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
||||
} else {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||
if (value == null) {
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
if (typeof value === "object") {
|
||||
if (Array.isArray(value)) {
|
||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||
} else if (value instanceof Date) {
|
||||
if (key != null) {
|
||||
httpParams = httpParams.append(key,
|
||||
(value as Date).toISOString().substr(0, 10));
|
||||
} else {
|
||||
throw Error("key may not be null if value is Date");
|
||||
}
|
||||
} else {
|
||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
||||
}
|
||||
} else if (key != null) {
|
||||
httpParams = httpParams.append(key, value);
|
||||
} else {
|
||||
throw Error("key may not be null if value is not object or array");
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Confirm
|
||||
* Registration confirmation and account creation. - **register_token**: Registration token received in email from /register
|
||||
* @param registerToken
|
||||
* @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 confirm(registerToken: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<BodyAccessToken>;
|
||||
public confirm(registerToken: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<BodyAccessToken>>;
|
||||
public confirm(registerToken: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<BodyAccessToken>>;
|
||||
public confirm(registerToken: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (registerToken === null || registerToken === undefined) {
|
||||
throw new Error('Required parameter registerToken was null or undefined when calling confirm.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.post<BodyAccessToken>(`${this.configuration.basePath}/api/admin/confirm/${encodeURIComponent(String(registerToken))}`,
|
||||
null,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Hood Read All
|
||||
* Get a list of all hoods of a given admin.
|
||||
* @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 getHoodsAdmin(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getHoodsAdmin(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getHoodsAdmin(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getHoodsAdmin(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/admin/hoods/`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Login
|
||||
* Get an access token. - **username**: Email of a registered hood admin - **password**: Password of a registered hood admin
|
||||
* @param username
|
||||
* @param password
|
||||
* @param grantType
|
||||
* @param scope
|
||||
* @param clientId
|
||||
* @param clientSecret
|
||||
* @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 login(username: string, password: string, grantType?: string, scope?: string, clientId?: string, clientSecret?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<BodyAccessToken>;
|
||||
public login(username: string, password: string, grantType?: string, scope?: string, clientId?: string, clientSecret?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<BodyAccessToken>>;
|
||||
public login(username: string, password: string, grantType?: string, scope?: string, clientId?: string, clientSecret?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<BodyAccessToken>>;
|
||||
public login(username: string, password: string, grantType?: string, scope?: string, clientId?: string, clientSecret?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (username === null || username === undefined) {
|
||||
throw new Error('Required parameter username was null or undefined when calling login.');
|
||||
}
|
||||
if (password === null || password === undefined) {
|
||||
throw new Error('Required parameter password was null or undefined when calling login.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/x-www-form-urlencoded'
|
||||
];
|
||||
|
||||
const canConsumeForm = this.canConsumeForm(consumes);
|
||||
|
||||
let formParams: { append(param: string, value: any): any; };
|
||||
let useForm = false;
|
||||
let convertFormParamsToString = false;
|
||||
if (useForm) {
|
||||
formParams = new FormData();
|
||||
} else {
|
||||
formParams = new HttpParams({encoder: this.encoder});
|
||||
}
|
||||
|
||||
if (grantType !== undefined) {
|
||||
formParams = formParams.append('grant_type', <any>grantType) as any || formParams;
|
||||
}
|
||||
if (username !== undefined) {
|
||||
formParams = formParams.append('username', <any>username) as any || formParams;
|
||||
}
|
||||
if (password !== undefined) {
|
||||
formParams = formParams.append('password', <any>password) as any || formParams;
|
||||
}
|
||||
if (scope !== undefined) {
|
||||
formParams = formParams.append('scope', <any>scope) as any || formParams;
|
||||
}
|
||||
if (clientId !== undefined) {
|
||||
formParams = formParams.append('client_id', <any>clientId) as any || formParams;
|
||||
}
|
||||
if (clientSecret !== undefined) {
|
||||
formParams = formParams.append('client_secret', <any>clientSecret) as any || formParams;
|
||||
}
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.post<BodyAccessToken>(`${this.configuration.basePath}/api/admin/login/`,
|
||||
convertFormParamsToString ? formParams.toString() : formParams,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Register
|
||||
* Sends an email with a confirmation link. - **email**: E-Mail Address of new hood admin - **password**: Password of new hood admin
|
||||
* @param bodyAdmin
|
||||
* @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 register(bodyAdmin: BodyAdmin, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<object>;
|
||||
public register(bodyAdmin: BodyAdmin, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<object>>;
|
||||
public register(bodyAdmin: BodyAdmin, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<object>>;
|
||||
public register(bodyAdmin: BodyAdmin, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (bodyAdmin === null || bodyAdmin === undefined) {
|
||||
throw new Error('Required parameter bodyAdmin was null or undefined when calling register.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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<object>(`${this.configuration.basePath}/api/admin/register/`,
|
||||
bodyAdmin,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
17
kibicara-frontend/src/app/api/api/api.ts
Normal file
17
kibicara-frontend/src/app/api/api/api.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
export * from './admin.service';
|
||||
import { AdminService } from './admin.service';
|
||||
export * from './badwords.service';
|
||||
import { BadwordsService } from './badwords.service';
|
||||
export * from './email.service';
|
||||
import { EmailService } from './email.service';
|
||||
export * from './hoods.service';
|
||||
import { HoodsService } from './hoods.service';
|
||||
export * from './telegram.service';
|
||||
import { TelegramService } from './telegram.service';
|
||||
export * from './test.service';
|
||||
import { TestService } from './test.service';
|
||||
export * from './triggers.service';
|
||||
import { TriggersService } from './triggers.service';
|
||||
export * from './twitter.service';
|
||||
import { TwitterService } from './twitter.service';
|
||||
export const APIS = [AdminService, BadwordsService, EmailService, HoodsService, TelegramService, TestService, TriggersService, TwitterService];
|
400
kibicara-frontend/src/app/api/api/badwords.service.ts
Normal file
400
kibicara-frontend/src/app/api/api/badwords.service.ts
Normal file
|
@ -0,0 +1,400 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec } from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { AnyType } from '../model/models';
|
||||
import { BodyBadWord } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class BadwordsService {
|
||||
|
||||
protected basePath = 'http://localhost';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||
if (typeof value === "object" && value instanceof Date === false) {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
||||
} else {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||
if (value == null) {
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
if (typeof value === "object") {
|
||||
if (Array.isArray(value)) {
|
||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||
} else if (value instanceof Date) {
|
||||
if (key != null) {
|
||||
httpParams = httpParams.append(key,
|
||||
(value as Date).toISOString().substr(0, 10));
|
||||
} else {
|
||||
throw Error("key may not be null if value is Date");
|
||||
}
|
||||
} else {
|
||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
||||
}
|
||||
} else if (key != null) {
|
||||
httpParams = httpParams.append(key, value);
|
||||
} else {
|
||||
throw Error("key may not be null if value is not object or array");
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Badword Create
|
||||
* Creates a new badword for hood with id **hood_id**. - **pattern**: Regular expression which is used to match a badword.
|
||||
* @param hoodId
|
||||
* @param bodyBadWord
|
||||
* @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 createBadword(hoodId: number, bodyBadWord: BodyBadWord, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public createBadword(hoodId: number, bodyBadWord: BodyBadWord, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public createBadword(hoodId: number, bodyBadWord: BodyBadWord, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public createBadword(hoodId: number, bodyBadWord: BodyBadWord, 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 createBadword.');
|
||||
}
|
||||
if (bodyBadWord === null || bodyBadWord === undefined) {
|
||||
throw new Error('Required parameter bodyBadWord was null or undefined when calling createBadword.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/badwords/`,
|
||||
bodyBadWord,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Badword Delete
|
||||
* Deletes badword with id **badword_id** for hood with id **hood_id**.
|
||||
* @param badwordId
|
||||
* @param hoodId
|
||||
* @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 deleteBadword(badwordId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<any>;
|
||||
public deleteBadword(badwordId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
|
||||
public deleteBadword(badwordId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
|
||||
public deleteBadword(badwordId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (badwordId === null || badwordId === undefined) {
|
||||
throw new Error('Required parameter badwordId was null or undefined when calling deleteBadword.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling deleteBadword.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/badwords/${encodeURIComponent(String(badwordId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Badword Read
|
||||
* Reads badword with id **badword_id** for hood with id **hood_id**.
|
||||
* @param badwordId
|
||||
* @param hoodId
|
||||
* @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 getBadword(badwordId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getBadword(badwordId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getBadword(badwordId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getBadword(badwordId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (badwordId === null || badwordId === undefined) {
|
||||
throw new Error('Required parameter badwordId was null or undefined when calling getBadword.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling getBadword.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/badwords/${encodeURIComponent(String(badwordId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Badword Read All
|
||||
* Get all badwords of hood with id **hood_id**.
|
||||
* @param hoodId
|
||||
* @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 getBadwords(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getBadwords(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getBadwords(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getBadwords(hoodId: number, 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 getBadwords.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/badwords/`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Badword Update
|
||||
* Updates badword with id **badword_id** for hood with id **hood_id**. - **pattern**: Regular expression which is used to match a badword
|
||||
* @param badwordId
|
||||
* @param hoodId
|
||||
* @param bodyBadWord
|
||||
* @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 updateBadword(badwordId: number, hoodId: number, bodyBadWord: BodyBadWord, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<any>;
|
||||
public updateBadword(badwordId: number, hoodId: number, bodyBadWord: BodyBadWord, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
|
||||
public updateBadword(badwordId: number, hoodId: number, bodyBadWord: BodyBadWord, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
|
||||
public updateBadword(badwordId: number, hoodId: number, bodyBadWord: BodyBadWord, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (badwordId === null || badwordId === undefined) {
|
||||
throw new Error('Required parameter badwordId was null or undefined when calling updateBadword.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling updateBadword.');
|
||||
}
|
||||
if (bodyBadWord === null || bodyBadWord === undefined) {
|
||||
throw new Error('Required parameter bodyBadWord was null or undefined when calling updateBadword.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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.put<any>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/badwords/${encodeURIComponent(String(badwordId))}`,
|
||||
bodyBadWord,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
820
kibicara-frontend/src/app/api/api/email.service.ts
Normal file
820
kibicara-frontend/src/app/api/api/email.service.ts
Normal file
|
@ -0,0 +1,820 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec } from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { AnyType } from '../model/models';
|
||||
import { BodyEmail } from '../model/models';
|
||||
import { BodySubscriber } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
import { KibicaraPlatformsEmailWebapiBodyMessage } from '../model/models';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class EmailService {
|
||||
|
||||
protected basePath = 'http://localhost';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||
if (typeof value === "object" && value instanceof Date === false) {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
||||
} else {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||
if (value == null) {
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
if (typeof value === "object") {
|
||||
if (Array.isArray(value)) {
|
||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||
} else if (value instanceof Date) {
|
||||
if (key != null) {
|
||||
httpParams = httpParams.append(key,
|
||||
(value as Date).toISOString().substr(0, 10));
|
||||
} else {
|
||||
throw Error("key may not be null if value is Date");
|
||||
}
|
||||
} else {
|
||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
||||
}
|
||||
} else if (key != null) {
|
||||
httpParams = httpParams.append(key, value);
|
||||
} else {
|
||||
throw Error("key may not be null if value is not object or array");
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Email Subscribe Confirm
|
||||
* Confirm a new subscriber and add them to the database. :param token: encrypted JSON token, holds the email of the subscriber. :param hood: Hood the Email bot belongs to. :return: Returns status code 200 after adding the subscriber to the database.
|
||||
* @param token
|
||||
* @param hoodId
|
||||
* @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 confirmSubscriber(token: AnyType, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<object>;
|
||||
public confirmSubscriber(token: AnyType, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<object>>;
|
||||
public confirmSubscriber(token: AnyType, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<object>>;
|
||||
public confirmSubscriber(token: AnyType, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (token === null || token === undefined) {
|
||||
throw new Error('Required parameter token was null or undefined when calling confirmSubscriber.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling confirmSubscriber.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.post<object>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/subscribe/confirm/${encodeURIComponent(String(token))}`,
|
||||
null,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email Create
|
||||
* Create an Email bot. Call this when creating a hood. :param hood: Hood row of the hood the Email bot is supposed to belong to. :return: Email row of the new email bot.
|
||||
* @param hoodId
|
||||
* @param bodyEmail
|
||||
* @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 createEmail(hoodId: number, bodyEmail: BodyEmail, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public createEmail(hoodId: number, bodyEmail: BodyEmail, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public createEmail(hoodId: number, bodyEmail: BodyEmail, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public createEmail(hoodId: number, bodyEmail: BodyEmail, 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 createEmail.');
|
||||
}
|
||||
if (bodyEmail === null || bodyEmail === undefined) {
|
||||
throw new Error('Required parameter bodyEmail was null or undefined when calling createEmail.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/`,
|
||||
bodyEmail,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email Delete
|
||||
* Delete an Email bot. Stops and deletes the Email bot. :param hood: Hood the Email bot belongs to.
|
||||
* @param emailId
|
||||
* @param hoodId
|
||||
* @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 deleteEmail(emailId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<any>;
|
||||
public deleteEmail(emailId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
|
||||
public deleteEmail(emailId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
|
||||
public deleteEmail(emailId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (emailId === null || emailId === undefined) {
|
||||
throw new Error('Required parameter emailId was null or undefined when calling deleteEmail.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling deleteEmail.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/${encodeURIComponent(String(emailId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email Read
|
||||
* @param emailId
|
||||
* @param hoodId
|
||||
* @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 getEmail(emailId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getEmail(emailId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getEmail(emailId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getEmail(emailId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (emailId === null || emailId === undefined) {
|
||||
throw new Error('Required parameter emailId was null or undefined when calling getEmail.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling getEmail.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/${encodeURIComponent(String(emailId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email Read All
|
||||
* @param hoodId
|
||||
* @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 getEmails(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getEmails(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getEmails(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getEmails(hoodId: number, 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 getEmails.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribers Read
|
||||
* @param subscriberId
|
||||
* @param hoodId
|
||||
* @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 getSubscriber(subscriberId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getSubscriber(subscriberId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getSubscriber(subscriberId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getSubscriber(subscriberId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (subscriberId === null || subscriberId === undefined) {
|
||||
throw new Error('Required parameter subscriberId was null or undefined when calling getSubscriber.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling getSubscriber.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/subscribers/${encodeURIComponent(String(subscriberId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribers Read All
|
||||
* @param hoodId
|
||||
* @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 getSubscribers(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getSubscribers(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getSubscribers(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getSubscribers(hoodId: number, 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 getSubscribers.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/subscribers/`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email Message Create
|
||||
* Receive a message from the MDA and pass it to the censor. :param message: BodyMessage object, holds the message. :param hood: Hood the Email bot belongs to. :return: returns status code 201 if the message is accepted by the censor.
|
||||
* @param hoodId
|
||||
* @param kibicaraPlatformsEmailWebapiBodyMessage
|
||||
* @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 sendMessage(hoodId: number, kibicaraPlatformsEmailWebapiBodyMessage: KibicaraPlatformsEmailWebapiBodyMessage, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public sendMessage(hoodId: number, kibicaraPlatformsEmailWebapiBodyMessage: KibicaraPlatformsEmailWebapiBodyMessage, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public sendMessage(hoodId: number, kibicaraPlatformsEmailWebapiBodyMessage: KibicaraPlatformsEmailWebapiBodyMessage, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public sendMessage(hoodId: number, kibicaraPlatformsEmailWebapiBodyMessage: KibicaraPlatformsEmailWebapiBodyMessage, 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 sendMessage.');
|
||||
}
|
||||
if (kibicaraPlatformsEmailWebapiBodyMessage === null || kibicaraPlatformsEmailWebapiBodyMessage === undefined) {
|
||||
throw new Error('Required parameter kibicaraPlatformsEmailWebapiBodyMessage was null or undefined when calling sendMessage.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/messages/`,
|
||||
kibicaraPlatformsEmailWebapiBodyMessage,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email Start
|
||||
* @param hoodId
|
||||
* @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 startEmail(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public startEmail(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public startEmail(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public startEmail(hoodId: number, 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 startEmail.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.post<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/start`,
|
||||
null,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email Status
|
||||
* @param hoodId
|
||||
* @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 statusEmail(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public statusEmail(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public statusEmail(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public statusEmail(hoodId: number, 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 statusEmail.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/status`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email Stop
|
||||
* @param hoodId
|
||||
* @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 stopEmail(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public stopEmail(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public stopEmail(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public stopEmail(hoodId: number, 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 stopEmail.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.post<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/stop`,
|
||||
null,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email Subscribe
|
||||
* Send a confirmation mail to subscribe to messages via email. :param subscriber: Subscriber object, holds the email address. :param hood: Hood the Email bot belongs to. :return: Returns status code 200 after sending confirmation email.
|
||||
* @param hoodId
|
||||
* @param bodySubscriber
|
||||
* @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 subscribe(hoodId: number, bodySubscriber: BodySubscriber, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<object>;
|
||||
public subscribe(hoodId: number, bodySubscriber: BodySubscriber, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<object>>;
|
||||
public subscribe(hoodId: number, bodySubscriber: BodySubscriber, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<object>>;
|
||||
public subscribe(hoodId: number, bodySubscriber: BodySubscriber, 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 subscribe.');
|
||||
}
|
||||
if (bodySubscriber === null || bodySubscriber === undefined) {
|
||||
throw new Error('Required parameter bodySubscriber was null or undefined when calling subscribe.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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<object>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/subscribe/`,
|
||||
bodySubscriber,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Email Unsubscribe
|
||||
* Remove a subscriber from the database when they click on an unsubscribe link. :param token: encrypted JSON token, holds subscriber email + hood.id. :param hood: Hood the Email bot belongs to.
|
||||
* @param token
|
||||
* @param hoodId
|
||||
* @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 unsubscribe(token: AnyType, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<any>;
|
||||
public unsubscribe(token: AnyType, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
|
||||
public unsubscribe(token: AnyType, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
|
||||
public unsubscribe(token: AnyType, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (token === null || token === undefined) {
|
||||
throw new Error('Required parameter token was null or undefined when calling unsubscribe.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling unsubscribe.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/email/unsubscribe/${encodeURIComponent(String(token))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
372
kibicara-frontend/src/app/api/api/hoods.service.ts
Normal file
372
kibicara-frontend/src/app/api/api/hoods.service.ts
Normal file
|
@ -0,0 +1,372 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec } from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { AnyType } from '../model/models';
|
||||
import { BodyHood } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class HoodsService {
|
||||
|
||||
protected basePath = 'http://localhost';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||
if (typeof value === "object" && value instanceof Date === false) {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
||||
} else {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||
if (value == null) {
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
if (typeof value === "object") {
|
||||
if (Array.isArray(value)) {
|
||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||
} else if (value instanceof Date) {
|
||||
if (key != null) {
|
||||
httpParams = httpParams.append(key,
|
||||
(value as Date).toISOString().substr(0, 10));
|
||||
} else {
|
||||
throw Error("key may not be null if value is Date");
|
||||
}
|
||||
} else {
|
||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
||||
}
|
||||
} else if (key != null) {
|
||||
httpParams = httpParams.append(key, value);
|
||||
} else {
|
||||
throw Error("key may not be null if value is not object or array");
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hood Create
|
||||
* Creates a hood. - **name**: Name of the hood - **landingpage**: Markdown formatted description of the hood
|
||||
* @param bodyHood
|
||||
* @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 createHood(bodyHood: BodyHood, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public createHood(bodyHood: BodyHood, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public createHood(bodyHood: BodyHood, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public createHood(bodyHood: BodyHood, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (bodyHood === null || bodyHood === undefined) {
|
||||
throw new Error('Required parameter bodyHood was null or undefined when calling createHood.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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<AnyType>(`${this.configuration.basePath}/api/hoods/`,
|
||||
bodyHood,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hood Delete
|
||||
* Deletes hood with id **hood_id**.
|
||||
* @param hoodId
|
||||
* @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 deleteHood(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<any>;
|
||||
public deleteHood(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
|
||||
public deleteHood(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
|
||||
public deleteHood(hoodId: number, 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 deleteHood.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hood Read
|
||||
* Get hood with id **hood_id**.
|
||||
* @param hoodId
|
||||
* @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 getHood(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getHood(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getHood(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getHood(hoodId: number, 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 getHood.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hood Read All
|
||||
* Get all existing hoods.
|
||||
* @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 getHoods(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getHoods(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getHoods(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getHoods(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hood Update
|
||||
* Updates hood with id **hood_id**. - **name**: New name of the hood - **landingpage**: New Markdown formatted description of the hood
|
||||
* @param hoodId
|
||||
* @param bodyHood
|
||||
* @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 updateHood(hoodId: number, bodyHood: BodyHood, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<any>;
|
||||
public updateHood(hoodId: number, bodyHood: BodyHood, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
|
||||
public updateHood(hoodId: number, bodyHood: BodyHood, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
|
||||
public updateHood(hoodId: number, bodyHood: BodyHood, 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 updateHood.');
|
||||
}
|
||||
if (bodyHood === null || bodyHood === undefined) {
|
||||
throw new Error('Required parameter bodyHood was null or undefined when calling updateHood.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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.put<any>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}`,
|
||||
bodyHood,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
568
kibicara-frontend/src/app/api/api/telegram.service.ts
Normal file
568
kibicara-frontend/src/app/api/api/telegram.service.ts
Normal file
|
@ -0,0 +1,568 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec } from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { AnyType } from '../model/models';
|
||||
import { BodyTelegram } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TelegramService {
|
||||
|
||||
protected basePath = 'http://localhost';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||
if (typeof value === "object" && value instanceof Date === false) {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
||||
} else {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||
if (value == null) {
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
if (typeof value === "object") {
|
||||
if (Array.isArray(value)) {
|
||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||
} else if (value instanceof Date) {
|
||||
if (key != null) {
|
||||
httpParams = httpParams.append(key,
|
||||
(value as Date).toISOString().substr(0, 10));
|
||||
} else {
|
||||
throw Error("key may not be null if value is Date");
|
||||
}
|
||||
} else {
|
||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
||||
}
|
||||
} else if (key != null) {
|
||||
httpParams = httpParams.append(key, value);
|
||||
} else {
|
||||
throw Error("key may not be null if value is not object or array");
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Telegram Create
|
||||
* @param hoodId
|
||||
* @param bodyTelegram
|
||||
* @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 createTelegram(hoodId: number, bodyTelegram: BodyTelegram, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public createTelegram(hoodId: number, bodyTelegram: BodyTelegram, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public createTelegram(hoodId: number, bodyTelegram: BodyTelegram, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public createTelegram(hoodId: number, bodyTelegram: BodyTelegram, 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 createTelegram.');
|
||||
}
|
||||
if (bodyTelegram === null || bodyTelegram === undefined) {
|
||||
throw new Error('Required parameter bodyTelegram was null or undefined when calling createTelegram.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/telegram/`,
|
||||
bodyTelegram,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Telegram Delete
|
||||
* @param telegramId
|
||||
* @param hoodId
|
||||
* @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 deleteTelegram(telegramId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<any>;
|
||||
public deleteTelegram(telegramId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
|
||||
public deleteTelegram(telegramId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
|
||||
public deleteTelegram(telegramId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (telegramId === null || telegramId === undefined) {
|
||||
throw new Error('Required parameter telegramId was null or undefined when calling deleteTelegram.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling deleteTelegram.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/telegram/${encodeURIComponent(String(telegramId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Telegram Read
|
||||
* @param telegramId
|
||||
* @param hoodId
|
||||
* @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 getTelegram(telegramId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getTelegram(telegramId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getTelegram(telegramId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getTelegram(telegramId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (telegramId === null || telegramId === undefined) {
|
||||
throw new Error('Required parameter telegramId was null or undefined when calling getTelegram.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling getTelegram.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/telegram/${encodeURIComponent(String(telegramId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Telegram Read All
|
||||
* @param hoodId
|
||||
* @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 getTelegrams(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getTelegrams(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getTelegrams(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getTelegrams(hoodId: number, 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 getTelegrams.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/telegram/`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Telegram Start
|
||||
* @param telegramId
|
||||
* @param hoodId
|
||||
* @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 startTelegram(telegramId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public startTelegram(telegramId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public startTelegram(telegramId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public startTelegram(telegramId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (telegramId === null || telegramId === undefined) {
|
||||
throw new Error('Required parameter telegramId was null or undefined when calling startTelegram.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling startTelegram.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.post<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/telegram/${encodeURIComponent(String(telegramId))}/start`,
|
||||
null,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Telegram Status
|
||||
* @param telegramId
|
||||
* @param hoodId
|
||||
* @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 statusTelegram(telegramId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public statusTelegram(telegramId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public statusTelegram(telegramId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public statusTelegram(telegramId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (telegramId === null || telegramId === undefined) {
|
||||
throw new Error('Required parameter telegramId was null or undefined when calling statusTelegram.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling statusTelegram.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/telegram/${encodeURIComponent(String(telegramId))}/status`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Telegram Stop
|
||||
* @param telegramId
|
||||
* @param hoodId
|
||||
* @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 stopTelegram(telegramId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public stopTelegram(telegramId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public stopTelegram(telegramId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public stopTelegram(telegramId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (telegramId === null || telegramId === undefined) {
|
||||
throw new Error('Required parameter telegramId was null or undefined when calling stopTelegram.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling stopTelegram.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.post<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/telegram/${encodeURIComponent(String(telegramId))}/stop`,
|
||||
null,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Telegram Update
|
||||
* @param telegramId
|
||||
* @param hoodId
|
||||
* @param bodyTelegram
|
||||
* @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 updateTelegram(telegramId: number, hoodId: number, bodyTelegram: BodyTelegram, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public updateTelegram(telegramId: number, hoodId: number, bodyTelegram: BodyTelegram, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public updateTelegram(telegramId: number, hoodId: number, bodyTelegram: BodyTelegram, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public updateTelegram(telegramId: number, hoodId: number, bodyTelegram: BodyTelegram, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (telegramId === null || telegramId === undefined) {
|
||||
throw new Error('Required parameter telegramId was null or undefined when calling updateTelegram.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling updateTelegram.');
|
||||
}
|
||||
if (bodyTelegram === null || bodyTelegram === undefined) {
|
||||
throw new Error('Required parameter bodyTelegram was null or undefined when calling updateTelegram.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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.put<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/telegram/${encodeURIComponent(String(telegramId))}`,
|
||||
bodyTelegram,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
439
kibicara-frontend/src/app/api/api/test.service.ts
Normal file
439
kibicara-frontend/src/app/api/api/test.service.ts
Normal file
|
@ -0,0 +1,439 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec } from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { AnyType } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
import { KibicaraPlatformsTestWebapiBodyMessage } from '../model/models';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TestService {
|
||||
|
||||
protected basePath = 'http://localhost';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||
if (typeof value === "object" && value instanceof Date === false) {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
||||
} else {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||
if (value == null) {
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
if (typeof value === "object") {
|
||||
if (Array.isArray(value)) {
|
||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||
} else if (value instanceof Date) {
|
||||
if (key != null) {
|
||||
httpParams = httpParams.append(key,
|
||||
(value as Date).toISOString().substr(0, 10));
|
||||
} else {
|
||||
throw Error("key may not be null if value is Date");
|
||||
}
|
||||
} else {
|
||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
||||
}
|
||||
} else if (key != null) {
|
||||
httpParams = httpParams.append(key, value);
|
||||
} else {
|
||||
throw Error("key may not be null if value is not object or array");
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Create
|
||||
* @param hoodId
|
||||
* @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 testCreateApiHoodsHoodIdTestPost(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public testCreateApiHoodsHoodIdTestPost(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public testCreateApiHoodsHoodIdTestPost(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public testCreateApiHoodsHoodIdTestPost(hoodId: number, 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 testCreateApiHoodsHoodIdTestPost.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.post<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/test/`,
|
||||
null,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Delete
|
||||
* @param testId
|
||||
* @param hoodId
|
||||
* @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 testDeleteApiHoodsHoodIdTestTestIdDelete(testId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<any>;
|
||||
public testDeleteApiHoodsHoodIdTestTestIdDelete(testId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
|
||||
public testDeleteApiHoodsHoodIdTestTestIdDelete(testId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
|
||||
public testDeleteApiHoodsHoodIdTestTestIdDelete(testId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (testId === null || testId === undefined) {
|
||||
throw new Error('Required parameter testId was null or undefined when calling testDeleteApiHoodsHoodIdTestTestIdDelete.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling testDeleteApiHoodsHoodIdTestTestIdDelete.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/test/${encodeURIComponent(String(testId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Message Create
|
||||
* @param testId
|
||||
* @param hoodId
|
||||
* @param kibicaraPlatformsTestWebapiBodyMessage
|
||||
* @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 testMessageCreateApiHoodsHoodIdTestTestIdMessagesPost(testId: number, hoodId: number, kibicaraPlatformsTestWebapiBodyMessage: KibicaraPlatformsTestWebapiBodyMessage, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public testMessageCreateApiHoodsHoodIdTestTestIdMessagesPost(testId: number, hoodId: number, kibicaraPlatformsTestWebapiBodyMessage: KibicaraPlatformsTestWebapiBodyMessage, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public testMessageCreateApiHoodsHoodIdTestTestIdMessagesPost(testId: number, hoodId: number, kibicaraPlatformsTestWebapiBodyMessage: KibicaraPlatformsTestWebapiBodyMessage, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public testMessageCreateApiHoodsHoodIdTestTestIdMessagesPost(testId: number, hoodId: number, kibicaraPlatformsTestWebapiBodyMessage: KibicaraPlatformsTestWebapiBodyMessage, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (testId === null || testId === undefined) {
|
||||
throw new Error('Required parameter testId was null or undefined when calling testMessageCreateApiHoodsHoodIdTestTestIdMessagesPost.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling testMessageCreateApiHoodsHoodIdTestTestIdMessagesPost.');
|
||||
}
|
||||
if (kibicaraPlatformsTestWebapiBodyMessage === null || kibicaraPlatformsTestWebapiBodyMessage === undefined) {
|
||||
throw new Error('Required parameter kibicaraPlatformsTestWebapiBodyMessage was null or undefined when calling testMessageCreateApiHoodsHoodIdTestTestIdMessagesPost.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/test/${encodeURIComponent(String(testId))}/messages/`,
|
||||
kibicaraPlatformsTestWebapiBodyMessage,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Message Read All
|
||||
* @param testId
|
||||
* @param hoodId
|
||||
* @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 testMessageReadAllApiHoodsHoodIdTestTestIdMessagesGet(testId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public testMessageReadAllApiHoodsHoodIdTestTestIdMessagesGet(testId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public testMessageReadAllApiHoodsHoodIdTestTestIdMessagesGet(testId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public testMessageReadAllApiHoodsHoodIdTestTestIdMessagesGet(testId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (testId === null || testId === undefined) {
|
||||
throw new Error('Required parameter testId was null or undefined when calling testMessageReadAllApiHoodsHoodIdTestTestIdMessagesGet.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling testMessageReadAllApiHoodsHoodIdTestTestIdMessagesGet.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/test/${encodeURIComponent(String(testId))}/messages/`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Read All
|
||||
* @param hoodId
|
||||
* @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 testReadAllApiHoodsHoodIdTestGet(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public testReadAllApiHoodsHoodIdTestGet(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public testReadAllApiHoodsHoodIdTestGet(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public testReadAllApiHoodsHoodIdTestGet(hoodId: number, 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 testReadAllApiHoodsHoodIdTestGet.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/test/`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Read
|
||||
* @param testId
|
||||
* @param hoodId
|
||||
* @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 testReadApiHoodsHoodIdTestTestIdGet(testId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public testReadApiHoodsHoodIdTestTestIdGet(testId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public testReadApiHoodsHoodIdTestTestIdGet(testId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public testReadApiHoodsHoodIdTestTestIdGet(testId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (testId === null || testId === undefined) {
|
||||
throw new Error('Required parameter testId was null or undefined when calling testReadApiHoodsHoodIdTestTestIdGet.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling testReadApiHoodsHoodIdTestTestIdGet.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/test/${encodeURIComponent(String(testId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
400
kibicara-frontend/src/app/api/api/triggers.service.ts
Normal file
400
kibicara-frontend/src/app/api/api/triggers.service.ts
Normal file
|
@ -0,0 +1,400 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec } from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { AnyType } from '../model/models';
|
||||
import { BodyTrigger } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TriggersService {
|
||||
|
||||
protected basePath = 'http://localhost';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||
if (typeof value === "object" && value instanceof Date === false) {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
||||
} else {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||
if (value == null) {
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
if (typeof value === "object") {
|
||||
if (Array.isArray(value)) {
|
||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||
} else if (value instanceof Date) {
|
||||
if (key != null) {
|
||||
httpParams = httpParams.append(key,
|
||||
(value as Date).toISOString().substr(0, 10));
|
||||
} else {
|
||||
throw Error("key may not be null if value is Date");
|
||||
}
|
||||
} else {
|
||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
||||
}
|
||||
} else if (key != null) {
|
||||
httpParams = httpParams.append(key, value);
|
||||
} else {
|
||||
throw Error("key may not be null if value is not object or array");
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger Create
|
||||
* Creates a new trigger for hood with id **hood_id**. - **pattern**: Regular expression which is used to match a trigger.
|
||||
* @param hoodId
|
||||
* @param bodyTrigger
|
||||
* @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 createTrigger(hoodId: number, bodyTrigger: BodyTrigger, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public createTrigger(hoodId: number, bodyTrigger: BodyTrigger, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public createTrigger(hoodId: number, bodyTrigger: BodyTrigger, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public createTrigger(hoodId: number, bodyTrigger: BodyTrigger, 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 createTrigger.');
|
||||
}
|
||||
if (bodyTrigger === null || bodyTrigger === undefined) {
|
||||
throw new Error('Required parameter bodyTrigger was null or undefined when calling createTrigger.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/triggers/`,
|
||||
bodyTrigger,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger Delete
|
||||
* Deletes trigger with id **trigger_id** for hood with id **hood_id**.
|
||||
* @param triggerId
|
||||
* @param hoodId
|
||||
* @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 deleteTrigger(triggerId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<any>;
|
||||
public deleteTrigger(triggerId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
|
||||
public deleteTrigger(triggerId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
|
||||
public deleteTrigger(triggerId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (triggerId === null || triggerId === undefined) {
|
||||
throw new Error('Required parameter triggerId was null or undefined when calling deleteTrigger.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling deleteTrigger.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/triggers/${encodeURIComponent(String(triggerId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger Read
|
||||
* Reads trigger with id **trigger_id** for hood with id **hood_id**.
|
||||
* @param triggerId
|
||||
* @param hoodId
|
||||
* @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 getTrigger(triggerId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getTrigger(triggerId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getTrigger(triggerId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getTrigger(triggerId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (triggerId === null || triggerId === undefined) {
|
||||
throw new Error('Required parameter triggerId was null or undefined when calling getTrigger.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling getTrigger.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/triggers/${encodeURIComponent(String(triggerId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger Read All
|
||||
* Get all triggers of hood with id **hood_id**.
|
||||
* @param hoodId
|
||||
* @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 getTriggers(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getTriggers(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getTriggers(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getTriggers(hoodId: number, 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 getTriggers.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/triggers/`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger Update
|
||||
* Updates trigger with id **trigger_id** for hood with id **hood_id**. - **pattern**: Regular expression which is used to match a trigger
|
||||
* @param triggerId
|
||||
* @param hoodId
|
||||
* @param bodyTrigger
|
||||
* @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 updateTrigger(triggerId: number, hoodId: number, bodyTrigger: BodyTrigger, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<any>;
|
||||
public updateTrigger(triggerId: number, hoodId: number, bodyTrigger: BodyTrigger, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
|
||||
public updateTrigger(triggerId: number, hoodId: number, bodyTrigger: BodyTrigger, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
|
||||
public updateTrigger(triggerId: number, hoodId: number, bodyTrigger: BodyTrigger, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (triggerId === null || triggerId === undefined) {
|
||||
throw new Error('Required parameter triggerId was null or undefined when calling updateTrigger.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling updateTrigger.');
|
||||
}
|
||||
if (bodyTrigger === null || bodyTrigger === undefined) {
|
||||
throw new Error('Required parameter bodyTrigger was null or undefined when calling updateTrigger.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
// 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.put<any>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/triggers/${encodeURIComponent(String(triggerId))}`,
|
||||
bodyTrigger,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
544
kibicara-frontend/src/app/api/api/twitter.service.ts
Normal file
544
kibicara-frontend/src/app/api/api/twitter.service.ts
Normal file
|
@ -0,0 +1,544 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec } from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { AnyType } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TwitterService {
|
||||
|
||||
protected basePath = 'http://localhost';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration = new Configuration();
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
|
||||
if (configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
|
||||
if (typeof value === "object" && value instanceof Date === false) {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value);
|
||||
} else {
|
||||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
|
||||
if (value == null) {
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
if (typeof value === "object") {
|
||||
if (Array.isArray(value)) {
|
||||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
|
||||
} else if (value instanceof Date) {
|
||||
if (key != null) {
|
||||
httpParams = httpParams.append(key,
|
||||
(value as Date).toISOString().substr(0, 10));
|
||||
} else {
|
||||
throw Error("key may not be null if value is Date");
|
||||
}
|
||||
} else {
|
||||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
|
||||
httpParams, value[k], key != null ? `${key}.${k}` : k));
|
||||
}
|
||||
} else if (key != null) {
|
||||
httpParams = httpParams.append(key, value);
|
||||
} else {
|
||||
throw Error("key may not be null if value is not object or array");
|
||||
}
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Twitter Read Callback
|
||||
* @param oauthToken
|
||||
* @param oauthVerifier
|
||||
* @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 callbackTwitter(oauthToken: string, oauthVerifier: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public callbackTwitter(oauthToken: string, oauthVerifier: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public callbackTwitter(oauthToken: string, oauthVerifier: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public callbackTwitter(oauthToken: string, oauthVerifier: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (oauthToken === null || oauthToken === undefined) {
|
||||
throw new Error('Required parameter oauthToken was null or undefined when calling callbackTwitter.');
|
||||
}
|
||||
if (oauthVerifier === null || oauthVerifier === undefined) {
|
||||
throw new Error('Required parameter oauthVerifier was null or undefined when calling callbackTwitter.');
|
||||
}
|
||||
|
||||
let queryParameters = new HttpParams({encoder: this.encoder});
|
||||
if (oauthToken !== undefined && oauthToken !== null) {
|
||||
queryParameters = this.addToHttpParams(queryParameters,
|
||||
<any>oauthToken, 'oauth_token');
|
||||
}
|
||||
if (oauthVerifier !== undefined && oauthVerifier !== null) {
|
||||
queryParameters = this.addToHttpParams(queryParameters,
|
||||
<any>oauthVerifier, 'oauth_verifier');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/twitter/callback`,
|
||||
{
|
||||
params: queryParameters,
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Twitter Create
|
||||
* `https://api.twitter.com/oauth/authorize?oauth_token=`
|
||||
* @param hoodId
|
||||
* @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 createTwitter(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public createTwitter(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public createTwitter(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public createTwitter(hoodId: number, 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 createTwitter.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.post<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/twitter/`,
|
||||
null,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Twitter Delete
|
||||
* @param twitterId
|
||||
* @param hoodId
|
||||
* @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 deleteTwitter(twitterId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<any>;
|
||||
public deleteTwitter(twitterId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<any>>;
|
||||
public deleteTwitter(twitterId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<any>>;
|
||||
public deleteTwitter(twitterId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (twitterId === null || twitterId === undefined) {
|
||||
throw new Error('Required parameter twitterId was null or undefined when calling deleteTwitter.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling deleteTwitter.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.delete<any>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/twitter/${encodeURIComponent(String(twitterId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Twitter Read
|
||||
* @param twitterId
|
||||
* @param hoodId
|
||||
* @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 getTwitter(twitterId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getTwitter(twitterId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getTwitter(twitterId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getTwitter(twitterId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (twitterId === null || twitterId === undefined) {
|
||||
throw new Error('Required parameter twitterId was null or undefined when calling getTwitter.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling getTwitter.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/twitter/${encodeURIComponent(String(twitterId))}`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Twitter Read All
|
||||
* @param hoodId
|
||||
* @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 getTwitters(hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public getTwitters(hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public getTwitters(hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public getTwitters(hoodId: number, 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 getTwitters.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/twitter/`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Twitter Start
|
||||
* @param twitterId
|
||||
* @param hoodId
|
||||
* @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 startTwitter(twitterId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public startTwitter(twitterId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public startTwitter(twitterId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public startTwitter(twitterId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (twitterId === null || twitterId === undefined) {
|
||||
throw new Error('Required parameter twitterId was null or undefined when calling startTwitter.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling startTwitter.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.post<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/twitter/${encodeURIComponent(String(twitterId))}/start`,
|
||||
null,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Twitter Status
|
||||
* @param twitterId
|
||||
* @param hoodId
|
||||
* @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 statusTwitter(twitterId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public statusTwitter(twitterId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public statusTwitter(twitterId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public statusTwitter(twitterId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (twitterId === null || twitterId === undefined) {
|
||||
throw new Error('Required parameter twitterId was null or undefined when calling statusTwitter.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling statusTwitter.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.get<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/twitter/${encodeURIComponent(String(twitterId))}/status`,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Twitter Stop
|
||||
* @param twitterId
|
||||
* @param hoodId
|
||||
* @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 stopTwitter(twitterId: number, hoodId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<AnyType>;
|
||||
public stopTwitter(twitterId: number, hoodId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpResponse<AnyType>>;
|
||||
public stopTwitter(twitterId: number, hoodId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable<HttpEvent<AnyType>>;
|
||||
public stopTwitter(twitterId: number, hoodId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable<any> {
|
||||
if (twitterId === null || twitterId === undefined) {
|
||||
throw new Error('Required parameter twitterId was null or undefined when calling stopTwitter.');
|
||||
}
|
||||
if (hoodId === null || hoodId === undefined) {
|
||||
throw new Error('Required parameter hoodId was null or undefined when calling stopTwitter.');
|
||||
}
|
||||
|
||||
let headers = this.defaultHeaders;
|
||||
|
||||
// authentication (OAuth2PasswordBearer) required
|
||||
if (this.configuration.accessToken) {
|
||||
const accessToken = typeof this.configuration.accessToken === 'function'
|
||||
? this.configuration.accessToken()
|
||||
: this.configuration.accessToken;
|
||||
headers = headers.set('Authorization', 'Bearer ' + accessToken);
|
||||
}
|
||||
|
||||
let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
|
||||
if (httpHeaderAcceptSelected === undefined) {
|
||||
// to determine the Accept header
|
||||
const httpHeaderAccepts: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
||||
}
|
||||
if (httpHeaderAcceptSelected !== undefined) {
|
||||
headers = headers.set('Accept', httpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
|
||||
let responseType: 'text' | 'json' = 'json';
|
||||
if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType = 'text';
|
||||
}
|
||||
|
||||
return this.httpClient.post<AnyType>(`${this.configuration.basePath}/api/hoods/${encodeURIComponent(String(hoodId))}/twitter/${encodeURIComponent(String(twitterId))}/stop`,
|
||||
null,
|
||||
{
|
||||
responseType: <any>responseType,
|
||||
withCredentials: this.configuration.withCredentials,
|
||||
headers: headers,
|
||||
observe: observe,
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
84
kibicara-frontend/src/app/api/configuration.ts
Normal file
84
kibicara-frontend/src/app/api/configuration.ts
Normal file
|
@ -0,0 +1,84 @@
|
|||
import { HttpParameterCodec } from '@angular/common/http';
|
||||
|
||||
export interface ConfigurationParameters {
|
||||
apiKeys?: {[ key: string ]: string};
|
||||
username?: string;
|
||||
password?: string;
|
||||
accessToken?: string | (() => string);
|
||||
basePath?: string;
|
||||
withCredentials?: boolean;
|
||||
encoder?: HttpParameterCodec;
|
||||
}
|
||||
|
||||
export class Configuration {
|
||||
apiKeys?: {[ key: string ]: string};
|
||||
username?: string;
|
||||
password?: string;
|
||||
accessToken?: string | (() => string);
|
||||
basePath?: string;
|
||||
withCredentials?: boolean;
|
||||
encoder?: HttpParameterCodec;
|
||||
|
||||
constructor(configurationParameters: ConfigurationParameters = {}) {
|
||||
this.apiKeys = configurationParameters.apiKeys;
|
||||
this.username = configurationParameters.username;
|
||||
this.password = configurationParameters.password;
|
||||
this.accessToken = configurationParameters.accessToken;
|
||||
this.basePath = configurationParameters.basePath;
|
||||
this.withCredentials = configurationParameters.withCredentials;
|
||||
this.encoder = configurationParameters.encoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the correct content-type to use for a request.
|
||||
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
|
||||
* If no content type is found return the first found type if the contentTypes is not empty
|
||||
* @param contentTypes - the array of content types that are available for selection
|
||||
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
||||
*/
|
||||
public selectHeaderContentType (contentTypes: string[]): string | undefined {
|
||||
if (contentTypes.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const type = contentTypes.find((x: string) => this.isJsonMime(x));
|
||||
if (type === undefined) {
|
||||
return contentTypes[0];
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the correct accept content-type to use for a request.
|
||||
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
|
||||
* If no content type is found return the first found type if the contentTypes is not empty
|
||||
* @param accepts - the array of content types that are available for selection.
|
||||
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
||||
*/
|
||||
public selectHeaderAccept(accepts: string[]): string | undefined {
|
||||
if (accepts.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const type = accepts.find((x: string) => this.isJsonMime(x));
|
||||
if (type === undefined) {
|
||||
return accepts[0];
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
||||
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
||||
}
|
||||
}
|
21
kibicara-frontend/src/app/api/encoder.ts
Normal file
21
kibicara-frontend/src/app/api/encoder.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { HttpParameterCodec } from '@angular/common/http';
|
||||
|
||||
/**
|
||||
* Custom HttpParameterCodec
|
||||
* Workaround for https://github.com/angular/angular/issues/18261
|
||||
*/
|
||||
export class CustomHttpParameterCodec implements HttpParameterCodec {
|
||||
encodeKey(k: string): string {
|
||||
return encodeURIComponent(k);
|
||||
}
|
||||
encodeValue(v: string): string {
|
||||
return encodeURIComponent(v);
|
||||
}
|
||||
decodeKey(k: string): string {
|
||||
return decodeURIComponent(k);
|
||||
}
|
||||
decodeValue(v: string): string {
|
||||
return decodeURIComponent(v);
|
||||
}
|
||||
}
|
||||
|
58
kibicara-frontend/src/app/api/git_push.sh
Normal file
58
kibicara-frontend/src/app/api/git_push.sh
Normal file
|
@ -0,0 +1,58 @@
|
|||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
git_host=$4
|
||||
|
||||
if [ "$git_host" = "" ]; then
|
||||
git_host="github.com"
|
||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||
fi
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=`git remote`
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
|
5
kibicara-frontend/src/app/api/index.ts
Normal file
5
kibicara-frontend/src/app/api/index.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
export * from './api/api';
|
||||
export * from './model/models';
|
||||
export * from './variables';
|
||||
export * from './configuration';
|
||||
export * from './api.module';
|
18
kibicara-frontend/src/app/api/model/bodyAccessToken.ts
Normal file
18
kibicara-frontend/src/app/api/model/bodyAccessToken.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* 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 BodyAccessToken {
|
||||
access_token: string;
|
||||
token_type?: string;
|
||||
}
|
||||
|
18
kibicara-frontend/src/app/api/model/bodyAdmin.ts
Normal file
18
kibicara-frontend/src/app/api/model/bodyAdmin.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* 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 BodyAdmin {
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* 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 BodyAdminLoginApiAdminLoginPost {
|
||||
grant_type?: string;
|
||||
username: string;
|
||||
password: string;
|
||||
scope?: string;
|
||||
client_id?: string;
|
||||
client_secret?: string;
|
||||
}
|
||||
|
17
kibicara-frontend/src/app/api/model/bodyBadWord.ts
Normal file
17
kibicara-frontend/src/app/api/model/bodyBadWord.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* 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 BodyBadWord {
|
||||
pattern: string;
|
||||
}
|
||||
|
17
kibicara-frontend/src/app/api/model/bodyEmail.ts
Normal file
17
kibicara-frontend/src/app/api/model/bodyEmail.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* 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 BodyEmail {
|
||||
name: string;
|
||||
}
|
||||
|
18
kibicara-frontend/src/app/api/model/bodyHood.ts
Normal file
18
kibicara-frontend/src/app/api/model/bodyHood.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* 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 BodyHood {
|
||||
name: string;
|
||||
landingpage?: string;
|
||||
}
|
||||
|
20
kibicara-frontend/src/app/api/model/bodySubscriber.ts
Normal file
20
kibicara-frontend/src/app/api/model/bodySubscriber.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* This model holds the email address of a fresh subscriber.
|
||||
*/
|
||||
export interface BodySubscriber {
|
||||
email: string;
|
||||
}
|
||||
|
18
kibicara-frontend/src/app/api/model/bodyTelegram.ts
Normal file
18
kibicara-frontend/src/app/api/model/bodyTelegram.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* 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 BodyTelegram {
|
||||
api_token: string;
|
||||
welcome_message?: string;
|
||||
}
|
||||
|
17
kibicara-frontend/src/app/api/model/bodyTrigger.ts
Normal file
17
kibicara-frontend/src/app/api/model/bodyTrigger.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* 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 BodyTrigger {
|
||||
pattern: string;
|
||||
}
|
||||
|
18
kibicara-frontend/src/app/api/model/hTTPValidationError.ts
Normal file
18
kibicara-frontend/src/app/api/model/hTTPValidationError.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
import { ValidationError } from './validationError';
|
||||
|
||||
|
||||
export interface HTTPValidationError {
|
||||
detail?: Array<ValidationError>;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* This model shows which values are supplied by the MDA listener script.
|
||||
*/
|
||||
export interface KibicaraPlatformsEmailWebapiBodyMessage {
|
||||
text: string;
|
||||
secret: string;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* 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 KibicaraPlatformsTestWebapiBodyMessage {
|
||||
text: string;
|
||||
}
|
||||
|
13
kibicara-frontend/src/app/api/model/models.ts
Normal file
13
kibicara-frontend/src/app/api/model/models.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
export * from './bodyAccessToken';
|
||||
export * from './bodyAdmin';
|
||||
export * from './bodyAdminLoginApiAdminLoginPost';
|
||||
export * from './bodyBadWord';
|
||||
export * from './bodyEmail';
|
||||
export * from './bodyHood';
|
||||
export * from './bodySubscriber';
|
||||
export * from './bodyTelegram';
|
||||
export * from './bodyTrigger';
|
||||
export * from './hTTPValidationError';
|
||||
export * from './kibicaraPlatformsEmailWebapiBodyMessage';
|
||||
export * from './kibicaraPlatformsTestWebapiBodyMessage';
|
||||
export * from './validationError';
|
19
kibicara-frontend/src/app/api/model/validationError.ts
Normal file
19
kibicara-frontend/src/app/api/model/validationError.ts
Normal 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 ValidationError {
|
||||
loc: Array<string>;
|
||||
msg: string;
|
||||
type: string;
|
||||
}
|
||||
|
9
kibicara-frontend/src/app/api/variables.ts
Normal file
9
kibicara-frontend/src/app/api/variables.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { InjectionToken } from '@angular/core';
|
||||
|
||||
export const BASE_PATH = new InjectionToken<string>('basePath');
|
||||
export const COLLECTION_FORMATS = {
|
||||
'csv': ',',
|
||||
'tsv': ' ',
|
||||
'ssv': ' ',
|
||||
'pipes': '|'
|
||||
}
|
|
@ -73,7 +73,7 @@ router = APIRouter()
|
|||
@router.get(
|
||||
'/',
|
||||
# TODO response_model
|
||||
operation_id='get_all',
|
||||
operation_id='get_emails',
|
||||
)
|
||||
async def email_read_all(hood=Depends(get_hood)):
|
||||
return await Email.objects.filter(hood=hood).all()
|
||||
|
@ -83,7 +83,7 @@ async def email_read_all(hood=Depends(get_hood)):
|
|||
'/',
|
||||
status_code=status.HTTP_201_CREATED,
|
||||
# TODO response_model
|
||||
operation_id='create',
|
||||
operation_id='create_email',
|
||||
)
|
||||
async def email_create(values: BodyEmail, response: Response, hood=Depends(get_hood)):
|
||||
""" Create an Email bot. Call this when creating a hood.
|
||||
|
@ -105,7 +105,7 @@ async def email_create(values: BodyEmail, response: Response, hood=Depends(get_h
|
|||
'/status',
|
||||
status_code=status.HTTP_200_OK,
|
||||
# TODO response_model
|
||||
operation_id='status',
|
||||
operation_id='status_email',
|
||||
)
|
||||
async def email_status(hood=Depends(get_hood)):
|
||||
return {'status': spawner.get(hood).status.name}
|
||||
|
@ -115,7 +115,7 @@ async def email_status(hood=Depends(get_hood)):
|
|||
'/start',
|
||||
status_code=status.HTTP_200_OK,
|
||||
# TODO response_model
|
||||
operation_id='start',
|
||||
operation_id='start_email',
|
||||
)
|
||||
async def email_start(hood=Depends(get_hood)):
|
||||
await hood.update(email_enabled=True)
|
||||
|
@ -127,7 +127,7 @@ async def email_start(hood=Depends(get_hood)):
|
|||
'/stop',
|
||||
status_code=status.HTTP_200_OK,
|
||||
# TODO response_model
|
||||
operation_id='stop',
|
||||
operation_id='stop_email',
|
||||
)
|
||||
async def email_stop(hood=Depends(get_hood)):
|
||||
await hood.update(email_enabled=False)
|
||||
|
@ -138,14 +138,14 @@ async def email_stop(hood=Depends(get_hood)):
|
|||
@router.get(
|
||||
'/{email_id}',
|
||||
# TODO response_model
|
||||
operation_id='get',
|
||||
operation_id='get_email',
|
||||
)
|
||||
async def email_read(email=Depends(get_email)):
|
||||
return email
|
||||
|
||||
|
||||
@router.delete(
|
||||
'/{email_id}', status_code=status.HTTP_204_NO_CONTENT, operation_id='delete'
|
||||
'/{email_id}', status_code=status.HTTP_204_NO_CONTENT, operation_id='delete_email'
|
||||
)
|
||||
async def email_delete(email=Depends(get_email)):
|
||||
""" Delete an Email bot.
|
||||
|
@ -253,7 +253,7 @@ async def subscribers_read_all(hood=Depends(get_hood)):
|
|||
@router.get(
|
||||
'/subscribers/{subscriber_id}',
|
||||
# TODO response_model
|
||||
operation_id='get_subscribers',
|
||||
operation_id='get_subscriber',
|
||||
)
|
||||
async def subscribers_read(subscriber=Depends(get_subscriber)):
|
||||
return subscriber
|
||||
|
@ -263,7 +263,7 @@ async def subscribers_read(subscriber=Depends(get_subscriber)):
|
|||
'/messages/',
|
||||
status_code=status.HTTP_201_CREATED,
|
||||
# TODO response_model
|
||||
operation_id='create_email',
|
||||
operation_id='send_message',
|
||||
)
|
||||
async def email_message_create(
|
||||
message: BodyMessage, hood=Depends(get_hood_unauthorized)
|
||||
|
|
|
@ -44,7 +44,7 @@ telegram_callback_router = APIRouter()
|
|||
@router.get(
|
||||
'/',
|
||||
# TODO response_model,
|
||||
operation_id='get_all',
|
||||
operation_id='get_telegrams',
|
||||
)
|
||||
async def telegram_read_all(hood=Depends(get_hood)):
|
||||
return await Telegram.objects.filter(hood=hood).all()
|
||||
|
@ -53,14 +53,16 @@ async def telegram_read_all(hood=Depends(get_hood)):
|
|||
@router.get(
|
||||
'/{telegram_id}',
|
||||
# TODO response_model,
|
||||
operation_id='get',
|
||||
operation_id='get_telegram',
|
||||
)
|
||||
async def telegram_read(telegram=Depends(get_telegram)):
|
||||
return telegram
|
||||
|
||||
|
||||
@router.delete(
|
||||
'/{telegram_id}', status_code=status.HTTP_204_NO_CONTENT, operation_id='delete'
|
||||
'/{telegram_id}',
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
operation_id='delete_telegram',
|
||||
)
|
||||
async def telegram_delete(telegram=Depends(get_telegram)):
|
||||
spawner.stop(telegram)
|
||||
|
@ -71,7 +73,7 @@ async def telegram_delete(telegram=Depends(get_telegram)):
|
|||
'/',
|
||||
status_code=status.HTTP_201_CREATED,
|
||||
# TODO response_model,
|
||||
operation_id='create',
|
||||
operation_id='create_telegram',
|
||||
)
|
||||
async def telegram_create(
|
||||
response: Response, values: BodyTelegram, hood=Depends(get_hood)
|
||||
|
@ -89,7 +91,7 @@ async def telegram_create(
|
|||
'/{telegram_id}',
|
||||
status_code=status.HTTP_202_ACCEPTED,
|
||||
# TODO response_model,
|
||||
operation_id='update',
|
||||
operation_id='update_telegram',
|
||||
)
|
||||
async def telegram_update(values: BodyTelegram, telegram=Depends(get_telegram)):
|
||||
try:
|
||||
|
@ -105,7 +107,7 @@ async def telegram_update(values: BodyTelegram, telegram=Depends(get_telegram)):
|
|||
'/{telegram_id}/status',
|
||||
status_code=status.HTTP_200_OK,
|
||||
# TODO response_model,
|
||||
operation_id='status',
|
||||
operation_id='status_telegram',
|
||||
)
|
||||
async def telegram_status(telegram=Depends(get_telegram)):
|
||||
return {'status': spawner.get(telegram).status.name}
|
||||
|
@ -115,7 +117,7 @@ async def telegram_status(telegram=Depends(get_telegram)):
|
|||
'/{telegram_id}/start',
|
||||
status_code=status.HTTP_200_OK,
|
||||
# TODO response_model,
|
||||
operation_id='start',
|
||||
operation_id='start_telegram',
|
||||
)
|
||||
async def telegram_start(telegram=Depends(get_telegram)):
|
||||
await telegram.update(enabled=True)
|
||||
|
@ -127,7 +129,7 @@ async def telegram_start(telegram=Depends(get_telegram)):
|
|||
'/{telegram_id}/stop',
|
||||
status_code=status.HTTP_200_OK,
|
||||
# TODO response_model,
|
||||
operation_id='stop',
|
||||
operation_id='stop_telegram',
|
||||
)
|
||||
async def telegram_stop(telegram=Depends(get_telegram)):
|
||||
await telegram.update(enabled=False)
|
||||
|
|
|
@ -31,7 +31,7 @@ twitter_callback_router = APIRouter()
|
|||
@router.get(
|
||||
'/',
|
||||
# TODO response_model,
|
||||
operation_id='get_all',
|
||||
operation_id='get_twitters',
|
||||
)
|
||||
async def twitter_read_all(hood=Depends(get_hood)):
|
||||
return await Twitter.objects.filter(hood=hood).all()
|
||||
|
@ -40,7 +40,7 @@ async def twitter_read_all(hood=Depends(get_hood)):
|
|||
@router.get(
|
||||
'/{twitter_id}',
|
||||
# TODO response_model
|
||||
operation_id='get',
|
||||
operation_id='get_twitter',
|
||||
)
|
||||
async def twitter_read(twitter=Depends(get_twitter)):
|
||||
return twitter
|
||||
|
@ -50,7 +50,7 @@ async def twitter_read(twitter=Depends(get_twitter)):
|
|||
'/{twitter_id}',
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
# TODO response_model
|
||||
operation_id='delete',
|
||||
operation_id='delete_twitter',
|
||||
)
|
||||
async def twitter_delete(twitter=Depends(get_twitter)):
|
||||
spawner.stop(twitter)
|
||||
|
@ -61,7 +61,7 @@ async def twitter_delete(twitter=Depends(get_twitter)):
|
|||
'/{twitter_id}/status',
|
||||
status_code=status.HTTP_200_OK,
|
||||
# TODO response_model
|
||||
operation_id='status',
|
||||
operation_id='status_twitter',
|
||||
)
|
||||
async def twitter_status(twitter=Depends(get_twitter)):
|
||||
return {'status': spawner.get(twitter).status.name}
|
||||
|
@ -71,7 +71,7 @@ async def twitter_status(twitter=Depends(get_twitter)):
|
|||
'/{twitter_id}/start',
|
||||
status_code=status.HTTP_200_OK,
|
||||
# TODO response_model
|
||||
operation_id='start',
|
||||
operation_id='start_twitter',
|
||||
)
|
||||
async def twitter_start(twitter=Depends(get_twitter)):
|
||||
await twitter.update(enabled=True)
|
||||
|
@ -83,7 +83,7 @@ async def twitter_start(twitter=Depends(get_twitter)):
|
|||
'/{twitter_id}/stop',
|
||||
status_code=status.HTTP_200_OK,
|
||||
# TODO response_model
|
||||
operation_id='stop',
|
||||
operation_id='stop_twitter',
|
||||
)
|
||||
async def twitter_stop(twitter=Depends(get_twitter)):
|
||||
await twitter.update(enabled=False)
|
||||
|
@ -95,7 +95,7 @@ async def twitter_stop(twitter=Depends(get_twitter)):
|
|||
'/',
|
||||
status_code=status.HTTP_201_CREATED,
|
||||
# TODO response_model
|
||||
operation_id='create',
|
||||
operation_id='create_twitter',
|
||||
)
|
||||
async def twitter_create(response: Response, hood=Depends(get_hood)):
|
||||
"""
|
||||
|
@ -125,7 +125,7 @@ async def twitter_create(response: Response, hood=Depends(get_hood)):
|
|||
@twitter_callback_router.get(
|
||||
'/callback',
|
||||
# TODO response_model
|
||||
operation_id='callback',
|
||||
operation_id='callback_twitter',
|
||||
)
|
||||
async def twitter_read_callback(oauth_token: str, oauth_verifier: str):
|
||||
try:
|
||||
|
|
|
@ -23,8 +23,12 @@ from kibicara.webapi.hoods.triggers import router as triggers_router
|
|||
|
||||
router = APIRouter()
|
||||
router.include_router(admin_router, prefix='/admin', tags=['admin'])
|
||||
hoods_router.include_router(triggers_router, prefix='/{hood_id}/triggers')
|
||||
hoods_router.include_router(badwords_router, prefix='/{hood_id}/badwords')
|
||||
hoods_router.include_router(
|
||||
triggers_router, prefix='/{hood_id}/triggers', tags=['triggers']
|
||||
)
|
||||
hoods_router.include_router(
|
||||
badwords_router, prefix='/{hood_id}/badwords', tags=['badwords']
|
||||
)
|
||||
hoods_router.include_router(test_router, prefix='/{hood_id}/test', tags=['test'])
|
||||
hoods_router.include_router(
|
||||
telegram_router, prefix='/{hood_id}/telegram', tags=['telegram']
|
||||
|
@ -34,4 +38,4 @@ hoods_router.include_router(
|
|||
)
|
||||
router.include_router(twitter_callback_router, prefix='/twitter', tags=['twitter'])
|
||||
hoods_router.include_router(email_router, prefix='/{hood_id}/email', tags=['email'])
|
||||
router.include_router(hoods_router, prefix='/hoods', tags=['hoods'])
|
||||
router.include_router(hoods_router, prefix='/hoods')
|
||||
|
|
|
@ -150,7 +150,7 @@ async def admin_login(form_data: OAuth2PasswordRequestForm = Depends()):
|
|||
@router.get(
|
||||
'/hoods/',
|
||||
# TODO response_model,
|
||||
operation_id='get_hoods',
|
||||
operation_id='get_hoods_admin',
|
||||
)
|
||||
async def admin_hood_read_all(admin=Depends(get_admin)):
|
||||
""" Get a list of all hoods of a given admin. """
|
||||
|
|
|
@ -46,7 +46,8 @@ router = APIRouter()
|
|||
@router.get(
|
||||
'/',
|
||||
# TODO response_model,
|
||||
operation_id='get_all',
|
||||
operation_id='get_hoods',
|
||||
tags=['hoods'],
|
||||
)
|
||||
async def hood_read_all():
|
||||
""" Get all existing hoods. """
|
||||
|
@ -58,6 +59,7 @@ async def hood_read_all():
|
|||
status_code=status.HTTP_201_CREATED,
|
||||
# TODO response_model,
|
||||
operation_id='create_hood',
|
||||
tags=['hoods'],
|
||||
)
|
||||
async def hood_create(values: BodyHood, response: Response, admin=Depends(get_admin)):
|
||||
""" Creates a hood.
|
||||
|
@ -79,6 +81,7 @@ async def hood_create(values: BodyHood, response: Response, admin=Depends(get_ad
|
|||
'/{hood_id}',
|
||||
# TODO response_model,
|
||||
operation_id='get_hood',
|
||||
tags=['hoods'],
|
||||
)
|
||||
async def hood_read(hood=Depends(get_hood)):
|
||||
""" Get hood with id **hood_id**. """
|
||||
|
@ -86,7 +89,10 @@ async def hood_read(hood=Depends(get_hood)):
|
|||
|
||||
|
||||
@router.put(
|
||||
'/{hood_id}', status_code=status.HTTP_204_NO_CONTENT, operation_id='update_hood',
|
||||
'/{hood_id}',
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
operation_id='update_hood',
|
||||
tags=['hoods'],
|
||||
)
|
||||
async def hood_update(values: BodyHood, hood=Depends(get_hood)):
|
||||
""" Updates hood with id **hood_id**.
|
||||
|
@ -98,7 +104,10 @@ async def hood_update(values: BodyHood, hood=Depends(get_hood)):
|
|||
|
||||
|
||||
@router.delete(
|
||||
'/{hood_id}', status_code=status.HTTP_204_NO_CONTENT, operation_id='update_hood',
|
||||
'/{hood_id}',
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
operation_id='delete_hood',
|
||||
tags=['hoods'],
|
||||
)
|
||||
async def hood_delete(hood=Depends(get_hood)):
|
||||
""" Deletes hood with id **hood_id**. """
|
||||
|
|
Loading…
Reference in a new issue