UNPKG

@relewise/integrations

Version:

Helper for updating entities in Relewise

358 lines (335 loc) 14 kB
import { Brand } from '@relewise/client'; import { BrandAdministrativeAction } from '@relewise/client'; import { BrandUpdate } from '@relewise/client'; import { CategoryNameAndId } from '@relewise/client'; import { CategoryPath } from '@relewise/client'; import { Company } from '@relewise/client'; import { CompanyAdministrativeAction } from '@relewise/client'; import { CompanyUpdate } from '@relewise/client'; import { ContentAdministrativeAction } from '@relewise/client'; import { ContentCategoryAdministrativeAction } from '@relewise/client'; import { ContentCategoryUpdate } from '@relewise/client'; import { ContentUpdate } from '@relewise/client'; import { DataValue } from '@relewise/client'; import { FilterBuilder } from '@relewise/client'; import { ProductAdministrativeAction } from '@relewise/client'; import { ProductCategoryAdministrativeAction } from '@relewise/client'; import { ProductCategoryUpdate } from '@relewise/client'; import { ProductUpdate } from '@relewise/client'; import { ProductVariant } from '@relewise/client'; import { RelewiseClient } from '@relewise/client'; import { RelewiseClientOptions } from '@relewise/client'; import { RelewiseRequestOptions } from '@relewise/client'; import { SearchResponseCollection } from '@relewise/client'; import { Trackable } from '@relewise/client'; import { UserDetailsCollectionResponse } from '@relewise/client'; import { UserQuery } from '@relewise/client'; import { UserQueryCriteria } from '@relewise/client'; export declare class BrandAdministrativeActionBuilder { private filterBuilder; private kind; language: string | null | undefined; currency: string | null | undefined; constructor({ language, currency, kind, filters }: { currency?: string | null; language?: string | null; kind: 'Disable' | 'Enable' | 'Delete'; filters: (filterBuilder: FilterBuilder) => void; }); filters(filters: (filterBuilder: FilterBuilder) => void): this; build(): BrandAdministrativeAction; } export declare class BrandUpdateBuilder { private brand; private updateKind; constructor({ id, updateKind }: { id: string; updateKind: 'None' | 'UpdateAndAppend' | 'ReplaceProvidedProperties' | 'ClearAndReplace'; }); displayName(name: string): this; data(data: Record<string, DataValue | null>): this; assortments(assortments: number[]): this; build(): BrandUpdate; } export declare class CategoryPathBuilder { private paths; path(builder: (builder: PathBuilder) => void): this; build(): CategoryPath[]; } export declare class CompanyAdministrativeActionBuilder { private filterBuilder; private kind; language: string | null | undefined; currency: string | null | undefined; constructor({ language, currency, kind, filters }: { currency?: string | null; language?: string | null; kind: 'Disable' | 'Enable' | 'Delete'; filters: (filterBuilder: FilterBuilder) => void; }); filters(filters: (filterBuilder: FilterBuilder) => void): this; build(): CompanyAdministrativeAction; } export declare class CompanyUpdateBuilder { private company; private updateKind; private parentCompanies; private replaceExistingParents; constructor({ id, updateKind, replaceExistingParents }: { id: string; updateKind: 'UpdateAndAppend' | 'ReplaceProvidedProperties' | 'ClearAndReplace'; replaceExistingParents: boolean; }); data(data: Record<string, DataValue | null>): this; parents(parents: Company[]): this; build(): CompanyUpdate; } export declare class ContentAdministrativeActionBuilder { private filterBuilder; private kind; language: string | null | undefined; currency: string | null | undefined; constructor({ language, currency, kind, filters }: { currency?: string | null; language?: string | null; kind: 'Disable' | 'Enable' | 'Delete'; filters: (filterBuilder: FilterBuilder) => void; }); filters(filters: (filterBuilder: FilterBuilder) => void): this; build(): ContentAdministrativeAction; } export declare class ContentCategoryAdministrativeActionBuilder { private filterBuilder; private kind; language: string | null | undefined; currency: string | null | undefined; constructor({ language, currency, kind, filters }: { currency?: string | null; language?: string | null; kind: 'Disable' | 'Enable' | 'Delete'; filters: (filterBuilder: FilterBuilder) => void; }); filters(filters: (filterBuilder: FilterBuilder) => void): this; build(): ContentCategoryAdministrativeAction; } export declare class ContentCategoryUpdateBuilder { private contentCategory; private kind; constructor({ id, kind }: { id: string; kind: 'UpdateAndAppend' | 'ReplaceProvidedProperties' | 'ClearAndReplace'; }); displayName(values: { value: string; language: string; }[]): this; data(data: Record<string, DataValue | null>): this; /** * Add multiple category paths to a content category. Start from the root to the lowest child. Example: Tools -> Outdoor -> Shovel * @param paths * @returns */ categoryPaths(builder: (b: CategoryPathBuilder) => void): this; assortments(assortments: number[]): this; build(): ContentCategoryUpdate; } export declare class ContentUpdateBuilder { private content; private updateKind; constructor({ id, updateKind }: { id: string; updateKind: 'UpdateAndAppend' | 'ReplaceProvidedProperties' | 'ClearAndReplace'; }); displayName(values: { value: string; language: string; }[]): this; data(data: Record<string, DataValue | null>): this; /** * Add multiple category paths to a content. Start from the root to the lowest child. Example: Tools -> Outdoor -> Shovel * @param paths * @returns */ categoryPaths(builder: (b: CategoryPathBuilder) => void): this; assortments(assortments: number[]): this; build(): ContentUpdate; } export declare class CriteriaBuilder { private userQueryCriteria; constructor(); byAuthenticatedId(authenticatedId: string): this; byTemporaryId(temporaryId: string): this; byEmail(email: string): this; byIdentifier(key: string, value: string): this; byIdentifiers(identifiers: Record<string, string>): this; language(language: string): this; currency(currency: string): this; build(): UserQueryCriteria; } export declare class DataAccessor extends RelewiseClient { protected readonly datasetId: string; protected readonly apiKey: string; constructor(datasetId: string, apiKey: string, options?: RelewiseClientOptions); queryUsers(request: UserQuery, options?: RelewiseRequestOptions): Promise<UserDetailsCollectionResponse | undefined>; } export declare class Integrator extends RelewiseClient { protected readonly datasetId: string; protected readonly apiKey: string; batchSize: number; constructor(datasetId: string, apiKey: string, options?: RelewiseClientOptions); updateProduct(request: ProductUpdate, options?: RelewiseRequestOptions): Promise<void | undefined>; executeProductAdministrativeAction(request: ProductAdministrativeAction, options?: RelewiseRequestOptions): Promise<void | undefined>; updateProductCategory(request: ProductCategoryUpdate, options?: RelewiseRequestOptions): Promise<void | undefined>; executeProductCategoryAdministrativeAction(request: ProductCategoryAdministrativeAction, options?: RelewiseRequestOptions): Promise<void | undefined>; updateContentCategory(request: ContentCategoryUpdate, options?: RelewiseRequestOptions): Promise<void | undefined>; executeContentCategoryAdministrativeAction(request: ContentCategoryAdministrativeAction, options?: RelewiseRequestOptions): Promise<void | undefined>; updateContent(request: ContentUpdate, options?: RelewiseRequestOptions): Promise<void | undefined>; executeContentAdministrativeAction(request: ContentAdministrativeAction, options?: RelewiseRequestOptions): Promise<void | undefined>; updateBrand(request: BrandUpdate, options?: RelewiseRequestOptions): Promise<void | undefined>; executeBrandAdministrativeAction(request: BrandAdministrativeAction, options?: RelewiseRequestOptions): Promise<void | undefined>; updateCompany(request: CompanyUpdate, options?: RelewiseRequestOptions): Promise<void | undefined>; executeCompanyAdministrativeAction(request: CompanyAdministrativeAction, options?: RelewiseRequestOptions): Promise<void | undefined>; batch(trackable: Trackable[], options?: RelewiseRequestOptions): Promise<SearchResponseCollection | undefined>; private chunk; } export declare class PathBuilder { private path; category(categoryIdAndName: { id: string; displayName: { value: string; language: string; }[]; }): this; build(): CategoryNameAndId[]; } export declare type PathNode = { id: string; displayName: { value: string; language: string; }[]; }; export declare class ProductAdministrativeActionBuilder { private filterBuilder; private productUpdateKind; private variantUpdateKind; language: string | null | undefined; currency: string | null | undefined; constructor({ language, currency, productUpdateKind, variantUpdateKind, filters }: { currency?: string | null; language?: string | null; productUpdateKind: 'None' | 'Disable' | 'Enable' | 'PermanentlyDelete' | 'Delete'; variantUpdateKind?: 'None' | 'Disable' | 'Enable' | 'PermanentlyDelete' | 'Delete'; filters: (filterBuilder: FilterBuilder) => void; }); filters(filters: (filterBuilder: FilterBuilder) => void): this; build(): ProductAdministrativeAction; } export declare class ProductCategoryAdministrativeActionBuilder { private filterBuilder; private kind; language: string | null | undefined; currency: string | null | undefined; constructor({ language, currency, kind, filters }: { currency?: string | null; language?: string | null; kind: 'Disable' | 'Enable' | 'Delete'; filters: (filterBuilder: FilterBuilder) => void; }); filters(filters: (filterBuilder: FilterBuilder) => void): this; build(): ProductCategoryAdministrativeAction; } export declare type ProductCategoryPath = { path: PathNode[]; }; export declare class ProductCategoryUpdateBuilder { private productCategory; private kind; constructor({ id, kind }: { id: string; kind: 'UpdateAndAppend' | 'ReplaceProvidedProperties' | 'ClearAndReplace'; }); displayName(values: { value: string; language: string; }[]): this; data(data: Record<string, DataValue | null>): this; /** * Add multiple category paths to a product category. Start from the root to the lowest child. Example: Tools -> Outdoor -> Shovel * @param paths * @returns */ categoryPaths(builder: (b: CategoryPathBuilder) => void): this; assortments(assortments: number[]): this; build(): ProductCategoryUpdate; } export declare class ProductUpdateBuilder { private product; private productUpdateKind; private variantUpdateKind; private brandUpdateKind; private replaceExistingVariants; private productVariants; constructor({ id, productUpdateKind, brandUpdateKind, variantUpdateKind, replaceExistingVariants }: { id: string; productUpdateKind: 'None' | 'UpdateAndAppend' | 'ReplaceProvidedProperties' | 'ClearAndReplace'; variantUpdateKind?: 'None' | 'UpdateAndAppend' | 'ReplaceProvidedProperties' | 'ClearAndReplace'; replaceExistingVariants?: boolean; brandUpdateKind?: 'None' | 'UpdateAndAppend' | 'ReplaceProvidedProperties' | 'ClearAndReplace' | null; }); displayName(values: { value: string; language: string; }[]): this; data(data: Record<string, DataValue | null>): this; variants(variants: ProductVariant[]): this; /** * Add multiple category paths to a product. Start from the root to the lowest child. Example: Tools -> Outdoor -> Shovel * @param paths * @returns */ categoryPaths(builder: (b: CategoryPathBuilder) => void): this; assortments(assortments: number[]): this; listPrice(values: { amount: number; currency: string; }[]): this; salesPrice(values: { amount: number; currency: string; }[]): this; brand(brand: Brand): this; build(): ProductUpdate; } export declare class ProductVariantBuilder { private variant; constructor({ id }: { id: string; }); displayName(values: { value: string; language: string; }[]): this; data(data: Record<string, DataValue | null>): this; assortments(assortments: number[]): this; listPrice(values: { amount: number; currency: string; }[]): this; salesPrice(values: { amount: number; currency: string; }[]): this; specifications(specifications: Record<string, string>): this; build(): ProductVariant; } export declare class UserQueryBuilder { private userQuery; constructor(); criteria(criteria: (criteria: CriteriaBuilder) => void): this; language(language: string): this; currency(currency: string): this; build(): UserQuery; } export { }