/* @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 = 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; productsControllerFindAll(observe?: 'response', options?: RequestOptions<'json'>): Observable>; productsControllerFindAll(observe?: 'events', options?: RequestOptions<'json'>): Observable>; productsControllerFindAll(observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable { 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; productsControllerCreate(createProductDto: CreateProductDto, observe?: 'response', options?: RequestOptions<'json'>): Observable>; productsControllerCreate(createProductDto: CreateProductDto, observe?: 'events', options?: RequestOptions<'json'>): Observable>; productsControllerCreate(createProductDto: CreateProductDto, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable { 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; productsControllerSearch(q: string, page: number, limit: number, observe?: 'response', options?: RequestOptions<'json'>): Observable>; productsControllerSearch(q: string, page: number, limit: number, observe?: 'events', options?: RequestOptions<'json'>): Observable>; productsControllerSearch(q: string, page: number, limit: number, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable { 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; productsControllerFindOne(id: number, observe?: 'response', options?: RequestOptions<'json'>): Observable>; productsControllerFindOne(id: number, observe?: 'events', options?: RequestOptions<'json'>): Observable>; productsControllerFindOne(id: number, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable { 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; productsControllerUpdate(id: number, updateProductDto: UpdateProductDto, observe?: 'response', options?: RequestOptions<'json'>): Observable>; productsControllerUpdate(id: number, updateProductDto: UpdateProductDto, observe?: 'events', options?: RequestOptions<'json'>): Observable>; productsControllerUpdate(id: number, updateProductDto: UpdateProductDto, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable { 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; productsControllerRemove(id: number, observe?: 'response', options?: RequestOptions<'json'>): Observable>; productsControllerRemove(id: number, observe?: 'events', options?: RequestOptions<'json'>): Observable>; productsControllerRemove(id: number, observe?: 'body' | 'events' | 'response', options?: RequestOptions<'arraybuffer' | 'blob' | 'json' | 'text'>): Observable { 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); } }