{{#apiInfo}} {{#apis}} {{#operations}} import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { environment } from '@environment'; import { MRepository } from '@mercadona/core/utils/repository'; import { {{classname}}Repository } from '@/domain/repositories/{{classFilename}}.repository.contract'; {{#returnImports}} import { {{classname}}Dto } from '@/dtos/{{classFilename}}.dto'; import { {{classname}} } from '@/entities/models/{{classFilename}}.model'; import { {{classVarName}}Mapper } from '@/mappers/{{classFilename}}.mapper'; {{/returnImports}} {{#paramImports}} import { {{classname}} } from '@/entities/models/{{classFilename}}.model'; {{/paramImports}} /** * {{classname}} Repository Implementation * Generated from OpenAPI tag: {{classname}} */ @Injectable() export class {{classname}}RepositoryImpl extends MRepository implements {{classname}}Repository { constructor() { super(`${environment.{{environmentApiKey}}.url}`); } {{#operation}} {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{^-last}}, {{/-last}}{{/allParams}}): Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> { {{#isListContainer}} return this.{{httpMethod}}<{{{returnBaseType}}}Dto>('{{path}}'{{#hasOptions}}, { {{#hasQueryParams}}params: { {{#queryParams}}{{paramName}}{{^-last}}, {{/-last}}{{/queryParams}} }{{/hasQueryParams}}{{#hasBothParamsAndBody}}, {{/hasBothParamsAndBody}}{{#hasBodyParam}}body{{/hasBodyParam}} }{{/hasOptions}}) .pipe( map((response) => response.{{#vendorExtensions}}{{x-response-property}}{{/vendorExtensions}}{{^vendorExtensions}}items{{/vendorExtensions}}.map({{{returnBaseTypeVarName}}}Mapper)) ); {{/isListContainer}} {{^isListContainer}} {{#returnType}} return this.{{httpMethod}}<{{{returnType}}}Dto>('{{path}}'{{#hasOptions}}, { {{#hasQueryParams}}params: { {{#queryParams}}{{paramName}}{{^-last}}, {{/-last}}{{/queryParams}} }{{/hasQueryParams}}{{#hasBothParamsAndBody}}, {{/hasBothParamsAndBody}}{{#hasBodyParam}}body{{/hasBodyParam}} }{{/hasOptions}}) .pipe( map({{{returnTypeVarName}}}Mapper) ); {{/returnType}} {{^returnType}} return this.{{httpMethod}}('{{path}}'{{#hasOptions}}, { {{#hasQueryParams}}params: { {{#queryParams}}{{paramName}}{{^-last}}, {{/-last}}{{/queryParams}} }{{/hasQueryParams}}{{#hasBothParamsAndBody}}, {{/hasBothParamsAndBody}}{{#hasBodyParam}}body{{/hasBodyParam}} }{{/hasOptions}}); {{/returnType}} {{/isListContainer}} } {{/operation}} } {{/operations}} {{/apis}} {{/apiInfo}}