channel3-sdk
Version:
The official TypeScript/JavaScript SDK for Channel3 AI Shopping API
151 lines • 6.5 kB
JavaScript
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.0
*
*
* 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 { BrandFromJSON, PaginatedResponseBrandFromJSON, ProductFromJSON, ProductDetailFromJSON, SearchRequestToJSON, } from '../models/index';
/**
*
*/
export class Channel3ApiApi extends runtime.BaseAPI {
/**
* Get detailed information for a specific brand by its ID.
* Get Brand Detail
*/
async getBrandDetailV0BrandsBrandIdGetRaw(requestParameters, initOverrides) {
if (requestParameters['brandId'] == null) {
throw new runtime.RequiredError('brandId', 'Required parameter "brandId" was null or undefined when calling getBrandDetailV0BrandsBrandIdGet().');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // APIKeyHeader authentication
}
let urlPath = `/v0/brands/{brand_id}`;
urlPath = urlPath.replace(`{${"brand_id"}}`, encodeURIComponent(String(requestParameters['brandId'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => BrandFromJSON(jsonValue));
}
/**
* Get detailed information for a specific brand by its ID.
* Get Brand Detail
*/
async getBrandDetailV0BrandsBrandIdGet(requestParameters, initOverrides) {
const response = await this.getBrandDetailV0BrandsBrandIdGetRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get all brands that the vendor currently sells.
* Get Brands
*/
async getBrandsV0BrandsGetRaw(requestParameters, initOverrides) {
const queryParameters = {};
if (requestParameters['query'] != null) {
queryParameters['query'] = requestParameters['query'];
}
if (requestParameters['page'] != null) {
queryParameters['page'] = requestParameters['page'];
}
if (requestParameters['size'] != null) {
queryParameters['size'] = requestParameters['size'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // APIKeyHeader authentication
}
let urlPath = `/v0/brands`;
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => PaginatedResponseBrandFromJSON(jsonValue));
}
/**
* Get all brands that the vendor currently sells.
* Get Brands
*/
async getBrandsV0BrandsGet(requestParameters = {}, initOverrides) {
const response = await this.getBrandsV0BrandsGetRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get detailed information about a specific product by its ID.
* Get Product Detail
*/
async getProductDetailV0ProductsProductIdGetRaw(requestParameters, initOverrides) {
if (requestParameters['productId'] == null) {
throw new runtime.RequiredError('productId', 'Required parameter "productId" was null or undefined when calling getProductDetailV0ProductsProductIdGet().');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // APIKeyHeader authentication
}
let urlPath = `/v0/products/{product_id}`;
urlPath = urlPath.replace(`{${"product_id"}}`, encodeURIComponent(String(requestParameters['productId'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ProductDetailFromJSON(jsonValue));
}
/**
* Get detailed information about a specific product by its ID.
* Get Product Detail
*/
async getProductDetailV0ProductsProductIdGet(requestParameters, initOverrides) {
const response = await this.getProductDetailV0ProductsProductIdGetRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Search for products.
* Search
*/
async searchV0SearchPostRaw(requestParameters, initOverrides) {
if (requestParameters['searchRequest'] == null) {
throw new runtime.RequiredError('searchRequest', 'Required parameter "searchRequest" was null or undefined when calling searchV0SearchPost().');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["x-api-key"] = await this.configuration.apiKey("x-api-key"); // APIKeyHeader authentication
}
let urlPath = `/v0/search`;
const response = await this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: SearchRequestToJSON(requestParameters['searchRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ProductFromJSON));
}
/**
* Search for products.
* Search
*/
async searchV0SearchPost(requestParameters, initOverrides) {
const response = await this.searchV0SearchPostRaw(requestParameters, initOverrides);
return await response.value();
}
}
//# sourceMappingURL=Channel3ApiApi.js.map