@greensecurity/javascript-sdk 0.43.1-beta.114 → 0.43.1-beta.116
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 +6 -0
- package/dist/commonjs/__tests__/users.test.js +100 -0
- package/dist/commonjs/__tests__/users.test.js.map +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
- package/dist/commonjs/__tests__/zones.test.js +7 -8
- package/dist/commonjs/__tests__/zones.test.js.map +1 -1
- package/dist/commonjs/funcs/usersUpdateUser.d.ts +26 -0
- package/dist/commonjs/funcs/usersUpdateUser.d.ts.map +1 -0
- package/dist/commonjs/funcs/usersUpdateUser.js +131 -0
- package/dist/commonjs/funcs/usersUpdateUser.js.map +1 -0
- package/dist/commonjs/funcs/usersUpdateUserProfilePicture.d.ts +20 -0
- package/dist/commonjs/funcs/usersUpdateUserProfilePicture.d.ts.map +1 -0
- package/dist/commonjs/funcs/usersUpdateUserProfilePicture.js +126 -0
- package/dist/commonjs/funcs/usersUpdateUserProfilePicture.js.map +1 -0
- package/dist/commonjs/funcs/vendorFieldsCreateVendorField.d.ts +3 -2
- package/dist/commonjs/funcs/vendorFieldsCreateVendorField.d.ts.map +1 -1
- package/dist/commonjs/funcs/vendorFieldsCreateVendorField.js +3 -2
- package/dist/commonjs/funcs/vendorFieldsCreateVendorField.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/company.d.ts +5 -0
- package/dist/commonjs/models/components/company.d.ts.map +1 -1
- package/dist/commonjs/models/components/company.js +4 -0
- package/dist/commonjs/models/components/company.js.map +1 -1
- package/dist/commonjs/models/components/companyvendorfield.d.ts +16 -0
- package/dist/commonjs/models/components/companyvendorfield.d.ts.map +1 -0
- package/dist/commonjs/models/components/companyvendorfield.js +60 -0
- package/dist/commonjs/models/components/companyvendorfield.js.map +1 -0
- package/dist/commonjs/models/components/expand.d.ts +2 -0
- package/dist/commonjs/models/components/expand.d.ts.map +1 -1
- package/dist/commonjs/models/components/expand.js +2 -0
- package/dist/commonjs/models/components/expand.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +1 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +1 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/vendor.d.ts +1 -0
- package/dist/commonjs/models/components/vendor.d.ts.map +1 -1
- package/dist/commonjs/models/components/vendor.js +2 -0
- package/dist/commonjs/models/components/vendor.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/updateuser.d.ts +74 -0
- package/dist/commonjs/models/operations/updateuser.d.ts.map +1 -0
- package/dist/commonjs/models/operations/updateuser.js +96 -0
- package/dist/commonjs/models/operations/updateuser.js.map +1 -0
- package/dist/commonjs/models/operations/updateuserprofilepicture.d.ts +70 -0
- package/dist/commonjs/models/operations/updateuserprofilepicture.d.ts.map +1 -0
- package/dist/commonjs/models/operations/updateuserprofilepicture.js +93 -0
- package/dist/commonjs/models/operations/updateuserprofilepicture.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/usersUpdateUser.d.ts +35 -0
- package/dist/commonjs/react-query/usersUpdateUser.d.ts.map +1 -0
- package/dist/commonjs/react-query/usersUpdateUser.js +53 -0
- package/dist/commonjs/react-query/usersUpdateUser.js.map +1 -0
- package/dist/commonjs/react-query/usersUpdateUserProfilePicture.d.ts +29 -0
- package/dist/commonjs/react-query/usersUpdateUserProfilePicture.d.ts.map +1 -0
- package/dist/commonjs/react-query/usersUpdateUserProfilePicture.js +47 -0
- package/dist/commonjs/react-query/usersUpdateUserProfilePicture.js.map +1 -0
- package/dist/commonjs/react-query/vendorFieldsCreateVendorField.d.ts +3 -2
- package/dist/commonjs/react-query/vendorFieldsCreateVendorField.d.ts.map +1 -1
- package/dist/commonjs/react-query/vendorFieldsCreateVendorField.js +3 -2
- package/dist/commonjs/react-query/vendorFieldsCreateVendorField.js.map +1 -1
- package/dist/commonjs/sdk/users.d.ts +20 -0
- package/dist/commonjs/sdk/users.d.ts.map +1 -1
- package/dist/commonjs/sdk/users.js +26 -0
- package/dist/commonjs/sdk/users.js.map +1 -1
- package/dist/commonjs/sdk/vendorfields.d.ts +3 -2
- package/dist/commonjs/sdk/vendorfields.d.ts.map +1 -1
- package/dist/commonjs/sdk/vendorfields.js +3 -2
- package/dist/commonjs/sdk/vendorfields.js.map +1 -1
- package/dist/esm/__tests__/users.test.js +100 -0
- package/dist/esm/__tests__/users.test.js.map +1 -1
- package/dist/esm/__tests__/webhooks.test.js +1 -1
- package/dist/esm/__tests__/webhooks.test.js.map +1 -1
- package/dist/esm/__tests__/zones.test.js +7 -8
- package/dist/esm/__tests__/zones.test.js.map +1 -1
- package/dist/esm/funcs/usersUpdateUser.d.ts +26 -0
- package/dist/esm/funcs/usersUpdateUser.d.ts.map +1 -0
- package/dist/esm/funcs/usersUpdateUser.js +95 -0
- package/dist/esm/funcs/usersUpdateUser.js.map +1 -0
- package/dist/esm/funcs/usersUpdateUserProfilePicture.d.ts +20 -0
- package/dist/esm/funcs/usersUpdateUserProfilePicture.d.ts.map +1 -0
- package/dist/esm/funcs/usersUpdateUserProfilePicture.js +90 -0
- package/dist/esm/funcs/usersUpdateUserProfilePicture.js.map +1 -0
- package/dist/esm/funcs/vendorFieldsCreateVendorField.d.ts +3 -2
- package/dist/esm/funcs/vendorFieldsCreateVendorField.d.ts.map +1 -1
- package/dist/esm/funcs/vendorFieldsCreateVendorField.js +3 -2
- package/dist/esm/funcs/vendorFieldsCreateVendorField.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/company.d.ts +5 -0
- package/dist/esm/models/components/company.d.ts.map +1 -1
- package/dist/esm/models/components/company.js +4 -0
- package/dist/esm/models/components/company.js.map +1 -1
- package/dist/esm/models/components/companyvendorfield.d.ts +16 -0
- package/dist/esm/models/components/companyvendorfield.d.ts.map +1 -0
- package/dist/esm/models/components/companyvendorfield.js +23 -0
- package/dist/esm/models/components/companyvendorfield.js.map +1 -0
- package/dist/esm/models/components/expand.d.ts +2 -0
- package/dist/esm/models/components/expand.d.ts.map +1 -1
- package/dist/esm/models/components/expand.js +2 -0
- package/dist/esm/models/components/expand.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +1 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +1 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/vendor.d.ts +1 -0
- package/dist/esm/models/components/vendor.d.ts.map +1 -1
- package/dist/esm/models/components/vendor.js +2 -0
- package/dist/esm/models/components/vendor.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/updateuser.d.ts +74 -0
- package/dist/esm/models/operations/updateuser.d.ts.map +1 -0
- package/dist/esm/models/operations/updateuser.js +57 -0
- package/dist/esm/models/operations/updateuser.js.map +1 -0
- package/dist/esm/models/operations/updateuserprofilepicture.d.ts +70 -0
- package/dist/esm/models/operations/updateuserprofilepicture.d.ts.map +1 -0
- package/dist/esm/models/operations/updateuserprofilepicture.js +54 -0
- package/dist/esm/models/operations/updateuserprofilepicture.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/usersUpdateUser.d.ts +35 -0
- package/dist/esm/react-query/usersUpdateUser.d.ts.map +1 -0
- package/dist/esm/react-query/usersUpdateUser.js +48 -0
- package/dist/esm/react-query/usersUpdateUser.js.map +1 -0
- package/dist/esm/react-query/usersUpdateUserProfilePicture.d.ts +29 -0
- package/dist/esm/react-query/usersUpdateUserProfilePicture.d.ts.map +1 -0
- package/dist/esm/react-query/usersUpdateUserProfilePicture.js +42 -0
- package/dist/esm/react-query/usersUpdateUserProfilePicture.js.map +1 -0
- package/dist/esm/react-query/vendorFieldsCreateVendorField.d.ts +3 -2
- package/dist/esm/react-query/vendorFieldsCreateVendorField.d.ts.map +1 -1
- package/dist/esm/react-query/vendorFieldsCreateVendorField.js +3 -2
- package/dist/esm/react-query/vendorFieldsCreateVendorField.js.map +1 -1
- package/dist/esm/sdk/users.d.ts +20 -0
- package/dist/esm/sdk/users.d.ts.map +1 -1
- package/dist/esm/sdk/users.js +26 -0
- package/dist/esm/sdk/users.js.map +1 -1
- package/dist/esm/sdk/vendorfields.d.ts +3 -2
- package/dist/esm/sdk/vendorfields.d.ts.map +1 -1
- package/dist/esm/sdk/vendorfields.js +3 -2
- package/dist/esm/sdk/vendorfields.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/users.test.ts +106 -0
- package/src/__tests__/webhooks.test.ts +1 -1
- package/src/__tests__/zones.test.ts +7 -8
- package/src/funcs/usersUpdateUser.ts +182 -0
- package/src/funcs/usersUpdateUserProfilePicture.ts +181 -0
- package/src/funcs/vendorFieldsCreateVendorField.ts +3 -2
- package/src/lib/config.ts +2 -2
- package/src/models/components/company.ts +11 -0
- package/src/models/components/companyvendorfield.ts +47 -0
- package/src/models/components/expand.ts +2 -0
- package/src/models/components/index.ts +1 -0
- package/src/models/components/vendor.ts +3 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/updateuser.ts +156 -0
- package/src/models/operations/updateuserprofilepicture.ts +154 -0
- package/src/react-query/index.ts +2 -0
- package/src/react-query/usersUpdateUser.ts +116 -0
- package/src/react-query/usersUpdateUserProfilePicture.ts +111 -0
- package/src/react-query/vendorFieldsCreateVendorField.ts +3 -2
- package/src/sdk/users.ts +42 -0
- package/src/sdk/vendorfields.ts +3 -2
|
@@ -91,3 +91,109 @@ test("Users Switch Account", async () => {
|
|
|
91
91
|
userToken: {},
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
|
+
|
|
95
|
+
test("Users Update User", async () => {
|
|
96
|
+
const testHttpClient = createTestHTTPClient("updateUser");
|
|
97
|
+
|
|
98
|
+
const greenSecurity = new GreenSecurity({
|
|
99
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
|
|
100
|
+
httpClient: testHttpClient,
|
|
101
|
+
security: {
|
|
102
|
+
token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const result = await greenSecurity.users.updateUser({
|
|
107
|
+
id: "<id>",
|
|
108
|
+
requestBody: {
|
|
109
|
+
timezone: "America/New_York",
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
expect(result).toBeDefined();
|
|
113
|
+
expect(result).toEqual({
|
|
114
|
+
user: {
|
|
115
|
+
isGatekeeper: true,
|
|
116
|
+
success: true,
|
|
117
|
+
user: {
|
|
118
|
+
id: 123,
|
|
119
|
+
firstName: "John",
|
|
120
|
+
lastName: "Doe",
|
|
121
|
+
email: "john@example.com",
|
|
122
|
+
phone: "555-555-5555",
|
|
123
|
+
userType: "Facility User",
|
|
124
|
+
timezone: "America/Chicago",
|
|
125
|
+
},
|
|
126
|
+
userToken: {
|
|
127
|
+
token: "WDCINRKRKYQ3TUEUEUEHEGWN6WKXP7N12345C8CSHQVJD7D6I",
|
|
128
|
+
tokenType: "permanent",
|
|
129
|
+
},
|
|
130
|
+
vendor: {
|
|
131
|
+
badge: {
|
|
132
|
+
badgeType: "rfid",
|
|
133
|
+
},
|
|
134
|
+
vendorJob: {
|
|
135
|
+
id: 154462,
|
|
136
|
+
job: "Account Representatives/Managers|Account Executive",
|
|
137
|
+
},
|
|
138
|
+
primaryFacility: {
|
|
139
|
+
contacts: {
|
|
140
|
+
contact: {
|
|
141
|
+
status: "Deleted",
|
|
142
|
+
department: 123,
|
|
143
|
+
},
|
|
144
|
+
adminContact: {
|
|
145
|
+
status: "Inactive",
|
|
146
|
+
department: 123,
|
|
147
|
+
},
|
|
148
|
+
techContact: {
|
|
149
|
+
status: "Deleted",
|
|
150
|
+
department: 123,
|
|
151
|
+
},
|
|
152
|
+
greenSecurityCsm: {
|
|
153
|
+
status: "Inactive",
|
|
154
|
+
department: 123,
|
|
155
|
+
},
|
|
156
|
+
accountManager: {
|
|
157
|
+
status: "Inactive",
|
|
158
|
+
department: 123,
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
vendorGuestPolicy: {
|
|
162
|
+
enabled: true,
|
|
163
|
+
vendorGuestLimitAndOr: "and",
|
|
164
|
+
vendorGuestRequireEmail: true,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
contact: {
|
|
169
|
+
status: "Deleted",
|
|
170
|
+
department: 123,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test("Users Update User Profile Picture", async () => {
|
|
177
|
+
const testHttpClient = createTestHTTPClient("updateUserProfilePicture");
|
|
178
|
+
|
|
179
|
+
const greenSecurity = new GreenSecurity({
|
|
180
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
|
|
181
|
+
httpClient: testHttpClient,
|
|
182
|
+
security: {
|
|
183
|
+
token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
const result = await greenSecurity.users.updateUserProfilePicture({
|
|
188
|
+
idOrMe: "<value>",
|
|
189
|
+
requestBody: {
|
|
190
|
+
imageFileName: "<value>",
|
|
191
|
+
imageContentType: "image/jpeg",
|
|
192
|
+
imageFileSize: 443381,
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
expect(result).toBeDefined();
|
|
196
|
+
expect(result).toEqual({
|
|
197
|
+
id: 541107,
|
|
198
|
+
});
|
|
199
|
+
});
|
|
@@ -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: true,
|
|
24
24
|
sort: "",
|
|
25
25
|
});
|
|
26
26
|
expect(testWebhookListForVendorUserResult).toBeDefined();
|
|
@@ -39,7 +39,7 @@ test("Zones List Or Search Security Zones", async () => {
|
|
|
39
39
|
facility: {
|
|
40
40
|
contacts: {
|
|
41
41
|
contact: {
|
|
42
|
-
status: "
|
|
42
|
+
status: "Deleted",
|
|
43
43
|
department: 123,
|
|
44
44
|
},
|
|
45
45
|
adminContact: {
|
|
@@ -47,20 +47,20 @@ test("Zones List Or Search Security Zones", async () => {
|
|
|
47
47
|
department: 123,
|
|
48
48
|
},
|
|
49
49
|
techContact: {
|
|
50
|
-
status: "
|
|
50
|
+
status: "Deleted",
|
|
51
51
|
department: 123,
|
|
52
52
|
},
|
|
53
53
|
greenSecurityCsm: {
|
|
54
|
-
status: "
|
|
54
|
+
status: "Inactive",
|
|
55
55
|
department: 123,
|
|
56
56
|
},
|
|
57
57
|
accountManager: {
|
|
58
|
-
status: "
|
|
58
|
+
status: "Active",
|
|
59
59
|
department: 123,
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
vendorGuestPolicy: {
|
|
63
|
-
enabled:
|
|
63
|
+
enabled: false,
|
|
64
64
|
vendorGuestLimitAndOr: "and",
|
|
65
65
|
vendorGuestRequireEmail: false,
|
|
66
66
|
},
|
|
@@ -85,9 +85,8 @@ test("Zones Security Zone Checkin", async () => {
|
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
const result = await greenSecurity.zones.securityZoneCheckin({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
zoneId: 944641,
|
|
88
|
+
qrCode: "<value>",
|
|
89
|
+
zoneId: 185875,
|
|
91
90
|
});
|
|
92
91
|
expect(result).toBeDefined();
|
|
93
92
|
expect(result).toEqual({});
|
|
@@ -0,0 +1,182 @@
|
|
|
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 user by ID
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Updates the contact information, address, and locale settings of a user.
|
|
33
|
+
* Pass `me` as `{id}` to update the authenticated user's own profile.
|
|
34
|
+
*
|
|
35
|
+
* Only submitted fields are applied — unrecognised fields are silently ignored.
|
|
36
|
+
* Changing `email` automatically resets `bounced_email` to `false`.
|
|
37
|
+
*
|
|
38
|
+
* To rotate an API token use `POST /users/api_key_rotator` instead.
|
|
39
|
+
*
|
|
40
|
+
* If set, this operation will use {@link Security.bearerJwt} from the global security.
|
|
41
|
+
*/
|
|
42
|
+
export function usersUpdateUser(
|
|
43
|
+
client: GreenSecurityCore,
|
|
44
|
+
request: operations.UpdateUserRequest,
|
|
45
|
+
options?: RequestOptions,
|
|
46
|
+
): APIPromise<
|
|
47
|
+
Result<
|
|
48
|
+
operations.UpdateUserUpdateUserOk,
|
|
49
|
+
| errors.ApiErrorResponse
|
|
50
|
+
| GreenSecurityError
|
|
51
|
+
| ResponseValidationError
|
|
52
|
+
| ConnectionError
|
|
53
|
+
| RequestAbortedError
|
|
54
|
+
| RequestTimeoutError
|
|
55
|
+
| InvalidRequestError
|
|
56
|
+
| UnexpectedClientError
|
|
57
|
+
| SDKValidationError
|
|
58
|
+
>
|
|
59
|
+
> {
|
|
60
|
+
return new APIPromise($do(
|
|
61
|
+
client,
|
|
62
|
+
request,
|
|
63
|
+
options,
|
|
64
|
+
));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function $do(
|
|
68
|
+
client: GreenSecurityCore,
|
|
69
|
+
request: operations.UpdateUserRequest,
|
|
70
|
+
options?: RequestOptions,
|
|
71
|
+
): Promise<
|
|
72
|
+
[
|
|
73
|
+
Result<
|
|
74
|
+
operations.UpdateUserUpdateUserOk,
|
|
75
|
+
| errors.ApiErrorResponse
|
|
76
|
+
| GreenSecurityError
|
|
77
|
+
| ResponseValidationError
|
|
78
|
+
| ConnectionError
|
|
79
|
+
| RequestAbortedError
|
|
80
|
+
| RequestTimeoutError
|
|
81
|
+
| InvalidRequestError
|
|
82
|
+
| UnexpectedClientError
|
|
83
|
+
| SDKValidationError
|
|
84
|
+
>,
|
|
85
|
+
APICall,
|
|
86
|
+
]
|
|
87
|
+
> {
|
|
88
|
+
const parsed = safeParse(
|
|
89
|
+
request,
|
|
90
|
+
(value) => operations.UpdateUserRequest$outboundSchema.parse(value),
|
|
91
|
+
"Input validation failed",
|
|
92
|
+
);
|
|
93
|
+
if (!parsed.ok) {
|
|
94
|
+
return [parsed, { status: "invalid" }];
|
|
95
|
+
}
|
|
96
|
+
const payload = parsed.value;
|
|
97
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
98
|
+
|
|
99
|
+
const pathParams = {
|
|
100
|
+
id: encodeSimple("id", payload.id, {
|
|
101
|
+
explode: false,
|
|
102
|
+
charEncoding: "percent",
|
|
103
|
+
}),
|
|
104
|
+
};
|
|
105
|
+
const path = pathToFunc("/users/{id}")(pathParams);
|
|
106
|
+
|
|
107
|
+
const headers = new Headers(compactMap({
|
|
108
|
+
"Content-Type": "application/json",
|
|
109
|
+
Accept: "application/json",
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
113
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [1]);
|
|
114
|
+
|
|
115
|
+
const context = {
|
|
116
|
+
options: client._options,
|
|
117
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
118
|
+
operationID: "updateUser",
|
|
119
|
+
oAuth2Scopes: null,
|
|
120
|
+
|
|
121
|
+
resolvedSecurity: requestSecurity,
|
|
122
|
+
|
|
123
|
+
securitySource: client._options.security,
|
|
124
|
+
retryConfig: options?.retries
|
|
125
|
+
|| client._options.retryConfig
|
|
126
|
+
|| { strategy: "none" },
|
|
127
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const requestRes = client._createRequest(context, {
|
|
131
|
+
security: requestSecurity,
|
|
132
|
+
method: "PUT",
|
|
133
|
+
baseURL: options?.serverURL,
|
|
134
|
+
path: path,
|
|
135
|
+
headers: headers,
|
|
136
|
+
body: body,
|
|
137
|
+
userAgent: client._options.userAgent,
|
|
138
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
139
|
+
}, options);
|
|
140
|
+
if (!requestRes.ok) {
|
|
141
|
+
return [requestRes, { status: "invalid" }];
|
|
142
|
+
}
|
|
143
|
+
const req = requestRes.value;
|
|
144
|
+
|
|
145
|
+
const doResult = await client._do(req, {
|
|
146
|
+
context,
|
|
147
|
+
errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
|
148
|
+
retryConfig: context.retryConfig,
|
|
149
|
+
retryCodes: context.retryCodes,
|
|
150
|
+
});
|
|
151
|
+
if (!doResult.ok) {
|
|
152
|
+
return [doResult, { status: "request-error", request: req }];
|
|
153
|
+
}
|
|
154
|
+
const response = doResult.value;
|
|
155
|
+
|
|
156
|
+
const responseFields = {
|
|
157
|
+
HttpMeta: { Response: response, Request: req },
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const [result] = await M.match<
|
|
161
|
+
operations.UpdateUserUpdateUserOk,
|
|
162
|
+
| errors.ApiErrorResponse
|
|
163
|
+
| GreenSecurityError
|
|
164
|
+
| ResponseValidationError
|
|
165
|
+
| ConnectionError
|
|
166
|
+
| RequestAbortedError
|
|
167
|
+
| RequestTimeoutError
|
|
168
|
+
| InvalidRequestError
|
|
169
|
+
| UnexpectedClientError
|
|
170
|
+
| SDKValidationError
|
|
171
|
+
>(
|
|
172
|
+
M.json(200, operations.UpdateUserUpdateUserOk$inboundSchema),
|
|
173
|
+
M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
|
|
174
|
+
M.fail("4XX"),
|
|
175
|
+
M.fail([500, "5XX"]),
|
|
176
|
+
)(response, req, { extraFields: responseFields });
|
|
177
|
+
if (!result.ok) {
|
|
178
|
+
return [result, { status: "complete", request: req, response }];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return [result, { status: "complete", request: req, response }];
|
|
182
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
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
|
+
* Register profile picture metadata for S3 direct upload
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Register profile picture metadata for a user. The client should then upload the file directly to S3 at user_profile_image/{id}.{ext}. An AWS Lambda function processes the image (resize to tiny/thumb/large) and triggers a callback. Use 'me' as the id for the authenticated user. Requires authentication and either self-ownership or 'users:edit' permission. API users must be authorized via MarketplaceAppActivation.
|
|
33
|
+
*
|
|
34
|
+
* If set, this operation will use {@link Security.bearerJwt} from the global security.
|
|
35
|
+
*/
|
|
36
|
+
export function usersUpdateUserProfilePicture(
|
|
37
|
+
client: GreenSecurityCore,
|
|
38
|
+
request: operations.UpdateUserProfilePictureRequest,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<
|
|
41
|
+
Result<
|
|
42
|
+
operations.UpdateUserProfilePictureUpdateUserProfilePictureOk,
|
|
43
|
+
| errors.ApiErrorResponse
|
|
44
|
+
| GreenSecurityError
|
|
45
|
+
| ResponseValidationError
|
|
46
|
+
| ConnectionError
|
|
47
|
+
| RequestAbortedError
|
|
48
|
+
| RequestTimeoutError
|
|
49
|
+
| InvalidRequestError
|
|
50
|
+
| UnexpectedClientError
|
|
51
|
+
| SDKValidationError
|
|
52
|
+
>
|
|
53
|
+
> {
|
|
54
|
+
return new APIPromise($do(
|
|
55
|
+
client,
|
|
56
|
+
request,
|
|
57
|
+
options,
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function $do(
|
|
62
|
+
client: GreenSecurityCore,
|
|
63
|
+
request: operations.UpdateUserProfilePictureRequest,
|
|
64
|
+
options?: RequestOptions,
|
|
65
|
+
): Promise<
|
|
66
|
+
[
|
|
67
|
+
Result<
|
|
68
|
+
operations.UpdateUserProfilePictureUpdateUserProfilePictureOk,
|
|
69
|
+
| errors.ApiErrorResponse
|
|
70
|
+
| GreenSecurityError
|
|
71
|
+
| ResponseValidationError
|
|
72
|
+
| ConnectionError
|
|
73
|
+
| RequestAbortedError
|
|
74
|
+
| RequestTimeoutError
|
|
75
|
+
| InvalidRequestError
|
|
76
|
+
| UnexpectedClientError
|
|
77
|
+
| SDKValidationError
|
|
78
|
+
>,
|
|
79
|
+
APICall,
|
|
80
|
+
]
|
|
81
|
+
> {
|
|
82
|
+
const parsed = safeParse(
|
|
83
|
+
request,
|
|
84
|
+
(value) =>
|
|
85
|
+
operations.UpdateUserProfilePictureRequest$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_or_me: encodeSimple("id_or_me", payload.id_or_me, {
|
|
96
|
+
explode: false,
|
|
97
|
+
charEncoding: "percent",
|
|
98
|
+
}),
|
|
99
|
+
};
|
|
100
|
+
const path = pathToFunc("/users/{id_or_me}/profile_picture")(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, [1]);
|
|
109
|
+
|
|
110
|
+
const context = {
|
|
111
|
+
options: client._options,
|
|
112
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
113
|
+
operationID: "updateUserProfilePicture",
|
|
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: "PUT",
|
|
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.UpdateUserProfilePictureUpdateUserProfilePictureOk,
|
|
157
|
+
| errors.ApiErrorResponse
|
|
158
|
+
| GreenSecurityError
|
|
159
|
+
| ResponseValidationError
|
|
160
|
+
| ConnectionError
|
|
161
|
+
| RequestAbortedError
|
|
162
|
+
| RequestTimeoutError
|
|
163
|
+
| InvalidRequestError
|
|
164
|
+
| UnexpectedClientError
|
|
165
|
+
| SDKValidationError
|
|
166
|
+
>(
|
|
167
|
+
M.json(
|
|
168
|
+
200,
|
|
169
|
+
operations
|
|
170
|
+
.UpdateUserProfilePictureUpdateUserProfilePictureOk$inboundSchema,
|
|
171
|
+
),
|
|
172
|
+
M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
|
|
173
|
+
M.fail([422, "4XX"]),
|
|
174
|
+
M.fail([500, "5XX"]),
|
|
175
|
+
)(response, req, { extraFields: responseFields });
|
|
176
|
+
if (!result.ok) {
|
|
177
|
+
return [result, { status: "complete", request: req, response }];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return [result, { status: "complete", request: req, response }];
|
|
181
|
+
}
|
|
@@ -29,8 +29,9 @@ import { Result } from "../types/fp.js";
|
|
|
29
29
|
* Create vendor field
|
|
30
30
|
*
|
|
31
31
|
* @remarks
|
|
32
|
-
* Create a new vendor field for a company.
|
|
33
|
-
*
|
|
32
|
+
* Create a new vendor field for a company. Each company may have at most one custom
|
|
33
|
+
* vendor field; if one already exists, the request fails with 422. The name can only
|
|
34
|
+
* be set on creation; once created, only the show_to_vendor flag can be updated via PATCH.
|
|
34
35
|
* Requires access to the company (company manager, admin, or API user with company scope).
|
|
35
36
|
*
|
|
36
37
|
* For API users: source_user_id is required. The API user acts on behalf of that user
|
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.
|
|
83
|
+
sdkVersion: "0.43.1-beta.115",
|
|
84
84
|
genVersion: "2.879.6",
|
|
85
85
|
userAgent:
|
|
86
|
-
"speakeasy-sdk/typescript 0.43.1-beta.
|
|
86
|
+
"speakeasy-sdk/typescript 0.43.1-beta.115 2.879.6 0.0.11 @greensecurity/javascript-sdk",
|
|
87
87
|
} as const;
|
|
@@ -8,6 +8,10 @@ import { safeParse } from "../../lib/schemas.js";
|
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import * as types from "../../types/primitives.js";
|
|
10
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
import {
|
|
12
|
+
CompanyVendorField,
|
|
13
|
+
CompanyVendorField$inboundSchema,
|
|
14
|
+
} from "./companyvendorfield.js";
|
|
11
15
|
import {
|
|
12
16
|
CompanyVendorTypeRestriction,
|
|
13
17
|
CompanyVendorTypeRestriction$inboundSchema,
|
|
@@ -56,6 +60,10 @@ export type Company = {
|
|
|
56
60
|
contact?: CompanyContact | undefined;
|
|
57
61
|
tax?: Tax | undefined;
|
|
58
62
|
stats?: Stats | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Result of expanding `company.vendor_fields` on the company object.
|
|
65
|
+
*/
|
|
66
|
+
vendorFields?: Array<CompanyVendorField> | null | undefined;
|
|
59
67
|
vendorTypeRestrictions?:
|
|
60
68
|
| Array<CompanyVendorTypeRestriction | null>
|
|
61
69
|
| null
|
|
@@ -176,12 +184,15 @@ export const Company$inboundSchema: z.ZodType<Company, z.ZodTypeDef, unknown> =
|
|
|
176
184
|
contact: types.optional(z.lazy(() => CompanyContact$inboundSchema)),
|
|
177
185
|
tax: types.optional(z.lazy(() => Tax$inboundSchema)),
|
|
178
186
|
stats: types.optional(z.lazy(() => Stats$inboundSchema)),
|
|
187
|
+
vendor_fields: z.nullable(z.array(CompanyVendorField$inboundSchema))
|
|
188
|
+
.optional(),
|
|
179
189
|
vendor_type_restrictions: z.nullable(
|
|
180
190
|
z.array(types.nullable(CompanyVendorTypeRestriction$inboundSchema)),
|
|
181
191
|
).optional(),
|
|
182
192
|
}).transform((v) => {
|
|
183
193
|
return remap$(v, {
|
|
184
194
|
"credit_balance": "creditBalance",
|
|
195
|
+
"vendor_fields": "vendorFields",
|
|
185
196
|
"vendor_type_restrictions": "vendorTypeRestrictions",
|
|
186
197
|
});
|
|
187
198
|
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import * as types from "../../types/primitives.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A vendor field definition created by a company.
|
|
14
|
+
*/
|
|
15
|
+
export type CompanyVendorField = {
|
|
16
|
+
id: number;
|
|
17
|
+
name: string;
|
|
18
|
+
showToVendor: boolean;
|
|
19
|
+
fieldType: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** @internal */
|
|
23
|
+
export const CompanyVendorField$inboundSchema: z.ZodType<
|
|
24
|
+
CompanyVendorField,
|
|
25
|
+
z.ZodTypeDef,
|
|
26
|
+
unknown
|
|
27
|
+
> = z.object({
|
|
28
|
+
id: types.number(),
|
|
29
|
+
name: types.string(),
|
|
30
|
+
show_to_vendor: types.boolean(),
|
|
31
|
+
field_type: types.string(),
|
|
32
|
+
}).transform((v) => {
|
|
33
|
+
return remap$(v, {
|
|
34
|
+
"show_to_vendor": "showToVendor",
|
|
35
|
+
"field_type": "fieldType",
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export function companyVendorFieldFromJSON(
|
|
40
|
+
jsonString: string,
|
|
41
|
+
): SafeParseResult<CompanyVendorField, SDKValidationError> {
|
|
42
|
+
return safeParse(
|
|
43
|
+
jsonString,
|
|
44
|
+
(x) => CompanyVendorField$inboundSchema.parse(JSON.parse(x)),
|
|
45
|
+
`Failed to parse 'CompanyVendorField' from JSON`,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -11,6 +11,8 @@ import { ClosedEnum } from "../../types/enums.js";
|
|
|
11
11
|
export const Expand = {
|
|
12
12
|
User: "user",
|
|
13
13
|
CompanyLocation: "company.location",
|
|
14
|
+
CompanyVendorFields: "company.vendor_fields",
|
|
15
|
+
CompanyVendorTypeRestrictions: "company.vendor_type_restrictions",
|
|
14
16
|
ContactFacility: "contact.facility",
|
|
15
17
|
ContactSystem: "contact.system",
|
|
16
18
|
ContactDepartment: "contact.department",
|
|
@@ -7,6 +7,7 @@ export * from "./alert.js";
|
|
|
7
7
|
export * from "./backgroundcheckresult.js";
|
|
8
8
|
export * from "./company.js";
|
|
9
9
|
export * from "./companymanager.js";
|
|
10
|
+
export * from "./companyvendorfield.js";
|
|
10
11
|
export * from "./companyvendortyperestriction.js";
|
|
11
12
|
export * from "./contact.js";
|
|
12
13
|
export * from "./contenttype.js";
|
|
@@ -34,6 +34,7 @@ import { VendorType, VendorType$inboundSchema } from "./vendortype.js";
|
|
|
34
34
|
|
|
35
35
|
export type Badge = {
|
|
36
36
|
badgeType?: string | undefined;
|
|
37
|
+
badgeMacAddress?: string | null | undefined;
|
|
37
38
|
requiredBadgeType?: string | null | undefined;
|
|
38
39
|
};
|
|
39
40
|
|
|
@@ -193,10 +194,12 @@ export type Vendor = {
|
|
|
193
194
|
export const Badge$inboundSchema: z.ZodType<Badge, z.ZodTypeDef, unknown> = z
|
|
194
195
|
.object({
|
|
195
196
|
badge_type: types.optional(types.string()),
|
|
197
|
+
badge_mac_address: z.nullable(types.string()).optional(),
|
|
196
198
|
required_badge_type: z.nullable(types.string()).optional(),
|
|
197
199
|
}).transform((v) => {
|
|
198
200
|
return remap$(v, {
|
|
199
201
|
"badge_type": "badgeType",
|
|
202
|
+
"badge_mac_address": "badgeMacAddress",
|
|
200
203
|
"required_badge_type": "requiredBadgeType",
|
|
201
204
|
});
|
|
202
205
|
});
|
|
@@ -100,7 +100,9 @@ export * from "./updateevent.js";
|
|
|
100
100
|
export * from "./updatefhirconfigbyid.js";
|
|
101
101
|
export * from "./updateinvoice.js";
|
|
102
102
|
export * from "./updatesthewebhookendpointwiththegivenid.js";
|
|
103
|
+
export * from "./updateuser.js";
|
|
103
104
|
export * from "./updateuseralerts.js";
|
|
105
|
+
export * from "./updateuserprofilepicture.js";
|
|
104
106
|
export * from "./updatevendorcredentialdata.js";
|
|
105
107
|
export * from "./updatevendorcredentialfile.js";
|
|
106
108
|
export * from "./updatevendordetails.js";
|