Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ShopperPromotions

View details for active promotions.

Example with shopper auth

import { Pricing, ClientConfig, Customer, slasHelpers } from "commerce-sdk";
// or
const { Pricing, ClientConfig, Customer, slasHelpers } = require("commerce-sdk");

const clientConfig: ClientConfig = {
  parameters: {
    clientId: "XXXXXX",
    organizationId: "XXXX",
    shortCode: "XXX",
    siteId: "XX"
  }
};

// must be registered in SLAS. On server, redirectURI is never called
const redirectURI = "http://localhost:3000/callback";
const slasClient = new Customer.ShopperLogin(clientConfig);
token = await slasHelpers.loginGuestUser(slasClient, { redirectURI });

clientConfig.headers['authorization'] = `Bearer ${token.access_token}`;
const shopperPromotionsClient = new Pricing.ShopperPromotions(clientConfig);
API Version: 1.0.21
Last Updated:

Hierarchy

  • BaseClient
    • ShopperPromotions

Index

Type aliases

Static AsyncCreated

AsyncCreated: {}

Type declaration

Static AttributeDefinition

AttributeDefinition: { defaultValue?: PropertyValueDefinition; description: L10nString; id?: string; key?: boolean; localizable?: boolean; mandatory?: boolean; max?: number; min?: number; minLength?: number; multiValueType?: boolean; name: L10nString; possibleValues?: Array<PropertyValueDefinition>; regularExpression?: string; scale?: number; searchable?: boolean; siteSpecific?: boolean; system?: boolean; type: string; unit?: L10nString; visible?: boolean }

Type declaration

  • Optional defaultValue?: PropertyValueDefinition
  • description: L10nString
  • Optional id?: string
  • Optional key?: boolean
  • Optional localizable?: boolean
  • Optional mandatory?: boolean
  • Optional max?: number
  • Optional min?: number
  • Optional minLength?: number
  • Optional multiValueType?: boolean
  • name: L10nString
  • Optional possibleValues?: Array<PropertyValueDefinition>
  • Optional regularExpression?: string
  • Optional scale?: number
  • Optional searchable?: boolean
  • Optional siteSpecific?: boolean
  • Optional system?: boolean
  • type: string
  • Optional unit?: L10nString
  • Optional visible?: boolean

Static BoolFilter

BoolFilter: { filters?: Array<any>; operator: string } & {}

Static BoolQuery

BoolQuery: { must?: Array<any>; mustNot?: Array<any>; should?: Array<any> } & {}

Static ChangeControlled

ChangeControlled: { createdBy?: string; creationDate?: any; lastModifiedBy?: string; modificationDate?: any } & {}

Static ChangeControlledDataType

ChangeControlledDataType: { createdBy?: string; creationDate?: any; lastModifiedBy?: string; modificationDate?: any } & {}

Static ClosedObject

ClosedObject: {} & {}

Static DateConditionalRequest

DateConditionalRequest: {}

Type declaration

Static DateRangeFilter

DateRangeFilter: {}

Type declaration

Static DatetimeRangeFilter

DatetimeRangeFilter: {}

Type declaration

Static Error

Error: { detail?: string; instance?: string; title?: string; type: string } & {}

Static ErrorResponse

ErrorResponse: { detail?: string; instance?: string; title?: string; type: string } & {}

Static EtagConditionalRequest

EtagConditionalRequest: {}

Type declaration

Static EtagResponse

EtagResponse: {}

Type declaration

Static Filter

Filter: { boolFilter?: BoolFilter; queryFilter?: QueryFilter; range2Filter?: Range2Filter; rangeFilter?: RangeFilter; termFilter?: TermFilter } & {}

Static FilteredQuery

FilteredQuery: { filter: any; query: any } & {}

Static IntegerRangeFilter

IntegerRangeFilter: {}

Type declaration

Static L10nString

L10nString: {} & {}

Static LocalizedString

LocalizedString: {} & {}

Static MatchAllQuery

MatchAllQuery: {} & {}

Static Money

Money: { currencyMnemonic?: string; value?: number } & {}

Static MoneyMnemonic

MoneyMnemonic: { currencyMnemonic?: string; value?: number } & {}

Static NestedQuery

NestedQuery: { path: string; query: any; scoreMode?: string } & {}

Static NoPropertiesAllowed

NoPropertiesAllowed: {}

Type declaration

Static NumericRangeFilter

NumericRangeFilter: {}

Type declaration

Static OffsetPaginated

OffsetPaginated: {}

Type declaration

Static OpenObject

OpenObject: {} & {}

Static PaginatedSearchResult

PaginatedSearchResult: { hits?: Array<object>; limit: number; offset: any; query: any; sorts?: Array<Sort>; total: any } & {}

Static PaginatedSearchResultBase

PaginatedSearchResultBase: { hits?: Array<object>; limit: number; offset: any; query: any; sorts?: Array<Sort>; total: any } & {}

Static Promotion

Promotion: { calloutMsg?: string; currency?: string; details?: string; endDate?: any; id: string; image?: string; name?: string; startDate?: any } & {}

Static PromotionNotFound

PromotionNotFound: {}

Type declaration

Static PromotionResult

PromotionResult: { count: number; data: Array<Promotion>; total: number } & {}

Static PropertyDefinition

PropertyDefinition: { defaultValue?: PropertyValueDefinition; description: L10nString; id?: string; key?: boolean; localizable?: boolean; mandatory?: boolean; max?: number; min?: number; minLength?: number; multiValueType?: boolean; name: L10nString; possibleValues?: Array<PropertyValueDefinition>; regularExpression?: string; scale?: number; searchable?: boolean; siteSpecific?: boolean; system?: boolean; type: string; unit?: L10nString; visible?: boolean } & {}

Static PropertyValueDefinition

PropertyValueDefinition: { description: L10nString; displayValue: L10nString; id: string; position?: number; value: string }

Type declaration

  • description: L10nString
  • displayValue: L10nString
  • id: string
  • Optional position?: number
  • value: string

Static Query

Query: { boolQuery?: BoolQuery; filteredQuery?: FilteredQuery; matchAllQuery?: MatchAllQuery; nestedQuery?: NestedQuery; termQuery?: TermQuery; textQuery?: TextQuery } & {}

Static QueryFilter

QueryFilter: { query: any } & {}

Static QueryParamsLimit

QueryParamsLimit: {}

Type declaration

Static QueryParamsOffset

QueryParamsOffset: {}

Type declaration

Static Range2Filter

Range2Filter: { filterMode?: string; fromField: string; fromInclusive?: boolean; fromValue?: any; toField: string; toInclusive?: boolean; toValue?: any } & {}

Static RangeFilter

RangeFilter: {}

Type declaration

Static RateLimited

RateLimited: {}

Type declaration

Static RateLimited2

RateLimited2: {}

Type declaration

Static RateLimited3

RateLimited3: {}

Type declaration

Static RateLimited4

RateLimited4: {}

Type declaration

Static RateLimited5

RateLimited5: {}

Type declaration

Static SearchRequest

SearchRequest: { limit?: number; offset?: any; query: any; sorts?: Array<Sort> } & {}

Static SearchRequestBase

SearchRequestBase: { limit?: number; offset?: any; query: any; sorts?: Array<Sort> } & {}

Static SimpleSearchResult

SimpleSearchResult: { hits?: Array<object>; limit: number; offset: any; total: any } & {}

Static SimpleSearchResultBase

SimpleSearchResultBase: { hits?: Array<object>; limit: number; offset: any; total: any } & {}

Static SiteSpecific

SiteSpecific: {}

Type declaration

Static Sort

Sort: { field: string; sortOrder?: string } & {}

Static SpecifiedPropertiesAllowed

SpecifiedPropertiesAllowed: {} & {}

Static SyncCreated

SyncCreated: {}

Type declaration

Static TermFilter

TermFilter: { field: string; operator: string; values?: Array<any> } & {}

Static TermQuery

TermQuery: { fields: Array<string>; operator: string; values?: Array<any> } & {}

Static TextQuery

TextQuery: { fields: Array<string>; searchPhrase: string } & {}

Static badrequest

badrequest: {}

Type declaration

Constructors

constructor

  • Parameters

    • config: ClientConfig

    Returns ShopperPromotions

Properties

clientConfig

clientConfig: ClientConfig

Methods

getPromotions

  • getPromotions(options?: { fetchOptions?: RequestInit; headers?: {}; parameters?: { ids: string; locale?: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }): Promise<PromotionResult>
  • getPromotions<T>(options?: { fetchOptions?: RequestInit; headers?: {}; parameters?: { ids: string; locale?: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }, rawResponse?: T): Promise<T extends true ? Response : ShopperPromotions.PromotionResult>
  • Returns an array of enabled promotions for a list of specified IDs. In the request URL, you can specify up to 50 IDs. If you specify an ID that contains either parentheses or the separator characters, you must URL encode these characters. Each request returns only enabled promotions as the server does not consider promotion qualifiers or schedules.

    If you would like to get a raw Response object use the other getPromotions function.

    Parameters

    • Optional options: { fetchOptions?: RequestInit; headers?: {}; parameters?: { ids: string; locale?: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { ids: string; locale?: string; organizationId?: string; siteId?: string } & {}
      • Optional retrySettings?: OperationOptions

    Returns Promise<PromotionResult>

    A promise of type ShopperPromotions.PromotionResult.

  • Returns an array of enabled promotions for a list of specified IDs. In the request URL, you can specify up to 50 IDs. If you specify an ID that contains either parentheses or the separator characters, you must URL encode these characters. Each request returns only enabled promotions as the server does not consider promotion qualifiers or schedules.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: { fetchOptions?: RequestInit; headers?: {}; parameters?: { ids: string; locale?: string; organizationId?: string; siteId?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { ids: string; locale?: string; organizationId?: string; siteId?: string } & {}
      • Optional retrySettings?: OperationOptions
    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : ShopperPromotions.PromotionResult>

    A promise of type Response if rawResponse is true, a promise of type ShopperPromotions.PromotionResult otherwise.

getPromotionsForCampaign

  • getPromotionsForCampaign(options?: { fetchOptions?: RequestInit; headers?: {}; parameters?: { campaignId: string; currency?: string; endDate?: string; organizationId?: string; siteId?: string; startDate?: string } & {}; retrySettings?: OperationOptions }): Promise<PromotionResult>
  • getPromotionsForCampaign<T>(options?: { fetchOptions?: RequestInit; headers?: {}; parameters?: { campaignId: string; currency?: string; endDate?: string; organizationId?: string; siteId?: string; startDate?: string } & {}; retrySettings?: OperationOptions }, rawResponse?: T): Promise<T extends true ? Response : ShopperPromotions.PromotionResult>
  • Handles get promotion by filter criteria. Returns an array of enabled promotions matching the specified filter criteria. In the request URL, you must provide a campaign_id parameter, and you can optionally specify a date range by providing start_date and end_date parameters. Both parameters are required to specify a date range, as omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled promotions, since the server does not consider promotion qualifiers or schedules.

    If you would like to get a raw Response object use the other getPromotionsForCampaign function.

    Parameters

    • Optional options: { fetchOptions?: RequestInit; headers?: {}; parameters?: { campaignId: string; currency?: string; endDate?: string; organizationId?: string; siteId?: string; startDate?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { campaignId: string; currency?: string; endDate?: string; organizationId?: string; siteId?: string; startDate?: string } & {}
      • Optional retrySettings?: OperationOptions

    Returns Promise<PromotionResult>

    A promise of type ShopperPromotions.PromotionResult.

  • Handles get promotion by filter criteria. Returns an array of enabled promotions matching the specified filter criteria. In the request URL, you must provide a campaign_id parameter, and you can optionally specify a date range by providing start_date and end_date parameters. Both parameters are required to specify a date range, as omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled promotions, since the server does not consider promotion qualifiers or schedules.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: { fetchOptions?: RequestInit; headers?: {}; parameters?: { campaignId: string; currency?: string; endDate?: string; organizationId?: string; siteId?: string; startDate?: string } & {}; retrySettings?: OperationOptions }

      An object containing the options for this method.

      • Optional fetchOptions?: RequestInit
      • Optional headers?: {}
        • [key: string]: string
      • Optional parameters?: { campaignId: string; currency?: string; endDate?: string; organizationId?: string; siteId?: string; startDate?: string } & {}
      • Optional retrySettings?: OperationOptions
    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : ShopperPromotions.PromotionResult>

    A promise of type Response if rawResponse is true, a promise of type ShopperPromotions.PromotionResult otherwise.

Generated using TypeDoc