@shipengine/connect-order-source-api
Version:
This is the typescript/javascript definitions for the order source api
95 lines • 4.14 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProductSchema = exports.Product = exports.ProductUrls = exports.ProductDetailSchema = exports.ProductDetail = exports.ProductIdentifiersSchema = exports.ProductIdentifiers = void 0;
const tslib_1 = require("tslib");
const weight_1 = require("./weight");
const dimensions_1 = require("./dimensions");
const joi_1 = tslib_1.__importDefault(require("joi"));
/** @description A set of identifiers for a product */
class ProductIdentifiers {
/** @description A stock-keeping unit associated with a product by the order source */
sku;
/** @description A universal product code associated with a product */
upc;
/** @description An international standard book number associated with a product */
isbn;
/** @description An Amzon standard identification number associated with a product */
asin;
/** @description A stock-keeping unit associated with the fulfillment of an order */
fulfillment_sku;
/** @description The identifier needed to set and retrieve inventory levels */
inventory_id;
}
exports.ProductIdentifiers = ProductIdentifiers;
exports.ProductIdentifiersSchema = joi_1.default.object({
sku: joi_1.default.string().optional().empty(),
upc: joi_1.default.string().optional().empty(),
isbn: joi_1.default.string().optional().empty(),
asin: joi_1.default.string().optional().empty(),
fulfillment_sku: joi_1.default.string().optional().empty(),
inventory_id: joi_1.default.string().optional().empty(),
});
/** @description Details about a product @example { name: "Color", value: "Red" } */
class ProductDetail {
/** @description The type of the product detail. Example (non-exhaustive) values: 'Color', 'CountryOfManufacture', 'Shape', 'Size', 'Style' */
name;
/** @description The value of the product detail */
value;
}
exports.ProductDetail = ProductDetail;
exports.ProductDetailSchema = joi_1.default.object({
name: joi_1.default.string().required(),
value: joi_1.default.string().required(),
});
/** @description The urls associated with a product */
class ProductUrls {
/** @description A link to the product page if available */
product_url;
/** @description A link to the image for a product if available */
image_url;
/** @description A link to the image for use in platform thumbnails */
thumbnail_url;
}
exports.ProductUrls = ProductUrls;
const ProductUrlsSchema = joi_1.default.object({
product_url: joi_1.default.string().optional().empty(),
image_url: joi_1.default.string().optional().empty(),
thumbnail_url: joi_1.default.string().optional().empty(),
});
/** @description This represents a product */
class Product {
/** @description This ID of this product in the vendor API */
product_id;
/** @description The product name */
name;
/** @description The product description */
description;
/** @description Additional identifiers associated with this product */
identifiers;
/** @description A list of details associated with this product */
details;
/** @description The cost of a single product */
unit_cost;
/** @description The weight of the product */
weight;
/** @description The dimensions of the product */
dimensions;
/** @description The urls associated with a product */
urls;
/** @description The location the product can be found in a warehouse */
location;
}
exports.Product = Product;
exports.ProductSchema = joi_1.default.object({
product_id: joi_1.default.string().required(),
name: joi_1.default.string().required(),
description: joi_1.default.string().optional(),
identifiers: exports.ProductIdentifiersSchema.optional(),
details: joi_1.default.array().optional().items(exports.ProductDetailSchema),
unit_cost: joi_1.default.number().optional(),
weight: weight_1.WeightSchema.optional(),
dimensions: dimensions_1.DimensionsSchema.optional(),
urls: ProductUrlsSchema.optional(),
location: joi_1.default.string().optional().empty(),
});
//# sourceMappingURL=product.js.map