From 49867798f412a1798b2c2a1cb01c987ca524c59d Mon Sep 17 00:00:00 2001 From: carteronm Date: Tue, 5 May 2026 10:58:22 +0200 Subject: [PATCH] openapi fin --- package.json | 2 +- src/app/services/api/.gitignore | 4 + .../services/api/.openapi-generator-ignore | 23 + src/app/services/api/.openapi-generator/FILES | 43 ++ .../services/api/.openapi-generator/VERSION | 1 + src/app/services/api/README.md | 185 +++++ src/app/services/api/api.base.service.ts | 96 +++ src/app/services/api/api.module.ts | 30 + src/app/services/api/api/api.ts | 13 + .../services/api/api/discussions.service.ts | 238 ++++++ src/app/services/api/api/groups.service.ts | 483 ++++++++++++ src/app/services/api/api/keys.service.ts | 252 +++++++ src/app/services/api/api/messages.service.ts | 277 +++++++ src/app/services/api/api/roles.service.ts | 227 ++++++ src/app/services/api/api/users.service.ts | 692 ++++++++++++++++++ src/app/services/api/configuration.ts | 194 +++++ src/app/services/api/encoder.ts | 35 + src/app/services/api/git_push.sh | 57 ++ src/app/services/api/index.ts | 7 + .../model/fast-endpoints-error-response.ts | 29 + ...ts-dto-discussion-create-discussion-dto.ts | 15 + ...ts-dto-discussion-delete-discussion-dto.ts | 15 + .../model/knots-dto-group-create-group-dto.ts | 17 + .../model/knots-dto-group-delete-group-dto.ts | 15 + ...o-group-update-group-members-amount-dto.ts | 15 + .../knots-dto-group-update-group-name-dto.ts | 15 + ...-group-update-group-profile-picture-dto.ts | 15 + .../api/model/knots-dto-key-create-key-dto.ts | 15 + .../api/model/knots-dto-key-delete-key-dto.ts | 15 + .../knots-dto-message-create-message-dto.ts | 17 + .../knots-dto-message-delete-message-dto.ts | 15 + .../model/knots-dto-role-create-role-dto.ts | 15 + .../model/knots-dto-role-delete-role-dto.ts | 15 + .../model/knots-dto-user-create-user-dto.ts | 20 + .../model/knots-dto-user-delete-user-dto.ts | 15 + .../api/model/knots-dto-user-get-user-dto.ts | 15 + .../knots-dto-user-update-user-contact-dto.ts | 16 + ...ts-dto-user-update-user-description-dto.ts | 16 + ...knots-dto-user-update-user-password-dto.ts | 15 + ...to-user-update-user-profile-picture-dto.ts | 16 + .../knots-dto-user-update-username-dto.ts | 16 + src/app/services/api/model/models.ts | 22 + src/app/services/api/param.ts | 69 ++ src/app/services/api/provide-api.ts | 15 + src/app/services/api/query.params.ts | 160 ++++ src/app/services/api/variables.ts | 9 + 46 files changed, 3490 insertions(+), 1 deletion(-) create mode 100644 src/app/services/api/.gitignore create mode 100644 src/app/services/api/.openapi-generator-ignore create mode 100644 src/app/services/api/.openapi-generator/FILES create mode 100644 src/app/services/api/.openapi-generator/VERSION create mode 100644 src/app/services/api/README.md create mode 100644 src/app/services/api/api.base.service.ts create mode 100644 src/app/services/api/api.module.ts create mode 100644 src/app/services/api/api/api.ts create mode 100644 src/app/services/api/api/discussions.service.ts create mode 100644 src/app/services/api/api/groups.service.ts create mode 100644 src/app/services/api/api/keys.service.ts create mode 100644 src/app/services/api/api/messages.service.ts create mode 100644 src/app/services/api/api/roles.service.ts create mode 100644 src/app/services/api/api/users.service.ts create mode 100644 src/app/services/api/configuration.ts create mode 100644 src/app/services/api/encoder.ts create mode 100644 src/app/services/api/git_push.sh create mode 100644 src/app/services/api/index.ts create mode 100644 src/app/services/api/model/fast-endpoints-error-response.ts create mode 100644 src/app/services/api/model/knots-dto-discussion-create-discussion-dto.ts create mode 100644 src/app/services/api/model/knots-dto-discussion-delete-discussion-dto.ts create mode 100644 src/app/services/api/model/knots-dto-group-create-group-dto.ts create mode 100644 src/app/services/api/model/knots-dto-group-delete-group-dto.ts create mode 100644 src/app/services/api/model/knots-dto-group-update-group-members-amount-dto.ts create mode 100644 src/app/services/api/model/knots-dto-group-update-group-name-dto.ts create mode 100644 src/app/services/api/model/knots-dto-group-update-group-profile-picture-dto.ts create mode 100644 src/app/services/api/model/knots-dto-key-create-key-dto.ts create mode 100644 src/app/services/api/model/knots-dto-key-delete-key-dto.ts create mode 100644 src/app/services/api/model/knots-dto-message-create-message-dto.ts create mode 100644 src/app/services/api/model/knots-dto-message-delete-message-dto.ts create mode 100644 src/app/services/api/model/knots-dto-role-create-role-dto.ts create mode 100644 src/app/services/api/model/knots-dto-role-delete-role-dto.ts create mode 100644 src/app/services/api/model/knots-dto-user-create-user-dto.ts create mode 100644 src/app/services/api/model/knots-dto-user-delete-user-dto.ts create mode 100644 src/app/services/api/model/knots-dto-user-get-user-dto.ts create mode 100644 src/app/services/api/model/knots-dto-user-update-user-contact-dto.ts create mode 100644 src/app/services/api/model/knots-dto-user-update-user-description-dto.ts create mode 100644 src/app/services/api/model/knots-dto-user-update-user-password-dto.ts create mode 100644 src/app/services/api/model/knots-dto-user-update-user-profile-picture-dto.ts create mode 100644 src/app/services/api/model/knots-dto-user-update-username-dto.ts create mode 100644 src/app/services/api/model/models.ts create mode 100644 src/app/services/api/param.ts create mode 100644 src/app/services/api/provide-api.ts create mode 100644 src/app/services/api/query.params.ts create mode 100644 src/app/services/api/variables.ts diff --git a/package.json b/package.json index d0eb14e..f4defc0 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "start": "ng serve", "build": "ng build", "watch": "ng build --watch --configuration development", - "openapi": "rm -rf src/app/services/api && openapi-generator-cli generate -i http://localhost:4200/swagger/v1/swagger.json -g typescript-angular -o src/app/services/api -c openapi-generator.yaml" + "openapi": "rm -rf src/app/services/api && openapi-generator-cli generate -i http://localhost:5250/swagger/v1/swagger.json -g typescript-angular -o src/app/services/api -c openapi-generator.yaml" }, "private": true, "dependencies": { diff --git a/src/app/services/api/.gitignore b/src/app/services/api/.gitignore new file mode 100644 index 0000000..149b576 --- /dev/null +++ b/src/app/services/api/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/src/app/services/api/.openapi-generator-ignore b/src/app/services/api/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/src/app/services/api/.openapi-generator-ignore @@ -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 diff --git a/src/app/services/api/.openapi-generator/FILES b/src/app/services/api/.openapi-generator/FILES new file mode 100644 index 0000000..baa058f --- /dev/null +++ b/src/app/services/api/.openapi-generator/FILES @@ -0,0 +1,43 @@ +.gitignore +.openapi-generator-ignore +README.md +api.base.service.ts +api.module.ts +api/api.ts +api/discussions.service.ts +api/groups.service.ts +api/keys.service.ts +api/messages.service.ts +api/roles.service.ts +api/users.service.ts +configuration.ts +encoder.ts +git_push.sh +index.ts +model/fast-endpoints-error-response.ts +model/knots-dto-discussion-create-discussion-dto.ts +model/knots-dto-discussion-delete-discussion-dto.ts +model/knots-dto-group-create-group-dto.ts +model/knots-dto-group-delete-group-dto.ts +model/knots-dto-group-update-group-members-amount-dto.ts +model/knots-dto-group-update-group-name-dto.ts +model/knots-dto-group-update-group-profile-picture-dto.ts +model/knots-dto-key-create-key-dto.ts +model/knots-dto-key-delete-key-dto.ts +model/knots-dto-message-create-message-dto.ts +model/knots-dto-message-delete-message-dto.ts +model/knots-dto-role-create-role-dto.ts +model/knots-dto-role-delete-role-dto.ts +model/knots-dto-user-create-user-dto.ts +model/knots-dto-user-delete-user-dto.ts +model/knots-dto-user-get-user-dto.ts +model/knots-dto-user-update-user-contact-dto.ts +model/knots-dto-user-update-user-description-dto.ts +model/knots-dto-user-update-user-password-dto.ts +model/knots-dto-user-update-user-profile-picture-dto.ts +model/knots-dto-user-update-username-dto.ts +model/models.ts +param.ts +provide-api.ts +query.params.ts +variables.ts diff --git a/src/app/services/api/.openapi-generator/VERSION b/src/app/services/api/.openapi-generator/VERSION new file mode 100644 index 0000000..696eaac --- /dev/null +++ b/src/app/services/api/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.22.0 diff --git a/src/app/services/api/README.md b/src/app/services/api/README.md new file mode 100644 index 0000000..c2ba935 --- /dev/null +++ b/src/app/services/api/README.md @@ -0,0 +1,185 @@ +# @ + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +The version of the OpenAPI document: 1.0.0 + +## Building + +To install the required dependencies and to build the typescript sources run: + +```console +npm install +npm run build +``` + +## Publishing + +First build the package then run `npm publish dist` (don't forget to specify the `dist` folder!) + +## Consuming + +Navigate to the folder of your consuming project and run one of next commands. + +_published:_ + +```console +npm install @ --save +``` + +_without publishing (not recommended):_ + +```console +npm install PATH_TO_GENERATED_PACKAGE/dist.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/dist: + +```console +npm link +``` + +In your project: + +```console +npm link +``` + +__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages. +Please refer to this issue for a solution / workaround. +Published packages are not effected by this issue. + +### General usage + +In your Angular project: + +```typescript + +import { ApplicationConfig } from '@angular/core'; +import { provideHttpClient } from '@angular/common/http'; +import { provideApi } from ''; + +export const appConfig: ApplicationConfig = { + providers: [ + // ... + provideHttpClient(), + provideApi() + ], +}; +``` + +**NOTE** +If you're still using `AppModule` and haven't [migrated](https://angular.dev/reference/migrations/standalone) yet, you can still import an Angular module: +```typescript +import { ApiModule } from ''; +``` + +If different from the generated base path, during app bootstrap, you can provide the base path to your service. + +```typescript +import { ApplicationConfig } from '@angular/core'; +import { provideHttpClient } from '@angular/common/http'; +import { provideApi } from ''; + +export const appConfig: ApplicationConfig = { + providers: [ + // ... + provideHttpClient(), + provideApi('http://localhost:9999') + ], +}; +``` + +```typescript +// with a custom configuration +import { ApplicationConfig } from '@angular/core'; +import { provideHttpClient } from '@angular/common/http'; +import { provideApi } from ''; + +export const appConfig: ApplicationConfig = { + providers: [ + // ... + provideHttpClient(), + provideApi({ + withCredentials: true, + username: 'user', + password: 'password' + }) + ], +}; +``` + +```typescript +// with factory building a custom configuration +import { ApplicationConfig } from '@angular/core'; +import { provideHttpClient } from '@angular/common/http'; +import { provideApi, Configuration } from ''; + +export const appConfig: ApplicationConfig = { + providers: [ + // ... + provideHttpClient(), + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration({ + basePath: 'http://localhost:9999', + withCredentials: true, + username: authService.getUsername(), + password: authService.getPassword(), + }), + deps: [AuthService], + multi: false + } + ], +}; +``` + +### Using multiple OpenAPI files / APIs + +In order to use multiple APIs generated from different OpenAPI files, +you can create an alias name when importing the modules +in order to avoid naming conflicts: + +```typescript +import { provideApi as provideUserApi } from 'my-user-api-path'; +import { provideApi as provideAdminApi } from 'my-admin-api-path'; +import { HttpClientModule } from '@angular/common/http'; +import { environment } from '../environments/environment'; + +export const appConfig: ApplicationConfig = { + providers: [ + // ... + provideHttpClient(), + provideUserApi(environment.basePath), + provideAdminApi(environment.basePath), + ], +}; +``` + +### Customizing path parameter encoding + +Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple' +and Dates for format 'date-time' are encoded correctly. + +Other styles (e.g. "matrix") are not that easy to encode +and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]). + +To implement your own parameter encoding (or call another library), +pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object +(see [General Usage](#general-usage) above). + +Example value for use in your Configuration-Provider: + +```typescript +new Configuration({ + encodeParam: (param: Param) => myFancyParamEncoder(param), +}) +``` + +[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations +[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values +[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander diff --git a/src/app/services/api/api.base.service.ts b/src/app/services/api/api.base.service.ts new file mode 100644 index 0000000..8f82a78 --- /dev/null +++ b/src/app/services/api/api.base.service.ts @@ -0,0 +1,96 @@ +/** + * Knots + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { CustomHttpParameterCodec } from './encoder'; +import { Configuration } from './configuration'; +import { OpenApiHttpParams, QueryParamStyle, concatHttpParamsObject} from './query.params'; + +export class BaseService { + protected basePath = 'http://localhost:5250'; + public defaultHeaders = new HttpHeaders(); + public configuration: Configuration; + public encoder: HttpParameterCodec; + + constructor(basePath?: string|string[], configuration?: Configuration) { + this.configuration = configuration || new Configuration(); + if (typeof this.configuration.basePath !== 'string') { + const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined; + if (firstBasePath != undefined) { + basePath = firstBasePath; + } + + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; + } + this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); + } + + protected canConsumeForm(consumes: string[]): boolean { + return consumes.indexOf('multipart/form-data') !== -1; + } + + protected addToHttpParams(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined, paramStyle: QueryParamStyle, explode: boolean): OpenApiHttpParams { + if (value === null || value === undefined) { + return httpParams; + } + + if (paramStyle === QueryParamStyle.DeepObject) { + if (typeof value !== 'object') { + throw Error(`An object must be provided for key ${key} as it is a deep object`); + } + + return Object.keys(value as Record).reduce( + (hp, k) => hp.append(`${key}[${k}]`, value[k]), + httpParams, + ); + } else if (paramStyle === QueryParamStyle.Json) { + return httpParams.append(key, JSON.stringify(value)); + } else { + // Form-style, SpaceDelimited or PipeDelimited + + if (Object(value) !== value) { + // If it is a primitive type, add its string representation + return httpParams.append(key, value.toString()); + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Array.isArray(value) || value instanceof Set) { + // Otherwise, if it's an array or set, add each element. + const array = Array.isArray(value) ? value : Array.from(value); + if (paramStyle === QueryParamStyle.Form) { + return httpParams.set(key, array, {explode: explode, delimiter: ','}); + } else if (paramStyle === QueryParamStyle.SpaceDelimited) { + return httpParams.set(key, array, {explode: explode, delimiter: ' '}); + } else { + // PipeDelimited + return httpParams.set(key, array, {explode: explode, delimiter: '|'}); + } + } else { + // Otherwise, if it's an object, add each field. + if (paramStyle === QueryParamStyle.Form) { + if (explode) { + Object.keys(value).forEach(k => { + httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + }); + return httpParams; + } else { + return concatHttpParamsObject(httpParams, key, value, ','); + } + } else if (paramStyle === QueryParamStyle.SpaceDelimited) { + return concatHttpParamsObject(httpParams, key, value, ' '); + } else { + // PipeDelimited + return concatHttpParamsObject(httpParams, key, value, '|'); + } + } + } + } +} diff --git a/src/app/services/api/api.module.ts b/src/app/services/api/api.module.ts new file mode 100644 index 0000000..58d341f --- /dev/null +++ b/src/app/services/api/api.module.ts @@ -0,0 +1,30 @@ +import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; +import { Configuration } from './configuration'; +import { HttpClient } from '@angular/common/http'; + + +@NgModule({ + imports: [], + declarations: [], + exports: [], + providers: [] +}) +export class ApiModule { + public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders { + 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'); + } + } +} diff --git a/src/app/services/api/api/api.ts b/src/app/services/api/api/api.ts new file mode 100644 index 0000000..69db23b --- /dev/null +++ b/src/app/services/api/api/api.ts @@ -0,0 +1,13 @@ +export * from './discussions.service'; +import { DiscussionsService } from './discussions.service'; +export * from './groups.service'; +import { GroupsService } from './groups.service'; +export * from './keys.service'; +import { KeysService } from './keys.service'; +export * from './messages.service'; +import { MessagesService } from './messages.service'; +export * from './roles.service'; +import { RolesService } from './roles.service'; +export * from './users.service'; +import { UsersService } from './users.service'; +export const APIS = [DiscussionsService, GroupsService, KeysService, MessagesService, RolesService, UsersService]; diff --git a/src/app/services/api/api/discussions.service.ts b/src/app/services/api/api/discussions.service.ts new file mode 100644 index 0000000..45e4bac --- /dev/null +++ b/src/app/services/api/api/discussions.service.ts @@ -0,0 +1,238 @@ +/** + * Knots + * + * + * + * 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, HttpContext + } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { OpenApiHttpParams, QueryParamStyle } from '../query.params'; + +// @ts-ignore +import { FastEndpointsErrorResponse } from '../model/fast-endpoints-error-response'; +// @ts-ignore +import { KnotsDTODiscussionCreateDiscussionDto } from '../model/knots-dto-discussion-create-discussion-dto'; +// @ts-ignore +import { KnotsDTODiscussionDeleteDiscussionDto } from '../model/knots-dto-discussion-delete-discussion-dto'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + + + +@Injectable({ + providedIn: 'root' +}) +export class DiscussionsService extends BaseService { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * @endpoint post /API/discussions + * @param knotsDTODiscussionCreateDiscussionDto + * @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. + * @param options additional options + */ + public createDiscussionEndpoint(knotsDTODiscussionCreateDiscussionDto: KnotsDTODiscussionCreateDiscussionDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public createDiscussionEndpoint(knotsDTODiscussionCreateDiscussionDto: KnotsDTODiscussionCreateDiscussionDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createDiscussionEndpoint(knotsDTODiscussionCreateDiscussionDto: KnotsDTODiscussionCreateDiscussionDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createDiscussionEndpoint(knotsDTODiscussionCreateDiscussionDto: KnotsDTODiscussionCreateDiscussionDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (knotsDTODiscussionCreateDiscussionDto === null || knotsDTODiscussionCreateDiscussionDto === undefined) { + throw new Error('Required parameter knotsDTODiscussionCreateDiscussionDto was null or undefined when calling createDiscussionEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/discussions`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTODiscussionCreateDiscussionDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint delete /API/discussions + * @param knotsDTODiscussionDeleteDiscussionDto + * @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. + * @param options additional options + */ + public deleteDiscussionEndpoint(knotsDTODiscussionDeleteDiscussionDto: KnotsDTODiscussionDeleteDiscussionDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public deleteDiscussionEndpoint(knotsDTODiscussionDeleteDiscussionDto: KnotsDTODiscussionDeleteDiscussionDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteDiscussionEndpoint(knotsDTODiscussionDeleteDiscussionDto: KnotsDTODiscussionDeleteDiscussionDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteDiscussionEndpoint(knotsDTODiscussionDeleteDiscussionDto: KnotsDTODiscussionDeleteDiscussionDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (knotsDTODiscussionDeleteDiscussionDto === null || knotsDTODiscussionDeleteDiscussionDto === undefined) { + throw new Error('Required parameter knotsDTODiscussionDeleteDiscussionDto was null or undefined when calling deleteDiscussionEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/discussions`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTODiscussionDeleteDiscussionDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint get /API/discussions + * @param id + * @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. + * @param options additional options + */ + public getDiscussionEndpoint(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable; + public getDiscussionEndpoint(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public getDiscussionEndpoint(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public getDiscussionEndpoint(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getDiscussionEndpoint.'); + } + + let localVarQueryParameters = new OpenApiHttpParams(this.encoder); + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'Id', + id, + QueryParamStyle.Form, + true, + ); + + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/discussions`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters.toHttpParams(), + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/src/app/services/api/api/groups.service.ts b/src/app/services/api/api/groups.service.ts new file mode 100644 index 0000000..e088e27 --- /dev/null +++ b/src/app/services/api/api/groups.service.ts @@ -0,0 +1,483 @@ +/** + * Knots + * + * + * + * 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, HttpContext + } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { OpenApiHttpParams, QueryParamStyle } from '../query.params'; + +// @ts-ignore +import { FastEndpointsErrorResponse } from '../model/fast-endpoints-error-response'; +// @ts-ignore +import { KnotsDTOGroupCreateGroupDto } from '../model/knots-dto-group-create-group-dto'; +// @ts-ignore +import { KnotsDTOGroupDeleteGroupDto } from '../model/knots-dto-group-delete-group-dto'; +// @ts-ignore +import { KnotsDTOGroupUpdateGroupMembersAmountDto } from '../model/knots-dto-group-update-group-members-amount-dto'; +// @ts-ignore +import { KnotsDTOGroupUpdateGroupNameDto } from '../model/knots-dto-group-update-group-name-dto'; +// @ts-ignore +import { KnotsDTOGroupUpdateGroupProfilePictureDto } from '../model/knots-dto-group-update-group-profile-picture-dto'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + + + +@Injectable({ + providedIn: 'root' +}) +export class GroupsService extends BaseService { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * @endpoint post /API/groups + * @param knotsDTOGroupCreateGroupDto + * @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. + * @param options additional options + */ + public createGroupEndpoint(knotsDTOGroupCreateGroupDto: KnotsDTOGroupCreateGroupDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public createGroupEndpoint(knotsDTOGroupCreateGroupDto: KnotsDTOGroupCreateGroupDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createGroupEndpoint(knotsDTOGroupCreateGroupDto: KnotsDTOGroupCreateGroupDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createGroupEndpoint(knotsDTOGroupCreateGroupDto: KnotsDTOGroupCreateGroupDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (knotsDTOGroupCreateGroupDto === null || knotsDTOGroupCreateGroupDto === undefined) { + throw new Error('Required parameter knotsDTOGroupCreateGroupDto was null or undefined when calling createGroupEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/groups`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOGroupCreateGroupDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint delete /API/groups + * @param knotsDTOGroupDeleteGroupDto + * @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. + * @param options additional options + */ + public deleteGroupEndpoint(knotsDTOGroupDeleteGroupDto: KnotsDTOGroupDeleteGroupDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public deleteGroupEndpoint(knotsDTOGroupDeleteGroupDto: KnotsDTOGroupDeleteGroupDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteGroupEndpoint(knotsDTOGroupDeleteGroupDto: KnotsDTOGroupDeleteGroupDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteGroupEndpoint(knotsDTOGroupDeleteGroupDto: KnotsDTOGroupDeleteGroupDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (knotsDTOGroupDeleteGroupDto === null || knotsDTOGroupDeleteGroupDto === undefined) { + throw new Error('Required parameter knotsDTOGroupDeleteGroupDto was null or undefined when calling deleteGroupEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/groups`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOGroupDeleteGroupDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint get /API/groups + * @param id + * @param nombreMembres + * @param nom + * @param profilePicture + * @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. + * @param options additional options + */ + public getGroupEndpoint(id: number, nombreMembres: number, nom?: string, profilePicture?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable; + public getGroupEndpoint(id: number, nombreMembres: number, nom?: string, profilePicture?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public getGroupEndpoint(id: number, nombreMembres: number, nom?: string, profilePicture?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public getGroupEndpoint(id: number, nombreMembres: number, nom?: string, profilePicture?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getGroupEndpoint.'); + } + if (nombreMembres === null || nombreMembres === undefined) { + throw new Error('Required parameter nombreMembres was null or undefined when calling getGroupEndpoint.'); + } + + let localVarQueryParameters = new OpenApiHttpParams(this.encoder); + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'Id', + id, + QueryParamStyle.Form, + true, + ); + + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'Nom', + nom, + QueryParamStyle.Form, + true, + ); + + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'NombreMembres', + nombreMembres, + QueryParamStyle.Form, + true, + ); + + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'ProfilePicture', + profilePicture, + QueryParamStyle.Form, + true, + ); + + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/groups`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters.toHttpParams(), + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint patch /API/groups/{Id}/membersAmount + * @param id + * @param knotsDTOGroupUpdateGroupMembersAmountDto + * @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. + * @param options additional options + */ + public patchGroupMembersAmountEndpoint(id: number, knotsDTOGroupUpdateGroupMembersAmountDto: KnotsDTOGroupUpdateGroupMembersAmountDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public patchGroupMembersAmountEndpoint(id: number, knotsDTOGroupUpdateGroupMembersAmountDto: KnotsDTOGroupUpdateGroupMembersAmountDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public patchGroupMembersAmountEndpoint(id: number, knotsDTOGroupUpdateGroupMembersAmountDto: KnotsDTOGroupUpdateGroupMembersAmountDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public patchGroupMembersAmountEndpoint(id: number, knotsDTOGroupUpdateGroupMembersAmountDto: KnotsDTOGroupUpdateGroupMembersAmountDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling patchGroupMembersAmountEndpoint.'); + } + if (knotsDTOGroupUpdateGroupMembersAmountDto === null || knotsDTOGroupUpdateGroupMembersAmountDto === undefined) { + throw new Error('Required parameter knotsDTOGroupUpdateGroupMembersAmountDto was null or undefined when calling patchGroupMembersAmountEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/groups/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int32"})}/membersAmount`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('patch', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOGroupUpdateGroupMembersAmountDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint patch /API/groups/{Id}/name + * @param id + * @param knotsDTOGroupUpdateGroupNameDto + * @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. + * @param options additional options + */ + public patchGroupNameEndpoint(id: number, knotsDTOGroupUpdateGroupNameDto: KnotsDTOGroupUpdateGroupNameDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public patchGroupNameEndpoint(id: number, knotsDTOGroupUpdateGroupNameDto: KnotsDTOGroupUpdateGroupNameDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public patchGroupNameEndpoint(id: number, knotsDTOGroupUpdateGroupNameDto: KnotsDTOGroupUpdateGroupNameDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public patchGroupNameEndpoint(id: number, knotsDTOGroupUpdateGroupNameDto: KnotsDTOGroupUpdateGroupNameDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling patchGroupNameEndpoint.'); + } + if (knotsDTOGroupUpdateGroupNameDto === null || knotsDTOGroupUpdateGroupNameDto === undefined) { + throw new Error('Required parameter knotsDTOGroupUpdateGroupNameDto was null or undefined when calling patchGroupNameEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/groups/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int32"})}/name`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('patch', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOGroupUpdateGroupNameDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint patch /API/groups/{Id}/profilePicture + * @param id + * @param knotsDTOGroupUpdateGroupProfilePictureDto + * @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. + * @param options additional options + */ + public patchGroupProfilePictureEndpoint(id: number, knotsDTOGroupUpdateGroupProfilePictureDto: KnotsDTOGroupUpdateGroupProfilePictureDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable; + public patchGroupProfilePictureEndpoint(id: number, knotsDTOGroupUpdateGroupProfilePictureDto: KnotsDTOGroupUpdateGroupProfilePictureDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public patchGroupProfilePictureEndpoint(id: number, knotsDTOGroupUpdateGroupProfilePictureDto: KnotsDTOGroupUpdateGroupProfilePictureDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public patchGroupProfilePictureEndpoint(id: number, knotsDTOGroupUpdateGroupProfilePictureDto: KnotsDTOGroupUpdateGroupProfilePictureDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling patchGroupProfilePictureEndpoint.'); + } + if (knotsDTOGroupUpdateGroupProfilePictureDto === null || knotsDTOGroupUpdateGroupProfilePictureDto === undefined) { + throw new Error('Required parameter knotsDTOGroupUpdateGroupProfilePictureDto was null or undefined when calling patchGroupProfilePictureEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/groups/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int32"})}/profilePicture`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('patch', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOGroupUpdateGroupProfilePictureDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/src/app/services/api/api/keys.service.ts b/src/app/services/api/api/keys.service.ts new file mode 100644 index 0000000..79ab67a --- /dev/null +++ b/src/app/services/api/api/keys.service.ts @@ -0,0 +1,252 @@ +/** + * Knots + * + * + * + * 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, HttpContext + } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { OpenApiHttpParams, QueryParamStyle } from '../query.params'; + +// @ts-ignore +import { FastEndpointsErrorResponse } from '../model/fast-endpoints-error-response'; +// @ts-ignore +import { KnotsDTOKeyCreateKeyDto } from '../model/knots-dto-key-create-key-dto'; +// @ts-ignore +import { KnotsDTOKeyDeleteKeyDto } from '../model/knots-dto-key-delete-key-dto'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + + + +@Injectable({ + providedIn: 'root' +}) +export class KeysService extends BaseService { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * @endpoint post /API/keys + * @param knotsDTOKeyCreateKeyDto + * @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. + * @param options additional options + */ + public createKeyEndpoint(knotsDTOKeyCreateKeyDto: KnotsDTOKeyCreateKeyDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public createKeyEndpoint(knotsDTOKeyCreateKeyDto: KnotsDTOKeyCreateKeyDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createKeyEndpoint(knotsDTOKeyCreateKeyDto: KnotsDTOKeyCreateKeyDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createKeyEndpoint(knotsDTOKeyCreateKeyDto: KnotsDTOKeyCreateKeyDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (knotsDTOKeyCreateKeyDto === null || knotsDTOKeyCreateKeyDto === undefined) { + throw new Error('Required parameter knotsDTOKeyCreateKeyDto was null or undefined when calling createKeyEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/keys`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOKeyCreateKeyDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint delete /API/keys + * @param knotsDTOKeyDeleteKeyDto + * @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. + * @param options additional options + */ + public deleteKeyEndpoint(knotsDTOKeyDeleteKeyDto: KnotsDTOKeyDeleteKeyDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public deleteKeyEndpoint(knotsDTOKeyDeleteKeyDto: KnotsDTOKeyDeleteKeyDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteKeyEndpoint(knotsDTOKeyDeleteKeyDto: KnotsDTOKeyDeleteKeyDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteKeyEndpoint(knotsDTOKeyDeleteKeyDto: KnotsDTOKeyDeleteKeyDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (knotsDTOKeyDeleteKeyDto === null || knotsDTOKeyDeleteKeyDto === undefined) { + throw new Error('Required parameter knotsDTOKeyDeleteKeyDto was null or undefined when calling deleteKeyEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/keys`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOKeyDeleteKeyDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint get /API/keys/{@Id} + * @param id + * @param id2 + * @param enKey + * @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. + * @param options additional options + */ + public getKeyEndpoint(id: string, id2: number, enKey?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable; + public getKeyEndpoint(id: string, id2: number, enKey?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public getKeyEndpoint(id: string, id2: number, enKey?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public getKeyEndpoint(id: string, id2: number, enKey?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getKeyEndpoint.'); + } + if (id2 === null || id2 === undefined) { + throw new Error('Required parameter id2 was null or undefined when calling getKeyEndpoint.'); + } + + let localVarQueryParameters = new OpenApiHttpParams(this.encoder); + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'Id', + id2, + QueryParamStyle.Form, + true, + ); + + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'EnKey', + enKey, + QueryParamStyle.Form, + true, + ); + + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/keys/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters.toHttpParams(), + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/src/app/services/api/api/messages.service.ts b/src/app/services/api/api/messages.service.ts new file mode 100644 index 0000000..50af4cd --- /dev/null +++ b/src/app/services/api/api/messages.service.ts @@ -0,0 +1,277 @@ +/** + * Knots + * + * + * + * 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, HttpContext + } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { OpenApiHttpParams, QueryParamStyle } from '../query.params'; + +// @ts-ignore +import { FastEndpointsErrorResponse } from '../model/fast-endpoints-error-response'; +// @ts-ignore +import { KnotsDTOMessageCreateMessageDto } from '../model/knots-dto-message-create-message-dto'; +// @ts-ignore +import { KnotsDTOMessageDeleteMessageDto } from '../model/knots-dto-message-delete-message-dto'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + + + +@Injectable({ + providedIn: 'root' +}) +export class MessagesService extends BaseService { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * @endpoint post /API/messages + * @param knotsDTOMessageCreateMessageDto + * @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. + * @param options additional options + */ + public createMessageEndpoint(knotsDTOMessageCreateMessageDto: KnotsDTOMessageCreateMessageDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public createMessageEndpoint(knotsDTOMessageCreateMessageDto: KnotsDTOMessageCreateMessageDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createMessageEndpoint(knotsDTOMessageCreateMessageDto: KnotsDTOMessageCreateMessageDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createMessageEndpoint(knotsDTOMessageCreateMessageDto: KnotsDTOMessageCreateMessageDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (knotsDTOMessageCreateMessageDto === null || knotsDTOMessageCreateMessageDto === undefined) { + throw new Error('Required parameter knotsDTOMessageCreateMessageDto was null or undefined when calling createMessageEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/messages`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOMessageCreateMessageDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint delete /API/messages + * @param knotsDTOMessageDeleteMessageDto + * @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. + * @param options additional options + */ + public deleteMessageEndpoint(knotsDTOMessageDeleteMessageDto: KnotsDTOMessageDeleteMessageDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable; + public deleteMessageEndpoint(knotsDTOMessageDeleteMessageDto: KnotsDTOMessageDeleteMessageDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteMessageEndpoint(knotsDTOMessageDeleteMessageDto: KnotsDTOMessageDeleteMessageDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteMessageEndpoint(knotsDTOMessageDeleteMessageDto: KnotsDTOMessageDeleteMessageDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable { + if (knotsDTOMessageDeleteMessageDto === null || knotsDTOMessageDeleteMessageDto === undefined) { + throw new Error('Required parameter knotsDTOMessageDeleteMessageDto was null or undefined when calling deleteMessageEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/messages`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOMessageDeleteMessageDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint get /API/messages/{@Id} + * @param id + * @param id2 + * @param date + * @param type + * @param contenu + * @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. + * @param options additional options + */ + public getMessageEndpoint(id: string, id2: number, date: string, type: boolean, contenu?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable; + public getMessageEndpoint(id: string, id2: number, date: string, type: boolean, contenu?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public getMessageEndpoint(id: string, id2: number, date: string, type: boolean, contenu?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public getMessageEndpoint(id: string, id2: number, date: string, type: boolean, contenu?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getMessageEndpoint.'); + } + if (id2 === null || id2 === undefined) { + throw new Error('Required parameter id2 was null or undefined when calling getMessageEndpoint.'); + } + if (date === null || date === undefined) { + throw new Error('Required parameter date was null or undefined when calling getMessageEndpoint.'); + } + if (type === null || type === undefined) { + throw new Error('Required parameter type was null or undefined when calling getMessageEndpoint.'); + } + + let localVarQueryParameters = new OpenApiHttpParams(this.encoder); + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'Id', + id2, + QueryParamStyle.Form, + true, + ); + + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'Contenu', + contenu, + QueryParamStyle.Form, + true, + ); + + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'Date', + date, + QueryParamStyle.Form, + true, + ); + + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'Type', + type, + QueryParamStyle.Form, + true, + ); + + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/messages/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters.toHttpParams(), + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/src/app/services/api/api/roles.service.ts b/src/app/services/api/api/roles.service.ts new file mode 100644 index 0000000..d47ea73 --- /dev/null +++ b/src/app/services/api/api/roles.service.ts @@ -0,0 +1,227 @@ +/** + * Knots + * + * + * + * 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, HttpContext + } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { OpenApiHttpParams, QueryParamStyle } from '../query.params'; + +// @ts-ignore +import { FastEndpointsErrorResponse } from '../model/fast-endpoints-error-response'; +// @ts-ignore +import { KnotsDTORoleCreateRoleDto } from '../model/knots-dto-role-create-role-dto'; +// @ts-ignore +import { KnotsDTORoleDeleteRoleDto } from '../model/knots-dto-role-delete-role-dto'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + + + +@Injectable({ + providedIn: 'root' +}) +export class RolesService extends BaseService { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * @endpoint post /API/roles + * @param knotsDTORoleCreateRoleDto + * @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. + * @param options additional options + */ + public createRoleEndpoint(knotsDTORoleCreateRoleDto: KnotsDTORoleCreateRoleDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public createRoleEndpoint(knotsDTORoleCreateRoleDto: KnotsDTORoleCreateRoleDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createRoleEndpoint(knotsDTORoleCreateRoleDto: KnotsDTORoleCreateRoleDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createRoleEndpoint(knotsDTORoleCreateRoleDto: KnotsDTORoleCreateRoleDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (knotsDTORoleCreateRoleDto === null || knotsDTORoleCreateRoleDto === undefined) { + throw new Error('Required parameter knotsDTORoleCreateRoleDto was null or undefined when calling createRoleEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/roles`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTORoleCreateRoleDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint delete /API/roles + * @param knotsDTORoleDeleteRoleDto + * @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. + * @param options additional options + */ + public deleteRoleEndpoint(knotsDTORoleDeleteRoleDto: KnotsDTORoleDeleteRoleDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public deleteRoleEndpoint(knotsDTORoleDeleteRoleDto: KnotsDTORoleDeleteRoleDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteRoleEndpoint(knotsDTORoleDeleteRoleDto: KnotsDTORoleDeleteRoleDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteRoleEndpoint(knotsDTORoleDeleteRoleDto: KnotsDTORoleDeleteRoleDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (knotsDTORoleDeleteRoleDto === null || knotsDTORoleDeleteRoleDto === undefined) { + throw new Error('Required parameter knotsDTORoleDeleteRoleDto was null or undefined when calling deleteRoleEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/roles`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTORoleDeleteRoleDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint get /API/roles/{Libelle} + * @param libelle + * @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. + * @param options additional options + */ + public getRoleEndpoint(libelle: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public getRoleEndpoint(libelle: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getRoleEndpoint(libelle: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getRoleEndpoint(libelle: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (libelle === null || libelle === undefined) { + throw new Error('Required parameter libelle was null or undefined when calling getRoleEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/roles/${this.configuration.encodeParam({name: "libelle", value: libelle, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/src/app/services/api/api/users.service.ts b/src/app/services/api/api/users.service.ts new file mode 100644 index 0000000..6ebc6cd --- /dev/null +++ b/src/app/services/api/api/users.service.ts @@ -0,0 +1,692 @@ +/** + * Knots + * + * + * + * 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, HttpContext + } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { OpenApiHttpParams, QueryParamStyle } from '../query.params'; + +// @ts-ignore +import { FastEndpointsErrorResponse } from '../model/fast-endpoints-error-response'; +// @ts-ignore +import { KnotsDTOUserCreateUserDto } from '../model/knots-dto-user-create-user-dto'; +// @ts-ignore +import { KnotsDTOUserDeleteUserDto } from '../model/knots-dto-user-delete-user-dto'; +// @ts-ignore +import { KnotsDTOUserGetUserDto } from '../model/knots-dto-user-get-user-dto'; +// @ts-ignore +import { KnotsDTOUserUpdateUserContactDto } from '../model/knots-dto-user-update-user-contact-dto'; +// @ts-ignore +import { KnotsDTOUserUpdateUserDescriptionDto } from '../model/knots-dto-user-update-user-description-dto'; +// @ts-ignore +import { KnotsDTOUserUpdateUserPasswordDto } from '../model/knots-dto-user-update-user-password-dto'; +// @ts-ignore +import { KnotsDTOUserUpdateUserProfilePictureDto } from '../model/knots-dto-user-update-user-profile-picture-dto'; +// @ts-ignore +import { KnotsDTOUserUpdateUsernameDto } from '../model/knots-dto-user-update-username-dto'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + + + +@Injectable({ + providedIn: 'root' +}) +export class UsersService extends BaseService { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * @endpoint post /API/users + * @param knotsDTOUserCreateUserDto + * @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. + * @param options additional options + */ + public createUserEndpoint(knotsDTOUserCreateUserDto: KnotsDTOUserCreateUserDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public createUserEndpoint(knotsDTOUserCreateUserDto: KnotsDTOUserCreateUserDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createUserEndpoint(knotsDTOUserCreateUserDto: KnotsDTOUserCreateUserDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createUserEndpoint(knotsDTOUserCreateUserDto: KnotsDTOUserCreateUserDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (knotsDTOUserCreateUserDto === null || knotsDTOUserCreateUserDto === undefined) { + throw new Error('Required parameter knotsDTOUserCreateUserDto was null or undefined when calling createUserEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/users`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOUserCreateUserDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint delete /API/users/{@Id} + * @param id + * @param knotsDTOUserDeleteUserDto + * @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. + * @param options additional options + */ + public deleteUserEndpoint(id: string, knotsDTOUserDeleteUserDto: KnotsDTOUserDeleteUserDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable; + public deleteUserEndpoint(id: string, knotsDTOUserDeleteUserDto: KnotsDTOUserDeleteUserDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteUserEndpoint(id: string, knotsDTOUserDeleteUserDto: KnotsDTOUserDeleteUserDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteUserEndpoint(id: string, knotsDTOUserDeleteUserDto: KnotsDTOUserDeleteUserDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling deleteUserEndpoint.'); + } + if (knotsDTOUserDeleteUserDto === null || knotsDTOUserDeleteUserDto === undefined) { + throw new Error('Required parameter knotsDTOUserDeleteUserDto was null or undefined when calling deleteUserEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (JWTBearerAuth) required + localVarHeaders = this.configuration.addCredentialToHeaders('JWTBearerAuth', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/users/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOUserDeleteUserDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint get /API/users + * @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. + * @param options additional options + */ + public getAllUsersEndpoint(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllUsersEndpoint(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getAllUsersEndpoint(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getAllUsersEndpoint(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/users`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint get /API/users/{Username} + * @param username + * @param description + * @param password + * @param email + * @param tel + * @param profilePicture + * @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. + * @param options additional options + */ + public getUserEndpoint(username: string, description?: string, password?: string, email?: string, tel?: string, profilePicture?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable; + public getUserEndpoint(username: string, description?: string, password?: string, email?: string, tel?: string, profilePicture?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public getUserEndpoint(username: string, description?: string, password?: string, email?: string, tel?: string, profilePicture?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public getUserEndpoint(username: string, description?: string, password?: string, email?: string, tel?: string, profilePicture?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable { + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling getUserEndpoint.'); + } + + let localVarQueryParameters = new OpenApiHttpParams(this.encoder); + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'Description', + description, + QueryParamStyle.Form, + true, + ); + + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'Password', + password, + QueryParamStyle.Form, + true, + ); + + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'Email', + email, + QueryParamStyle.Form, + true, + ); + + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'Tel', + tel, + QueryParamStyle.Form, + true, + ); + + + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + 'ProfilePicture', + profilePicture, + QueryParamStyle.Form, + true, + ); + + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/users/${this.configuration.encodeParam({name: "username", value: username, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters.toHttpParams(), + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint patch /API/users/{Id}/contact + * @param id + * @param knotsDTOUserUpdateUserContactDto + * @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. + * @param options additional options + */ + public patchUserContactEndpoint(id: number, knotsDTOUserUpdateUserContactDto: KnotsDTOUserUpdateUserContactDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public patchUserContactEndpoint(id: number, knotsDTOUserUpdateUserContactDto: KnotsDTOUserUpdateUserContactDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public patchUserContactEndpoint(id: number, knotsDTOUserUpdateUserContactDto: KnotsDTOUserUpdateUserContactDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public patchUserContactEndpoint(id: number, knotsDTOUserUpdateUserContactDto: KnotsDTOUserUpdateUserContactDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling patchUserContactEndpoint.'); + } + if (knotsDTOUserUpdateUserContactDto === null || knotsDTOUserUpdateUserContactDto === undefined) { + throw new Error('Required parameter knotsDTOUserUpdateUserContactDto was null or undefined when calling patchUserContactEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/users/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int32"})}/contact`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('patch', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOUserUpdateUserContactDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint patch /API/users/{@Id}/description + * @param id + * @param knotsDTOUserUpdateUserDescriptionDto + * @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. + * @param options additional options + */ + public patchUserDescriptionEndpoint(id: string, knotsDTOUserUpdateUserDescriptionDto: KnotsDTOUserUpdateUserDescriptionDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public patchUserDescriptionEndpoint(id: string, knotsDTOUserUpdateUserDescriptionDto: KnotsDTOUserUpdateUserDescriptionDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public patchUserDescriptionEndpoint(id: string, knotsDTOUserUpdateUserDescriptionDto: KnotsDTOUserUpdateUserDescriptionDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public patchUserDescriptionEndpoint(id: string, knotsDTOUserUpdateUserDescriptionDto: KnotsDTOUserUpdateUserDescriptionDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling patchUserDescriptionEndpoint.'); + } + if (knotsDTOUserUpdateUserDescriptionDto === null || knotsDTOUserUpdateUserDescriptionDto === undefined) { + throw new Error('Required parameter knotsDTOUserUpdateUserDescriptionDto was null or undefined when calling patchUserDescriptionEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/users/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/description`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('patch', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOUserUpdateUserDescriptionDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint patch /API/users/{Id}/password + * @param id + * @param knotsDTOUserUpdateUserPasswordDto + * @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. + * @param options additional options + */ + public patchUserPasswordEndpoint(id: number, knotsDTOUserUpdateUserPasswordDto: KnotsDTOUserUpdateUserPasswordDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable; + public patchUserPasswordEndpoint(id: number, knotsDTOUserUpdateUserPasswordDto: KnotsDTOUserUpdateUserPasswordDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public patchUserPasswordEndpoint(id: number, knotsDTOUserUpdateUserPasswordDto: KnotsDTOUserUpdateUserPasswordDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable>; + public patchUserPasswordEndpoint(id: number, knotsDTOUserUpdateUserPasswordDto: KnotsDTOUserUpdateUserPasswordDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling patchUserPasswordEndpoint.'); + } + if (knotsDTOUserUpdateUserPasswordDto === null || knotsDTOUserUpdateUserPasswordDto === undefined) { + throw new Error('Required parameter knotsDTOUserUpdateUserPasswordDto was null or undefined when calling patchUserPasswordEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/users/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: "int32"})}/password`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('patch', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOUserUpdateUserPasswordDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint patch /API/users/{@Id}/profilepicture + * @param id + * @param knotsDTOUserUpdateUserProfilePictureDto + * @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. + * @param options additional options + */ + public patchUserProfilePictureEndpoint(id: string, knotsDTOUserUpdateUserProfilePictureDto: KnotsDTOUserUpdateUserProfilePictureDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public patchUserProfilePictureEndpoint(id: string, knotsDTOUserUpdateUserProfilePictureDto: KnotsDTOUserUpdateUserProfilePictureDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public patchUserProfilePictureEndpoint(id: string, knotsDTOUserUpdateUserProfilePictureDto: KnotsDTOUserUpdateUserProfilePictureDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public patchUserProfilePictureEndpoint(id: string, knotsDTOUserUpdateUserProfilePictureDto: KnotsDTOUserUpdateUserProfilePictureDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling patchUserProfilePictureEndpoint.'); + } + if (knotsDTOUserUpdateUserProfilePictureDto === null || knotsDTOUserUpdateUserProfilePictureDto === undefined) { + throw new Error('Required parameter knotsDTOUserUpdateUserProfilePictureDto was null or undefined when calling patchUserProfilePictureEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/users/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/profilepicture`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('patch', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOUserUpdateUserProfilePictureDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * @endpoint patch /API/users/{@Id}/username + * @param id + * @param knotsDTOUserUpdateUsernameDto + * @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. + * @param options additional options + */ + public patchUsernameEndpoint(id: string, knotsDTOUserUpdateUsernameDto: KnotsDTOUserUpdateUsernameDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable; + public patchUsernameEndpoint(id: string, knotsDTOUserUpdateUsernameDto: KnotsDTOUserUpdateUsernameDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public patchUsernameEndpoint(id: string, knotsDTOUserUpdateUsernameDto: KnotsDTOUserUpdateUsernameDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable>; + public patchUsernameEndpoint(id: string, knotsDTOUserUpdateUsernameDto: KnotsDTOUserUpdateUsernameDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/problem+json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling patchUsernameEndpoint.'); + } + if (knotsDTOUserUpdateUsernameDto === null || knotsDTOUserUpdateUsernameDto === undefined) { + throw new Error('Required parameter knotsDTOUserUpdateUsernameDto was null or undefined when calling patchUsernameEndpoint.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/problem+json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/API/users/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/username`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('patch', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOUserUpdateUsernameDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/src/app/services/api/configuration.ts b/src/app/services/api/configuration.ts new file mode 100644 index 0000000..a6e2514 --- /dev/null +++ b/src/app/services/api/configuration.ts @@ -0,0 +1,194 @@ +import { HttpHeaders, HttpParameterCodec } from '@angular/common/http'; +import { Param } from './param'; +import { OpenApiHttpParams } from './query.params'; + +export interface ConfigurationParameters { + /** + * @deprecated Since 5.0. Use credentials instead + */ + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + /** + * @deprecated Since 5.0. Use credentials instead + */ + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; + /** + * Takes care of encoding query- and form-parameters. + */ + encoder?: HttpParameterCodec; + /** + * Override the default method for encoding path parameters in various + * styles. + *

+ * See {@link README.md} for more details + *

+ */ + encodeParam?: (param: Param) => string; + /** + * The keys are the names in the securitySchemes section of the OpenAPI + * document. They should map to the value used for authentication + * minus any standard prefixes such as 'Basic' or 'Bearer'. + */ + credentials?: {[ key: string ]: string | (() => string | undefined)}; +} + +export class Configuration { + /** + * @deprecated Since 5.0. Use credentials instead + */ + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + /** + * @deprecated Since 5.0. Use credentials instead + */ + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; + /** + * Takes care of encoding query- and form-parameters. + */ + encoder?: HttpParameterCodec; + /** + * Encoding of various path parameter + * styles. + *

+ * See {@link README.md} for more details + *

+ */ + encodeParam: (param: Param) => string; + /** + * The keys are the names in the securitySchemes section of the OpenAPI + * document. They should map to the value used for authentication + * minus any standard prefixes such as 'Basic' or 'Bearer'. + */ + credentials: {[ key: string ]: string | (() => string | undefined)}; + +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; + } + if (username !== undefined) { + this.username = username; + } + if (password !== undefined) { + this.password = password; + } + if (accessToken !== undefined) { + this.accessToken = accessToken; + } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; + + // init default JWTBearerAuth credential + if (!this.credentials['JWTBearerAuth']) { + this.credentials['JWTBearerAuth'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } + } + + /** + * 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 undefined 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 undefined 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 = /^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$/i; + return mime !== null && jsonMime.test(mime); + } + + public lookupCredential(key: string): string | undefined { + const value = this.credentials[key]; + return typeof value === 'function' + ? value() + : value; + } + + public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders { + const value = this.lookupCredential(credentialKey); + return value + ? headers.set(headerName, (prefix ?? '') + value) + : headers; + } + + public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams { + const value = this.lookupCredential(credentialKey); + return value + ? query.set(paramName, value) + : query; + } + + private defaultEncodeParam(param: Param): string { + // This implementation exists as fallback for missing configuration + // and for backwards compatibility to older typescript-angular generator versions. + // It only works for the 'simple' parameter style. + // Date-handling only works for the 'date-time' format. + // All other styles and Date-formats are probably handled incorrectly. + // + // But: if that's all you need (i.e.: the most common use-case): no need for customization! + + const value = param.dataFormat === 'date-time' && param.value instanceof Date + ? (param.value as Date).toISOString() + : param.value; + + return encodeURIComponent(String(value)); + } +} diff --git a/src/app/services/api/encoder.ts b/src/app/services/api/encoder.ts new file mode 100644 index 0000000..af45235 --- /dev/null +++ b/src/app/services/api/encoder.ts @@ -0,0 +1,35 @@ +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); + } +} + +export class IdentityHttpParameterCodec implements HttpParameterCodec { + encodeKey(k: string): string { + return k; + } + encodeValue(v: string): string { + return v; + } + decodeKey(k: string): string { + return k; + } + decodeValue(v: string): string { + return v; + } +} diff --git a/src/app/services/api/git_push.sh b/src/app/services/api/git_push.sh new file mode 100644 index 0000000..f53a75d --- /dev/null +++ b/src/app/services/api/git_push.sh @@ -0,0 +1,57 @@ +#!/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-petstore-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' diff --git a/src/app/services/api/index.ts b/src/app/services/api/index.ts new file mode 100644 index 0000000..02cb7d4 --- /dev/null +++ b/src/app/services/api/index.ts @@ -0,0 +1,7 @@ +export * from './api/api'; +export * from './model/models'; +export * from './variables'; +export * from './configuration'; +export * from './api.module'; +export * from './provide-api'; +export * from './param'; diff --git a/src/app/services/api/model/fast-endpoints-error-response.ts b/src/app/services/api/model/fast-endpoints-error-response.ts new file mode 100644 index 0000000..4008f4b --- /dev/null +++ b/src/app/services/api/model/fast-endpoints-error-response.ts @@ -0,0 +1,29 @@ +/** + * Knots + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * the dto used to send an error response to the client + */ +export interface FastEndpointsErrorResponse { + /** + * the http status code sent to the client. default is 400. + */ + statusCode?: number; + /** + * the message for the error response + */ + message?: string; + /** + * the collection of errors for the current context + */ + errors?: { [key: string]: Array; }; +} + diff --git a/src/app/services/api/model/knots-dto-discussion-create-discussion-dto.ts b/src/app/services/api/model/knots-dto-discussion-create-discussion-dto.ts new file mode 100644 index 0000000..2a1e9fe --- /dev/null +++ b/src/app/services/api/model/knots-dto-discussion-create-discussion-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTODiscussionCreateDiscussionDto { + id?: number; +} + diff --git a/src/app/services/api/model/knots-dto-discussion-delete-discussion-dto.ts b/src/app/services/api/model/knots-dto-discussion-delete-discussion-dto.ts new file mode 100644 index 0000000..1be0452 --- /dev/null +++ b/src/app/services/api/model/knots-dto-discussion-delete-discussion-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTODiscussionDeleteDiscussionDto { + id?: number; +} + diff --git a/src/app/services/api/model/knots-dto-group-create-group-dto.ts b/src/app/services/api/model/knots-dto-group-create-group-dto.ts new file mode 100644 index 0000000..1c0a794 --- /dev/null +++ b/src/app/services/api/model/knots-dto-group-create-group-dto.ts @@ -0,0 +1,17 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOGroupCreateGroupDto { + nom?: string | null; + nombreMembres?: number; + profilePicture?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-group-delete-group-dto.ts b/src/app/services/api/model/knots-dto-group-delete-group-dto.ts new file mode 100644 index 0000000..fcc1b57 --- /dev/null +++ b/src/app/services/api/model/knots-dto-group-delete-group-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOGroupDeleteGroupDto { + id?: number | null; +} + diff --git a/src/app/services/api/model/knots-dto-group-update-group-members-amount-dto.ts b/src/app/services/api/model/knots-dto-group-update-group-members-amount-dto.ts new file mode 100644 index 0000000..bde6c12 --- /dev/null +++ b/src/app/services/api/model/knots-dto-group-update-group-members-amount-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOGroupUpdateGroupMembersAmountDto { + membersAmount?: number; +} + diff --git a/src/app/services/api/model/knots-dto-group-update-group-name-dto.ts b/src/app/services/api/model/knots-dto-group-update-group-name-dto.ts new file mode 100644 index 0000000..0c152ef --- /dev/null +++ b/src/app/services/api/model/knots-dto-group-update-group-name-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOGroupUpdateGroupNameDto { + name?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-group-update-group-profile-picture-dto.ts b/src/app/services/api/model/knots-dto-group-update-group-profile-picture-dto.ts new file mode 100644 index 0000000..0c606c5 --- /dev/null +++ b/src/app/services/api/model/knots-dto-group-update-group-profile-picture-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOGroupUpdateGroupProfilePictureDto { + profilePicture?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-key-create-key-dto.ts b/src/app/services/api/model/knots-dto-key-create-key-dto.ts new file mode 100644 index 0000000..bdf7d12 --- /dev/null +++ b/src/app/services/api/model/knots-dto-key-create-key-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOKeyCreateKeyDto { + enKey?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-key-delete-key-dto.ts b/src/app/services/api/model/knots-dto-key-delete-key-dto.ts new file mode 100644 index 0000000..e289d29 --- /dev/null +++ b/src/app/services/api/model/knots-dto-key-delete-key-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOKeyDeleteKeyDto { + id?: number; +} + diff --git a/src/app/services/api/model/knots-dto-message-create-message-dto.ts b/src/app/services/api/model/knots-dto-message-create-message-dto.ts new file mode 100644 index 0000000..9b8883a --- /dev/null +++ b/src/app/services/api/model/knots-dto-message-create-message-dto.ts @@ -0,0 +1,17 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOMessageCreateMessageDto { + contenu?: string | null; + date?: string; + type?: boolean; +} + diff --git a/src/app/services/api/model/knots-dto-message-delete-message-dto.ts b/src/app/services/api/model/knots-dto-message-delete-message-dto.ts new file mode 100644 index 0000000..5d36f95 --- /dev/null +++ b/src/app/services/api/model/knots-dto-message-delete-message-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOMessageDeleteMessageDto { + id?: number; +} + diff --git a/src/app/services/api/model/knots-dto-role-create-role-dto.ts b/src/app/services/api/model/knots-dto-role-create-role-dto.ts new file mode 100644 index 0000000..d7e39ef --- /dev/null +++ b/src/app/services/api/model/knots-dto-role-create-role-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTORoleCreateRoleDto { + libelle?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-role-delete-role-dto.ts b/src/app/services/api/model/knots-dto-role-delete-role-dto.ts new file mode 100644 index 0000000..f916529 --- /dev/null +++ b/src/app/services/api/model/knots-dto-role-delete-role-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTORoleDeleteRoleDto { + id?: number; +} + diff --git a/src/app/services/api/model/knots-dto-user-create-user-dto.ts b/src/app/services/api/model/knots-dto-user-create-user-dto.ts new file mode 100644 index 0000000..d882667 --- /dev/null +++ b/src/app/services/api/model/knots-dto-user-create-user-dto.ts @@ -0,0 +1,20 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOUserCreateUserDto { + username?: string | null; + description?: string | null; + password?: string | null; + email?: string | null; + tel?: string | null; + profilePicture?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-user-delete-user-dto.ts b/src/app/services/api/model/knots-dto-user-delete-user-dto.ts new file mode 100644 index 0000000..676d549 --- /dev/null +++ b/src/app/services/api/model/knots-dto-user-delete-user-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOUserDeleteUserDto { + username?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-user-get-user-dto.ts b/src/app/services/api/model/knots-dto-user-get-user-dto.ts new file mode 100644 index 0000000..1db3313 --- /dev/null +++ b/src/app/services/api/model/knots-dto-user-get-user-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOUserGetUserDto { + username?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-user-update-user-contact-dto.ts b/src/app/services/api/model/knots-dto-user-update-user-contact-dto.ts new file mode 100644 index 0000000..030df91 --- /dev/null +++ b/src/app/services/api/model/knots-dto-user-update-user-contact-dto.ts @@ -0,0 +1,16 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOUserUpdateUserContactDto { + email?: string | null; + tel?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-user-update-user-description-dto.ts b/src/app/services/api/model/knots-dto-user-update-user-description-dto.ts new file mode 100644 index 0000000..80b1cdc --- /dev/null +++ b/src/app/services/api/model/knots-dto-user-update-user-description-dto.ts @@ -0,0 +1,16 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOUserUpdateUserDescriptionDto { + id?: number; + description?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-user-update-user-password-dto.ts b/src/app/services/api/model/knots-dto-user-update-user-password-dto.ts new file mode 100644 index 0000000..5dfeb22 --- /dev/null +++ b/src/app/services/api/model/knots-dto-user-update-user-password-dto.ts @@ -0,0 +1,15 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOUserUpdateUserPasswordDto { + password?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-user-update-user-profile-picture-dto.ts b/src/app/services/api/model/knots-dto-user-update-user-profile-picture-dto.ts new file mode 100644 index 0000000..ce778ae --- /dev/null +++ b/src/app/services/api/model/knots-dto-user-update-user-profile-picture-dto.ts @@ -0,0 +1,16 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOUserUpdateUserProfilePictureDto { + id?: number; + profilePicture?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-user-update-username-dto.ts b/src/app/services/api/model/knots-dto-user-update-username-dto.ts new file mode 100644 index 0000000..cef80f5 --- /dev/null +++ b/src/app/services/api/model/knots-dto-user-update-username-dto.ts @@ -0,0 +1,16 @@ +/** + * Knots + * + * + * + * 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 KnotsDTOUserUpdateUsernameDto { + id?: number; + username?: string | null; +} + diff --git a/src/app/services/api/model/models.ts b/src/app/services/api/model/models.ts new file mode 100644 index 0000000..54e4581 --- /dev/null +++ b/src/app/services/api/model/models.ts @@ -0,0 +1,22 @@ +export * from './fast-endpoints-error-response'; +export * from './knots-dto-discussion-create-discussion-dto'; +export * from './knots-dto-discussion-delete-discussion-dto'; +export * from './knots-dto-group-create-group-dto'; +export * from './knots-dto-group-delete-group-dto'; +export * from './knots-dto-group-update-group-members-amount-dto'; +export * from './knots-dto-group-update-group-name-dto'; +export * from './knots-dto-group-update-group-profile-picture-dto'; +export * from './knots-dto-key-create-key-dto'; +export * from './knots-dto-key-delete-key-dto'; +export * from './knots-dto-message-create-message-dto'; +export * from './knots-dto-message-delete-message-dto'; +export * from './knots-dto-role-create-role-dto'; +export * from './knots-dto-role-delete-role-dto'; +export * from './knots-dto-user-create-user-dto'; +export * from './knots-dto-user-delete-user-dto'; +export * from './knots-dto-user-get-user-dto'; +export * from './knots-dto-user-update-user-contact-dto'; +export * from './knots-dto-user-update-user-description-dto'; +export * from './knots-dto-user-update-user-password-dto'; +export * from './knots-dto-user-update-user-profile-picture-dto'; +export * from './knots-dto-user-update-username-dto'; diff --git a/src/app/services/api/param.ts b/src/app/services/api/param.ts new file mode 100644 index 0000000..78a2d20 --- /dev/null +++ b/src/app/services/api/param.ts @@ -0,0 +1,69 @@ +/** + * Standard parameter styles defined by OpenAPI spec + */ +export type StandardParamStyle = + | 'matrix' + | 'label' + | 'form' + | 'simple' + | 'spaceDelimited' + | 'pipeDelimited' + | 'deepObject' + ; + +/** + * The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user. + */ +export type ParamStyle = StandardParamStyle | string; + +/** + * Standard parameter locations defined by OpenAPI spec + */ +export type ParamLocation = 'query' | 'header' | 'path' | 'cookie'; + +/** + * Standard types as defined in OpenAPI Specification: Data Types + */ +export type StandardDataType = + | "integer" + | "number" + | "boolean" + | "string" + | "object" + | "array" + ; + +/** + * Standard {@link DataType}s plus your own types/classes. + */ +export type DataType = StandardDataType | string; + +/** + * Standard formats as defined in OpenAPI Specification: Data Types + */ +export type StandardDataFormat = + | "int32" + | "int64" + | "float" + | "double" + | "byte" + | "binary" + | "date" + | "date-time" + | "password" + ; + +export type DataFormat = StandardDataFormat | string; + +/** + * The parameter to encode. + */ +export interface Param { + name: string; + value: unknown; + in: ParamLocation; + style: ParamStyle, + explode: boolean; + dataType: DataType; + dataFormat: DataFormat | undefined; +} diff --git a/src/app/services/api/provide-api.ts b/src/app/services/api/provide-api.ts new file mode 100644 index 0000000..19c762a --- /dev/null +++ b/src/app/services/api/provide-api.ts @@ -0,0 +1,15 @@ +import { EnvironmentProviders, makeEnvironmentProviders } from "@angular/core"; +import { Configuration, ConfigurationParameters } from './configuration'; +import { BASE_PATH } from './variables'; + +// Returns the service class providers, to be used in the [ApplicationConfig](https://angular.dev/api/core/ApplicationConfig). +export function provideApi(configOrBasePath: string | ConfigurationParameters): EnvironmentProviders { + return makeEnvironmentProviders([ + typeof configOrBasePath === "string" + ? { provide: BASE_PATH, useValue: configOrBasePath } + : { + provide: Configuration, + useValue: new Configuration({ ...configOrBasePath }), + }, + ]); +} \ No newline at end of file diff --git a/src/app/services/api/query.params.ts b/src/app/services/api/query.params.ts new file mode 100644 index 0000000..4076c11 --- /dev/null +++ b/src/app/services/api/query.params.ts @@ -0,0 +1,160 @@ +import { HttpParams, HttpParameterCodec } from '@angular/common/http'; +import { CustomHttpParameterCodec, IdentityHttpParameterCodec } from './encoder'; + +export enum QueryParamStyle { + Json, + Form, + DeepObject, + SpaceDelimited, + PipeDelimited, +} + +export type Delimiter = "," | " " | "|" | "\t"; + +export interface ParamOptions { + /** When true, serialized as multiple repeated key=value pairs. When false, serialized as a single key with joined values using `delimiter`. */ + explode?: boolean; + /** Delimiter used when explode=false. The delimiter itself is inserted unencoded between encoded values. */ + delimiter?: Delimiter; +} + +interface ParamEntry { + values: string[]; + options: Required; +} + +export class OpenApiHttpParams { + private params: Map = new Map(); + private defaults: Required; + private encoder: HttpParameterCodec; + + /** + * @param encoder Parameter serializer + * @param defaults Global defaults used when a specific parameter has no explicit options. + * By OpenAPI default, explode is true for query params with style=form. + */ + constructor(encoder?: HttpParameterCodec, defaults?: { explode?: boolean; delimiter?: Delimiter }) { + this.encoder = encoder || new CustomHttpParameterCodec(); + this.defaults = { + explode: defaults?.explode ?? true, + delimiter: defaults?.delimiter ?? ",", + }; + } + + private resolveOptions(local?: ParamOptions): Required { + return { + explode: local?.explode ?? this.defaults.explode, + delimiter: local?.delimiter ?? this.defaults.delimiter, + }; + } + + /** + * Replace the parameter's values and (optionally) its options. + * Options are stored per-parameter (not global). + */ + set(key: string, values: string[] | string, options?: ParamOptions): this { + const arr = Array.isArray(values) ? values.slice() : [values]; + const opts = this.resolveOptions(options); + this.params.set(key, {values: arr, options: opts}); + return this; + } + + /** + * Append a single value to the parameter. If the parameter didn't exist it will be created + * and use resolved options (global defaults merged with any provided options). + */ + append(key: string, value: string, options?: ParamOptions): this { + const entry = this.params.get(key); + if (entry) { + // If new options provided, override the stored options for subsequent serialization + if (options) { + entry.options = this.resolveOptions({...entry.options, ...options}); + } + entry.values.push(value); + } else { + this.set(key, [value], options); + } + return this; + } + + /** + * Serialize to a query string according to per-parameter OpenAPI options. + * - If explode=true for that parameter → repeated key=value pairs (each value encoded). + * - If explode=false for that parameter → single key=value where values are individually encoded + * and joined using the configured delimiter. The delimiter character is inserted AS-IS + * (not percent-encoded). + */ + toString(): string { + const records = this.toRecord(); + const parts: string[] = []; + + for (const key in records) { + parts.push(`${key}=${records[key]}`); + } + + return parts.join("&"); + } + + /** + * Return parameters as a plain record. + * - If a parameter has exactly one value, returns that value directly. + * - If a parameter has multiple values, returns a readonly array of values. + */ + toRecord(): Record> { + const parts: Record> = {}; + + for (const [key, entry] of this.params.entries()) { + const encodedKey = this.encoder.encodeKey(key); + + if (entry.options.explode) { + parts[encodedKey] = entry.values.map((v) => this.encoder.encodeValue(v)); + } else { + const encodedValues = entry.values.map((v) => this.encoder.encodeValue(v)); + + // join with the delimiter *unencoded* + parts[encodedKey] = encodedValues.join(entry.options.delimiter); + } + } + + return parts; + } + + /** + * Return an Angular's HttpParams with an identity parameter codec as the parameters are already encoded. + */ + toHttpParams(): HttpParams { + const records = this.toRecord(); + + let httpParams = new HttpParams({encoder: new IdentityHttpParameterCodec()}); + + return httpParams.appendAll(records); + } +} + +export function concatHttpParamsObject(httpParams: OpenApiHttpParams, key: string, item: { + [index: string]: any +}, delimiter: Delimiter): OpenApiHttpParams { + let keyAndValues: string[] = []; + + for (const k in item) { + keyAndValues.push(k); + + const value = item[k]; + + if (Array.isArray(value)) { + keyAndValues.push(...value.map(convertToString)); + } else { + keyAndValues.push(convertToString(value)); + } + } + + return httpParams.set(key, keyAndValues, {explode: false, delimiter: delimiter}); +} + +function convertToString(value: any): string { + if (value instanceof Date) { + return value.toISOString(); + } else { + return value.toString(); + } +} diff --git a/src/app/services/api/variables.ts b/src/app/services/api/variables.ts new file mode 100644 index 0000000..6fe5854 --- /dev/null +++ b/src/app/services/api/variables.ts @@ -0,0 +1,9 @@ +import { InjectionToken } from '@angular/core'; + +export const BASE_PATH = new InjectionToken('basePath'); +export const COLLECTION_FORMATS = { + 'csv': ',', + 'tsv': ' ', + 'ssv': ' ', + 'pipes': '|' +}