flexprice-sdk-test 1.0.49 → 1.0.52

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 (185) hide show
  1. package/README.md +31 -449
  2. package/examples/node_modules/.package-lock.json +1 -1
  3. package/examples/package-lock.json +1 -1
  4. package/funcs/{customerDashboardPostCustomerDashboardCostAnalytics.d.ts → customerPortalGetPortalExternalId.d.ts} +4 -5
  5. package/funcs/customerPortalGetPortalExternalId.d.ts.map +1 -0
  6. package/funcs/{customerDashboardGetCustomerDashboardWalletsId.js → customerPortalGetPortalExternalId.js} +18 -22
  7. package/funcs/customerPortalGetPortalExternalId.js.map +1 -0
  8. package/jsr.json +1 -1
  9. package/lib/config.d.ts +2 -2
  10. package/lib/config.js +2 -2
  11. package/models/components/dtoportalsessionresponse.d.ts +12 -0
  12. package/models/components/dtoportalsessionresponse.d.ts.map +1 -0
  13. package/models/components/{dtodashboardsessionresponse.js → dtoportalsessionresponse.js} +6 -6
  14. package/models/components/dtoportalsessionresponse.js.map +1 -0
  15. package/models/components/index.d.ts +1 -4
  16. package/models/components/index.d.ts.map +1 -1
  17. package/models/components/index.js +1 -4
  18. package/models/components/index.js.map +1 -1
  19. package/models/components/security.d.ts +2 -2
  20. package/models/components/security.d.ts.map +1 -1
  21. package/models/components/security.js +1 -1
  22. package/models/components/security.js.map +1 -1
  23. package/models/operations/getportalexternalid.d.ts +15 -0
  24. package/models/operations/getportalexternalid.d.ts.map +1 -0
  25. package/models/operations/{putcustomerdashboardinfo.js → getportalexternalid.js} +8 -8
  26. package/models/operations/getportalexternalid.js.map +1 -0
  27. package/models/operations/index.d.ts +1 -11
  28. package/models/operations/index.d.ts.map +1 -1
  29. package/models/operations/index.js +1 -11
  30. package/models/operations/index.js.map +1 -1
  31. package/package.json +1 -1
  32. package/sdk/customerportal.d.ts +12 -0
  33. package/sdk/customerportal.d.ts.map +1 -0
  34. package/sdk/customerportal.js +22 -0
  35. package/sdk/customerportal.js.map +1 -0
  36. package/sdk/sdk.d.ts +3 -3
  37. package/sdk/sdk.d.ts.map +1 -1
  38. package/sdk/sdk.js +4 -4
  39. package/sdk/sdk.js.map +1 -1
  40. package/src/funcs/{customerDashboardGetCustomerDashboardExternalId.ts → customerPortalGetPortalExternalId.ts} +38 -8
  41. package/src/lib/config.ts +2 -2
  42. package/src/models/components/{dtodashboardsessionresponse.ts → dtoportalsessionresponse.ts} +7 -7
  43. package/src/models/components/index.ts +1 -4
  44. package/src/models/components/security.ts +3 -3
  45. package/src/models/operations/getportalexternalid.ts +39 -0
  46. package/src/models/operations/index.ts +1 -11
  47. package/src/sdk/customerportal.ts +27 -0
  48. package/src/sdk/sdk.ts +6 -6
  49. package/.eslintrc.js +0 -27
  50. package/funcs/customerDashboardGetCustomerDashboardExternalId.d.ts +0 -18
  51. package/funcs/customerDashboardGetCustomerDashboardExternalId.d.ts.map +0 -1
  52. package/funcs/customerDashboardGetCustomerDashboardExternalId.js +0 -118
  53. package/funcs/customerDashboardGetCustomerDashboardExternalId.js.map +0 -1
  54. package/funcs/customerDashboardGetCustomerDashboardInfo.d.ts +0 -19
  55. package/funcs/customerDashboardGetCustomerDashboardInfo.d.ts.map +0 -1
  56. package/funcs/customerDashboardGetCustomerDashboardInfo.js +0 -122
  57. package/funcs/customerDashboardGetCustomerDashboardInfo.js.map +0 -1
  58. package/funcs/customerDashboardGetCustomerDashboardInvoicesId.d.ts +0 -19
  59. package/funcs/customerDashboardGetCustomerDashboardInvoicesId.d.ts.map +0 -1
  60. package/funcs/customerDashboardGetCustomerDashboardInvoicesId.js +0 -141
  61. package/funcs/customerDashboardGetCustomerDashboardInvoicesId.js.map +0 -1
  62. package/funcs/customerDashboardGetCustomerDashboardSubscriptionsId.d.ts +0 -19
  63. package/funcs/customerDashboardGetCustomerDashboardSubscriptionsId.d.ts.map +0 -1
  64. package/funcs/customerDashboardGetCustomerDashboardSubscriptionsId.js +0 -142
  65. package/funcs/customerDashboardGetCustomerDashboardSubscriptionsId.js.map +0 -1
  66. package/funcs/customerDashboardGetCustomerDashboardUsage.d.ts +0 -19
  67. package/funcs/customerDashboardGetCustomerDashboardUsage.d.ts.map +0 -1
  68. package/funcs/customerDashboardGetCustomerDashboardUsage.js +0 -141
  69. package/funcs/customerDashboardGetCustomerDashboardUsage.js.map +0 -1
  70. package/funcs/customerDashboardGetCustomerDashboardWalletsId.d.ts +0 -19
  71. package/funcs/customerDashboardGetCustomerDashboardWalletsId.d.ts.map +0 -1
  72. package/funcs/customerDashboardGetCustomerDashboardWalletsId.js.map +0 -1
  73. package/funcs/customerDashboardPostCustomerDashboardAnalytics.d.ts +0 -19
  74. package/funcs/customerDashboardPostCustomerDashboardAnalytics.d.ts.map +0 -1
  75. package/funcs/customerDashboardPostCustomerDashboardAnalytics.js +0 -132
  76. package/funcs/customerDashboardPostCustomerDashboardAnalytics.js.map +0 -1
  77. package/funcs/customerDashboardPostCustomerDashboardCostAnalytics.d.ts.map +0 -1
  78. package/funcs/customerDashboardPostCustomerDashboardCostAnalytics.js +0 -132
  79. package/funcs/customerDashboardPostCustomerDashboardCostAnalytics.js.map +0 -1
  80. package/funcs/customerDashboardPostCustomerDashboardInvoices.d.ts +0 -19
  81. package/funcs/customerDashboardPostCustomerDashboardInvoices.d.ts.map +0 -1
  82. package/funcs/customerDashboardPostCustomerDashboardInvoices.js +0 -132
  83. package/funcs/customerDashboardPostCustomerDashboardInvoices.js.map +0 -1
  84. package/funcs/customerDashboardPostCustomerDashboardSubscriptions.d.ts +0 -19
  85. package/funcs/customerDashboardPostCustomerDashboardSubscriptions.d.ts.map +0 -1
  86. package/funcs/customerDashboardPostCustomerDashboardSubscriptions.js +0 -132
  87. package/funcs/customerDashboardPostCustomerDashboardSubscriptions.js.map +0 -1
  88. package/funcs/customerDashboardPostCustomerDashboardWallets.d.ts +0 -19
  89. package/funcs/customerDashboardPostCustomerDashboardWallets.d.ts.map +0 -1
  90. package/funcs/customerDashboardPostCustomerDashboardWallets.js +0 -123
  91. package/funcs/customerDashboardPostCustomerDashboardWallets.js.map +0 -1
  92. package/funcs/customerDashboardPutCustomerDashboardInfo.d.ts +0 -19
  93. package/funcs/customerDashboardPutCustomerDashboardInfo.d.ts.map +0 -1
  94. package/funcs/customerDashboardPutCustomerDashboardInfo.js +0 -132
  95. package/funcs/customerDashboardPutCustomerDashboardInfo.js.map +0 -1
  96. package/jest.config.js +0 -30
  97. package/models/components/dtodashboardanalyticsrequest.d.ts +0 -31
  98. package/models/components/dtodashboardanalyticsrequest.d.ts.map +0 -1
  99. package/models/components/dtodashboardanalyticsrequest.js +0 -67
  100. package/models/components/dtodashboardanalyticsrequest.js.map +0 -1
  101. package/models/components/dtodashboardcostanalyticsrequest.d.ts +0 -16
  102. package/models/components/dtodashboardcostanalyticsrequest.d.ts.map +0 -1
  103. package/models/components/dtodashboardcostanalyticsrequest.js +0 -58
  104. package/models/components/dtodashboardcostanalyticsrequest.js.map +0 -1
  105. package/models/components/dtodashboardpaginatedrequest.d.ts +0 -14
  106. package/models/components/dtodashboardpaginatedrequest.d.ts.map +0 -1
  107. package/models/components/dtodashboardpaginatedrequest.js +0 -50
  108. package/models/components/dtodashboardpaginatedrequest.js.map +0 -1
  109. package/models/components/dtodashboardsessionresponse.d.ts +0 -12
  110. package/models/components/dtodashboardsessionresponse.d.ts.map +0 -1
  111. package/models/components/dtodashboardsessionresponse.js.map +0 -1
  112. package/models/operations/getcustomerdashboardinfo.d.ts +0 -12
  113. package/models/operations/getcustomerdashboardinfo.d.ts.map +0 -1
  114. package/models/operations/getcustomerdashboardinfo.js +0 -54
  115. package/models/operations/getcustomerdashboardinfo.js.map +0 -1
  116. package/models/operations/getcustomerdashboardinvoicesid.d.ts +0 -25
  117. package/models/operations/getcustomerdashboardinvoicesid.d.ts.map +0 -1
  118. package/models/operations/getcustomerdashboardinvoicesid.js +0 -62
  119. package/models/operations/getcustomerdashboardinvoicesid.js.map +0 -1
  120. package/models/operations/getcustomerdashboardsubscriptionsid.d.ts +0 -25
  121. package/models/operations/getcustomerdashboardsubscriptionsid.d.ts.map +0 -1
  122. package/models/operations/getcustomerdashboardsubscriptionsid.js +0 -62
  123. package/models/operations/getcustomerdashboardsubscriptionsid.js.map +0 -1
  124. package/models/operations/getcustomerdashboardusage.d.ts +0 -30
  125. package/models/operations/getcustomerdashboardusage.d.ts.map +0 -1
  126. package/models/operations/getcustomerdashboardusage.js +0 -74
  127. package/models/operations/getcustomerdashboardusage.js.map +0 -1
  128. package/models/operations/getcustomerdashboardwalletsid.d.ts +0 -25
  129. package/models/operations/getcustomerdashboardwalletsid.d.ts.map +0 -1
  130. package/models/operations/getcustomerdashboardwalletsid.js +0 -62
  131. package/models/operations/getcustomerdashboardwalletsid.js.map +0 -1
  132. package/models/operations/postcustomerdashboardanalytics.d.ts +0 -12
  133. package/models/operations/postcustomerdashboardanalytics.d.ts.map +0 -1
  134. package/models/operations/postcustomerdashboardanalytics.js +0 -54
  135. package/models/operations/postcustomerdashboardanalytics.js.map +0 -1
  136. package/models/operations/postcustomerdashboardcostanalytics.d.ts +0 -12
  137. package/models/operations/postcustomerdashboardcostanalytics.d.ts.map +0 -1
  138. package/models/operations/postcustomerdashboardcostanalytics.js +0 -54
  139. package/models/operations/postcustomerdashboardcostanalytics.js.map +0 -1
  140. package/models/operations/postcustomerdashboardinvoices.d.ts +0 -12
  141. package/models/operations/postcustomerdashboardinvoices.d.ts.map +0 -1
  142. package/models/operations/postcustomerdashboardinvoices.js +0 -54
  143. package/models/operations/postcustomerdashboardinvoices.js.map +0 -1
  144. package/models/operations/postcustomerdashboardsubscriptions.d.ts +0 -12
  145. package/models/operations/postcustomerdashboardsubscriptions.d.ts.map +0 -1
  146. package/models/operations/postcustomerdashboardsubscriptions.js +0 -54
  147. package/models/operations/postcustomerdashboardsubscriptions.js.map +0 -1
  148. package/models/operations/postcustomerdashboardwallets.d.ts +0 -12
  149. package/models/operations/postcustomerdashboardwallets.d.ts.map +0 -1
  150. package/models/operations/postcustomerdashboardwallets.js +0 -54
  151. package/models/operations/postcustomerdashboardwallets.js.map +0 -1
  152. package/models/operations/putcustomerdashboardinfo.d.ts +0 -12
  153. package/models/operations/putcustomerdashboardinfo.d.ts.map +0 -1
  154. package/models/operations/putcustomerdashboardinfo.js.map +0 -1
  155. package/sdk/customerdashboard.d.ts +0 -90
  156. package/sdk/customerdashboard.d.ts.map +0 -1
  157. package/sdk/customerdashboard.js +0 -132
  158. package/sdk/customerdashboard.js.map +0 -1
  159. package/src/funcs/customerDashboardGetCustomerDashboardInfo.ts +0 -172
  160. package/src/funcs/customerDashboardGetCustomerDashboardInvoicesId.ts +0 -203
  161. package/src/funcs/customerDashboardGetCustomerDashboardSubscriptionsId.ts +0 -202
  162. package/src/funcs/customerDashboardGetCustomerDashboardUsage.ts +0 -203
  163. package/src/funcs/customerDashboardGetCustomerDashboardWalletsId.ts +0 -203
  164. package/src/funcs/customerDashboardPostCustomerDashboardAnalytics.ts +0 -191
  165. package/src/funcs/customerDashboardPostCustomerDashboardCostAnalytics.ts +0 -191
  166. package/src/funcs/customerDashboardPostCustomerDashboardInvoices.ts +0 -191
  167. package/src/funcs/customerDashboardPostCustomerDashboardSubscriptions.ts +0 -191
  168. package/src/funcs/customerDashboardPostCustomerDashboardWallets.ts +0 -173
  169. package/src/funcs/customerDashboardPutCustomerDashboardInfo.ts +0 -190
  170. package/src/models/components/dtodashboardanalyticsrequest.ts +0 -68
  171. package/src/models/components/dtodashboardcostanalyticsrequest.ts +0 -46
  172. package/src/models/components/dtodashboardpaginatedrequest.ts +0 -36
  173. package/src/models/operations/getcustomerdashboardinfo.ts +0 -38
  174. package/src/models/operations/getcustomerdashboardinvoicesid.ts +0 -70
  175. package/src/models/operations/getcustomerdashboardsubscriptionsid.ts +0 -73
  176. package/src/models/operations/getcustomerdashboardusage.ts +0 -86
  177. package/src/models/operations/getcustomerdashboardwalletsid.ts +0 -69
  178. package/src/models/operations/postcustomerdashboardanalytics.ts +0 -39
  179. package/src/models/operations/postcustomerdashboardcostanalytics.ts +0 -40
  180. package/src/models/operations/postcustomerdashboardinvoices.ts +0 -38
  181. package/src/models/operations/postcustomerdashboardsubscriptions.ts +0 -40
  182. package/src/models/operations/postcustomerdashboardwallets.ts +0 -38
  183. package/src/models/operations/putcustomerdashboardinfo.ts +0 -38
  184. package/src/sdk/customerdashboard.ts +0 -242
  185. package/tsconfig.esm.json +0 -7
@@ -1,191 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import { FlexPriceCore } from "../core.js";
6
- import { encodeJSON } from "../lib/encodings.js";
7
- import * as M from "../lib/matchers.js";
8
- import { compactMap } from "../lib/primitives.js";
9
- import { safeParse } from "../lib/schemas.js";
10
- import { RequestOptions } from "../lib/sdks.js";
11
- import { resolveSecurity } from "../lib/security.js";
12
- import { pathToFunc } from "../lib/url.js";
13
- import * as components from "../models/components/index.js";
14
- import { FlexPriceError } from "../models/errors/flexpriceerror.js";
15
- import {
16
- ConnectionError,
17
- InvalidRequestError,
18
- RequestAbortedError,
19
- RequestTimeoutError,
20
- UnexpectedClientError,
21
- } from "../models/errors/httpclienterrors.js";
22
- import * as errors from "../models/errors/index.js";
23
- import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
- import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
- import * as operations from "../models/operations/index.js";
26
- import { APICall, APIPromise } from "../types/async.js";
27
- import { Result } from "../types/fp.js";
28
-
29
- /**
30
- * Get customer analytics
31
- *
32
- * @remarks
33
- * Get usage analytics for the authenticated customer
34
- */
35
- export function customerDashboardPostCustomerDashboardAnalytics(
36
- client: FlexPriceCore,
37
- security: operations.PostCustomerDashboardAnalyticsSecurity,
38
- request: components.DtoDashboardAnalyticsRequest,
39
- options?: RequestOptions,
40
- ): APIPromise<
41
- Result<
42
- components.DtoGetUsageAnalyticsResponse,
43
- | errors.ErrorsErrorResponse
44
- | FlexPriceError
45
- | ResponseValidationError
46
- | ConnectionError
47
- | RequestAbortedError
48
- | RequestTimeoutError
49
- | InvalidRequestError
50
- | UnexpectedClientError
51
- | SDKValidationError
52
- >
53
- > {
54
- return new APIPromise($do(
55
- client,
56
- security,
57
- request,
58
- options,
59
- ));
60
- }
61
-
62
- async function $do(
63
- client: FlexPriceCore,
64
- security: operations.PostCustomerDashboardAnalyticsSecurity,
65
- request: components.DtoDashboardAnalyticsRequest,
66
- options?: RequestOptions,
67
- ): Promise<
68
- [
69
- Result<
70
- components.DtoGetUsageAnalyticsResponse,
71
- | errors.ErrorsErrorResponse
72
- | FlexPriceError
73
- | ResponseValidationError
74
- | ConnectionError
75
- | RequestAbortedError
76
- | RequestTimeoutError
77
- | InvalidRequestError
78
- | UnexpectedClientError
79
- | SDKValidationError
80
- >,
81
- APICall,
82
- ]
83
- > {
84
- const parsed = safeParse(
85
- request,
86
- (value) =>
87
- components.DtoDashboardAnalyticsRequest$outboundSchema.parse(value),
88
- "Input validation failed",
89
- );
90
- if (!parsed.ok) {
91
- return [parsed, { status: "invalid" }];
92
- }
93
- const payload = parsed.value;
94
- const body = encodeJSON("body", payload, { explode: true });
95
-
96
- const path = pathToFunc("/customer-dashboard/analytics")();
97
-
98
- const headers = new Headers(compactMap({
99
- "Content-Type": "application/json",
100
- Accept: "application/json",
101
- }));
102
-
103
- const requestSecurity = resolveSecurity(
104
- [
105
- {
106
- fieldName: "Authorization",
107
- type: "apiKey:header",
108
- value: security?.bearerAuth,
109
- },
110
- ],
111
- );
112
-
113
- const context = {
114
- options: client._options,
115
- baseURL: options?.serverURL ?? client._baseURL ?? "",
116
- operationID: "post_/customer-dashboard/analytics",
117
- oAuth2Scopes: null,
118
-
119
- resolvedSecurity: requestSecurity,
120
-
121
- securitySource: security,
122
- retryConfig: options?.retries
123
- || client._options.retryConfig
124
- || {
125
- strategy: "backoff",
126
- backoff: {
127
- initialInterval: 500,
128
- maxInterval: 60000,
129
- exponent: 1.5,
130
- maxElapsedTime: 3600000,
131
- },
132
- retryConnectionErrors: true,
133
- }
134
- || { strategy: "none" },
135
- retryCodes: options?.retryCodes || ["5XX", "429"],
136
- };
137
-
138
- const requestRes = client._createRequest(context, {
139
- security: requestSecurity,
140
- method: "POST",
141
- baseURL: options?.serverURL,
142
- path: path,
143
- headers: headers,
144
- body: body,
145
- userAgent: client._options.userAgent,
146
- timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
147
- }, options);
148
- if (!requestRes.ok) {
149
- return [requestRes, { status: "invalid" }];
150
- }
151
- const req = requestRes.value;
152
-
153
- const doResult = await client._do(req, {
154
- context,
155
- errorCodes: ["401", "4XX", "500", "5XX"],
156
- retryConfig: context.retryConfig,
157
- retryCodes: context.retryCodes,
158
- });
159
- if (!doResult.ok) {
160
- return [doResult, { status: "request-error", request: req }];
161
- }
162
- const response = doResult.value;
163
-
164
- const responseFields = {
165
- HttpMeta: { Response: response, Request: req },
166
- };
167
-
168
- const [result] = await M.match<
169
- components.DtoGetUsageAnalyticsResponse,
170
- | errors.ErrorsErrorResponse
171
- | FlexPriceError
172
- | ResponseValidationError
173
- | ConnectionError
174
- | RequestAbortedError
175
- | RequestTimeoutError
176
- | InvalidRequestError
177
- | UnexpectedClientError
178
- | SDKValidationError
179
- >(
180
- M.json(200, components.DtoGetUsageAnalyticsResponse$inboundSchema),
181
- M.jsonErr(401, errors.ErrorsErrorResponse$inboundSchema),
182
- M.jsonErr(500, errors.ErrorsErrorResponse$inboundSchema),
183
- M.fail("4XX"),
184
- M.fail("5XX"),
185
- )(response, req, { extraFields: responseFields });
186
- if (!result.ok) {
187
- return [result, { status: "complete", request: req, response }];
188
- }
189
-
190
- return [result, { status: "complete", request: req, response }];
191
- }
@@ -1,191 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import { FlexPriceCore } from "../core.js";
6
- import { encodeJSON } from "../lib/encodings.js";
7
- import * as M from "../lib/matchers.js";
8
- import { compactMap } from "../lib/primitives.js";
9
- import { safeParse } from "../lib/schemas.js";
10
- import { RequestOptions } from "../lib/sdks.js";
11
- import { resolveSecurity } from "../lib/security.js";
12
- import { pathToFunc } from "../lib/url.js";
13
- import * as components from "../models/components/index.js";
14
- import { FlexPriceError } from "../models/errors/flexpriceerror.js";
15
- import {
16
- ConnectionError,
17
- InvalidRequestError,
18
- RequestAbortedError,
19
- RequestTimeoutError,
20
- UnexpectedClientError,
21
- } from "../models/errors/httpclienterrors.js";
22
- import * as errors from "../models/errors/index.js";
23
- import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
- import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
- import * as operations from "../models/operations/index.js";
26
- import { APICall, APIPromise } from "../types/async.js";
27
- import { Result } from "../types/fp.js";
28
-
29
- /**
30
- * Get customer cost analytics
31
- *
32
- * @remarks
33
- * Get cost analytics for the authenticated customer
34
- */
35
- export function customerDashboardPostCustomerDashboardCostAnalytics(
36
- client: FlexPriceCore,
37
- security: operations.PostCustomerDashboardCostAnalyticsSecurity,
38
- request: components.DtoDashboardCostAnalyticsRequest,
39
- options?: RequestOptions,
40
- ): APIPromise<
41
- Result<
42
- components.DtoGetDetailedCostAnalyticsResponse,
43
- | errors.ErrorsErrorResponse
44
- | FlexPriceError
45
- | ResponseValidationError
46
- | ConnectionError
47
- | RequestAbortedError
48
- | RequestTimeoutError
49
- | InvalidRequestError
50
- | UnexpectedClientError
51
- | SDKValidationError
52
- >
53
- > {
54
- return new APIPromise($do(
55
- client,
56
- security,
57
- request,
58
- options,
59
- ));
60
- }
61
-
62
- async function $do(
63
- client: FlexPriceCore,
64
- security: operations.PostCustomerDashboardCostAnalyticsSecurity,
65
- request: components.DtoDashboardCostAnalyticsRequest,
66
- options?: RequestOptions,
67
- ): Promise<
68
- [
69
- Result<
70
- components.DtoGetDetailedCostAnalyticsResponse,
71
- | errors.ErrorsErrorResponse
72
- | FlexPriceError
73
- | ResponseValidationError
74
- | ConnectionError
75
- | RequestAbortedError
76
- | RequestTimeoutError
77
- | InvalidRequestError
78
- | UnexpectedClientError
79
- | SDKValidationError
80
- >,
81
- APICall,
82
- ]
83
- > {
84
- const parsed = safeParse(
85
- request,
86
- (value) =>
87
- components.DtoDashboardCostAnalyticsRequest$outboundSchema.parse(value),
88
- "Input validation failed",
89
- );
90
- if (!parsed.ok) {
91
- return [parsed, { status: "invalid" }];
92
- }
93
- const payload = parsed.value;
94
- const body = encodeJSON("body", payload, { explode: true });
95
-
96
- const path = pathToFunc("/customer-dashboard/cost-analytics")();
97
-
98
- const headers = new Headers(compactMap({
99
- "Content-Type": "application/json",
100
- Accept: "application/json",
101
- }));
102
-
103
- const requestSecurity = resolveSecurity(
104
- [
105
- {
106
- fieldName: "Authorization",
107
- type: "apiKey:header",
108
- value: security?.bearerAuth,
109
- },
110
- ],
111
- );
112
-
113
- const context = {
114
- options: client._options,
115
- baseURL: options?.serverURL ?? client._baseURL ?? "",
116
- operationID: "post_/customer-dashboard/cost-analytics",
117
- oAuth2Scopes: null,
118
-
119
- resolvedSecurity: requestSecurity,
120
-
121
- securitySource: security,
122
- retryConfig: options?.retries
123
- || client._options.retryConfig
124
- || {
125
- strategy: "backoff",
126
- backoff: {
127
- initialInterval: 500,
128
- maxInterval: 60000,
129
- exponent: 1.5,
130
- maxElapsedTime: 3600000,
131
- },
132
- retryConnectionErrors: true,
133
- }
134
- || { strategy: "none" },
135
- retryCodes: options?.retryCodes || ["5XX", "429"],
136
- };
137
-
138
- const requestRes = client._createRequest(context, {
139
- security: requestSecurity,
140
- method: "POST",
141
- baseURL: options?.serverURL,
142
- path: path,
143
- headers: headers,
144
- body: body,
145
- userAgent: client._options.userAgent,
146
- timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
147
- }, options);
148
- if (!requestRes.ok) {
149
- return [requestRes, { status: "invalid" }];
150
- }
151
- const req = requestRes.value;
152
-
153
- const doResult = await client._do(req, {
154
- context,
155
- errorCodes: ["401", "4XX", "500", "5XX"],
156
- retryConfig: context.retryConfig,
157
- retryCodes: context.retryCodes,
158
- });
159
- if (!doResult.ok) {
160
- return [doResult, { status: "request-error", request: req }];
161
- }
162
- const response = doResult.value;
163
-
164
- const responseFields = {
165
- HttpMeta: { Response: response, Request: req },
166
- };
167
-
168
- const [result] = await M.match<
169
- components.DtoGetDetailedCostAnalyticsResponse,
170
- | errors.ErrorsErrorResponse
171
- | FlexPriceError
172
- | ResponseValidationError
173
- | ConnectionError
174
- | RequestAbortedError
175
- | RequestTimeoutError
176
- | InvalidRequestError
177
- | UnexpectedClientError
178
- | SDKValidationError
179
- >(
180
- M.json(200, components.DtoGetDetailedCostAnalyticsResponse$inboundSchema),
181
- M.jsonErr(401, errors.ErrorsErrorResponse$inboundSchema),
182
- M.jsonErr(500, errors.ErrorsErrorResponse$inboundSchema),
183
- M.fail("4XX"),
184
- M.fail("5XX"),
185
- )(response, req, { extraFields: responseFields });
186
- if (!result.ok) {
187
- return [result, { status: "complete", request: req, response }];
188
- }
189
-
190
- return [result, { status: "complete", request: req, response }];
191
- }
@@ -1,191 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import { FlexPriceCore } from "../core.js";
6
- import { encodeJSON } from "../lib/encodings.js";
7
- import * as M from "../lib/matchers.js";
8
- import { compactMap } from "../lib/primitives.js";
9
- import { safeParse } from "../lib/schemas.js";
10
- import { RequestOptions } from "../lib/sdks.js";
11
- import { resolveSecurity } from "../lib/security.js";
12
- import { pathToFunc } from "../lib/url.js";
13
- import * as components from "../models/components/index.js";
14
- import { FlexPriceError } from "../models/errors/flexpriceerror.js";
15
- import {
16
- ConnectionError,
17
- InvalidRequestError,
18
- RequestAbortedError,
19
- RequestTimeoutError,
20
- UnexpectedClientError,
21
- } from "../models/errors/httpclienterrors.js";
22
- import * as errors from "../models/errors/index.js";
23
- import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
- import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
- import * as operations from "../models/operations/index.js";
26
- import { APICall, APIPromise } from "../types/async.js";
27
- import { Result } from "../types/fp.js";
28
-
29
- /**
30
- * Get customer invoices
31
- *
32
- * @remarks
33
- * Get all invoices for the authenticated customer with pagination
34
- */
35
- export function customerDashboardPostCustomerDashboardInvoices(
36
- client: FlexPriceCore,
37
- security: operations.PostCustomerDashboardInvoicesSecurity,
38
- request: components.DtoDashboardPaginatedRequest,
39
- options?: RequestOptions,
40
- ): APIPromise<
41
- Result<
42
- components.DtoListInvoicesResponse,
43
- | errors.ErrorsErrorResponse
44
- | FlexPriceError
45
- | ResponseValidationError
46
- | ConnectionError
47
- | RequestAbortedError
48
- | RequestTimeoutError
49
- | InvalidRequestError
50
- | UnexpectedClientError
51
- | SDKValidationError
52
- >
53
- > {
54
- return new APIPromise($do(
55
- client,
56
- security,
57
- request,
58
- options,
59
- ));
60
- }
61
-
62
- async function $do(
63
- client: FlexPriceCore,
64
- security: operations.PostCustomerDashboardInvoicesSecurity,
65
- request: components.DtoDashboardPaginatedRequest,
66
- options?: RequestOptions,
67
- ): Promise<
68
- [
69
- Result<
70
- components.DtoListInvoicesResponse,
71
- | errors.ErrorsErrorResponse
72
- | FlexPriceError
73
- | ResponseValidationError
74
- | ConnectionError
75
- | RequestAbortedError
76
- | RequestTimeoutError
77
- | InvalidRequestError
78
- | UnexpectedClientError
79
- | SDKValidationError
80
- >,
81
- APICall,
82
- ]
83
- > {
84
- const parsed = safeParse(
85
- request,
86
- (value) =>
87
- components.DtoDashboardPaginatedRequest$outboundSchema.parse(value),
88
- "Input validation failed",
89
- );
90
- if (!parsed.ok) {
91
- return [parsed, { status: "invalid" }];
92
- }
93
- const payload = parsed.value;
94
- const body = encodeJSON("body", payload, { explode: true });
95
-
96
- const path = pathToFunc("/customer-dashboard/invoices")();
97
-
98
- const headers = new Headers(compactMap({
99
- "Content-Type": "application/json",
100
- Accept: "application/json",
101
- }));
102
-
103
- const requestSecurity = resolveSecurity(
104
- [
105
- {
106
- fieldName: "Authorization",
107
- type: "apiKey:header",
108
- value: security?.bearerAuth,
109
- },
110
- ],
111
- );
112
-
113
- const context = {
114
- options: client._options,
115
- baseURL: options?.serverURL ?? client._baseURL ?? "",
116
- operationID: "post_/customer-dashboard/invoices",
117
- oAuth2Scopes: null,
118
-
119
- resolvedSecurity: requestSecurity,
120
-
121
- securitySource: security,
122
- retryConfig: options?.retries
123
- || client._options.retryConfig
124
- || {
125
- strategy: "backoff",
126
- backoff: {
127
- initialInterval: 500,
128
- maxInterval: 60000,
129
- exponent: 1.5,
130
- maxElapsedTime: 3600000,
131
- },
132
- retryConnectionErrors: true,
133
- }
134
- || { strategy: "none" },
135
- retryCodes: options?.retryCodes || ["5XX", "429"],
136
- };
137
-
138
- const requestRes = client._createRequest(context, {
139
- security: requestSecurity,
140
- method: "POST",
141
- baseURL: options?.serverURL,
142
- path: path,
143
- headers: headers,
144
- body: body,
145
- userAgent: client._options.userAgent,
146
- timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
147
- }, options);
148
- if (!requestRes.ok) {
149
- return [requestRes, { status: "invalid" }];
150
- }
151
- const req = requestRes.value;
152
-
153
- const doResult = await client._do(req, {
154
- context,
155
- errorCodes: ["401", "4XX", "500", "5XX"],
156
- retryConfig: context.retryConfig,
157
- retryCodes: context.retryCodes,
158
- });
159
- if (!doResult.ok) {
160
- return [doResult, { status: "request-error", request: req }];
161
- }
162
- const response = doResult.value;
163
-
164
- const responseFields = {
165
- HttpMeta: { Response: response, Request: req },
166
- };
167
-
168
- const [result] = await M.match<
169
- components.DtoListInvoicesResponse,
170
- | errors.ErrorsErrorResponse
171
- | FlexPriceError
172
- | ResponseValidationError
173
- | ConnectionError
174
- | RequestAbortedError
175
- | RequestTimeoutError
176
- | InvalidRequestError
177
- | UnexpectedClientError
178
- | SDKValidationError
179
- >(
180
- M.json(200, components.DtoListInvoicesResponse$inboundSchema),
181
- M.jsonErr(401, errors.ErrorsErrorResponse$inboundSchema),
182
- M.jsonErr(500, errors.ErrorsErrorResponse$inboundSchema),
183
- M.fail("4XX"),
184
- M.fail("5XX"),
185
- )(response, req, { extraFields: responseFields });
186
- if (!result.ok) {
187
- return [result, { status: "complete", request: req, response }];
188
- }
189
-
190
- return [result, { status: "complete", request: req, response }];
191
- }