@greensecurity/javascript-sdk 0.30.19 → 0.30.21
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.
- package/README.md +3 -0
- package/bin/mcp-server.js +223 -41
- package/bin/mcp-server.js.map +10 -7
- package/dist/commonjs/__tests__/vendormanagedbycompanies.test.js +1 -1
- package/dist/commonjs/__tests__/vendormanagedbycompanies.test.js.map +1 -1
- package/dist/commonjs/__tests__/vendors.test.js +20 -1
- package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js +1 -1
- package/dist/commonjs/funcs/vendorsPurchaseScrubCredits.d.ts +17 -0
- package/dist/commonjs/funcs/vendorsPurchaseScrubCredits.d.ts.map +1 -0
- package/dist/commonjs/funcs/vendorsPurchaseScrubCredits.js +121 -0
- package/dist/commonjs/funcs/vendorsPurchaseScrubCredits.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/server.js +3 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/vendorsPurchaseScrubCredits.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/vendorsPurchaseScrubCredits.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/vendorsPurchaseScrubCredits.js +64 -0
- package/dist/commonjs/mcp-server/tools/vendorsPurchaseScrubCredits.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/purchasescrubcredits.d.ts +91 -0
- package/dist/commonjs/models/operations/purchasescrubcredits.d.ts.map +1 -0
- package/dist/commonjs/models/operations/purchasescrubcredits.js +160 -0
- package/dist/commonjs/models/operations/purchasescrubcredits.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +1 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +1 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/vendorsPurchaseScrubCredits.d.ts +23 -0
- package/dist/commonjs/react-query/vendorsPurchaseScrubCredits.d.ts.map +1 -0
- package/dist/commonjs/react-query/vendorsPurchaseScrubCredits.js +47 -0
- package/dist/commonjs/react-query/vendorsPurchaseScrubCredits.js.map +1 -0
- package/dist/commonjs/sdk/vendors.d.ts +7 -0
- package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
- package/dist/commonjs/sdk/vendors.js +10 -0
- package/dist/commonjs/sdk/vendors.js.map +1 -1
- package/dist/esm/__tests__/vendormanagedbycompanies.test.js +1 -1
- package/dist/esm/__tests__/vendormanagedbycompanies.test.js.map +1 -1
- package/dist/esm/__tests__/vendors.test.js +20 -1
- package/dist/esm/__tests__/vendors.test.js.map +1 -1
- package/dist/esm/__tests__/webhooks.test.js +1 -1
- package/dist/esm/funcs/vendorsPurchaseScrubCredits.d.ts +17 -0
- package/dist/esm/funcs/vendorsPurchaseScrubCredits.d.ts.map +1 -0
- package/dist/esm/funcs/vendorsPurchaseScrubCredits.js +85 -0
- package/dist/esm/funcs/vendorsPurchaseScrubCredits.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.d.ts.map +1 -1
- package/dist/esm/mcp-server/server.js +3 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/vendorsPurchaseScrubCredits.d.ts +8 -0
- package/dist/esm/mcp-server/tools/vendorsPurchaseScrubCredits.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/vendorsPurchaseScrubCredits.js +28 -0
- package/dist/esm/mcp-server/tools/vendorsPurchaseScrubCredits.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/purchasescrubcredits.d.ts +91 -0
- package/dist/esm/models/operations/purchasescrubcredits.d.ts.map +1 -0
- package/dist/esm/models/operations/purchasescrubcredits.js +118 -0
- package/dist/esm/models/operations/purchasescrubcredits.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +1 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +1 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/vendorsPurchaseScrubCredits.d.ts +23 -0
- package/dist/esm/react-query/vendorsPurchaseScrubCredits.d.ts.map +1 -0
- package/dist/esm/react-query/vendorsPurchaseScrubCredits.js +42 -0
- package/dist/esm/react-query/vendorsPurchaseScrubCredits.js.map +1 -0
- package/dist/esm/sdk/vendors.d.ts +7 -0
- package/dist/esm/sdk/vendors.d.ts.map +1 -1
- package/dist/esm/sdk/vendors.js +10 -0
- package/dist/esm/sdk/vendors.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/vendormanagedbycompanies.test.ts +1 -1
- package/src/__tests__/vendors.test.ts +23 -1
- package/src/__tests__/webhooks.test.ts +1 -1
- package/src/funcs/vendorsPurchaseScrubCredits.ts +176 -0
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +3 -1
- package/src/mcp-server/tools/vendorsPurchaseScrubCredits.ts +37 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/purchasescrubcredits.ts +237 -0
- package/src/react-query/index.ts +1 -0
- package/src/react-query/vendorsPurchaseScrubCredits.ts +89 -0
- package/src/sdk/vendors.ts +18 -0
|
@@ -20,7 +20,7 @@ test("Webhooks List All Webhook Endpoints", async () => {
|
|
|
20
20
|
const testWebhookListForVendorUserResult = await greenSecurity.webhooks
|
|
21
21
|
.listAllWebhookEndpoints({
|
|
22
22
|
itemsPerPage: 25,
|
|
23
|
-
desc:
|
|
23
|
+
desc: 0,
|
|
24
24
|
sort: "",
|
|
25
25
|
});
|
|
26
26
|
expect(testWebhookListForVendorUserResult).toBeDefined();
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GreenSecurityCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import { APIError } from "../models/errors/apierror.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import * as errors from "../models/errors/index.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
25
|
+
import { Result } from "../types/fp.js";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Purchase scrub credits
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Purchase scrub credits
|
|
32
|
+
*/
|
|
33
|
+
export function vendorsPurchaseScrubCredits(
|
|
34
|
+
client: GreenSecurityCore,
|
|
35
|
+
request: operations.PurchaseScrubCreditsRequest,
|
|
36
|
+
options?: RequestOptions,
|
|
37
|
+
): APIPromise<
|
|
38
|
+
Result<
|
|
39
|
+
operations.PurchaseScrubCreditsResponseBody,
|
|
40
|
+
| errors.ApiErrorResponse
|
|
41
|
+
| errors.ApiErrorResponse
|
|
42
|
+
| APIError
|
|
43
|
+
| SDKValidationError
|
|
44
|
+
| UnexpectedClientError
|
|
45
|
+
| InvalidRequestError
|
|
46
|
+
| RequestAbortedError
|
|
47
|
+
| RequestTimeoutError
|
|
48
|
+
| ConnectionError
|
|
49
|
+
>
|
|
50
|
+
> {
|
|
51
|
+
return new APIPromise($do(
|
|
52
|
+
client,
|
|
53
|
+
request,
|
|
54
|
+
options,
|
|
55
|
+
));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function $do(
|
|
59
|
+
client: GreenSecurityCore,
|
|
60
|
+
request: operations.PurchaseScrubCreditsRequest,
|
|
61
|
+
options?: RequestOptions,
|
|
62
|
+
): Promise<
|
|
63
|
+
[
|
|
64
|
+
Result<
|
|
65
|
+
operations.PurchaseScrubCreditsResponseBody,
|
|
66
|
+
| errors.ApiErrorResponse
|
|
67
|
+
| errors.ApiErrorResponse
|
|
68
|
+
| APIError
|
|
69
|
+
| SDKValidationError
|
|
70
|
+
| UnexpectedClientError
|
|
71
|
+
| InvalidRequestError
|
|
72
|
+
| RequestAbortedError
|
|
73
|
+
| RequestTimeoutError
|
|
74
|
+
| ConnectionError
|
|
75
|
+
>,
|
|
76
|
+
APICall,
|
|
77
|
+
]
|
|
78
|
+
> {
|
|
79
|
+
const parsed = safeParse(
|
|
80
|
+
request,
|
|
81
|
+
(value) =>
|
|
82
|
+
operations.PurchaseScrubCreditsRequest$outboundSchema.parse(value),
|
|
83
|
+
"Input validation failed",
|
|
84
|
+
);
|
|
85
|
+
if (!parsed.ok) {
|
|
86
|
+
return [parsed, { status: "invalid" }];
|
|
87
|
+
}
|
|
88
|
+
const payload = parsed.value;
|
|
89
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
90
|
+
|
|
91
|
+
const pathParams = {
|
|
92
|
+
vendor_id_or_me: encodeSimple("vendor_id_or_me", payload.vendor_id_or_me, {
|
|
93
|
+
explode: false,
|
|
94
|
+
charEncoding: "percent",
|
|
95
|
+
}),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const path = pathToFunc("/vendors/{vendor_id_or_me}/scrub_credits/order")(
|
|
99
|
+
pathParams,
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const headers = new Headers(compactMap({
|
|
103
|
+
"Content-Type": "application/json",
|
|
104
|
+
Accept: "application/json",
|
|
105
|
+
}));
|
|
106
|
+
|
|
107
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
108
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
109
|
+
|
|
110
|
+
const context = {
|
|
111
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
112
|
+
operationID: "purchaseScrubCredits",
|
|
113
|
+
oAuth2Scopes: [],
|
|
114
|
+
|
|
115
|
+
resolvedSecurity: requestSecurity,
|
|
116
|
+
|
|
117
|
+
securitySource: client._options.security,
|
|
118
|
+
retryConfig: options?.retries
|
|
119
|
+
|| client._options.retryConfig
|
|
120
|
+
|| { strategy: "none" },
|
|
121
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const requestRes = client._createRequest(context, {
|
|
125
|
+
security: requestSecurity,
|
|
126
|
+
method: "POST",
|
|
127
|
+
baseURL: options?.serverURL,
|
|
128
|
+
path: path,
|
|
129
|
+
headers: headers,
|
|
130
|
+
body: body,
|
|
131
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
132
|
+
}, options);
|
|
133
|
+
if (!requestRes.ok) {
|
|
134
|
+
return [requestRes, { status: "invalid" }];
|
|
135
|
+
}
|
|
136
|
+
const req = requestRes.value;
|
|
137
|
+
|
|
138
|
+
const doResult = await client._do(req, {
|
|
139
|
+
context,
|
|
140
|
+
errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
|
|
141
|
+
retryConfig: context.retryConfig,
|
|
142
|
+
retryCodes: context.retryCodes,
|
|
143
|
+
});
|
|
144
|
+
if (!doResult.ok) {
|
|
145
|
+
return [doResult, { status: "request-error", request: req }];
|
|
146
|
+
}
|
|
147
|
+
const response = doResult.value;
|
|
148
|
+
|
|
149
|
+
const responseFields = {
|
|
150
|
+
HttpMeta: { Response: response, Request: req },
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const [result] = await M.match<
|
|
154
|
+
operations.PurchaseScrubCreditsResponseBody,
|
|
155
|
+
| errors.ApiErrorResponse
|
|
156
|
+
| errors.ApiErrorResponse
|
|
157
|
+
| APIError
|
|
158
|
+
| SDKValidationError
|
|
159
|
+
| UnexpectedClientError
|
|
160
|
+
| InvalidRequestError
|
|
161
|
+
| RequestAbortedError
|
|
162
|
+
| RequestTimeoutError
|
|
163
|
+
| ConnectionError
|
|
164
|
+
>(
|
|
165
|
+
M.json(200, operations.PurchaseScrubCreditsResponseBody$inboundSchema),
|
|
166
|
+
M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
|
|
167
|
+
M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
|
|
168
|
+
M.fail("4XX"),
|
|
169
|
+
M.fail("5XX"),
|
|
170
|
+
)(response, { extraFields: responseFields });
|
|
171
|
+
if (!result.ok) {
|
|
172
|
+
return [result, { status: "complete", request: req, response }];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return [result, { status: "complete", request: req, response }];
|
|
176
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -72,8 +72,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
72
72
|
export const SDK_METADATA = {
|
|
73
73
|
language: "typescript",
|
|
74
74
|
openapiDocVersion: "0.0.3",
|
|
75
|
-
sdkVersion: "0.30.
|
|
76
|
-
genVersion: "2.568.
|
|
75
|
+
sdkVersion: "0.30.21",
|
|
76
|
+
genVersion: "2.568.5",
|
|
77
77
|
userAgent:
|
|
78
|
-
"speakeasy-sdk/typescript 0.30.
|
|
78
|
+
"speakeasy-sdk/typescript 0.30.21 2.568.5 0.0.3 @greensecurity/javascript-sdk",
|
|
79
79
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -40,6 +40,7 @@ import { tool$vendorsListVendorManagedByCompanies } from "./tools/vendorsListVen
|
|
|
40
40
|
import { tool$vendorsListVendorScrubDetails } from "./tools/vendorsListVendorScrubDetails.js";
|
|
41
41
|
import { tool$vendorsListVendorScrubPackages } from "./tools/vendorsListVendorScrubPackages.js";
|
|
42
42
|
import { tool$vendorsListVendorScrubPurchases } from "./tools/vendorsListVendorScrubPurchases.js";
|
|
43
|
+
import { tool$vendorsPurchaseScrubCredits } from "./tools/vendorsPurchaseScrubCredits.js";
|
|
43
44
|
import { tool$vendorsUpdateVendorDetails } from "./tools/vendorsUpdateVendorDetails.js";
|
|
44
45
|
import { tool$vendorsUpdateVendorManagedByCompany } from "./tools/vendorsUpdateVendorManagedByCompany.js";
|
|
45
46
|
import { tool$vendorsUpdateVendorScrubDetails } from "./tools/vendorsUpdateVendorScrubDetails.js";
|
|
@@ -56,7 +57,7 @@ export function createMCPServer(deps: {
|
|
|
56
57
|
}) {
|
|
57
58
|
const server = new McpServer({
|
|
58
59
|
name: "GreenSecurity",
|
|
59
|
-
version: "0.30.
|
|
60
|
+
version: "0.30.21",
|
|
60
61
|
});
|
|
61
62
|
|
|
62
63
|
const client = new GreenSecurityCore({
|
|
@@ -104,6 +105,7 @@ export function createMCPServer(deps: {
|
|
|
104
105
|
tool(tool$vendorsAddVendorManagedByCompany);
|
|
105
106
|
tool(tool$vendorsDeleteVendorManagedByCompany);
|
|
106
107
|
tool(tool$vendorsUpdateVendorManagedByCompany);
|
|
108
|
+
tool(tool$vendorsPurchaseScrubCredits);
|
|
107
109
|
tool(tool$usersGetCurrentUser);
|
|
108
110
|
tool(tool$usersGetUserById);
|
|
109
111
|
tool(tool$usersLogsUserIntoTheSystem);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { vendorsPurchaseScrubCredits } from "../../funcs/vendorsPurchaseScrubCredits.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.PurchaseScrubCreditsRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$vendorsPurchaseScrubCredits: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "vendors-purchase-scrub-credits",
|
|
15
|
+
description: `Purchase scrub credits
|
|
16
|
+
|
|
17
|
+
Purchase scrub credits`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await vendorsPurchaseScrubCredits(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -30,6 +30,7 @@ export * from "./logsuserintothesystem.js";
|
|
|
30
30
|
export * from "./magiclink.js";
|
|
31
31
|
export * from "./password.js";
|
|
32
32
|
export * from "./passwordresetrequest.js";
|
|
33
|
+
export * from "./purchasescrubcredits.js";
|
|
33
34
|
export * from "./updatevendordetails.js";
|
|
34
35
|
export * from "./updatevendormanagedbycompany.js";
|
|
35
36
|
export * from "./updatevendorscrubdetails.js";
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type PurchaseScrubCreditsRequestBody = {
|
|
12
|
+
payLater: boolean;
|
|
13
|
+
variantId: number;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type PurchaseScrubCreditsRequest = {
|
|
17
|
+
/**
|
|
18
|
+
* Either the ID of the vendor rep or the keyword "me" to represent the current vendor.
|
|
19
|
+
*/
|
|
20
|
+
vendorIdOrMe: string;
|
|
21
|
+
requestBody: PurchaseScrubCreditsRequestBody;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The request was successful, and the server has returned the requested resource in the response body.
|
|
26
|
+
*/
|
|
27
|
+
export type PurchaseScrubCreditsResponseBody = {
|
|
28
|
+
invoiceId?: number | undefined;
|
|
29
|
+
creditBalance?: number | undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const PurchaseScrubCreditsRequestBody$inboundSchema: z.ZodType<
|
|
34
|
+
PurchaseScrubCreditsRequestBody,
|
|
35
|
+
z.ZodTypeDef,
|
|
36
|
+
unknown
|
|
37
|
+
> = z.object({
|
|
38
|
+
pay_later: z.boolean(),
|
|
39
|
+
variant_id: z.number().int(),
|
|
40
|
+
}).transform((v) => {
|
|
41
|
+
return remap$(v, {
|
|
42
|
+
"pay_later": "payLater",
|
|
43
|
+
"variant_id": "variantId",
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/** @internal */
|
|
48
|
+
export type PurchaseScrubCreditsRequestBody$Outbound = {
|
|
49
|
+
pay_later: boolean;
|
|
50
|
+
variant_id: number;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** @internal */
|
|
54
|
+
export const PurchaseScrubCreditsRequestBody$outboundSchema: z.ZodType<
|
|
55
|
+
PurchaseScrubCreditsRequestBody$Outbound,
|
|
56
|
+
z.ZodTypeDef,
|
|
57
|
+
PurchaseScrubCreditsRequestBody
|
|
58
|
+
> = z.object({
|
|
59
|
+
payLater: z.boolean(),
|
|
60
|
+
variantId: z.number().int(),
|
|
61
|
+
}).transform((v) => {
|
|
62
|
+
return remap$(v, {
|
|
63
|
+
payLater: "pay_later",
|
|
64
|
+
variantId: "variant_id",
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
71
|
+
*/
|
|
72
|
+
export namespace PurchaseScrubCreditsRequestBody$ {
|
|
73
|
+
/** @deprecated use `PurchaseScrubCreditsRequestBody$inboundSchema` instead. */
|
|
74
|
+
export const inboundSchema = PurchaseScrubCreditsRequestBody$inboundSchema;
|
|
75
|
+
/** @deprecated use `PurchaseScrubCreditsRequestBody$outboundSchema` instead. */
|
|
76
|
+
export const outboundSchema = PurchaseScrubCreditsRequestBody$outboundSchema;
|
|
77
|
+
/** @deprecated use `PurchaseScrubCreditsRequestBody$Outbound` instead. */
|
|
78
|
+
export type Outbound = PurchaseScrubCreditsRequestBody$Outbound;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function purchaseScrubCreditsRequestBodyToJSON(
|
|
82
|
+
purchaseScrubCreditsRequestBody: PurchaseScrubCreditsRequestBody,
|
|
83
|
+
): string {
|
|
84
|
+
return JSON.stringify(
|
|
85
|
+
PurchaseScrubCreditsRequestBody$outboundSchema.parse(
|
|
86
|
+
purchaseScrubCreditsRequestBody,
|
|
87
|
+
),
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function purchaseScrubCreditsRequestBodyFromJSON(
|
|
92
|
+
jsonString: string,
|
|
93
|
+
): SafeParseResult<PurchaseScrubCreditsRequestBody, SDKValidationError> {
|
|
94
|
+
return safeParse(
|
|
95
|
+
jsonString,
|
|
96
|
+
(x) => PurchaseScrubCreditsRequestBody$inboundSchema.parse(JSON.parse(x)),
|
|
97
|
+
`Failed to parse 'PurchaseScrubCreditsRequestBody' from JSON`,
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** @internal */
|
|
102
|
+
export const PurchaseScrubCreditsRequest$inboundSchema: z.ZodType<
|
|
103
|
+
PurchaseScrubCreditsRequest,
|
|
104
|
+
z.ZodTypeDef,
|
|
105
|
+
unknown
|
|
106
|
+
> = z.object({
|
|
107
|
+
vendor_id_or_me: z.string(),
|
|
108
|
+
RequestBody: z.lazy(() => PurchaseScrubCreditsRequestBody$inboundSchema),
|
|
109
|
+
}).transform((v) => {
|
|
110
|
+
return remap$(v, {
|
|
111
|
+
"vendor_id_or_me": "vendorIdOrMe",
|
|
112
|
+
"RequestBody": "requestBody",
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
/** @internal */
|
|
117
|
+
export type PurchaseScrubCreditsRequest$Outbound = {
|
|
118
|
+
vendor_id_or_me: string;
|
|
119
|
+
RequestBody: PurchaseScrubCreditsRequestBody$Outbound;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/** @internal */
|
|
123
|
+
export const PurchaseScrubCreditsRequest$outboundSchema: z.ZodType<
|
|
124
|
+
PurchaseScrubCreditsRequest$Outbound,
|
|
125
|
+
z.ZodTypeDef,
|
|
126
|
+
PurchaseScrubCreditsRequest
|
|
127
|
+
> = z.object({
|
|
128
|
+
vendorIdOrMe: z.string(),
|
|
129
|
+
requestBody: z.lazy(() => PurchaseScrubCreditsRequestBody$outboundSchema),
|
|
130
|
+
}).transform((v) => {
|
|
131
|
+
return remap$(v, {
|
|
132
|
+
vendorIdOrMe: "vendor_id_or_me",
|
|
133
|
+
requestBody: "RequestBody",
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @internal
|
|
139
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
140
|
+
*/
|
|
141
|
+
export namespace PurchaseScrubCreditsRequest$ {
|
|
142
|
+
/** @deprecated use `PurchaseScrubCreditsRequest$inboundSchema` instead. */
|
|
143
|
+
export const inboundSchema = PurchaseScrubCreditsRequest$inboundSchema;
|
|
144
|
+
/** @deprecated use `PurchaseScrubCreditsRequest$outboundSchema` instead. */
|
|
145
|
+
export const outboundSchema = PurchaseScrubCreditsRequest$outboundSchema;
|
|
146
|
+
/** @deprecated use `PurchaseScrubCreditsRequest$Outbound` instead. */
|
|
147
|
+
export type Outbound = PurchaseScrubCreditsRequest$Outbound;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function purchaseScrubCreditsRequestToJSON(
|
|
151
|
+
purchaseScrubCreditsRequest: PurchaseScrubCreditsRequest,
|
|
152
|
+
): string {
|
|
153
|
+
return JSON.stringify(
|
|
154
|
+
PurchaseScrubCreditsRequest$outboundSchema.parse(
|
|
155
|
+
purchaseScrubCreditsRequest,
|
|
156
|
+
),
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function purchaseScrubCreditsRequestFromJSON(
|
|
161
|
+
jsonString: string,
|
|
162
|
+
): SafeParseResult<PurchaseScrubCreditsRequest, SDKValidationError> {
|
|
163
|
+
return safeParse(
|
|
164
|
+
jsonString,
|
|
165
|
+
(x) => PurchaseScrubCreditsRequest$inboundSchema.parse(JSON.parse(x)),
|
|
166
|
+
`Failed to parse 'PurchaseScrubCreditsRequest' from JSON`,
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** @internal */
|
|
171
|
+
export const PurchaseScrubCreditsResponseBody$inboundSchema: z.ZodType<
|
|
172
|
+
PurchaseScrubCreditsResponseBody,
|
|
173
|
+
z.ZodTypeDef,
|
|
174
|
+
unknown
|
|
175
|
+
> = z.object({
|
|
176
|
+
invoice_id: z.number().int().optional(),
|
|
177
|
+
credit_balance: z.number().int().optional(),
|
|
178
|
+
}).transform((v) => {
|
|
179
|
+
return remap$(v, {
|
|
180
|
+
"invoice_id": "invoiceId",
|
|
181
|
+
"credit_balance": "creditBalance",
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
/** @internal */
|
|
186
|
+
export type PurchaseScrubCreditsResponseBody$Outbound = {
|
|
187
|
+
invoice_id?: number | undefined;
|
|
188
|
+
credit_balance?: number | undefined;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/** @internal */
|
|
192
|
+
export const PurchaseScrubCreditsResponseBody$outboundSchema: z.ZodType<
|
|
193
|
+
PurchaseScrubCreditsResponseBody$Outbound,
|
|
194
|
+
z.ZodTypeDef,
|
|
195
|
+
PurchaseScrubCreditsResponseBody
|
|
196
|
+
> = z.object({
|
|
197
|
+
invoiceId: z.number().int().optional(),
|
|
198
|
+
creditBalance: z.number().int().optional(),
|
|
199
|
+
}).transform((v) => {
|
|
200
|
+
return remap$(v, {
|
|
201
|
+
invoiceId: "invoice_id",
|
|
202
|
+
creditBalance: "credit_balance",
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* @internal
|
|
208
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
209
|
+
*/
|
|
210
|
+
export namespace PurchaseScrubCreditsResponseBody$ {
|
|
211
|
+
/** @deprecated use `PurchaseScrubCreditsResponseBody$inboundSchema` instead. */
|
|
212
|
+
export const inboundSchema = PurchaseScrubCreditsResponseBody$inboundSchema;
|
|
213
|
+
/** @deprecated use `PurchaseScrubCreditsResponseBody$outboundSchema` instead. */
|
|
214
|
+
export const outboundSchema = PurchaseScrubCreditsResponseBody$outboundSchema;
|
|
215
|
+
/** @deprecated use `PurchaseScrubCreditsResponseBody$Outbound` instead. */
|
|
216
|
+
export type Outbound = PurchaseScrubCreditsResponseBody$Outbound;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export function purchaseScrubCreditsResponseBodyToJSON(
|
|
220
|
+
purchaseScrubCreditsResponseBody: PurchaseScrubCreditsResponseBody,
|
|
221
|
+
): string {
|
|
222
|
+
return JSON.stringify(
|
|
223
|
+
PurchaseScrubCreditsResponseBody$outboundSchema.parse(
|
|
224
|
+
purchaseScrubCreditsResponseBody,
|
|
225
|
+
),
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export function purchaseScrubCreditsResponseBodyFromJSON(
|
|
230
|
+
jsonString: string,
|
|
231
|
+
): SafeParseResult<PurchaseScrubCreditsResponseBody, SDKValidationError> {
|
|
232
|
+
return safeParse(
|
|
233
|
+
jsonString,
|
|
234
|
+
(x) => PurchaseScrubCreditsResponseBody$inboundSchema.parse(JSON.parse(x)),
|
|
235
|
+
`Failed to parse 'PurchaseScrubCreditsResponseBody' from JSON`,
|
|
236
|
+
);
|
|
237
|
+
}
|
package/src/react-query/index.ts
CHANGED
|
@@ -33,6 +33,7 @@ export * from "./vendorsListVendorManagedByCompanies.js";
|
|
|
33
33
|
export * from "./vendorsListVendorScrubDetails.js";
|
|
34
34
|
export * from "./vendorsListVendorScrubPackages.js";
|
|
35
35
|
export * from "./vendorsListVendorScrubPurchases.js";
|
|
36
|
+
export * from "./vendorsPurchaseScrubCredits.js";
|
|
36
37
|
export * from "./vendorsUpdateVendorDetails.js";
|
|
37
38
|
export * from "./vendorsUpdateVendorManagedByCompany.js";
|
|
38
39
|
export * from "./vendorsUpdateVendorScrubDetails.js";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
MutationKey,
|
|
7
|
+
useMutation,
|
|
8
|
+
UseMutationResult,
|
|
9
|
+
} from "@tanstack/react-query";
|
|
10
|
+
import { GreenSecurityCore } from "../core.js";
|
|
11
|
+
import { vendorsPurchaseScrubCredits } from "../funcs/vendorsPurchaseScrubCredits.js";
|
|
12
|
+
import { combineSignals } from "../lib/primitives.js";
|
|
13
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
16
|
+
import { useGreenSecurityContext } from "./_context.js";
|
|
17
|
+
import { MutationHookOptions } from "./_types.js";
|
|
18
|
+
|
|
19
|
+
export type VendorsPurchaseScrubCreditsMutationVariables = {
|
|
20
|
+
request: operations.PurchaseScrubCreditsRequest;
|
|
21
|
+
options?: RequestOptions;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type VendorsPurchaseScrubCreditsMutationData =
|
|
25
|
+
operations.PurchaseScrubCreditsResponseBody;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Purchase scrub credits
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Purchase scrub credits
|
|
32
|
+
*/
|
|
33
|
+
export function useVendorsPurchaseScrubCreditsMutation(
|
|
34
|
+
options?: MutationHookOptions<
|
|
35
|
+
VendorsPurchaseScrubCreditsMutationData,
|
|
36
|
+
Error,
|
|
37
|
+
VendorsPurchaseScrubCreditsMutationVariables
|
|
38
|
+
>,
|
|
39
|
+
): UseMutationResult<
|
|
40
|
+
VendorsPurchaseScrubCreditsMutationData,
|
|
41
|
+
Error,
|
|
42
|
+
VendorsPurchaseScrubCreditsMutationVariables
|
|
43
|
+
> {
|
|
44
|
+
const client = useGreenSecurityContext();
|
|
45
|
+
return useMutation({
|
|
46
|
+
...buildVendorsPurchaseScrubCreditsMutation(client, options),
|
|
47
|
+
...options,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function mutationKeyVendorsPurchaseScrubCredits(): MutationKey {
|
|
52
|
+
return ["@greensecurity/javascript-sdk", "vendors", "purchaseScrubCredits"];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function buildVendorsPurchaseScrubCreditsMutation(
|
|
56
|
+
client$: GreenSecurityCore,
|
|
57
|
+
hookOptions?: RequestOptions,
|
|
58
|
+
): {
|
|
59
|
+
mutationKey: MutationKey;
|
|
60
|
+
mutationFn: (
|
|
61
|
+
variables: VendorsPurchaseScrubCreditsMutationVariables,
|
|
62
|
+
) => Promise<VendorsPurchaseScrubCreditsMutationData>;
|
|
63
|
+
} {
|
|
64
|
+
return {
|
|
65
|
+
mutationKey: mutationKeyVendorsPurchaseScrubCredits(),
|
|
66
|
+
mutationFn: function vendorsPurchaseScrubCreditsMutationFn({
|
|
67
|
+
request,
|
|
68
|
+
options,
|
|
69
|
+
}): Promise<VendorsPurchaseScrubCreditsMutationData> {
|
|
70
|
+
const mergedOptions = {
|
|
71
|
+
...hookOptions,
|
|
72
|
+
...options,
|
|
73
|
+
fetchOptions: {
|
|
74
|
+
...hookOptions?.fetchOptions,
|
|
75
|
+
...options?.fetchOptions,
|
|
76
|
+
signal: combineSignals(
|
|
77
|
+
hookOptions?.fetchOptions?.signal,
|
|
78
|
+
options?.fetchOptions?.signal,
|
|
79
|
+
),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
return unwrapAsync(vendorsPurchaseScrubCredits(
|
|
83
|
+
client$,
|
|
84
|
+
request,
|
|
85
|
+
mergedOptions,
|
|
86
|
+
));
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
package/src/sdk/vendors.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { vendorsListVendorManagedByCompanies } from "../funcs/vendorsListVendorM
|
|
|
18
18
|
import { vendorsListVendorScrubDetails } from "../funcs/vendorsListVendorScrubDetails.js";
|
|
19
19
|
import { vendorsListVendorScrubPackages } from "../funcs/vendorsListVendorScrubPackages.js";
|
|
20
20
|
import { vendorsListVendorScrubPurchases } from "../funcs/vendorsListVendorScrubPurchases.js";
|
|
21
|
+
import { vendorsPurchaseScrubCredits } from "../funcs/vendorsPurchaseScrubCredits.js";
|
|
21
22
|
import { vendorsUpdateVendorDetails } from "../funcs/vendorsUpdateVendorDetails.js";
|
|
22
23
|
import { vendorsUpdateVendorManagedByCompany } from "../funcs/vendorsUpdateVendorManagedByCompany.js";
|
|
23
24
|
import { vendorsUpdateVendorScrubDetails } from "../funcs/vendorsUpdateVendorScrubDetails.js";
|
|
@@ -404,4 +405,21 @@ export class Vendors extends ClientSDK {
|
|
|
404
405
|
options,
|
|
405
406
|
));
|
|
406
407
|
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Purchase scrub credits
|
|
411
|
+
*
|
|
412
|
+
* @remarks
|
|
413
|
+
* Purchase scrub credits
|
|
414
|
+
*/
|
|
415
|
+
async purchaseScrubCredits(
|
|
416
|
+
request: operations.PurchaseScrubCreditsRequest,
|
|
417
|
+
options?: RequestOptions,
|
|
418
|
+
): Promise<operations.PurchaseScrubCreditsResponseBody> {
|
|
419
|
+
return unwrapAsync(vendorsPurchaseScrubCredits(
|
|
420
|
+
this,
|
|
421
|
+
request,
|
|
422
|
+
options,
|
|
423
|
+
));
|
|
424
|
+
}
|
|
407
425
|
}
|