UNPKG

omnisend-node-sdk

Version:

🔹 Typesafe Omnisend API SDK for Node.js

469 lines (468 loc) • 15.6 kB
import type { PagingLink } from "../data-contracts"; import type { HttpClient, RequestParams } from "../http-client"; export declare class Products<SecurityDataType = unknown, SafeMode extends true | false = false> { http: HttpClient<SecurityDataType, SafeMode>; constructor(http: HttpClient<SecurityDataType, SafeMode>); /** * No description * * @tags Products * @name GetProductsProductId * @summary Get product's info * @request GET:/products/{productID} * @secure */ getProductsProductId: (productId: string, params?: RequestParams) => Promise<SafeMode extends true ? { success: false; error?: string | undefined; } | { success: true; data: { productID: string; title: string; status?: "inStock" | "outOfStock" | "notAvailable" | undefined; description?: string | undefined; /** * ISO currency code. * @minLength 3 * @maxLength 3 */ currency: string; /** * Link to product page * @format uri */ productUrl?: string | undefined; /** Product's vendor */ vendor?: string | undefined; /** A categorization that a product can be tagged with, commonly used for filtering and searching. For example: book, virtualGood, music. It's not product category. */ type?: string | undefined; /** * Product creation date-time. * @format date-time */ createdAt?: string | undefined; /** * Product update date-time. * @format date-time */ updatedAt?: string | undefined; tags?: string[] | undefined; categoryIDs?: string[] | undefined; images?: { imageID?: string | undefined; /** @format uri */ url?: string | undefined; isDefault?: boolean | undefined; variantIDs?: string[] | undefined; }[] | undefined; variants?: { variantID: string; title: string; sku?: string | undefined; status?: "inStock" | "outOfStock" | "notAvailable" | undefined; /** * In cents * @min 0 */ price?: number | undefined; /** In cents */ oldPrice?: number | undefined; /** * Link to product page * @format uri */ productUrl?: string | undefined; imageID?: string | undefined; }[] | undefined; }; } : { productID: string; title: string; status?: "inStock" | "outOfStock" | "notAvailable" | undefined; description?: string | undefined; /** * ISO currency code. * @minLength 3 * @maxLength 3 */ currency: string; /** * Link to product page * @format uri */ productUrl?: string | undefined; /** Product's vendor */ vendor?: string | undefined; /** A categorization that a product can be tagged with, commonly used for filtering and searching. For example: book, virtualGood, music. It's not product category. */ type?: string | undefined; /** * Product creation date-time. * @format date-time */ createdAt?: string | undefined; /** * Product update date-time. * @format date-time */ updatedAt?: string | undefined; tags?: string[] | undefined; categoryIDs?: string[] | undefined; images?: { imageID?: string | undefined; /** @format uri */ url?: string | undefined; isDefault?: boolean | undefined; variantIDs?: string[] | undefined; }[] | undefined; variants?: { variantID: string; title: string; sku?: string | undefined; status?: "inStock" | "outOfStock" | "notAvailable" | undefined; /** * In cents * @min 0 */ price?: number | undefined; /** In cents */ oldPrice?: number | undefined; /** * Link to product page * @format uri */ productUrl?: string | undefined; imageID?: string | undefined; }[] | undefined; }>; /** * @description Replace product. Pass all product info. Not passed fields will be deleted. **Variants** At least one variant is required for each product. A variant can use the same **ID** (`productID`) and **title** (`title`) as the parent product. * * @tags Products * @name PutProductsProductId * @summary Replace product * @request PUT:/products/{productID} * @secure */ putProductsProductId: (productId: string, data: { title: string; status: "inStock" | "outOfStock" | "notAvailable"; description?: string; /** * ISO currency code. * @minLength 3 * @maxLength 3 */ currency: string; /** * Link to product page * @format uri */ productUrl?: string; /** Product's vendor */ vendor?: string; /** A categorization that a product can be tagged with, commonly used for filtering and searching. For example: book, virtualGood, music. It's not product category. */ type?: string; /** * Product creation date-time. * @format date-time */ createdAt?: string; /** * Product update date-time. * @format date-time */ updatedAt: string; tags?: string[]; categoryIDs?: string[]; /** @maxItems 10 */ images?: { imageID: string; /** @format uri */ url: string; isDefault?: boolean; variantIDs?: string[]; }[]; variants?: { variantID: string; title: string; status: "inStock" | "outOfStock" | "notAvailable"; /** * In cents * @min 0 */ price: number; /** In cents */ oldPrice?: number; /** * Link to product page * @format uri */ productUrl?: string; /** @maxItems 10 */ imageID?: string; }[]; }, params?: RequestParams) => Promise<SafeMode extends true ? { success: false; error?: string | undefined; } | { success: true; data: { productID?: string | undefined; }; } : { productID?: string | undefined; }>; /** * @description **Curl example:** ```php curl -X DELETE "https://api.omnisend.com/v3/products/prod478541" ``` * * @tags Products * @name DeleteProductsProductId * @summary Delete product * @request DELETE:/products/{productID} * @secure */ deleteProductsProductId: (productId: string, params?: RequestParams) => Promise<SafeMode extends true ? { success: false; error?: string | undefined; } | { success: true; data: void; } : void>; /** * @description **Sorting:** | **Parameter** | **Sort order** | **Description** | | --- | ---| --- | | createdAt | DESC | Product creation date - recent first | | updatedAt | DESC | Product update date - recent first | * * @tags Products * @name GetProducts * @summary List products * @request GET:/products * @secure */ getProducts: (query?: { sort?: string; vendor?: string; type?: string; /** * Number of results to skip. Default is 0. * @min 0 * @default 0 */ offset?: number; /** * Number of results to fetch. Default is 100, max 250. * @min 1 * @max 250 * @default 100 */ limit?: number; }, params?: RequestParams) => Promise<SafeMode extends true ? { success: false; error?: string | undefined; } | { success: true; data: { products?: { productID: string; title: string; status?: "inStock" | "outOfStock" | "notAvailable" | undefined; description?: string | undefined; /** * ISO currency code. * @minLength 3 * @maxLength 3 */ currency: string; /** * Link to product page * @format uri */ productUrl?: string | undefined; /** Product's vendor */ vendor?: string | undefined; /** A categorization that a product can be tagged with, commonly used for filtering and searching. For example: book, virtualGood, music. It's not product category. */ type?: string | undefined; /** * Product creation date-time. * @format date-time */ createdAt?: string | undefined; /** * Product update date-time. * @format date-time */ updatedAt?: string | undefined; tags?: string[] | undefined; categoryIDs?: string[] | undefined; images?: { imageID?: string | undefined; /** @format uri */ url?: string | undefined; isDefault?: boolean | undefined; variantIDs?: string[] | undefined; }[] | undefined; variants?: { variantID: string; title: string; sku?: string | undefined; status?: "inStock" | "outOfStock" | "notAvailable" | undefined; /** * In cents * @min 0 */ price?: number | undefined; /** In cents */ oldPrice?: number | undefined; /** * Link to product page * @format uri */ productUrl?: string | undefined; imageID?: string | undefined; }[] | undefined; }[] | undefined; paging?: PagingLink | undefined; }; } : { products?: { productID: string; title: string; status?: "inStock" | "outOfStock" | "notAvailable" | undefined; description?: string | undefined; /** * ISO currency code. * @minLength 3 * @maxLength 3 */ currency: string; /** * Link to product page * @format uri */ productUrl?: string | undefined; /** Product's vendor */ vendor?: string | undefined; /** A categorization that a product can be tagged with, commonly used for filtering and searching. For example: book, virtualGood, music. It's not product category. */ type?: string | undefined; /** * Product creation date-time. * @format date-time */ createdAt?: string | undefined; /** * Product update date-time. * @format date-time */ updatedAt?: string | undefined; tags?: string[] | undefined; categoryIDs?: string[] | undefined; images?: { imageID?: string | undefined; /** @format uri */ url?: string | undefined; isDefault?: boolean | undefined; variantIDs?: string[] | undefined; }[] | undefined; variants?: { variantID: string; title: string; sku?: string | undefined; status?: "inStock" | "outOfStock" | "notAvailable" | undefined; /** * In cents * @min 0 */ price?: number | undefined; /** In cents */ oldPrice?: number | undefined; /** * Link to product page * @format uri */ productUrl?: string | undefined; imageID?: string | undefined; }[] | undefined; }[] | undefined; paging?: PagingLink | undefined; }>; /** * @description Create new product. **Variants** At least one variant is required for each product. A variant can use the same **ID** (`productID`) and **title** (`title`) as the parent product. * * @tags Products * @name PostProducts * @summary Create product * @request POST:/products * @secure */ postProducts: (data: { /** Unique product identificator. */ productID: string; title: string; status: "inStock" | "outOfStock" | "notAvailable"; description?: string; /** * ISO currency code. * @minLength 3 * @maxLength 3 */ currency: string; /** * Link to product page * @format uri */ productUrl: string; /** Product's vendor */ vendor?: string; /** A categorization that a product can be tagged with, commonly used for filtering and searching. For example: book, virtualGood, music. It's not product category. */ type?: string; /** * Product creation date-time. * @format date-time */ createdAt?: string; /** * Product update date-time. * @format date-time */ updatedAt?: string; tags?: string[]; categoryIDs?: string[]; /** @maxItems 10 */ images?: { imageID: string; /** @format uri */ url: string; isDefault?: boolean; variantIDs?: string[]; }[]; variants: { variantID: string; title: string; sku?: string; status: "inStock" | "outOfStock" | "notAvailable"; /** * In cents * @min 0 */ price: number; /** In cents */ oldPrice?: number; /** * Link to product page * @format uri */ productUrl?: string; /** @maxItems 10 */ imageID?: string; }[]; }, params?: RequestParams) => Promise<SafeMode extends true ? { success: false; error?: string | undefined; } | { success: true; data: { productID?: string | undefined; }; } : { productID?: string | undefined; }>; }