/** * 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 { CatalogDataProductAttributeMediaGalleryEntryInterface } from '../model/catalogDataProductAttributeMediaGalleryEntryInterface'; import { CatalogProductAttributeMediaGalleryManagementV1CreatePostBody } from '../model/catalogProductAttributeMediaGalleryManagementV1CreatePostBody'; import { CatalogProductAttributeMediaGalleryManagementV1UpdatePutBody } from '../model/catalogProductAttributeMediaGalleryManagementV1UpdatePutBody'; import { ErrorResponse } from '../model/errorResponse'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; @Injectable() export class CatalogProductAttributeMediaGalleryManagementV1Service { 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; } /** * * Create new gallery entry * @param sku * @param catalogProductAttributeMediaGalleryManagementV1CreatePostBody * @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 catalogProductAttributeMediaGalleryManagementV1CreatePost(sku: string, catalogProductAttributeMediaGalleryManagementV1CreatePostBody?: CatalogProductAttributeMediaGalleryManagementV1CreatePostBody, observe?: 'body', reportProgress?: boolean): Observable; public catalogProductAttributeMediaGalleryManagementV1CreatePost(sku: string, catalogProductAttributeMediaGalleryManagementV1CreatePostBody?: CatalogProductAttributeMediaGalleryManagementV1CreatePostBody, observe?: 'response', reportProgress?: boolean): Observable>; public catalogProductAttributeMediaGalleryManagementV1CreatePost(sku: string, catalogProductAttributeMediaGalleryManagementV1CreatePostBody?: CatalogProductAttributeMediaGalleryManagementV1CreatePostBody, observe?: 'events', reportProgress?: boolean): Observable>; public catalogProductAttributeMediaGalleryManagementV1CreatePost(sku: string, catalogProductAttributeMediaGalleryManagementV1CreatePostBody?: CatalogProductAttributeMediaGalleryManagementV1CreatePostBody, observe: any = 'body', reportProgress: boolean = false ): Observable { if (sku === null || sku === undefined) { throw new Error('Required parameter sku was null or undefined when calling catalogProductAttributeMediaGalleryManagementV1CreatePost.'); } 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/products/${encodeURIComponent(String(sku))}/media`, catalogProductAttributeMediaGalleryManagementV1CreatePostBody, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * * Return information about gallery entry * @param sku * @param entryId * @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 catalogProductAttributeMediaGalleryManagementV1GetGet(sku: string, entryId: number, observe?: 'body', reportProgress?: boolean): Observable; public catalogProductAttributeMediaGalleryManagementV1GetGet(sku: string, entryId: number, observe?: 'response', reportProgress?: boolean): Observable>; public catalogProductAttributeMediaGalleryManagementV1GetGet(sku: string, entryId: number, observe?: 'events', reportProgress?: boolean): Observable>; public catalogProductAttributeMediaGalleryManagementV1GetGet(sku: string, entryId: number, observe: any = 'body', reportProgress: boolean = false ): Observable { if (sku === null || sku === undefined) { throw new Error('Required parameter sku was null or undefined when calling catalogProductAttributeMediaGalleryManagementV1GetGet.'); } if (entryId === null || entryId === undefined) { throw new Error('Required parameter entryId was null or undefined when calling catalogProductAttributeMediaGalleryManagementV1GetGet.'); } 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/products/${encodeURIComponent(String(sku))}/media/${encodeURIComponent(String(entryId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * * Retrieve the list of gallery entries associated with given product * @param sku * @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 catalogProductAttributeMediaGalleryManagementV1GetListGet(sku: string, observe?: 'body', reportProgress?: boolean): Observable>; public catalogProductAttributeMediaGalleryManagementV1GetListGet(sku: string, observe?: 'response', reportProgress?: boolean): Observable>>; public catalogProductAttributeMediaGalleryManagementV1GetListGet(sku: string, observe?: 'events', reportProgress?: boolean): Observable>>; public catalogProductAttributeMediaGalleryManagementV1GetListGet(sku: 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 catalogProductAttributeMediaGalleryManagementV1GetListGet.'); } 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/products/${encodeURIComponent(String(sku))}/media`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * * Remove gallery entry * @param sku * @param entryId * @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 catalogProductAttributeMediaGalleryManagementV1RemoveDelete(sku: string, entryId: number, observe?: 'body', reportProgress?: boolean): Observable; public catalogProductAttributeMediaGalleryManagementV1RemoveDelete(sku: string, entryId: number, observe?: 'response', reportProgress?: boolean): Observable>; public catalogProductAttributeMediaGalleryManagementV1RemoveDelete(sku: string, entryId: number, observe?: 'events', reportProgress?: boolean): Observable>; public catalogProductAttributeMediaGalleryManagementV1RemoveDelete(sku: string, entryId: number, observe: any = 'body', reportProgress: boolean = false ): Observable { if (sku === null || sku === undefined) { throw new Error('Required parameter sku was null or undefined when calling catalogProductAttributeMediaGalleryManagementV1RemoveDelete.'); } if (entryId === null || entryId === undefined) { throw new Error('Required parameter entryId was null or undefined when calling catalogProductAttributeMediaGalleryManagementV1RemoveDelete.'); } 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/products/${encodeURIComponent(String(sku))}/media/${encodeURIComponent(String(entryId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * * Update gallery entry * @param sku * @param entryId * @param catalogProductAttributeMediaGalleryManagementV1UpdatePutBody * @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 catalogProductAttributeMediaGalleryManagementV1UpdatePut(sku: string, entryId: string, catalogProductAttributeMediaGalleryManagementV1UpdatePutBody?: CatalogProductAttributeMediaGalleryManagementV1UpdatePutBody, observe?: 'body', reportProgress?: boolean): Observable; public catalogProductAttributeMediaGalleryManagementV1UpdatePut(sku: string, entryId: string, catalogProductAttributeMediaGalleryManagementV1UpdatePutBody?: CatalogProductAttributeMediaGalleryManagementV1UpdatePutBody, observe?: 'response', reportProgress?: boolean): Observable>; public catalogProductAttributeMediaGalleryManagementV1UpdatePut(sku: string, entryId: string, catalogProductAttributeMediaGalleryManagementV1UpdatePutBody?: CatalogProductAttributeMediaGalleryManagementV1UpdatePutBody, observe?: 'events', reportProgress?: boolean): Observable>; public catalogProductAttributeMediaGalleryManagementV1UpdatePut(sku: string, entryId: string, catalogProductAttributeMediaGalleryManagementV1UpdatePutBody?: CatalogProductAttributeMediaGalleryManagementV1UpdatePutBody, observe: any = 'body', reportProgress: boolean = false ): Observable { if (sku === null || sku === undefined) { throw new Error('Required parameter sku was null or undefined when calling catalogProductAttributeMediaGalleryManagementV1UpdatePut.'); } if (entryId === null || entryId === undefined) { throw new Error('Required parameter entryId was null or undefined when calling catalogProductAttributeMediaGalleryManagementV1UpdatePut.'); } 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/products/${encodeURIComponent(String(sku))}/media/${encodeURIComponent(String(entryId))}`, catalogProductAttributeMediaGalleryManagementV1UpdatePutBody, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } }