@greensecurity/javascript-sdk 0.43.1-beta.115 → 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.
Files changed (176) hide show
  1. package/README.md +6 -0
  2. package/dist/commonjs/__tests__/users.test.js +100 -0
  3. package/dist/commonjs/__tests__/users.test.js.map +1 -1
  4. package/dist/commonjs/__tests__/webhooks.test.js +1 -1
  5. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  6. package/dist/commonjs/__tests__/zones.test.js +14 -31
  7. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  8. package/dist/commonjs/funcs/usersUpdateUser.d.ts +26 -0
  9. package/dist/commonjs/funcs/usersUpdateUser.d.ts.map +1 -0
  10. package/dist/commonjs/funcs/usersUpdateUser.js +131 -0
  11. package/dist/commonjs/funcs/usersUpdateUser.js.map +1 -0
  12. package/dist/commonjs/funcs/usersUpdateUserProfilePicture.d.ts +20 -0
  13. package/dist/commonjs/funcs/usersUpdateUserProfilePicture.d.ts.map +1 -0
  14. package/dist/commonjs/funcs/usersUpdateUserProfilePicture.js +126 -0
  15. package/dist/commonjs/funcs/usersUpdateUserProfilePicture.js.map +1 -0
  16. package/dist/commonjs/funcs/vendorFieldsCreateVendorField.d.ts +3 -2
  17. package/dist/commonjs/funcs/vendorFieldsCreateVendorField.d.ts.map +1 -1
  18. package/dist/commonjs/funcs/vendorFieldsCreateVendorField.js +3 -2
  19. package/dist/commonjs/funcs/vendorFieldsCreateVendorField.js.map +1 -1
  20. package/dist/commonjs/lib/config.d.ts +2 -2
  21. package/dist/commonjs/lib/config.js +2 -2
  22. package/dist/commonjs/models/components/company.d.ts +5 -0
  23. package/dist/commonjs/models/components/company.d.ts.map +1 -1
  24. package/dist/commonjs/models/components/company.js +4 -0
  25. package/dist/commonjs/models/components/company.js.map +1 -1
  26. package/dist/commonjs/models/components/companyvendorfield.d.ts +16 -0
  27. package/dist/commonjs/models/components/companyvendorfield.d.ts.map +1 -0
  28. package/dist/commonjs/models/components/companyvendorfield.js +60 -0
  29. package/dist/commonjs/models/components/companyvendorfield.js.map +1 -0
  30. package/dist/commonjs/models/components/expand.d.ts +2 -0
  31. package/dist/commonjs/models/components/expand.d.ts.map +1 -1
  32. package/dist/commonjs/models/components/expand.js +2 -0
  33. package/dist/commonjs/models/components/expand.js.map +1 -1
  34. package/dist/commonjs/models/components/index.d.ts +1 -0
  35. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  36. package/dist/commonjs/models/components/index.js +1 -0
  37. package/dist/commonjs/models/components/index.js.map +1 -1
  38. package/dist/commonjs/models/components/vendor.d.ts +1 -0
  39. package/dist/commonjs/models/components/vendor.d.ts.map +1 -1
  40. package/dist/commonjs/models/components/vendor.js +2 -0
  41. package/dist/commonjs/models/components/vendor.js.map +1 -1
  42. package/dist/commonjs/models/operations/index.d.ts +2 -0
  43. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  44. package/dist/commonjs/models/operations/index.js +2 -0
  45. package/dist/commonjs/models/operations/index.js.map +1 -1
  46. package/dist/commonjs/models/operations/updateuser.d.ts +74 -0
  47. package/dist/commonjs/models/operations/updateuser.d.ts.map +1 -0
  48. package/dist/commonjs/models/operations/updateuser.js +96 -0
  49. package/dist/commonjs/models/operations/updateuser.js.map +1 -0
  50. package/dist/commonjs/models/operations/updateuserprofilepicture.d.ts +70 -0
  51. package/dist/commonjs/models/operations/updateuserprofilepicture.d.ts.map +1 -0
  52. package/dist/commonjs/models/operations/updateuserprofilepicture.js +93 -0
  53. package/dist/commonjs/models/operations/updateuserprofilepicture.js.map +1 -0
  54. package/dist/commonjs/react-query/index.d.ts +2 -0
  55. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  56. package/dist/commonjs/react-query/index.js +2 -0
  57. package/dist/commonjs/react-query/index.js.map +1 -1
  58. package/dist/commonjs/react-query/usersUpdateUser.d.ts +35 -0
  59. package/dist/commonjs/react-query/usersUpdateUser.d.ts.map +1 -0
  60. package/dist/commonjs/react-query/usersUpdateUser.js +53 -0
  61. package/dist/commonjs/react-query/usersUpdateUser.js.map +1 -0
  62. package/dist/commonjs/react-query/usersUpdateUserProfilePicture.d.ts +29 -0
  63. package/dist/commonjs/react-query/usersUpdateUserProfilePicture.d.ts.map +1 -0
  64. package/dist/commonjs/react-query/usersUpdateUserProfilePicture.js +47 -0
  65. package/dist/commonjs/react-query/usersUpdateUserProfilePicture.js.map +1 -0
  66. package/dist/commonjs/react-query/vendorFieldsCreateVendorField.d.ts +3 -2
  67. package/dist/commonjs/react-query/vendorFieldsCreateVendorField.d.ts.map +1 -1
  68. package/dist/commonjs/react-query/vendorFieldsCreateVendorField.js +3 -2
  69. package/dist/commonjs/react-query/vendorFieldsCreateVendorField.js.map +1 -1
  70. package/dist/commonjs/sdk/users.d.ts +20 -0
  71. package/dist/commonjs/sdk/users.d.ts.map +1 -1
  72. package/dist/commonjs/sdk/users.js +26 -0
  73. package/dist/commonjs/sdk/users.js.map +1 -1
  74. package/dist/commonjs/sdk/vendorfields.d.ts +3 -2
  75. package/dist/commonjs/sdk/vendorfields.d.ts.map +1 -1
  76. package/dist/commonjs/sdk/vendorfields.js +3 -2
  77. package/dist/commonjs/sdk/vendorfields.js.map +1 -1
  78. package/dist/esm/__tests__/users.test.js +100 -0
  79. package/dist/esm/__tests__/users.test.js.map +1 -1
  80. package/dist/esm/__tests__/webhooks.test.js +1 -1
  81. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  82. package/dist/esm/__tests__/zones.test.js +14 -31
  83. package/dist/esm/__tests__/zones.test.js.map +1 -1
  84. package/dist/esm/funcs/usersUpdateUser.d.ts +26 -0
  85. package/dist/esm/funcs/usersUpdateUser.d.ts.map +1 -0
  86. package/dist/esm/funcs/usersUpdateUser.js +95 -0
  87. package/dist/esm/funcs/usersUpdateUser.js.map +1 -0
  88. package/dist/esm/funcs/usersUpdateUserProfilePicture.d.ts +20 -0
  89. package/dist/esm/funcs/usersUpdateUserProfilePicture.d.ts.map +1 -0
  90. package/dist/esm/funcs/usersUpdateUserProfilePicture.js +90 -0
  91. package/dist/esm/funcs/usersUpdateUserProfilePicture.js.map +1 -0
  92. package/dist/esm/funcs/vendorFieldsCreateVendorField.d.ts +3 -2
  93. package/dist/esm/funcs/vendorFieldsCreateVendorField.d.ts.map +1 -1
  94. package/dist/esm/funcs/vendorFieldsCreateVendorField.js +3 -2
  95. package/dist/esm/funcs/vendorFieldsCreateVendorField.js.map +1 -1
  96. package/dist/esm/lib/config.d.ts +2 -2
  97. package/dist/esm/lib/config.js +2 -2
  98. package/dist/esm/models/components/company.d.ts +5 -0
  99. package/dist/esm/models/components/company.d.ts.map +1 -1
  100. package/dist/esm/models/components/company.js +4 -0
  101. package/dist/esm/models/components/company.js.map +1 -1
  102. package/dist/esm/models/components/companyvendorfield.d.ts +16 -0
  103. package/dist/esm/models/components/companyvendorfield.d.ts.map +1 -0
  104. package/dist/esm/models/components/companyvendorfield.js +23 -0
  105. package/dist/esm/models/components/companyvendorfield.js.map +1 -0
  106. package/dist/esm/models/components/expand.d.ts +2 -0
  107. package/dist/esm/models/components/expand.d.ts.map +1 -1
  108. package/dist/esm/models/components/expand.js +2 -0
  109. package/dist/esm/models/components/expand.js.map +1 -1
  110. package/dist/esm/models/components/index.d.ts +1 -0
  111. package/dist/esm/models/components/index.d.ts.map +1 -1
  112. package/dist/esm/models/components/index.js +1 -0
  113. package/dist/esm/models/components/index.js.map +1 -1
  114. package/dist/esm/models/components/vendor.d.ts +1 -0
  115. package/dist/esm/models/components/vendor.d.ts.map +1 -1
  116. package/dist/esm/models/components/vendor.js +2 -0
  117. package/dist/esm/models/components/vendor.js.map +1 -1
  118. package/dist/esm/models/operations/index.d.ts +2 -0
  119. package/dist/esm/models/operations/index.d.ts.map +1 -1
  120. package/dist/esm/models/operations/index.js +2 -0
  121. package/dist/esm/models/operations/index.js.map +1 -1
  122. package/dist/esm/models/operations/updateuser.d.ts +74 -0
  123. package/dist/esm/models/operations/updateuser.d.ts.map +1 -0
  124. package/dist/esm/models/operations/updateuser.js +57 -0
  125. package/dist/esm/models/operations/updateuser.js.map +1 -0
  126. package/dist/esm/models/operations/updateuserprofilepicture.d.ts +70 -0
  127. package/dist/esm/models/operations/updateuserprofilepicture.d.ts.map +1 -0
  128. package/dist/esm/models/operations/updateuserprofilepicture.js +54 -0
  129. package/dist/esm/models/operations/updateuserprofilepicture.js.map +1 -0
  130. package/dist/esm/react-query/index.d.ts +2 -0
  131. package/dist/esm/react-query/index.d.ts.map +1 -1
  132. package/dist/esm/react-query/index.js +2 -0
  133. package/dist/esm/react-query/index.js.map +1 -1
  134. package/dist/esm/react-query/usersUpdateUser.d.ts +35 -0
  135. package/dist/esm/react-query/usersUpdateUser.d.ts.map +1 -0
  136. package/dist/esm/react-query/usersUpdateUser.js +48 -0
  137. package/dist/esm/react-query/usersUpdateUser.js.map +1 -0
  138. package/dist/esm/react-query/usersUpdateUserProfilePicture.d.ts +29 -0
  139. package/dist/esm/react-query/usersUpdateUserProfilePicture.d.ts.map +1 -0
  140. package/dist/esm/react-query/usersUpdateUserProfilePicture.js +42 -0
  141. package/dist/esm/react-query/usersUpdateUserProfilePicture.js.map +1 -0
  142. package/dist/esm/react-query/vendorFieldsCreateVendorField.d.ts +3 -2
  143. package/dist/esm/react-query/vendorFieldsCreateVendorField.d.ts.map +1 -1
  144. package/dist/esm/react-query/vendorFieldsCreateVendorField.js +3 -2
  145. package/dist/esm/react-query/vendorFieldsCreateVendorField.js.map +1 -1
  146. package/dist/esm/sdk/users.d.ts +20 -0
  147. package/dist/esm/sdk/users.d.ts.map +1 -1
  148. package/dist/esm/sdk/users.js +26 -0
  149. package/dist/esm/sdk/users.js.map +1 -1
  150. package/dist/esm/sdk/vendorfields.d.ts +3 -2
  151. package/dist/esm/sdk/vendorfields.d.ts.map +1 -1
  152. package/dist/esm/sdk/vendorfields.js +3 -2
  153. package/dist/esm/sdk/vendorfields.js.map +1 -1
  154. package/jsr.json +1 -1
  155. package/package.json +1 -1
  156. package/src/__tests__/users.test.ts +106 -0
  157. package/src/__tests__/webhooks.test.ts +1 -1
  158. package/src/__tests__/zones.test.ts +14 -31
  159. package/src/funcs/usersUpdateUser.ts +182 -0
  160. package/src/funcs/usersUpdateUserProfilePicture.ts +181 -0
  161. package/src/funcs/vendorFieldsCreateVendorField.ts +3 -2
  162. package/src/lib/config.ts +2 -2
  163. package/src/models/components/company.ts +11 -0
  164. package/src/models/components/companyvendorfield.ts +47 -0
  165. package/src/models/components/expand.ts +2 -0
  166. package/src/models/components/index.ts +1 -0
  167. package/src/models/components/vendor.ts +3 -0
  168. package/src/models/operations/index.ts +2 -0
  169. package/src/models/operations/updateuser.ts +156 -0
  170. package/src/models/operations/updateuserprofilepicture.ts +154 -0
  171. package/src/react-query/index.ts +2 -0
  172. package/src/react-query/usersUpdateUser.ts +116 -0
  173. package/src/react-query/usersUpdateUserProfilePicture.ts +111 -0
  174. package/src/react-query/vendorFieldsCreateVendorField.ts +3 -2
  175. package/src/sdk/users.ts +42 -0
  176. package/src/sdk/vendorfields.ts +3 -2
@@ -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";
@@ -0,0 +1,156 @@
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 components from "../components/index.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ export type UpdateUserRequestBody = {
13
+ firstName?: string | undefined;
14
+ lastName?: string | undefined;
15
+ username?: string | undefined;
16
+ email?: string | undefined;
17
+ email2?: string | undefined;
18
+ phone?: string | undefined;
19
+ mobilePhone?: string | undefined;
20
+ fax?: string | undefined;
21
+ address?: string | undefined;
22
+ address1?: string | undefined;
23
+ address2?: string | undefined;
24
+ city?: string | undefined;
25
+ state?: string | undefined;
26
+ zip?: string | undefined;
27
+ country?: string | undefined;
28
+ timezone?: string | undefined;
29
+ utcOffset?: number | undefined;
30
+ };
31
+
32
+ export type UpdateUserRequest = {
33
+ /**
34
+ * Numeric user ID or `me` for the authenticated user.
35
+ */
36
+ id: string;
37
+ requestBody: UpdateUserRequestBody;
38
+ };
39
+
40
+ /**
41
+ * User updated successfully.
42
+ */
43
+ export type UpdateUserUpdateUserOk = {
44
+ /**
45
+ * The User object describes a person or service account.
46
+ */
47
+ user: components.User;
48
+ };
49
+
50
+ /** @internal */
51
+ export type UpdateUserRequestBody$Outbound = {
52
+ first_name?: string | undefined;
53
+ last_name?: string | undefined;
54
+ username?: string | undefined;
55
+ email?: string | undefined;
56
+ email2?: string | undefined;
57
+ phone?: string | undefined;
58
+ mobile_phone?: string | undefined;
59
+ fax?: string | undefined;
60
+ address?: string | undefined;
61
+ address1?: string | undefined;
62
+ address2?: string | undefined;
63
+ city?: string | undefined;
64
+ state?: string | undefined;
65
+ zip?: string | undefined;
66
+ country?: string | undefined;
67
+ timezone?: string | undefined;
68
+ utc_offset?: number | undefined;
69
+ };
70
+
71
+ /** @internal */
72
+ export const UpdateUserRequestBody$outboundSchema: z.ZodType<
73
+ UpdateUserRequestBody$Outbound,
74
+ z.ZodTypeDef,
75
+ UpdateUserRequestBody
76
+ > = z.object({
77
+ firstName: z.string().optional(),
78
+ lastName: z.string().optional(),
79
+ username: z.string().optional(),
80
+ email: z.string().optional(),
81
+ email2: z.string().optional(),
82
+ phone: z.string().optional(),
83
+ mobilePhone: z.string().optional(),
84
+ fax: z.string().optional(),
85
+ address: z.string().optional(),
86
+ address1: z.string().optional(),
87
+ address2: z.string().optional(),
88
+ city: z.string().optional(),
89
+ state: z.string().optional(),
90
+ zip: z.string().optional(),
91
+ country: z.string().optional(),
92
+ timezone: z.string().optional(),
93
+ utcOffset: z.number().optional(),
94
+ }).transform((v) => {
95
+ return remap$(v, {
96
+ firstName: "first_name",
97
+ lastName: "last_name",
98
+ mobilePhone: "mobile_phone",
99
+ utcOffset: "utc_offset",
100
+ });
101
+ });
102
+
103
+ export function updateUserRequestBodyToJSON(
104
+ updateUserRequestBody: UpdateUserRequestBody,
105
+ ): string {
106
+ return JSON.stringify(
107
+ UpdateUserRequestBody$outboundSchema.parse(updateUserRequestBody),
108
+ );
109
+ }
110
+
111
+ /** @internal */
112
+ export type UpdateUserRequest$Outbound = {
113
+ id: string;
114
+ RequestBody: UpdateUserRequestBody$Outbound;
115
+ };
116
+
117
+ /** @internal */
118
+ export const UpdateUserRequest$outboundSchema: z.ZodType<
119
+ UpdateUserRequest$Outbound,
120
+ z.ZodTypeDef,
121
+ UpdateUserRequest
122
+ > = z.object({
123
+ id: z.string(),
124
+ requestBody: z.lazy(() => UpdateUserRequestBody$outboundSchema),
125
+ }).transform((v) => {
126
+ return remap$(v, {
127
+ requestBody: "RequestBody",
128
+ });
129
+ });
130
+
131
+ export function updateUserRequestToJSON(
132
+ updateUserRequest: UpdateUserRequest,
133
+ ): string {
134
+ return JSON.stringify(
135
+ UpdateUserRequest$outboundSchema.parse(updateUserRequest),
136
+ );
137
+ }
138
+
139
+ /** @internal */
140
+ export const UpdateUserUpdateUserOk$inboundSchema: z.ZodType<
141
+ UpdateUserUpdateUserOk,
142
+ z.ZodTypeDef,
143
+ unknown
144
+ > = z.object({
145
+ user: components.User$inboundSchema,
146
+ });
147
+
148
+ export function updateUserUpdateUserOkFromJSON(
149
+ jsonString: string,
150
+ ): SafeParseResult<UpdateUserUpdateUserOk, SDKValidationError> {
151
+ return safeParse(
152
+ jsonString,
153
+ (x) => UpdateUserUpdateUserOk$inboundSchema.parse(JSON.parse(x)),
154
+ `Failed to parse 'UpdateUserUpdateUserOk' from JSON`,
155
+ );
156
+ }
@@ -0,0 +1,154 @@
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 { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import * as types from "../../types/primitives.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ /**
14
+ * MIME type of the image
15
+ */
16
+ export const ImageContentType = {
17
+ ImageJpeg: "image/jpeg",
18
+ ImagePng: "image/png",
19
+ ImageGif: "image/gif",
20
+ ImageWebp: "image/webp",
21
+ } as const;
22
+ /**
23
+ * MIME type of the image
24
+ */
25
+ export type ImageContentType = ClosedEnum<typeof ImageContentType>;
26
+
27
+ export type UpdateUserProfilePictureRequestBody = {
28
+ /**
29
+ * Original file name of the image
30
+ */
31
+ imageFileName: string;
32
+ /**
33
+ * MIME type of the image
34
+ */
35
+ imageContentType: ImageContentType;
36
+ /**
37
+ * File size in bytes
38
+ */
39
+ imageFileSize: number;
40
+ };
41
+
42
+ export type UpdateUserProfilePictureRequest = {
43
+ /**
44
+ * Either the ID of the user rep or the keyword "me" to represent the current user.
45
+ */
46
+ idOrMe: string;
47
+ requestBody: UpdateUserProfilePictureRequestBody;
48
+ };
49
+
50
+ /**
51
+ * Metadata registered. Upload the file directly to S3 at user_profile_image/{id}.{ext}.
52
+ */
53
+ export type UpdateUserProfilePictureUpdateUserProfilePictureOk = {
54
+ /**
55
+ * User ID to use as the S3 upload key
56
+ */
57
+ id: number;
58
+ };
59
+
60
+ /** @internal */
61
+ export const ImageContentType$outboundSchema: z.ZodNativeEnum<
62
+ typeof ImageContentType
63
+ > = z.nativeEnum(ImageContentType);
64
+
65
+ /** @internal */
66
+ export type UpdateUserProfilePictureRequestBody$Outbound = {
67
+ image_file_name: string;
68
+ image_content_type: string;
69
+ image_file_size: number;
70
+ };
71
+
72
+ /** @internal */
73
+ export const UpdateUserProfilePictureRequestBody$outboundSchema: z.ZodType<
74
+ UpdateUserProfilePictureRequestBody$Outbound,
75
+ z.ZodTypeDef,
76
+ UpdateUserProfilePictureRequestBody
77
+ > = z.object({
78
+ imageFileName: z.string(),
79
+ imageContentType: ImageContentType$outboundSchema,
80
+ imageFileSize: z.number().int(),
81
+ }).transform((v) => {
82
+ return remap$(v, {
83
+ imageFileName: "image_file_name",
84
+ imageContentType: "image_content_type",
85
+ imageFileSize: "image_file_size",
86
+ });
87
+ });
88
+
89
+ export function updateUserProfilePictureRequestBodyToJSON(
90
+ updateUserProfilePictureRequestBody: UpdateUserProfilePictureRequestBody,
91
+ ): string {
92
+ return JSON.stringify(
93
+ UpdateUserProfilePictureRequestBody$outboundSchema.parse(
94
+ updateUserProfilePictureRequestBody,
95
+ ),
96
+ );
97
+ }
98
+
99
+ /** @internal */
100
+ export type UpdateUserProfilePictureRequest$Outbound = {
101
+ id_or_me: string;
102
+ RequestBody: UpdateUserProfilePictureRequestBody$Outbound;
103
+ };
104
+
105
+ /** @internal */
106
+ export const UpdateUserProfilePictureRequest$outboundSchema: z.ZodType<
107
+ UpdateUserProfilePictureRequest$Outbound,
108
+ z.ZodTypeDef,
109
+ UpdateUserProfilePictureRequest
110
+ > = z.object({
111
+ idOrMe: z.string(),
112
+ requestBody: z.lazy(() => UpdateUserProfilePictureRequestBody$outboundSchema),
113
+ }).transform((v) => {
114
+ return remap$(v, {
115
+ idOrMe: "id_or_me",
116
+ requestBody: "RequestBody",
117
+ });
118
+ });
119
+
120
+ export function updateUserProfilePictureRequestToJSON(
121
+ updateUserProfilePictureRequest: UpdateUserProfilePictureRequest,
122
+ ): string {
123
+ return JSON.stringify(
124
+ UpdateUserProfilePictureRequest$outboundSchema.parse(
125
+ updateUserProfilePictureRequest,
126
+ ),
127
+ );
128
+ }
129
+
130
+ /** @internal */
131
+ export const UpdateUserProfilePictureUpdateUserProfilePictureOk$inboundSchema:
132
+ z.ZodType<
133
+ UpdateUserProfilePictureUpdateUserProfilePictureOk,
134
+ z.ZodTypeDef,
135
+ unknown
136
+ > = z.object({
137
+ id: types.number(),
138
+ });
139
+
140
+ export function updateUserProfilePictureUpdateUserProfilePictureOkFromJSON(
141
+ jsonString: string,
142
+ ): SafeParseResult<
143
+ UpdateUserProfilePictureUpdateUserProfilePictureOk,
144
+ SDKValidationError
145
+ > {
146
+ return safeParse(
147
+ jsonString,
148
+ (x) =>
149
+ UpdateUserProfilePictureUpdateUserProfilePictureOk$inboundSchema.parse(
150
+ JSON.parse(x),
151
+ ),
152
+ `Failed to parse 'UpdateUserProfilePictureUpdateUserProfilePictureOk' from JSON`,
153
+ );
154
+ }
@@ -56,6 +56,8 @@ export * from "./usersPasswordResetRequest.js";
56
56
  export * from "./usersPostAuthenticate.js";
57
57
  export * from "./usersRotateApiKey.js";
58
58
  export * from "./usersSwitchAccount.js";
59
+ export * from "./usersUpdateUser.js";
60
+ export * from "./usersUpdateUserProfilePicture.js";
59
61
  export * from "./vendorFieldsCreateVendorField.js";
60
62
  export * from "./vendorFieldsUpdateVendorField.js";
61
63
  export * from "./vendorsAcceptVendorCredential.js";
@@ -0,0 +1,116 @@
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 { usersUpdateUser } from "../funcs/usersUpdateUser.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { unwrapAsync } from "../types/fp.js";
27
+ import { useGreenSecurityContext } from "./_context.js";
28
+ import { MutationHookOptions } from "./_types.js";
29
+
30
+ export type UsersUpdateUserMutationVariables = {
31
+ request: operations.UpdateUserRequest;
32
+ options?: RequestOptions;
33
+ };
34
+
35
+ export type UsersUpdateUserMutationData = operations.UpdateUserUpdateUserOk;
36
+
37
+ export type UsersUpdateUserMutationError =
38
+ | errors.ApiErrorResponse
39
+ | GreenSecurityError
40
+ | ResponseValidationError
41
+ | ConnectionError
42
+ | RequestAbortedError
43
+ | RequestTimeoutError
44
+ | InvalidRequestError
45
+ | UnexpectedClientError
46
+ | SDKValidationError;
47
+
48
+ /**
49
+ * Update user by ID
50
+ *
51
+ * @remarks
52
+ * Updates the contact information, address, and locale settings of a user.
53
+ * Pass `me` as `{id}` to update the authenticated user's own profile.
54
+ *
55
+ * Only submitted fields are applied — unrecognised fields are silently ignored.
56
+ * Changing `email` automatically resets `bounced_email` to `false`.
57
+ *
58
+ * To rotate an API token use `POST /users/api_key_rotator` instead.
59
+ */
60
+ export function useUsersUpdateUserMutation(
61
+ options?: MutationHookOptions<
62
+ UsersUpdateUserMutationData,
63
+ UsersUpdateUserMutationError,
64
+ UsersUpdateUserMutationVariables
65
+ >,
66
+ ): UseMutationResult<
67
+ UsersUpdateUserMutationData,
68
+ UsersUpdateUserMutationError,
69
+ UsersUpdateUserMutationVariables
70
+ > {
71
+ const client = useGreenSecurityContext();
72
+ return useMutation({
73
+ ...buildUsersUpdateUserMutation(client, options),
74
+ ...options,
75
+ });
76
+ }
77
+
78
+ export function mutationKeyUsersUpdateUser(): MutationKey {
79
+ return ["@greensecurity/javascript-sdk", "users", "updateUser"];
80
+ }
81
+
82
+ export function buildUsersUpdateUserMutation(
83
+ client$: GreenSecurityCore,
84
+ hookOptions?: RequestOptions,
85
+ ): {
86
+ mutationKey: MutationKey;
87
+ mutationFn: (
88
+ variables: UsersUpdateUserMutationVariables,
89
+ ) => Promise<UsersUpdateUserMutationData>;
90
+ } {
91
+ return {
92
+ mutationKey: mutationKeyUsersUpdateUser(),
93
+ mutationFn: function usersUpdateUserMutationFn({
94
+ request,
95
+ options,
96
+ }): Promise<UsersUpdateUserMutationData> {
97
+ const mergedOptions = {
98
+ ...hookOptions,
99
+ ...options,
100
+ fetchOptions: {
101
+ ...hookOptions?.fetchOptions,
102
+ ...options?.fetchOptions,
103
+ signal: combineSignals(
104
+ hookOptions?.fetchOptions?.signal,
105
+ options?.fetchOptions?.signal,
106
+ ),
107
+ },
108
+ };
109
+ return unwrapAsync(usersUpdateUser(
110
+ client$,
111
+ request,
112
+ mergedOptions,
113
+ ));
114
+ },
115
+ };
116
+ }
@@ -0,0 +1,111 @@
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 { usersUpdateUserProfilePicture } from "../funcs/usersUpdateUserProfilePicture.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { unwrapAsync } from "../types/fp.js";
27
+ import { useGreenSecurityContext } from "./_context.js";
28
+ import { MutationHookOptions } from "./_types.js";
29
+
30
+ export type UsersUpdateUserProfilePictureMutationVariables = {
31
+ request: operations.UpdateUserProfilePictureRequest;
32
+ options?: RequestOptions;
33
+ };
34
+
35
+ export type UsersUpdateUserProfilePictureMutationData =
36
+ operations.UpdateUserProfilePictureUpdateUserProfilePictureOk;
37
+
38
+ export type UsersUpdateUserProfilePictureMutationError =
39
+ | errors.ApiErrorResponse
40
+ | GreenSecurityError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError;
48
+
49
+ /**
50
+ * Register profile picture metadata for S3 direct upload
51
+ *
52
+ * @remarks
53
+ * 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.
54
+ */
55
+ export function useUsersUpdateUserProfilePictureMutation(
56
+ options?: MutationHookOptions<
57
+ UsersUpdateUserProfilePictureMutationData,
58
+ UsersUpdateUserProfilePictureMutationError,
59
+ UsersUpdateUserProfilePictureMutationVariables
60
+ >,
61
+ ): UseMutationResult<
62
+ UsersUpdateUserProfilePictureMutationData,
63
+ UsersUpdateUserProfilePictureMutationError,
64
+ UsersUpdateUserProfilePictureMutationVariables
65
+ > {
66
+ const client = useGreenSecurityContext();
67
+ return useMutation({
68
+ ...buildUsersUpdateUserProfilePictureMutation(client, options),
69
+ ...options,
70
+ });
71
+ }
72
+
73
+ export function mutationKeyUsersUpdateUserProfilePicture(): MutationKey {
74
+ return ["@greensecurity/javascript-sdk", "users", "updateUserProfilePicture"];
75
+ }
76
+
77
+ export function buildUsersUpdateUserProfilePictureMutation(
78
+ client$: GreenSecurityCore,
79
+ hookOptions?: RequestOptions,
80
+ ): {
81
+ mutationKey: MutationKey;
82
+ mutationFn: (
83
+ variables: UsersUpdateUserProfilePictureMutationVariables,
84
+ ) => Promise<UsersUpdateUserProfilePictureMutationData>;
85
+ } {
86
+ return {
87
+ mutationKey: mutationKeyUsersUpdateUserProfilePicture(),
88
+ mutationFn: function usersUpdateUserProfilePictureMutationFn({
89
+ request,
90
+ options,
91
+ }): Promise<UsersUpdateUserProfilePictureMutationData> {
92
+ const mergedOptions = {
93
+ ...hookOptions,
94
+ ...options,
95
+ fetchOptions: {
96
+ ...hookOptions?.fetchOptions,
97
+ ...options?.fetchOptions,
98
+ signal: combineSignals(
99
+ hookOptions?.fetchOptions?.signal,
100
+ options?.fetchOptions?.signal,
101
+ ),
102
+ },
103
+ };
104
+ return unwrapAsync(usersUpdateUserProfilePicture(
105
+ client$,
106
+ request,
107
+ mergedOptions,
108
+ ));
109
+ },
110
+ };
111
+ }
@@ -50,8 +50,9 @@ export type VendorFieldsCreateVendorFieldMutationError =
50
50
  * Create vendor field
51
51
  *
52
52
  * @remarks
53
- * Create a new vendor field for a company. The name can only be set on creation;
54
- * once created, only the show_to_vendor flag can be updated via PATCH.
53
+ * Create a new vendor field for a company. Each company may have at most one custom
54
+ * vendor field; if one already exists, the request fails with 422. The name can only
55
+ * be set on creation; once created, only the show_to_vendor flag can be updated via PATCH.
55
56
  * Requires access to the company (company manager, admin, or API user with company scope).
56
57
  *
57
58
  * For API users: source_user_id is required. The API user acts on behalf of that user
package/src/sdk/users.ts CHANGED
@@ -12,6 +12,8 @@ import { usersPasswordResetRequest } from "../funcs/usersPasswordResetRequest.js
12
12
  import { usersPostAuthenticate } from "../funcs/usersPostAuthenticate.js";
13
13
  import { usersRotateApiKey } from "../funcs/usersRotateApiKey.js";
14
14
  import { usersSwitchAccount } from "../funcs/usersSwitchAccount.js";
15
+ import { usersUpdateUser } from "../funcs/usersUpdateUser.js";
16
+ import { usersUpdateUserProfilePicture } from "../funcs/usersUpdateUserProfilePicture.js";
15
17
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
16
18
  import * as components from "../models/components/index.js";
17
19
  import * as operations from "../models/operations/index.js";
@@ -53,6 +55,29 @@ export class Users extends ClientSDK {
53
55
  ));
54
56
  }
55
57
 
58
+ /**
59
+ * Update user by ID
60
+ *
61
+ * @remarks
62
+ * Updates the contact information, address, and locale settings of a user.
63
+ * Pass `me` as `{id}` to update the authenticated user's own profile.
64
+ *
65
+ * Only submitted fields are applied — unrecognised fields are silently ignored.
66
+ * Changing `email` automatically resets `bounced_email` to `false`.
67
+ *
68
+ * To rotate an API token use `POST /users/api_key_rotator` instead.
69
+ */
70
+ async updateUser(
71
+ request: operations.UpdateUserRequest,
72
+ options?: RequestOptions,
73
+ ): Promise<operations.UpdateUserUpdateUserOk> {
74
+ return unwrapAsync(usersUpdateUser(
75
+ this,
76
+ request,
77
+ options,
78
+ ));
79
+ }
80
+
56
81
  /**
57
82
  * Logs user into the system
58
83
  *
@@ -222,4 +247,21 @@ export class Users extends ClientSDK {
222
247
  options,
223
248
  ));
224
249
  }
250
+
251
+ /**
252
+ * Register profile picture metadata for S3 direct upload
253
+ *
254
+ * @remarks
255
+ * 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.
256
+ */
257
+ async updateUserProfilePicture(
258
+ request: operations.UpdateUserProfilePictureRequest,
259
+ options?: RequestOptions,
260
+ ): Promise<operations.UpdateUserProfilePictureUpdateUserProfilePictureOk> {
261
+ return unwrapAsync(usersUpdateUserProfilePicture(
262
+ this,
263
+ request,
264
+ options,
265
+ ));
266
+ }
225
267
  }
@@ -13,8 +13,9 @@ export class VendorFields extends ClientSDK {
13
13
  * Create vendor field
14
14
  *
15
15
  * @remarks
16
- * Create a new vendor field for a company. The name can only be set on creation;
17
- * once created, only the show_to_vendor flag can be updated via PATCH.
16
+ * Create a new vendor field for a company. Each company may have at most one custom
17
+ * vendor field; if one already exists, the request fails with 422. The name can only
18
+ * be set on creation; once created, only the show_to_vendor flag can be updated via PATCH.
18
19
  * Requires access to the company (company manager, admin, or API user with company scope).
19
20
  *
20
21
  * For API users: source_user_id is required. The API user acts on behalf of that user