ce-storefront 0.0.2 → 0.0.5

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 (165) hide show
  1. package/README.md +50 -25
  2. package/docs/sdks/auth/README.md +75 -0
  3. package/docs/sdks/customers/README.md +1 -80
  4. package/docs/sdks/customersapi/README.md +322 -0
  5. package/funcs/authLoginAnonymously.d.ts +16 -0
  6. package/funcs/authLoginAnonymously.d.ts.map +1 -0
  7. package/funcs/authLoginAnonymously.js +88 -0
  8. package/funcs/authLoginAnonymously.js.map +1 -0
  9. package/funcs/{ordersReturnsList.d.ts → customersAPIGetCustomersId.d.ts} +4 -4
  10. package/funcs/customersAPIGetCustomersId.d.ts.map +1 -0
  11. package/funcs/{ordersReturnsList.js → customersAPIGetCustomersId.js} +10 -13
  12. package/funcs/customersAPIGetCustomersId.js.map +1 -0
  13. package/funcs/{customersGetRecommendedProducts.d.ts → customersAPIGetRecommendedProducts.d.ts} +3 -3
  14. package/funcs/customersAPIGetRecommendedProducts.d.ts.map +1 -0
  15. package/funcs/{customersGetRecommendedProducts.js → customersAPIGetRecommendedProducts.js} +20 -7
  16. package/funcs/customersAPIGetRecommendedProducts.js.map +1 -0
  17. package/funcs/customersAPIPostCustomers.d.ts +17 -0
  18. package/funcs/customersAPIPostCustomers.d.ts.map +1 -0
  19. package/funcs/customersAPIPostCustomers.js +96 -0
  20. package/funcs/customersAPIPostCustomers.js.map +1 -0
  21. package/funcs/customersAPIPutCustomersId.d.ts +16 -0
  22. package/funcs/customersAPIPutCustomersId.d.ts.map +1 -0
  23. package/funcs/customersAPIPutCustomersId.js +98 -0
  24. package/funcs/customersAPIPutCustomersId.js.map +1 -0
  25. package/lib/config.d.ts +2 -2
  26. package/lib/config.js +2 -2
  27. package/models/components/business.d.ts +31 -0
  28. package/models/components/business.d.ts.map +1 -0
  29. package/models/components/business.js +71 -0
  30. package/models/components/business.js.map +1 -0
  31. package/models/components/cart.d.ts +1 -1
  32. package/models/components/cart.d.ts.map +1 -1
  33. package/models/components/cart.js +5 -5
  34. package/models/components/cart.js.map +1 -1
  35. package/models/components/createcustomer.d.ts +29 -0
  36. package/models/components/createcustomer.d.ts.map +1 -0
  37. package/models/components/createcustomer.js +54 -0
  38. package/models/components/createcustomer.js.map +1 -0
  39. package/models/components/{customeraddress.d.ts → customeraddressinput.d.ts} +29 -29
  40. package/models/components/customeraddressinput.d.ts.map +1 -0
  41. package/models/components/{customeraddress.js → customeraddressinput.js} +30 -30
  42. package/models/components/customeraddressinput.js.map +1 -0
  43. package/models/components/customerdetail.d.ts +51 -0
  44. package/models/components/customerdetail.d.ts.map +1 -0
  45. package/models/components/customerdetail.js +88 -0
  46. package/models/components/customerdetail.js.map +1 -0
  47. package/models/components/index.d.ts +6 -3
  48. package/models/components/index.d.ts.map +1 -1
  49. package/models/components/index.js +6 -3
  50. package/models/components/index.js.map +1 -1
  51. package/models/components/orderdetail.d.ts +1 -1
  52. package/models/components/orderdetail.d.ts.map +1 -1
  53. package/models/components/orderdetail.js +5 -5
  54. package/models/components/orderdetail.js.map +1 -1
  55. package/models/components/recommendedproduct.d.ts +149 -0
  56. package/models/components/recommendedproduct.d.ts.map +1 -0
  57. package/models/components/recommendedproduct.js +230 -0
  58. package/models/components/recommendedproduct.js.map +1 -0
  59. package/models/components/updatecustomer.d.ts +26 -0
  60. package/models/components/updatecustomer.d.ts.map +1 -0
  61. package/models/components/updatecustomer.js +51 -0
  62. package/models/components/updatecustomer.js.map +1 -0
  63. package/models/operations/getcustomersid.d.ts +82 -0
  64. package/models/operations/getcustomersid.d.ts.map +1 -0
  65. package/models/operations/getcustomersid.js +106 -0
  66. package/models/operations/getcustomersid.js.map +1 -0
  67. package/models/operations/getrecommendedproducts.d.ts +82 -0
  68. package/models/operations/getrecommendedproducts.d.ts.map +1 -0
  69. package/models/operations/getrecommendedproducts.js +93 -0
  70. package/models/operations/getrecommendedproducts.js.map +1 -0
  71. package/models/operations/index.d.ts +5 -2
  72. package/models/operations/index.d.ts.map +1 -1
  73. package/models/operations/index.js +5 -2
  74. package/models/operations/index.js.map +1 -1
  75. package/models/operations/postauthanonymous.d.ts +101 -0
  76. package/models/operations/postauthanonymous.d.ts.map +1 -0
  77. package/models/operations/postauthanonymous.js +124 -0
  78. package/models/operations/postauthanonymous.js.map +1 -0
  79. package/models/operations/postcustomers.d.ts +56 -0
  80. package/models/operations/postcustomers.d.ts.map +1 -0
  81. package/models/operations/postcustomers.js +87 -0
  82. package/models/operations/postcustomers.js.map +1 -0
  83. package/models/operations/putcustomersid.d.ts +84 -0
  84. package/models/operations/putcustomersid.d.ts.map +1 -0
  85. package/models/operations/putcustomersid.js +120 -0
  86. package/models/operations/putcustomersid.js.map +1 -0
  87. package/package.json +1 -1
  88. package/sdk/auth.d.ts +8 -0
  89. package/sdk/auth.d.ts.map +1 -1
  90. package/sdk/auth.js +11 -0
  91. package/sdk/auth.js.map +1 -1
  92. package/sdk/customers.d.ts +1 -9
  93. package/sdk/customers.d.ts.map +1 -1
  94. package/sdk/customers.js +0 -11
  95. package/sdk/customers.js.map +1 -1
  96. package/sdk/customersapi.d.ts +34 -0
  97. package/sdk/customersapi.d.ts.map +1 -0
  98. package/sdk/customersapi.js +52 -0
  99. package/sdk/customersapi.js.map +1 -0
  100. package/sdk/orders.d.ts +0 -3
  101. package/sdk/orders.d.ts.map +1 -1
  102. package/sdk/orders.js +0 -5
  103. package/sdk/orders.js.map +1 -1
  104. package/sdk/sdk.d.ts +5 -2
  105. package/sdk/sdk.d.ts.map +1 -1
  106. package/sdk/sdk.js +7 -2
  107. package/sdk/sdk.js.map +1 -1
  108. package/src/funcs/authLoginAnonymously.ts +112 -0
  109. package/src/funcs/{ordersReturnsList.ts → customersAPIGetCustomersId.ts} +11 -14
  110. package/src/funcs/{customersGetRecommendedProducts.ts → customersAPIGetRecommendedProducts.ts} +28 -7
  111. package/src/funcs/customersAPIPostCustomers.ts +133 -0
  112. package/src/funcs/customersAPIPutCustomersId.ts +136 -0
  113. package/src/lib/config.ts +2 -2
  114. package/src/models/components/business.ts +64 -0
  115. package/src/models/components/cart.ts +1 -1
  116. package/src/models/components/createcustomer.ts +58 -0
  117. package/src/models/components/customerdetail.ts +109 -0
  118. package/src/models/components/index.ts +6 -3
  119. package/src/models/components/orderdetail.ts +1 -1
  120. package/src/models/components/recommendedproduct.ts +359 -0
  121. package/src/models/components/updatecustomer.ts +48 -0
  122. package/src/models/operations/getcustomersid.ts +153 -0
  123. package/src/models/operations/getrecommendedproducts.ts +140 -0
  124. package/src/models/operations/index.ts +5 -2
  125. package/src/models/operations/postauthanonymous.ts +190 -0
  126. package/src/models/operations/postcustomers.ts +110 -0
  127. package/src/models/operations/putcustomersid.ts +169 -0
  128. package/src/sdk/auth.ts +15 -0
  129. package/src/sdk/customers.ts +1 -16
  130. package/src/sdk/customersapi.ts +66 -0
  131. package/src/sdk/orders.ts +0 -6
  132. package/src/sdk/sdk.ts +9 -3
  133. package/docs/sdks/returns/README.md +0 -84
  134. package/funcs/customersGetRecommendedProducts.d.ts.map +0 -1
  135. package/funcs/customersGetRecommendedProducts.js.map +0 -1
  136. package/funcs/ordersReturnsList.d.ts.map +0 -1
  137. package/funcs/ordersReturnsList.js.map +0 -1
  138. package/models/components/customeraddress.d.ts.map +0 -1
  139. package/models/components/customeraddress.js.map +0 -1
  140. package/models/components/orderreturn.d.ts +0 -59
  141. package/models/components/orderreturn.d.ts.map +0 -1
  142. package/models/components/orderreturn.js +0 -165
  143. package/models/components/orderreturn.js.map +0 -1
  144. package/models/components/orderreturnitem.d.ts +0 -91
  145. package/models/components/orderreturnitem.d.ts.map +0 -1
  146. package/models/components/orderreturnitem.js +0 -130
  147. package/models/components/orderreturnitem.js.map +0 -1
  148. package/models/operations/getordersordernumberreturn.d.ts +0 -59
  149. package/models/operations/getordersordernumberreturn.d.ts.map +0 -1
  150. package/models/operations/getordersordernumberreturn.js +0 -99
  151. package/models/operations/getordersordernumberreturn.js.map +0 -1
  152. package/models/operations/getrecommended.d.ts +0 -56
  153. package/models/operations/getrecommended.d.ts.map +0 -1
  154. package/models/operations/getrecommended.js +0 -74
  155. package/models/operations/getrecommended.js.map +0 -1
  156. package/sdk/returns.d.ts +0 -12
  157. package/sdk/returns.d.ts.map +0 -1
  158. package/sdk/returns.js +0 -22
  159. package/sdk/returns.js.map +0 -1
  160. package/src/models/components/orderreturn.ts +0 -198
  161. package/src/models/components/orderreturnitem.ts +0 -152
  162. package/src/models/operations/getordersordernumberreturn.ts +0 -125
  163. package/src/models/operations/getrecommended.ts +0 -97
  164. package/src/sdk/returns.ts +0 -23
  165. package/src/models/components/{customeraddress.ts → customeraddressinput.ts} +46 -46
@@ -0,0 +1,112 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { CeStorefrontCore } from "../core.js";
6
+ import * as m$ from "../lib/matchers.js";
7
+ import { RequestOptions } from "../lib/sdks.js";
8
+ import { resolveSecurity, SecurityInput } from "../lib/security.js";
9
+ import { pathToFunc } from "../lib/url.js";
10
+ import {
11
+ ConnectionError,
12
+ InvalidRequestError,
13
+ RequestAbortedError,
14
+ RequestTimeoutError,
15
+ UnexpectedClientError,
16
+ } from "../models/errors/httpclienterrors.js";
17
+ import { SDKError } from "../models/errors/sdkerror.js";
18
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
19
+ import * as operations from "../models/operations/index.js";
20
+ import { Result } from "../types/fp.js";
21
+
22
+ /**
23
+ * Anonymous user
24
+ *
25
+ * @remarks
26
+ * This API’s focus is on anonymous users who have not undergone the formal account creation process. These anonymous users are associated with a unique identifier called a ULID, ensuring that even in the absence of a fully realized account, there is a distinct and trackable identity for each user.
27
+ * To interact with the system, each anonymous user is issued an access token. This access token plays a dual role in the system: it serves as a means of authenticating the user and it also acts as a tool for authorization, determining what actions the authenticated user is permitted to perform.
28
+ */
29
+ export async function authLoginAnonymously(
30
+ client$: CeStorefrontCore,
31
+ security: operations.PostAuthAnonymousSecurity,
32
+ options?: RequestOptions
33
+ ): Promise<
34
+ Result<
35
+ operations.PostAuthAnonymousResponseBody,
36
+ | SDKError
37
+ | SDKValidationError
38
+ | UnexpectedClientError
39
+ | InvalidRequestError
40
+ | RequestAbortedError
41
+ | RequestTimeoutError
42
+ | ConnectionError
43
+ >
44
+ > {
45
+ const path$ = pathToFunc("/auth/anonymous")();
46
+
47
+ const headers$ = new Headers({
48
+ Accept: "application/json",
49
+ });
50
+
51
+ const security$: SecurityInput[][] = [
52
+ [
53
+ {
54
+ fieldName: "X-Api-Key",
55
+ type: "apiKey:header",
56
+ value: security?.xApiKey,
57
+ },
58
+ ],
59
+ ];
60
+ const securitySettings$ = resolveSecurity(...security$);
61
+ const context = {
62
+ operationID: "post-auth-anonymous",
63
+ oAuth2Scopes: [],
64
+ securitySource: security$,
65
+ };
66
+
67
+ const requestRes = client$.createRequest$(
68
+ context,
69
+ {
70
+ security: securitySettings$,
71
+ method: "POST",
72
+ path: path$,
73
+ headers: headers$,
74
+ timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1,
75
+ },
76
+ options
77
+ );
78
+ if (!requestRes.ok) {
79
+ return requestRes;
80
+ }
81
+ const request$ = requestRes.value;
82
+
83
+ const doResult = await client$.do$(request$, {
84
+ context,
85
+ errorCodes: ["4XX", "5XX"],
86
+ retryConfig: options?.retries || client$.options$.retryConfig,
87
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
88
+ });
89
+ if (!doResult.ok) {
90
+ return doResult;
91
+ }
92
+ const response = doResult.value;
93
+
94
+ const [result$] = await m$.match<
95
+ operations.PostAuthAnonymousResponseBody,
96
+ | SDKError
97
+ | SDKValidationError
98
+ | UnexpectedClientError
99
+ | InvalidRequestError
100
+ | RequestAbortedError
101
+ | RequestTimeoutError
102
+ | ConnectionError
103
+ >(
104
+ m$.json(200, operations.PostAuthAnonymousResponseBody$inboundSchema),
105
+ m$.fail(["4XX", "5XX"])
106
+ )(response);
107
+ if (!result$.ok) {
108
+ return result$;
109
+ }
110
+
111
+ return result$;
112
+ }
@@ -22,18 +22,18 @@ import * as operations from "../models/operations/index.js";
22
22
  import { Result } from "../types/fp.js";
23
23
 
24
24
  /**
25
- * List all order returns
25
+ * Retrieve customer detail
26
26
  *
27
27
  * @remarks
28
- * List all order returns
28
+ * Retrieve customer detail.
29
29
  */
30
- export async function ordersReturnsList(
30
+ export async function customersAPIGetCustomersId(
31
31
  client$: CeStorefrontCore,
32
- request: operations.GetOrdersOrderNumberReturnRequest,
32
+ request: operations.GetCustomersIdRequest,
33
33
  options?: RequestOptions
34
34
  ): Promise<
35
35
  Result<
36
- operations.GetOrdersOrderNumberReturnResponseBody,
36
+ operations.GetCustomersIdResponseBody,
37
37
  | SDKError
38
38
  | SDKValidationError
39
39
  | UnexpectedClientError
@@ -47,7 +47,7 @@ export async function ordersReturnsList(
47
47
 
48
48
  const parsed$ = schemas$.safeParse(
49
49
  input$,
50
- (value$) => operations.GetOrdersOrderNumberReturnRequest$outboundSchema.parse(value$),
50
+ (value$) => operations.GetCustomersIdRequest$outboundSchema.parse(value$),
51
51
  "Input validation failed"
52
52
  );
53
53
  if (!parsed$.ok) {
@@ -57,13 +57,10 @@ export async function ordersReturnsList(
57
57
  const body$ = null;
58
58
 
59
59
  const pathParams$ = {
60
- order_number: encodeSimple$("order_number", payload$.order_number, {
61
- explode: false,
62
- charEncoding: "percent",
63
- }),
60
+ id: encodeSimple$("id", payload$.id, { explode: false, charEncoding: "percent" }),
64
61
  };
65
62
 
66
- const path$ = pathToFunc("/orders/{order_number}/return")(pathParams$);
63
+ const path$ = pathToFunc("/customers/{id}")(pathParams$);
67
64
 
68
65
  const headers$ = new Headers({
69
66
  Accept: "application/json",
@@ -72,7 +69,7 @@ export async function ordersReturnsList(
72
69
  const authorization$ = await extractSecurity(client$.options$.authorization);
73
70
  const security$ = authorization$ == null ? {} : { authorization: authorization$ };
74
71
  const context = {
75
- operationID: "get-orders-order_number-return",
72
+ operationID: "get-customers-id",
76
73
  oAuth2Scopes: [],
77
74
  securitySource: client$.options$.authorization,
78
75
  };
@@ -107,7 +104,7 @@ export async function ordersReturnsList(
107
104
  const response = doResult.value;
108
105
 
109
106
  const [result$] = await m$.match<
110
- operations.GetOrdersOrderNumberReturnResponseBody,
107
+ operations.GetCustomersIdResponseBody,
111
108
  | SDKError
112
109
  | SDKValidationError
113
110
  | UnexpectedClientError
@@ -116,7 +113,7 @@ export async function ordersReturnsList(
116
113
  | RequestTimeoutError
117
114
  | ConnectionError
118
115
  >(
119
- m$.json(200, operations.GetOrdersOrderNumberReturnResponseBody$inboundSchema),
116
+ m$.json(200, operations.GetCustomersIdResponseBody$inboundSchema),
120
117
  m$.fail(["4XX", "5XX"])
121
118
  )(response);
122
119
  if (!result$.ok) {
@@ -3,7 +3,9 @@
3
3
  */
4
4
 
5
5
  import { CeStorefrontCore } from "../core.js";
6
+ import { encodeSimple as encodeSimple$ } from "../lib/encodings.js";
6
7
  import * as m$ from "../lib/matchers.js";
8
+ import * as schemas$ from "../lib/schemas.js";
7
9
  import { RequestOptions } from "../lib/sdks.js";
8
10
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
9
11
  import { pathToFunc } from "../lib/url.js";
@@ -21,17 +23,18 @@ import * as operations from "../models/operations/index.js";
21
23
  import { Result } from "../types/fp.js";
22
24
 
23
25
  /**
24
- * Retrieve recommended products
26
+ * List all recommended products
25
27
  *
26
28
  * @remarks
27
29
  * Retrieves a list of recommended products for a specified user based on their browsing history, past purchases, and indicated preferences. The recommended products are returned sorted by relevance, providing a personalized shopping experience for each user.
28
30
  */
29
- export async function customersGetRecommendedProducts(
31
+ export async function customersAPIGetRecommendedProducts(
30
32
  client$: CeStorefrontCore,
33
+ request: operations.GetRecommendedProductsRequest,
31
34
  options?: RequestOptions
32
35
  ): Promise<
33
36
  Result<
34
- operations.GetRecommendedResponseBody,
37
+ operations.GetRecommendedProductsResponseBody,
35
38
  | errors.Unauthorized
36
39
  | errors.NotFound
37
40
  | SDKError
@@ -43,7 +46,24 @@ export async function customersGetRecommendedProducts(
43
46
  | ConnectionError
44
47
  >
45
48
  > {
46
- const path$ = pathToFunc("/catalog/products/recommended")();
49
+ const input$ = request;
50
+
51
+ const parsed$ = schemas$.safeParse(
52
+ input$,
53
+ (value$) => operations.GetRecommendedProductsRequest$outboundSchema.parse(value$),
54
+ "Input validation failed"
55
+ );
56
+ if (!parsed$.ok) {
57
+ return parsed$;
58
+ }
59
+ const payload$ = parsed$.value;
60
+ const body$ = null;
61
+
62
+ const pathParams$ = {
63
+ id: encodeSimple$("id", payload$.id, { explode: false, charEncoding: "percent" }),
64
+ };
65
+
66
+ const path$ = pathToFunc("/customer/{id}/recommended-products")(pathParams$);
47
67
 
48
68
  const headers$ = new Headers({
49
69
  Accept: "application/json",
@@ -52,7 +72,7 @@ export async function customersGetRecommendedProducts(
52
72
  const authorization$ = await extractSecurity(client$.options$.authorization);
53
73
  const security$ = authorization$ == null ? {} : { authorization: authorization$ };
54
74
  const context = {
55
- operationID: "get-recommended",
75
+ operationID: "get-recommended-products",
56
76
  oAuth2Scopes: [],
57
77
  securitySource: client$.options$.authorization,
58
78
  };
@@ -65,6 +85,7 @@ export async function customersGetRecommendedProducts(
65
85
  method: "GET",
66
86
  path: path$,
67
87
  headers: headers$,
88
+ body: body$,
68
89
  timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1,
69
90
  },
70
91
  options
@@ -90,7 +111,7 @@ export async function customersGetRecommendedProducts(
90
111
  };
91
112
 
92
113
  const [result$] = await m$.match<
93
- operations.GetRecommendedResponseBody,
114
+ operations.GetRecommendedProductsResponseBody,
94
115
  | errors.Unauthorized
95
116
  | errors.NotFound
96
117
  | SDKError
@@ -101,7 +122,7 @@ export async function customersGetRecommendedProducts(
101
122
  | RequestTimeoutError
102
123
  | ConnectionError
103
124
  >(
104
- m$.json(200, operations.GetRecommendedResponseBody$inboundSchema),
125
+ m$.json(200, operations.GetRecommendedProductsResponseBody$inboundSchema),
105
126
  m$.jsonErr(401, errors.Unauthorized$inboundSchema),
106
127
  m$.jsonErr(404, errors.NotFound$inboundSchema),
107
128
  m$.fail(["4XX", "5XX"])
@@ -0,0 +1,133 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { CeStorefrontCore } from "../core.js";
6
+ import { encodeJSON as encodeJSON$ } from "../lib/encodings.js";
7
+ import * as m$ from "../lib/matchers.js";
8
+ import * as schemas$ from "../lib/schemas.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import * as components from "../models/components/index.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import * as errors from "../models/errors/index.js";
21
+ import { SDKError } from "../models/errors/sdkerror.js";
22
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
+ import * as operations from "../models/operations/index.js";
24
+ import { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * Create customer
28
+ *
29
+ * @remarks
30
+ * Create customer
31
+ */
32
+ export async function customersAPIPostCustomers(
33
+ client$: CeStorefrontCore,
34
+ request?: components.CreateCustomer | undefined,
35
+ options?: RequestOptions
36
+ ): Promise<
37
+ Result<
38
+ operations.PostCustomersResponseBody,
39
+ | errors.BadRequest
40
+ | errors.Unauthorized
41
+ | SDKError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ const input$ = request;
51
+
52
+ const parsed$ = schemas$.safeParse(
53
+ input$,
54
+ (value$) => components.CreateCustomer$outboundSchema.optional().parse(value$),
55
+ "Input validation failed"
56
+ );
57
+ if (!parsed$.ok) {
58
+ return parsed$;
59
+ }
60
+ const payload$ = parsed$.value;
61
+ const body$ = payload$ === undefined ? null : encodeJSON$("body", payload$, { explode: true });
62
+
63
+ const path$ = pathToFunc("/customers")();
64
+
65
+ const headers$ = new Headers({
66
+ "Content-Type": "application/json",
67
+ Accept: "application/json",
68
+ });
69
+
70
+ const authorization$ = await extractSecurity(client$.options$.authorization);
71
+ const security$ = authorization$ == null ? {} : { authorization: authorization$ };
72
+ const context = {
73
+ operationID: "post-customers",
74
+ oAuth2Scopes: [],
75
+ securitySource: client$.options$.authorization,
76
+ };
77
+ const securitySettings$ = resolveGlobalSecurity(security$);
78
+
79
+ const requestRes = client$.createRequest$(
80
+ context,
81
+ {
82
+ security: securitySettings$,
83
+ method: "POST",
84
+ path: path$,
85
+ headers: headers$,
86
+ body: body$,
87
+ timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1,
88
+ },
89
+ options
90
+ );
91
+ if (!requestRes.ok) {
92
+ return requestRes;
93
+ }
94
+ const request$ = requestRes.value;
95
+
96
+ const doResult = await client$.do$(request$, {
97
+ context,
98
+ errorCodes: ["400", "401", "4XX", "5XX"],
99
+ retryConfig: options?.retries || client$.options$.retryConfig,
100
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
101
+ });
102
+ if (!doResult.ok) {
103
+ return doResult;
104
+ }
105
+ const response = doResult.value;
106
+
107
+ const responseFields$ = {
108
+ HttpMeta: { Response: response, Request: request$ },
109
+ };
110
+
111
+ const [result$] = await m$.match<
112
+ operations.PostCustomersResponseBody,
113
+ | errors.BadRequest
114
+ | errors.Unauthorized
115
+ | SDKError
116
+ | SDKValidationError
117
+ | UnexpectedClientError
118
+ | InvalidRequestError
119
+ | RequestAbortedError
120
+ | RequestTimeoutError
121
+ | ConnectionError
122
+ >(
123
+ m$.json(200, operations.PostCustomersResponseBody$inboundSchema),
124
+ m$.jsonErr(400, errors.BadRequest$inboundSchema),
125
+ m$.jsonErr(401, errors.Unauthorized$inboundSchema),
126
+ m$.fail(["4XX", "5XX"])
127
+ )(response, { extraFields: responseFields$ });
128
+ if (!result$.ok) {
129
+ return result$;
130
+ }
131
+
132
+ return result$;
133
+ }
@@ -0,0 +1,136 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { CeStorefrontCore } from "../core.js";
6
+ import { encodeJSON as encodeJSON$, encodeSimple as encodeSimple$ } from "../lib/encodings.js";
7
+ import * as m$ from "../lib/matchers.js";
8
+ import * as schemas$ from "../lib/schemas.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import {
13
+ ConnectionError,
14
+ InvalidRequestError,
15
+ RequestAbortedError,
16
+ RequestTimeoutError,
17
+ UnexpectedClientError,
18
+ } from "../models/errors/httpclienterrors.js";
19
+ import * as errors from "../models/errors/index.js";
20
+ import { SDKError } from "../models/errors/sdkerror.js";
21
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
+ import * as operations from "../models/operations/index.js";
23
+ import { Result } from "../types/fp.js";
24
+
25
+ /**
26
+ * Update customer detail
27
+ *
28
+ * @remarks
29
+ * Update customer detail
30
+ */
31
+ export async function customersAPIPutCustomersId(
32
+ client$: CeStorefrontCore,
33
+ request: operations.PutCustomersIdRequest,
34
+ options?: RequestOptions
35
+ ): Promise<
36
+ Result<
37
+ operations.PutCustomersIdResponseBody,
38
+ | errors.BadRequest
39
+ | errors.Unauthorized
40
+ | SDKError
41
+ | SDKValidationError
42
+ | UnexpectedClientError
43
+ | InvalidRequestError
44
+ | RequestAbortedError
45
+ | RequestTimeoutError
46
+ | ConnectionError
47
+ >
48
+ > {
49
+ const input$ = request;
50
+
51
+ const parsed$ = schemas$.safeParse(
52
+ input$,
53
+ (value$) => operations.PutCustomersIdRequest$outboundSchema.parse(value$),
54
+ "Input validation failed"
55
+ );
56
+ if (!parsed$.ok) {
57
+ return parsed$;
58
+ }
59
+ const payload$ = parsed$.value;
60
+ const body$ = encodeJSON$("body", payload$.UpdateCustomer, { explode: true });
61
+
62
+ const pathParams$ = {
63
+ id: encodeSimple$("id", payload$.id, { explode: false, charEncoding: "percent" }),
64
+ };
65
+
66
+ const path$ = pathToFunc("/customers/{id}")(pathParams$);
67
+
68
+ const headers$ = new Headers({
69
+ "Content-Type": "application/json",
70
+ Accept: "application/json",
71
+ });
72
+
73
+ const authorization$ = await extractSecurity(client$.options$.authorization);
74
+ const security$ = authorization$ == null ? {} : { authorization: authorization$ };
75
+ const context = {
76
+ operationID: "put-customers-id",
77
+ oAuth2Scopes: [],
78
+ securitySource: client$.options$.authorization,
79
+ };
80
+ const securitySettings$ = resolveGlobalSecurity(security$);
81
+
82
+ const requestRes = client$.createRequest$(
83
+ context,
84
+ {
85
+ security: securitySettings$,
86
+ method: "PUT",
87
+ path: path$,
88
+ headers: headers$,
89
+ body: body$,
90
+ timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1,
91
+ },
92
+ options
93
+ );
94
+ if (!requestRes.ok) {
95
+ return requestRes;
96
+ }
97
+ const request$ = requestRes.value;
98
+
99
+ const doResult = await client$.do$(request$, {
100
+ context,
101
+ errorCodes: ["400", "401", "4XX", "5XX"],
102
+ retryConfig: options?.retries || client$.options$.retryConfig,
103
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
104
+ });
105
+ if (!doResult.ok) {
106
+ return doResult;
107
+ }
108
+ const response = doResult.value;
109
+
110
+ const responseFields$ = {
111
+ HttpMeta: { Response: response, Request: request$ },
112
+ };
113
+
114
+ const [result$] = await m$.match<
115
+ operations.PutCustomersIdResponseBody,
116
+ | errors.BadRequest
117
+ | errors.Unauthorized
118
+ | SDKError
119
+ | SDKValidationError
120
+ | UnexpectedClientError
121
+ | InvalidRequestError
122
+ | RequestAbortedError
123
+ | RequestTimeoutError
124
+ | ConnectionError
125
+ >(
126
+ m$.json(200, operations.PutCustomersIdResponseBody$inboundSchema),
127
+ m$.jsonErr(400, errors.BadRequest$inboundSchema),
128
+ m$.jsonErr(401, errors.Unauthorized$inboundSchema),
129
+ m$.fail(["4XX", "5XX"])
130
+ )(response, { extraFields: responseFields$ });
131
+ if (!result$.ok) {
132
+ return result$;
133
+ }
134
+
135
+ return result$;
136
+ }
package/src/lib/config.ts CHANGED
@@ -74,7 +74,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
74
74
  export const SDK_METADATA = {
75
75
  language: "typescript",
76
76
  openapiDocVersion: "1.0",
77
- sdkVersion: "0.0.2",
77
+ sdkVersion: "0.0.5",
78
78
  genVersion: "2.404.3",
79
- userAgent: "speakeasy-sdk/typescript 0.0.2 2.404.3 1.0 ce-storefront",
79
+ userAgent: "speakeasy-sdk/typescript 0.0.5 2.404.3 1.0 ce-storefront",
80
80
  } as const;
@@ -0,0 +1,64 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { remap as remap$ } from "../../lib/primitives.js";
6
+ import * as z from "zod";
7
+
8
+ export type Business = {
9
+ businessType: string;
10
+ name: string;
11
+ panNumber: string;
12
+ gstin?: string | null | undefined;
13
+ };
14
+
15
+ /** @internal */
16
+ export const Business$inboundSchema: z.ZodType<Business, z.ZodTypeDef, unknown> = z
17
+ .object({
18
+ business_type: z.string(),
19
+ name: z.string(),
20
+ pan_number: z.string(),
21
+ gstin: z.nullable(z.string()).optional(),
22
+ })
23
+ .transform((v) => {
24
+ return remap$(v, {
25
+ business_type: "businessType",
26
+ pan_number: "panNumber",
27
+ });
28
+ });
29
+
30
+ /** @internal */
31
+ export type Business$Outbound = {
32
+ business_type: string;
33
+ name: string;
34
+ pan_number: string;
35
+ gstin?: string | null | undefined;
36
+ };
37
+
38
+ /** @internal */
39
+ export const Business$outboundSchema: z.ZodType<Business$Outbound, z.ZodTypeDef, Business> = z
40
+ .object({
41
+ businessType: z.string(),
42
+ name: z.string(),
43
+ panNumber: z.string(),
44
+ gstin: z.nullable(z.string()).optional(),
45
+ })
46
+ .transform((v) => {
47
+ return remap$(v, {
48
+ businessType: "business_type",
49
+ panNumber: "pan_number",
50
+ });
51
+ });
52
+
53
+ /**
54
+ * @internal
55
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
56
+ */
57
+ export namespace Business$ {
58
+ /** @deprecated use `Business$inboundSchema` instead. */
59
+ export const inboundSchema = Business$inboundSchema;
60
+ /** @deprecated use `Business$outboundSchema` instead. */
61
+ export const outboundSchema = Business$outboundSchema;
62
+ /** @deprecated use `Business$Outbound` instead. */
63
+ export type Outbound = Business$Outbound;
64
+ }
@@ -20,7 +20,7 @@ import {
20
20
  CustomerAddress$inboundSchema,
21
21
  CustomerAddress$Outbound,
22
22
  CustomerAddress$outboundSchema,
23
- } from "./customeraddress.js";
23
+ } from "./customeraddressinput.js";
24
24
  import * as z from "zod";
25
25
 
26
26
  export type CartMetadata = {};
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ Business,
7
+ Business$inboundSchema,
8
+ Business$Outbound,
9
+ Business$outboundSchema,
10
+ } from "./business.js";
11
+ import {
12
+ CustomerAddressInput,
13
+ CustomerAddressInput$inboundSchema,
14
+ CustomerAddressInput$Outbound,
15
+ CustomerAddressInput$outboundSchema,
16
+ } from "./customeraddressinput.js";
17
+ import * as z from "zod";
18
+
19
+ export type CreateCustomer = {
20
+ business?: Business | undefined;
21
+ address?: CustomerAddressInput | null | undefined;
22
+ };
23
+
24
+ /** @internal */
25
+ export const CreateCustomer$inboundSchema: z.ZodType<CreateCustomer, z.ZodTypeDef, unknown> =
26
+ z.object({
27
+ business: Business$inboundSchema.optional(),
28
+ address: z.nullable(CustomerAddressInput$inboundSchema).optional(),
29
+ });
30
+
31
+ /** @internal */
32
+ export type CreateCustomer$Outbound = {
33
+ business?: Business$Outbound | undefined;
34
+ address?: CustomerAddressInput$Outbound | null | undefined;
35
+ };
36
+
37
+ /** @internal */
38
+ export const CreateCustomer$outboundSchema: z.ZodType<
39
+ CreateCustomer$Outbound,
40
+ z.ZodTypeDef,
41
+ CreateCustomer
42
+ > = z.object({
43
+ business: Business$outboundSchema.optional(),
44
+ address: z.nullable(CustomerAddressInput$outboundSchema).optional(),
45
+ });
46
+
47
+ /**
48
+ * @internal
49
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
50
+ */
51
+ export namespace CreateCustomer$ {
52
+ /** @deprecated use `CreateCustomer$inboundSchema` instead. */
53
+ export const inboundSchema = CreateCustomer$inboundSchema;
54
+ /** @deprecated use `CreateCustomer$outboundSchema` instead. */
55
+ export const outboundSchema = CreateCustomer$outboundSchema;
56
+ /** @deprecated use `CreateCustomer$Outbound` instead. */
57
+ export type Outbound = CreateCustomer$Outbound;
58
+ }