Broadleaf Microservices
  • v1.0.0-latest-prod

Core Types

ApiError

Response object that represents some error state from the API.

Property Type Description

cancelled?

boolean

Whether the error was from the request being cancelled.

exception?

string

Optional exception class name.

globalErrors?

Array<GlobalApiError>

Optionally gives additional information to the client about what was wrong with their request.

status

string

The HTTP status type such as NOT_FOUND.

statusCode

number

The HTTP status code such as 404.

timestamp

string

When the error occurred as an ISO formatted date string.

title

string

A human-readable representation of the type of error being returned.

type

string

A machine-readable representation of the type of error being returned.

ApiValidationError

extends ApiError

Type of ApiError for entity validation failures.

Property Type Description

fieldErrors

Record<string, Array<FieldValidationError>>

Map of FieldValidationErrors where the key is the FieldValidationError#path.

ClientCallOptions

Options passed to the HTTP request call to customize the request configuration.

Property Type Description

applicationToken?

string

Application token to be used for this specific operation. This will take precedence over the client’s applicationToken.

accessToken?

string

Bearer token to be used to authorize this request for a particular user. This will include an Authorization header with the value Bearer ${accessToken}.

cancelToken?

CancelToken

Axios CancelToken to be used for request cancellation. This will be included on the request configuration passed to the request agent.

config?

AxiosRequestConfig

Overrides of the HTTP request configuration for an operation. These overrides will be merged into the default request configuration for the operation.

await client.getOperation({
  config: {
    headers: {
      'X-My-Header': 'My Header Value'
    }
  }
});

configCustomizer?

(config: AxiosRequestConfig) ⇒ Promise<void> | void

Function used to customize the HTTP request configuration for an operation. This function can be async and return a Promise.

await client.doOperation({
  configCustomizer: config => {
    config.headers['X-My-Header'] = 'My Header Value';
  }
});

headers?

{ [name: string]: string }

Overrides for the HTTP request headers for an operation. These headers will be merged into the default request headers for the operation.

locale?

string

The current locale for the operation. This value will be added as an Accept-Language header on the requst.

params?

{ [name: string]: unknown }

Overrides for the HTTP request parameters for an operation. These parameters will be merged into the default request parameters for the operation.

preview?

PreviewOptions

Options that allow for the access of sandboxed preview data

ClientOptions

Property Type Description

agent?

AxiosInstance

applicationToken?

string

Application token to be used for this specific operation.

baseURL?

string

Base URL for the axios client.

baseHost?

string

Concatenated with the basePath to create the default baseURL. Ignored if baseURL is provided.

basePath?

string

Concatenated with the baseHost to create the default baseURL. Ignored if baseURL is provided.

locale?

string

The current locale for the operation. This value will be added as an Accept-Language header on the requst.

preview?

PreviewOptions

Options passed to the HTTP request call to customize the request for previews. These will be treated as the default values when constructing the relevant request headers.

defaults?

AxiosRequestConfig

Default request configuration.

CurrencyUnit

Property Type Description

currencyCode

string

The unique currency code, the effective code depends on the currency.

numericCode?

string

The numeric currency code. within the ISO-4217 name space.

DefaultRequestHeaderType (Enum)

Defines the names of frequently used request headers.

Name Value Description

ACCEPT_LANGUAGE

'Accept-Language'

AUTHORIZATION

'Authorization'

APPLICATION_TOKEN

'X-Application-Token'

PREVIEW_SANDBOX

'X-Preview-Sandbox'

PREVIEW_TOKEN

'X-Preview-Token'

PREVIEW_DATE

'X-Preview-Date'

EntityAsset

Represents a digital asset related to some entity like a product.

Property Type Description

applicationId

string

The application id that this asset is associated with, used for asset resolving

tenantId

string

The tenant id that this asset is associated with, used for asset resolving

type

string

Describes the general type of the asset.

provider

string

The name of the provider that is hosting the asset.

url

string

The location used to resolve this asset.

contentUrl

string

Fully quailified URL for the asset. Includes all tenant and context information.

embedCode

string

If and only if the type is 'EMBED', this field holds the HTML to embed.

altText

string

Text that corresponds to the HTML alt attribute that should be used when this asset is rendered in a browser.

title

string

Text that corresponds to the HTML title attribute that should be used when this asset is rendered in a browser.

tags

Array<string>

Descriptive or identifying labels.

[key: string]

unknown

FieldValidationError

extends GlobalApiError

Type of GlobalApiError for information about a field that failed validation.

Property Type Description

path

string

Path on the validated entity to the field that failed validation: cartItems[0].quantity.

rejectedValue?

unknown

Value that was rejected if applicable.

GlobalApiError

Represents an individual global error that came back from the API.

Property Type Description

code

string

Can be either machine-readable or human-readable representation of the error.

reason

string

Human-readable representation of the error

MonetaryAmount

Property Type Description

amount

number

The monetary amount.

currency

string

The currency.

NarrowedPageable

extends UnnumberedPageable

Pageable that is suitable for denoting page boundaries for a narrowed fetch. Narrowed fetch results generally go through a NarrowExecutor and as a result, can provide a narrowed result set from what is physically represented in the database. For this reason, it is important to keep track of a silent underlyingPageSize when determining next page offset values. For example, next page offset is generally calculated as the current offset plus the underlyingPageSize.

Property Type Description

forward

boolean

Whether the pagination results represent a forward progression or backwards progression.

underlyingPageSize

number

The number of physical database records processed. This can be different than the narrowed records returned in a page.

NarrowedPageRequest

Params to include in API requests to indicate pagination options for denoting page boundaries for a narrowed fetch.

Property Type Description

forward

boolean

Whether to request a forward progression of results or a backward one.

offset

number

The offset to start the progression of the results, e.g., start at the 10th element.

sort?

string

How the results should be sorted.

Page<T, P>

Represents a "page" of data.

Property Type Description

content

Array<T>

The content in this page.

empty

boolean

Whether the page had no results.

first

boolean

Whether the page is the first.

last

boolean

Whether the page is the last.

number?

number

The page number.

numberOfElements

number

The number of elements in this page.

pageable

P

The pagination info.

size

number

The size of the page.

sort

Sort

The sort details for the page.

totalElements?

number

The total of all elements including those that extend beyond this page.

totalPages?

number

The total number of pages that can be returned based on the size and total elements.

Pageable

Defines the pagination for a result set.

Property Type Description

paged

boolean

Whether it contains paged information.

offset

number

The offset to be taken according to the underlying page and page size.

pageNumber?

number

The page number.

pageSize

number

The number of items to be returned.

sort?

Sort

The sort params for the pageable

unpaged

boolean

Whether it does NOT contain paged information.

PageRequestParams

Params to include in API requests to indicate pagination options for default paging.

Property Type Description

page?

number

The number of the page desired.

size?

number

The size of the page desired.

sort?

string

How the results should be sorted.

PreviewOptions

Options passed to the HTTP request call to customize the request for previews. This if the token is valid and and the sandbox is with in the same context as the token with a valid date

Property Type Description

token

string

Preview token to authorize that a request has access to preview data for a given sandbox

sandbox

string

The Sandbox ID.

date?

string

The date in which to preview data.

Sort

Defines the sort details for a result set.

Property Type Description

empty

boolean

Whether it is empty.

orders?

Array<SortOrder>

Ordering to apply.

sorted

boolean

Whether it is sorted.

unsorted

boolean

Whether it is NOT sorted.

SortOrder

Describes the sort details for a specific property.

Property Type Description

direction

'ASC' | 'DESC'

The sort direction.

ignoreCase

boolean

Whether to ignore case when sorting on the property.

property

string

The property to sort by.

nullHandling

'NATIVE' | 'NULLS_FIRST' | 'NULLS_LAST'

How to handle null values when sorting.