@commercengine/storefront-sdk 0.3.0 → 0.3.2

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.
@@ -1,14 +1,10 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.StorefrontAPIClient = exports.Environment = void 0;
7
- const openapi_fetch_1 = __importDefault(require("openapi-fetch"));
1
+ import createClient from "openapi-fetch";
2
+ import { createDefaultAuthMiddleware } from "./middleware";
3
+ import { getPathnameFromUrl, isAnonymousAuthEndpoint } from "./auth-utils";
8
4
  /**
9
5
  * Available API environments
10
6
  */
11
- var Environment;
7
+ export var Environment;
12
8
  (function (Environment) {
13
9
  /**
14
10
  * Staging environment
@@ -18,87 +14,101 @@ var Environment;
18
14
  * Production environment
19
15
  */
20
16
  Environment["Production"] = "production";
21
- })(Environment || (exports.Environment = Environment = {}));
17
+ })(Environment || (Environment = {}));
22
18
  /**
23
19
  * Base API client for Storefront API
24
20
  */
25
- class StorefrontAPIClient {
21
+ export class StorefrontAPIClient {
22
+ client;
23
+ config;
24
+ baseUrl;
26
25
  /**
27
26
  * Create a new StorefrontAPIClient
28
27
  *
29
28
  * @param config - Configuration for the API client
30
- *
31
- * @remarks
32
- * This client implements a token refresh mechanism that will:
33
- * 1. Automatically retry requests that fail with a 401 error
34
- * 2. Refresh the token before retrying the request
35
- * 3. If the token refresh fails, the original error will be thrown
36
- *
37
- * This behavior is inherited by all client classes that extend StorefrontAPIClient.
38
- *
39
- * When using the AuthClient, tokens can be stored persistently in:
40
- * - Memory (default) - Tokens are lost when the page refreshes or app restarts
41
- * - Browser localStorage - Tokens persist across page refreshes
42
- * - Cookies - Tokens persist across page refreshes and can be read server-side
43
- * - Next.js cookies API - For server-side components
44
29
  */
45
30
  constructor(config) {
46
- this.isRefreshing = false;
47
- // Use shared config reference for the same storeId to ensure all clients use the same config
48
- const storeKey = config.storeId + (config.baseUrl || config.environment || "");
49
- if (!StorefrontAPIClient.sharedConfigs.has(storeKey)) {
50
- StorefrontAPIClient.sharedConfigs.set(storeKey, { ...config });
51
- }
52
- // Use the shared config reference
53
- this.config = StorefrontAPIClient.sharedConfigs.get(storeKey);
54
- // Copy non-shared values from the provided config
55
- if (config.token && !this.config.token) {
56
- this.config.token = config.token;
57
- }
58
- if (config.apiKey && !this.config.apiKey) {
59
- this.config.apiKey = config.apiKey;
60
- }
61
- this.headers = {
62
- "Content-Type": "application/json",
63
- };
64
- if (this.config.token) {
65
- this.headers["Authorization"] = `Bearer ${this.config.token}`;
66
- }
67
- if (this.config.apiKey) {
68
- this.headers["X-Api-Key"] = this.config.apiKey;
69
- }
31
+ this.config = { ...config };
70
32
  // Determine base URL from environment or use custom URL if provided
71
33
  this.baseUrl = this.getBaseUrlFromConfig(this.config);
72
- this.client = (0, openapi_fetch_1.default)({
34
+ this.client = createClient({
73
35
  baseUrl: this.baseUrl,
74
- fetch: (input, init) => {
75
- // Add timeout if configured
76
- const timeoutSignal = this.config.timeout
77
- ? AbortSignal.timeout(this.config.timeout)
78
- : undefined;
79
- // Always check for the most current token and API key before each request
80
- if (this.config.token) {
81
- this.headers["Authorization"] = `Bearer ${this.config.token}`;
82
- }
83
- else {
84
- delete this.headers["Authorization"];
85
- }
86
- if (this.config.apiKey) {
87
- this.headers["X-Api-Key"] = this.config.apiKey;
88
- }
89
- else {
90
- delete this.headers["X-Api-Key"];
36
+ });
37
+ // Set up auth middleware if token storage is provided
38
+ if (this.config.tokenStorage) {
39
+ const authMiddleware = createDefaultAuthMiddleware({
40
+ apiKey: this.config.apiKey,
41
+ baseUrl: this.baseUrl,
42
+ tokenStorage: this.config.tokenStorage,
43
+ onTokensUpdated: this.config.onTokensUpdated,
44
+ onTokensCleared: this.config.onTokensCleared,
45
+ });
46
+ this.client.use(authMiddleware);
47
+ // If initial tokens were provided, store them in tokenStorage
48
+ if (this.config.accessToken) {
49
+ this.config.tokenStorage.setAccessToken(this.config.accessToken).catch(error => {
50
+ console.warn('Failed to set initial access token in storage:', error);
51
+ });
52
+ // Clear the manual token since we're using storage
53
+ this.config.accessToken = undefined;
54
+ }
55
+ if (this.config.refreshToken) {
56
+ this.config.tokenStorage.setRefreshToken(this.config.refreshToken).catch(error => {
57
+ console.warn('Failed to set initial refresh token in storage:', error);
58
+ });
59
+ // Clear the manual refresh token since we're using storage
60
+ this.config.refreshToken = undefined;
61
+ }
62
+ }
63
+ else {
64
+ // For manual token management, add simple header injection middleware
65
+ this.client.use({
66
+ onRequest: async ({ request }) => {
67
+ const pathname = getPathnameFromUrl(request.url);
68
+ // Handle anonymous auth endpoint - use API key
69
+ if (isAnonymousAuthEndpoint(pathname)) {
70
+ if (this.config.apiKey) {
71
+ request.headers.set("X-Api-Key", this.config.apiKey);
72
+ }
73
+ // Also send existing access token if available for continuity
74
+ if (this.config.accessToken) {
75
+ request.headers.set("Authorization", `Bearer ${this.config.accessToken}`);
76
+ }
77
+ return request;
78
+ }
79
+ // For all other endpoints, use access token
80
+ if (this.config.accessToken) {
81
+ request.headers.set("Authorization", `Bearer ${this.config.accessToken}`);
82
+ }
83
+ return request;
84
+ },
85
+ });
86
+ }
87
+ // Set up timeout middleware if configured
88
+ if (this.config.timeout) {
89
+ this.setupTimeoutMiddleware();
90
+ }
91
+ }
92
+ /**
93
+ * Set up timeout middleware
94
+ */
95
+ setupTimeoutMiddleware() {
96
+ this.client.use({
97
+ onRequest: async ({ request }) => {
98
+ // Add timeout signal
99
+ const controller = new AbortController();
100
+ const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
101
+ // Merge with existing signal if present
102
+ if (request.signal) {
103
+ request.signal.addEventListener('abort', () => controller.abort());
91
104
  }
92
- // Merge headers
93
- const headers = {
94
- ...this.headers,
95
- ...(init?.headers || {}),
96
- };
97
- return fetch(input, {
98
- ...init,
99
- headers,
100
- signal: timeoutSignal || init?.signal,
105
+ // Create new request with timeout signal
106
+ const newRequest = new Request(request, {
107
+ signal: controller.signal,
101
108
  });
109
+ // Clean up timeout when request completes
110
+ controller.signal.addEventListener('abort', () => clearTimeout(timeoutId));
111
+ return newRequest;
102
112
  },
103
113
  });
104
114
  }
@@ -133,27 +143,58 @@ class StorefrontAPIClient {
133
143
  }
134
144
  /**
135
145
  * Get the authorization header value
146
+ * If using token storage, gets the current token from storage
147
+ * Otherwise returns the manual token
136
148
  *
137
149
  * @returns The Authorization header value or empty string if no token is set
138
150
  */
139
- getAuthorizationHeader() {
140
- return this.config.token ? `Bearer ${this.config.token}` : "";
151
+ async getAuthorizationHeader() {
152
+ if (this.config.tokenStorage) {
153
+ const token = await this.config.tokenStorage.getAccessToken();
154
+ return token ? `Bearer ${token}` : "";
155
+ }
156
+ return this.config.accessToken ? `Bearer ${this.config.accessToken}` : "";
141
157
  }
142
158
  /**
143
- * Set the authentication token
159
+ * Set authentication tokens
160
+ *
161
+ * @param accessToken - The access token (required)
162
+ * @param refreshToken - The refresh token (optional)
144
163
  *
145
- * @param token - The authentication token
164
+ * Behavior:
165
+ * - If tokenStorage is provided: Stores tokens for automatic management
166
+ * - If tokenStorage is not provided: Only stores access token for manual management
146
167
  */
147
- setToken(token) {
148
- this.config.token = token;
149
- this.headers["Authorization"] = `Bearer ${token}`;
168
+ async setTokens(accessToken, refreshToken) {
169
+ if (this.config.tokenStorage) {
170
+ // Automatic token management
171
+ await this.config.tokenStorage.setAccessToken(accessToken);
172
+ if (refreshToken) {
173
+ await this.config.tokenStorage.setRefreshToken(refreshToken);
174
+ }
175
+ }
176
+ else {
177
+ // Manual token management - only access token
178
+ this.config.accessToken = accessToken;
179
+ if (refreshToken) {
180
+ console.warn("Refresh token provided but ignored in manual token management mode. Use tokenStorage for automatic management.");
181
+ }
182
+ }
150
183
  }
151
184
  /**
152
- * Clear the authentication token
185
+ * Clear all authentication tokens
186
+ *
187
+ * Behavior:
188
+ * - If tokenStorage is provided: Clears both access and refresh tokens from storage
189
+ * - If tokenStorage is not provided: Clears the manual access token
153
190
  */
154
- clearToken() {
155
- this.config.token = undefined;
156
- delete this.headers["Authorization"];
191
+ async clearTokens() {
192
+ if (this.config.tokenStorage) {
193
+ await this.config.tokenStorage.clearTokens();
194
+ }
195
+ else {
196
+ this.config.accessToken = undefined;
197
+ }
157
198
  }
158
199
  /**
159
200
  * Set the X-Api-Key header
@@ -162,106 +203,40 @@ class StorefrontAPIClient {
162
203
  */
163
204
  setApiKey(apiKey) {
164
205
  this.config.apiKey = apiKey;
165
- this.headers["X-Api-Key"] = apiKey;
166
206
  }
167
207
  /**
168
208
  * Clear the X-Api-Key header
169
209
  */
170
210
  clearApiKey() {
171
211
  this.config.apiKey = undefined;
172
- delete this.headers["X-Api-Key"];
173
- }
174
- /**
175
- * Handle API errors
176
- *
177
- * @param error - Error object from OpenAPI-Fetch
178
- * @throws Rethrows the error with additional context
179
- */
180
- async handleError(error) {
181
- // Extract status code and error data from OpenAPI-Fetch error response
182
- const statusCode = error.status || (error.response?.status ? error.response.status : 500);
183
- const errorData = error.data ||
184
- error.response?.data || { message: error.message || "Unknown error" };
185
- // If we have a 401 error and we're not already in a refresh operation,
186
- // attempt to refresh the token
187
- if (statusCode === 401 && !this.isRefreshing) {
188
- try {
189
- this.isRefreshing = true;
190
- const refreshed = await this.attemptTokenRefresh();
191
- if (refreshed) {
192
- // Token refreshed successfully - no need to throw error
193
- // The calling method should retry the request
194
- this.isRefreshing = false;
195
- throw new Error("Token refreshed, please retry the request");
196
- }
197
- }
198
- catch (refreshError) {
199
- // If refresh fails, continue to throw the original error
200
- }
201
- finally {
202
- this.isRefreshing = false;
203
- }
204
- }
205
- if (statusCode === 401) {
206
- throw new Error("Unauthorized: Please check your authentication token");
207
- }
208
- else if (statusCode === 404) {
209
- throw new Error("Resource not found");
210
- }
211
- else if (errorData?.message) {
212
- throw new Error(`API Error (${statusCode}): ${errorData.message}`);
213
- }
214
- else {
215
- throw new Error(`API Error (${statusCode})`);
216
- }
217
- }
218
- /**
219
- * Attempt to refresh the token
220
- * This is a placeholder method that will be overridden by AuthClient
221
- *
222
- * @returns Promise that resolves to true if token was refreshed, false otherwise
223
- */
224
- async attemptTokenRefresh() {
225
- // Base implementation does nothing
226
- // Will be overridden by AuthClient
227
- return false;
228
212
  }
229
213
  /**
230
- * Execute a request with automatic token refresh handling
231
- * For AuthClient, this will attempt to refresh the token and retry once on 401 errors
232
- * Base implementation just executes the request
214
+ * Execute a request and handle the response
233
215
  *
234
- * @param requestFn - Function that executes the API request
216
+ * @param apiCall - Function that executes the API request
235
217
  * @returns Promise with the API response
236
218
  */
237
- async executeRequest(requestFn) {
219
+ async executeRequest(apiCall) {
238
220
  try {
239
- return await requestFn();
240
- }
241
- catch (error) {
242
- // Handle 401 errors by attempting to refresh token
243
- if (error &&
244
- typeof error === "object" &&
245
- "status" in error &&
246
- error.status === 401) {
247
- // Attempt to refresh the token
248
- const refreshed = await this.attemptTokenRefresh();
249
- if (refreshed) {
250
- // If token was refreshed, retry the request once
251
- return await requestFn();
252
- }
253
- }
254
- // Check if the error is from handleError and is the special refresh token message
255
- if (error instanceof Error &&
256
- error.message === "Token refreshed, please retry the request") {
257
- // If token was refreshed, retry the request once
258
- return await requestFn();
221
+ const { data, error } = await apiCall();
222
+ // openapi-fetch returns error for 4xx/5xx, data for 2xx
223
+ if (error) {
224
+ return { data: null, error };
259
225
  }
260
- // Otherwise, throw the error to be handled by the caller
261
- throw error;
226
+ // data will be defined for 2xx responses
227
+ return { data: data, error: null };
228
+ }
229
+ catch (err) {
230
+ // This handles network errors or other unexpected errors
231
+ return {
232
+ data: null,
233
+ error: {
234
+ success: false,
235
+ code: 'NETWORK_ERROR',
236
+ message: 'Network error occurred',
237
+ error: err,
238
+ },
239
+ };
262
240
  }
263
241
  }
264
242
  }
265
- exports.StorefrontAPIClient = StorefrontAPIClient;
266
- // Shared static reference for configs by storeId to ensure all clients use the same config
267
- StorefrontAPIClient.sharedConfigs = new Map();
@@ -0,0 +1,87 @@
1
+ import type { ApiResult, CreateCustomerBody, CreateAddressBody, CreateAddressContent, CreateAddressPathParams, CreateCustomerContent, DeleteAddressPathParams, DeleteAddressResponse, GetAddressDetailContent, GetAddressDetailPathParams, GetCustomerDetailContent, GetCustomerDetailPathParams, GetLoyaltyDetailsContent, GetLoyaltyDetailsPathParams, ListAddressesContent, ListAddressesPathParams, ListLoyaltyActivitiesContent, ListLoyaltyActivitiesPathParams, ListUserReviewsContent, ListUserReviewsPathParams, UpdateAddressDetailBody, UpdateAddressDetailContent, UpdateAddressDetailPathParams, UpdateCustomerBody, UpdateCustomerContent, UpdateCustomerPathParams } from "../types/storefront-api-types";
2
+ import { StorefrontAPIClient } from "./client";
3
+ /**
4
+ * Client for interacting with customer endpoints
5
+ */
6
+ export declare class CustomerClient extends StorefrontAPIClient {
7
+ /**
8
+ * Create a customer
9
+ *
10
+ * @param body - Customer creation body
11
+ * @returns Promise with customer details
12
+ */
13
+ createCustomer(body: CreateCustomerBody): Promise<ApiResult<CreateCustomerContent>>;
14
+ /**
15
+ * Get customer details
16
+ *
17
+ * @param pathParams - Path parameters
18
+ * @returns Promise with customer details
19
+ */
20
+ getCustomer(pathParams: GetCustomerDetailPathParams): Promise<ApiResult<GetCustomerDetailContent>>;
21
+ /**
22
+ * Update a customer
23
+ *
24
+ * @param pathParams - Path parameters
25
+ * @param body - Customer update body
26
+ * @returns Promise with customer details
27
+ */
28
+ updateCustomer(pathParams: UpdateCustomerPathParams, body: UpdateCustomerBody): Promise<ApiResult<UpdateCustomerContent>>;
29
+ /**
30
+ * Get all saved addresses for a customer
31
+ *
32
+ * @param pathParams - Path parameters
33
+ * @returns Promise with addresses
34
+ */
35
+ listAddresses(pathParams: ListAddressesPathParams): Promise<ApiResult<ListAddressesContent>>;
36
+ /**
37
+ * Create a new address for a customer
38
+ *
39
+ * @param pathParams - Path parameters
40
+ * @param body - Address creation body
41
+ * @returns Promise with address details
42
+ */
43
+ createAddress(pathParams: CreateAddressPathParams, body: CreateAddressBody): Promise<ApiResult<CreateAddressContent>>;
44
+ /**
45
+ * Get an address for a customer
46
+ *
47
+ * @param pathParams - Path parameters
48
+ * @returns Promise with address details
49
+ */
50
+ getAddress(pathParams: GetAddressDetailPathParams): Promise<ApiResult<GetAddressDetailContent>>;
51
+ /**
52
+ * Update an address for a customer
53
+ *
54
+ * @param pathParams - Path parameters
55
+ * @param body - Address update body
56
+ * @returns Promise with address details
57
+ */
58
+ updateAddress(pathParams: UpdateAddressDetailPathParams, body: UpdateAddressDetailBody): Promise<ApiResult<UpdateAddressDetailContent>>;
59
+ /**
60
+ * Delete an address for a customer
61
+ *
62
+ * @param pathParams - Path parameters
63
+ * @returns Promise with address details
64
+ */
65
+ deleteAddress(pathParams: DeleteAddressPathParams): Promise<ApiResult<DeleteAddressResponse>>;
66
+ /**
67
+ * Get customer loyalty details
68
+ *
69
+ * @param pathParams - Path parameters
70
+ * @returns Promise with loyalty details
71
+ */
72
+ getLoyaltyDetails(pathParams: GetLoyaltyDetailsPathParams): Promise<ApiResult<GetLoyaltyDetailsContent>>;
73
+ /**
74
+ * List all loyalty points activity for a customer
75
+ *
76
+ * @param pathParams - Path parameters
77
+ * @returns Promise with loyalty points activity
78
+ */
79
+ listLoyaltyPointsActivity(pathParams: ListLoyaltyActivitiesPathParams): Promise<ApiResult<ListLoyaltyActivitiesContent>>;
80
+ /**
81
+ * List all reviews left by a customer
82
+ *
83
+ * @param pathParams - Path parameters
84
+ * @returns Promise with reviews
85
+ */
86
+ listCustomerReviews(pathParams: ListUserReviewsPathParams): Promise<ApiResult<ListUserReviewsContent>>;
87
+ }
@@ -0,0 +1,153 @@
1
+ import { StorefrontAPIClient } from "./client";
2
+ /**
3
+ * Client for interacting with customer endpoints
4
+ */
5
+ export class CustomerClient extends StorefrontAPIClient {
6
+ /**
7
+ * Create a customer
8
+ *
9
+ * @param body - Customer creation body
10
+ * @returns Promise with customer details
11
+ */
12
+ async createCustomer(body) {
13
+ return this.executeRequest(() => this.client.POST("/customers", {
14
+ body: body,
15
+ }));
16
+ }
17
+ /**
18
+ * Get customer details
19
+ *
20
+ * @param pathParams - Path parameters
21
+ * @returns Promise with customer details
22
+ */
23
+ async getCustomer(pathParams) {
24
+ return this.executeRequest(() => this.client.GET("/customers/{id}", {
25
+ params: {
26
+ path: pathParams,
27
+ },
28
+ }));
29
+ }
30
+ /**
31
+ * Update a customer
32
+ *
33
+ * @param pathParams - Path parameters
34
+ * @param body - Customer update body
35
+ * @returns Promise with customer details
36
+ */
37
+ async updateCustomer(pathParams, body) {
38
+ return this.executeRequest(() => this.client.PUT("/customers/{id}", {
39
+ params: {
40
+ path: pathParams,
41
+ },
42
+ body: body,
43
+ }));
44
+ }
45
+ /**
46
+ * Get all saved addresses for a customer
47
+ *
48
+ * @param pathParams - Path parameters
49
+ * @returns Promise with addresses
50
+ */
51
+ async listAddresses(pathParams) {
52
+ return this.executeRequest(() => this.client.GET("/customers/{user_id}/addresses", {
53
+ params: {
54
+ path: pathParams,
55
+ },
56
+ }));
57
+ }
58
+ /**
59
+ * Create a new address for a customer
60
+ *
61
+ * @param pathParams - Path parameters
62
+ * @param body - Address creation body
63
+ * @returns Promise with address details
64
+ */
65
+ async createAddress(pathParams, body) {
66
+ return this.executeRequest(() => this.client.POST("/customers/{user_id}/addresses", {
67
+ params: {
68
+ path: pathParams,
69
+ },
70
+ body: body,
71
+ }));
72
+ }
73
+ /**
74
+ * Get an address for a customer
75
+ *
76
+ * @param pathParams - Path parameters
77
+ * @returns Promise with address details
78
+ */
79
+ async getAddress(pathParams) {
80
+ return this.executeRequest(() => this.client.GET("/customers/{user_id}/addresses/{address_id}", {
81
+ params: {
82
+ path: pathParams,
83
+ },
84
+ }));
85
+ }
86
+ /**
87
+ * Update an address for a customer
88
+ *
89
+ * @param pathParams - Path parameters
90
+ * @param body - Address update body
91
+ * @returns Promise with address details
92
+ */
93
+ async updateAddress(pathParams, body) {
94
+ return this.executeRequest(() => this.client.PUT("/customers/{user_id}/addresses/{address_id}", {
95
+ params: {
96
+ path: pathParams,
97
+ },
98
+ body: body,
99
+ }));
100
+ }
101
+ /**
102
+ * Delete an address for a customer
103
+ *
104
+ * @param pathParams - Path parameters
105
+ * @returns Promise with address details
106
+ */
107
+ async deleteAddress(pathParams) {
108
+ return this.executeRequest(() => this.client.DELETE("/customers/{user_id}/addresses/{address_id}", {
109
+ params: {
110
+ path: pathParams,
111
+ },
112
+ }));
113
+ }
114
+ /**
115
+ * Get customer loyalty details
116
+ *
117
+ * @param pathParams - Path parameters
118
+ * @returns Promise with loyalty details
119
+ */
120
+ async getLoyaltyDetails(pathParams) {
121
+ return this.executeRequest(() => this.client.GET("/customers/{user_id}/loyalty", {
122
+ params: {
123
+ path: pathParams,
124
+ },
125
+ }));
126
+ }
127
+ /**
128
+ * List all loyalty points activity for a customer
129
+ *
130
+ * @param pathParams - Path parameters
131
+ * @returns Promise with loyalty points activity
132
+ */
133
+ async listLoyaltyPointsActivity(pathParams) {
134
+ return this.executeRequest(() => this.client.GET("/customers/{user_id}/loyalty-points-activity", {
135
+ params: {
136
+ path: pathParams,
137
+ },
138
+ }));
139
+ }
140
+ /**
141
+ * List all reviews left by a customer
142
+ *
143
+ * @param pathParams - Path parameters
144
+ * @returns Promise with reviews
145
+ */
146
+ async listCustomerReviews(pathParams) {
147
+ return this.executeRequest(() => this.client.GET("/customers/{user_id}/reviews", {
148
+ params: {
149
+ path: pathParams,
150
+ },
151
+ }));
152
+ }
153
+ }
@@ -0,0 +1,27 @@
1
+ import type { ApiResult, ListCountriesContent, ListCountryPincodesContent, ListCountryPincodesPathParams, ListCountryStatesContent, ListCountryStatesPathParams } from "../types/storefront-api-types";
2
+ import { StorefrontAPIClient } from "./client";
3
+ /**
4
+ * Client for interacting with helper endpoints
5
+ */
6
+ export declare class HelpersClient extends StorefrontAPIClient {
7
+ /**
8
+ * Get a list of countries
9
+ *
10
+ * @returns Promise with countries
11
+ */
12
+ listCountries(): Promise<ApiResult<ListCountriesContent>>;
13
+ /**
14
+ * - Get a list of states for a country
15
+ *
16
+ * @param pathParams - Path parameters
17
+ * @returns Promise with states
18
+ */
19
+ listCountryStates(pathParams: ListCountryStatesPathParams): Promise<ApiResult<ListCountryStatesContent>>;
20
+ /**
21
+ * Get pincodes for a country
22
+ *
23
+ * @param pathParams - Path parameters
24
+ * @returns Promise with pincodes
25
+ */
26
+ listCountryPincodes(pathParams: ListCountryPincodesPathParams): Promise<ApiResult<ListCountryPincodesContent>>;
27
+ }