commerce-sdk-isomorphic 4.0.0 → 4.0.1-preview-shopper-configurations.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -3
- package/lib/clientConfig.cjs.d.ts +52 -0
- package/lib/clientConfig.cjs.js +1 -0
- package/lib/clientConfig.d.ts +52 -0
- package/lib/clientConfig.js +1 -0
- package/lib/config.cjs.d.ts +2 -0
- package/lib/config.cjs.js +1 -0
- package/lib/config.d.ts +2 -0
- package/lib/config.js +1 -0
- package/lib/helpers.cjs.d.ts +2225 -0
- package/lib/helpers.cjs.js +1 -0
- package/lib/helpers.d.ts +2225 -0
- package/lib/helpers.js +1 -0
- package/lib/index.cjs.d.ts +748 -6
- package/lib/index.cjs.js +1 -1
- package/lib/index.esm.d.ts +748 -6
- package/lib/index.esm.js +1 -1
- package/lib/responseError.cjs.d.ts +12 -0
- package/lib/responseError.cjs.js +1 -0
- package/lib/responseError.d.ts +12 -0
- package/lib/responseError.js +1 -0
- package/lib/shopperBaskets.cjs.d.ts +10259 -0
- package/lib/shopperBaskets.cjs.js +1 -0
- package/lib/shopperBaskets.d.ts +10259 -0
- package/lib/shopperBaskets.js +1 -0
- package/lib/shopperBasketsv2.cjs.d.ts +10453 -0
- package/lib/shopperBasketsv2.cjs.js +1 -0
- package/lib/shopperBasketsv2.d.ts +10453 -0
- package/lib/shopperBasketsv2.js +1 -0
- package/lib/shopperConfigurations.cjs.d.ts +601 -0
- package/lib/shopperConfigurations.cjs.js +1 -0
- package/lib/shopperConfigurations.d.ts +601 -0
- package/lib/shopperConfigurations.js +1 -0
- package/lib/shopperConsents.cjs.d.ts +1142 -0
- package/lib/shopperConsents.cjs.js +1 -0
- package/lib/shopperConsents.d.ts +1142 -0
- package/lib/shopperConsents.js +1 -0
- package/lib/shopperContext.cjs.d.ts +1401 -0
- package/lib/shopperContext.cjs.js +1 -0
- package/lib/shopperContext.d.ts +1401 -0
- package/lib/shopperContext.js +1 -0
- package/lib/shopperCustomers.cjs.d.ts +12425 -0
- package/lib/shopperCustomers.cjs.js +1 -0
- package/lib/shopperCustomers.d.ts +12425 -0
- package/lib/shopperCustomers.js +1 -0
- package/lib/shopperExperience.cjs.d.ts +1169 -0
- package/lib/shopperExperience.cjs.js +1 -0
- package/lib/shopperExperience.d.ts +1169 -0
- package/lib/shopperExperience.js +1 -0
- package/lib/shopperGiftCertificates.cjs.d.ts +729 -0
- package/lib/shopperGiftCertificates.cjs.js +1 -0
- package/lib/shopperGiftCertificates.d.ts +729 -0
- package/lib/shopperGiftCertificates.js +1 -0
- package/lib/shopperLogin.cjs.d.ts +3842 -0
- package/lib/shopperLogin.cjs.js +1 -0
- package/lib/shopperLogin.d.ts +3842 -0
- package/lib/shopperLogin.js +1 -0
- package/lib/shopperOrders.cjs.d.ts +5393 -0
- package/lib/shopperOrders.cjs.js +1 -0
- package/lib/shopperOrders.d.ts +5393 -0
- package/lib/shopperOrders.js +1 -0
- package/lib/shopperProducts.cjs.d.ts +3479 -0
- package/lib/shopperProducts.cjs.js +1 -0
- package/lib/shopperProducts.d.ts +3479 -0
- package/lib/shopperProducts.js +1 -0
- package/lib/shopperPromotions.cjs.d.ts +1001 -0
- package/lib/shopperPromotions.cjs.js +1 -0
- package/lib/shopperPromotions.d.ts +1001 -0
- package/lib/shopperPromotions.js +1 -0
- package/lib/shopperSearch.cjs.d.ts +3352 -0
- package/lib/shopperSearch.cjs.js +1 -0
- package/lib/shopperSearch.d.ts +3352 -0
- package/lib/shopperSearch.js +1 -0
- package/lib/shopperSeo.cjs.d.ts +769 -0
- package/lib/shopperSeo.cjs.js +1 -0
- package/lib/shopperSeo.d.ts +769 -0
- package/lib/shopperSeo.js +1 -0
- package/lib/shopperStores.cjs.d.ts +1289 -0
- package/lib/shopperStores.cjs.js +1 -0
- package/lib/shopperStores.d.ts +1289 -0
- package/lib/shopperStores.js +1 -0
- package/lib/templateUrl.cjs.d.ts +76 -0
- package/lib/templateUrl.cjs.js +1 -0
- package/lib/templateUrl.d.ts +76 -0
- package/lib/templateUrl.js +1 -0
- package/lib/version.cjs.d.ts +3 -0
- package/lib/version.cjs.js +1 -0
- package/lib/version.d.ts +3 -0
- package/lib/version.js +1 -0
- package/package.json +93 -26
|
@@ -0,0 +1,1289 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2021, salesforce.com, inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
import { RequestInit as NodeRequestInit } from "node-fetch";
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
10
|
+
* All rights reserved.
|
|
11
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
13
|
+
*/
|
|
14
|
+
declare const defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/store/shopper-stores/v1";
|
|
15
|
+
/**
|
|
16
|
+
* Makes a type easier to read.
|
|
17
|
+
*/
|
|
18
|
+
type Prettify<T> = NonNullable<{
|
|
19
|
+
[K in keyof T]: T[K];
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Generates the types required on a method, based on those provided in the config.
|
|
23
|
+
*/
|
|
24
|
+
type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Prettify<Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>>;
|
|
25
|
+
/**
|
|
26
|
+
* If an object has a `parameters` property, and the `parameters` object has required properties,
|
|
27
|
+
* then the `parameters` property on the root object is marked as required.
|
|
28
|
+
*/
|
|
29
|
+
type RequireParametersUnlessAllAreOptional<T extends {
|
|
30
|
+
parameters?: Record<string, unknown>;
|
|
31
|
+
}> = Record<string, never> extends NonNullable<T["parameters"]> ? T : Prettify<T & Required<Pick<T, "parameters">>>;
|
|
32
|
+
/**
|
|
33
|
+
* Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
|
|
34
|
+
* if not specified.
|
|
35
|
+
*/
|
|
36
|
+
interface BaseUriParameters {
|
|
37
|
+
shortCode: string;
|
|
38
|
+
}
|
|
39
|
+
type LocaleCode = {
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Generic interface for path parameters.
|
|
44
|
+
*/
|
|
45
|
+
interface PathParameters {
|
|
46
|
+
[key: string]: string | number | boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Generic interface for query parameters.
|
|
50
|
+
*/
|
|
51
|
+
interface QueryParameters {
|
|
52
|
+
[key: string]: string | number | boolean | string[] | number[] | LocaleCode;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
|
|
56
|
+
* it from the `RequestInit` provided by node-fetch.
|
|
57
|
+
*/
|
|
58
|
+
type BrowserRequestInit = RequestInit;
|
|
59
|
+
/**
|
|
60
|
+
* Any properties supported in either the browser or node are accepted.
|
|
61
|
+
* Using the right properties in the right context is left to the user.
|
|
62
|
+
*/
|
|
63
|
+
type FetchOptions = NodeRequestInit & BrowserRequestInit;
|
|
64
|
+
/**
|
|
65
|
+
* Base options that can be passed to the `ClientConfig` class.
|
|
66
|
+
*/
|
|
67
|
+
interface ClientConfigInit<Params extends BaseUriParameters> {
|
|
68
|
+
baseUri?: string;
|
|
69
|
+
proxy?: string;
|
|
70
|
+
headers?: {
|
|
71
|
+
[key: string]: string;
|
|
72
|
+
};
|
|
73
|
+
parameters: Params;
|
|
74
|
+
fetchOptions?: FetchOptions;
|
|
75
|
+
transformRequest?: (data: unknown, headers: {
|
|
76
|
+
[key: string]: string;
|
|
77
|
+
}) => Required<FetchOptions>["body"];
|
|
78
|
+
throwOnBadResponse?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Configuration parameters common to Commerce SDK clients
|
|
82
|
+
*/
|
|
83
|
+
declare class ClientConfig<Params extends BaseUriParameters> implements ClientConfigInit<Params> {
|
|
84
|
+
baseUri?: string;
|
|
85
|
+
proxy?: string;
|
|
86
|
+
headers: {
|
|
87
|
+
[key: string]: string;
|
|
88
|
+
};
|
|
89
|
+
parameters: Params;
|
|
90
|
+
fetchOptions: FetchOptions;
|
|
91
|
+
transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
|
|
92
|
+
throwOnBadResponse: boolean;
|
|
93
|
+
constructor(config: ClientConfigInit<Params>);
|
|
94
|
+
static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A specialized value indicating the system default values for locales.
|
|
98
|
+
*/
|
|
99
|
+
type DefaultFallback = "default";
|
|
100
|
+
/**
|
|
101
|
+
* The unit the distance attribute is measured in (either in miles or kilometers).
|
|
102
|
+
*/
|
|
103
|
+
type DistanceUnit = "km" | "mi";
|
|
104
|
+
/**
|
|
105
|
+
* @type ErrorResponse:
|
|
106
|
+
*
|
|
107
|
+
* @property title: A short, human-readable summary of the problem type. It will not change from occurrence to occurrence of the problem, except for purposes of localization
|
|
108
|
+
* - **Max Length:** 256
|
|
109
|
+
*
|
|
110
|
+
* @property type: A URI reference [RFC3986] that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML [W3C.REC-html5-20141028]). When this member is not present, its value is assumed to be \"about:blank\". It accepts relative URIs; this means that they must be resolved relative to the document\'s base URI, as per [RFC3986], Section 5.
|
|
111
|
+
* - **Max Length:** 2048
|
|
112
|
+
*
|
|
113
|
+
* @property detail: A human-readable explanation specific to this occurrence of the problem.
|
|
114
|
+
*
|
|
115
|
+
* @property instance: A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. It accepts relative URIs; this means that they must be resolved relative to the document\'s base URI, as per [RFC3986], Section 5.
|
|
116
|
+
* - **Max Length:** 2048
|
|
117
|
+
*
|
|
118
|
+
*/
|
|
119
|
+
type ErrorResponse = {
|
|
120
|
+
title: string;
|
|
121
|
+
type: string;
|
|
122
|
+
detail: string;
|
|
123
|
+
instance?: string;
|
|
124
|
+
} & {
|
|
125
|
+
[key: string]: any;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* @type LocaleCode
|
|
129
|
+
* A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
|
|
130
|
+
*/
|
|
131
|
+
type LocaleCode$0 = DefaultFallback | string;
|
|
132
|
+
/**
|
|
133
|
+
* @type PaginatedResultBase: Schema defining generic pageable result. Each response schema of a resource requiring pagination should extend this schema. If you use this extend this schema directly, it needs to be defined what data is returned. Allowed names for the data field is `data`.
|
|
134
|
+
*
|
|
135
|
+
* @property offset: The zero-based index of the first hit/data to include in the result.
|
|
136
|
+
*
|
|
137
|
+
* @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
|
|
138
|
+
*
|
|
139
|
+
* @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
|
|
140
|
+
*
|
|
141
|
+
*/
|
|
142
|
+
type PaginatedResultBase = {
|
|
143
|
+
offset: number;
|
|
144
|
+
limit: number;
|
|
145
|
+
total: number;
|
|
146
|
+
} & {
|
|
147
|
+
[key: string]: any;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* @type ResultBase: Schema defining generic list result. Each response schema of a resource requiring a list response should extend this schema. Additionally it needs to be defined what data is returned.
|
|
151
|
+
*
|
|
152
|
+
* @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
|
|
153
|
+
*
|
|
154
|
+
* @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
|
|
155
|
+
*
|
|
156
|
+
*/
|
|
157
|
+
type ResultBase = {
|
|
158
|
+
limit: number;
|
|
159
|
+
total: number;
|
|
160
|
+
} & {
|
|
161
|
+
[key: string]: any;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* @type Store: Document representing a store.
|
|
165
|
+
*
|
|
166
|
+
* @property address1: The primary address of the store.
|
|
167
|
+
* - **Min Length:** 1
|
|
168
|
+
*
|
|
169
|
+
* @property address2: The secondary address of the store.
|
|
170
|
+
*
|
|
171
|
+
* @property city: The city of the store.
|
|
172
|
+
*
|
|
173
|
+
* @property countryCode: A two letter uppercase country code conforming to the [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 standard.
|
|
174
|
+
* - **Pattern:** /^[A-Z][A-Z]$/
|
|
175
|
+
*
|
|
176
|
+
* @property distance: The distance to the given geolocation where the stores will be searched, using the unit given in the attribute \'DistanceUnit\' (miles or kilometers).
|
|
177
|
+
*
|
|
178
|
+
* @property distanceUnit:
|
|
179
|
+
*
|
|
180
|
+
* @property email: The email address of the store.
|
|
181
|
+
*
|
|
182
|
+
* @property fax: The fax number of the store.
|
|
183
|
+
*
|
|
184
|
+
* @property id: The id of the store.
|
|
185
|
+
* - **Min Length:** 1
|
|
186
|
+
* - **Max Length:** 256
|
|
187
|
+
*
|
|
188
|
+
* @property image: The store image.
|
|
189
|
+
*
|
|
190
|
+
* @property inventoryId: The inventory list id associated with this store.
|
|
191
|
+
* - **Max Length:** 256
|
|
192
|
+
*
|
|
193
|
+
* @property latitude: The latitude of the store.
|
|
194
|
+
*
|
|
195
|
+
* @property longitude: The longitude of the store.
|
|
196
|
+
*
|
|
197
|
+
* @property name: The store name.
|
|
198
|
+
*
|
|
199
|
+
* @property phone: The phone number of the store.
|
|
200
|
+
*
|
|
201
|
+
* @property posEnabled: Whether this store uses Store Point-of-Sale.
|
|
202
|
+
*
|
|
203
|
+
* @property postalCode: The postal code of the store.
|
|
204
|
+
* - **Min Length:** 3
|
|
205
|
+
* - **Max Length:** 10
|
|
206
|
+
*
|
|
207
|
+
* @property stateCode: The state code of the store.
|
|
208
|
+
*
|
|
209
|
+
* @property storeEvents: The store events.
|
|
210
|
+
*
|
|
211
|
+
* @property storeHours: The opening hours of the store.
|
|
212
|
+
*
|
|
213
|
+
* @property storeLocatorEnabled: Whether this store should show up in store locator results.
|
|
214
|
+
*
|
|
215
|
+
*/
|
|
216
|
+
type Store = {
|
|
217
|
+
address1?: string;
|
|
218
|
+
address2?: string;
|
|
219
|
+
city?: string;
|
|
220
|
+
countryCode?: string;
|
|
221
|
+
distance?: number;
|
|
222
|
+
distanceUnit?: DistanceUnit;
|
|
223
|
+
email?: string;
|
|
224
|
+
fax?: string;
|
|
225
|
+
id: string;
|
|
226
|
+
image?: string;
|
|
227
|
+
inventoryId?: string;
|
|
228
|
+
latitude?: number;
|
|
229
|
+
longitude?: number;
|
|
230
|
+
name?: string;
|
|
231
|
+
phone?: string;
|
|
232
|
+
posEnabled?: boolean;
|
|
233
|
+
postalCode?: string;
|
|
234
|
+
stateCode?: string;
|
|
235
|
+
storeEvents?: string;
|
|
236
|
+
storeHours?: string;
|
|
237
|
+
storeLocatorEnabled?: boolean;
|
|
238
|
+
} & {
|
|
239
|
+
[key: string]: any;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* @type StoreResult: Result object containing an array of stores.
|
|
243
|
+
*
|
|
244
|
+
* @property data: The list of stores in the search result.
|
|
245
|
+
*
|
|
246
|
+
* @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
|
|
247
|
+
*
|
|
248
|
+
* @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
|
|
249
|
+
*
|
|
250
|
+
*/
|
|
251
|
+
type StoreResult = {
|
|
252
|
+
data?: Array<Store>;
|
|
253
|
+
limit: number;
|
|
254
|
+
total: number;
|
|
255
|
+
} & {
|
|
256
|
+
[key: string]: any;
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* @type Stores: Result object containing an paginated array of stores.
|
|
260
|
+
*
|
|
261
|
+
* @property data: The list of stores in the search result.
|
|
262
|
+
*
|
|
263
|
+
* @property offset: The zero-based index of the first hit/data to include in the result.
|
|
264
|
+
*
|
|
265
|
+
* @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
|
|
266
|
+
*
|
|
267
|
+
* @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
|
|
268
|
+
*
|
|
269
|
+
*/
|
|
270
|
+
type Stores = {
|
|
271
|
+
data?: Array<Store>;
|
|
272
|
+
offset: number;
|
|
273
|
+
limit: number;
|
|
274
|
+
total: number;
|
|
275
|
+
} & {
|
|
276
|
+
[key: string]: any;
|
|
277
|
+
};
|
|
278
|
+
type getStoresQueryParameters = {
|
|
279
|
+
ids: string;
|
|
280
|
+
siteId: string;
|
|
281
|
+
locale?: LocaleCode$0;
|
|
282
|
+
};
|
|
283
|
+
type getStoresPathParameters = {
|
|
284
|
+
organizationId: string;
|
|
285
|
+
};
|
|
286
|
+
type searchStoresQueryParameters = {
|
|
287
|
+
countryCode?: string;
|
|
288
|
+
distanceUnit?: DistanceUnit;
|
|
289
|
+
latitude?: number;
|
|
290
|
+
longitude?: number;
|
|
291
|
+
maxDistance?: number;
|
|
292
|
+
postalCode?: string;
|
|
293
|
+
siteId: string;
|
|
294
|
+
locale?: LocaleCode$0;
|
|
295
|
+
limit?: number;
|
|
296
|
+
offset?: number;
|
|
297
|
+
};
|
|
298
|
+
type searchStoresPathParameters = {
|
|
299
|
+
organizationId: string;
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* All path parameters that are used by at least one ShopperStores method.
|
|
303
|
+
*/
|
|
304
|
+
type ShopperStoresPathParameters = Partial<getStoresPathParameters & searchStoresPathParameters & {}>;
|
|
305
|
+
/**
|
|
306
|
+
* All query parameters that are used by at least one ShopperStores method.
|
|
307
|
+
*/
|
|
308
|
+
type ShopperStoresQueryParameters = Partial<getStoresQueryParameters & searchStoresQueryParameters & {}>;
|
|
309
|
+
/**
|
|
310
|
+
* All parameters that are used by ShopperStores.
|
|
311
|
+
*/
|
|
312
|
+
type ShopperStoresParameters = ShopperStoresPathParameters & BaseUriParameters & ShopperStoresQueryParameters;
|
|
313
|
+
/**
|
|
314
|
+
* [Shopper Stores](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-stores:Summary)
|
|
315
|
+
* ==================================
|
|
316
|
+
*
|
|
317
|
+
* *# API Overview
|
|
318
|
+
|
|
319
|
+
Provides access to stores via search or ID lookup.
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
## Authentication & Authorization
|
|
323
|
+
|
|
324
|
+
The Shopper Stores API requires a shopper access token from the [Shopper Login and API Access Service (SLAS).](https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-shopper-apis.html)
|
|
325
|
+
|
|
326
|
+
You must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see [Authorization Scopes Catalog.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog.html)*<br />
|
|
327
|
+
*
|
|
328
|
+
* Simple example:
|
|
329
|
+
*
|
|
330
|
+
* ```typescript
|
|
331
|
+
* import { ShopperStores } from "commerce-sdk-isomorphic";
|
|
332
|
+
*
|
|
333
|
+
* const clientConfig = {
|
|
334
|
+
* parameters: {
|
|
335
|
+
* clientId: "XXXXXX",
|
|
336
|
+
* organizationId: "XXXX",
|
|
337
|
+
* shortCode: "XXX",
|
|
338
|
+
* siteId: "XX"
|
|
339
|
+
* }
|
|
340
|
+
* };
|
|
341
|
+
* const shopperStoresClient = new ShopperStores(clientConfig);
|
|
342
|
+
* ```
|
|
343
|
+
*
|
|
344
|
+
* <span style="font-size:.7em; display:block; text-align: right">
|
|
345
|
+
* API Version: 0.0.33<br />
|
|
346
|
+
* Last Updated: <br />
|
|
347
|
+
* </span>
|
|
348
|
+
*
|
|
349
|
+
*
|
|
350
|
+
*/
|
|
351
|
+
declare class ShopperStores<ConfigParameters extends ShopperStoresParameters & Record<string, unknown>> {
|
|
352
|
+
// baseUri is not required on ClientConfig, but we know that we provide one in the class constructor
|
|
353
|
+
clientConfig: ClientConfig<ConfigParameters> & {
|
|
354
|
+
baseUri: string;
|
|
355
|
+
};
|
|
356
|
+
static readonly defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/store/shopper-stores/v1";
|
|
357
|
+
static readonly apiPaths: {
|
|
358
|
+
getStores: string;
|
|
359
|
+
searchStores: string;
|
|
360
|
+
};
|
|
361
|
+
constructor(config: ClientConfigInit<ConfigParameters>);
|
|
362
|
+
static readonly paramKeys: {
|
|
363
|
+
readonly getStores: readonly [
|
|
364
|
+
"organizationId",
|
|
365
|
+
"ids",
|
|
366
|
+
"siteId",
|
|
367
|
+
"locale"
|
|
368
|
+
];
|
|
369
|
+
readonly getStoresRequired: readonly [
|
|
370
|
+
"organizationId",
|
|
371
|
+
"ids",
|
|
372
|
+
"siteId"
|
|
373
|
+
];
|
|
374
|
+
readonly searchStores: readonly [
|
|
375
|
+
"organizationId",
|
|
376
|
+
"siteId",
|
|
377
|
+
"countryCode",
|
|
378
|
+
"distanceUnit",
|
|
379
|
+
"latitude",
|
|
380
|
+
"longitude",
|
|
381
|
+
"maxDistance",
|
|
382
|
+
"postalCode",
|
|
383
|
+
"locale",
|
|
384
|
+
"limit",
|
|
385
|
+
"offset"
|
|
386
|
+
];
|
|
387
|
+
readonly searchStoresRequired: readonly [
|
|
388
|
+
"organizationId",
|
|
389
|
+
"siteId"
|
|
390
|
+
];
|
|
391
|
+
};
|
|
392
|
+
/**
|
|
393
|
+
*
|
|
394
|
+
*
|
|
395
|
+
* If you would like to get a raw Response object use the other getStores function.
|
|
396
|
+
*
|
|
397
|
+
* @param options - An object containing the options for this method.
|
|
398
|
+
* @param options.parameters - An object containing the parameters for this method.
|
|
399
|
+
* @param options.parameters.organizationId - An identifier for the organization the request is being made by
|
|
400
|
+
* @param options.parameters.ids - The IDs of a requested stores (comma separated, max 50 IDs).
|
|
401
|
+
* @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
|
|
402
|
+
* @param options.parameters.locale - A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
|
|
403
|
+
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
404
|
+
*
|
|
405
|
+
* @returns A promise of type StoreResult.
|
|
406
|
+
*/
|
|
407
|
+
getStores(options?: RequireParametersUnlessAllAreOptional<{
|
|
408
|
+
parameters?: CompositeParameters<{
|
|
409
|
+
organizationId: string;
|
|
410
|
+
ids: string;
|
|
411
|
+
siteId: string;
|
|
412
|
+
locale?: LocaleCode$0;
|
|
413
|
+
} & QueryParameters, ConfigParameters>;
|
|
414
|
+
headers?: {
|
|
415
|
+
[key: string]: string;
|
|
416
|
+
};
|
|
417
|
+
}>): Promise<StoreResult>;
|
|
418
|
+
/**
|
|
419
|
+
*
|
|
420
|
+
*
|
|
421
|
+
* @param options - An object containing the options for this method.
|
|
422
|
+
* @param options.parameters - An object containing the parameters for this method.
|
|
423
|
+
* @param options.parameters.organizationId - An identifier for the organization the request is being made by
|
|
424
|
+
* @param options.parameters.ids - The IDs of a requested stores (comma separated, max 50 IDs).
|
|
425
|
+
* @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
|
|
426
|
+
* @param options.parameters.locale - A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
|
|
427
|
+
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
428
|
+
* @param rawResponse - Set to true to return entire Response object instead of DTO.
|
|
429
|
+
*
|
|
430
|
+
* @returns A promise of type Response if rawResponse is true, a promise of type StoreResult otherwise.
|
|
431
|
+
*/
|
|
432
|
+
getStores<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
|
|
433
|
+
parameters?: CompositeParameters<{
|
|
434
|
+
organizationId: string;
|
|
435
|
+
ids: string;
|
|
436
|
+
siteId: string;
|
|
437
|
+
locale?: LocaleCode$0;
|
|
438
|
+
} & QueryParameters, ConfigParameters>;
|
|
439
|
+
headers?: {
|
|
440
|
+
[key: string]: string;
|
|
441
|
+
};
|
|
442
|
+
}>, rawResponse?: T): Promise<T extends true ? Response : StoreResult>;
|
|
443
|
+
/**
|
|
444
|
+
* - The distance is interpreted either in miles or kilometers, depending on the `distanceUnit` input parameter.
|
|
445
|
+
- The location is specified by either directly providing a latitude and longitude coordinate pair, or by providing a country and a postal code. If a postal code is passed, the resource looks in the system's geolocation mappings in Business Manager to find the coordinates for this postal code. If no matching geolocation is found, the resource returns an empty list of stores. If coordinates are passed, the values for country and postal code are ignored.
|
|
446
|
+
|
|
447
|
+
To verify site latitude and longitude information in Business Manager:
|
|
448
|
+
- Navigate to **Merchant Tools -> Online Marketing -> Stores**.
|
|
449
|
+
- Select the applicable site.
|
|
450
|
+
- In the **Address** tab, verify that valid information is provided in the following fields: **Address**, **City**, **Postal Code**, **State**, and **Country**. For latitude and longitude values, you can manually enter values or provide all field values to auto-populate **Latitude** and **Longitude**. You must provide valid values for all of the previous fields for latitude and longitude to auto-populate **Latitude** and **Longitude** values.
|
|
451
|
+
|
|
452
|
+
*
|
|
453
|
+
* If you would like to get a raw Response object use the other searchStores function.
|
|
454
|
+
*
|
|
455
|
+
* @param options - An object containing the options for this method.
|
|
456
|
+
* @param options.parameters - An object containing the parameters for this method.
|
|
457
|
+
* @param options.parameters.organizationId - An identifier for the organization the request is being made by
|
|
458
|
+
* @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
|
|
459
|
+
* @param options.parameters.countryCode - The two letter ISO country code, such as "US". This value is required when a postalCode is provided.
|
|
460
|
+
* @param options.parameters.distanceUnit - The distance unit. Supported values are "mi" (miles) and "km" (kilometers). The default is "km".
|
|
461
|
+
* @param options.parameters.latitude - The geographical latitude to search for stores (value range -90.00 .. 90.00). This value is required when a longitude is provided.
|
|
462
|
+
* @param options.parameters.longitude - The geographical longitude to search for stores (value range -180.00 .. 180.00). You must provide a longitude when a latitude is provided.
|
|
463
|
+
* @param options.parameters.maxDistance - The area (radius) in distanceUnit where stores will be searched.
|
|
464
|
+
* @param options.parameters.postalCode - The postal code, such as "84121". You must provide a countryCode when a postalCode is provided.
|
|
465
|
+
* @param options.parameters.locale - A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
|
|
466
|
+
* @param options.parameters.limit - Maximum records to retrieve per request, not to exceed 200. Defaults to 25.
|
|
467
|
+
* @param options.parameters.offset - Used to retrieve the results based on a particular resource offset.
|
|
468
|
+
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
469
|
+
*
|
|
470
|
+
* @returns A promise of type Stores.
|
|
471
|
+
*/
|
|
472
|
+
searchStores(options?: RequireParametersUnlessAllAreOptional<{
|
|
473
|
+
parameters?: CompositeParameters<{
|
|
474
|
+
organizationId: string;
|
|
475
|
+
siteId: string;
|
|
476
|
+
countryCode?: string;
|
|
477
|
+
distanceUnit?: DistanceUnit;
|
|
478
|
+
latitude?: number;
|
|
479
|
+
longitude?: number;
|
|
480
|
+
maxDistance?: number;
|
|
481
|
+
postalCode?: string;
|
|
482
|
+
locale?: LocaleCode$0;
|
|
483
|
+
limit?: number;
|
|
484
|
+
offset?: number;
|
|
485
|
+
} & QueryParameters, ConfigParameters>;
|
|
486
|
+
headers?: {
|
|
487
|
+
[key: string]: string;
|
|
488
|
+
};
|
|
489
|
+
}>): Promise<Stores>;
|
|
490
|
+
/**
|
|
491
|
+
* - The distance is interpreted either in miles or kilometers, depending on the `distanceUnit` input parameter.
|
|
492
|
+
- The location is specified by either directly providing a latitude and longitude coordinate pair, or by providing a country and a postal code. If a postal code is passed, the resource looks in the system's geolocation mappings in Business Manager to find the coordinates for this postal code. If no matching geolocation is found, the resource returns an empty list of stores. If coordinates are passed, the values for country and postal code are ignored.
|
|
493
|
+
|
|
494
|
+
To verify site latitude and longitude information in Business Manager:
|
|
495
|
+
- Navigate to **Merchant Tools -> Online Marketing -> Stores**.
|
|
496
|
+
- Select the applicable site.
|
|
497
|
+
- In the **Address** tab, verify that valid information is provided in the following fields: **Address**, **City**, **Postal Code**, **State**, and **Country**. For latitude and longitude values, you can manually enter values or provide all field values to auto-populate **Latitude** and **Longitude**. You must provide valid values for all of the previous fields for latitude and longitude to auto-populate **Latitude** and **Longitude** values.
|
|
498
|
+
|
|
499
|
+
*
|
|
500
|
+
* @param options - An object containing the options for this method.
|
|
501
|
+
* @param options.parameters - An object containing the parameters for this method.
|
|
502
|
+
* @param options.parameters.organizationId - An identifier for the organization the request is being made by
|
|
503
|
+
* @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
|
|
504
|
+
* @param options.parameters.countryCode - The two letter ISO country code, such as "US". This value is required when a postalCode is provided.
|
|
505
|
+
* @param options.parameters.distanceUnit - The distance unit. Supported values are "mi" (miles) and "km" (kilometers). The default is "km".
|
|
506
|
+
* @param options.parameters.latitude - The geographical latitude to search for stores (value range -90.00 .. 90.00). This value is required when a longitude is provided.
|
|
507
|
+
* @param options.parameters.longitude - The geographical longitude to search for stores (value range -180.00 .. 180.00). You must provide a longitude when a latitude is provided.
|
|
508
|
+
* @param options.parameters.maxDistance - The area (radius) in distanceUnit where stores will be searched.
|
|
509
|
+
* @param options.parameters.postalCode - The postal code, such as "84121". You must provide a countryCode when a postalCode is provided.
|
|
510
|
+
* @param options.parameters.locale - A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
|
|
511
|
+
* @param options.parameters.limit - Maximum records to retrieve per request, not to exceed 200. Defaults to 25.
|
|
512
|
+
* @param options.parameters.offset - Used to retrieve the results based on a particular resource offset.
|
|
513
|
+
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
514
|
+
* @param rawResponse - Set to true to return entire Response object instead of DTO.
|
|
515
|
+
*
|
|
516
|
+
* @returns A promise of type Response if rawResponse is true, a promise of type Stores otherwise.
|
|
517
|
+
*/
|
|
518
|
+
searchStores<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
|
|
519
|
+
parameters?: CompositeParameters<{
|
|
520
|
+
organizationId: string;
|
|
521
|
+
siteId: string;
|
|
522
|
+
countryCode?: string;
|
|
523
|
+
distanceUnit?: DistanceUnit;
|
|
524
|
+
latitude?: number;
|
|
525
|
+
longitude?: number;
|
|
526
|
+
maxDistance?: number;
|
|
527
|
+
postalCode?: string;
|
|
528
|
+
locale?: LocaleCode$0;
|
|
529
|
+
limit?: number;
|
|
530
|
+
offset?: number;
|
|
531
|
+
} & QueryParameters, ConfigParameters>;
|
|
532
|
+
headers?: {
|
|
533
|
+
[key: string]: string;
|
|
534
|
+
};
|
|
535
|
+
}>, rawResponse?: T): Promise<T extends true ? Response : Stores>;
|
|
536
|
+
}
|
|
537
|
+
declare namespace ShopperStoresApiTypes {
|
|
538
|
+
/*
|
|
539
|
+
* Copyright (c) 2023, Salesforce, Inc.
|
|
540
|
+
* All rights reserved.
|
|
541
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
542
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
543
|
+
*/
|
|
544
|
+
/**
|
|
545
|
+
* Makes a type easier to read.
|
|
546
|
+
*/
|
|
547
|
+
type Prettify<T> = NonNullable<{
|
|
548
|
+
[K in keyof T]: T[K];
|
|
549
|
+
}>;
|
|
550
|
+
/**
|
|
551
|
+
* Generates the types required on a method, based on those provided in the config.
|
|
552
|
+
*/
|
|
553
|
+
type CompositeParameters<MethodParameters extends Record<string, unknown>, ConfigParameters extends Record<string, unknown>> = Prettify<Omit<MethodParameters, keyof ConfigParameters> & Partial<MethodParameters>>;
|
|
554
|
+
/**
|
|
555
|
+
* If an object has a `parameters` property, and the `parameters` object has required properties,
|
|
556
|
+
* then the `parameters` property on the root object is marked as required.
|
|
557
|
+
*/
|
|
558
|
+
type RequireParametersUnlessAllAreOptional<T extends {
|
|
559
|
+
parameters?: Record<string, unknown>;
|
|
560
|
+
}> = Record<string, never> extends NonNullable<T["parameters"]> ? T : Prettify<T & Required<Pick<T, "parameters">>>;
|
|
561
|
+
/**
|
|
562
|
+
* Template parameters used in the base URI of all API endpoints. `version` will default to `"v1"`
|
|
563
|
+
* if not specified.
|
|
564
|
+
*/
|
|
565
|
+
interface BaseUriParameters {
|
|
566
|
+
shortCode: string;
|
|
567
|
+
}
|
|
568
|
+
type LocaleCode = {
|
|
569
|
+
[key: string]: any;
|
|
570
|
+
};
|
|
571
|
+
/**
|
|
572
|
+
* Generic interface for path parameters.
|
|
573
|
+
*/
|
|
574
|
+
interface PathParameters {
|
|
575
|
+
[key: string]: string | number | boolean;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Generic interface for query parameters.
|
|
579
|
+
*/
|
|
580
|
+
interface QueryParameters {
|
|
581
|
+
[key: string]: string | number | boolean | string[] | number[] | LocaleCode;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Generic interface for all parameter types.
|
|
585
|
+
*/
|
|
586
|
+
type UrlParameters = PathParameters | QueryParameters;
|
|
587
|
+
/**
|
|
588
|
+
* Custom query parameter type with any string prefixed with `c_` as the key and the allowed
|
|
589
|
+
* types for query parameters for the value.
|
|
590
|
+
*/
|
|
591
|
+
type CustomQueryParameters = {
|
|
592
|
+
[key in `c_${string}`]: string | number | boolean | string[] | number[];
|
|
593
|
+
};
|
|
594
|
+
/**
|
|
595
|
+
* Custom body request type with any string prefixed with `c_` as the key and the allowed
|
|
596
|
+
* types for the value.
|
|
597
|
+
*/
|
|
598
|
+
type CustomRequestBody = {
|
|
599
|
+
[key in `c_${string}`]: string | number | boolean | string[] | number[] | {
|
|
600
|
+
[key: string]: unknown;
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
/**
|
|
604
|
+
* Alias for `RequestInit` from TypeScript's DOM lib, to more clearly differentiate
|
|
605
|
+
* it from the `RequestInit` provided by node-fetch.
|
|
606
|
+
*/
|
|
607
|
+
type BrowserRequestInit = RequestInit;
|
|
608
|
+
/**
|
|
609
|
+
* Any properties supported in either the browser or node are accepted.
|
|
610
|
+
* Using the right properties in the right context is left to the user.
|
|
611
|
+
*/
|
|
612
|
+
type FetchOptions = NodeRequestInit & BrowserRequestInit;
|
|
613
|
+
/**
|
|
614
|
+
* Base options that can be passed to the `ClientConfig` class.
|
|
615
|
+
*/
|
|
616
|
+
interface ClientConfigInit<Params extends BaseUriParameters> {
|
|
617
|
+
baseUri?: string;
|
|
618
|
+
proxy?: string;
|
|
619
|
+
headers?: {
|
|
620
|
+
[key: string]: string;
|
|
621
|
+
};
|
|
622
|
+
parameters: Params;
|
|
623
|
+
fetchOptions?: FetchOptions;
|
|
624
|
+
transformRequest?: (data: unknown, headers: {
|
|
625
|
+
[key: string]: string;
|
|
626
|
+
}) => Required<FetchOptions>["body"];
|
|
627
|
+
throwOnBadResponse?: boolean;
|
|
628
|
+
}
|
|
629
|
+
type FetchFunction = (input: RequestInfo, init?: FetchOptions | undefined) => Promise<Response>;
|
|
630
|
+
/**
|
|
631
|
+
* Configuration parameters common to Commerce SDK clients
|
|
632
|
+
*/
|
|
633
|
+
class ClientConfig<Params extends BaseUriParameters> implements ClientConfigInit<Params> {
|
|
634
|
+
baseUri?: string;
|
|
635
|
+
proxy?: string;
|
|
636
|
+
headers: {
|
|
637
|
+
[key: string]: string;
|
|
638
|
+
};
|
|
639
|
+
parameters: Params;
|
|
640
|
+
fetchOptions: FetchOptions;
|
|
641
|
+
transformRequest: NonNullable<ClientConfigInit<Params>["transformRequest"]>;
|
|
642
|
+
throwOnBadResponse: boolean;
|
|
643
|
+
constructor(config: ClientConfigInit<Params>);
|
|
644
|
+
static readonly defaults: Pick<Required<ClientConfigInit<never>>, "transformRequest">;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* A specialized value indicating the system default values for locales.
|
|
648
|
+
*/
|
|
649
|
+
type DefaultFallback = "default";
|
|
650
|
+
/**
|
|
651
|
+
* The unit the distance attribute is measured in (either in miles or kilometers).
|
|
652
|
+
*/
|
|
653
|
+
type DistanceUnit = "km" | "mi";
|
|
654
|
+
/**
|
|
655
|
+
* @type ErrorResponse:
|
|
656
|
+
*
|
|
657
|
+
* @property title: A short, human-readable summary of the problem type. It will not change from occurrence to occurrence of the problem, except for purposes of localization
|
|
658
|
+
* - **Max Length:** 256
|
|
659
|
+
*
|
|
660
|
+
* @property type: A URI reference [RFC3986] that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML [W3C.REC-html5-20141028]). When this member is not present, its value is assumed to be \"about:blank\". It accepts relative URIs; this means that they must be resolved relative to the document\'s base URI, as per [RFC3986], Section 5.
|
|
661
|
+
* - **Max Length:** 2048
|
|
662
|
+
*
|
|
663
|
+
* @property detail: A human-readable explanation specific to this occurrence of the problem.
|
|
664
|
+
*
|
|
665
|
+
* @property instance: A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. It accepts relative URIs; this means that they must be resolved relative to the document\'s base URI, as per [RFC3986], Section 5.
|
|
666
|
+
* - **Max Length:** 2048
|
|
667
|
+
*
|
|
668
|
+
*/
|
|
669
|
+
type ErrorResponse = {
|
|
670
|
+
title: string;
|
|
671
|
+
type: string;
|
|
672
|
+
detail: string;
|
|
673
|
+
instance?: string;
|
|
674
|
+
} & {
|
|
675
|
+
[key: string]: any;
|
|
676
|
+
};
|
|
677
|
+
/**
|
|
678
|
+
* @type LocaleCode
|
|
679
|
+
* A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
|
|
680
|
+
*/
|
|
681
|
+
type LocaleCode$0 = DefaultFallback | string;
|
|
682
|
+
/**
|
|
683
|
+
* @type PaginatedResultBase: Schema defining generic pageable result. Each response schema of a resource requiring pagination should extend this schema. If you use this extend this schema directly, it needs to be defined what data is returned. Allowed names for the data field is `data`.
|
|
684
|
+
*
|
|
685
|
+
* @property offset: The zero-based index of the first hit/data to include in the result.
|
|
686
|
+
*
|
|
687
|
+
* @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
|
|
688
|
+
*
|
|
689
|
+
* @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
|
|
690
|
+
*
|
|
691
|
+
*/
|
|
692
|
+
type PaginatedResultBase = {
|
|
693
|
+
offset: number;
|
|
694
|
+
limit: number;
|
|
695
|
+
total: number;
|
|
696
|
+
} & {
|
|
697
|
+
[key: string]: any;
|
|
698
|
+
};
|
|
699
|
+
/**
|
|
700
|
+
* @type ResultBase: Schema defining generic list result. Each response schema of a resource requiring a list response should extend this schema. Additionally it needs to be defined what data is returned.
|
|
701
|
+
*
|
|
702
|
+
* @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
|
|
703
|
+
*
|
|
704
|
+
* @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
|
|
705
|
+
*
|
|
706
|
+
*/
|
|
707
|
+
type ResultBase = {
|
|
708
|
+
limit: number;
|
|
709
|
+
total: number;
|
|
710
|
+
} & {
|
|
711
|
+
[key: string]: any;
|
|
712
|
+
};
|
|
713
|
+
/**
|
|
714
|
+
* @type Store: Document representing a store.
|
|
715
|
+
*
|
|
716
|
+
* @property address1: The primary address of the store.
|
|
717
|
+
* - **Min Length:** 1
|
|
718
|
+
*
|
|
719
|
+
* @property address2: The secondary address of the store.
|
|
720
|
+
*
|
|
721
|
+
* @property city: The city of the store.
|
|
722
|
+
*
|
|
723
|
+
* @property countryCode: A two letter uppercase country code conforming to the [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 standard.
|
|
724
|
+
* - **Pattern:** /^[A-Z][A-Z]$/
|
|
725
|
+
*
|
|
726
|
+
* @property distance: The distance to the given geolocation where the stores will be searched, using the unit given in the attribute \'DistanceUnit\' (miles or kilometers).
|
|
727
|
+
*
|
|
728
|
+
* @property distanceUnit:
|
|
729
|
+
*
|
|
730
|
+
* @property email: The email address of the store.
|
|
731
|
+
*
|
|
732
|
+
* @property fax: The fax number of the store.
|
|
733
|
+
*
|
|
734
|
+
* @property id: The id of the store.
|
|
735
|
+
* - **Min Length:** 1
|
|
736
|
+
* - **Max Length:** 256
|
|
737
|
+
*
|
|
738
|
+
* @property image: The store image.
|
|
739
|
+
*
|
|
740
|
+
* @property inventoryId: The inventory list id associated with this store.
|
|
741
|
+
* - **Max Length:** 256
|
|
742
|
+
*
|
|
743
|
+
* @property latitude: The latitude of the store.
|
|
744
|
+
*
|
|
745
|
+
* @property longitude: The longitude of the store.
|
|
746
|
+
*
|
|
747
|
+
* @property name: The store name.
|
|
748
|
+
*
|
|
749
|
+
* @property phone: The phone number of the store.
|
|
750
|
+
*
|
|
751
|
+
* @property posEnabled: Whether this store uses Store Point-of-Sale.
|
|
752
|
+
*
|
|
753
|
+
* @property postalCode: The postal code of the store.
|
|
754
|
+
* - **Min Length:** 3
|
|
755
|
+
* - **Max Length:** 10
|
|
756
|
+
*
|
|
757
|
+
* @property stateCode: The state code of the store.
|
|
758
|
+
*
|
|
759
|
+
* @property storeEvents: The store events.
|
|
760
|
+
*
|
|
761
|
+
* @property storeHours: The opening hours of the store.
|
|
762
|
+
*
|
|
763
|
+
* @property storeLocatorEnabled: Whether this store should show up in store locator results.
|
|
764
|
+
*
|
|
765
|
+
*/
|
|
766
|
+
type Store = {
|
|
767
|
+
address1?: string;
|
|
768
|
+
address2?: string;
|
|
769
|
+
city?: string;
|
|
770
|
+
countryCode?: string;
|
|
771
|
+
distance?: number;
|
|
772
|
+
distanceUnit?: DistanceUnit;
|
|
773
|
+
email?: string;
|
|
774
|
+
fax?: string;
|
|
775
|
+
id: string;
|
|
776
|
+
image?: string;
|
|
777
|
+
inventoryId?: string;
|
|
778
|
+
latitude?: number;
|
|
779
|
+
longitude?: number;
|
|
780
|
+
name?: string;
|
|
781
|
+
phone?: string;
|
|
782
|
+
posEnabled?: boolean;
|
|
783
|
+
postalCode?: string;
|
|
784
|
+
stateCode?: string;
|
|
785
|
+
storeEvents?: string;
|
|
786
|
+
storeHours?: string;
|
|
787
|
+
storeLocatorEnabled?: boolean;
|
|
788
|
+
} & {
|
|
789
|
+
[key: string]: any;
|
|
790
|
+
};
|
|
791
|
+
/**
|
|
792
|
+
* @type StoreResult: Result object containing an array of stores.
|
|
793
|
+
*
|
|
794
|
+
* @property data: The list of stores in the search result.
|
|
795
|
+
*
|
|
796
|
+
* @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
|
|
797
|
+
*
|
|
798
|
+
* @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
|
|
799
|
+
*
|
|
800
|
+
*/
|
|
801
|
+
type StoreResult = {
|
|
802
|
+
data?: Array<Store>;
|
|
803
|
+
limit: number;
|
|
804
|
+
total: number;
|
|
805
|
+
} & {
|
|
806
|
+
[key: string]: any;
|
|
807
|
+
};
|
|
808
|
+
/**
|
|
809
|
+
* @type Stores: Result object containing an paginated array of stores.
|
|
810
|
+
*
|
|
811
|
+
* @property data: The list of stores in the search result.
|
|
812
|
+
*
|
|
813
|
+
* @property offset: The zero-based index of the first hit/data to include in the result.
|
|
814
|
+
*
|
|
815
|
+
* @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
|
|
816
|
+
*
|
|
817
|
+
* @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
|
|
818
|
+
*
|
|
819
|
+
*/
|
|
820
|
+
type Stores = {
|
|
821
|
+
data?: Array<Store>;
|
|
822
|
+
offset: number;
|
|
823
|
+
limit: number;
|
|
824
|
+
total: number;
|
|
825
|
+
} & {
|
|
826
|
+
[key: string]: any;
|
|
827
|
+
};
|
|
828
|
+
type getStoresQueryParameters = {
|
|
829
|
+
ids: string;
|
|
830
|
+
siteId: string;
|
|
831
|
+
locale?: LocaleCode$0;
|
|
832
|
+
};
|
|
833
|
+
type getStoresPathParameters = {
|
|
834
|
+
organizationId: string;
|
|
835
|
+
};
|
|
836
|
+
type searchStoresQueryParameters = {
|
|
837
|
+
countryCode?: string;
|
|
838
|
+
distanceUnit?: DistanceUnit;
|
|
839
|
+
latitude?: number;
|
|
840
|
+
longitude?: number;
|
|
841
|
+
maxDistance?: number;
|
|
842
|
+
postalCode?: string;
|
|
843
|
+
siteId: string;
|
|
844
|
+
locale?: LocaleCode$0;
|
|
845
|
+
limit?: number;
|
|
846
|
+
offset?: number;
|
|
847
|
+
};
|
|
848
|
+
type searchStoresPathParameters = {
|
|
849
|
+
organizationId: string;
|
|
850
|
+
};
|
|
851
|
+
/**
|
|
852
|
+
* All path parameters that are used by at least one ShopperStores method.
|
|
853
|
+
*/
|
|
854
|
+
type ShopperStoresPathParameters = Partial<getStoresPathParameters & searchStoresPathParameters & {}>;
|
|
855
|
+
/**
|
|
856
|
+
* All query parameters that are used by at least one ShopperStores method.
|
|
857
|
+
*/
|
|
858
|
+
type ShopperStoresQueryParameters = Partial<getStoresQueryParameters & searchStoresQueryParameters & {}>;
|
|
859
|
+
/**
|
|
860
|
+
* All parameters that are used by ShopperStores.
|
|
861
|
+
*/
|
|
862
|
+
type ShopperStoresParameters = ShopperStoresPathParameters & BaseUriParameters & ShopperStoresQueryParameters;
|
|
863
|
+
/**
|
|
864
|
+
* [Shopper Stores](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-stores:Summary)
|
|
865
|
+
* ==================================
|
|
866
|
+
*
|
|
867
|
+
* *# API Overview
|
|
868
|
+
|
|
869
|
+
Provides access to stores via search or ID lookup.
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
## Authentication & Authorization
|
|
873
|
+
|
|
874
|
+
The Shopper Stores API requires a shopper access token from the [Shopper Login and API Access Service (SLAS).](https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-shopper-apis.html)
|
|
875
|
+
|
|
876
|
+
You must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see [Authorization Scopes Catalog.](https://developer.salesforce.com/docs/commerce/commerce-api/guide/auth-z-scope-catalog.html)*<br />
|
|
877
|
+
*
|
|
878
|
+
* Simple example:
|
|
879
|
+
*
|
|
880
|
+
* ```typescript
|
|
881
|
+
* import { ShopperStores } from "commerce-sdk-isomorphic";
|
|
882
|
+
*
|
|
883
|
+
* const clientConfig = {
|
|
884
|
+
* parameters: {
|
|
885
|
+
* clientId: "XXXXXX",
|
|
886
|
+
* organizationId: "XXXX",
|
|
887
|
+
* shortCode: "XXX",
|
|
888
|
+
* siteId: "XX"
|
|
889
|
+
* }
|
|
890
|
+
* };
|
|
891
|
+
* const shopperStoresClient = new ShopperStores(clientConfig);
|
|
892
|
+
* ```
|
|
893
|
+
*
|
|
894
|
+
* <span style="font-size:.7em; display:block; text-align: right">
|
|
895
|
+
* API Version: 0.0.33<br />
|
|
896
|
+
* Last Updated: <br />
|
|
897
|
+
* </span>
|
|
898
|
+
*
|
|
899
|
+
*
|
|
900
|
+
*/
|
|
901
|
+
class ShopperStores<ConfigParameters extends ShopperStoresParameters & Record<string, unknown>> {
|
|
902
|
+
// baseUri is not required on ClientConfig, but we know that we provide one in the class constructor
|
|
903
|
+
clientConfig: ClientConfig<ConfigParameters> & {
|
|
904
|
+
baseUri: string;
|
|
905
|
+
};
|
|
906
|
+
static readonly defaultBaseUri = "https://{shortCode}.api.commercecloud.salesforce.com/store/shopper-stores/v1";
|
|
907
|
+
static readonly apiPaths: {
|
|
908
|
+
getStores: string;
|
|
909
|
+
searchStores: string;
|
|
910
|
+
};
|
|
911
|
+
constructor(config: ClientConfigInit<ConfigParameters>);
|
|
912
|
+
static readonly paramKeys: {
|
|
913
|
+
readonly getStores: readonly [
|
|
914
|
+
"organizationId",
|
|
915
|
+
"ids",
|
|
916
|
+
"siteId",
|
|
917
|
+
"locale"
|
|
918
|
+
];
|
|
919
|
+
readonly getStoresRequired: readonly [
|
|
920
|
+
"organizationId",
|
|
921
|
+
"ids",
|
|
922
|
+
"siteId"
|
|
923
|
+
];
|
|
924
|
+
readonly searchStores: readonly [
|
|
925
|
+
"organizationId",
|
|
926
|
+
"siteId",
|
|
927
|
+
"countryCode",
|
|
928
|
+
"distanceUnit",
|
|
929
|
+
"latitude",
|
|
930
|
+
"longitude",
|
|
931
|
+
"maxDistance",
|
|
932
|
+
"postalCode",
|
|
933
|
+
"locale",
|
|
934
|
+
"limit",
|
|
935
|
+
"offset"
|
|
936
|
+
];
|
|
937
|
+
readonly searchStoresRequired: readonly [
|
|
938
|
+
"organizationId",
|
|
939
|
+
"siteId"
|
|
940
|
+
];
|
|
941
|
+
};
|
|
942
|
+
/**
|
|
943
|
+
*
|
|
944
|
+
*
|
|
945
|
+
* If you would like to get a raw Response object use the other getStores function.
|
|
946
|
+
*
|
|
947
|
+
* @param options - An object containing the options for this method.
|
|
948
|
+
* @param options.parameters - An object containing the parameters for this method.
|
|
949
|
+
* @param options.parameters.organizationId - An identifier for the organization the request is being made by
|
|
950
|
+
* @param options.parameters.ids - The IDs of a requested stores (comma separated, max 50 IDs).
|
|
951
|
+
* @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
|
|
952
|
+
* @param options.parameters.locale - A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
|
|
953
|
+
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
954
|
+
*
|
|
955
|
+
* @returns A promise of type StoreResult.
|
|
956
|
+
*/
|
|
957
|
+
getStores(options?: RequireParametersUnlessAllAreOptional<{
|
|
958
|
+
parameters?: CompositeParameters<{
|
|
959
|
+
organizationId: string;
|
|
960
|
+
ids: string;
|
|
961
|
+
siteId: string;
|
|
962
|
+
locale?: LocaleCode$0;
|
|
963
|
+
} & QueryParameters, ConfigParameters>;
|
|
964
|
+
headers?: {
|
|
965
|
+
[key: string]: string;
|
|
966
|
+
};
|
|
967
|
+
}>): Promise<StoreResult>;
|
|
968
|
+
/**
|
|
969
|
+
*
|
|
970
|
+
*
|
|
971
|
+
* @param options - An object containing the options for this method.
|
|
972
|
+
* @param options.parameters - An object containing the parameters for this method.
|
|
973
|
+
* @param options.parameters.organizationId - An identifier for the organization the request is being made by
|
|
974
|
+
* @param options.parameters.ids - The IDs of a requested stores (comma separated, max 50 IDs).
|
|
975
|
+
* @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
|
|
976
|
+
* @param options.parameters.locale - A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
|
|
977
|
+
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
978
|
+
* @param rawResponse - Set to true to return entire Response object instead of DTO.
|
|
979
|
+
*
|
|
980
|
+
* @returns A promise of type Response if rawResponse is true, a promise of type StoreResult otherwise.
|
|
981
|
+
*/
|
|
982
|
+
getStores<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
|
|
983
|
+
parameters?: CompositeParameters<{
|
|
984
|
+
organizationId: string;
|
|
985
|
+
ids: string;
|
|
986
|
+
siteId: string;
|
|
987
|
+
locale?: LocaleCode$0;
|
|
988
|
+
} & QueryParameters, ConfigParameters>;
|
|
989
|
+
headers?: {
|
|
990
|
+
[key: string]: string;
|
|
991
|
+
};
|
|
992
|
+
}>, rawResponse?: T): Promise<T extends true ? Response : StoreResult>;
|
|
993
|
+
/**
|
|
994
|
+
* - The distance is interpreted either in miles or kilometers, depending on the `distanceUnit` input parameter.
|
|
995
|
+
- The location is specified by either directly providing a latitude and longitude coordinate pair, or by providing a country and a postal code. If a postal code is passed, the resource looks in the system's geolocation mappings in Business Manager to find the coordinates for this postal code. If no matching geolocation is found, the resource returns an empty list of stores. If coordinates are passed, the values for country and postal code are ignored.
|
|
996
|
+
|
|
997
|
+
To verify site latitude and longitude information in Business Manager:
|
|
998
|
+
- Navigate to **Merchant Tools -> Online Marketing -> Stores**.
|
|
999
|
+
- Select the applicable site.
|
|
1000
|
+
- In the **Address** tab, verify that valid information is provided in the following fields: **Address**, **City**, **Postal Code**, **State**, and **Country**. For latitude and longitude values, you can manually enter values or provide all field values to auto-populate **Latitude** and **Longitude**. You must provide valid values for all of the previous fields for latitude and longitude to auto-populate **Latitude** and **Longitude** values.
|
|
1001
|
+
|
|
1002
|
+
*
|
|
1003
|
+
* If you would like to get a raw Response object use the other searchStores function.
|
|
1004
|
+
*
|
|
1005
|
+
* @param options - An object containing the options for this method.
|
|
1006
|
+
* @param options.parameters - An object containing the parameters for this method.
|
|
1007
|
+
* @param options.parameters.organizationId - An identifier for the organization the request is being made by
|
|
1008
|
+
* @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
|
|
1009
|
+
* @param options.parameters.countryCode - The two letter ISO country code, such as "US". This value is required when a postalCode is provided.
|
|
1010
|
+
* @param options.parameters.distanceUnit - The distance unit. Supported values are "mi" (miles) and "km" (kilometers). The default is "km".
|
|
1011
|
+
* @param options.parameters.latitude - The geographical latitude to search for stores (value range -90.00 .. 90.00). This value is required when a longitude is provided.
|
|
1012
|
+
* @param options.parameters.longitude - The geographical longitude to search for stores (value range -180.00 .. 180.00). You must provide a longitude when a latitude is provided.
|
|
1013
|
+
* @param options.parameters.maxDistance - The area (radius) in distanceUnit where stores will be searched.
|
|
1014
|
+
* @param options.parameters.postalCode - The postal code, such as "84121". You must provide a countryCode when a postalCode is provided.
|
|
1015
|
+
* @param options.parameters.locale - A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
|
|
1016
|
+
* @param options.parameters.limit - Maximum records to retrieve per request, not to exceed 200. Defaults to 25.
|
|
1017
|
+
* @param options.parameters.offset - Used to retrieve the results based on a particular resource offset.
|
|
1018
|
+
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
1019
|
+
*
|
|
1020
|
+
* @returns A promise of type Stores.
|
|
1021
|
+
*/
|
|
1022
|
+
searchStores(options?: RequireParametersUnlessAllAreOptional<{
|
|
1023
|
+
parameters?: CompositeParameters<{
|
|
1024
|
+
organizationId: string;
|
|
1025
|
+
siteId: string;
|
|
1026
|
+
countryCode?: string;
|
|
1027
|
+
distanceUnit?: DistanceUnit;
|
|
1028
|
+
latitude?: number;
|
|
1029
|
+
longitude?: number;
|
|
1030
|
+
maxDistance?: number;
|
|
1031
|
+
postalCode?: string;
|
|
1032
|
+
locale?: LocaleCode$0;
|
|
1033
|
+
limit?: number;
|
|
1034
|
+
offset?: number;
|
|
1035
|
+
} & QueryParameters, ConfigParameters>;
|
|
1036
|
+
headers?: {
|
|
1037
|
+
[key: string]: string;
|
|
1038
|
+
};
|
|
1039
|
+
}>): Promise<Stores>;
|
|
1040
|
+
/**
|
|
1041
|
+
* - The distance is interpreted either in miles or kilometers, depending on the `distanceUnit` input parameter.
|
|
1042
|
+
- The location is specified by either directly providing a latitude and longitude coordinate pair, or by providing a country and a postal code. If a postal code is passed, the resource looks in the system's geolocation mappings in Business Manager to find the coordinates for this postal code. If no matching geolocation is found, the resource returns an empty list of stores. If coordinates are passed, the values for country and postal code are ignored.
|
|
1043
|
+
|
|
1044
|
+
To verify site latitude and longitude information in Business Manager:
|
|
1045
|
+
- Navigate to **Merchant Tools -> Online Marketing -> Stores**.
|
|
1046
|
+
- Select the applicable site.
|
|
1047
|
+
- In the **Address** tab, verify that valid information is provided in the following fields: **Address**, **City**, **Postal Code**, **State**, and **Country**. For latitude and longitude values, you can manually enter values or provide all field values to auto-populate **Latitude** and **Longitude**. You must provide valid values for all of the previous fields for latitude and longitude to auto-populate **Latitude** and **Longitude** values.
|
|
1048
|
+
|
|
1049
|
+
*
|
|
1050
|
+
* @param options - An object containing the options for this method.
|
|
1051
|
+
* @param options.parameters - An object containing the parameters for this method.
|
|
1052
|
+
* @param options.parameters.organizationId - An identifier for the organization the request is being made by
|
|
1053
|
+
* @param options.parameters.siteId - The identifier of the site that a request is being made in the context of. Attributes might have site specific values, and some objects may only be assigned to specific sites.
|
|
1054
|
+
* @param options.parameters.countryCode - The two letter ISO country code, such as "US". This value is required when a postalCode is provided.
|
|
1055
|
+
* @param options.parameters.distanceUnit - The distance unit. Supported values are "mi" (miles) and "km" (kilometers). The default is "km".
|
|
1056
|
+
* @param options.parameters.latitude - The geographical latitude to search for stores (value range -90.00 .. 90.00). This value is required when a longitude is provided.
|
|
1057
|
+
* @param options.parameters.longitude - The geographical longitude to search for stores (value range -180.00 .. 180.00). You must provide a longitude when a latitude is provided.
|
|
1058
|
+
* @param options.parameters.maxDistance - The area (radius) in distanceUnit where stores will be searched.
|
|
1059
|
+
* @param options.parameters.postalCode - The postal code, such as "84121". You must provide a countryCode when a postalCode is provided.
|
|
1060
|
+
* @param options.parameters.locale - A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
|
|
1061
|
+
* @param options.parameters.limit - Maximum records to retrieve per request, not to exceed 200. Defaults to 25.
|
|
1062
|
+
* @param options.parameters.offset - Used to retrieve the results based on a particular resource offset.
|
|
1063
|
+
* @param options.headers - An object literal of key value pairs of the headers to be sent with this request.
|
|
1064
|
+
* @param rawResponse - Set to true to return entire Response object instead of DTO.
|
|
1065
|
+
*
|
|
1066
|
+
* @returns A promise of type Response if rawResponse is true, a promise of type Stores otherwise.
|
|
1067
|
+
*/
|
|
1068
|
+
searchStores<T extends boolean>(options?: RequireParametersUnlessAllAreOptional<{
|
|
1069
|
+
parameters?: CompositeParameters<{
|
|
1070
|
+
organizationId: string;
|
|
1071
|
+
siteId: string;
|
|
1072
|
+
countryCode?: string;
|
|
1073
|
+
distanceUnit?: DistanceUnit;
|
|
1074
|
+
latitude?: number;
|
|
1075
|
+
longitude?: number;
|
|
1076
|
+
maxDistance?: number;
|
|
1077
|
+
postalCode?: string;
|
|
1078
|
+
locale?: LocaleCode$0;
|
|
1079
|
+
limit?: number;
|
|
1080
|
+
offset?: number;
|
|
1081
|
+
} & QueryParameters, ConfigParameters>;
|
|
1082
|
+
headers?: {
|
|
1083
|
+
[key: string]: string;
|
|
1084
|
+
};
|
|
1085
|
+
}>, rawResponse?: T): Promise<T extends true ? Response : Stores>;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
declare namespace ShopperStoresModelTypes {
|
|
1089
|
+
/**
|
|
1090
|
+
* A specialized value indicating the system default values for locales.
|
|
1091
|
+
*/
|
|
1092
|
+
type DefaultFallback = "default";
|
|
1093
|
+
/**
|
|
1094
|
+
* The unit the distance attribute is measured in (either in miles or kilometers).
|
|
1095
|
+
*/
|
|
1096
|
+
type DistanceUnit = "km" | "mi";
|
|
1097
|
+
/**
|
|
1098
|
+
* @type ErrorResponse:
|
|
1099
|
+
*
|
|
1100
|
+
* @property title: A short, human-readable summary of the problem type. It will not change from occurrence to occurrence of the problem, except for purposes of localization
|
|
1101
|
+
* - **Max Length:** 256
|
|
1102
|
+
*
|
|
1103
|
+
* @property type: A URI reference [RFC3986] that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML [W3C.REC-html5-20141028]). When this member is not present, its value is assumed to be \"about:blank\". It accepts relative URIs; this means that they must be resolved relative to the document\'s base URI, as per [RFC3986], Section 5.
|
|
1104
|
+
* - **Max Length:** 2048
|
|
1105
|
+
*
|
|
1106
|
+
* @property detail: A human-readable explanation specific to this occurrence of the problem.
|
|
1107
|
+
*
|
|
1108
|
+
* @property instance: A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. It accepts relative URIs; this means that they must be resolved relative to the document\'s base URI, as per [RFC3986], Section 5.
|
|
1109
|
+
* - **Max Length:** 2048
|
|
1110
|
+
*
|
|
1111
|
+
*/
|
|
1112
|
+
type ErrorResponse = {
|
|
1113
|
+
title: string;
|
|
1114
|
+
type: string;
|
|
1115
|
+
detail: string;
|
|
1116
|
+
instance?: string;
|
|
1117
|
+
} & {
|
|
1118
|
+
[key: string]: any;
|
|
1119
|
+
};
|
|
1120
|
+
/**
|
|
1121
|
+
* @type LocaleCode
|
|
1122
|
+
* A descriptor for a geographical region by both a language and country code. By combining these two, regional differences in a language can be addressed, such as with the request header parameter `Accept-Language` following [RFC 2616](https://tools.ietf.org/html/rfc2616) & [RFC 1766](https://tools.ietf.org/html/rfc1766). This can also just refer to a language code, also RFC 2616/1766 compliant, as a default if there is no specific match for a country. Finally, can also be used to define default behavior if there is no locale specified.
|
|
1123
|
+
*/
|
|
1124
|
+
type LocaleCode = DefaultFallback | string;
|
|
1125
|
+
/**
|
|
1126
|
+
* @type PaginatedResultBase: Schema defining generic pageable result. Each response schema of a resource requiring pagination should extend this schema. If you use this extend this schema directly, it needs to be defined what data is returned. Allowed names for the data field is `data`.
|
|
1127
|
+
*
|
|
1128
|
+
* @property offset: The zero-based index of the first hit/data to include in the result.
|
|
1129
|
+
*
|
|
1130
|
+
* @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
|
|
1131
|
+
*
|
|
1132
|
+
* @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
|
|
1133
|
+
*
|
|
1134
|
+
*/
|
|
1135
|
+
type PaginatedResultBase = {
|
|
1136
|
+
offset: number;
|
|
1137
|
+
limit: number;
|
|
1138
|
+
total: number;
|
|
1139
|
+
} & {
|
|
1140
|
+
[key: string]: any;
|
|
1141
|
+
};
|
|
1142
|
+
/**
|
|
1143
|
+
* @type ResultBase: Schema defining generic list result. Each response schema of a resource requiring a list response should extend this schema. Additionally it needs to be defined what data is returned.
|
|
1144
|
+
*
|
|
1145
|
+
* @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
|
|
1146
|
+
*
|
|
1147
|
+
* @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
|
|
1148
|
+
*
|
|
1149
|
+
*/
|
|
1150
|
+
type ResultBase = {
|
|
1151
|
+
limit: number;
|
|
1152
|
+
total: number;
|
|
1153
|
+
} & {
|
|
1154
|
+
[key: string]: any;
|
|
1155
|
+
};
|
|
1156
|
+
/**
|
|
1157
|
+
* @type Store: Document representing a store.
|
|
1158
|
+
*
|
|
1159
|
+
* @property address1: The primary address of the store.
|
|
1160
|
+
* - **Min Length:** 1
|
|
1161
|
+
*
|
|
1162
|
+
* @property address2: The secondary address of the store.
|
|
1163
|
+
*
|
|
1164
|
+
* @property city: The city of the store.
|
|
1165
|
+
*
|
|
1166
|
+
* @property countryCode: A two letter uppercase country code conforming to the [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 standard.
|
|
1167
|
+
* - **Pattern:** /^[A-Z][A-Z]$/
|
|
1168
|
+
*
|
|
1169
|
+
* @property distance: The distance to the given geolocation where the stores will be searched, using the unit given in the attribute \'DistanceUnit\' (miles or kilometers).
|
|
1170
|
+
*
|
|
1171
|
+
* @property distanceUnit:
|
|
1172
|
+
*
|
|
1173
|
+
* @property email: The email address of the store.
|
|
1174
|
+
*
|
|
1175
|
+
* @property fax: The fax number of the store.
|
|
1176
|
+
*
|
|
1177
|
+
* @property id: The id of the store.
|
|
1178
|
+
* - **Min Length:** 1
|
|
1179
|
+
* - **Max Length:** 256
|
|
1180
|
+
*
|
|
1181
|
+
* @property image: The store image.
|
|
1182
|
+
*
|
|
1183
|
+
* @property inventoryId: The inventory list id associated with this store.
|
|
1184
|
+
* - **Max Length:** 256
|
|
1185
|
+
*
|
|
1186
|
+
* @property latitude: The latitude of the store.
|
|
1187
|
+
*
|
|
1188
|
+
* @property longitude: The longitude of the store.
|
|
1189
|
+
*
|
|
1190
|
+
* @property name: The store name.
|
|
1191
|
+
*
|
|
1192
|
+
* @property phone: The phone number of the store.
|
|
1193
|
+
*
|
|
1194
|
+
* @property posEnabled: Whether this store uses Store Point-of-Sale.
|
|
1195
|
+
*
|
|
1196
|
+
* @property postalCode: The postal code of the store.
|
|
1197
|
+
* - **Min Length:** 3
|
|
1198
|
+
* - **Max Length:** 10
|
|
1199
|
+
*
|
|
1200
|
+
* @property stateCode: The state code of the store.
|
|
1201
|
+
*
|
|
1202
|
+
* @property storeEvents: The store events.
|
|
1203
|
+
*
|
|
1204
|
+
* @property storeHours: The opening hours of the store.
|
|
1205
|
+
*
|
|
1206
|
+
* @property storeLocatorEnabled: Whether this store should show up in store locator results.
|
|
1207
|
+
*
|
|
1208
|
+
*/
|
|
1209
|
+
type Store = {
|
|
1210
|
+
address1?: string;
|
|
1211
|
+
address2?: string;
|
|
1212
|
+
city?: string;
|
|
1213
|
+
countryCode?: string;
|
|
1214
|
+
distance?: number;
|
|
1215
|
+
distanceUnit?: DistanceUnit;
|
|
1216
|
+
email?: string;
|
|
1217
|
+
fax?: string;
|
|
1218
|
+
id: string;
|
|
1219
|
+
image?: string;
|
|
1220
|
+
inventoryId?: string;
|
|
1221
|
+
latitude?: number;
|
|
1222
|
+
longitude?: number;
|
|
1223
|
+
name?: string;
|
|
1224
|
+
phone?: string;
|
|
1225
|
+
posEnabled?: boolean;
|
|
1226
|
+
postalCode?: string;
|
|
1227
|
+
stateCode?: string;
|
|
1228
|
+
storeEvents?: string;
|
|
1229
|
+
storeHours?: string;
|
|
1230
|
+
storeLocatorEnabled?: boolean;
|
|
1231
|
+
} & {
|
|
1232
|
+
[key: string]: any;
|
|
1233
|
+
};
|
|
1234
|
+
/**
|
|
1235
|
+
* @type StoreResult: Result object containing an array of stores.
|
|
1236
|
+
*
|
|
1237
|
+
* @property data: The list of stores in the search result.
|
|
1238
|
+
*
|
|
1239
|
+
* @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
|
|
1240
|
+
*
|
|
1241
|
+
* @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
|
|
1242
|
+
*
|
|
1243
|
+
*/
|
|
1244
|
+
type StoreResult = {
|
|
1245
|
+
data?: Array<Store>;
|
|
1246
|
+
limit: number;
|
|
1247
|
+
total: number;
|
|
1248
|
+
} & {
|
|
1249
|
+
[key: string]: any;
|
|
1250
|
+
};
|
|
1251
|
+
/**
|
|
1252
|
+
* @type Stores: Result object containing an paginated array of stores.
|
|
1253
|
+
*
|
|
1254
|
+
* @property data: The list of stores in the search result.
|
|
1255
|
+
*
|
|
1256
|
+
* @property offset: The zero-based index of the first hit/data to include in the result.
|
|
1257
|
+
*
|
|
1258
|
+
* @property limit: Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
|
|
1259
|
+
*
|
|
1260
|
+
* @property total: The total number of hits that match the search\'s criteria. This can be greater than the number of results returned as search results are pagenated.
|
|
1261
|
+
*
|
|
1262
|
+
*/
|
|
1263
|
+
type Stores = {
|
|
1264
|
+
data?: Array<Store>;
|
|
1265
|
+
offset: number;
|
|
1266
|
+
limit: number;
|
|
1267
|
+
total: number;
|
|
1268
|
+
} & {
|
|
1269
|
+
[key: string]: any;
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
declare namespace ShopperStoresTypes {
|
|
1273
|
+
type ShopperStoresPathParameters = ShopperStoresApiTypes.ShopperStoresPathParameters;
|
|
1274
|
+
type ShopperStoresQueryParameters = ShopperStoresApiTypes.ShopperStoresQueryParameters;
|
|
1275
|
+
type getStoresQueryParameters = ShopperStoresApiTypes.getStoresQueryParameters;
|
|
1276
|
+
type getStoresPathParameters = ShopperStoresApiTypes.getStoresPathParameters;
|
|
1277
|
+
type searchStoresQueryParameters = ShopperStoresApiTypes.searchStoresQueryParameters;
|
|
1278
|
+
type searchStoresPathParameters = ShopperStoresApiTypes.searchStoresPathParameters;
|
|
1279
|
+
type DefaultFallback = ShopperStoresModelTypes.DefaultFallback;
|
|
1280
|
+
type DistanceUnit = ShopperStoresModelTypes.DistanceUnit;
|
|
1281
|
+
type ErrorResponse = ShopperStoresModelTypes.ErrorResponse;
|
|
1282
|
+
type LocaleCode = ShopperStoresModelTypes.LocaleCode;
|
|
1283
|
+
type PaginatedResultBase = ShopperStoresModelTypes.PaginatedResultBase;
|
|
1284
|
+
type ResultBase = ShopperStoresModelTypes.ResultBase;
|
|
1285
|
+
type Store = ShopperStoresModelTypes.Store;
|
|
1286
|
+
type StoreResult = ShopperStoresModelTypes.StoreResult;
|
|
1287
|
+
type Stores = ShopperStoresModelTypes.Stores;
|
|
1288
|
+
}
|
|
1289
|
+
export { defaultBaseUri, getStoresQueryParameters, getStoresPathParameters, searchStoresQueryParameters, searchStoresPathParameters, ShopperStoresPathParameters, ShopperStoresQueryParameters, ShopperStoresParameters, ShopperStores, DefaultFallback, DistanceUnit, ErrorResponse, LocaleCode$0 as LocaleCode, PaginatedResultBase, ResultBase, Store, StoreResult, Stores, ShopperStoresTypes };
|