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

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 (189) 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/create-billing-entity-request.md +21 -0
  7. package/docs/sdk/models/create-customer-request.md +1 -0
  8. package/docs/sdk/models/customer-filter.md +1 -0
  9. package/docs/sdk/models/customer-response.md +1 -0
  10. package/docs/sdk/models/customer.md +1 -0
  11. package/docs/sdk/models/get-billing-entity-request.md +17 -0
  12. package/docs/sdk/models/invoice-billing-entity.md +17 -0
  13. package/docs/sdk/models/invoice-filter.md +1 -0
  14. package/docs/sdk/models/invoice-response.md +2 -0
  15. package/docs/sdk/models/list-billing-entities-order.md +15 -0
  16. package/docs/sdk/models/list-billing-entities-request.md +22 -0
  17. package/docs/sdk/models/list-billing-entities-response.md +16 -0
  18. package/docs/sdk/models/list-billing-entities-status.md +15 -0
  19. package/docs/sdk/models/tax-rate-entity-type.md +2 -2
  20. package/docs/sdk/models/update-billing-entity-request-request.md +19 -0
  21. package/docs/sdk/models/update-billing-entity-request.md +18 -0
  22. package/docs/sdk/models/update-customer-request.md +1 -0
  23. package/docs/sdk/models/webhook-dto-customer.md +1 -0
  24. package/docs/sdk/models/webhook-dto-invoice.md +1 -0
  25. package/docs/sdks/billingentities/README.md +442 -0
  26. package/docs/sdks/subscriptions/README.md +1 -1
  27. package/esm/funcs/billing-entities-create-billing-entity.d.ts +17 -0
  28. package/esm/funcs/billing-entities-create-billing-entity.d.ts.map +1 -0
  29. package/esm/funcs/billing-entities-create-billing-entity.js +83 -0
  30. package/esm/funcs/billing-entities-create-billing-entity.js.map +1 -0
  31. package/esm/funcs/billing-entities-enable-billing-entities.d.ts +17 -0
  32. package/esm/funcs/billing-entities-enable-billing-entities.d.ts.map +1 -0
  33. package/esm/funcs/billing-entities-enable-billing-entities.js +72 -0
  34. package/esm/funcs/billing-entities-enable-billing-entities.js.map +1 -0
  35. package/esm/funcs/billing-entities-get-billing-entities-status.d.ts +17 -0
  36. package/esm/funcs/billing-entities-get-billing-entities-status.d.ts.map +1 -0
  37. package/esm/funcs/billing-entities-get-billing-entities-status.js +72 -0
  38. package/esm/funcs/billing-entities-get-billing-entities-status.js.map +1 -0
  39. package/esm/funcs/billing-entities-get-billing-entity.d.ts +17 -0
  40. package/esm/funcs/billing-entities-get-billing-entity.d.ts.map +1 -0
  41. package/esm/funcs/billing-entities-get-billing-entity.js +91 -0
  42. package/esm/funcs/billing-entities-get-billing-entity.js.map +1 -0
  43. package/esm/funcs/billing-entities-list-billing-entities.d.ts +17 -0
  44. package/esm/funcs/billing-entities-list-billing-entities.d.ts.map +1 -0
  45. package/esm/funcs/billing-entities-list-billing-entities.js +94 -0
  46. package/esm/funcs/billing-entities-list-billing-entities.js.map +1 -0
  47. package/esm/funcs/billing-entities-update-billing-entity.d.ts +17 -0
  48. package/esm/funcs/billing-entities-update-billing-entity.d.ts.map +1 -0
  49. package/esm/funcs/billing-entities-update-billing-entity.js +93 -0
  50. package/esm/funcs/billing-entities-update-billing-entity.js.map +1 -0
  51. package/esm/funcs/subscriptions-cancel-subscription.js +1 -1
  52. package/esm/funcs/subscriptions-cancel-subscription.js.map +1 -1
  53. package/esm/lib/config.d.ts +2 -2
  54. package/esm/lib/config.js +2 -2
  55. package/esm/sdk/billing-entities.d.ts +47 -0
  56. package/esm/sdk/billing-entities.d.ts.map +1 -0
  57. package/esm/sdk/billing-entities.js +68 -0
  58. package/esm/sdk/billing-entities.js.map +1 -0
  59. package/esm/sdk/models/billing-address.d.ts +27 -0
  60. package/esm/sdk/models/billing-address.d.ts.map +1 -0
  61. package/esm/sdk/models/billing-address.js +50 -0
  62. package/esm/sdk/models/billing-address.js.map +1 -0
  63. package/esm/sdk/models/billing-details.d.ts +24 -0
  64. package/esm/sdk/models/billing-details.d.ts.map +1 -0
  65. package/esm/sdk/models/billing-details.js +37 -0
  66. package/esm/sdk/models/billing-details.js.map +1 -0
  67. package/esm/sdk/models/billing-entity-mode-response.d.ts +11 -0
  68. package/esm/sdk/models/billing-entity-mode-response.d.ts.map +1 -0
  69. package/esm/sdk/models/billing-entity-mode-response.js +15 -0
  70. package/esm/sdk/models/billing-entity-mode-response.js.map +1 -0
  71. package/esm/sdk/models/billing-entity-mode.d.ts +11 -0
  72. package/esm/sdk/models/billing-entity-mode.d.ts.map +1 -0
  73. package/esm/sdk/models/billing-entity-mode.js +12 -0
  74. package/esm/sdk/models/billing-entity-mode.js.map +1 -0
  75. package/esm/sdk/models/billing-entity-response.d.ts +26 -0
  76. package/esm/sdk/models/billing-entity-response.d.ts.map +1 -0
  77. package/esm/sdk/models/billing-entity-response.js +41 -0
  78. package/esm/sdk/models/billing-entity-response.js.map +1 -0
  79. package/esm/sdk/models/create-billing-entity-request.d.ts +23 -0
  80. package/esm/sdk/models/create-billing-entity-request.d.ts.map +1 -0
  81. package/esm/sdk/models/create-billing-entity-request.js +22 -0
  82. package/esm/sdk/models/create-billing-entity-request.js.map +1 -0
  83. package/esm/sdk/models/create-customer-request.d.ts +8 -0
  84. package/esm/sdk/models/create-customer-request.d.ts.map +1 -1
  85. package/esm/sdk/models/create-customer-request.js +2 -0
  86. package/esm/sdk/models/create-customer-request.js.map +1 -1
  87. package/esm/sdk/models/customer-filter.d.ts +5 -0
  88. package/esm/sdk/models/customer-filter.d.ts.map +1 -1
  89. package/esm/sdk/models/customer-filter.js +2 -0
  90. package/esm/sdk/models/customer-filter.js.map +1 -1
  91. package/esm/sdk/models/customer-response.d.ts +4 -0
  92. package/esm/sdk/models/customer-response.d.ts.map +1 -1
  93. package/esm/sdk/models/customer-response.js +2 -0
  94. package/esm/sdk/models/customer-response.js.map +1 -1
  95. package/esm/sdk/models/customer.d.ts +4 -0
  96. package/esm/sdk/models/customer.d.ts.map +1 -1
  97. package/esm/sdk/models/customer.js +2 -0
  98. package/esm/sdk/models/customer.js.map +1 -1
  99. package/esm/sdk/models/get-billing-entity-op.d.ts +15 -0
  100. package/esm/sdk/models/get-billing-entity-op.d.ts.map +1 -0
  101. package/esm/sdk/models/get-billing-entity-op.js +12 -0
  102. package/esm/sdk/models/get-billing-entity-op.js.map +1 -0
  103. package/esm/sdk/models/index.d.ts +12 -0
  104. package/esm/sdk/models/index.d.ts.map +1 -1
  105. package/esm/sdk/models/index.js +12 -0
  106. package/esm/sdk/models/index.js.map +1 -1
  107. package/esm/sdk/models/invoice-billing-entity.d.ts +13 -0
  108. package/esm/sdk/models/invoice-billing-entity.d.ts.map +1 -0
  109. package/esm/sdk/models/invoice-billing-entity.js +23 -0
  110. package/esm/sdk/models/invoice-billing-entity.js.map +1 -0
  111. package/esm/sdk/models/invoice-filter.d.ts +5 -0
  112. package/esm/sdk/models/invoice-filter.d.ts.map +1 -1
  113. package/esm/sdk/models/invoice-filter.js +2 -0
  114. package/esm/sdk/models/invoice-filter.js.map +1 -1
  115. package/esm/sdk/models/invoice-response.d.ts +6 -0
  116. package/esm/sdk/models/invoice-response.d.ts.map +1 -1
  117. package/esm/sdk/models/invoice-response.js +5 -0
  118. package/esm/sdk/models/invoice-response.js.map +1 -1
  119. package/esm/sdk/models/list-billing-entities-op.d.ts +42 -0
  120. package/esm/sdk/models/list-billing-entities-op.d.ts.map +1 -0
  121. package/esm/sdk/models/list-billing-entities-op.js +38 -0
  122. package/esm/sdk/models/list-billing-entities-op.js.map +1 -0
  123. package/esm/sdk/models/list-billing-entities-response.d.ts +13 -0
  124. package/esm/sdk/models/list-billing-entities-response.d.ts.map +1 -0
  125. package/esm/sdk/models/list-billing-entities-response.js +17 -0
  126. package/esm/sdk/models/list-billing-entities-response.js.map +1 -0
  127. package/esm/sdk/models/tax-rate-entity-type.d.ts +1 -0
  128. package/esm/sdk/models/tax-rate-entity-type.d.ts.map +1 -1
  129. package/esm/sdk/models/tax-rate-entity-type.js +1 -0
  130. package/esm/sdk/models/tax-rate-entity-type.js.map +1 -1
  131. package/esm/sdk/models/update-billing-entity-op.d.ts +21 -0
  132. package/esm/sdk/models/update-billing-entity-op.d.ts.map +1 -0
  133. package/esm/sdk/models/update-billing-entity-op.js +14 -0
  134. package/esm/sdk/models/update-billing-entity-op.js.map +1 -0
  135. package/esm/sdk/models/update-billing-entity-request.d.ts +23 -0
  136. package/esm/sdk/models/update-billing-entity-request.d.ts.map +1 -0
  137. package/esm/sdk/models/update-billing-entity-request.js +22 -0
  138. package/esm/sdk/models/update-billing-entity-request.js.map +1 -0
  139. package/esm/sdk/models/update-customer-request.d.ts +5 -0
  140. package/esm/sdk/models/update-customer-request.d.ts.map +1 -1
  141. package/esm/sdk/models/update-customer-request.js +2 -0
  142. package/esm/sdk/models/update-customer-request.js.map +1 -1
  143. package/esm/sdk/models/webhook-dto-customer.d.ts +1 -0
  144. package/esm/sdk/models/webhook-dto-customer.d.ts.map +1 -1
  145. package/esm/sdk/models/webhook-dto-customer.js +2 -0
  146. package/esm/sdk/models/webhook-dto-customer.js.map +1 -1
  147. package/esm/sdk/models/webhook-dto-invoice.d.ts +1 -0
  148. package/esm/sdk/models/webhook-dto-invoice.d.ts.map +1 -1
  149. package/esm/sdk/models/webhook-dto-invoice.js +2 -0
  150. package/esm/sdk/models/webhook-dto-invoice.js.map +1 -1
  151. package/esm/sdk/sdk.d.ts +3 -0
  152. package/esm/sdk/sdk.d.ts.map +1 -1
  153. package/esm/sdk/sdk.js +5 -0
  154. package/esm/sdk/sdk.js.map +1 -1
  155. package/jsr.json +1 -1
  156. package/package.json +2 -2
  157. package/src/funcs/billing-entities-create-billing-entity.ts +172 -0
  158. package/src/funcs/billing-entities-enable-billing-entities.ts +153 -0
  159. package/src/funcs/billing-entities-get-billing-entities-status.ts +152 -0
  160. package/src/funcs/billing-entities-get-billing-entity.ts +181 -0
  161. package/src/funcs/billing-entities-list-billing-entities.ts +191 -0
  162. package/src/funcs/billing-entities-update-billing-entity.ts +187 -0
  163. package/src/funcs/subscriptions-cancel-subscription.ts +1 -1
  164. package/src/lib/config.ts +2 -2
  165. package/src/sdk/billing-entities.ts +115 -0
  166. package/src/sdk/models/billing-address.ts +91 -0
  167. package/src/sdk/models/billing-details.ts +79 -0
  168. package/src/sdk/models/billing-entity-mode-response.ts +35 -0
  169. package/src/sdk/models/billing-entity-mode.ts +20 -0
  170. package/src/sdk/models/billing-entity-response.ts +76 -0
  171. package/src/sdk/models/create-billing-entity-request.ts +53 -0
  172. package/src/sdk/models/create-customer-request.ts +10 -0
  173. package/src/sdk/models/customer-filter.ts +7 -0
  174. package/src/sdk/models/customer-response.ts +6 -0
  175. package/src/sdk/models/customer.ts +6 -0
  176. package/src/sdk/models/get-billing-entity-op.ts +33 -0
  177. package/src/sdk/models/index.ts +12 -0
  178. package/src/sdk/models/invoice-billing-entity.ts +48 -0
  179. package/src/sdk/models/invoice-filter.ts +7 -0
  180. package/src/sdk/models/invoice-response.ts +13 -0
  181. package/src/sdk/models/list-billing-entities-op.ts +88 -0
  182. package/src/sdk/models/list-billing-entities-response.ts +41 -0
  183. package/src/sdk/models/tax-rate-entity-type.ts +1 -0
  184. package/src/sdk/models/update-billing-entity-op.ts +46 -0
  185. package/src/sdk/models/update-billing-entity-request.ts +53 -0
  186. package/src/sdk/models/update-customer-request.ts +7 -0
  187. package/src/sdk/models/webhook-dto-customer.ts +3 -0
  188. package/src/sdk/models/webhook-dto-invoice.ts +3 -0
  189. package/src/sdk/sdk.ts +6 -0
@@ -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
+ }
@@ -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,7 @@ 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.49-dev.1",
80
+ sdkVersion: "2.1.49-dev.3",
81
81
  genVersion: "2.956.1",
82
- userAgent: "speakeasy-sdk/typescript 2.1.49-dev.1 2.956.1 1.0 @flexprice/sdk",
82
+ userAgent: "speakeasy-sdk/typescript 2.1.49-dev.3 2.956.1 1.0 @flexprice/sdk",
83
83
  } 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
+ }