printful-sdk-js-v2
Version:
Printful SDK for Node.js / TypeScript. A wrapper for the Printful REST API (v2)
1,346 lines (1,299 loc) • 143 kB
TypeScript
type ApiRequestOptions = {
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
readonly url: string;
readonly path?: Record<string, any>;
readonly cookies?: Record<string, any>;
readonly headers?: Record<string, any>;
readonly query?: Record<string, any>;
readonly formData?: Record<string, any>;
readonly body?: any;
readonly mediaType?: string;
readonly responseHeader?: string;
readonly errors?: Record<number, string>;
};
declare class CancelError extends Error {
constructor(message: string);
get isCancelled(): boolean;
}
interface OnCancel {
readonly isResolved: boolean;
readonly isRejected: boolean;
readonly isCancelled: boolean;
(cancelHandler: () => void): void;
}
declare class CancelablePromise<T> implements Promise<T> {
#private;
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
get [Symbol.toStringTag](): string;
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
finally(onFinally?: (() => void) | null): Promise<T>;
cancel(): void;
get isCancelled(): boolean;
}
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
type Headers = Record<string, string>;
type OpenAPIConfig = {
BASE: string;
VERSION: string;
WITH_CREDENTIALS: boolean;
CREDENTIALS: 'include' | 'omit' | 'same-origin';
TOKEN?: string | Resolver<string> | undefined;
USERNAME?: string | Resolver<string> | undefined;
PASSWORD?: string | Resolver<string> | undefined;
HEADERS?: Headers | Resolver<Headers> | undefined;
ENCODE_PATH?: ((path: string) => string) | undefined;
};
declare const OpenAPI: OpenAPIConfig;
declare abstract class BaseHttpRequest {
readonly config: OpenAPIConfig;
constructor(config: OpenAPIConfig);
abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
}
declare class ApprovalSheetsV2Service {
readonly httpRequest: BaseHttpRequest;
constructor(httpRequest: BaseHttpRequest);
/**
* Retrieve a list of approval sheets
* Retrieve a list of approval sheets confirming suggested changes to files of on hold orders.
* @param xPfStoreId Use this to specify which store you want to use (required only for account level token).
*
* The store IDs can be retrieved with the [Get basic information about stores](/docs/#operation/getStores) endpoint.
*
* @param orderId Order ID.
* @returns any OK
* @throws ApiError
*/
getApprovalSheets(xPfStoreId?: string, orderId?: number): CancelablePromise<any>;
}
declare enum TechniqueEnum {
DTG = "dtg",
DIGITAL = "digital",
CUT_SEW = "cut-sew",
UV = "uv",
EMBROIDERY = "embroidery",
SUBLIMATION = "sublimation",
DTFILM = "dtfilm"
}
declare class CatalogV2Service {
readonly httpRequest: BaseHttpRequest;
constructor(httpRequest: BaseHttpRequest);
/**
* Retrieve a list of catalog products
* This endpoint retrieves a list of the products available in Printful's catalog. The list is paginated and can be filtered using various filters. The information returned includes details on how each product can be designed, such as the available placements, techniques, and additional options.
* For a visual representation of the design data, please see the following diagram:
* [<img src="images/catalog/design_data_diagram.png#center" width="700"/>](images/catalog/design_data_diagram.png)
*
* @param categoryIds One or more category IDs to return only products in those categories. The IDs can be found in the response of the
* operation _[Get Categories](#operation/getCategories)_.
*
* @param colors One or more color names to return only products with variants of one the those colors.
*
* @param limit The number of results to return per page.
* @param _new If true only new Products will be returned.
* @param offset The number of results to not include in the response starting from the beginning of the list.
*
* This can be used to return results after the initial 100. For example, sending offset 100
*
* @param placements One or more identifiers of a placement to return only products with variants that have that placement. The complete list of placements can be found [here](https://developers.printful.com/docs/#section/Placements).
* @param sellingRegionName Only returns the products that can be sold in the specified region. If is set to 'all' returns each region availability for specified product.
* @param sortDirection This parameter only is used if sort_type is also present and it changes the order of the returned products.
* The exact meaning varies depending on the value of `sort_type`:
* * `sort_type=new`
* * ascending sorts from newest to oldest.
* * descending sorts from oldest to newest.
* * `sort_type=rating`
* * ascending from lowest to highest rated.
* * descending from highest to lowest rated.
* * `sort_type=price`
* * ascending from lowest to highest price.
* * descending from highest to lowest price.
* * `sort_type=bestseller`
* * ascending from non bestsellers to bestsellers.
* * descending from bestsellers to non bestsellers.
*
* @param sortType The sorting strategy to use when sorting the result. When it's not present, no specific order is guaranteed.
*
* @param techniques One or more techniques to return only products with variants that can be printed using one of the techniques.
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
getProducts(categoryIds?: Array<number>, colors?: Array<string>, limit?: number, _new?: boolean, offset?: number, placements?: Array<string>, sellingRegionName?: 'worldwide' | 'north_america' | 'canada' | 'europe' | 'spain' | 'latvia' | 'uk' | 'france' | 'germany' | 'australia' | 'japan' | 'new_zealand' | 'italy' | 'brazil' | 'southeast_asia' | 'republic_of_korea' | 'english_speaking_regions' | 'all', sortDirection?: 'ascending' | 'descending', sortType?: 'new' | 'rating' | 'price' | 'bestseller', techniques?: Array<TechniqueEnum>, xPfLanguage?: string): CancelablePromise<any>;
/**
* Retrieve a single catalog product
* Returns information about a single specified catalog product. [See catalog product](#tag/Catalog-v2/What-is-a-catalog-product)
*
* @param id Product ID.
* @param sellingRegionName Only returns the products that can be sold in the specified region. If is set to 'all' returns each region availability for specified product.
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
getProductById(id: number, sellingRegionName?: 'worldwide' | 'north_america' | 'canada' | 'europe' | 'spain' | 'latvia' | 'uk' | 'france' | 'germany' | 'australia' | 'japan' | 'new_zealand' | 'italy' | 'brazil' | 'southeast_asia' | 'republic_of_korea' | 'english_speaking_regions' | 'all', xPfLanguage?: string): CancelablePromise<any>;
/**
* Retrieve information about specific catalog variant
* Returns information about single specified catalog variant. [See catalog variant](#tag/Catalog-v2/What-is-a-catalog-variant)
*
* @param id Variant ID
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
getVariantById(id: number, xPfLanguage?: string): CancelablePromise<any>;
/**
* Retrieve information about catalog product variants
* Returns information about all catalog variants associated with the specified
* catalog product. [See catalog variant](#tag/Catalog-v2/What-is-a-catalog-variant)
*
* @param id Product ID.
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
getProductVariantsById(id: number, xPfLanguage?: string): CancelablePromise<any>;
/**
* Retrieve a list of catalog categories
* Returns list of all categories that are present in the catalog. The categories specify the type of the product that is associated with it. For example, the category "Men’s T-shirts" indicates that the product is a subgroup of T-shirts specifically targeted at Men.
* Categories can be used to filter the product list by specific tags [See categories_ids](#operation/getProducts)
*
* @returns any OK
* @throws ApiError
*/
getCategories(): CancelablePromise<any>;
/**
* Retrieve information about specific category
* Returns information about a specific catalog category. The categories specify the type of the product that is associated with it. For example, the category "Men’s T-shirts" indicates that the product is a subgroup of T-shirts specifically targeted at Men.
* Categories can be used to filter the product list by specific tags [See categories_ids](#operation/getProducts)
*
* @param id Category ID
* @returns any OK
* @throws ApiError
*/
getCategoryById(id: number): CancelablePromise<any>;
/**
* Retrieve a list of catalog product categories
* To retrieve information about a particular products categories, use this feature. It returns details about the catalog categories associated with the catalog product. Categories help identify the type of product associated with them. For instance, the category "Men's T-shirts" denotes that the product is a subgroup of T-shirts intended for men.
*
* @param id Product ID.
* @param sellingRegionName Only returns the products that can be sold in the specified region. If is set to 'all' returns each region availability for specified product.
* @returns any OK
* @throws ApiError
*/
getCategoriesByProductId(id: number, sellingRegionName?: 'worldwide' | 'north_america' | 'canada' | 'europe' | 'spain' | 'latvia' | 'uk' | 'france' | 'germany' | 'australia' | 'japan' | 'new_zealand' | 'italy' | 'brazil' | 'southeast_asia' | 'republic_of_korea' | 'english_speaking_regions' | 'all'): CancelablePromise<any>;
/**
* Retrieve size guide for a catalog product
* Returns information about the size guide for a specific product.
* @param id Product ID.
* @param unit A comma-separated list of measurement unit in which size tables are to be returned (`inches` or `cm`).
* The default value is determined based on the locale country. The inches are used for United States, Liberia
* and Myanmar, for other countries the unit defaults to centimeters.
*
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
getProductSizeGuideById(id: number, unit?: string, xPfLanguage?: string): CancelablePromise<any>;
/**
* Retrieve catalog product prices
*
* Calculates prices for specific catalog product based on selling region and specified currency. Calculations also include Store discounts. Selling region is used to specify product production currency, that is the price that the product is natively manufactured in. Different selling regions might affect the overall price amount. Currency parameter is used only to define the currency that the prices will be displayed in.
*
* For more information on product pricing please refer to the information provided at https://www.printful.com/pricing
* <div class="alert alert-info" style="word-wrap: break-word; padding: 16px; border-radius: 0; cursor: default; color: #31708f; background-color: #d9edf7; border-color: #bce8f1;">
* <p>
* When developing against either API be sure to inform your customers that a placement will be included in the price of the product. If one placement is provided that placement will be included in the price, if multiple are provided the included placement will generally be the placement that comes earliest in the list of placements at `/v2/catalog-products/71` (though the discount will generally be up to the price of the first placement in that list). Certain placements come with additional service fees, such as large embroidery, this additional price will never be included even if the only placement is large embroidery.
* </p>
* <p>
* There is a minor difference in the handling of prices for placements between V1 and V2.
* In V1 the price of the first placement is always null, this is because there
* is always a placement included in the price of each product. In V2 the price of placements
* is always displayed even if it is included in the price of the product because any
* placement can be included.
* </p>
* </div>
*
* @param id Product ID.
* @param sellingRegionName Specifies the region production currency that the product prices will be calculated in
* @param currency The currency (3-letter code) used to determine currency in which the prices will be displayed. The store currency will be used by default. The format is compliant with ISO 4217 standard.
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
getProductPricesById(id: number, sellingRegionName?: string, currency?: string, xPfLanguage?: string): CancelablePromise<any>;
/**
* Retrieve pricing information for the catalog variant
* Return pricing information from a single variant and the parent product
* @param id Variant ID
* @param sellingRegionName Specifies the region production currency that the product prices will be calculated in
* @param currency The currency (3-letter code) used to determine currency in which the prices will be displayed. The store currency will be used by default. The format is compliant with ISO 4217 standard.
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
getVariantPricesById(id: number, sellingRegionName?: string, currency?: string, xPfLanguage?: string): CancelablePromise<any>;
/**
* Retrieve blank images for a catalog product
* This feature helps to fetch blank images for a catalog product. These blank images are always white and semi-transparent and can be colored by the user on the client-side as per the specified color in the `data.images.background_color` field. For some mockups the `data.images.background_image` could apply. The endpoint allows filtering of the result based on the type of the mockup, the placement, and the color of the product.
*
* @param id Product ID.
* @param mockupStyleIds Used to specify style of images For example:
* * On the hanger
* * On the Male/Female model
* * Flat on the table
* * etc.
* Available mockup styles for catalog product can be found under _[Retrieve catalog product mockup styles](#operation/retrieveMockupStylesByProductId)_.
*
* @param colors String values separated by comma. You can specify multiple variant colors filters.
* @param placement Filters result by specified placement
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
getProductImagesById(id: number, mockupStyleIds?: number, colors?: string, placement?: string, xPfLanguage?: string): CancelablePromise<any>;
/**
* Retrieve blank images for a catalog variant
* Returns images for a specified Variant.
* @param id Variant ID
* @param mockupStyleIds Used to specify style of images For example:
* * On the hanger
* * On the Male/Female model
* * Flat on the table
* * etc.
* Available mockup styles for catalog product can be found under _[Retrieve catalog product mockup styles](#operation/retrieveMockupStylesByProductId)_.
*
* @param placement Filters result by specified placement
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
getVariantImagesById(id: number, mockupStyleIds?: number, placement?: string, xPfLanguage?: string): CancelablePromise<any>;
/**
* Retrieve catalog product mockup styles
* Returns information about available mockup styles for specified catalog product.
*
* @param id Product ID.
* @param placements One or more placement idenitifiers used to filter in mockup styles that match a given placement. The complete list of placements can be found [here](https://developers.printful.com/docs/#section/Placements).
* @param sellingRegionName Only returns the products that can be sold in the specified region. If is set to 'all' returns each region availability for specified product.
* @param offset Result set offset
* @param limit Number of items per page (max 100)
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
retrieveMockupStylesByProductId(id: number, placements?: Array<string>, sellingRegionName?: 'worldwide' | 'north_america' | 'canada' | 'europe' | 'spain' | 'latvia' | 'uk' | 'france' | 'germany' | 'australia' | 'japan' | 'new_zealand' | 'italy' | 'brazil' | 'southeast_asia' | 'republic_of_korea' | 'english_speaking_regions' | 'all', offset?: number, limit?: number, xPfLanguage?: string): CancelablePromise<any>;
/**
* Retrieve catalog product mockup templates
* Returns positional data for specified catalog product mockups. The data from this endpoint could be used
* to generate your own mockups without the need to use Printful's mockup generator.
* 
*
* @param id Product ID.
* @param placements One or more identifiers of a placement to return only products with variants that have that placement. The complete list of placements can be found [here](https://developers.printful.com/docs/#section/Placements).
* @param sellingRegionName Only returns the products that can be sold in the specified region. If is set to 'all' returns each region availability for specified product.
* @param limit The number of results to return per page.
* @param offset The number of results to not include in the response starting from the beginning of the list.
*
* This can be used to return results after the initial 100. For example, sending offset 100
*
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
getMockupTemplatesByProductId(id: number, placements?: Array<string>, sellingRegionName?: 'worldwide' | 'north_america' | 'canada' | 'europe' | 'spain' | 'latvia' | 'uk' | 'france' | 'germany' | 'australia' | 'japan' | 'new_zealand' | 'italy' | 'brazil' | 'southeast_asia' | 'republic_of_korea' | 'english_speaking_regions' | 'all', limit?: number, offset?: number, xPfLanguage?: string): CancelablePromise<any>;
/**
* Retrieve catalog product stock availability
* Provides information about the catalog product stock status. Stock availability is grouped by variants → techniques → selling regions.
*
* @param id Product ID.
* @param techniques One or more techniques to return only products with variants that can be printed using one of the techniques.
* @param sellingRegionName Only returns the products that can be sold in the specified region. If is set to 'all' returns each region availability for specified product.
* @param limit The number of results to return per page.
* @param offset The number of results to not include in the response starting from the beginning of the list.
*
* This can be used to return results after the initial 100. For example, sending offset 100
*
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
getProductStockAvailabilityById(id: number, techniques?: Array<TechniqueEnum>, sellingRegionName?: 'worldwide' | 'north_america' | 'canada' | 'europe' | 'spain' | 'latvia' | 'uk' | 'france' | 'germany' | 'australia' | 'japan' | 'new_zealand' | 'italy' | 'brazil' | 'southeast_asia' | 'republic_of_korea' | 'english_speaking_regions' | 'all', limit?: number, offset?: number, xPfLanguage?: string): CancelablePromise<any>;
/**
* Retrieve catalog variant stock availability
* Provides information about the catalog variant stock status. Stock availability is grouped by variants → techniques → selling regions.
*
* @param id Variant ID
* @param techniques One or more techniques to return only products with variants that can be printed using one of the techniques.
* @param sellingRegionName Only returns the products that can be sold in the specified region. If is set to 'all' returns each region availability for specified product.
* @param xPfLanguage Use this to specify which locale you would like to use in the responses, for some endpoints this can affect translations.
*
* @returns any OK
* @throws ApiError
*/
getVariantStockAvailabilityById(id: number, techniques?: Array<TechniqueEnum>, sellingRegionName?: 'worldwide' | 'north_america' | 'canada' | 'europe' | 'spain' | 'latvia' | 'uk' | 'france' | 'germany' | 'australia' | 'japan' | 'new_zealand' | 'italy' | 'brazil' | 'southeast_asia' | 'republic_of_korea' | 'english_speaking_regions' | 'all', xPfLanguage?: string): CancelablePromise<any>;
}
declare class CountriesV2Service {
readonly httpRequest: BaseHttpRequest;
constructor(httpRequest: BaseHttpRequest);
/**
* Retrieve a list of countries
* Get information about all countries where Printful is available
* @param offset The number of results to not include in the response starting from the beginning of the list.
*
* This can be used to return results after the initial 100. For example, sending offset 100
*
* @param limit The number of results to return per page.
* @returns any OK
* @throws ApiError
*/
getCountries(offset?: number, limit?: number): CancelablePromise<any>;
}
/**
* Information about the added File
*/
type AddFile = {
/**
* Role of the file
*/
role?: AddFile.role;
/**
* Source URL where the file is to be downloaded from. The use of .ai, .psd, and .tiff files has been deprecated, if your application uses these file types or accepts these types from users you will need to add validation.
*/
url: string;
/**
* If the filename is not provided, and something looking like a filename is present in the URL (e.g. "something.jpg"), it will be used.
* Otherwise, it will default to `{file_id}.{file_extension}`, with file extension determined based on the media type of the file.
*
*/
filename?: string;
/**
* Show file in the Printfile Library
*/
visible?: boolean;
};
declare namespace AddFile {
/**
* Role of the file
*/
enum role {
PRINTFILE = "printfile",
LABEL = "label",
PREVIEW = "preview"
}
}
declare class FilesV2Service {
readonly httpRequest: BaseHttpRequest;
constructor(httpRequest: BaseHttpRequest);
/**
* Add a new file
* Adds a new File to the library by providing URL of the file.
*
* If a file with identical URL already exists, then the original file is returned. If a file does not exist, a new file is created.
*
* [See examples](#tag/Examples/Files-API-examples/Add-a-new-file)
*
* @param requestBody POST request body
* @param xPfStoreId Use this to specify which store you want to use (required only for account level token).
*
* The store IDs can be retrieved with the [Get basic information about stores](/docs/#operation/getStores) endpoint.
*
* @returns any OK
* @throws ApiError
*/
addFile(requestBody: AddFile, xPfStoreId?: string): CancelablePromise<any>;
/**
* Retrieve a single file from the file library
* Get basic information about the file stored in the file library
* @param id File ID.
* @returns any OK
* @throws ApiError
*/
getFileById(id: number): CancelablePromise<any>;
}
type BaseMockupProduct = {
/**
* Mockup product source
*/
source: string;
/**
* Used to specify style of mockups that should be generated. For example:
* * On the hanger
* * On the Male/Female model
* * Flat on the table
* * etc.
* Available mockup styles for catalog product can be found under _[Retrieve catalog product mockup styles](#operation/retrieveMockupStylesByProductId)_.
*
*/
mockup_style_ids: Array<number>;
};
type CatalogMockupProduct = BaseMockupProduct;
type TemplateMockupProduct = BaseMockupProduct;
type MockupTaskCreation = {
/**
* Generated file format. PNG will have a transparent background, JPG will have a smaller file size.
*/
format: MockupTaskCreation.format;
products: Array<(CatalogMockupProduct | TemplateMockupProduct)>;
};
declare namespace MockupTaskCreation {
/**
* Generated file format. PNG will have a transparent background, JPG will have a smaller file size.
*/
enum format {
JPG = "jpg",
PNG = "png"
}
}
declare class MockupGeneratorV2Service {
readonly httpRequest: BaseHttpRequest;
constructor(httpRequest: BaseHttpRequest);
/**
* Create Mockup Generator tasks
* Create Mockup Generator tasks
* @param xPfStoreId Use this to specify which store you want to use (required only for account level token).
*
* The store IDs can be retrieved with the [Get basic information about stores](/docs/#operation/getStores) endpoint.
*
* @param requestBody This action schedules asynchronous mockup generation tasks. In the response of this request `id` will be returned which can be used to retrieve the result of the tasks _[Retrieve mockup generator tasks](#operation/getMockupGeneratorTasks)_. In addition, the webhook event will be sent informing about the task completion, if the correct webhook has been subscribed to _[Mockup generator task finished event](#operation/mockupTaskFinished)_. You can subscribe to webhook events by using _[Set up event configuration](#operation/createWebhookEventConfiguration)_.
* @returns any OK
* @throws ApiError
*/
createMockupGeneratorTasks(xPfStoreId?: string, requestBody?: MockupTaskCreation): CancelablePromise<any>;
/**
* Retrieve Mockup Generator tasks
* Returns result of Mockup Generator tasks
* @param id One or more mockup generator task IDs to return only specified tasks. The IDs can be found in the response of the operation _[Create mockup generator tasks](#operation/createMockupGeneratorTasks)_.
* @param limit The number of results to return per page.
* @param offset The number of results to not include in the response starting from the beginning of the list.
*
* This can be used to return results after the initial 100. For example, sending offset 100
*
* @returns any OK
* @throws ApiError
*/
getMockupGeneratorTasks(id: Array<string>, limit?: number, offset?: number): CancelablePromise<any>;
}
declare class OAuthScopesV2Service {
readonly httpRequest: BaseHttpRequest;
constructor(httpRequest: BaseHttpRequest);
/**
* Retrieve OAuth scopes
* This endpoint will retrieve all OAuth scopes associated with the used token
* @returns any OK
* @throws ApiError
*/
getOAuthScopes(): CancelablePromise<any>;
}
/**
* Information about the address
*/
type Address = {
/**
* Full name
*/
name?: string;
/**
* Company name
*/
company?: string;
/**
* Address line 1
*/
address1?: string;
/**
* Address line 2
*/
address2?: string;
/**
* City
*/
city?: string;
/**
* State code
*/
state_code?: string;
/**
* State name
*/
state_name?: string;
/**
* Country code
*/
country_code?: string;
/**
* Country name
*/
country_name?: string;
/**
* ZIP/Postal code
*/
zip?: string;
/**
* Phone number
*/
phone?: string;
/**
* Email address
*/
email?: string;
/**
* TAX number (`optional`, but in case of Brazil country this field becomes `required` and will be used as CPF/CNPJ number)<br> CPF format is 000.000.000-00 (14 characters);<br> CNPJ format is 00.000.000/0000-00 (18 characters).
*/
tax_number?: string;
};
type HateoasLink = {
/**
* The HREF of the linked resource.
*/
href: string;
};
/**
* Item user specified external ID
*/
type ItemExternalId = string | null;
/**
* Should thread use 3d puff technique
*/
type dPuffOption = {
/**
* Option identifier
*/
name: dPuffOption.name;
/**
* Whether the 3d puff technique should be used for the layer.
*/
value: boolean;
};
declare namespace dPuffOption {
/**
* Option identifier
*/
enum name {
_3D_PUFF = "3d_puff"
}
}
/**
* Option value
*/
declare enum KnitwearOptionValue {
_090909 = "#090909",
_404040 = "#404040",
_563C33 = "#563c33",
_D52213 = "#d52213",
_6E5242 = "#6e5242",
_7F6A53 = "#7f6a53",
_CD5E38 = "#cd5e38",
_B57648 = "#b57648",
_D1773B = "#d1773b",
_D68785 = "#d68785",
_C6B5A7 = "#c6b5a7",
_D6C6B4 = "#d6c6b4",
_DCD3CC = "#dcd3cc",
_EDD9D9 = "#edd9d9",
_E2DFDC = "#e2dfdc",
_FDFAFA = "#fdfafa",
_999996 = "#999996",
_DDA032 = "#dda032",
_D1C6AE = "#d1c6ae",
_EDDEA4 = "#eddea4",
_48542E = "#48542e",
_6E8C4B = "#6e8c4b",
_C0C1BD = "#c0c1bd",
_243F33 = "#243f33",
_C5D1D0 = "#c5d1d0",
_175387 = "#175387",
_237D96 = "#237d96",
_787979 = "#787979",
_343D55 = "#343d55",
_4E59BE = "#4e59be",
_566E99 = "#566e99",
_504372 = "#504372",
_4C1C29 = "#4c1c29",
_F66274 = "#f66274",
_EDA6B4 = "#eda6b4",
_DDABC8 = "#ddabc8"
}
/**
* Used to specify the yarn colors for the whole product. These are the colors that will be used across the whole product.
*/
type KnitwearYarnColor = {
/**
* Option identifier
*/
name: KnitwearYarnColor.name;
/**
* Option value
*/
value: Array<KnitwearOptionValue>;
};
declare namespace KnitwearYarnColor {
/**
* Option identifier
*/
enum name {
YARN_COLORS = "yarn_colors"
}
}
/**
* Specify thread colors for embroidery technique
*/
type ThreadColorsOption = {
/**
* Option identifier
*/
name: ThreadColorsOption.name;
/**
* Thread colors for embroidery technique
*/
value: Array<string>;
};
declare namespace ThreadColorsOption {
/**
* Option identifier
*/
enum name {
THREAD_COLORS = "thread_colors"
}
}
/**
* List of layer options
*/
type LayerOptions = Array<(dPuffOption | ThreadColorsOption | KnitwearYarnColor)>;
/**
* Information about the Layer position. If the positions are not provided then the design will be automatically centered.
*/
type LayerPosition = {
/**
* Layer width in inches
*/
width: number;
/**
* Layer height in inches
*/
height: number;
/**
* Layer top position in inches
*/
top: number;
/**
* Layer left position in inches
*/
left: number;
};
/**
* Information about the Layer
*/
type Layer = {
/**
* Type of layer (e.g. file, text)
*/
type: string;
/**
* File image URL if layer type is file
*/
url: string;
layer_options?: LayerOptions;
position?: LayerPosition;
};
/**
* Specify the type of inside label
*/
type InsideLabelTypeOption = {
/**
* Option identifier
*/
name: InsideLabelTypeOption.name;
/**
* Specifies type of inside label design that should be used
*/
value: InsideLabelTypeOption.value;
};
declare namespace InsideLabelTypeOption {
/**
* Option identifier
*/
enum name {
INSIDE_LABEL_TYPE = "inside_label_type"
}
/**
* Specifies type of inside label design that should be used
*/
enum value {
NATIVE = "native",
CUSTOM = "custom"
}
}
/**
* Specify if the design should use unlimited color technique
*/
type UnlimitedColorOption = {
/**
* Option identifier
*/
name: UnlimitedColorOption.name;
/**
* Whether the design should use unlimited color technique.
*/
value: boolean;
};
declare namespace UnlimitedColorOption {
/**
* Option identifier
*/
enum name {
UNLIMITED_COLOR = "unlimited_color"
}
}
/**
* List of placement options
*/
type PlacementOptions = Array<(UnlimitedColorOption | InsideLabelTypeOption)>;
/**
* A placement is used to represent the physical area in which a design will be printed, and the technique used. It includes the layers that will be printed on the placement.
*/
type Placement = {
/**
* Name of the placement
*/
placement: string;
/**
* Placement's technique
*/
technique: string;
/**
* Type of the print area. Defaults to simple. Advanced type might be specified only for some specific products
* for example All-over Tote bag. In that case both sides of the product will be designed.
* Advanced designs are often more complicated so it's advised to refer to the [mockup templates endpoint](#tag/Catalog-v2/operation/getMockupTemplatesByProductId) when using advanced designs.
* Available print area types for a specific product can be found in [Mockup Styles endpoint](/docs/#operation/createMockupGeneratorTasks).
*
*/
print_area_type?: Placement.print_area_type;
/**
* Information about placement's layers
*/
layers: Array<Layer>;
placement_options?: PlacementOptions;
/**
* Status of the placement design
*/
readonly status?: Placement.status;
/**
* Reason behind failed status
*/
readonly status_explanation?: string;
};
declare namespace Placement {
/**
* Type of the print area. Defaults to simple. Advanced type might be specified only for some specific products
* for example All-over Tote bag. In that case both sides of the product will be designed.
* Advanced designs are often more complicated so it's advised to refer to the [mockup templates endpoint](#tag/Catalog-v2/operation/getMockupTemplatesByProductId) when using advanced designs.
* Available print area types for a specific product can be found in [Mockup Styles endpoint](/docs/#operation/createMockupGeneratorTasks).
*
*/
enum print_area_type {
SIMPLE = "simple",
ADVANCED = "advanced"
}
/**
* Status of the placement design
*/
enum status {
OK = "ok",
FAILED = "failed"
}
}
/**
* Each entry in this list represents a placement on the physical product and the design that will be printed in that location.
*/
type PlacementsList = Array<Placement>;
/**
* Used to specify the border color of a sticker
*/
type CustomBorderColorOption = {
/**
* Option identifier
*/
name: CustomBorderColorOption.name;
/**
* Color defined in hexadecimal format
*/
value: string;
};
declare namespace CustomBorderColorOption {
/**
* Option identifier
*/
enum name {
CUSTOM_BORDER_COLOR = "custom_border_color"
}
}
/**
* Specify if inside pocket should be added to the product
*/
type InsidePocketOption = {
/**
* Option identifier
*/
name: InsidePocketOption.name;
/**
* Whether inside pocket should be added to the product.
*/
value: boolean;
};
declare namespace InsidePocketOption {
/**
* Option identifier
*/
enum name {
INSIDE_POCKET = "inside_pocket"
}
}
/**
* Used to specify the base color on a knitwear product.
*/
type KnitwearBaseColor = {
/**
* Option identifier
*/
name: KnitwearBaseColor.name;
value: KnitwearOptionValue;
};
declare namespace KnitwearBaseColor {
/**
* Option identifier
*/
enum name {
BASE_COLOR = "base_color"
}
}
/**
* Used to set the color reduction mode for a knitwear product
*/
type KnitwearColorReductionMode = {
/**
* Option identifier
*/
name: KnitwearColorReductionMode.name;
/**
* Option value
*/
value: KnitwearColorReductionMode.value;
};
declare namespace KnitwearColorReductionMode {
/**
* Option identifier
*/
enum name {
COLOR_REDUCTION_MODE = "color_reduction_mode"
}
/**
* Option value
*/
enum value {
SOLID = "solid",
PIXELATED = "pixelated"
}
}
/**
* Used to specify the color of the trim on a knitwear product.
*/
type KnitwearTrimColor = {
/**
* Option identifier
*/
name: KnitwearTrimColor.name;
value: KnitwearOptionValue;
};
declare namespace KnitwearTrimColor {
/**
* Option identifier
*/
enum name {
TRIM_COLOR = "trim_color"
}
}
/**
* Specifies if generated mockup should use lifelike effect
*/
type LifelikeOption = {
/**
* Option identifier
*/
name: LifelikeOption.name;
/**
* Whether generated mockup should use lifelike effect.
*/
value: boolean;
};
declare namespace LifelikeOption {
/**
* Option identifier
*/
enum name {
LIFELIKE = "lifelike"
}
}
/**
* Include additional notes for fulfillment for embroidery prints
*/
type NotesOption = {
/**
* Option identifier
*/
name: NotesOption.name;
/**
* Additional notes for fulfillment for embroidery prints.
*/
value: string;
};
declare namespace NotesOption {
/**
* Option identifier
*/
enum name {
NOTES = "notes"
}
}
/**
* Specified what color should be used for stitches
*/
type StitchColorOption = {
/**
* Option identifier
*/
name: StitchColorOption.name;
/**
* Option value
*/
value: string;
};
declare namespace StitchColorOption {
/**
* Option identifier
*/
enum name {
STITCH_COLOR = "stitch_color"
}
}
/**
* List of product options
*/
type ProductOptions = Array<(InsidePocketOption | StitchColorOption | NotesOption | LifelikeOption | CustomBorderColorOption | KnitwearBaseColor | KnitwearTrimColor | KnitwearColorReductionMode)>;
/**
* Information about the Item
*/
type Item = {
/**
* Item ID
*/
readonly id?: number;
external_id?: ItemExternalId;
/**
* Item quantity
*/
quantity?: number;
/**
* Item retail price
*/
retail_price?: string;
/**
* Item custom name
*/
name?: string;
placements?: PlacementsList;
product_options?: ProductOptions;
/**
* HATEOAS links
*/
readonly _links?: {
self?: HateoasLink;
};
};
type CatalogItem = ({
/**
* Catalog source
*/
source: CatalogItem.source;
/**
* ID of catalog variant
*/
catalog_variant_id: number;
} & Item);
declare namespace CatalogItem {
/**
* Catalog source
*/
enum source {
CATALOG = "catalog"
}
}
/**
* The gift subject and message
*/
type Gift = {
/**
* Gift message subject
*/
subject?: string;
/**
* Gift message
*/
message?: string;
};
/**
* The values for customized packing slip
*/
type PackingSlip = {
/**
* Customer service email
*/
email?: string;
/**
* Customer service phone
*/
phone?: string;
/**
* Custom packing slip message
*/
message?: string;
/**
* URL address to a sticker we will put on a package
*/
logo_url?: string;
/**
* Store name override for the return address
*/
store_name?: string;
/**
* Your own Order ID that will be printed instead of Printful's Order ID
*/
custom_order_id?: string;
};
/**
* The Order's customization values
*/
type Customization = {
gift?: Gift;
packing_slip?: PackingSlip;
};
/**
* Information about the address for estimations.
*/
type EstimationAddress = {
/**
* State code.
*/
state_code?: string;
/**
* Country code
*/
country_code: string;
/**
* ZIP/Postal code
*/
zip: string;
};
/**
* Retail costs
*/
type RetailCosts_2 = {
/**
* The code of the currency in which the retail costs are returned.
*/
currency?: string;
/**
* Discount sum.
*/
discount?: string;
/**
* Shipping costs.
*/
shipping?: string;
/**
* Sum of taxes (not included in the item price).
*/
tax?: string;
};
declare class OrdersV2Service {
readonly httpRequest: BaseHttpRequest;
constructor(httpRequest: BaseHttpRequest);
/**
* Retrieve a list of orders
* Retrieve a list of orders from a specific store. The order list will be paginated with twenty items per page by default.
* @param limit The number of results to return per page.
* @param offset The number of results to not include in the response starting from the beginning of the list.
*
* This can be used to return results after the initial 100. For example, sending offset 100
*
* @param xPfStoreId Use this to specify which store you want to use (required only for account level token).
*
* The store IDs can be retrieved with the [Get basic information about stores](/docs/#operation/getStores) endpoint.
*
* @returns any OK
* @throws ApiError
*/
getOrders(limit?: number, offset?: number, xPfStoreId?: string): CancelablePromise<any>;
/**
* Create a new order
* This endpoint allows the creation of a new order in which the default status will be `draft`.
* @param xPfStoreId Use this to specify which store you want to use (required only for account level token).
*
* The store IDs can be retrieved with the [Get basic information about stores](/docs/#operation/getStores) endpoint.
*
* @param requestBody POST request body
* @returns any OK
* @throws ApiError
*/
createOrder(xPfStoreId?: string, requestBody?: {
/**
* Order ID from the external system
*/
external_id?: string;
/**
* Shipping method. Defaults to 'STANDARD'
*/
shipping?: string;
/**
* The recipient data.
*/
recipient: Address;
/**
* Array of order items
*/
order_items: Array<CatalogItem>;
customization?: Customization;
retail_costs?: RetailCosts_2;
}): CancelablePromise<any>;
/**
* Retrieve a single order
* Retrieve a single order from the specified store. The result object will contain links to the same resource, order items, and shipments.
* @param orderId Order ID (integer) or Order External ID (string prepended with "@" symbol)
* @param xPfStoreId Use this to specify which store you want to use (required only for account level token).
*
* The store IDs can be retrieved with the [Get basic information about stores](/docs/#operation/getStores) endpoint.
*
* @returns any OK
* @throws ApiError
*/
getOrder(orderId: (number | string), xPfStoreId?: string): CancelablePromise<any>;
/**
* Delete an order
* <div class="alert alert-danger">
* <strong>Warning:</strong> The DELETE HTTP method in version 2 of order in the
* API will delete the order if the order can be deleted. This is distinct from
* version 1 where the DELETE method will actually cancel the order rather than
* delete it. Please, keep this in mind if you are migrating to version 2 from
* version 1
* </div>
*
* Delete the order if it can be deleted. An order can be deleted if it's status is
* `draft`, `failed` or `cancelled`. The order must also have not been charged yet
* and there must be no payments pending.
*
* @param orderId Order ID (integer) or Order External ID (string prepended with "@" symbol)
* @param xPfStoreId Use this to specify which store you want to use (required only for account level token).
*
* The store IDs can be retrieved with the [Get basic information about stores](/docs/#operation/getStores) endpoint.
*
* @returns void
* @throws ApiError
*/
deleteOrder(orderId: (number | string), xPfStoreId?: string): CancelablePromise<void>;
/**
* Update an order
* Make a partial update of an order.
* @param orderId Order ID (integer) or Order External ID (string prepended with "@" symbol)
* @param xPfStoreId Use this to specify which store you want to use (required only for account level token).
*
* The store IDs can be retrieved with the [Get basic information about stores](/docs/#operation/getStores) endpoint.
*
* @param requestBody PATCH request body
* @returns any OK
* @throws ApiError
*/
updateOrder(orderId: (number | string), xPfStoreId?: string, requestBody?: {
/**
* Order ID from the external system
*/
external_id?: string;
/**
* Shipping method. Defaults to 'STANDARD'
*/
shipping?: string;
/**
* The recipient data.
*/
recipient?: Address;
/**
* Array of order items
*/
order_items?: Array<CatalogItem>;
customization?: Customization;
/**
* Retail costs
*/
retail_costs?: {
/**
* The code of the currency in which the retail costs are returned.
*/
currency?: string;
/**
* Discount sum.
*/
discount?: string;
/**
* Shipping costs.
*/
shipping?: string;
/**
* Sum of taxes (not included in the item price).
*/
tax?: string;
};
}): CancelablePromise<any>;
/**
* Confirm an order
* This endpoint allows customers to confirm the order and start the fulfillment in the production facility.
* @param orderId Order ID (integer) or Order External ID (string prepended with "@" symbol)
* @param xPfStoreId Use this to specify which store you want to use (required only for account level token).
*
* The store IDs can be retrieved with the [Get basic information about stores](/docs/#operation/getStores) endpoint.
*
* @returns any OK
* @throws ApiError
*/
confirmOrder(orderId: (number | string), xPfStoreId?: string): CancelablePromise<any>;
/**
* Retrieve a list of order items
* This endpoint retrieves the list of items that belong to the order.
* @param orderId Order ID (integer) or Order External ID (string prepended with "@" symbol)
* @param type Type of items returned (order_item, branding_item). By default all items are returned.
* @param limit The number of results to return per page.
* @param offset The number of results to not include in the response starting from the beginning of the list.
*
* This can be used to return results after the initial 100. For example, sending offset 100
*
* @param xPfStoreId Use this to specify which store you want to use (required only for account level token).
*
* The store IDs can be retrieved with the [Get basic information about stores](/docs/#operation/getStores) endpoint.
*
* @returns any OK
* @throws ApiError
*/
getItemsByOrderId(orderId: (number | string), type?: string, limit?: number, offset?: number, xPfStoreId?: string): CancelablePromise<any>;
/**
* Create a new order item
* This endpoint allows the creation of a new item that will be added to an existing order.
* @param orderId Order ID (integer) or Order External ID (string prepended with "@" symbol