ce-storefront 0.12.5 → 0.13.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.
Files changed (248) hide show
  1. package/docs/sdks/auth/README.md +20 -13
  2. package/docs/sdks/carts/README.md +8 -3
  3. package/docs/sdks/catalog/README.md +6 -3
  4. package/docs/sdks/common/README.md +6 -3
  5. package/docs/sdks/customers/README.md +12 -6
  6. package/docs/sdks/orders/README.md +6 -3
  7. package/docs/sdks/shipping/README.md +15 -6
  8. package/esm/funcs/authGenerateOtp.d.ts +2 -1
  9. package/esm/funcs/authGenerateOtp.d.ts.map +1 -1
  10. package/esm/funcs/authGenerateOtp.js +8 -2
  11. package/esm/funcs/authGenerateOtp.js.map +1 -1
  12. package/esm/funcs/authGetAnonymousToken.js +2 -0
  13. package/esm/funcs/authGetAnonymousToken.js.map +1 -1
  14. package/esm/funcs/authGetUserDetail.js +2 -0
  15. package/esm/funcs/authGetUserDetail.js.map +1 -1
  16. package/esm/funcs/authLoginWithEmail.js +2 -0
  17. package/esm/funcs/authLoginWithEmail.js.map +1 -1
  18. package/esm/funcs/authLoginWithPhone.js +2 -0
  19. package/esm/funcs/authLoginWithPhone.js.map +1 -1
  20. package/esm/funcs/authLoginWithWhatsapp.d.ts +2 -1
  21. package/esm/funcs/authLoginWithWhatsapp.d.ts.map +1 -1
  22. package/esm/funcs/authLoginWithWhatsapp.js +8 -2
  23. package/esm/funcs/authLoginWithWhatsapp.js.map +1 -1
  24. package/esm/funcs/authLogout.d.ts +2 -1
  25. package/esm/funcs/authLogout.d.ts.map +1 -1
  26. package/esm/funcs/authLogout.js +8 -2
  27. package/esm/funcs/authLogout.js.map +1 -1
  28. package/esm/funcs/authRefreshToken.js +2 -0
  29. package/esm/funcs/authRefreshToken.js.map +1 -1
  30. package/esm/funcs/authUpdateUser.js +2 -0
  31. package/esm/funcs/authUpdateUser.js.map +1 -1
  32. package/esm/funcs/authVerifyOtp.js +2 -0
  33. package/esm/funcs/authVerifyOtp.js.map +1 -1
  34. package/esm/funcs/cartsAddShippingMethod.js +2 -0
  35. package/esm/funcs/cartsAddShippingMethod.js.map +1 -1
  36. package/esm/funcs/cartsApplyCoupon.js +2 -0
  37. package/esm/funcs/cartsApplyCoupon.js.map +1 -1
  38. package/esm/funcs/cartsCreateCart.d.ts +2 -1
  39. package/esm/funcs/cartsCreateCart.d.ts.map +1 -1
  40. package/esm/funcs/cartsCreateCart.js +8 -2
  41. package/esm/funcs/cartsCreateCart.js.map +1 -1
  42. package/esm/funcs/cartsCreateCartAddress.js +2 -0
  43. package/esm/funcs/cartsCreateCartAddress.js.map +1 -1
  44. package/esm/funcs/cartsDeleteCart.js +2 -0
  45. package/esm/funcs/cartsDeleteCart.js.map +1 -1
  46. package/esm/funcs/cartsGetCart.js +2 -0
  47. package/esm/funcs/cartsGetCart.js.map +1 -1
  48. package/esm/funcs/cartsGetUserCart.js +2 -0
  49. package/esm/funcs/cartsGetUserCart.js.map +1 -1
  50. package/esm/funcs/cartsRedeemLoyaltyPoints.js +2 -0
  51. package/esm/funcs/cartsRedeemLoyaltyPoints.js.map +1 -1
  52. package/esm/funcs/cartsRemoveCoupon.js +2 -0
  53. package/esm/funcs/cartsRemoveCoupon.js.map +1 -1
  54. package/esm/funcs/cartsRemoveLoyaltyPoints.js +2 -0
  55. package/esm/funcs/cartsRemoveLoyaltyPoints.js.map +1 -1
  56. package/esm/funcs/cartsRemoveUserCart.js +2 -0
  57. package/esm/funcs/cartsRemoveUserCart.js.map +1 -1
  58. package/esm/funcs/cartsUpdateCart.js +2 -0
  59. package/esm/funcs/cartsUpdateCart.js.map +1 -1
  60. package/esm/funcs/catalogGetProductDetail.js +2 -0
  61. package/esm/funcs/catalogGetProductDetail.js.map +1 -1
  62. package/esm/funcs/catalogGetVariantDetail.js +2 -0
  63. package/esm/funcs/catalogGetVariantDetail.js.map +1 -1
  64. package/esm/funcs/catalogListCategories.d.ts +2 -1
  65. package/esm/funcs/catalogListCategories.d.ts.map +1 -1
  66. package/esm/funcs/catalogListCategories.js +8 -2
  67. package/esm/funcs/catalogListCategories.js.map +1 -1
  68. package/esm/funcs/catalogListCrosssellProducts.js +2 -0
  69. package/esm/funcs/catalogListCrosssellProducts.js.map +1 -1
  70. package/esm/funcs/catalogListProductReviews.js +2 -0
  71. package/esm/funcs/catalogListProductReviews.js.map +1 -1
  72. package/esm/funcs/catalogListProductVariants.js +2 -0
  73. package/esm/funcs/catalogListProductVariants.js.map +1 -1
  74. package/esm/funcs/catalogListProducts.js +2 -0
  75. package/esm/funcs/catalogListProducts.js.map +1 -1
  76. package/esm/funcs/catalogListSimilarProducts.js +2 -0
  77. package/esm/funcs/catalogListSimilarProducts.js.map +1 -1
  78. package/esm/funcs/catalogListSkus.js +2 -0
  79. package/esm/funcs/catalogListSkus.js.map +1 -1
  80. package/esm/funcs/catalogListUpsellProducts.js +2 -0
  81. package/esm/funcs/catalogListUpsellProducts.js.map +1 -1
  82. package/esm/funcs/catalogSearchProducts.js +2 -0
  83. package/esm/funcs/catalogSearchProducts.js.map +1 -1
  84. package/esm/funcs/commonListCountryPincodes.d.ts +2 -1
  85. package/esm/funcs/commonListCountryPincodes.d.ts.map +1 -1
  86. package/esm/funcs/commonListCountryPincodes.js +8 -2
  87. package/esm/funcs/commonListCountryPincodes.js.map +1 -1
  88. package/esm/funcs/customersCreateAddress.js +2 -0
  89. package/esm/funcs/customersCreateAddress.js.map +1 -1
  90. package/esm/funcs/customersDeleteAddress.js +2 -0
  91. package/esm/funcs/customersDeleteAddress.js.map +1 -1
  92. package/esm/funcs/customersGetAddressDetail.js +2 -0
  93. package/esm/funcs/customersGetAddressDetail.js.map +1 -1
  94. package/esm/funcs/customersGetLoyaltyDetails.js +2 -0
  95. package/esm/funcs/customersGetLoyaltyDetails.js.map +1 -1
  96. package/esm/funcs/customersListAddresses.d.ts +2 -1
  97. package/esm/funcs/customersListAddresses.d.ts.map +1 -1
  98. package/esm/funcs/customersListAddresses.js +8 -2
  99. package/esm/funcs/customersListAddresses.js.map +1 -1
  100. package/esm/funcs/customersListUserReviews.d.ts +2 -1
  101. package/esm/funcs/customersListUserReviews.d.ts.map +1 -1
  102. package/esm/funcs/customersListUserReviews.js +8 -2
  103. package/esm/funcs/customersListUserReviews.js.map +1 -1
  104. package/esm/funcs/customersUpdateAddressDetail.js +2 -0
  105. package/esm/funcs/customersUpdateAddressDetail.js.map +1 -1
  106. package/esm/funcs/ordersCancelOrder.js +2 -0
  107. package/esm/funcs/ordersCancelOrder.js.map +1 -1
  108. package/esm/funcs/ordersCreateOrder.js +2 -0
  109. package/esm/funcs/ordersCreateOrder.js.map +1 -1
  110. package/esm/funcs/ordersGetOrderDetail.js +2 -0
  111. package/esm/funcs/ordersGetOrderDetail.js.map +1 -1
  112. package/esm/funcs/ordersGetPaymentStatus.d.ts +2 -1
  113. package/esm/funcs/ordersGetPaymentStatus.d.ts.map +1 -1
  114. package/esm/funcs/ordersGetPaymentStatus.js +8 -2
  115. package/esm/funcs/ordersGetPaymentStatus.js.map +1 -1
  116. package/esm/funcs/ordersListOrderShipments.js +2 -0
  117. package/esm/funcs/ordersListOrderShipments.js.map +1 -1
  118. package/esm/funcs/ordersListOrders.js +2 -0
  119. package/esm/funcs/ordersListOrders.js.map +1 -1
  120. package/esm/funcs/ordersRetryOrderPayment.js +2 -0
  121. package/esm/funcs/ordersRetryOrderPayment.js.map +1 -1
  122. package/esm/funcs/shippingShippingMethods.d.ts +3 -1
  123. package/esm/funcs/shippingShippingMethods.d.ts.map +1 -1
  124. package/esm/funcs/shippingShippingMethods.js +11 -6
  125. package/esm/funcs/shippingShippingMethods.js.map +1 -1
  126. package/esm/hooks/types.d.ts +2 -0
  127. package/esm/hooks/types.d.ts.map +1 -1
  128. package/esm/lib/config.d.ts +7 -3
  129. package/esm/lib/config.d.ts.map +1 -1
  130. package/esm/lib/config.js +3 -3
  131. package/esm/lib/config.js.map +1 -1
  132. package/esm/lib/sdks.d.ts +1 -0
  133. package/esm/lib/sdks.d.ts.map +1 -1
  134. package/esm/lib/sdks.js +3 -3
  135. package/esm/lib/sdks.js.map +1 -1
  136. package/esm/models/components/appliedcoupon.d.ts +85 -0
  137. package/esm/models/components/appliedcoupon.d.ts.map +1 -0
  138. package/esm/models/components/appliedcoupon.js +87 -0
  139. package/esm/models/components/appliedcoupon.js.map +1 -0
  140. package/esm/models/components/appliedpromotion.d.ts +83 -0
  141. package/esm/models/components/appliedpromotion.d.ts.map +1 -0
  142. package/esm/models/components/appliedpromotion.js +90 -0
  143. package/esm/models/components/appliedpromotion.js.map +1 -0
  144. package/esm/models/components/cart.d.ts +6 -153
  145. package/esm/models/components/cart.d.ts.map +1 -1
  146. package/esm/models/components/cart.js +6 -161
  147. package/esm/models/components/cart.js.map +1 -1
  148. package/esm/models/components/generateotpwithemail.d.ts +65 -0
  149. package/esm/models/components/generateotpwithemail.d.ts.map +1 -0
  150. package/esm/models/components/generateotpwithemail.js +65 -0
  151. package/esm/models/components/generateotpwithemail.js.map +1 -0
  152. package/esm/models/components/generateotpwithphone.d.ts +98 -0
  153. package/esm/models/components/generateotpwithphone.d.ts.map +1 -0
  154. package/esm/models/components/generateotpwithphone.js +90 -0
  155. package/esm/models/components/generateotpwithphone.js.map +1 -0
  156. package/esm/models/components/index.d.ts +4 -0
  157. package/esm/models/components/index.d.ts.map +1 -1
  158. package/esm/models/components/index.js +4 -0
  159. package/esm/models/components/index.js.map +1 -1
  160. package/esm/models/components/order.d.ts +6 -181
  161. package/esm/models/components/order.d.ts.map +1 -1
  162. package/esm/models/components/order.js +6 -185
  163. package/esm/models/components/order.js.map +1 -1
  164. package/esm/models/components/orderdetail.d.ts +6 -181
  165. package/esm/models/components/orderdetail.d.ts.map +1 -1
  166. package/esm/models/components/orderdetail.js +6 -185
  167. package/esm/models/components/orderdetail.js.map +1 -1
  168. package/esm/models/operations/generateotp.d.ts +3 -104
  169. package/esm/models/operations/generateotp.d.ts.map +1 -1
  170. package/esm/models/operations/generateotp.js +9 -72
  171. package/esm/models/operations/generateotp.js.map +1 -1
  172. package/esm/models/operations/getshippingmethods.d.ts +0 -21
  173. package/esm/models/operations/getshippingmethods.d.ts.map +1 -1
  174. package/esm/models/operations/getshippingmethods.js +0 -21
  175. package/esm/models/operations/getshippingmethods.js.map +1 -1
  176. package/esm/models/operations/updateshippingmethod.d.ts +9 -33
  177. package/esm/models/operations/updateshippingmethod.d.ts.map +1 -1
  178. package/esm/models/operations/updateshippingmethod.js +6 -27
  179. package/esm/models/operations/updateshippingmethod.js.map +1 -1
  180. package/esm/sdk/shipping.d.ts +2 -1
  181. package/esm/sdk/shipping.d.ts.map +1 -1
  182. package/esm/sdk/shipping.js.map +1 -1
  183. package/jsr.json +1 -1
  184. package/package.json +1 -1
  185. package/src/funcs/authGenerateOtp.ts +17 -2
  186. package/src/funcs/authGetAnonymousToken.ts +2 -0
  187. package/src/funcs/authGetUserDetail.ts +2 -0
  188. package/src/funcs/authLoginWithEmail.ts +2 -0
  189. package/src/funcs/authLoginWithPhone.ts +2 -0
  190. package/src/funcs/authLoginWithWhatsapp.ts +17 -2
  191. package/src/funcs/authLogout.ts +21 -2
  192. package/src/funcs/authRefreshToken.ts +2 -0
  193. package/src/funcs/authUpdateUser.ts +2 -0
  194. package/src/funcs/authVerifyOtp.ts +2 -0
  195. package/src/funcs/cartsAddShippingMethod.ts +2 -0
  196. package/src/funcs/cartsApplyCoupon.ts +2 -0
  197. package/src/funcs/cartsCreateCart.ts +21 -2
  198. package/src/funcs/cartsCreateCartAddress.ts +2 -0
  199. package/src/funcs/cartsDeleteCart.ts +2 -0
  200. package/src/funcs/cartsGetCart.ts +2 -0
  201. package/src/funcs/cartsGetUserCart.ts +2 -0
  202. package/src/funcs/cartsRedeemLoyaltyPoints.ts +2 -0
  203. package/src/funcs/cartsRemoveCoupon.ts +2 -0
  204. package/src/funcs/cartsRemoveLoyaltyPoints.ts +2 -0
  205. package/src/funcs/cartsRemoveUserCart.ts +2 -0
  206. package/src/funcs/cartsUpdateCart.ts +2 -0
  207. package/src/funcs/catalogGetProductDetail.ts +2 -0
  208. package/src/funcs/catalogGetVariantDetail.ts +2 -0
  209. package/src/funcs/catalogListCategories.ts +21 -2
  210. package/src/funcs/catalogListCrosssellProducts.ts +2 -0
  211. package/src/funcs/catalogListProductReviews.ts +2 -0
  212. package/src/funcs/catalogListProductVariants.ts +2 -0
  213. package/src/funcs/catalogListProducts.ts +2 -0
  214. package/src/funcs/catalogListSimilarProducts.ts +2 -0
  215. package/src/funcs/catalogListSkus.ts +2 -0
  216. package/src/funcs/catalogListUpsellProducts.ts +2 -0
  217. package/src/funcs/catalogSearchProducts.ts +2 -0
  218. package/src/funcs/commonListCountryPincodes.ts +21 -2
  219. package/src/funcs/customersCreateAddress.ts +2 -0
  220. package/src/funcs/customersDeleteAddress.ts +2 -0
  221. package/src/funcs/customersGetAddressDetail.ts +2 -0
  222. package/src/funcs/customersGetLoyaltyDetails.ts +2 -0
  223. package/src/funcs/customersListAddresses.ts +21 -2
  224. package/src/funcs/customersListUserReviews.ts +21 -2
  225. package/src/funcs/customersUpdateAddressDetail.ts +2 -0
  226. package/src/funcs/ordersCancelOrder.ts +2 -0
  227. package/src/funcs/ordersCreateOrder.ts +2 -0
  228. package/src/funcs/ordersGetOrderDetail.ts +2 -0
  229. package/src/funcs/ordersGetPaymentStatus.ts +21 -2
  230. package/src/funcs/ordersListOrderShipments.ts +2 -0
  231. package/src/funcs/ordersListOrders.ts +2 -0
  232. package/src/funcs/ordersRetryOrderPayment.ts +2 -0
  233. package/src/funcs/shippingShippingMethods.ts +26 -10
  234. package/src/hooks/types.ts +2 -0
  235. package/src/lib/config.ts +7 -3
  236. package/src/lib/sdks.ts +10 -4
  237. package/src/models/components/appliedcoupon.ts +139 -0
  238. package/src/models/components/appliedpromotion.ts +153 -0
  239. package/src/models/components/cart.ts +20 -265
  240. package/src/models/components/generateotpwithemail.ts +115 -0
  241. package/src/models/components/generateotpwithphone.ts +148 -0
  242. package/src/models/components/index.ts +4 -0
  243. package/src/models/components/order.ts +20 -310
  244. package/src/models/components/orderdetail.ts +20 -319
  245. package/src/models/operations/generateotp.ts +15 -118
  246. package/src/models/operations/getshippingmethods.ts +0 -54
  247. package/src/models/operations/updateshippingmethod.ts +15 -69
  248. package/src/sdk/shipping.ts +2 -1
@@ -18,6 +18,7 @@ import {
18
18
  RequestTimeoutError,
19
19
  UnexpectedClientError,
20
20
  } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
21
22
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
23
  import * as operations from "../models/operations/index.js";
23
24
  import { APICall, APIPromise } from "../types/async.js";
@@ -36,6 +37,9 @@ export function customersListAddresses(
36
37
  ): APIPromise<
37
38
  Result<
38
39
  operations.ListAddressesResponseBody,
40
+ | errors.BadRequest
41
+ | errors.Unauthorized
42
+ | errors.NotFound
39
43
  | CeError
40
44
  | SDKValidationError
41
45
  | UnexpectedClientError
@@ -60,6 +64,9 @@ async function $do(
60
64
  [
61
65
  Result<
62
66
  operations.ListAddressesResponseBody,
67
+ | errors.BadRequest
68
+ | errors.Unauthorized
69
+ | errors.NotFound
63
70
  | CeError
64
71
  | SDKValidationError
65
72
  | UnexpectedClientError
@@ -105,6 +112,7 @@ async function $do(
105
112
  const requestSecurity = resolveGlobalSecurity(securityInput);
106
113
 
107
114
  const context = {
115
+ options: client._options,
108
116
  baseURL: options?.serverURL ?? client._baseURL ?? "",
109
117
  operationID: "list-addresses",
110
118
  oAuth2Scopes: [],
@@ -126,6 +134,7 @@ async function $do(
126
134
  headers: headers,
127
135
  query: query,
128
136
  body: body,
137
+ userAgent: client._options.userAgent,
129
138
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
130
139
  }, options);
131
140
  if (!requestRes.ok) {
@@ -135,7 +144,7 @@ async function $do(
135
144
 
136
145
  const doResult = await client._do(req, {
137
146
  context,
138
- errorCodes: ["4XX", "5XX"],
147
+ errorCodes: ["400", "401", "404", "4XX", "5XX"],
139
148
  retryConfig: context.retryConfig,
140
149
  retryCodes: context.retryCodes,
141
150
  });
@@ -144,8 +153,15 @@ async function $do(
144
153
  }
145
154
  const response = doResult.value;
146
155
 
156
+ const responseFields = {
157
+ HttpMeta: { Response: response, Request: req },
158
+ };
159
+
147
160
  const [result] = await M.match<
148
161
  operations.ListAddressesResponseBody,
162
+ | errors.BadRequest
163
+ | errors.Unauthorized
164
+ | errors.NotFound
149
165
  | CeError
150
166
  | SDKValidationError
151
167
  | UnexpectedClientError
@@ -155,9 +171,12 @@ async function $do(
155
171
  | ConnectionError
156
172
  >(
157
173
  M.json(200, operations.ListAddressesResponseBody$inboundSchema),
174
+ M.jsonErr(400, errors.BadRequest$inboundSchema),
175
+ M.jsonErr(401, errors.Unauthorized$inboundSchema),
176
+ M.jsonErr(404, errors.NotFound$inboundSchema),
158
177
  M.fail("4XX"),
159
178
  M.fail("5XX"),
160
- )(response);
179
+ )(response, { extraFields: responseFields });
161
180
  if (!result.ok) {
162
181
  return [result, { status: "complete", request: req, response }];
163
182
  }
@@ -18,6 +18,7 @@ import {
18
18
  RequestTimeoutError,
19
19
  UnexpectedClientError,
20
20
  } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
21
22
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
23
  import * as operations from "../models/operations/index.js";
23
24
  import { APICall, APIPromise } from "../types/async.js";
@@ -36,6 +37,9 @@ export function customersListUserReviews(
36
37
  ): APIPromise<
37
38
  Result<
38
39
  operations.ListUserReviewsResponseBody,
40
+ | errors.BadRequest
41
+ | errors.Unauthorized
42
+ | errors.NotFound
39
43
  | CeError
40
44
  | SDKValidationError
41
45
  | UnexpectedClientError
@@ -60,6 +64,9 @@ async function $do(
60
64
  [
61
65
  Result<
62
66
  operations.ListUserReviewsResponseBody,
67
+ | errors.BadRequest
68
+ | errors.Unauthorized
69
+ | errors.NotFound
63
70
  | CeError
64
71
  | SDKValidationError
65
72
  | UnexpectedClientError
@@ -100,6 +107,7 @@ async function $do(
100
107
  const requestSecurity = resolveGlobalSecurity(securityInput);
101
108
 
102
109
  const context = {
110
+ options: client._options,
103
111
  baseURL: options?.serverURL ?? client._baseURL ?? "",
104
112
  operationID: "list-user-reviews",
105
113
  oAuth2Scopes: [],
@@ -120,6 +128,7 @@ async function $do(
120
128
  path: path,
121
129
  headers: headers,
122
130
  body: body,
131
+ userAgent: client._options.userAgent,
123
132
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
124
133
  }, options);
125
134
  if (!requestRes.ok) {
@@ -129,7 +138,7 @@ async function $do(
129
138
 
130
139
  const doResult = await client._do(req, {
131
140
  context,
132
- errorCodes: ["4XX", "5XX"],
141
+ errorCodes: ["400", "401", "404", "4XX", "5XX"],
133
142
  retryConfig: context.retryConfig,
134
143
  retryCodes: context.retryCodes,
135
144
  });
@@ -138,8 +147,15 @@ async function $do(
138
147
  }
139
148
  const response = doResult.value;
140
149
 
150
+ const responseFields = {
151
+ HttpMeta: { Response: response, Request: req },
152
+ };
153
+
141
154
  const [result] = await M.match<
142
155
  operations.ListUserReviewsResponseBody,
156
+ | errors.BadRequest
157
+ | errors.Unauthorized
158
+ | errors.NotFound
143
159
  | CeError
144
160
  | SDKValidationError
145
161
  | UnexpectedClientError
@@ -149,9 +165,12 @@ async function $do(
149
165
  | ConnectionError
150
166
  >(
151
167
  M.json(200, operations.ListUserReviewsResponseBody$inboundSchema),
168
+ M.jsonErr(400, errors.BadRequest$inboundSchema),
169
+ M.jsonErr(401, errors.Unauthorized$inboundSchema),
170
+ M.jsonErr(404, errors.NotFound$inboundSchema),
152
171
  M.fail("4XX"),
153
172
  M.fail("5XX"),
154
- )(response);
173
+ )(response, { extraFields: responseFields });
155
174
  if (!result.ok) {
156
175
  return [result, { status: "complete", request: req, response }];
157
176
  }
@@ -115,6 +115,7 @@ async function $do(
115
115
  const requestSecurity = resolveGlobalSecurity(securityInput);
116
116
 
117
117
  const context = {
118
+ options: client._options,
118
119
  baseURL: options?.serverURL ?? client._baseURL ?? "",
119
120
  operationID: "update-address-detail",
120
121
  oAuth2Scopes: [],
@@ -135,6 +136,7 @@ async function $do(
135
136
  path: path,
136
137
  headers: headers,
137
138
  body: body,
139
+ userAgent: client._options.userAgent,
138
140
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
139
141
  }, options);
140
142
  if (!requestRes.ok) {
@@ -106,6 +106,7 @@ async function $do(
106
106
  const requestSecurity = resolveGlobalSecurity(securityInput);
107
107
 
108
108
  const context = {
109
+ options: client._options,
109
110
  baseURL: options?.serverURL ?? client._baseURL ?? "",
110
111
  operationID: "cancel-order",
111
112
  oAuth2Scopes: [],
@@ -126,6 +127,7 @@ async function $do(
126
127
  path: path,
127
128
  headers: headers,
128
129
  body: body,
130
+ userAgent: client._options.userAgent,
129
131
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
130
132
  }, options);
131
133
  if (!requestRes.ok) {
@@ -101,6 +101,7 @@ async function $do(
101
101
  const requestSecurity = resolveGlobalSecurity(securityInput);
102
102
 
103
103
  const context = {
104
+ options: client._options,
104
105
  baseURL: options?.serverURL ?? client._baseURL ?? "",
105
106
  operationID: "create-order",
106
107
  oAuth2Scopes: [],
@@ -121,6 +122,7 @@ async function $do(
121
122
  path: path,
122
123
  headers: headers,
123
124
  body: body,
125
+ userAgent: client._options.userAgent,
124
126
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
125
127
  }, options);
126
128
  if (!requestRes.ok) {
@@ -105,6 +105,7 @@ async function $do(
105
105
  const requestSecurity = resolveGlobalSecurity(securityInput);
106
106
 
107
107
  const context = {
108
+ options: client._options,
108
109
  baseURL: options?.serverURL ?? client._baseURL ?? "",
109
110
  operationID: "get-order-detail",
110
111
  oAuth2Scopes: [],
@@ -125,6 +126,7 @@ async function $do(
125
126
  path: path,
126
127
  headers: headers,
127
128
  body: body,
129
+ userAgent: client._options.userAgent,
128
130
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
129
131
  }, options);
130
132
  if (!requestRes.ok) {
@@ -18,6 +18,7 @@ import {
18
18
  RequestTimeoutError,
19
19
  UnexpectedClientError,
20
20
  } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
21
22
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
23
  import * as operations from "../models/operations/index.js";
23
24
  import { APICall, APIPromise } from "../types/async.js";
@@ -36,6 +37,9 @@ export function ordersGetPaymentStatus(
36
37
  ): APIPromise<
37
38
  Result<
38
39
  operations.GetPaymentStatusResponseBody,
40
+ | errors.BadRequest
41
+ | errors.Unauthorized
42
+ | errors.NotFound
39
43
  | CeError
40
44
  | SDKValidationError
41
45
  | UnexpectedClientError
@@ -60,6 +64,9 @@ async function $do(
60
64
  [
61
65
  Result<
62
66
  operations.GetPaymentStatusResponseBody,
67
+ | errors.BadRequest
68
+ | errors.Unauthorized
69
+ | errors.NotFound
63
70
  | CeError
64
71
  | SDKValidationError
65
72
  | UnexpectedClientError
@@ -100,6 +107,7 @@ async function $do(
100
107
  const requestSecurity = resolveGlobalSecurity(securityInput);
101
108
 
102
109
  const context = {
110
+ options: client._options,
103
111
  baseURL: options?.serverURL ?? client._baseURL ?? "",
104
112
  operationID: "get-payment-status",
105
113
  oAuth2Scopes: [],
@@ -120,6 +128,7 @@ async function $do(
120
128
  path: path,
121
129
  headers: headers,
122
130
  body: body,
131
+ userAgent: client._options.userAgent,
123
132
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
124
133
  }, options);
125
134
  if (!requestRes.ok) {
@@ -129,7 +138,7 @@ async function $do(
129
138
 
130
139
  const doResult = await client._do(req, {
131
140
  context,
132
- errorCodes: ["4XX", "5XX"],
141
+ errorCodes: ["400", "401", "404", "4XX", "5XX"],
133
142
  retryConfig: context.retryConfig,
134
143
  retryCodes: context.retryCodes,
135
144
  });
@@ -138,8 +147,15 @@ async function $do(
138
147
  }
139
148
  const response = doResult.value;
140
149
 
150
+ const responseFields = {
151
+ HttpMeta: { Response: response, Request: req },
152
+ };
153
+
141
154
  const [result] = await M.match<
142
155
  operations.GetPaymentStatusResponseBody,
156
+ | errors.BadRequest
157
+ | errors.Unauthorized
158
+ | errors.NotFound
143
159
  | CeError
144
160
  | SDKValidationError
145
161
  | UnexpectedClientError
@@ -149,9 +165,12 @@ async function $do(
149
165
  | ConnectionError
150
166
  >(
151
167
  M.json(200, operations.GetPaymentStatusResponseBody$inboundSchema),
168
+ M.jsonErr(400, errors.BadRequest$inboundSchema),
169
+ M.jsonErr(401, errors.Unauthorized$inboundSchema),
170
+ M.jsonErr(404, errors.NotFound$inboundSchema),
152
171
  M.fail("4XX"),
153
172
  M.fail("5XX"),
154
- )(response);
173
+ )(response, { extraFields: responseFields });
155
174
  if (!result.ok) {
156
175
  return [result, { status: "complete", request: req, response }];
157
176
  }
@@ -105,6 +105,7 @@ async function $do(
105
105
  const requestSecurity = resolveGlobalSecurity(securityInput);
106
106
 
107
107
  const context = {
108
+ options: client._options,
108
109
  baseURL: options?.serverURL ?? client._baseURL ?? "",
109
110
  operationID: "list-order-shipments",
110
111
  oAuth2Scopes: [],
@@ -125,6 +126,7 @@ async function $do(
125
126
  path: path,
126
127
  headers: headers,
127
128
  body: body,
129
+ userAgent: client._options.userAgent,
128
130
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
129
131
  }, options);
130
132
  if (!requestRes.ok) {
@@ -101,6 +101,7 @@ async function $do(
101
101
  const requestSecurity = resolveGlobalSecurity(securityInput);
102
102
 
103
103
  const context = {
104
+ options: client._options,
104
105
  baseURL: options?.serverURL ?? client._baseURL ?? "",
105
106
  operationID: "list-orders",
106
107
  oAuth2Scopes: [],
@@ -122,6 +123,7 @@ async function $do(
122
123
  headers: headers,
123
124
  query: query,
124
125
  body: body,
126
+ userAgent: client._options.userAgent,
125
127
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
126
128
  }, options);
127
129
  if (!requestRes.ok) {
@@ -108,6 +108,7 @@ async function $do(
108
108
  const requestSecurity = resolveGlobalSecurity(securityInput);
109
109
 
110
110
  const context = {
111
+ options: client._options,
111
112
  baseURL: options?.serverURL ?? client._baseURL ?? "",
112
113
  operationID: "retry-order-payment",
113
114
  oAuth2Scopes: [],
@@ -128,6 +129,7 @@ async function $do(
128
129
  path: path,
129
130
  headers: headers,
130
131
  body: body,
132
+ userAgent: client._options.userAgent,
131
133
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
132
134
  }, options);
133
135
  if (!requestRes.ok) {
@@ -10,6 +10,7 @@ import { safeParse } from "../lib/schemas.js";
10
10
  import { RequestOptions } from "../lib/sdks.js";
11
11
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
12
  import { pathToFunc } from "../lib/url.js";
13
+ import * as components from "../models/components/index.js";
13
14
  import { CeError } from "../models/errors/ceerror.js";
14
15
  import {
15
16
  ConnectionError,
@@ -18,6 +19,7 @@ import {
18
19
  RequestTimeoutError,
19
20
  UnexpectedClientError,
20
21
  } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
21
23
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
24
  import * as operations from "../models/operations/index.js";
23
25
  import { APICall, APIPromise } from "../types/async.js";
@@ -31,11 +33,14 @@ import { Result } from "../types/fp.js";
31
33
  */
32
34
  export function shippingShippingMethods(
33
35
  client: CeStorefrontCore,
34
- request?: operations.GetShippingMethodsRequestBody | undefined,
36
+ request: components.CartBasedServiceabilityCheck,
35
37
  options?: RequestOptions,
36
38
  ): APIPromise<
37
39
  Result<
38
40
  operations.GetShippingMethodsResponseBody,
41
+ | errors.BadRequest
42
+ | errors.Unauthorized
43
+ | errors.NotFound
39
44
  | CeError
40
45
  | SDKValidationError
41
46
  | UnexpectedClientError
@@ -54,12 +59,15 @@ export function shippingShippingMethods(
54
59
 
55
60
  async function $do(
56
61
  client: CeStorefrontCore,
57
- request?: operations.GetShippingMethodsRequestBody | undefined,
62
+ request: components.CartBasedServiceabilityCheck,
58
63
  options?: RequestOptions,
59
64
  ): Promise<
60
65
  [
61
66
  Result<
62
67
  operations.GetShippingMethodsResponseBody,
68
+ | errors.BadRequest
69
+ | errors.Unauthorized
70
+ | errors.NotFound
63
71
  | CeError
64
72
  | SDKValidationError
65
73
  | UnexpectedClientError
@@ -74,18 +82,14 @@ async function $do(
74
82
  const parsed = safeParse(
75
83
  request,
76
84
  (value) =>
77
- operations.GetShippingMethodsRequestBody$outboundSchema.optional().parse(
78
- value,
79
- ),
85
+ components.CartBasedServiceabilityCheck$outboundSchema.parse(value),
80
86
  "Input validation failed",
81
87
  );
82
88
  if (!parsed.ok) {
83
89
  return [parsed, { status: "invalid" }];
84
90
  }
85
91
  const payload = parsed.value;
86
- const body = payload === undefined
87
- ? null
88
- : encodeJSON("body", payload, { explode: true });
92
+ const body = encodeJSON("body", payload, { explode: true });
89
93
 
90
94
  const path = pathToFunc("/shipping/shipping-methods")();
91
95
 
@@ -99,6 +103,7 @@ async function $do(
99
103
  const requestSecurity = resolveGlobalSecurity(securityInput);
100
104
 
101
105
  const context = {
106
+ options: client._options,
102
107
  baseURL: options?.serverURL ?? client._baseURL ?? "",
103
108
  operationID: "get-shipping-methods",
104
109
  oAuth2Scopes: [],
@@ -119,6 +124,7 @@ async function $do(
119
124
  path: path,
120
125
  headers: headers,
121
126
  body: body,
127
+ userAgent: client._options.userAgent,
122
128
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
123
129
  }, options);
124
130
  if (!requestRes.ok) {
@@ -128,7 +134,7 @@ async function $do(
128
134
 
129
135
  const doResult = await client._do(req, {
130
136
  context,
131
- errorCodes: ["4XX", "5XX"],
137
+ errorCodes: ["400", "401", "404", "4XX", "5XX"],
132
138
  retryConfig: context.retryConfig,
133
139
  retryCodes: context.retryCodes,
134
140
  });
@@ -137,8 +143,15 @@ async function $do(
137
143
  }
138
144
  const response = doResult.value;
139
145
 
146
+ const responseFields = {
147
+ HttpMeta: { Response: response, Request: req },
148
+ };
149
+
140
150
  const [result] = await M.match<
141
151
  operations.GetShippingMethodsResponseBody,
152
+ | errors.BadRequest
153
+ | errors.Unauthorized
154
+ | errors.NotFound
142
155
  | CeError
143
156
  | SDKValidationError
144
157
  | UnexpectedClientError
@@ -148,9 +161,12 @@ async function $do(
148
161
  | ConnectionError
149
162
  >(
150
163
  M.json(200, operations.GetShippingMethodsResponseBody$inboundSchema),
164
+ M.jsonErr(400, errors.BadRequest$inboundSchema),
165
+ M.jsonErr(401, errors.Unauthorized$inboundSchema),
166
+ M.jsonErr(404, errors.NotFound$inboundSchema),
151
167
  M.fail("4XX"),
152
168
  M.fail("5XX"),
153
- )(response);
169
+ )(response, { extraFields: responseFields });
154
170
  if (!result.ok) {
155
171
  return [result, { status: "complete", request: req, response }];
156
172
  }
@@ -2,6 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { SDKOptions } from "../lib/config.js";
5
6
  import { HTTPClient, RequestInput } from "../lib/http.js";
6
7
  import { RetryConfig } from "../lib/retries.js";
7
8
  import { SecurityState } from "../lib/security.js";
@@ -13,6 +14,7 @@ export type HookContext = {
13
14
  securitySource?: any | (() => Promise<any>);
14
15
  retryConfig: RetryConfig;
15
16
  resolvedSecurity: SecurityState | null;
17
+ options: SDKOptions;
16
18
  };
17
19
 
18
20
  export type Awaitable<T> = T | Promise<T>;
package/src/lib/config.ts CHANGED
@@ -41,6 +41,10 @@ export type SDKOptions = {
41
41
  * Allows overriding the default server URL used by the SDK
42
42
  */
43
43
  serverURL?: string | undefined;
44
+ /**
45
+ * Allows overriding the default user agent used by the SDK
46
+ */
47
+ userAgent?: string | undefined;
44
48
  /**
45
49
  * Allows overriding the default retry config used by the SDK
46
50
  */
@@ -76,7 +80,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
76
80
  export const SDK_METADATA = {
77
81
  language: "typescript",
78
82
  openapiDocVersion: "1.0",
79
- sdkVersion: "0.12.5",
80
- genVersion: "2.610.0",
81
- userAgent: "speakeasy-sdk/typescript 0.12.5 2.610.0 1.0 ce-storefront",
83
+ sdkVersion: "0.13.0",
84
+ genVersion: "2.616.1",
85
+ userAgent: "speakeasy-sdk/typescript 0.13.0 2.616.1 1.0 ce-storefront",
82
86
  } as const;
package/src/lib/sdks.ts CHANGED
@@ -64,6 +64,7 @@ type RequestConfig = {
64
64
  headers?: HeadersInit;
65
65
  security?: SecurityState | null;
66
66
  uaHeader?: string;
67
+ userAgent?: string | undefined;
67
68
  timeoutMs?: number;
68
69
  };
69
70
 
@@ -95,19 +96,21 @@ export class ClientSDK {
95
96
  } else {
96
97
  this.#hooks = new SDKHooks();
97
98
  }
98
- this._options = { ...options, hooks: this.#hooks };
99
-
100
99
  const url = serverURLFromOptions(options);
101
100
  if (url) {
102
101
  url.pathname = url.pathname.replace(/\/+$/, "") + "/";
103
102
  }
103
+
104
104
  const { baseURL, client } = this.#hooks.sdkInit({
105
105
  baseURL: url,
106
106
  client: options.httpClient || new HTTPClient(),
107
107
  });
108
108
  this._baseURL = baseURL;
109
109
  this.#httpClient = client;
110
- this.#logger = options.debugLogger;
110
+
111
+ this._options = { ...options, hooks: this.#hooks };
112
+
113
+ this.#logger = this._options.debugLogger;
111
114
  }
112
115
 
113
116
  public _createRequest(
@@ -180,7 +183,10 @@ export class ClientSDK {
180
183
  // Only set user agent header in non-browser-like environments since CORS
181
184
  // policy disallows setting it in browsers e.g. Chrome throws an error.
182
185
  if (!isBrowserLike) {
183
- headers.set(conf.uaHeader ?? "user-agent", SDK_METADATA.userAgent);
186
+ headers.set(
187
+ conf.uaHeader ?? "user-agent",
188
+ conf.userAgent ?? SDK_METADATA.userAgent,
189
+ );
184
190
  }
185
191
 
186
192
  const fetchOptions: Omit<RequestInit, "method" | "body"> = {