@vercel/sdk 14.0.0-canary.7 → 14.0.0-canary.9

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 (179) hide show
  1. package/.devcontainer/README.md +1 -1
  2. package/README.md +25 -0
  3. package/docs/sdks/authentication/README.md +69 -0
  4. package/docs/sdks/marketplace/README.md +694 -0
  5. package/docs/sdks/projects/README.md +85 -0
  6. package/esm/funcs/authenticationExchangeSsoToken.d.ts +15 -0
  7. package/esm/funcs/authenticationExchangeSsoToken.d.ts.map +1 -0
  8. package/esm/funcs/authenticationExchangeSsoToken.js +66 -0
  9. package/esm/funcs/authenticationExchangeSsoToken.js.map +1 -0
  10. package/esm/funcs/marketplaceCreateEvent.d.ts +15 -0
  11. package/esm/funcs/marketplaceCreateEvent.d.ts.map +1 -0
  12. package/esm/funcs/marketplaceCreateEvent.js +73 -0
  13. package/esm/funcs/marketplaceCreateEvent.js.map +1 -0
  14. package/esm/funcs/marketplaceExchangeSsoToken.d.ts +15 -0
  15. package/esm/funcs/marketplaceExchangeSsoToken.d.ts.map +1 -0
  16. package/esm/funcs/marketplaceExchangeSsoToken.js +66 -0
  17. package/esm/funcs/marketplaceExchangeSsoToken.js.map +1 -0
  18. package/esm/funcs/marketplaceGetAccountInfo.d.ts +15 -0
  19. package/esm/funcs/marketplaceGetAccountInfo.d.ts.map +1 -0
  20. package/esm/funcs/marketplaceGetAccountInfo.js +71 -0
  21. package/esm/funcs/marketplaceGetAccountInfo.js.map +1 -0
  22. package/esm/funcs/marketplaceGetInvoice.d.ts +15 -0
  23. package/esm/funcs/marketplaceGetInvoice.d.ts.map +1 -0
  24. package/esm/funcs/marketplaceGetInvoice.js +75 -0
  25. package/esm/funcs/marketplaceGetInvoice.js.map +1 -0
  26. package/esm/funcs/marketplaceGetMember.d.ts +15 -0
  27. package/esm/funcs/marketplaceGetMember.d.ts.map +1 -0
  28. package/esm/funcs/marketplaceGetMember.js +75 -0
  29. package/esm/funcs/marketplaceGetMember.js.map +1 -0
  30. package/esm/funcs/marketplaceSubmitBillingData.d.ts +15 -0
  31. package/esm/funcs/marketplaceSubmitBillingData.d.ts.map +1 -0
  32. package/esm/funcs/marketplaceSubmitBillingData.js +73 -0
  33. package/esm/funcs/marketplaceSubmitBillingData.js.map +1 -0
  34. package/esm/funcs/marketplaceSubmitInvoice.d.ts +15 -0
  35. package/esm/funcs/marketplaceSubmitInvoice.d.ts.map +1 -0
  36. package/esm/funcs/marketplaceSubmitInvoice.js +72 -0
  37. package/esm/funcs/marketplaceSubmitInvoice.js.map +1 -0
  38. package/esm/funcs/marketplaceUpdateInvoice.d.ts +15 -0
  39. package/esm/funcs/marketplaceUpdateInvoice.d.ts.map +1 -0
  40. package/esm/funcs/marketplaceUpdateInvoice.js +77 -0
  41. package/esm/funcs/marketplaceUpdateInvoice.js.map +1 -0
  42. package/esm/funcs/marketplaceUpdateResourceSecrets.d.ts +15 -0
  43. package/esm/funcs/marketplaceUpdateResourceSecrets.d.ts.map +1 -0
  44. package/esm/funcs/marketplaceUpdateResourceSecrets.js +78 -0
  45. package/esm/funcs/marketplaceUpdateResourceSecrets.js.map +1 -0
  46. package/esm/funcs/projectsGetProjectDomains.d.ts +15 -0
  47. package/esm/funcs/projectsGetProjectDomains.d.ts.map +1 -0
  48. package/esm/funcs/projectsGetProjectDomains.js +89 -0
  49. package/esm/funcs/projectsGetProjectDomains.js.map +1 -0
  50. package/esm/lib/config.d.ts +2 -2
  51. package/esm/lib/config.js +2 -2
  52. package/esm/models/components/authuser.d.ts +6 -3
  53. package/esm/models/components/authuser.d.ts.map +1 -1
  54. package/esm/models/components/authuser.js +2 -1
  55. package/esm/models/components/authuser.js.map +1 -1
  56. package/esm/models/components/security.d.ts +2 -2
  57. package/esm/models/components/security.d.ts.map +1 -1
  58. package/esm/models/components/security.js +2 -2
  59. package/esm/models/components/security.js.map +1 -1
  60. package/esm/models/operations/createevent.d.ts +187 -0
  61. package/esm/models/operations/createevent.d.ts.map +1 -0
  62. package/esm/models/operations/createevent.js +195 -0
  63. package/esm/models/operations/createevent.js.map +1 -0
  64. package/esm/models/operations/createproject.d.ts +4 -0
  65. package/esm/models/operations/createproject.d.ts.map +1 -1
  66. package/esm/models/operations/createproject.js +4 -0
  67. package/esm/models/operations/createproject.js.map +1 -1
  68. package/esm/models/operations/createteam.d.ts +15 -15
  69. package/esm/models/operations/createteam.d.ts.map +1 -1
  70. package/esm/models/operations/createteam.js +15 -15
  71. package/esm/models/operations/createteam.js.map +1 -1
  72. package/esm/models/operations/deletedeployment.d.ts +8 -8
  73. package/esm/models/operations/deletedeployment.d.ts.map +1 -1
  74. package/esm/models/operations/deletedeployment.js +12 -12
  75. package/esm/models/operations/deletedeployment.js.map +1 -1
  76. package/esm/models/operations/exchangessotoken.d.ts +81 -0
  77. package/esm/models/operations/exchangessotoken.d.ts.map +1 -0
  78. package/esm/models/operations/exchangessotoken.js +93 -0
  79. package/esm/models/operations/exchangessotoken.js.map +1 -0
  80. package/esm/models/operations/getaccountinfo.d.ts +85 -0
  81. package/esm/models/operations/getaccountinfo.d.ts.map +1 -0
  82. package/esm/models/operations/getaccountinfo.js +87 -0
  83. package/esm/models/operations/getaccountinfo.js.map +1 -0
  84. package/esm/models/operations/getinvoice.d.ts +232 -0
  85. package/esm/models/operations/getinvoice.d.ts.map +1 -0
  86. package/esm/models/operations/getinvoice.js +219 -0
  87. package/esm/models/operations/getinvoice.js.map +1 -0
  88. package/esm/models/operations/getmember.d.ts +84 -0
  89. package/esm/models/operations/getmember.d.ts.map +1 -0
  90. package/esm/models/operations/getmember.js +79 -0
  91. package/esm/models/operations/getmember.js.map +1 -0
  92. package/esm/models/operations/getprojectdomains.d.ts +367 -0
  93. package/esm/models/operations/getprojectdomains.d.ts.map +1 -0
  94. package/esm/models/operations/getprojectdomains.js +272 -0
  95. package/esm/models/operations/getprojectdomains.js.map +1 -0
  96. package/esm/models/operations/getprojects.d.ts +4 -0
  97. package/esm/models/operations/getprojects.d.ts.map +1 -1
  98. package/esm/models/operations/getprojects.js +4 -0
  99. package/esm/models/operations/getprojects.js.map +1 -1
  100. package/esm/models/operations/putfirewallconfig.d.ts +44 -44
  101. package/esm/models/operations/putfirewallconfig.d.ts.map +1 -1
  102. package/esm/models/operations/putfirewallconfig.js +71 -72
  103. package/esm/models/operations/putfirewallconfig.js.map +1 -1
  104. package/esm/models/operations/submitbillingdata.d.ts +448 -0
  105. package/esm/models/operations/submitbillingdata.d.ts.map +1 -0
  106. package/esm/models/operations/submitbillingdata.js +355 -0
  107. package/esm/models/operations/submitbillingdata.js.map +1 -0
  108. package/esm/models/operations/submitinvoice.d.ts +299 -0
  109. package/esm/models/operations/submitinvoice.d.ts.map +1 -0
  110. package/esm/models/operations/submitinvoice.js +269 -0
  111. package/esm/models/operations/submitinvoice.js.map +1 -0
  112. package/esm/models/operations/updateinvoice.d.ts +91 -0
  113. package/esm/models/operations/updateinvoice.d.ts.map +1 -0
  114. package/esm/models/operations/updateinvoice.js +92 -0
  115. package/esm/models/operations/updateinvoice.js.map +1 -0
  116. package/esm/models/operations/updateproject.d.ts +4 -0
  117. package/esm/models/operations/updateproject.d.ts.map +1 -1
  118. package/esm/models/operations/updateproject.js +4 -0
  119. package/esm/models/operations/updateproject.js.map +1 -1
  120. package/esm/models/operations/updateprojectdatacache.d.ts +4 -0
  121. package/esm/models/operations/updateprojectdatacache.d.ts.map +1 -1
  122. package/esm/models/operations/updateprojectdatacache.js +4 -0
  123. package/esm/models/operations/updateprojectdatacache.js.map +1 -1
  124. package/esm/models/operations/updateresourcesecrets.d.ts +87 -0
  125. package/esm/models/operations/updateresourcesecrets.d.ts.map +1 -0
  126. package/esm/models/operations/updateresourcesecrets.js +100 -0
  127. package/esm/models/operations/updateresourcesecrets.js.map +1 -0
  128. package/esm/sdk/authentication.d.ts +8 -0
  129. package/esm/sdk/authentication.d.ts.map +1 -1
  130. package/esm/sdk/authentication.js +10 -0
  131. package/esm/sdk/authentication.js.map +1 -1
  132. package/esm/sdk/marketplace.d.ts +76 -0
  133. package/esm/sdk/marketplace.d.ts.map +1 -0
  134. package/esm/sdk/marketplace.js +98 -0
  135. package/esm/sdk/marketplace.js.map +1 -0
  136. package/esm/sdk/projects.d.ts +8 -0
  137. package/esm/sdk/projects.d.ts.map +1 -1
  138. package/esm/sdk/projects.js +10 -0
  139. package/esm/sdk/projects.js.map +1 -1
  140. package/esm/sdk/sdk.d.ts +5 -2
  141. package/esm/sdk/sdk.d.ts.map +1 -1
  142. package/esm/sdk/sdk.js +9 -4
  143. package/esm/sdk/sdk.js.map +1 -1
  144. package/package.json +2 -2
  145. package/src/funcs/authenticationExchangeSsoToken.ts +125 -0
  146. package/src/funcs/marketplaceCreateEvent.ts +137 -0
  147. package/src/funcs/marketplaceExchangeSsoToken.ts +125 -0
  148. package/src/funcs/marketplaceGetAccountInfo.ts +137 -0
  149. package/src/funcs/marketplaceGetInvoice.ts +141 -0
  150. package/src/funcs/marketplaceGetMember.ts +141 -0
  151. package/src/funcs/marketplaceSubmitBillingData.ts +137 -0
  152. package/src/funcs/marketplaceSubmitInvoice.ts +138 -0
  153. package/src/funcs/marketplaceUpdateInvoice.ts +141 -0
  154. package/src/funcs/marketplaceUpdateResourceSecrets.ts +146 -0
  155. package/src/funcs/projectsGetProjectDomains.ts +150 -0
  156. package/src/lib/config.ts +2 -2
  157. package/src/models/components/authuser.ts +2 -1
  158. package/src/models/components/security.ts +4 -4
  159. package/src/models/operations/createevent.ts +373 -0
  160. package/src/models/operations/createproject.ts +8 -0
  161. package/src/models/operations/createteam.ts +31 -24
  162. package/src/models/operations/deletedeployment.ts +16 -15
  163. package/src/models/operations/exchangessotoken.ts +192 -0
  164. package/src/models/operations/getaccountinfo.ts +187 -0
  165. package/src/models/operations/getinvoice.ts +454 -0
  166. package/src/models/operations/getmember.ts +160 -0
  167. package/src/models/operations/getprojectdomains.ts +571 -0
  168. package/src/models/operations/getprojects.ts +8 -0
  169. package/src/models/operations/putfirewallconfig.ts +102 -93
  170. package/src/models/operations/submitbillingdata.ts +813 -0
  171. package/src/models/operations/submitinvoice.ts +593 -0
  172. package/src/models/operations/updateinvoice.ts +180 -0
  173. package/src/models/operations/updateproject.ts +8 -0
  174. package/src/models/operations/updateprojectdatacache.ts +8 -0
  175. package/src/models/operations/updateresourcesecrets.ts +206 -0
  176. package/src/sdk/authentication.ts +22 -0
  177. package/src/sdk/marketplace.ts +194 -0
  178. package/src/sdk/projects.ts +22 -0
  179. package/src/sdk/sdk.ts +11 -5
@@ -0,0 +1,141 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { VercelCore } from "../core.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { safeParse } from "../lib/schemas.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import {
13
+ ConnectionError,
14
+ InvalidRequestError,
15
+ RequestAbortedError,
16
+ RequestTimeoutError,
17
+ UnexpectedClientError,
18
+ } from "../models/errors/httpclienterrors.js";
19
+ import { SDKError } from "../models/errors/sdkerror.js";
20
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
21
+ import {
22
+ GetMemberRequest,
23
+ GetMemberRequest$outboundSchema,
24
+ GetMemberResponseBody,
25
+ GetMemberResponseBody$inboundSchema,
26
+ } from "../models/operations/getmember.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Get Member Information
31
+ *
32
+ * @remarks
33
+ * Returns the member role and other information for a given member ID ("user_id" claim in the SSO OIDC token).
34
+ */
35
+ export async function marketplaceGetMember(
36
+ client: VercelCore,
37
+ request: GetMemberRequest,
38
+ options?: RequestOptions,
39
+ ): Promise<
40
+ Result<
41
+ GetMemberResponseBody,
42
+ | SDKError
43
+ | SDKValidationError
44
+ | UnexpectedClientError
45
+ | InvalidRequestError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | ConnectionError
49
+ >
50
+ > {
51
+ const parsed = safeParse(
52
+ request,
53
+ (value) => GetMemberRequest$outboundSchema.parse(value),
54
+ "Input validation failed",
55
+ );
56
+ if (!parsed.ok) {
57
+ return parsed;
58
+ }
59
+ const payload = parsed.value;
60
+ const body = null;
61
+
62
+ const pathParams = {
63
+ integrationConfigurationId: encodeSimple(
64
+ "integrationConfigurationId",
65
+ payload.integrationConfigurationId,
66
+ { explode: false, charEncoding: "percent" },
67
+ ),
68
+ memberId: encodeSimple("memberId", payload.memberId, {
69
+ explode: false,
70
+ charEncoding: "percent",
71
+ }),
72
+ };
73
+
74
+ const path = pathToFunc(
75
+ "/v1/installations/{integrationConfigurationId}/member/{memberId}",
76
+ )(pathParams);
77
+
78
+ const headers = new Headers({
79
+ Accept: "application/json",
80
+ });
81
+
82
+ const secConfig = await extractSecurity(client._options.bearerToken);
83
+ const securityInput = secConfig == null ? {} : { bearerToken: secConfig };
84
+ const requestSecurity = resolveGlobalSecurity(securityInput);
85
+
86
+ const context = {
87
+ operationID: "get-member",
88
+ oAuth2Scopes: [],
89
+
90
+ resolvedSecurity: requestSecurity,
91
+
92
+ securitySource: client._options.bearerToken,
93
+ retryConfig: options?.retries
94
+ || client._options.retryConfig
95
+ || { strategy: "none" },
96
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
97
+ };
98
+
99
+ const requestRes = client._createRequest(context, {
100
+ security: requestSecurity,
101
+ method: "GET",
102
+ path: path,
103
+ headers: headers,
104
+ body: body,
105
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
106
+ }, options);
107
+ if (!requestRes.ok) {
108
+ return requestRes;
109
+ }
110
+ const req = requestRes.value;
111
+
112
+ const doResult = await client._do(req, {
113
+ context,
114
+ errorCodes: ["400", "401", "403", "404", "4XX", "5XX"],
115
+ retryConfig: context.retryConfig,
116
+ retryCodes: context.retryCodes,
117
+ });
118
+ if (!doResult.ok) {
119
+ return doResult;
120
+ }
121
+ const response = doResult.value;
122
+
123
+ const [result] = await M.match<
124
+ GetMemberResponseBody,
125
+ | SDKError
126
+ | SDKValidationError
127
+ | UnexpectedClientError
128
+ | InvalidRequestError
129
+ | RequestAbortedError
130
+ | RequestTimeoutError
131
+ | ConnectionError
132
+ >(
133
+ M.json(200, GetMemberResponseBody$inboundSchema),
134
+ M.fail([400, 401, 403, 404, "4XX", "5XX"]),
135
+ )(response);
136
+ if (!result.ok) {
137
+ return result;
138
+ }
139
+
140
+ return result;
141
+ }
@@ -0,0 +1,137 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { VercelCore } from "../core.js";
7
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { SDKError } from "../models/errors/sdkerror.js";
21
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
+ import {
23
+ SubmitBillingDataRequest,
24
+ SubmitBillingDataRequest$outboundSchema,
25
+ } from "../models/operations/submitbillingdata.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Submit Billing Data
30
+ *
31
+ * @remarks
32
+ * Sends the billing and usage data. The partner should do this at least once a day and ideally once per hour.
33
+ */
34
+ export async function marketplaceSubmitBillingData(
35
+ client: VercelCore,
36
+ request: SubmitBillingDataRequest,
37
+ options?: RequestOptions,
38
+ ): Promise<
39
+ Result<
40
+ void,
41
+ | SDKError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ const parsed = safeParse(
51
+ request,
52
+ (value) => SubmitBillingDataRequest$outboundSchema.parse(value),
53
+ "Input validation failed",
54
+ );
55
+ if (!parsed.ok) {
56
+ return parsed;
57
+ }
58
+ const payload = parsed.value;
59
+ const body = encodeJSON("body", payload.RequestBody, { explode: true });
60
+
61
+ const pathParams = {
62
+ integrationConfigurationId: encodeSimple(
63
+ "integrationConfigurationId",
64
+ payload.integrationConfigurationId,
65
+ { explode: false, charEncoding: "percent" },
66
+ ),
67
+ };
68
+
69
+ const path = pathToFunc(
70
+ "/v1/installations/{integrationConfigurationId}/billing",
71
+ )(pathParams);
72
+
73
+ const headers = new Headers({
74
+ "Content-Type": "application/json",
75
+ Accept: "*/*",
76
+ });
77
+
78
+ const secConfig = await extractSecurity(client._options.bearerToken);
79
+ const securityInput = secConfig == null ? {} : { bearerToken: secConfig };
80
+ const requestSecurity = resolveGlobalSecurity(securityInput);
81
+
82
+ const context = {
83
+ operationID: "submit-billing-data",
84
+ oAuth2Scopes: [],
85
+
86
+ resolvedSecurity: requestSecurity,
87
+
88
+ securitySource: client._options.bearerToken,
89
+ retryConfig: options?.retries
90
+ || client._options.retryConfig
91
+ || { strategy: "none" },
92
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
93
+ };
94
+
95
+ const requestRes = client._createRequest(context, {
96
+ security: requestSecurity,
97
+ method: "POST",
98
+ path: path,
99
+ headers: headers,
100
+ body: body,
101
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
102
+ }, options);
103
+ if (!requestRes.ok) {
104
+ return requestRes;
105
+ }
106
+ const req = requestRes.value;
107
+
108
+ const doResult = await client._do(req, {
109
+ context,
110
+ errorCodes: ["400", "401", "403", "4XX", "5XX"],
111
+ retryConfig: context.retryConfig,
112
+ retryCodes: context.retryCodes,
113
+ });
114
+ if (!doResult.ok) {
115
+ return doResult;
116
+ }
117
+ const response = doResult.value;
118
+
119
+ const [result] = await M.match<
120
+ void,
121
+ | SDKError
122
+ | SDKValidationError
123
+ | UnexpectedClientError
124
+ | InvalidRequestError
125
+ | RequestAbortedError
126
+ | RequestTimeoutError
127
+ | ConnectionError
128
+ >(
129
+ M.nil(201, z.void()),
130
+ M.fail([400, 401, 403, "4XX", "5XX"]),
131
+ )(response);
132
+ if (!result.ok) {
133
+ return result;
134
+ }
135
+
136
+ return result;
137
+ }
@@ -0,0 +1,138 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { VercelCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { safeParse } from "../lib/schemas.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import {
13
+ ConnectionError,
14
+ InvalidRequestError,
15
+ RequestAbortedError,
16
+ RequestTimeoutError,
17
+ UnexpectedClientError,
18
+ } from "../models/errors/httpclienterrors.js";
19
+ import { SDKError } from "../models/errors/sdkerror.js";
20
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
21
+ import {
22
+ SubmitInvoiceRequest,
23
+ SubmitInvoiceRequest$outboundSchema,
24
+ SubmitInvoiceResponseBody,
25
+ SubmitInvoiceResponseBody$inboundSchema,
26
+ } from "../models/operations/submitinvoice.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Submit Invoice
31
+ *
32
+ * @remarks
33
+ * This endpoint allows the partner to submit an invoice to Vercel. The invoice is created in Vercel's billing system and sent to the customer. Depending on the type of billing plan, the invoice can be sent at a time of signup, at the start of the billing period, or at the end of the billing period.<br/> <br/> There are several limitations to the invoice submission:<br/> <br/> 1. A resource can only be billed once per the billing period and the billing plan.<br/> 2. The billing plan used to bill the resource must have been active for this resource during the billing period.<br/> 3. The billing plan used must be a subscription plan.<br/> 4. The interim usage data must be sent hourly for all types of subscriptions. See [Send subscription billing and usage data](#send-subscription-billing-and-usage-data) API on how to send interim billing and usage data.<br/>
34
+ */
35
+ export async function marketplaceSubmitInvoice(
36
+ client: VercelCore,
37
+ request: SubmitInvoiceRequest,
38
+ options?: RequestOptions,
39
+ ): Promise<
40
+ Result<
41
+ SubmitInvoiceResponseBody,
42
+ | SDKError
43
+ | SDKValidationError
44
+ | UnexpectedClientError
45
+ | InvalidRequestError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | ConnectionError
49
+ >
50
+ > {
51
+ const parsed = safeParse(
52
+ request,
53
+ (value) => SubmitInvoiceRequest$outboundSchema.parse(value),
54
+ "Input validation failed",
55
+ );
56
+ if (!parsed.ok) {
57
+ return parsed;
58
+ }
59
+ const payload = parsed.value;
60
+ const body = encodeJSON("body", payload.RequestBody, { explode: true });
61
+
62
+ const pathParams = {
63
+ integrationConfigurationId: encodeSimple(
64
+ "integrationConfigurationId",
65
+ payload.integrationConfigurationId,
66
+ { explode: false, charEncoding: "percent" },
67
+ ),
68
+ };
69
+
70
+ const path = pathToFunc(
71
+ "/v1/installations/{integrationConfigurationId}/billing/invoices",
72
+ )(pathParams);
73
+
74
+ const headers = new Headers({
75
+ "Content-Type": "application/json",
76
+ Accept: "application/json",
77
+ });
78
+
79
+ const secConfig = await extractSecurity(client._options.bearerToken);
80
+ const securityInput = secConfig == null ? {} : { bearerToken: secConfig };
81
+ const requestSecurity = resolveGlobalSecurity(securityInput);
82
+
83
+ const context = {
84
+ operationID: "submit-invoice",
85
+ oAuth2Scopes: [],
86
+
87
+ resolvedSecurity: requestSecurity,
88
+
89
+ securitySource: client._options.bearerToken,
90
+ retryConfig: options?.retries
91
+ || client._options.retryConfig
92
+ || { strategy: "none" },
93
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
94
+ };
95
+
96
+ const requestRes = client._createRequest(context, {
97
+ security: requestSecurity,
98
+ method: "POST",
99
+ path: path,
100
+ headers: headers,
101
+ body: body,
102
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
103
+ }, options);
104
+ if (!requestRes.ok) {
105
+ return requestRes;
106
+ }
107
+ const req = requestRes.value;
108
+
109
+ const doResult = await client._do(req, {
110
+ context,
111
+ errorCodes: ["400", "401", "403", "4XX", "5XX"],
112
+ retryConfig: context.retryConfig,
113
+ retryCodes: context.retryCodes,
114
+ });
115
+ if (!doResult.ok) {
116
+ return doResult;
117
+ }
118
+ const response = doResult.value;
119
+
120
+ const [result] = await M.match<
121
+ SubmitInvoiceResponseBody,
122
+ | SDKError
123
+ | SDKValidationError
124
+ | UnexpectedClientError
125
+ | InvalidRequestError
126
+ | RequestAbortedError
127
+ | RequestTimeoutError
128
+ | ConnectionError
129
+ >(
130
+ M.json(200, SubmitInvoiceResponseBody$inboundSchema),
131
+ M.fail([400, 401, 403, "4XX", "5XX"]),
132
+ )(response);
133
+ if (!result.ok) {
134
+ return result;
135
+ }
136
+
137
+ return result;
138
+ }
@@ -0,0 +1,141 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { VercelCore } from "../core.js";
7
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { SDKError } from "../models/errors/sdkerror.js";
21
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
+ import {
23
+ UpdateInvoiceRequest,
24
+ UpdateInvoiceRequest$outboundSchema,
25
+ } from "../models/operations/updateinvoice.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Invoice Actions
30
+ *
31
+ * @remarks
32
+ * This endpoint allows the partner to request a refund for an invoice to Vercel. The invoice is created using the [Submit Invoice API](#submit-invoice-api).
33
+ */
34
+ export async function marketplaceUpdateInvoice(
35
+ client: VercelCore,
36
+ request: UpdateInvoiceRequest,
37
+ options?: RequestOptions,
38
+ ): Promise<
39
+ Result<
40
+ void,
41
+ | SDKError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ const parsed = safeParse(
51
+ request,
52
+ (value) => UpdateInvoiceRequest$outboundSchema.parse(value),
53
+ "Input validation failed",
54
+ );
55
+ if (!parsed.ok) {
56
+ return parsed;
57
+ }
58
+ const payload = parsed.value;
59
+ const body = encodeJSON("body", payload.RequestBody, { explode: true });
60
+
61
+ const pathParams = {
62
+ integrationConfigurationId: encodeSimple(
63
+ "integrationConfigurationId",
64
+ payload.integrationConfigurationId,
65
+ { explode: false, charEncoding: "percent" },
66
+ ),
67
+ invoiceId: encodeSimple("invoiceId", payload.invoiceId, {
68
+ explode: false,
69
+ charEncoding: "percent",
70
+ }),
71
+ };
72
+
73
+ const path = pathToFunc(
74
+ "/v1/installations/{integrationConfigurationId}/billing/invoices/{invoiceId}/actions",
75
+ )(pathParams);
76
+
77
+ const headers = new Headers({
78
+ "Content-Type": "application/json",
79
+ Accept: "*/*",
80
+ });
81
+
82
+ const secConfig = await extractSecurity(client._options.bearerToken);
83
+ const securityInput = secConfig == null ? {} : { bearerToken: secConfig };
84
+ const requestSecurity = resolveGlobalSecurity(securityInput);
85
+
86
+ const context = {
87
+ operationID: "update-invoice",
88
+ oAuth2Scopes: [],
89
+
90
+ resolvedSecurity: requestSecurity,
91
+
92
+ securitySource: client._options.bearerToken,
93
+ retryConfig: options?.retries
94
+ || client._options.retryConfig
95
+ || { strategy: "none" },
96
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
97
+ };
98
+
99
+ const requestRes = client._createRequest(context, {
100
+ security: requestSecurity,
101
+ method: "POST",
102
+ path: path,
103
+ headers: headers,
104
+ body: body,
105
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
106
+ }, options);
107
+ if (!requestRes.ok) {
108
+ return requestRes;
109
+ }
110
+ const req = requestRes.value;
111
+
112
+ const doResult = await client._do(req, {
113
+ context,
114
+ errorCodes: ["400", "401", "403", "404", "4XX", "5XX"],
115
+ retryConfig: context.retryConfig,
116
+ retryCodes: context.retryCodes,
117
+ });
118
+ if (!doResult.ok) {
119
+ return doResult;
120
+ }
121
+ const response = doResult.value;
122
+
123
+ const [result] = await M.match<
124
+ void,
125
+ | SDKError
126
+ | SDKValidationError
127
+ | UnexpectedClientError
128
+ | InvalidRequestError
129
+ | RequestAbortedError
130
+ | RequestTimeoutError
131
+ | ConnectionError
132
+ >(
133
+ M.nil(204, z.void()),
134
+ M.fail([400, 401, 403, 404, "4XX", "5XX"]),
135
+ )(response);
136
+ if (!result.ok) {
137
+ return result;
138
+ }
139
+
140
+ return result;
141
+ }
@@ -0,0 +1,146 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { VercelCore } from "../core.js";
7
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { SDKError } from "../models/errors/sdkerror.js";
21
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
+ import {
23
+ UpdateResourceSecretsRequest,
24
+ UpdateResourceSecretsRequest$outboundSchema,
25
+ } from "../models/operations/updateresourcesecrets.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Update Resource Secrets
30
+ *
31
+ * @remarks
32
+ * This endpoint updates the secrets of a resource. If a resource has projects connected, the connected secrets are updated with the new secrets. The old secrets may still be used by existing connected projects because they are not automatically redeployed. Redeployment is a manual action and must be completed by the user. All new project connections will use the new secrets.<br/> <br/> Use cases for this endpoint:<br/> <br/> - Resetting the credentials of a database in the partner. If the user requests the credentials to be updated in the partner’s application, the partner post the new set of secrets to Vercel, the user should redeploy their application and the expire the old credentials.<br/>
33
+ */
34
+ export async function marketplaceUpdateResourceSecrets(
35
+ client: VercelCore,
36
+ request: UpdateResourceSecretsRequest,
37
+ options?: RequestOptions,
38
+ ): Promise<
39
+ Result<
40
+ void,
41
+ | SDKError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ const parsed = safeParse(
51
+ request,
52
+ (value) => UpdateResourceSecretsRequest$outboundSchema.parse(value),
53
+ "Input validation failed",
54
+ );
55
+ if (!parsed.ok) {
56
+ return parsed;
57
+ }
58
+ const payload = parsed.value;
59
+ const body = encodeJSON("body", payload.RequestBody, { explode: true });
60
+
61
+ const pathParams = {
62
+ integrationConfigurationId: encodeSimple(
63
+ "integrationConfigurationId",
64
+ payload.integrationConfigurationId,
65
+ { explode: false, charEncoding: "percent" },
66
+ ),
67
+ integrationProductIdOrSlug: encodeSimple(
68
+ "integrationProductIdOrSlug",
69
+ payload.integrationProductIdOrSlug,
70
+ { explode: false, charEncoding: "percent" },
71
+ ),
72
+ resourceId: encodeSimple("resourceId", payload.resourceId, {
73
+ explode: false,
74
+ charEncoding: "percent",
75
+ }),
76
+ };
77
+
78
+ const path = pathToFunc(
79
+ "/v1/installations/{integrationConfigurationId}/products/{integrationProductIdOrSlug}/resources/{resourceId}/secrets",
80
+ )(pathParams);
81
+
82
+ const headers = new Headers({
83
+ "Content-Type": "application/json",
84
+ Accept: "*/*",
85
+ });
86
+
87
+ const secConfig = await extractSecurity(client._options.bearerToken);
88
+ const securityInput = secConfig == null ? {} : { bearerToken: secConfig };
89
+ const requestSecurity = resolveGlobalSecurity(securityInput);
90
+
91
+ const context = {
92
+ operationID: "update-resource-secrets",
93
+ oAuth2Scopes: [],
94
+
95
+ resolvedSecurity: requestSecurity,
96
+
97
+ securitySource: client._options.bearerToken,
98
+ retryConfig: options?.retries
99
+ || client._options.retryConfig
100
+ || { strategy: "none" },
101
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
102
+ };
103
+
104
+ const requestRes = client._createRequest(context, {
105
+ security: requestSecurity,
106
+ method: "PUT",
107
+ path: path,
108
+ headers: headers,
109
+ body: body,
110
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
111
+ }, options);
112
+ if (!requestRes.ok) {
113
+ return requestRes;
114
+ }
115
+ const req = requestRes.value;
116
+
117
+ const doResult = await client._do(req, {
118
+ context,
119
+ errorCodes: ["400", "401", "403", "404", "4XX", "5XX"],
120
+ retryConfig: context.retryConfig,
121
+ retryCodes: context.retryCodes,
122
+ });
123
+ if (!doResult.ok) {
124
+ return doResult;
125
+ }
126
+ const response = doResult.value;
127
+
128
+ const [result] = await M.match<
129
+ void,
130
+ | SDKError
131
+ | SDKValidationError
132
+ | UnexpectedClientError
133
+ | InvalidRequestError
134
+ | RequestAbortedError
135
+ | RequestTimeoutError
136
+ | ConnectionError
137
+ >(
138
+ M.nil(201, z.void()),
139
+ M.fail([400, 401, 403, 404, "4XX", "5XX"]),
140
+ )(response);
141
+ if (!result.ok) {
142
+ return result;
143
+ }
144
+
145
+ return result;
146
+ }