openapi fait

This commit is contained in:
2026-06-10 13:53:50 +02:00
parent eb87d15f94
commit cb0ebe3c92
7 changed files with 111 additions and 46 deletions
@@ -31,6 +31,8 @@ model/knots-dto-role-delete-role-dto.ts
model/knots-dto-user-create-user-dto.ts model/knots-dto-user-create-user-dto.ts
model/knots-dto-user-delete-user-dto.ts model/knots-dto-user-delete-user-dto.ts
model/knots-dto-user-get-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-contact-dto.ts
model/knots-dto-user-update-user-description-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-password-dto.ts
+69
View File
@@ -25,6 +25,10 @@ import { KnotsDTOUserDeleteUserDto } from '../model/knots-dto-user-delete-user-d
// @ts-ignore // @ts-ignore
import { KnotsDTOUserGetUserDto } from '../model/knots-dto-user-get-user-dto'; import { KnotsDTOUserGetUserDto } from '../model/knots-dto-user-get-user-dto';
// @ts-ignore // @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'; import { KnotsDTOUserUpdateUserContactDto } from '../model/knots-dto-user-update-user-contact-dto';
// @ts-ignore // @ts-ignore
import { KnotsDTOUserUpdateUserDescriptionDto } from '../model/knots-dto-user-update-user-description-dto'; 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<KnotsDTOUserLoginResponseDto>;
public loginEndpoint(knotsDTOUserLoginUserDto: KnotsDTOUserLoginUserDto, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<KnotsDTOUserLoginResponseDto>>;
public loginEndpoint(knotsDTOUserLoginUserDto: KnotsDTOUserLoginUserDto, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<KnotsDTOUserLoginResponseDto>>;
public loginEndpoint(knotsDTOUserLoginUserDto: KnotsDTOUserLoginUserDto, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
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<KnotsDTOUserLoginResponseDto>('post', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
body: knotsDTOUserLoginUserDto,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/** /**
* @endpoint patch /API/users/{Id}/contact * @endpoint patch /API/users/{Id}/contact
* @param id * @param id
-30
View File
@@ -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);
}
}
@@ -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<Discussion[]> {
return this.http.get<Discussion[]>(`${this.apiUrl}/discussions`);
}
}
@@ -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;
}
@@ -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;
}
+3 -1
View File
@@ -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-create-user-dto';
export * from './knots-dto-user-delete-user-dto'; export * from './knots-dto-user-delete-user-dto';
export * from './knots-dto-user-get-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-contact-dto';
export * from './knots-dto-user-update-user-description-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-password-dto';
export * from './knots-dto-user-update-user-profile-picture-dto'; export * from './knots-dto-user-update-user-profile-picture-dto';
export * from './knots-dto-user-update-username-dto'; export * from './knots-dto-user-update-username-dto';