/* tslint:disable */ /* eslint-disable */ /** * Geins Management API * Geins Management API is a RESTful api that powers your applications and helps you manage your Geins services. Geins provides an easy-to-use and scalable solution for managing all aspects of an online store, from product listings and customer information to order processing and payment transactions. :::tip Tip With this API, you can build custom applications and integrate with third-party systems, feeds, dashboards and other bussiness logic apps. ::: ## Getting started Once you have created an account, you can start using the Management API by creating an `API User`. You can create as many API users as you need. Each `API user` is connected to a specific account so you can keep track of operations and manage keys. You can find all your API credentials in `Geins Merchant Center`. ### Fast track Use one of our [SDKs](https://docs.geins.io/docs/sdk/introduction) to get started quickly. The SDKs are available for the most popular programming languages and frameworks. Or, if you prefer to just take it for a test run: [![Run in Postman](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/25895885-aaf6598f-1a7c-4949-85d7-ba846c42d553?action=collection%2Ffork&collection-url=entityId%3D25895885-aaf6598f-1a7c-4949-85d7-ba846c42d553%26entityType%3Dcollection%26workspaceId%3Da2a179ce-158e-46b0-8d06-e9640f45112c) ### Authentication Two authentication methods are required: - `Basic Auth` - `API Key` All API credentials can be found in `Geins Merchant Center`. #### Basic Auth A Basic auth `Authorization` header needs to be included in every request. The value should be `Basic ` where `` is the Base64 encoding of your `API username` and `API password` joined by a single colon `:`. See [Wikipedia](https://en.wikipedia.org/wiki/Basic_access_authentication) for more information on Basic auth. #### API Key An `X-ApiKey` header needs to be included in every request. This header should contain the value of your `API key`. #### Example ```bash curl -X GET \"https://mgmtapi.geins.io/API/Market/List\" \\ -H \"Authorization: Basic [USER-CREDENTIALS-BASE64-ENCODED]\" \\ -H \"X-ApiKey: [API-KEY]\" ``` * * The version of the OpenAPI document: v1.10.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import type { BaseEnvelope, EnvelopeProductModelsReadUploadedImage, } from '../models'; import { BaseEnvelopeFromJSON, BaseEnvelopeToJSON, EnvelopeProductModelsReadUploadedImageFromJSON, EnvelopeProductModelsReadUploadedImageToJSON, } from '../models'; export interface AddProductImageRequest { productId: string; imageName: string; payload: Blob; position?: number; isPrimaryImage?: boolean; productIdType?: AddProductImageProductIdTypeEnum; } export interface AddUpdateProductImageRequest { productId: string; imageName: string; payload: Blob; position?: number; isPrimaryImage?: boolean; productIdType?: AddUpdateProductImageProductIdTypeEnum; } export interface DeleteProductImageRequest { productId: string; imageName: string; productIdType?: DeleteProductImageProductIdTypeEnum; } /** * */ export class ProductImageApi extends runtime.BaseAPI { /** * Uploads a new image on a product. If an image with the same file name already exists, the image will still be uploaded but with a new unique name. The image is included in the body of the request as binary data. * Add product image */ async addProductImageRaw(requestParameters: AddProductImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.productId === null || requestParameters.productId === undefined) { throw new runtime.RequiredError('productId','Required parameter requestParameters.productId was null or undefined when calling addProductImage.'); } if (requestParameters.imageName === null || requestParameters.imageName === undefined) { throw new runtime.RequiredError('imageName','Required parameter requestParameters.imageName was null or undefined when calling addProductImage.'); } if (requestParameters.payload === null || requestParameters.payload === undefined) { throw new runtime.RequiredError('payload','Required parameter requestParameters.payload was null or undefined when calling addProductImage.'); } const queryParameters: any = {}; if (requestParameters.position !== undefined) { queryParameters['position'] = requestParameters.position; } if (requestParameters.isPrimaryImage !== undefined) { queryParameters['isPrimaryImage'] = requestParameters.isPrimaryImage; } if (requestParameters.productIdType !== undefined) { queryParameters['productIdType'] = requestParameters.productIdType; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'image/jpeg'; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/Product/{productId}/Image/{imageName}`.replace(`{${"productId"}}`, encodeURIComponent(String(requestParameters.productId))).replace(`{${"imageName"}}`, encodeURIComponent(String(requestParameters.imageName))), method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters.payload as any, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvelopeProductModelsReadUploadedImageFromJSON(jsonValue)); } /** * Uploads a new image on a product. If an image with the same file name already exists, the image will still be uploaded but with a new unique name. The image is included in the body of the request as binary data. * Add product image */ async addProductImage(requestParameters: AddProductImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.addProductImageRaw(requestParameters, initOverrides); return await response.value(); } /** * Creates or updates an image on a product. If an image with the same file already exists it will be replaced. The image is included in the body of the request as binary data. * Add/update product image */ async addUpdateProductImageRaw(requestParameters: AddUpdateProductImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.productId === null || requestParameters.productId === undefined) { throw new runtime.RequiredError('productId','Required parameter requestParameters.productId was null or undefined when calling addUpdateProductImage.'); } if (requestParameters.imageName === null || requestParameters.imageName === undefined) { throw new runtime.RequiredError('imageName','Required parameter requestParameters.imageName was null or undefined when calling addUpdateProductImage.'); } if (requestParameters.payload === null || requestParameters.payload === undefined) { throw new runtime.RequiredError('payload','Required parameter requestParameters.payload was null or undefined when calling addUpdateProductImage.'); } const queryParameters: any = {}; if (requestParameters.position !== undefined) { queryParameters['position'] = requestParameters.position; } if (requestParameters.isPrimaryImage !== undefined) { queryParameters['isPrimaryImage'] = requestParameters.isPrimaryImage; } if (requestParameters.productIdType !== undefined) { queryParameters['productIdType'] = requestParameters.productIdType; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'image/jpeg'; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/Product/{productId}/Image/{imageName}`.replace(`{${"productId"}}`, encodeURIComponent(String(requestParameters.productId))).replace(`{${"imageName"}}`, encodeURIComponent(String(requestParameters.imageName))), method: 'PUT', headers: headerParameters, query: queryParameters, body: requestParameters.payload as any, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvelopeProductModelsReadUploadedImageFromJSON(jsonValue)); } /** * Creates or updates an image on a product. If an image with the same file already exists it will be replaced. The image is included in the body of the request as binary data. * Add/update product image */ async addUpdateProductImage(requestParameters: AddUpdateProductImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.addUpdateProductImageRaw(requestParameters, initOverrides); return await response.value(); } /** * Deletes an image on a product. Does not delete the physical image file from storage. * Delete product image */ async deleteProductImageRaw(requestParameters: DeleteProductImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.productId === null || requestParameters.productId === undefined) { throw new runtime.RequiredError('productId','Required parameter requestParameters.productId was null or undefined when calling deleteProductImage.'); } if (requestParameters.imageName === null || requestParameters.imageName === undefined) { throw new runtime.RequiredError('imageName','Required parameter requestParameters.imageName was null or undefined when calling deleteProductImage.'); } const queryParameters: any = {}; if (requestParameters.productIdType !== undefined) { queryParameters['productIdType'] = requestParameters.productIdType; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/Product/{productId}/Image/{imageName}`.replace(`{${"productId"}}`, encodeURIComponent(String(requestParameters.productId))).replace(`{${"imageName"}}`, encodeURIComponent(String(requestParameters.imageName))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BaseEnvelopeFromJSON(jsonValue)); } /** * Deletes an image on a product. Does not delete the physical image file from storage. * Delete product image */ async deleteProductImage(requestParameters: DeleteProductImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.deleteProductImageRaw(requestParameters, initOverrides); return await response.value(); } } /** * @export */ export const AddProductImageProductIdTypeEnum = { NUMBER_0: 0, NUMBER_1: 1, NUMBER_2: 2, NUMBER_3: 3 } as const; export type AddProductImageProductIdTypeEnum = typeof AddProductImageProductIdTypeEnum[keyof typeof AddProductImageProductIdTypeEnum]; /** * @export */ export const AddUpdateProductImageProductIdTypeEnum = { NUMBER_0: 0, NUMBER_1: 1, NUMBER_2: 2, NUMBER_3: 3 } as const; export type AddUpdateProductImageProductIdTypeEnum = typeof AddUpdateProductImageProductIdTypeEnum[keyof typeof AddUpdateProductImageProductIdTypeEnum]; /** * @export */ export const DeleteProductImageProductIdTypeEnum = { NUMBER_0: 0, NUMBER_1: 1, NUMBER_2: 2, NUMBER_3: 3 } as const; export type DeleteProductImageProductIdTypeEnum = typeof DeleteProductImageProductIdTypeEnum[keyof typeof DeleteProductImageProductIdTypeEnum];