diff --git a/src/app/services/api/.openapi-generator/FILES b/src/app/services/api/.openapi-generator/FILES index baa058f..0f53e7c 100644 --- a/src/app/services/api/.openapi-generator/FILES +++ b/src/app/services/api/.openapi-generator/FILES @@ -31,6 +31,8 @@ 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-login-response-dto.ts +model/knots-dto-user-login-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 diff --git a/src/app/services/api/api/users.service.ts b/src/app/services/api/api/users.service.ts index 6ebc6cd..14300a0 100644 --- a/src/app/services/api/api/users.service.ts +++ b/src/app/services/api/api/users.service.ts @@ -25,6 +25,10 @@ import { KnotsDTOUserDeleteUserDto } from '../model/knots-dto-user-delete-user-d // @ts-ignore import { KnotsDTOUserGetUserDto } from '../model/knots-dto-user-get-user-dto'; // @ts-ignore +import { KnotsDTOUserLoginResponseDto } from '../model/knots-dto-user-login-response-dto'; +// @ts-ignore +import { KnotsDTOUserLoginUserDto } from '../model/knots-dto-user-login-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'; @@ -345,6 +349,71 @@ export class UsersService extends BaseService { ); } + /** + * @endpoint post /API/users/login + * @param knotsDTOUserLoginUserDto + * @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 loginEndpoint(knotsDTOUserLoginUserDto: KnotsDTOUserLoginUserDto, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public loginEndpoint(knotsDTOUserLoginUserDto: KnotsDTOUserLoginUserDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public loginEndpoint(knotsDTOUserLoginUserDto: KnotsDTOUserLoginUserDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public loginEndpoint(knotsDTOUserLoginUserDto: KnotsDTOUserLoginUserDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (knotsDTOUserLoginUserDto === null || knotsDTOUserLoginUserDto === undefined) { + throw new Error('Required parameter knotsDTOUserLoginUserDto was null or undefined when calling loginEndpoint.'); + } + + 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/login`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: knotsDTOUserLoginUserDto, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + /** * @endpoint patch /API/users/{Id}/contact * @param id diff --git a/src/app/services/api/chat.service.ts b/src/app/services/api/chat.service.ts deleted file mode 100644 index a4dd04d..0000000 --- a/src/app/services/api/chat.service.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HubConnection, HubConnectionBuilder, HubConnectionState } from '@microsoft/signalr'; - -@Injectable({ providedIn: 'root' }) -export class ChatService { - - private hub: HubConnection; - - constructor() { - this.hub = new HubConnectionBuilder() - .withUrl('https://localhost:5001/hubs/chat') - .withAutomaticReconnect() - .build(); - } - - async connect() { - if (this.hub.state === HubConnectionState.Disconnected) { - await this.hub.start(); - } - } - - async sendMessage(discussionId: string, content: string) { - await this.connect(); // s'assure que la connexion est active - await this.hub.invoke('SendMessage', discussionId, content); - } - - onMessage(callback: (message: any) => void) { - this.hub.on('ReceiveMessage', callback); - } -} \ No newline at end of file diff --git a/src/app/services/api/discussion.service.ts b/src/app/services/api/discussion.service.ts deleted file mode 100644 index 4c14d21..0000000 --- a/src/app/services/api/discussion.service.ts +++ /dev/null @@ -1,15 +0,0 @@ -import {Observable} from "rxjs"; -import {Discussion} from "../../pages/menu/menu-users/menu-users.component"; -import {HttpClient} from "@angular/common/http"; -import {inject, Injectable} from "@angular/core"; - -@Injectable({ providedIn: 'root' }) -export class discussionsService { - - private http = inject(HttpClient); - private apiUrl = 'https://localhost:5001/API'; - - getDiscussions(): Observable { - return this.http.get(`${this.apiUrl}/discussions`); - } -} \ No newline at end of file diff --git a/src/app/services/api/model/knots-dto-user-login-response-dto.ts b/src/app/services/api/model/knots-dto-user-login-response-dto.ts new file mode 100644 index 0000000..5599c97 --- /dev/null +++ b/src/app/services/api/model/knots-dto-user-login-response-dto.ts @@ -0,0 +1,21 @@ +/** + * 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 KnotsDTOUserLoginResponseDto { + token?: string | null; + id?: number; + username?: string | null; + email?: string | null; + tel?: string | null; + profilePicture?: string | null; + description?: string | null; +} + diff --git a/src/app/services/api/model/knots-dto-user-login-user-dto.ts b/src/app/services/api/model/knots-dto-user-login-user-dto.ts new file mode 100644 index 0000000..e0ff9e2 --- /dev/null +++ b/src/app/services/api/model/knots-dto-user-login-user-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 KnotsDTOUserLoginUserDto { + username?: string | null; + password?: string | null; +} + diff --git a/src/app/services/api/model/models.ts b/src/app/services/api/model/models.ts index a9690cf..a4aece7 100644 --- a/src/app/services/api/model/models.ts +++ b/src/app/services/api/model/models.ts @@ -15,8 +15,10 @@ 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-login-response-dto'; +export * from './knots-dto-user-login-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'; \ No newline at end of file +export * from './knots-dto-user-update-username-dto';