@flexprice/sdk 2.1.49-dev.1 → 2.1.49-dev.10

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 (212) hide show
  1. package/docs/sdk/models/billing-address.md +20 -0
  2. package/docs/sdk/models/billing-details.md +18 -0
  3. package/docs/sdk/models/billing-entity-mode-response.md +15 -0
  4. package/docs/sdk/models/billing-entity-mode.md +17 -0
  5. package/docs/sdk/models/billing-entity-response.md +27 -0
  6. package/docs/sdk/models/billingterm-instalment.md +1 -0
  7. package/docs/sdk/models/create-billing-entity-request.md +21 -0
  8. package/docs/sdk/models/create-customer-request.md +1 -0
  9. package/docs/sdk/models/customer-filter.md +1 -0
  10. package/docs/sdk/models/customer-response.md +1 -0
  11. package/docs/sdk/models/customer.md +1 -0
  12. package/docs/sdk/models/get-billing-entity-request.md +17 -0
  13. package/docs/sdk/models/get-usage-analytics-request.md +1 -1
  14. package/docs/sdk/models/get-usage-analytics-response.md +10 -8
  15. package/docs/sdk/models/invoice-billing-entity.md +17 -0
  16. package/docs/sdk/models/invoice-filter.md +1 -0
  17. package/docs/sdk/models/invoice-response.md +2 -0
  18. package/docs/sdk/models/list-billing-entities-order.md +15 -0
  19. package/docs/sdk/models/list-billing-entities-request.md +22 -0
  20. package/docs/sdk/models/list-billing-entities-response.md +16 -0
  21. package/docs/sdk/models/list-billing-entities-status.md +15 -0
  22. package/docs/sdk/models/tax-rate-entity-type.md +2 -2
  23. package/docs/sdk/models/update-billing-entity-request-request.md +19 -0
  24. package/docs/sdk/models/update-billing-entity-request.md +18 -0
  25. package/docs/sdk/models/update-customer-request.md +1 -0
  26. package/docs/sdk/models/usage-analytic-instalment.md +24 -0
  27. package/docs/sdk/models/webhook-dto-customer.md +1 -0
  28. package/docs/sdk/models/webhook-dto-invoice.md +1 -0
  29. package/docs/sdks/billingentities/README.md +442 -0
  30. package/docs/sdks/subscriptions/README.md +1 -1
  31. package/esm/funcs/billing-entities-create-billing-entity.d.ts +17 -0
  32. package/esm/funcs/billing-entities-create-billing-entity.d.ts.map +1 -0
  33. package/esm/funcs/billing-entities-create-billing-entity.js +83 -0
  34. package/esm/funcs/billing-entities-create-billing-entity.js.map +1 -0
  35. package/esm/funcs/billing-entities-enable-billing-entities.d.ts +17 -0
  36. package/esm/funcs/billing-entities-enable-billing-entities.d.ts.map +1 -0
  37. package/esm/funcs/billing-entities-enable-billing-entities.js +72 -0
  38. package/esm/funcs/billing-entities-enable-billing-entities.js.map +1 -0
  39. package/esm/funcs/billing-entities-get-billing-entities-status.d.ts +17 -0
  40. package/esm/funcs/billing-entities-get-billing-entities-status.d.ts.map +1 -0
  41. package/esm/funcs/billing-entities-get-billing-entities-status.js +72 -0
  42. package/esm/funcs/billing-entities-get-billing-entities-status.js.map +1 -0
  43. package/esm/funcs/billing-entities-get-billing-entity.d.ts +17 -0
  44. package/esm/funcs/billing-entities-get-billing-entity.d.ts.map +1 -0
  45. package/esm/funcs/billing-entities-get-billing-entity.js +91 -0
  46. package/esm/funcs/billing-entities-get-billing-entity.js.map +1 -0
  47. package/esm/funcs/billing-entities-list-billing-entities.d.ts +17 -0
  48. package/esm/funcs/billing-entities-list-billing-entities.d.ts.map +1 -0
  49. package/esm/funcs/billing-entities-list-billing-entities.js +94 -0
  50. package/esm/funcs/billing-entities-list-billing-entities.js.map +1 -0
  51. package/esm/funcs/billing-entities-update-billing-entity.d.ts +17 -0
  52. package/esm/funcs/billing-entities-update-billing-entity.d.ts.map +1 -0
  53. package/esm/funcs/billing-entities-update-billing-entity.js +93 -0
  54. package/esm/funcs/billing-entities-update-billing-entity.js.map +1 -0
  55. package/esm/funcs/subscriptions-cancel-subscription.js +1 -1
  56. package/esm/funcs/subscriptions-cancel-subscription.js.map +1 -1
  57. package/esm/lib/config.d.ts +3 -3
  58. package/esm/lib/config.d.ts.map +1 -1
  59. package/esm/lib/config.js +3 -3
  60. package/esm/lib/config.js.map +1 -1
  61. package/esm/sdk/billing-entities.d.ts +47 -0
  62. package/esm/sdk/billing-entities.d.ts.map +1 -0
  63. package/esm/sdk/billing-entities.js +68 -0
  64. package/esm/sdk/billing-entities.js.map +1 -0
  65. package/esm/sdk/models/billing-address.d.ts +27 -0
  66. package/esm/sdk/models/billing-address.d.ts.map +1 -0
  67. package/esm/sdk/models/billing-address.js +50 -0
  68. package/esm/sdk/models/billing-address.js.map +1 -0
  69. package/esm/sdk/models/billing-details.d.ts +24 -0
  70. package/esm/sdk/models/billing-details.d.ts.map +1 -0
  71. package/esm/sdk/models/billing-details.js +37 -0
  72. package/esm/sdk/models/billing-details.js.map +1 -0
  73. package/esm/sdk/models/billing-entity-mode-response.d.ts +11 -0
  74. package/esm/sdk/models/billing-entity-mode-response.d.ts.map +1 -0
  75. package/esm/sdk/models/billing-entity-mode-response.js +15 -0
  76. package/esm/sdk/models/billing-entity-mode-response.js.map +1 -0
  77. package/esm/sdk/models/billing-entity-mode.d.ts +11 -0
  78. package/esm/sdk/models/billing-entity-mode.d.ts.map +1 -0
  79. package/esm/sdk/models/billing-entity-mode.js +12 -0
  80. package/esm/sdk/models/billing-entity-mode.js.map +1 -0
  81. package/esm/sdk/models/billing-entity-response.d.ts +26 -0
  82. package/esm/sdk/models/billing-entity-response.d.ts.map +1 -0
  83. package/esm/sdk/models/billing-entity-response.js +41 -0
  84. package/esm/sdk/models/billing-entity-response.js.map +1 -0
  85. package/esm/sdk/models/billingterm-instalment.d.ts +4 -0
  86. package/esm/sdk/models/billingterm-instalment.d.ts.map +1 -1
  87. package/esm/sdk/models/billingterm-instalment.js +2 -0
  88. package/esm/sdk/models/billingterm-instalment.js.map +1 -1
  89. package/esm/sdk/models/create-billing-entity-request.d.ts +23 -0
  90. package/esm/sdk/models/create-billing-entity-request.d.ts.map +1 -0
  91. package/esm/sdk/models/create-billing-entity-request.js +22 -0
  92. package/esm/sdk/models/create-billing-entity-request.js.map +1 -0
  93. package/esm/sdk/models/create-customer-request.d.ts +8 -0
  94. package/esm/sdk/models/create-customer-request.d.ts.map +1 -1
  95. package/esm/sdk/models/create-customer-request.js +2 -0
  96. package/esm/sdk/models/create-customer-request.js.map +1 -1
  97. package/esm/sdk/models/customer-filter.d.ts +5 -0
  98. package/esm/sdk/models/customer-filter.d.ts.map +1 -1
  99. package/esm/sdk/models/customer-filter.js +2 -0
  100. package/esm/sdk/models/customer-filter.js.map +1 -1
  101. package/esm/sdk/models/customer-response.d.ts +4 -0
  102. package/esm/sdk/models/customer-response.d.ts.map +1 -1
  103. package/esm/sdk/models/customer-response.js +2 -0
  104. package/esm/sdk/models/customer-response.js.map +1 -1
  105. package/esm/sdk/models/customer.d.ts +4 -0
  106. package/esm/sdk/models/customer.d.ts.map +1 -1
  107. package/esm/sdk/models/customer.js +2 -0
  108. package/esm/sdk/models/customer.js.map +1 -1
  109. package/esm/sdk/models/get-billing-entity-op.d.ts +15 -0
  110. package/esm/sdk/models/get-billing-entity-op.d.ts.map +1 -0
  111. package/esm/sdk/models/get-billing-entity-op.js +12 -0
  112. package/esm/sdk/models/get-billing-entity-op.js.map +1 -0
  113. package/esm/sdk/models/get-usage-analytics-request.d.ts +1 -1
  114. package/esm/sdk/models/get-usage-analytics-response.d.ts +12 -0
  115. package/esm/sdk/models/get-usage-analytics-response.d.ts.map +1 -1
  116. package/esm/sdk/models/get-usage-analytics-response.js +4 -0
  117. package/esm/sdk/models/get-usage-analytics-response.js.map +1 -1
  118. package/esm/sdk/models/index.d.ts +13 -0
  119. package/esm/sdk/models/index.d.ts.map +1 -1
  120. package/esm/sdk/models/index.js +13 -0
  121. package/esm/sdk/models/index.js.map +1 -1
  122. package/esm/sdk/models/invoice-billing-entity.d.ts +13 -0
  123. package/esm/sdk/models/invoice-billing-entity.d.ts.map +1 -0
  124. package/esm/sdk/models/invoice-billing-entity.js +23 -0
  125. package/esm/sdk/models/invoice-billing-entity.js.map +1 -0
  126. package/esm/sdk/models/invoice-filter.d.ts +5 -0
  127. package/esm/sdk/models/invoice-filter.d.ts.map +1 -1
  128. package/esm/sdk/models/invoice-filter.js +2 -0
  129. package/esm/sdk/models/invoice-filter.js.map +1 -1
  130. package/esm/sdk/models/invoice-response.d.ts +6 -0
  131. package/esm/sdk/models/invoice-response.d.ts.map +1 -1
  132. package/esm/sdk/models/invoice-response.js +5 -0
  133. package/esm/sdk/models/invoice-response.js.map +1 -1
  134. package/esm/sdk/models/list-billing-entities-op.d.ts +42 -0
  135. package/esm/sdk/models/list-billing-entities-op.d.ts.map +1 -0
  136. package/esm/sdk/models/list-billing-entities-op.js +38 -0
  137. package/esm/sdk/models/list-billing-entities-op.js.map +1 -0
  138. package/esm/sdk/models/list-billing-entities-response.d.ts +13 -0
  139. package/esm/sdk/models/list-billing-entities-response.d.ts.map +1 -0
  140. package/esm/sdk/models/list-billing-entities-response.js +17 -0
  141. package/esm/sdk/models/list-billing-entities-response.js.map +1 -0
  142. package/esm/sdk/models/tax-rate-entity-type.d.ts +1 -0
  143. package/esm/sdk/models/tax-rate-entity-type.d.ts.map +1 -1
  144. package/esm/sdk/models/tax-rate-entity-type.js +1 -0
  145. package/esm/sdk/models/tax-rate-entity-type.js.map +1 -1
  146. package/esm/sdk/models/update-billing-entity-op.d.ts +21 -0
  147. package/esm/sdk/models/update-billing-entity-op.d.ts.map +1 -0
  148. package/esm/sdk/models/update-billing-entity-op.js +14 -0
  149. package/esm/sdk/models/update-billing-entity-op.js.map +1 -0
  150. package/esm/sdk/models/update-billing-entity-request.d.ts +23 -0
  151. package/esm/sdk/models/update-billing-entity-request.d.ts.map +1 -0
  152. package/esm/sdk/models/update-billing-entity-request.js +22 -0
  153. package/esm/sdk/models/update-billing-entity-request.js.map +1 -0
  154. package/esm/sdk/models/update-customer-request.d.ts +5 -0
  155. package/esm/sdk/models/update-customer-request.d.ts.map +1 -1
  156. package/esm/sdk/models/update-customer-request.js +2 -0
  157. package/esm/sdk/models/update-customer-request.js.map +1 -1
  158. package/esm/sdk/models/usage-analytic-instalment.d.ts +22 -0
  159. package/esm/sdk/models/usage-analytic-instalment.d.ts.map +1 -0
  160. package/esm/sdk/models/usage-analytic-instalment.js +34 -0
  161. package/esm/sdk/models/usage-analytic-instalment.js.map +1 -0
  162. package/esm/sdk/models/webhook-dto-customer.d.ts +1 -0
  163. package/esm/sdk/models/webhook-dto-customer.d.ts.map +1 -1
  164. package/esm/sdk/models/webhook-dto-customer.js +2 -0
  165. package/esm/sdk/models/webhook-dto-customer.js.map +1 -1
  166. package/esm/sdk/models/webhook-dto-invoice.d.ts +1 -0
  167. package/esm/sdk/models/webhook-dto-invoice.d.ts.map +1 -1
  168. package/esm/sdk/models/webhook-dto-invoice.js +2 -0
  169. package/esm/sdk/models/webhook-dto-invoice.js.map +1 -1
  170. package/esm/sdk/sdk.d.ts +3 -0
  171. package/esm/sdk/sdk.d.ts.map +1 -1
  172. package/esm/sdk/sdk.js +5 -0
  173. package/esm/sdk/sdk.js.map +1 -1
  174. package/jsr.json +1 -1
  175. package/package.json +2 -2
  176. package/src/funcs/billing-entities-create-billing-entity.ts +172 -0
  177. package/src/funcs/billing-entities-enable-billing-entities.ts +153 -0
  178. package/src/funcs/billing-entities-get-billing-entities-status.ts +152 -0
  179. package/src/funcs/billing-entities-get-billing-entity.ts +181 -0
  180. package/src/funcs/billing-entities-list-billing-entities.ts +191 -0
  181. package/src/funcs/billing-entities-update-billing-entity.ts +187 -0
  182. package/src/funcs/subscriptions-cancel-subscription.ts +1 -1
  183. package/src/lib/config.ts +4 -3
  184. package/src/sdk/billing-entities.ts +115 -0
  185. package/src/sdk/models/billing-address.ts +91 -0
  186. package/src/sdk/models/billing-details.ts +79 -0
  187. package/src/sdk/models/billing-entity-mode-response.ts +35 -0
  188. package/src/sdk/models/billing-entity-mode.ts +20 -0
  189. package/src/sdk/models/billing-entity-response.ts +76 -0
  190. package/src/sdk/models/billingterm-instalment.ts +6 -0
  191. package/src/sdk/models/create-billing-entity-request.ts +53 -0
  192. package/src/sdk/models/create-customer-request.ts +10 -0
  193. package/src/sdk/models/customer-filter.ts +7 -0
  194. package/src/sdk/models/customer-response.ts +6 -0
  195. package/src/sdk/models/customer.ts +6 -0
  196. package/src/sdk/models/get-billing-entity-op.ts +33 -0
  197. package/src/sdk/models/get-usage-analytics-request.ts +1 -1
  198. package/src/sdk/models/get-usage-analytics-response.ts +18 -0
  199. package/src/sdk/models/index.ts +13 -0
  200. package/src/sdk/models/invoice-billing-entity.ts +48 -0
  201. package/src/sdk/models/invoice-filter.ts +7 -0
  202. package/src/sdk/models/invoice-response.ts +13 -0
  203. package/src/sdk/models/list-billing-entities-op.ts +88 -0
  204. package/src/sdk/models/list-billing-entities-response.ts +41 -0
  205. package/src/sdk/models/tax-rate-entity-type.ts +1 -0
  206. package/src/sdk/models/update-billing-entity-op.ts +46 -0
  207. package/src/sdk/models/update-billing-entity-request.ts +53 -0
  208. package/src/sdk/models/update-customer-request.ts +7 -0
  209. package/src/sdk/models/usage-analytic-instalment.ts +66 -0
  210. package/src/sdk/models/webhook-dto-customer.ts +3 -0
  211. package/src/sdk/models/webhook-dto-invoice.ts +3 -0
  212. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,153 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { FlexpriceCore } from "../core.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.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 { FlexPriceError } from "../sdk/models/flex-price-error.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../sdk/models/http-client-errors.js";
20
+ import * as models from "../sdk/models/index.js";
21
+ import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
22
+ import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
23
+ import { APICall, APIPromise } from "../types/async.js";
24
+ import { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * Enable billing entities
28
+ *
29
+ * @remarks
30
+ * Start enabling billing entities in the environment. The environment gets a default entity and its existing customers are assigned to it. Irreversible.
31
+ */
32
+ export function billingEntitiesEnableBillingEntities(
33
+ client: FlexpriceCore,
34
+ options?: RequestOptions,
35
+ ): APIPromise<
36
+ Result<
37
+ models.BillingEntityModeResponse,
38
+ | models.ErrorsErrorResponse
39
+ | FlexPriceError
40
+ | ResponseValidationError
41
+ | ConnectionError
42
+ | RequestAbortedError
43
+ | RequestTimeoutError
44
+ | InvalidRequestError
45
+ | UnexpectedClientError
46
+ | SDKValidationError
47
+ >
48
+ > {
49
+ return new APIPromise($do(
50
+ client,
51
+ options,
52
+ ));
53
+ }
54
+
55
+ async function $do(
56
+ client: FlexpriceCore,
57
+ options?: RequestOptions,
58
+ ): Promise<
59
+ [
60
+ Result<
61
+ models.BillingEntityModeResponse,
62
+ | models.ErrorsErrorResponse
63
+ | FlexPriceError
64
+ | ResponseValidationError
65
+ | ConnectionError
66
+ | RequestAbortedError
67
+ | RequestTimeoutError
68
+ | InvalidRequestError
69
+ | UnexpectedClientError
70
+ | SDKValidationError
71
+ >,
72
+ APICall,
73
+ ]
74
+ > {
75
+ const path = pathToFunc("/billing-entities/enable")();
76
+
77
+ const headers = new Headers(compactMap({
78
+ Accept: "application/json",
79
+ }));
80
+
81
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
82
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
83
+ const requestSecurity = resolveGlobalSecurity(securityInput);
84
+
85
+ const context = {
86
+ options: client._options,
87
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
88
+ operationID: "enableBillingEntities",
89
+ oAuth2Scopes: null,
90
+
91
+ resolvedSecurity: requestSecurity,
92
+
93
+ securitySource: client._options.apiKeyAuth,
94
+ retryConfig: options?.retries
95
+ || client._options.retryConfig
96
+ || { strategy: "none" },
97
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
98
+ };
99
+
100
+ const requestRes = client._createRequest(context, {
101
+ security: requestSecurity,
102
+ method: "POST",
103
+ baseURL: options?.serverURL,
104
+ path: path,
105
+ headers: headers,
106
+ userAgent: client._options.userAgent,
107
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
108
+ }, options);
109
+ if (!requestRes.ok) {
110
+ return [requestRes, { status: "invalid" }];
111
+ }
112
+ const req = requestRes.value;
113
+
114
+ const doResult = await client._do(req, {
115
+ context,
116
+ isErrorStatusCode: (statusCode: number) =>
117
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
118
+ retryConfig: context.retryConfig,
119
+ retryCodes: context.retryCodes,
120
+ });
121
+ if (!doResult.ok) {
122
+ return [doResult, { status: "request-error", request: req }];
123
+ }
124
+ const response = doResult.value;
125
+
126
+ const responseFields = {
127
+ HttpMeta: { Response: response, Request: req },
128
+ };
129
+
130
+ const [result] = await M.match<
131
+ models.BillingEntityModeResponse,
132
+ | models.ErrorsErrorResponse
133
+ | FlexPriceError
134
+ | ResponseValidationError
135
+ | ConnectionError
136
+ | RequestAbortedError
137
+ | RequestTimeoutError
138
+ | InvalidRequestError
139
+ | UnexpectedClientError
140
+ | SDKValidationError
141
+ >(
142
+ M.json([200, 202], models.BillingEntityModeResponse$inboundSchema),
143
+ M.jsonErr([400, 403], models.ErrorsErrorResponse$inboundSchema),
144
+ M.jsonErr(500, models.ErrorsErrorResponse$inboundSchema),
145
+ M.fail("4XX"),
146
+ M.fail("5XX"),
147
+ )(response, req, { extraFields: responseFields });
148
+ if (!result.ok) {
149
+ return [result, { status: "complete", request: req, response }];
150
+ }
151
+
152
+ return [result, { status: "complete", request: req, response }];
153
+ }
@@ -0,0 +1,152 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { FlexpriceCore } from "../core.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.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 { FlexPriceError } from "../sdk/models/flex-price-error.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../sdk/models/http-client-errors.js";
20
+ import * as models from "../sdk/models/index.js";
21
+ import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
22
+ import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
23
+ import { APICall, APIPromise } from "../types/async.js";
24
+ import { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * Get billing entities status
28
+ *
29
+ * @remarks
30
+ * Whether billing entities are off, enabling or enabled in the environment.
31
+ */
32
+ export function billingEntitiesGetBillingEntitiesStatus(
33
+ client: FlexpriceCore,
34
+ options?: RequestOptions,
35
+ ): APIPromise<
36
+ Result<
37
+ models.BillingEntityModeResponse,
38
+ | models.ErrorsErrorResponse
39
+ | FlexPriceError
40
+ | ResponseValidationError
41
+ | ConnectionError
42
+ | RequestAbortedError
43
+ | RequestTimeoutError
44
+ | InvalidRequestError
45
+ | UnexpectedClientError
46
+ | SDKValidationError
47
+ >
48
+ > {
49
+ return new APIPromise($do(
50
+ client,
51
+ options,
52
+ ));
53
+ }
54
+
55
+ async function $do(
56
+ client: FlexpriceCore,
57
+ options?: RequestOptions,
58
+ ): Promise<
59
+ [
60
+ Result<
61
+ models.BillingEntityModeResponse,
62
+ | models.ErrorsErrorResponse
63
+ | FlexPriceError
64
+ | ResponseValidationError
65
+ | ConnectionError
66
+ | RequestAbortedError
67
+ | RequestTimeoutError
68
+ | InvalidRequestError
69
+ | UnexpectedClientError
70
+ | SDKValidationError
71
+ >,
72
+ APICall,
73
+ ]
74
+ > {
75
+ const path = pathToFunc("/billing-entities/status")();
76
+
77
+ const headers = new Headers(compactMap({
78
+ Accept: "application/json",
79
+ }));
80
+
81
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
82
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
83
+ const requestSecurity = resolveGlobalSecurity(securityInput);
84
+
85
+ const context = {
86
+ options: client._options,
87
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
88
+ operationID: "getBillingEntitiesStatus",
89
+ oAuth2Scopes: null,
90
+
91
+ resolvedSecurity: requestSecurity,
92
+
93
+ securitySource: client._options.apiKeyAuth,
94
+ retryConfig: options?.retries
95
+ || client._options.retryConfig
96
+ || { strategy: "none" },
97
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
98
+ };
99
+
100
+ const requestRes = client._createRequest(context, {
101
+ security: requestSecurity,
102
+ method: "GET",
103
+ baseURL: options?.serverURL,
104
+ path: path,
105
+ headers: headers,
106
+ userAgent: client._options.userAgent,
107
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
108
+ }, options);
109
+ if (!requestRes.ok) {
110
+ return [requestRes, { status: "invalid" }];
111
+ }
112
+ const req = requestRes.value;
113
+
114
+ const doResult = await client._do(req, {
115
+ context,
116
+ isErrorStatusCode: (statusCode: number) =>
117
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
118
+ retryConfig: context.retryConfig,
119
+ retryCodes: context.retryCodes,
120
+ });
121
+ if (!doResult.ok) {
122
+ return [doResult, { status: "request-error", request: req }];
123
+ }
124
+ const response = doResult.value;
125
+
126
+ const responseFields = {
127
+ HttpMeta: { Response: response, Request: req },
128
+ };
129
+
130
+ const [result] = await M.match<
131
+ models.BillingEntityModeResponse,
132
+ | models.ErrorsErrorResponse
133
+ | FlexPriceError
134
+ | ResponseValidationError
135
+ | ConnectionError
136
+ | RequestAbortedError
137
+ | RequestTimeoutError
138
+ | InvalidRequestError
139
+ | UnexpectedClientError
140
+ | SDKValidationError
141
+ >(
142
+ M.json(200, models.BillingEntityModeResponse$inboundSchema),
143
+ M.jsonErr(500, models.ErrorsErrorResponse$inboundSchema),
144
+ M.fail("4XX"),
145
+ M.fail("5XX"),
146
+ )(response, req, { extraFields: responseFields });
147
+ if (!result.ok) {
148
+ return [result, { status: "complete", request: req, response }];
149
+ }
150
+
151
+ return [result, { status: "complete", request: req, response }];
152
+ }
@@ -0,0 +1,181 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { FlexpriceCore } from "../core.js";
7
+ import { encodeSimple } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
9
+ import * as M from "../lib/matchers.js";
10
+ import { compactMap } from "../lib/primitives.js";
11
+ import { safeParse } from "../lib/schemas.js";
12
+ import { RequestOptions } from "../lib/sdks.js";
13
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
14
+ import { pathToFunc } from "../lib/url.js";
15
+ import { FlexPriceError } from "../sdk/models/flex-price-error.js";
16
+ import {
17
+ ConnectionError,
18
+ InvalidRequestError,
19
+ RequestAbortedError,
20
+ RequestTimeoutError,
21
+ UnexpectedClientError,
22
+ } from "../sdk/models/http-client-errors.js";
23
+ import * as models from "../sdk/models/index.js";
24
+ import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
25
+ import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Get a billing entity
31
+ *
32
+ * @remarks
33
+ * Load a single billing entity by ID.
34
+ */
35
+ export function billingEntitiesGetBillingEntity(
36
+ client: FlexpriceCore,
37
+ id: string,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ models.BillingEntityResponse,
42
+ | models.ErrorsErrorResponse
43
+ | FlexPriceError
44
+ | ResponseValidationError
45
+ | ConnectionError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | InvalidRequestError
49
+ | UnexpectedClientError
50
+ | SDKValidationError
51
+ >
52
+ > {
53
+ return new APIPromise($do(
54
+ client,
55
+ id,
56
+ options,
57
+ ));
58
+ }
59
+
60
+ async function $do(
61
+ client: FlexpriceCore,
62
+ id: string,
63
+ options?: RequestOptions,
64
+ ): Promise<
65
+ [
66
+ Result<
67
+ models.BillingEntityResponse,
68
+ | models.ErrorsErrorResponse
69
+ | FlexPriceError
70
+ | ResponseValidationError
71
+ | ConnectionError
72
+ | RequestAbortedError
73
+ | RequestTimeoutError
74
+ | InvalidRequestError
75
+ | UnexpectedClientError
76
+ | SDKValidationError
77
+ >,
78
+ APICall,
79
+ ]
80
+ > {
81
+ const input: models.GetBillingEntityRequest = {
82
+ id: id,
83
+ };
84
+
85
+ const parsed = safeParse(
86
+ input,
87
+ (value) => z.parse(models.GetBillingEntityRequest$outboundSchema, value),
88
+ "Input validation failed",
89
+ );
90
+ if (!parsed.ok) {
91
+ return [parsed, { status: "invalid" }];
92
+ }
93
+ const payload = parsed.value;
94
+ const body = null;
95
+
96
+ const pathParams = {
97
+ id: encodeSimple("id", payload.id, {
98
+ explode: false,
99
+ charEncoding: "percent",
100
+ }),
101
+ };
102
+ const path = pathToFunc("/billing-entities/{id}")(pathParams);
103
+
104
+ const headers = new Headers(compactMap({
105
+ Accept: "application/json",
106
+ }));
107
+
108
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
109
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
110
+ const requestSecurity = resolveGlobalSecurity(securityInput);
111
+
112
+ const context = {
113
+ options: client._options,
114
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
115
+ operationID: "getBillingEntity",
116
+ oAuth2Scopes: null,
117
+
118
+ resolvedSecurity: requestSecurity,
119
+
120
+ securitySource: client._options.apiKeyAuth,
121
+ retryConfig: options?.retries
122
+ || client._options.retryConfig
123
+ || { strategy: "none" },
124
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
125
+ };
126
+
127
+ const requestRes = client._createRequest(context, {
128
+ security: requestSecurity,
129
+ method: "GET",
130
+ baseURL: options?.serverURL,
131
+ path: path,
132
+ headers: headers,
133
+ body: body,
134
+ userAgent: client._options.userAgent,
135
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
136
+ }, options);
137
+ if (!requestRes.ok) {
138
+ return [requestRes, { status: "invalid" }];
139
+ }
140
+ const req = requestRes.value;
141
+
142
+ const doResult = await client._do(req, {
143
+ context,
144
+ isErrorStatusCode: (statusCode: number) =>
145
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
146
+ retryConfig: context.retryConfig,
147
+ retryCodes: context.retryCodes,
148
+ });
149
+ if (!doResult.ok) {
150
+ return [doResult, { status: "request-error", request: req }];
151
+ }
152
+ const response = doResult.value;
153
+
154
+ const responseFields = {
155
+ HttpMeta: { Response: response, Request: req },
156
+ };
157
+
158
+ const [result] = await M.match<
159
+ models.BillingEntityResponse,
160
+ | models.ErrorsErrorResponse
161
+ | FlexPriceError
162
+ | ResponseValidationError
163
+ | ConnectionError
164
+ | RequestAbortedError
165
+ | RequestTimeoutError
166
+ | InvalidRequestError
167
+ | UnexpectedClientError
168
+ | SDKValidationError
169
+ >(
170
+ M.json(200, models.BillingEntityResponse$inboundSchema),
171
+ M.jsonErr([400, 404], models.ErrorsErrorResponse$inboundSchema),
172
+ M.jsonErr(500, models.ErrorsErrorResponse$inboundSchema),
173
+ M.fail("4XX"),
174
+ M.fail("5XX"),
175
+ )(response, req, { extraFields: responseFields });
176
+ if (!result.ok) {
177
+ return [result, { status: "complete", request: req, response }];
178
+ }
179
+
180
+ return [result, { status: "complete", request: req, response }];
181
+ }
@@ -0,0 +1,191 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { FlexpriceCore } from "../core.js";
7
+ import { encodeFormQuery, queryJoin } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
9
+ import * as M from "../lib/matchers.js";
10
+ import { compactMap } from "../lib/primitives.js";
11
+ import { safeParse } from "../lib/schemas.js";
12
+ import { RequestOptions } from "../lib/sdks.js";
13
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
14
+ import { pathToFunc } from "../lib/url.js";
15
+ import { FlexPriceError } from "../sdk/models/flex-price-error.js";
16
+ import {
17
+ ConnectionError,
18
+ InvalidRequestError,
19
+ RequestAbortedError,
20
+ RequestTimeoutError,
21
+ UnexpectedClientError,
22
+ } from "../sdk/models/http-client-errors.js";
23
+ import * as models from "../sdk/models/index.js";
24
+ import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
25
+ import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * List billing entities
31
+ *
32
+ * @remarks
33
+ * List the billing entities of this environment.
34
+ */
35
+ export function billingEntitiesListBillingEntities(
36
+ client: FlexpriceCore,
37
+ request?: models.ListBillingEntitiesRequest | undefined,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ models.ListBillingEntitiesResponse,
42
+ | models.ErrorsErrorResponse
43
+ | FlexPriceError
44
+ | ResponseValidationError
45
+ | ConnectionError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | InvalidRequestError
49
+ | UnexpectedClientError
50
+ | SDKValidationError
51
+ >
52
+ > {
53
+ return new APIPromise($do(
54
+ client,
55
+ request,
56
+ options,
57
+ ));
58
+ }
59
+
60
+ async function $do(
61
+ client: FlexpriceCore,
62
+ request?: models.ListBillingEntitiesRequest | undefined,
63
+ options?: RequestOptions,
64
+ ): Promise<
65
+ [
66
+ Result<
67
+ models.ListBillingEntitiesResponse,
68
+ | models.ErrorsErrorResponse
69
+ | FlexPriceError
70
+ | ResponseValidationError
71
+ | ConnectionError
72
+ | RequestAbortedError
73
+ | RequestTimeoutError
74
+ | InvalidRequestError
75
+ | UnexpectedClientError
76
+ | SDKValidationError
77
+ >,
78
+ APICall,
79
+ ]
80
+ > {
81
+ const parsed = safeParse(
82
+ request,
83
+ (value) =>
84
+ z.parse(
85
+ z.optional(models.ListBillingEntitiesRequest$outboundSchema),
86
+ value,
87
+ ),
88
+ "Input validation failed",
89
+ );
90
+ if (!parsed.ok) {
91
+ return [parsed, { status: "invalid" }];
92
+ }
93
+ const payload = parsed.value;
94
+ const body = null;
95
+
96
+ const path = pathToFunc("/billing-entities")();
97
+
98
+ const query = queryJoin(
99
+ encodeFormQuery({
100
+ "billing_entity_ids": payload?.billing_entity_ids,
101
+ }, { explode: false }),
102
+ encodeFormQuery({
103
+ "expand": payload?.expand,
104
+ "is_default": payload?.is_default,
105
+ "limit": payload?.limit,
106
+ "offset": payload?.offset,
107
+ "order": payload?.order,
108
+ "sort": payload?.sort,
109
+ "status": payload?.status,
110
+ }),
111
+ );
112
+
113
+ const headers = new Headers(compactMap({
114
+ Accept: "application/json",
115
+ }));
116
+
117
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
118
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
119
+ const requestSecurity = resolveGlobalSecurity(securityInput);
120
+
121
+ const context = {
122
+ options: client._options,
123
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
124
+ operationID: "listBillingEntities",
125
+ oAuth2Scopes: null,
126
+
127
+ resolvedSecurity: requestSecurity,
128
+
129
+ securitySource: client._options.apiKeyAuth,
130
+ retryConfig: options?.retries
131
+ || client._options.retryConfig
132
+ || { strategy: "none" },
133
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
134
+ };
135
+
136
+ const requestRes = client._createRequest(context, {
137
+ security: requestSecurity,
138
+ method: "GET",
139
+ baseURL: options?.serverURL,
140
+ path: path,
141
+ headers: headers,
142
+ query: query,
143
+ body: body,
144
+ userAgent: client._options.userAgent,
145
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
146
+ }, options);
147
+ if (!requestRes.ok) {
148
+ return [requestRes, { status: "invalid" }];
149
+ }
150
+ const req = requestRes.value;
151
+
152
+ const doResult = await client._do(req, {
153
+ context,
154
+ isErrorStatusCode: (statusCode: number) =>
155
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "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
+ models.ListBillingEntitiesResponse,
170
+ | models.ErrorsErrorResponse
171
+ | FlexPriceError
172
+ | ResponseValidationError
173
+ | ConnectionError
174
+ | RequestAbortedError
175
+ | RequestTimeoutError
176
+ | InvalidRequestError
177
+ | UnexpectedClientError
178
+ | SDKValidationError
179
+ >(
180
+ M.json(200, models.ListBillingEntitiesResponse$inboundSchema),
181
+ M.jsonErr(400, models.ErrorsErrorResponse$inboundSchema),
182
+ M.jsonErr(500, models.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
+ }