/** * Magento Community * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: 2.2 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ /* tslint:disable:no-unused-variable member-ordering */ import { Inject, Injectable, Optional } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams, HttpResponse, HttpEvent } from '@angular/common/http'; import { CustomHttpUrlEncodingCodec } from '../encoder'; import { Observable } from 'rxjs/Observable'; import { BundleDataLinkInterface } from '../model/bundleDataLinkInterface'; import { BundleProductLinkManagementV1AddChildByProductSkuPostBody } from '../model/bundleProductLinkManagementV1AddChildByProductSkuPostBody'; import { BundleProductLinkManagementV1SaveChildPutBody } from '../model/bundleProductLinkManagementV1SaveChildPutBody'; import { ErrorResponse } from '../model/errorResponse'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; @Injectable() export class BundleProductLinkManagementV1Service { protected basePath = 'http://shop.sergiofabbri.com/rest'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { this.basePath = basePath; } if (configuration) { this.configuration = configuration; this.basePath = basePath || configuration.basePath || this.basePath; } } /** * @param consumes string[] mime-types * @return true: consumes contains 'multipart/form-data', false: otherwise */ private canConsumeForm(consumes: string[]): boolean { const form = 'multipart/form-data'; for (let consume of consumes) { if (form === consume) { return true; } } return false; } /** * * Add child product to specified Bundle option by product sku * @param sku * @param optionId * @param bundleProductLinkManagementV1AddChildByProductSkuPostBody * @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. */ public bundleProductLinkManagementV1AddChildByProductSkuPost(sku: string, optionId: number, bundleProductLinkManagementV1AddChildByProductSkuPostBody?: BundleProductLinkManagementV1AddChildByProductSkuPostBody, observe?: 'body', reportProgress?: boolean): Observable; public bundleProductLinkManagementV1AddChildByProductSkuPost(sku: string, optionId: number, bundleProductLinkManagementV1AddChildByProductSkuPostBody?: BundleProductLinkManagementV1AddChildByProductSkuPostBody, observe?: 'response', reportProgress?: boolean): Observable>; public bundleProductLinkManagementV1AddChildByProductSkuPost(sku: string, optionId: number, bundleProductLinkManagementV1AddChildByProductSkuPostBody?: BundleProductLinkManagementV1AddChildByProductSkuPostBody, observe?: 'events', reportProgress?: boolean): Observable>; public bundleProductLinkManagementV1AddChildByProductSkuPost(sku: string, optionId: number, bundleProductLinkManagementV1AddChildByProductSkuPostBody?: BundleProductLinkManagementV1AddChildByProductSkuPostBody, observe: any = 'body', reportProgress: boolean = false ): Observable { if (sku === null || sku === undefined) { throw new Error('Required parameter sku was null or undefined when calling bundleProductLinkManagementV1AddChildByProductSkuPost.'); } if (optionId === null || optionId === undefined) { throw new Error('Required parameter optionId was null or undefined when calling bundleProductLinkManagementV1AddChildByProductSkuPost.'); } let headers = this.defaultHeaders; // to determine the Accept header let httpHeaderAccepts: string[] = [ ]; let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { headers = headers.set("Accept", httpHeaderAcceptSelected); } // to determine the Content-Type header let consumes: string[] = [ ]; let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers = headers.set("Content-Type", httpContentTypeSelected); } return this.httpClient.post(`${this.basePath}/V1/bundle-products/${encodeURIComponent(String(sku))}/links/${encodeURIComponent(String(optionId))}`, bundleProductLinkManagementV1AddChildByProductSkuPostBody, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * * Get all children for Bundle product * @param productSku * @param optionId * @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. */ public bundleProductLinkManagementV1GetChildrenGet(productSku: string, optionId?: number, observe?: 'body', reportProgress?: boolean): Observable>; public bundleProductLinkManagementV1GetChildrenGet(productSku: string, optionId?: number, observe?: 'response', reportProgress?: boolean): Observable>>; public bundleProductLinkManagementV1GetChildrenGet(productSku: string, optionId?: number, observe?: 'events', reportProgress?: boolean): Observable>>; public bundleProductLinkManagementV1GetChildrenGet(productSku: string, optionId?: number, observe: any = 'body', reportProgress: boolean = false ): Observable { if (productSku === null || productSku === undefined) { throw new Error('Required parameter productSku was null or undefined when calling bundleProductLinkManagementV1GetChildrenGet.'); } let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()}); if (optionId !== undefined) { queryParameters = queryParameters.set('optionId', optionId); } let headers = this.defaultHeaders; // to determine the Accept header let httpHeaderAccepts: string[] = [ ]; let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { headers = headers.set("Accept", httpHeaderAcceptSelected); } // to determine the Content-Type header let consumes: string[] = [ ]; return this.httpClient.get>(`${this.basePath}/V1/bundle-products/${encodeURIComponent(String(productSku))}/children`, { params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * * Remove product from Bundle product option * @param sku * @param optionId * @param childSku * @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. */ public bundleProductLinkManagementV1RemoveChildDelete(sku: string, optionId: number, childSku: string, observe?: 'body', reportProgress?: boolean): Observable; public bundleProductLinkManagementV1RemoveChildDelete(sku: string, optionId: number, childSku: string, observe?: 'response', reportProgress?: boolean): Observable>; public bundleProductLinkManagementV1RemoveChildDelete(sku: string, optionId: number, childSku: string, observe?: 'events', reportProgress?: boolean): Observable>; public bundleProductLinkManagementV1RemoveChildDelete(sku: string, optionId: number, childSku: string, observe: any = 'body', reportProgress: boolean = false ): Observable { if (sku === null || sku === undefined) { throw new Error('Required parameter sku was null or undefined when calling bundleProductLinkManagementV1RemoveChildDelete.'); } if (optionId === null || optionId === undefined) { throw new Error('Required parameter optionId was null or undefined when calling bundleProductLinkManagementV1RemoveChildDelete.'); } if (childSku === null || childSku === undefined) { throw new Error('Required parameter childSku was null or undefined when calling bundleProductLinkManagementV1RemoveChildDelete.'); } let headers = this.defaultHeaders; // to determine the Accept header let httpHeaderAccepts: string[] = [ ]; let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { headers = headers.set("Accept", httpHeaderAcceptSelected); } // to determine the Content-Type header let consumes: string[] = [ ]; return this.httpClient.delete(`${this.basePath}/V1/bundle-products/${encodeURIComponent(String(sku))}/options/${encodeURIComponent(String(optionId))}/children/${encodeURIComponent(String(childSku))}`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * * * @param sku * @param id * @param bundleProductLinkManagementV1SaveChildPutBody * @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. */ public bundleProductLinkManagementV1SaveChildPut(sku: string, id: string, bundleProductLinkManagementV1SaveChildPutBody?: BundleProductLinkManagementV1SaveChildPutBody, observe?: 'body', reportProgress?: boolean): Observable; public bundleProductLinkManagementV1SaveChildPut(sku: string, id: string, bundleProductLinkManagementV1SaveChildPutBody?: BundleProductLinkManagementV1SaveChildPutBody, observe?: 'response', reportProgress?: boolean): Observable>; public bundleProductLinkManagementV1SaveChildPut(sku: string, id: string, bundleProductLinkManagementV1SaveChildPutBody?: BundleProductLinkManagementV1SaveChildPutBody, observe?: 'events', reportProgress?: boolean): Observable>; public bundleProductLinkManagementV1SaveChildPut(sku: string, id: string, bundleProductLinkManagementV1SaveChildPutBody?: BundleProductLinkManagementV1SaveChildPutBody, observe: any = 'body', reportProgress: boolean = false ): Observable { if (sku === null || sku === undefined) { throw new Error('Required parameter sku was null or undefined when calling bundleProductLinkManagementV1SaveChildPut.'); } if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling bundleProductLinkManagementV1SaveChildPut.'); } let headers = this.defaultHeaders; // to determine the Accept header let httpHeaderAccepts: string[] = [ ]; let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected != undefined) { headers = headers.set("Accept", httpHeaderAcceptSelected); } // to determine the Content-Type header let consumes: string[] = [ ]; let httpContentTypeSelected:string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected != undefined) { headers = headers.set("Content-Type", httpContentTypeSelected); } return this.httpClient.put(`${this.basePath}/V1/bundle-products/${encodeURIComponent(String(sku))}/links/${encodeURIComponent(String(id))}`, bundleProductLinkManagementV1SaveChildPutBody, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } }