@greensecurity/javascript-sdk 0.43.1-beta.102 → 0.43.1-beta.106
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/FUNCTIONS.md +10 -10
- package/REACT_QUERY.md +6 -10
- package/README.md +54 -52
- package/dist/commonjs/__tests__/vendorfields.test.d.ts +2 -0
- package/dist/commonjs/__tests__/vendorfields.test.d.ts.map +1 -0
- package/dist/commonjs/__tests__/vendorfields.test.js +43 -0
- package/dist/commonjs/__tests__/vendorfields.test.js.map +1 -0
- package/dist/commonjs/__tests__/zones.test.js +12 -13
- package/dist/commonjs/__tests__/zones.test.js.map +1 -1
- package/dist/commonjs/funcs/usersGetCurrentUser.d.ts +4 -2
- package/dist/commonjs/funcs/usersGetCurrentUser.d.ts.map +1 -1
- package/dist/commonjs/funcs/usersGetCurrentUser.js +19 -4
- package/dist/commonjs/funcs/usersGetCurrentUser.js.map +1 -1
- package/dist/commonjs/funcs/vendorFieldsCreateVendorField.d.ts +23 -0
- package/dist/commonjs/funcs/vendorFieldsCreateVendorField.d.ts.map +1 -0
- package/dist/commonjs/funcs/vendorFieldsCreateVendorField.js +122 -0
- package/dist/commonjs/funcs/vendorFieldsCreateVendorField.js.map +1 -0
- package/dist/commonjs/funcs/vendorFieldsUpdateVendorField.d.ts +21 -0
- package/dist/commonjs/funcs/vendorFieldsUpdateVendorField.d.ts.map +1 -0
- package/dist/commonjs/funcs/vendorFieldsUpdateVendorField.js +126 -0
- package/dist/commonjs/funcs/vendorFieldsUpdateVendorField.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/encodings.d.ts.map +1 -1
- package/dist/commonjs/lib/encodings.js +20 -5
- package/dist/commonjs/lib/encodings.js.map +1 -1
- package/dist/commonjs/models/components/productvariant.d.ts +10 -0
- package/dist/commonjs/models/components/productvariant.d.ts.map +1 -1
- package/dist/commonjs/models/components/productvariant.js +10 -1
- package/dist/commonjs/models/components/productvariant.js.map +1 -1
- package/dist/commonjs/models/operations/createvendorfield.d.ts +39 -0
- package/dist/commonjs/models/operations/createvendorfield.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createvendorfield.js +67 -0
- package/dist/commonjs/models/operations/createvendorfield.js.map +1 -0
- package/dist/commonjs/models/operations/getcurrentuser.d.ts +16 -0
- package/dist/commonjs/models/operations/getcurrentuser.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getcurrentuser.js +50 -0
- package/dist/commonjs/models/operations/getcurrentuser.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +3 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +3 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/updatevendorfield.d.ts +49 -0
- package/dist/commonjs/models/operations/updatevendorfield.d.ts.map +1 -0
- package/dist/commonjs/models/operations/updatevendorfield.js +84 -0
- package/dist/commonjs/models/operations/updatevendorfield.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +2 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +2 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/usersGetCurrentUser.core.d.ts +6 -3
- package/dist/commonjs/react-query/usersGetCurrentUser.core.d.ts.map +1 -1
- package/dist/commonjs/react-query/usersGetCurrentUser.core.js +12 -7
- package/dist/commonjs/react-query/usersGetCurrentUser.core.js.map +1 -1
- package/dist/commonjs/react-query/usersGetCurrentUser.d.ts +17 -6
- package/dist/commonjs/react-query/usersGetCurrentUser.d.ts.map +1 -1
- package/dist/commonjs/react-query/usersGetCurrentUser.js +22 -8
- package/dist/commonjs/react-query/usersGetCurrentUser.js.map +1 -1
- package/dist/commonjs/react-query/vendorFieldsCreateVendorField.d.ts +34 -0
- package/dist/commonjs/react-query/vendorFieldsCreateVendorField.d.ts.map +1 -0
- package/dist/commonjs/react-query/vendorFieldsCreateVendorField.js +56 -0
- package/dist/commonjs/react-query/vendorFieldsCreateVendorField.js.map +1 -0
- package/dist/commonjs/react-query/vendorFieldsUpdateVendorField.d.ts +32 -0
- package/dist/commonjs/react-query/vendorFieldsUpdateVendorField.d.ts.map +1 -0
- package/dist/commonjs/react-query/vendorFieldsUpdateVendorField.js +54 -0
- package/dist/commonjs/react-query/vendorFieldsUpdateVendorField.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/commonjs/sdk/users.d.ts +3 -2
- package/dist/commonjs/sdk/users.d.ts.map +1 -1
- package/dist/commonjs/sdk/users.js +4 -3
- package/dist/commonjs/sdk/users.js.map +1 -1
- package/dist/commonjs/sdk/vendorfields.d.ts +27 -0
- package/dist/commonjs/sdk/vendorfields.d.ts.map +1 -0
- package/dist/commonjs/sdk/vendorfields.js +40 -0
- package/dist/commonjs/sdk/vendorfields.js.map +1 -0
- package/dist/esm/__tests__/vendorfields.test.d.ts +2 -0
- package/dist/esm/__tests__/vendorfields.test.d.ts.map +1 -0
- package/dist/esm/__tests__/vendorfields.test.js +41 -0
- package/dist/esm/__tests__/vendorfields.test.js.map +1 -0
- package/dist/esm/__tests__/zones.test.js +12 -13
- package/dist/esm/__tests__/zones.test.js.map +1 -1
- package/dist/esm/funcs/usersGetCurrentUser.d.ts +4 -2
- package/dist/esm/funcs/usersGetCurrentUser.d.ts.map +1 -1
- package/dist/esm/funcs/usersGetCurrentUser.js +19 -4
- package/dist/esm/funcs/usersGetCurrentUser.js.map +1 -1
- package/dist/esm/funcs/vendorFieldsCreateVendorField.d.ts +23 -0
- package/dist/esm/funcs/vendorFieldsCreateVendorField.d.ts.map +1 -0
- package/dist/esm/funcs/vendorFieldsCreateVendorField.js +86 -0
- package/dist/esm/funcs/vendorFieldsCreateVendorField.js.map +1 -0
- package/dist/esm/funcs/vendorFieldsUpdateVendorField.d.ts +21 -0
- package/dist/esm/funcs/vendorFieldsUpdateVendorField.d.ts.map +1 -0
- package/dist/esm/funcs/vendorFieldsUpdateVendorField.js +90 -0
- package/dist/esm/funcs/vendorFieldsUpdateVendorField.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/encodings.d.ts.map +1 -1
- package/dist/esm/lib/encodings.js +20 -5
- package/dist/esm/lib/encodings.js.map +1 -1
- package/dist/esm/models/components/productvariant.d.ts +10 -0
- package/dist/esm/models/components/productvariant.d.ts.map +1 -1
- package/dist/esm/models/components/productvariant.js +9 -0
- package/dist/esm/models/components/productvariant.js.map +1 -1
- package/dist/esm/models/operations/createvendorfield.d.ts +39 -0
- package/dist/esm/models/operations/createvendorfield.d.ts.map +1 -0
- package/dist/esm/models/operations/createvendorfield.js +29 -0
- package/dist/esm/models/operations/createvendorfield.js.map +1 -0
- package/dist/esm/models/operations/getcurrentuser.d.ts +16 -0
- package/dist/esm/models/operations/getcurrentuser.d.ts.map +1 -0
- package/dist/esm/models/operations/getcurrentuser.js +13 -0
- package/dist/esm/models/operations/getcurrentuser.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +3 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +3 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/updatevendorfield.d.ts +49 -0
- package/dist/esm/models/operations/updatevendorfield.d.ts.map +1 -0
- package/dist/esm/models/operations/updatevendorfield.js +45 -0
- package/dist/esm/models/operations/updatevendorfield.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +2 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +2 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/usersGetCurrentUser.core.d.ts +6 -3
- package/dist/esm/react-query/usersGetCurrentUser.core.d.ts.map +1 -1
- package/dist/esm/react-query/usersGetCurrentUser.core.js +12 -7
- package/dist/esm/react-query/usersGetCurrentUser.core.js.map +1 -1
- package/dist/esm/react-query/usersGetCurrentUser.d.ts +17 -6
- package/dist/esm/react-query/usersGetCurrentUser.d.ts.map +1 -1
- package/dist/esm/react-query/usersGetCurrentUser.js +21 -8
- package/dist/esm/react-query/usersGetCurrentUser.js.map +1 -1
- package/dist/esm/react-query/vendorFieldsCreateVendorField.d.ts +34 -0
- package/dist/esm/react-query/vendorFieldsCreateVendorField.d.ts.map +1 -0
- package/dist/esm/react-query/vendorFieldsCreateVendorField.js +51 -0
- package/dist/esm/react-query/vendorFieldsCreateVendorField.js.map +1 -0
- package/dist/esm/react-query/vendorFieldsUpdateVendorField.d.ts +32 -0
- package/dist/esm/react-query/vendorFieldsUpdateVendorField.d.ts.map +1 -0
- package/dist/esm/react-query/vendorFieldsUpdateVendorField.js +49 -0
- package/dist/esm/react-query/vendorFieldsUpdateVendorField.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/dist/esm/sdk/users.d.ts +3 -2
- package/dist/esm/sdk/users.d.ts.map +1 -1
- package/dist/esm/sdk/users.js +4 -3
- package/dist/esm/sdk/users.js.map +1 -1
- package/dist/esm/sdk/vendorfields.d.ts +27 -0
- package/dist/esm/sdk/vendorfields.d.ts.map +1 -0
- package/dist/esm/sdk/vendorfields.js +36 -0
- package/dist/esm/sdk/vendorfields.js.map +1 -0
- package/examples/{vendorsCreateVendorRegistration.example.ts → vendorFieldsCreateVendorField.example.ts} +9 -9
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/vendorfields.test.ts +47 -0
- package/src/__tests__/zones.test.ts +12 -13
- package/src/funcs/usersGetCurrentUser.ts +25 -1
- package/src/funcs/vendorFieldsCreateVendorField.ts +174 -0
- package/src/funcs/vendorFieldsUpdateVendorField.ts +177 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/encodings.ts +23 -4
- package/src/models/components/productvariant.ts +18 -0
- package/src/models/operations/createvendorfield.ts +87 -0
- package/src/models/operations/getcurrentuser.ts +35 -0
- package/src/models/operations/index.ts +3 -0
- package/src/models/operations/updatevendorfield.ts +122 -0
- package/src/react-query/index.ts +2 -0
- package/src/react-query/usersGetCurrentUser.core.ts +15 -3
- package/src/react-query/usersGetCurrentUser.ts +35 -4
- package/src/react-query/vendorFieldsCreateVendorField.ts +120 -0
- package/src/react-query/vendorFieldsUpdateVendorField.ts +118 -0
- package/src/sdk/sdk.ts +6 -0
- package/src/sdk/users.ts +4 -1
- package/src/sdk/vendorfields.ts +53 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { vendorFieldsCreateVendorField } from "../funcs/vendorFieldsCreateVendorField.js";
|
|
5
|
+
import { vendorFieldsUpdateVendorField } from "../funcs/vendorFieldsUpdateVendorField.js";
|
|
6
|
+
import { ClientSDK } from "../lib/sdks.js";
|
|
7
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
8
|
+
export class VendorFields extends ClientSDK {
|
|
9
|
+
/**
|
|
10
|
+
* Create vendor field
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Create a new vendor field for a company. The name can only be set on creation;
|
|
14
|
+
* once created, only the show_to_vendor flag can be updated via PATCH.
|
|
15
|
+
* Requires access to the company (company manager, admin, or API user with company scope).
|
|
16
|
+
*
|
|
17
|
+
* For API users: source_user_id is required. The API user acts on behalf of that user
|
|
18
|
+
* (e.g. a company manager). The app must be activated for that user via MarketplaceAppActivation.
|
|
19
|
+
*/
|
|
20
|
+
async createVendorField(request, options) {
|
|
21
|
+
return unwrapAsync(vendorFieldsCreateVendorField(this, request, options));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Update vendor field
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* Update a vendor field. Only the show_to_vendor flag can be changed;
|
|
28
|
+
* the name cannot be modified after creation.
|
|
29
|
+
*
|
|
30
|
+
* For API users: source_user_id is required. The API user acts on behalf of that user.
|
|
31
|
+
*/
|
|
32
|
+
async updateVendorField(request, options) {
|
|
33
|
+
return unwrapAsync(vendorFieldsUpdateVendorField(this, request, options));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=vendorfields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendorfields.js","sourceRoot":"","sources":["../../../src/sdk/vendorfields.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,EAAE,6BAA6B,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAAO,YAAa,SAAQ,SAAS;IACzC;;;;;;;;;;OAUG;IACH,KAAK,CAAC,iBAAiB,CACrB,OAAgD,EAChD,OAAwB;QAExB,OAAO,WAAW,CAAC,6BAA6B,CAC9C,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,iBAAiB,CACrB,OAA4C,EAC5C,OAAwB;QAExB,OAAO,WAAW,CAAC,6BAA6B,CAC9C,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -8,21 +8,21 @@ dotenv.config();
|
|
|
8
8
|
* Example usage of the @greensecurity/javascript-sdk SDK
|
|
9
9
|
*
|
|
10
10
|
* To run this example from the examples directory:
|
|
11
|
-
* npm run build && npx tsx
|
|
11
|
+
* npm run build && npx tsx vendorFieldsCreateVendorField.example.ts
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { GreenSecurity } from "@greensecurity/javascript-sdk";
|
|
15
15
|
|
|
16
|
-
const greenSecurity = new GreenSecurity(
|
|
16
|
+
const greenSecurity = new GreenSecurity({
|
|
17
|
+
security: {
|
|
18
|
+
bearerJwt: process.env["GREEN_SECURITY_BEARER_JWT"] ?? "",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
17
21
|
|
|
18
22
|
async function main() {
|
|
19
|
-
const result = await greenSecurity.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
timezone: "America/Chicago",
|
|
23
|
-
affiliateId: 123,
|
|
24
|
-
vendorGroupId: 123,
|
|
25
|
-
managingCompanyId: 123,
|
|
23
|
+
const result = await greenSecurity.vendorFields.createVendorField({
|
|
24
|
+
companyId: 814595,
|
|
25
|
+
name: "<value>",
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
console.log(result);
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { expect, test } from "vitest";
|
|
6
|
+
import { GreenSecurity } from "../index.js";
|
|
7
|
+
import { createTestHTTPClient } from "./testclient.js";
|
|
8
|
+
|
|
9
|
+
test("Vendor Fields Create Vendor Field", async () => {
|
|
10
|
+
const testHttpClient = createTestHTTPClient("createVendorField");
|
|
11
|
+
|
|
12
|
+
const greenSecurity = new GreenSecurity({
|
|
13
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
|
|
14
|
+
httpClient: testHttpClient,
|
|
15
|
+
security: {
|
|
16
|
+
token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const result = await greenSecurity.vendorFields.createVendorField({
|
|
21
|
+
companyId: 814595,
|
|
22
|
+
name: "<value>",
|
|
23
|
+
});
|
|
24
|
+
expect(result).toBeDefined();
|
|
25
|
+
expect(result).toEqual({});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("Vendor Fields Update Vendor Field", async () => {
|
|
29
|
+
const testHttpClient = createTestHTTPClient("updateVendorField");
|
|
30
|
+
|
|
31
|
+
const greenSecurity = new GreenSecurity({
|
|
32
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
|
|
33
|
+
httpClient: testHttpClient,
|
|
34
|
+
security: {
|
|
35
|
+
token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const result = await greenSecurity.vendorFields.updateVendorField({
|
|
40
|
+
id: 426182,
|
|
41
|
+
requestBody: {
|
|
42
|
+
showToVendor: true,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
expect(result).toBeDefined();
|
|
46
|
+
expect(result).toEqual({});
|
|
47
|
+
});
|
|
@@ -42,27 +42,27 @@ test("Zones List Or Search Security Zones", async () => {
|
|
|
42
42
|
facility: {
|
|
43
43
|
contacts: {
|
|
44
44
|
contact: {
|
|
45
|
-
status: "
|
|
46
|
-
department:
|
|
45
|
+
status: "Active",
|
|
46
|
+
department: 123,
|
|
47
|
+
},
|
|
48
|
+
adminContact: {
|
|
49
|
+
status: "Inactive",
|
|
50
|
+
department: 123,
|
|
47
51
|
},
|
|
48
|
-
adminContact: null,
|
|
49
52
|
techContact: {
|
|
50
|
-
status: "
|
|
53
|
+
status: "Active",
|
|
51
54
|
department: 123,
|
|
52
55
|
},
|
|
53
56
|
greenSecurityCsm: {
|
|
54
|
-
status: "
|
|
55
|
-
department: null,
|
|
56
|
-
},
|
|
57
|
-
accountManager: {
|
|
58
|
-
status: "Inactive",
|
|
57
|
+
status: "Active",
|
|
59
58
|
department: 123,
|
|
60
59
|
},
|
|
60
|
+
accountManager: null,
|
|
61
61
|
},
|
|
62
62
|
vendorGuestPolicy: {
|
|
63
63
|
enabled: false,
|
|
64
64
|
vendorGuestLimitAndOr: "and",
|
|
65
|
-
vendorGuestRequireEmail:
|
|
65
|
+
vendorGuestRequireEmail: true,
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
68
|
},
|
|
@@ -82,9 +82,8 @@ test("Zones Security Zone Checkin", async () => {
|
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
const result = await greenSecurity.zones.securityZoneCheckin({
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
zoneId: 654096,
|
|
85
|
+
qrCode: "<value>",
|
|
86
|
+
zoneId: 776072,
|
|
88
87
|
});
|
|
89
88
|
expect(result).toBeDefined();
|
|
90
89
|
expect(result).toEqual({});
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { GreenSecurityCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
6
7
|
import * as M from "../lib/matchers.js";
|
|
7
8
|
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
10
|
import { RequestOptions } from "../lib/sdks.js";
|
|
9
11
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
10
12
|
import { pathToFunc } from "../lib/url.js";
|
|
@@ -20,6 +22,7 @@ import {
|
|
|
20
22
|
import * as errors from "../models/errors/index.js";
|
|
21
23
|
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
22
24
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
23
26
|
import { APICall, APIPromise } from "../types/async.js";
|
|
24
27
|
import { Result } from "../types/fp.js";
|
|
25
28
|
|
|
@@ -27,10 +30,12 @@ import { Result } from "../types/fp.js";
|
|
|
27
30
|
* Get current user
|
|
28
31
|
*
|
|
29
32
|
* @remarks
|
|
30
|
-
* Returns a user object for the user represented by the authorization token
|
|
33
|
+
* Returns a user object for the user represented by the authorization token.
|
|
34
|
+
* For Company Manager users, the `company` object supports expand. Available values: company.vendor_fields, company.location, company.vendor_type_restrictions.
|
|
31
35
|
*/
|
|
32
36
|
export function usersGetCurrentUser(
|
|
33
37
|
client: GreenSecurityCore,
|
|
38
|
+
request: operations.GetCurrentUserRequest,
|
|
34
39
|
options?: RequestOptions,
|
|
35
40
|
): APIPromise<
|
|
36
41
|
Result<
|
|
@@ -48,12 +53,14 @@ export function usersGetCurrentUser(
|
|
|
48
53
|
> {
|
|
49
54
|
return new APIPromise($do(
|
|
50
55
|
client,
|
|
56
|
+
request,
|
|
51
57
|
options,
|
|
52
58
|
));
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
async function $do(
|
|
56
62
|
client: GreenSecurityCore,
|
|
63
|
+
request: operations.GetCurrentUserRequest,
|
|
57
64
|
options?: RequestOptions,
|
|
58
65
|
): Promise<
|
|
59
66
|
[
|
|
@@ -72,8 +79,23 @@ async function $do(
|
|
|
72
79
|
APICall,
|
|
73
80
|
]
|
|
74
81
|
> {
|
|
82
|
+
const parsed = safeParse(
|
|
83
|
+
request,
|
|
84
|
+
(value) => operations.GetCurrentUserRequest$outboundSchema.parse(value),
|
|
85
|
+
"Input validation failed",
|
|
86
|
+
);
|
|
87
|
+
if (!parsed.ok) {
|
|
88
|
+
return [parsed, { status: "invalid" }];
|
|
89
|
+
}
|
|
90
|
+
const payload = parsed.value;
|
|
91
|
+
const body = null;
|
|
92
|
+
|
|
75
93
|
const path = pathToFunc("/users/me")();
|
|
76
94
|
|
|
95
|
+
const query = encodeFormQuery({
|
|
96
|
+
"expand": payload.expand,
|
|
97
|
+
}, { explode: false });
|
|
98
|
+
|
|
77
99
|
const headers = new Headers(compactMap({
|
|
78
100
|
Accept: "application/json",
|
|
79
101
|
}));
|
|
@@ -102,6 +124,8 @@ async function $do(
|
|
|
102
124
|
baseURL: options?.serverURL,
|
|
103
125
|
path: path,
|
|
104
126
|
headers: headers,
|
|
127
|
+
query: query,
|
|
128
|
+
body: body,
|
|
105
129
|
userAgent: client._options.userAgent,
|
|
106
130
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
107
131
|
}, options);
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GreenSecurityCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } 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 { GreenSecurityError } from "../models/errors/greensecurityerror.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 { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Create vendor field
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Create a new vendor field for a company. The name can only be set on creation;
|
|
33
|
+
* once created, only the show_to_vendor flag can be updated via PATCH.
|
|
34
|
+
* Requires access to the company (company manager, admin, or API user with company scope).
|
|
35
|
+
*
|
|
36
|
+
* For API users: source_user_id is required. The API user acts on behalf of that user
|
|
37
|
+
* (e.g. a company manager). The app must be activated for that user via MarketplaceAppActivation.
|
|
38
|
+
*/
|
|
39
|
+
export function vendorFieldsCreateVendorField(
|
|
40
|
+
client: GreenSecurityCore,
|
|
41
|
+
request: operations.CreateVendorFieldRequestBody,
|
|
42
|
+
options?: RequestOptions,
|
|
43
|
+
): APIPromise<
|
|
44
|
+
Result<
|
|
45
|
+
operations.CreateVendorFieldResponseBody,
|
|
46
|
+
| errors.ApiErrorResponse
|
|
47
|
+
| GreenSecurityError
|
|
48
|
+
| ResponseValidationError
|
|
49
|
+
| ConnectionError
|
|
50
|
+
| RequestAbortedError
|
|
51
|
+
| RequestTimeoutError
|
|
52
|
+
| InvalidRequestError
|
|
53
|
+
| UnexpectedClientError
|
|
54
|
+
| SDKValidationError
|
|
55
|
+
>
|
|
56
|
+
> {
|
|
57
|
+
return new APIPromise($do(
|
|
58
|
+
client,
|
|
59
|
+
request,
|
|
60
|
+
options,
|
|
61
|
+
));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function $do(
|
|
65
|
+
client: GreenSecurityCore,
|
|
66
|
+
request: operations.CreateVendorFieldRequestBody,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<
|
|
69
|
+
[
|
|
70
|
+
Result<
|
|
71
|
+
operations.CreateVendorFieldResponseBody,
|
|
72
|
+
| errors.ApiErrorResponse
|
|
73
|
+
| GreenSecurityError
|
|
74
|
+
| ResponseValidationError
|
|
75
|
+
| ConnectionError
|
|
76
|
+
| RequestAbortedError
|
|
77
|
+
| RequestTimeoutError
|
|
78
|
+
| InvalidRequestError
|
|
79
|
+
| UnexpectedClientError
|
|
80
|
+
| SDKValidationError
|
|
81
|
+
>,
|
|
82
|
+
APICall,
|
|
83
|
+
]
|
|
84
|
+
> {
|
|
85
|
+
const parsed = safeParse(
|
|
86
|
+
request,
|
|
87
|
+
(value) =>
|
|
88
|
+
operations.CreateVendorFieldRequestBody$outboundSchema.parse(value),
|
|
89
|
+
"Input validation failed",
|
|
90
|
+
);
|
|
91
|
+
if (!parsed.ok) {
|
|
92
|
+
return [parsed, { status: "invalid" }];
|
|
93
|
+
}
|
|
94
|
+
const payload = parsed.value;
|
|
95
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
96
|
+
|
|
97
|
+
const path = pathToFunc("/vendor-fields")();
|
|
98
|
+
|
|
99
|
+
const headers = new Headers(compactMap({
|
|
100
|
+
"Content-Type": "application/json",
|
|
101
|
+
Accept: "application/json",
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
105
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
106
|
+
|
|
107
|
+
const context = {
|
|
108
|
+
options: client._options,
|
|
109
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
110
|
+
operationID: "createVendorField",
|
|
111
|
+
oAuth2Scopes: null,
|
|
112
|
+
|
|
113
|
+
resolvedSecurity: requestSecurity,
|
|
114
|
+
|
|
115
|
+
securitySource: client._options.security,
|
|
116
|
+
retryConfig: options?.retries
|
|
117
|
+
|| client._options.retryConfig
|
|
118
|
+
|| { strategy: "none" },
|
|
119
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const requestRes = client._createRequest(context, {
|
|
123
|
+
security: requestSecurity,
|
|
124
|
+
method: "POST",
|
|
125
|
+
baseURL: options?.serverURL,
|
|
126
|
+
path: path,
|
|
127
|
+
headers: headers,
|
|
128
|
+
body: body,
|
|
129
|
+
userAgent: client._options.userAgent,
|
|
130
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
131
|
+
}, options);
|
|
132
|
+
if (!requestRes.ok) {
|
|
133
|
+
return [requestRes, { status: "invalid" }];
|
|
134
|
+
}
|
|
135
|
+
const req = requestRes.value;
|
|
136
|
+
|
|
137
|
+
const doResult = await client._do(req, {
|
|
138
|
+
context,
|
|
139
|
+
errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
|
140
|
+
retryConfig: context.retryConfig,
|
|
141
|
+
retryCodes: context.retryCodes,
|
|
142
|
+
});
|
|
143
|
+
if (!doResult.ok) {
|
|
144
|
+
return [doResult, { status: "request-error", request: req }];
|
|
145
|
+
}
|
|
146
|
+
const response = doResult.value;
|
|
147
|
+
|
|
148
|
+
const responseFields = {
|
|
149
|
+
HttpMeta: { Response: response, Request: req },
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const [result] = await M.match<
|
|
153
|
+
operations.CreateVendorFieldResponseBody,
|
|
154
|
+
| errors.ApiErrorResponse
|
|
155
|
+
| GreenSecurityError
|
|
156
|
+
| ResponseValidationError
|
|
157
|
+
| ConnectionError
|
|
158
|
+
| RequestAbortedError
|
|
159
|
+
| RequestTimeoutError
|
|
160
|
+
| InvalidRequestError
|
|
161
|
+
| UnexpectedClientError
|
|
162
|
+
| SDKValidationError
|
|
163
|
+
>(
|
|
164
|
+
M.json(201, operations.CreateVendorFieldResponseBody$inboundSchema),
|
|
165
|
+
M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
|
|
166
|
+
M.fail("4XX"),
|
|
167
|
+
M.fail([500, "5XX"]),
|
|
168
|
+
)(response, req, { extraFields: responseFields });
|
|
169
|
+
if (!result.ok) {
|
|
170
|
+
return [result, { status: "complete", request: req, response }];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return [result, { status: "complete", request: req, response }];
|
|
174
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
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 { GreenSecurityError } from "../models/errors/greensecurityerror.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 { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Update vendor field
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Update a vendor field. Only the show_to_vendor flag can be changed;
|
|
33
|
+
* the name cannot be modified after creation.
|
|
34
|
+
*
|
|
35
|
+
* For API users: source_user_id is required. The API user acts on behalf of that user.
|
|
36
|
+
*/
|
|
37
|
+
export function vendorFieldsUpdateVendorField(
|
|
38
|
+
client: GreenSecurityCore,
|
|
39
|
+
request: operations.UpdateVendorFieldRequest,
|
|
40
|
+
options?: RequestOptions,
|
|
41
|
+
): APIPromise<
|
|
42
|
+
Result<
|
|
43
|
+
operations.UpdateVendorFieldResponseBody,
|
|
44
|
+
| errors.ApiErrorResponse
|
|
45
|
+
| GreenSecurityError
|
|
46
|
+
| ResponseValidationError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
| RequestAbortedError
|
|
49
|
+
| RequestTimeoutError
|
|
50
|
+
| InvalidRequestError
|
|
51
|
+
| UnexpectedClientError
|
|
52
|
+
| SDKValidationError
|
|
53
|
+
>
|
|
54
|
+
> {
|
|
55
|
+
return new APIPromise($do(
|
|
56
|
+
client,
|
|
57
|
+
request,
|
|
58
|
+
options,
|
|
59
|
+
));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function $do(
|
|
63
|
+
client: GreenSecurityCore,
|
|
64
|
+
request: operations.UpdateVendorFieldRequest,
|
|
65
|
+
options?: RequestOptions,
|
|
66
|
+
): Promise<
|
|
67
|
+
[
|
|
68
|
+
Result<
|
|
69
|
+
operations.UpdateVendorFieldResponseBody,
|
|
70
|
+
| errors.ApiErrorResponse
|
|
71
|
+
| GreenSecurityError
|
|
72
|
+
| ResponseValidationError
|
|
73
|
+
| ConnectionError
|
|
74
|
+
| RequestAbortedError
|
|
75
|
+
| RequestTimeoutError
|
|
76
|
+
| InvalidRequestError
|
|
77
|
+
| UnexpectedClientError
|
|
78
|
+
| SDKValidationError
|
|
79
|
+
>,
|
|
80
|
+
APICall,
|
|
81
|
+
]
|
|
82
|
+
> {
|
|
83
|
+
const parsed = safeParse(
|
|
84
|
+
request,
|
|
85
|
+
(value) => operations.UpdateVendorFieldRequest$outboundSchema.parse(value),
|
|
86
|
+
"Input validation failed",
|
|
87
|
+
);
|
|
88
|
+
if (!parsed.ok) {
|
|
89
|
+
return [parsed, { status: "invalid" }];
|
|
90
|
+
}
|
|
91
|
+
const payload = parsed.value;
|
|
92
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
93
|
+
|
|
94
|
+
const pathParams = {
|
|
95
|
+
id: encodeSimple("id", payload.id, {
|
|
96
|
+
explode: false,
|
|
97
|
+
charEncoding: "percent",
|
|
98
|
+
}),
|
|
99
|
+
};
|
|
100
|
+
const path = pathToFunc("/vendor-fields/{id}")(pathParams);
|
|
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
|
+
options: client._options,
|
|
112
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
113
|
+
operationID: "updateVendorField",
|
|
114
|
+
oAuth2Scopes: null,
|
|
115
|
+
|
|
116
|
+
resolvedSecurity: requestSecurity,
|
|
117
|
+
|
|
118
|
+
securitySource: client._options.security,
|
|
119
|
+
retryConfig: options?.retries
|
|
120
|
+
|| client._options.retryConfig
|
|
121
|
+
|| { strategy: "none" },
|
|
122
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const requestRes = client._createRequest(context, {
|
|
126
|
+
security: requestSecurity,
|
|
127
|
+
method: "PATCH",
|
|
128
|
+
baseURL: options?.serverURL,
|
|
129
|
+
path: path,
|
|
130
|
+
headers: headers,
|
|
131
|
+
body: body,
|
|
132
|
+
userAgent: client._options.userAgent,
|
|
133
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
134
|
+
}, options);
|
|
135
|
+
if (!requestRes.ok) {
|
|
136
|
+
return [requestRes, { status: "invalid" }];
|
|
137
|
+
}
|
|
138
|
+
const req = requestRes.value;
|
|
139
|
+
|
|
140
|
+
const doResult = await client._do(req, {
|
|
141
|
+
context,
|
|
142
|
+
errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
|
143
|
+
retryConfig: context.retryConfig,
|
|
144
|
+
retryCodes: context.retryCodes,
|
|
145
|
+
});
|
|
146
|
+
if (!doResult.ok) {
|
|
147
|
+
return [doResult, { status: "request-error", request: req }];
|
|
148
|
+
}
|
|
149
|
+
const response = doResult.value;
|
|
150
|
+
|
|
151
|
+
const responseFields = {
|
|
152
|
+
HttpMeta: { Response: response, Request: req },
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const [result] = await M.match<
|
|
156
|
+
operations.UpdateVendorFieldResponseBody,
|
|
157
|
+
| errors.ApiErrorResponse
|
|
158
|
+
| GreenSecurityError
|
|
159
|
+
| ResponseValidationError
|
|
160
|
+
| ConnectionError
|
|
161
|
+
| RequestAbortedError
|
|
162
|
+
| RequestTimeoutError
|
|
163
|
+
| InvalidRequestError
|
|
164
|
+
| UnexpectedClientError
|
|
165
|
+
| SDKValidationError
|
|
166
|
+
>(
|
|
167
|
+
M.json(200, operations.UpdateVendorFieldResponseBody$inboundSchema),
|
|
168
|
+
M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
|
|
169
|
+
M.fail("4XX"),
|
|
170
|
+
M.fail([500, "5XX"]),
|
|
171
|
+
)(response, req, { extraFields: responseFields });
|
|
172
|
+
if (!result.ok) {
|
|
173
|
+
return [result, { status: "complete", request: req, response }];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return [result, { status: "complete", request: req, response }];
|
|
177
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -80,8 +80,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
80
80
|
export const SDK_METADATA = {
|
|
81
81
|
language: "typescript",
|
|
82
82
|
openapiDocVersion: "0.0.11",
|
|
83
|
-
sdkVersion: "0.43.1-beta.
|
|
84
|
-
genVersion: "2.869.
|
|
83
|
+
sdkVersion: "0.43.1-beta.104",
|
|
84
|
+
genVersion: "2.869.25",
|
|
85
85
|
userAgent:
|
|
86
|
-
"speakeasy-sdk/typescript 0.43.1-beta.
|
|
86
|
+
"speakeasy-sdk/typescript 0.43.1-beta.104 2.869.25 0.0.11 @greensecurity/javascript-sdk",
|
|
87
87
|
} as const;
|
package/src/lib/encodings.ts
CHANGED
|
@@ -479,6 +479,23 @@ export const encodeSpaceDelimitedQuery = queryEncoder(encodeSpaceDelimited);
|
|
|
479
479
|
export const encodePipeDelimitedQuery = queryEncoder(encodePipeDelimited);
|
|
480
480
|
export const encodeDeepObjectQuery = queryEncoder(encodeDeepObject);
|
|
481
481
|
|
|
482
|
+
function isBlobLike(val: unknown): val is Blob {
|
|
483
|
+
if (val instanceof Blob) {
|
|
484
|
+
return true;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
if (typeof val !== "object" || val == null || !(Symbol.toStringTag in val)) {
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
const tag = val[Symbol.toStringTag];
|
|
492
|
+
if (tag !== "Blob" && tag !== "File") {
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
return "stream" in val && typeof val.stream === "function";
|
|
497
|
+
}
|
|
498
|
+
|
|
482
499
|
export function appendForm(
|
|
483
500
|
fd: FormData,
|
|
484
501
|
key: string,
|
|
@@ -487,10 +504,12 @@ export function appendForm(
|
|
|
487
504
|
): void {
|
|
488
505
|
if (value == null) {
|
|
489
506
|
return;
|
|
490
|
-
} else if (value
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
507
|
+
} else if (isBlobLike(value)) {
|
|
508
|
+
if (fileName) {
|
|
509
|
+
fd.append(key, value as Blob, fileName);
|
|
510
|
+
} else {
|
|
511
|
+
fd.append(key, value as Blob);
|
|
512
|
+
}
|
|
494
513
|
} else {
|
|
495
514
|
fd.append(key, String(value));
|
|
496
515
|
}
|