136 lines
7.3 KiB
TypeScript
136 lines
7.3 KiB
TypeScript
/* @ts-nocheck */
|
|
/* eslint-disable */
|
|
/* @noformat */
|
|
/* @formatter:off */
|
|
/**
|
|
* Generated by ng-openapi
|
|
* Generated Angular service for Products controller
|
|
* Do not edit this file manually
|
|
*/
|
|
import { HttpClient, HttpContext, HttpContextToken, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from "@angular/common/http";
|
|
import { inject, Injectable } from "@angular/core";
|
|
import { Observable } from "rxjs";
|
|
import { BASE_PATH_DEFAULT, CLIENT_CONTEXT_TOKEN_DEFAULT } from "../tokens";
|
|
import { HttpParamsBuilder } from "../utils/http-params-builder";
|
|
import { RequestOptions, CreateProductDto, UpdateProductDto } from "../models";
|
|
|
|
@Injectable({ providedIn: "root" })
|
|
export class ProductsService {
|
|
private readonly httpClient: HttpClient = inject(HttpClient);
|
|
private readonly basePath: string = inject(BASE_PATH_DEFAULT);
|
|
private readonly clientContextToken: HttpContextToken<string> = CLIENT_CONTEXT_TOKEN_DEFAULT;
|
|
|
|
private createContextWithClientId(existingContext?: HttpContext): HttpContext {
|
|
const context = existingContext || new HttpContext();
|
|
return context.set(this.clientContextToken, 'default');
|
|
}
|
|
|
|
productsControllerFindAll(observe?: 'body', options?: RequestOptions<'json'>): Observable<any>;
|
|
productsControllerFindAll(observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<any>>;
|
|
productsControllerFindAll(observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<any>>;
|
|
productsControllerFindAll(observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
|
const url = `${this.basePath}/api/products`;
|
|
|
|
const requestOptions: any = {
|
|
observe: observe as any,
|
|
reportProgress: options?.reportProgress,
|
|
withCredentials: options?.withCredentials,
|
|
context: this.createContextWithClientId(options?.context)
|
|
};
|
|
|
|
return this.httpClient.get(url, requestOptions);
|
|
}
|
|
|
|
productsControllerCreate(createProductDto: CreateProductDto, observe?: 'body', options?: RequestOptions<'json'>): Observable<any>;
|
|
productsControllerCreate(createProductDto: CreateProductDto, observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<any>>;
|
|
productsControllerCreate(createProductDto: CreateProductDto, observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<any>>;
|
|
productsControllerCreate(createProductDto: CreateProductDto, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
|
const url = `${this.basePath}/api/products`;
|
|
|
|
const requestOptions: any = {
|
|
observe: observe as any,
|
|
reportProgress: options?.reportProgress,
|
|
withCredentials: options?.withCredentials,
|
|
context: this.createContextWithClientId(options?.context)
|
|
};
|
|
|
|
return this.httpClient.post(url, createProductDto, requestOptions);
|
|
}
|
|
|
|
productsControllerSearch(q: string, page: number, limit: number, observe?: 'body', options?: RequestOptions<'json'>): Observable<any>;
|
|
productsControllerSearch(q: string, page: number, limit: number, observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<any>>;
|
|
productsControllerSearch(q: string, page: number, limit: number, observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<any>>;
|
|
productsControllerSearch(q: string, page: number, limit: number, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
|
const url = `${this.basePath}/api/products/search`;
|
|
|
|
let params = new HttpParams();
|
|
if (q != null) {
|
|
params = HttpParamsBuilder.addToHttpParams(params, q, 'q');
|
|
}
|
|
if (page != null) {
|
|
params = HttpParamsBuilder.addToHttpParams(params, page, 'page');
|
|
}
|
|
if (limit != null) {
|
|
params = HttpParamsBuilder.addToHttpParams(params, limit, 'limit');
|
|
}
|
|
|
|
const requestOptions: any = {
|
|
observe: observe as any,
|
|
params,
|
|
reportProgress: options?.reportProgress,
|
|
withCredentials: options?.withCredentials,
|
|
context: this.createContextWithClientId(options?.context)
|
|
};
|
|
|
|
return this.httpClient.get(url, requestOptions);
|
|
}
|
|
|
|
productsControllerFindOne(id: number, observe?: 'body', options?: RequestOptions<'json'>): Observable<any>;
|
|
productsControllerFindOne(id: number, observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<any>>;
|
|
productsControllerFindOne(id: number, observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<any>>;
|
|
productsControllerFindOne(id: number, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
|
const url = `${this.basePath}/api/products/${id}`;
|
|
|
|
const requestOptions: any = {
|
|
observe: observe as any,
|
|
reportProgress: options?.reportProgress,
|
|
withCredentials: options?.withCredentials,
|
|
context: this.createContextWithClientId(options?.context)
|
|
};
|
|
|
|
return this.httpClient.get(url, requestOptions);
|
|
}
|
|
|
|
productsControllerUpdate(id: number, updateProductDto: UpdateProductDto, observe?: 'body', options?: RequestOptions<'json'>): Observable<any>;
|
|
productsControllerUpdate(id: number, updateProductDto: UpdateProductDto, observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<any>>;
|
|
productsControllerUpdate(id: number, updateProductDto: UpdateProductDto, observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<any>>;
|
|
productsControllerUpdate(id: number, updateProductDto: UpdateProductDto, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
|
const url = `${this.basePath}/api/products/${id}`;
|
|
|
|
const requestOptions: any = {
|
|
observe: observe as any,
|
|
reportProgress: options?.reportProgress,
|
|
withCredentials: options?.withCredentials,
|
|
context: this.createContextWithClientId(options?.context)
|
|
};
|
|
|
|
return this.httpClient.patch(url, updateProductDto, requestOptions);
|
|
}
|
|
|
|
productsControllerRemove(id: number, observe?: 'body', options?: RequestOptions<'json'>): Observable<any>;
|
|
productsControllerRemove(id: number, observe?: 'response', options?: RequestOptions<'json'>): Observable<HttpResponse<any>>;
|
|
productsControllerRemove(id: number, observe?: 'events', options?: RequestOptions<'json'>): Observable<HttpEvent<any>>;
|
|
productsControllerRemove(id: number, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable<any> {
|
|
const url = `${this.basePath}/api/products/${id}`;
|
|
|
|
const requestOptions: any = {
|
|
observe: observe as any,
|
|
reportProgress: options?.reportProgress,
|
|
withCredentials: options?.withCredentials,
|
|
context: this.createContextWithClientId(options?.context)
|
|
};
|
|
|
|
return this.httpClient.delete(url, requestOptions);
|
|
}
|
|
}
|