@flexprice/sdk 2.1.48 → 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 +2 -2
  58. package/esm/lib/config.d.ts.map +1 -1
  59. package/esm/lib/config.js +2 -2
  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 +3 -3
  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 +3 -2
  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,187 @@
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 { encodeJSON, 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
+ * Update a billing entity
31
+ *
32
+ * @remarks
33
+ * Edit a billing entity. Drafts and future invoices use the new details; finalized invoices keep theirs.
34
+ */
35
+ export function billingEntitiesUpdateBillingEntity(
36
+ client: FlexpriceCore,
37
+ id: string,
38
+ body: models.UpdateBillingEntityRequest,
39
+ options?: RequestOptions,
40
+ ): APIPromise<
41
+ Result<
42
+ models.BillingEntityResponse,
43
+ | models.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
+ id,
57
+ body,
58
+ options,
59
+ ));
60
+ }
61
+
62
+ async function $do(
63
+ client: FlexpriceCore,
64
+ id: string,
65
+ body: models.UpdateBillingEntityRequest,
66
+ options?: RequestOptions,
67
+ ): Promise<
68
+ [
69
+ Result<
70
+ models.BillingEntityResponse,
71
+ | models.ErrorsErrorResponse
72
+ | FlexPriceError
73
+ | ResponseValidationError
74
+ | ConnectionError
75
+ | RequestAbortedError
76
+ | RequestTimeoutError
77
+ | InvalidRequestError
78
+ | UnexpectedClientError
79
+ | SDKValidationError
80
+ >,
81
+ APICall,
82
+ ]
83
+ > {
84
+ const input: models.UpdateBillingEntityRequestRequest = {
85
+ id: id,
86
+ body: body,
87
+ };
88
+
89
+ const parsed = safeParse(
90
+ input,
91
+ (value) =>
92
+ z.parse(models.UpdateBillingEntityRequestRequest$outboundSchema, value),
93
+ "Input validation failed",
94
+ );
95
+ if (!parsed.ok) {
96
+ return [parsed, { status: "invalid" }];
97
+ }
98
+ const payload = parsed.value;
99
+ const body$ = encodeJSON("body", payload.body, { explode: true });
100
+
101
+ const pathParams = {
102
+ id: encodeSimple("id", payload.id, {
103
+ explode: false,
104
+ charEncoding: "percent",
105
+ }),
106
+ };
107
+ const path = pathToFunc("/billing-entities/{id}")(pathParams);
108
+
109
+ const headers = new Headers(compactMap({
110
+ "Content-Type": "application/json",
111
+ Accept: "application/json",
112
+ }));
113
+
114
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
115
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
116
+ const requestSecurity = resolveGlobalSecurity(securityInput);
117
+
118
+ const context = {
119
+ options: client._options,
120
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
121
+ operationID: "updateBillingEntity",
122
+ oAuth2Scopes: null,
123
+
124
+ resolvedSecurity: requestSecurity,
125
+
126
+ securitySource: client._options.apiKeyAuth,
127
+ retryConfig: options?.retries
128
+ || client._options.retryConfig
129
+ || { strategy: "none" },
130
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
131
+ };
132
+
133
+ const requestRes = client._createRequest(context, {
134
+ security: requestSecurity,
135
+ method: "PUT",
136
+ baseURL: options?.serverURL,
137
+ path: path,
138
+ headers: headers,
139
+ body: body$,
140
+ userAgent: client._options.userAgent,
141
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
142
+ }, options);
143
+ if (!requestRes.ok) {
144
+ return [requestRes, { status: "invalid" }];
145
+ }
146
+ const req = requestRes.value;
147
+
148
+ const doResult = await client._do(req, {
149
+ context,
150
+ isErrorStatusCode: (statusCode: number) =>
151
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
152
+ retryConfig: context.retryConfig,
153
+ retryCodes: context.retryCodes,
154
+ });
155
+ if (!doResult.ok) {
156
+ return [doResult, { status: "request-error", request: req }];
157
+ }
158
+ const response = doResult.value;
159
+
160
+ const responseFields = {
161
+ HttpMeta: { Response: response, Request: req },
162
+ };
163
+
164
+ const [result] = await M.match<
165
+ models.BillingEntityResponse,
166
+ | models.ErrorsErrorResponse
167
+ | FlexPriceError
168
+ | ResponseValidationError
169
+ | ConnectionError
170
+ | RequestAbortedError
171
+ | RequestTimeoutError
172
+ | InvalidRequestError
173
+ | UnexpectedClientError
174
+ | SDKValidationError
175
+ >(
176
+ M.json(200, models.BillingEntityResponse$inboundSchema),
177
+ M.jsonErr([400, 404, 409], models.ErrorsErrorResponse$inboundSchema),
178
+ M.jsonErr(500, models.ErrorsErrorResponse$inboundSchema),
179
+ M.fail("4XX"),
180
+ M.fail("5XX"),
181
+ )(response, req, { extraFields: responseFields });
182
+ if (!result.ok) {
183
+ return [result, { status: "complete", request: req, response }];
184
+ }
185
+
186
+ return [result, { status: "complete", request: req, response }];
187
+ }
@@ -174,7 +174,7 @@ async function $do(
174
174
  | SDKValidationError
175
175
  >(
176
176
  M.json(200, models.CancelSubscriptionResponse$inboundSchema),
177
- M.jsonErr(400, models.ErrorsErrorResponse$inboundSchema),
177
+ M.jsonErr([400, 409], models.ErrorsErrorResponse$inboundSchema),
178
178
  M.jsonErr(500, models.ErrorsErrorResponse$inboundSchema),
179
179
  M.fail("4XX"),
180
180
  M.fail("5XX"),
package/src/lib/config.ts CHANGED
@@ -77,7 +77,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
77
77
  export const SDK_METADATA = {
78
78
  language: "typescript",
79
79
  openapiDocVersion: "1.0",
80
- sdkVersion: "2.1.48",
80
+ sdkVersion: "2.1.49-dev.10",
81
81
  genVersion: "2.948.4",
82
- userAgent: "speakeasy-sdk/typescript 2.1.48 2.948.4 1.0 @flexprice/sdk",
82
+ userAgent:
83
+ "speakeasy-sdk/typescript 2.1.49-dev.10 2.948.4 1.0 @flexprice/sdk",
83
84
  } as const;
@@ -0,0 +1,115 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { billingEntitiesCreateBillingEntity } from "../funcs/billing-entities-create-billing-entity.js";
6
+ import { billingEntitiesEnableBillingEntities } from "../funcs/billing-entities-enable-billing-entities.js";
7
+ import { billingEntitiesGetBillingEntitiesStatus } from "../funcs/billing-entities-get-billing-entities-status.js";
8
+ import { billingEntitiesGetBillingEntity } from "../funcs/billing-entities-get-billing-entity.js";
9
+ import { billingEntitiesListBillingEntities } from "../funcs/billing-entities-list-billing-entities.js";
10
+ import { billingEntitiesUpdateBillingEntity } from "../funcs/billing-entities-update-billing-entity.js";
11
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
12
+ import { unwrapAsync } from "../types/fp.js";
13
+ import * as models from "./models/index.js";
14
+
15
+ export class BillingEntities extends ClientSDK {
16
+ /**
17
+ * List billing entities
18
+ *
19
+ * @remarks
20
+ * List the billing entities of this environment.
21
+ */
22
+ async listBillingEntities(
23
+ request?: models.ListBillingEntitiesRequest | undefined,
24
+ options?: RequestOptions,
25
+ ): Promise<models.ListBillingEntitiesResponse> {
26
+ return unwrapAsync(billingEntitiesListBillingEntities(
27
+ this,
28
+ request,
29
+ options,
30
+ ));
31
+ }
32
+
33
+ /**
34
+ * Create a billing entity
35
+ *
36
+ * @remarks
37
+ * Create a legal entity that bills customers in this environment. Requires billing entities to be enabled.
38
+ */
39
+ async createBillingEntity(
40
+ request: models.CreateBillingEntityRequest,
41
+ options?: RequestOptions,
42
+ ): Promise<models.BillingEntityResponse> {
43
+ return unwrapAsync(billingEntitiesCreateBillingEntity(
44
+ this,
45
+ request,
46
+ options,
47
+ ));
48
+ }
49
+
50
+ /**
51
+ * Enable billing entities
52
+ *
53
+ * @remarks
54
+ * Start enabling billing entities in the environment. The environment gets a default entity and its existing customers are assigned to it. Irreversible.
55
+ */
56
+ async enableBillingEntities(
57
+ options?: RequestOptions,
58
+ ): Promise<models.BillingEntityModeResponse> {
59
+ return unwrapAsync(billingEntitiesEnableBillingEntities(
60
+ this,
61
+ options,
62
+ ));
63
+ }
64
+
65
+ /**
66
+ * Get billing entities status
67
+ *
68
+ * @remarks
69
+ * Whether billing entities are off, enabling or enabled in the environment.
70
+ */
71
+ async getBillingEntitiesStatus(
72
+ options?: RequestOptions,
73
+ ): Promise<models.BillingEntityModeResponse> {
74
+ return unwrapAsync(billingEntitiesGetBillingEntitiesStatus(
75
+ this,
76
+ options,
77
+ ));
78
+ }
79
+
80
+ /**
81
+ * Get a billing entity
82
+ *
83
+ * @remarks
84
+ * Load a single billing entity by ID.
85
+ */
86
+ async getBillingEntity(
87
+ id: string,
88
+ options?: RequestOptions,
89
+ ): Promise<models.BillingEntityResponse> {
90
+ return unwrapAsync(billingEntitiesGetBillingEntity(
91
+ this,
92
+ id,
93
+ options,
94
+ ));
95
+ }
96
+
97
+ /**
98
+ * Update a billing entity
99
+ *
100
+ * @remarks
101
+ * Edit a billing entity. Drafts and future invoices use the new details; finalized invoices keep theirs.
102
+ */
103
+ async updateBillingEntity(
104
+ id: string,
105
+ body: models.UpdateBillingEntityRequest,
106
+ options?: RequestOptions,
107
+ ): Promise<models.BillingEntityResponse> {
108
+ return unwrapAsync(billingEntitiesUpdateBillingEntity(
109
+ this,
110
+ id,
111
+ body,
112
+ options,
113
+ ));
114
+ }
115
+ }
@@ -0,0 +1,91 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "./sdk-validation-error.js";
11
+
12
+ export type BillingAddress = {
13
+ addressCity?: string | undefined;
14
+ addressCountry?: string | undefined;
15
+ addressLine1?: string | undefined;
16
+ addressLine2?: string | undefined;
17
+ addressPostalCode?: string | undefined;
18
+ addressState?: string | undefined;
19
+ };
20
+
21
+ /** @internal */
22
+ export const BillingAddress$inboundSchema: z.ZodMiniType<
23
+ BillingAddress,
24
+ unknown
25
+ > = z.pipe(
26
+ z.object({
27
+ address_city: types.optional(types.string()),
28
+ address_country: types.optional(types.string()),
29
+ address_line1: types.optional(types.string()),
30
+ address_line2: types.optional(types.string()),
31
+ address_postal_code: types.optional(types.string()),
32
+ address_state: types.optional(types.string()),
33
+ }),
34
+ z.transform((v) => {
35
+ return remap$(v, {
36
+ "address_city": "addressCity",
37
+ "address_country": "addressCountry",
38
+ "address_line1": "addressLine1",
39
+ "address_line2": "addressLine2",
40
+ "address_postal_code": "addressPostalCode",
41
+ "address_state": "addressState",
42
+ });
43
+ }),
44
+ );
45
+ /** @internal */
46
+ export type BillingAddress$Outbound = {
47
+ address_city?: string | undefined;
48
+ address_country?: string | undefined;
49
+ address_line1?: string | undefined;
50
+ address_line2?: string | undefined;
51
+ address_postal_code?: string | undefined;
52
+ address_state?: string | undefined;
53
+ };
54
+
55
+ /** @internal */
56
+ export const BillingAddress$outboundSchema: z.ZodMiniType<
57
+ BillingAddress$Outbound,
58
+ BillingAddress
59
+ > = z.pipe(
60
+ z.object({
61
+ addressCity: z.optional(z.string()),
62
+ addressCountry: z.optional(z.string()),
63
+ addressLine1: z.optional(z.string()),
64
+ addressLine2: z.optional(z.string()),
65
+ addressPostalCode: z.optional(z.string()),
66
+ addressState: z.optional(z.string()),
67
+ }),
68
+ z.transform((v) => {
69
+ return remap$(v, {
70
+ addressCity: "address_city",
71
+ addressCountry: "address_country",
72
+ addressLine1: "address_line1",
73
+ addressLine2: "address_line2",
74
+ addressPostalCode: "address_postal_code",
75
+ addressState: "address_state",
76
+ });
77
+ }),
78
+ );
79
+
80
+ export function billingAddressToJSON(billingAddress: BillingAddress): string {
81
+ return JSON.stringify(BillingAddress$outboundSchema.parse(billingAddress));
82
+ }
83
+ export function billingAddressFromJSON(
84
+ jsonString: string,
85
+ ): SafeParseResult<BillingAddress, SDKValidationError> {
86
+ return safeParse(
87
+ jsonString,
88
+ (x) => BillingAddress$inboundSchema.parse(JSON.parse(x)),
89
+ `Failed to parse 'BillingAddress' from JSON`,
90
+ );
91
+ }
@@ -0,0 +1,79 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import {
11
+ BillingAddress,
12
+ BillingAddress$inboundSchema,
13
+ BillingAddress$Outbound,
14
+ BillingAddress$outboundSchema,
15
+ } from "./billing-address.js";
16
+ import { SDKValidationError } from "./sdk-validation-error.js";
17
+
18
+ export type BillingDetails = {
19
+ address?: BillingAddress | undefined;
20
+ email?: string | undefined;
21
+ helpEmail?: string | undefined;
22
+ phone?: string | undefined;
23
+ };
24
+
25
+ /** @internal */
26
+ export const BillingDetails$inboundSchema: z.ZodMiniType<
27
+ BillingDetails,
28
+ unknown
29
+ > = z.pipe(
30
+ z.object({
31
+ address: types.optional(BillingAddress$inboundSchema),
32
+ email: types.optional(types.string()),
33
+ help_email: types.optional(types.string()),
34
+ phone: types.optional(types.string()),
35
+ }),
36
+ z.transform((v) => {
37
+ return remap$(v, {
38
+ "help_email": "helpEmail",
39
+ });
40
+ }),
41
+ );
42
+ /** @internal */
43
+ export type BillingDetails$Outbound = {
44
+ address?: BillingAddress$Outbound | undefined;
45
+ email?: string | undefined;
46
+ help_email?: string | undefined;
47
+ phone?: string | undefined;
48
+ };
49
+
50
+ /** @internal */
51
+ export const BillingDetails$outboundSchema: z.ZodMiniType<
52
+ BillingDetails$Outbound,
53
+ BillingDetails
54
+ > = z.pipe(
55
+ z.object({
56
+ address: z.optional(BillingAddress$outboundSchema),
57
+ email: z.optional(z.string()),
58
+ helpEmail: z.optional(z.string()),
59
+ phone: z.optional(z.string()),
60
+ }),
61
+ z.transform((v) => {
62
+ return remap$(v, {
63
+ helpEmail: "help_email",
64
+ });
65
+ }),
66
+ );
67
+
68
+ export function billingDetailsToJSON(billingDetails: BillingDetails): string {
69
+ return JSON.stringify(BillingDetails$outboundSchema.parse(billingDetails));
70
+ }
71
+ export function billingDetailsFromJSON(
72
+ jsonString: string,
73
+ ): SafeParseResult<BillingDetails, SDKValidationError> {
74
+ return safeParse(
75
+ jsonString,
76
+ (x) => BillingDetails$inboundSchema.parse(JSON.parse(x)),
77
+ `Failed to parse 'BillingDetails' from JSON`,
78
+ );
79
+ }
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import * as types from "../../types/primitives.js";
9
+ import {
10
+ BillingEntityMode,
11
+ BillingEntityMode$inboundSchema,
12
+ } from "./billing-entity-mode.js";
13
+ import { SDKValidationError } from "./sdk-validation-error.js";
14
+
15
+ export type BillingEntityModeResponse = {
16
+ mode?: BillingEntityMode | undefined;
17
+ };
18
+
19
+ /** @internal */
20
+ export const BillingEntityModeResponse$inboundSchema: z.ZodMiniType<
21
+ BillingEntityModeResponse,
22
+ unknown
23
+ > = z.object({
24
+ mode: types.optional(BillingEntityMode$inboundSchema),
25
+ });
26
+
27
+ export function billingEntityModeResponseFromJSON(
28
+ jsonString: string,
29
+ ): SafeParseResult<BillingEntityModeResponse, SDKValidationError> {
30
+ return safeParse(
31
+ jsonString,
32
+ (x) => BillingEntityModeResponse$inboundSchema.parse(JSON.parse(x)),
33
+ `Failed to parse 'BillingEntityModeResponse' from JSON`,
34
+ );
35
+ }
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import * as openEnums from "../../types/enums.js";
7
+ import { OpenEnum } from "../../types/enums.js";
8
+
9
+ export const BillingEntityMode = {
10
+ Off: "off",
11
+ Enabling: "enabling",
12
+ Enabled: "enabled",
13
+ } as const;
14
+ export type BillingEntityMode = OpenEnum<typeof BillingEntityMode>;
15
+
16
+ /** @internal */
17
+ export const BillingEntityMode$inboundSchema: z.ZodMiniType<
18
+ BillingEntityMode,
19
+ unknown
20
+ > = openEnums.inboundSchema(BillingEntityMode);
@@ -0,0 +1,76 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import {
11
+ BillingDetails,
12
+ BillingDetails$inboundSchema,
13
+ } from "./billing-details.js";
14
+ import { SDKValidationError } from "./sdk-validation-error.js";
15
+ import { Status, Status$inboundSchema } from "./status.js";
16
+
17
+ export type BillingEntityResponse = {
18
+ billingDetails?: BillingDetails | undefined;
19
+ createdAt?: Date | undefined;
20
+ createdBy?: string | undefined;
21
+ environmentId?: string | undefined;
22
+ id?: string | undefined;
23
+ invoiceNumberPrefix?: string | undefined;
24
+ isDefault?: boolean | undefined;
25
+ metadata?: { [k: string]: string } | undefined;
26
+ name?: string | undefined;
27
+ status?: Status | undefined;
28
+ tenantId?: string | undefined;
29
+ updatedAt?: Date | undefined;
30
+ updatedBy?: string | undefined;
31
+ };
32
+
33
+ /** @internal */
34
+ export const BillingEntityResponse$inboundSchema: z.ZodMiniType<
35
+ BillingEntityResponse,
36
+ unknown
37
+ > = z.pipe(
38
+ z.object({
39
+ billing_details: types.optional(BillingDetails$inboundSchema),
40
+ created_at: types.optional(types.date()),
41
+ created_by: types.optional(types.string()),
42
+ environment_id: types.optional(types.string()),
43
+ id: types.optional(types.string()),
44
+ invoice_number_prefix: types.optional(types.string()),
45
+ is_default: types.optional(types.boolean()),
46
+ metadata: types.optional(z.record(z.string(), types.string())),
47
+ name: types.optional(types.string()),
48
+ status: types.optional(Status$inboundSchema),
49
+ tenant_id: types.optional(types.string()),
50
+ updated_at: types.optional(types.date()),
51
+ updated_by: types.optional(types.string()),
52
+ }),
53
+ z.transform((v) => {
54
+ return remap$(v, {
55
+ "billing_details": "billingDetails",
56
+ "created_at": "createdAt",
57
+ "created_by": "createdBy",
58
+ "environment_id": "environmentId",
59
+ "invoice_number_prefix": "invoiceNumberPrefix",
60
+ "is_default": "isDefault",
61
+ "tenant_id": "tenantId",
62
+ "updated_at": "updatedAt",
63
+ "updated_by": "updatedBy",
64
+ });
65
+ }),
66
+ );
67
+
68
+ export function billingEntityResponseFromJSON(
69
+ jsonString: string,
70
+ ): SafeParseResult<BillingEntityResponse, SDKValidationError> {
71
+ return safeParse(
72
+ jsonString,
73
+ (x) => BillingEntityResponse$inboundSchema.parse(JSON.parse(x)),
74
+ `Failed to parse 'BillingEntityResponse' from JSON`,
75
+ );
76
+ }
@@ -45,6 +45,10 @@ export type BillingtermInstalment = {
45
45
  instalmentStatus?: InstalmentStatus | undefined;
46
46
  invoiceId?: string | undefined;
47
47
  invoiceLabel?: string | undefined;
48
+ /**
49
+ * InvoicedAt is when the invoice billing the instalment was finalized.
50
+ */
51
+ invoicedAt?: Date | undefined;
48
52
  kind?: InstalmentKind | undefined;
49
53
  metadata?: { [k: string]: string } | undefined;
50
54
  ownerId?: string | undefined;
@@ -79,6 +83,7 @@ export const BillingtermInstalment$inboundSchema: z.ZodMiniType<
79
83
  instalment_status: types.optional(InstalmentStatus$inboundSchema),
80
84
  invoice_id: types.optional(types.string()),
81
85
  invoice_label: types.optional(types.string()),
86
+ invoiced_at: types.optional(types.date()),
82
87
  kind: types.optional(InstalmentKind$inboundSchema),
83
88
  metadata: types.optional(z.record(z.string(), types.string())),
84
89
  owner_id: types.optional(types.string()),
@@ -104,6 +109,7 @@ export const BillingtermInstalment$inboundSchema: z.ZodMiniType<
104
109
  "instalment_status": "instalmentStatus",
105
110
  "invoice_id": "invoiceId",
106
111
  "invoice_label": "invoiceLabel",
112
+ "invoiced_at": "invoicedAt",
107
113
  "owner_id": "ownerId",
108
114
  "owner_type": "ownerType",
109
115
  "service_period_end": "servicePeriodEnd",