@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.
Files changed (176) hide show
  1. package/FUNCTIONS.md +10 -10
  2. package/REACT_QUERY.md +6 -10
  3. package/README.md +54 -52
  4. package/dist/commonjs/__tests__/vendorfields.test.d.ts +2 -0
  5. package/dist/commonjs/__tests__/vendorfields.test.d.ts.map +1 -0
  6. package/dist/commonjs/__tests__/vendorfields.test.js +43 -0
  7. package/dist/commonjs/__tests__/vendorfields.test.js.map +1 -0
  8. package/dist/commonjs/__tests__/zones.test.js +12 -13
  9. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  10. package/dist/commonjs/funcs/usersGetCurrentUser.d.ts +4 -2
  11. package/dist/commonjs/funcs/usersGetCurrentUser.d.ts.map +1 -1
  12. package/dist/commonjs/funcs/usersGetCurrentUser.js +19 -4
  13. package/dist/commonjs/funcs/usersGetCurrentUser.js.map +1 -1
  14. package/dist/commonjs/funcs/vendorFieldsCreateVendorField.d.ts +23 -0
  15. package/dist/commonjs/funcs/vendorFieldsCreateVendorField.d.ts.map +1 -0
  16. package/dist/commonjs/funcs/vendorFieldsCreateVendorField.js +122 -0
  17. package/dist/commonjs/funcs/vendorFieldsCreateVendorField.js.map +1 -0
  18. package/dist/commonjs/funcs/vendorFieldsUpdateVendorField.d.ts +21 -0
  19. package/dist/commonjs/funcs/vendorFieldsUpdateVendorField.d.ts.map +1 -0
  20. package/dist/commonjs/funcs/vendorFieldsUpdateVendorField.js +126 -0
  21. package/dist/commonjs/funcs/vendorFieldsUpdateVendorField.js.map +1 -0
  22. package/dist/commonjs/lib/config.d.ts +3 -3
  23. package/dist/commonjs/lib/config.js +3 -3
  24. package/dist/commonjs/lib/encodings.d.ts.map +1 -1
  25. package/dist/commonjs/lib/encodings.js +20 -5
  26. package/dist/commonjs/lib/encodings.js.map +1 -1
  27. package/dist/commonjs/models/components/productvariant.d.ts +10 -0
  28. package/dist/commonjs/models/components/productvariant.d.ts.map +1 -1
  29. package/dist/commonjs/models/components/productvariant.js +10 -1
  30. package/dist/commonjs/models/components/productvariant.js.map +1 -1
  31. package/dist/commonjs/models/operations/createvendorfield.d.ts +39 -0
  32. package/dist/commonjs/models/operations/createvendorfield.d.ts.map +1 -0
  33. package/dist/commonjs/models/operations/createvendorfield.js +67 -0
  34. package/dist/commonjs/models/operations/createvendorfield.js.map +1 -0
  35. package/dist/commonjs/models/operations/getcurrentuser.d.ts +16 -0
  36. package/dist/commonjs/models/operations/getcurrentuser.d.ts.map +1 -0
  37. package/dist/commonjs/models/operations/getcurrentuser.js +50 -0
  38. package/dist/commonjs/models/operations/getcurrentuser.js.map +1 -0
  39. package/dist/commonjs/models/operations/index.d.ts +3 -0
  40. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  41. package/dist/commonjs/models/operations/index.js +3 -0
  42. package/dist/commonjs/models/operations/index.js.map +1 -1
  43. package/dist/commonjs/models/operations/updatevendorfield.d.ts +49 -0
  44. package/dist/commonjs/models/operations/updatevendorfield.d.ts.map +1 -0
  45. package/dist/commonjs/models/operations/updatevendorfield.js +84 -0
  46. package/dist/commonjs/models/operations/updatevendorfield.js.map +1 -0
  47. package/dist/commonjs/react-query/index.d.ts +2 -0
  48. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  49. package/dist/commonjs/react-query/index.js +2 -0
  50. package/dist/commonjs/react-query/index.js.map +1 -1
  51. package/dist/commonjs/react-query/usersGetCurrentUser.core.d.ts +6 -3
  52. package/dist/commonjs/react-query/usersGetCurrentUser.core.d.ts.map +1 -1
  53. package/dist/commonjs/react-query/usersGetCurrentUser.core.js +12 -7
  54. package/dist/commonjs/react-query/usersGetCurrentUser.core.js.map +1 -1
  55. package/dist/commonjs/react-query/usersGetCurrentUser.d.ts +17 -6
  56. package/dist/commonjs/react-query/usersGetCurrentUser.d.ts.map +1 -1
  57. package/dist/commonjs/react-query/usersGetCurrentUser.js +22 -8
  58. package/dist/commonjs/react-query/usersGetCurrentUser.js.map +1 -1
  59. package/dist/commonjs/react-query/vendorFieldsCreateVendorField.d.ts +34 -0
  60. package/dist/commonjs/react-query/vendorFieldsCreateVendorField.d.ts.map +1 -0
  61. package/dist/commonjs/react-query/vendorFieldsCreateVendorField.js +56 -0
  62. package/dist/commonjs/react-query/vendorFieldsCreateVendorField.js.map +1 -0
  63. package/dist/commonjs/react-query/vendorFieldsUpdateVendorField.d.ts +32 -0
  64. package/dist/commonjs/react-query/vendorFieldsUpdateVendorField.d.ts.map +1 -0
  65. package/dist/commonjs/react-query/vendorFieldsUpdateVendorField.js +54 -0
  66. package/dist/commonjs/react-query/vendorFieldsUpdateVendorField.js.map +1 -0
  67. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  68. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  69. package/dist/commonjs/sdk/sdk.js +4 -0
  70. package/dist/commonjs/sdk/sdk.js.map +1 -1
  71. package/dist/commonjs/sdk/users.d.ts +3 -2
  72. package/dist/commonjs/sdk/users.d.ts.map +1 -1
  73. package/dist/commonjs/sdk/users.js +4 -3
  74. package/dist/commonjs/sdk/users.js.map +1 -1
  75. package/dist/commonjs/sdk/vendorfields.d.ts +27 -0
  76. package/dist/commonjs/sdk/vendorfields.d.ts.map +1 -0
  77. package/dist/commonjs/sdk/vendorfields.js +40 -0
  78. package/dist/commonjs/sdk/vendorfields.js.map +1 -0
  79. package/dist/esm/__tests__/vendorfields.test.d.ts +2 -0
  80. package/dist/esm/__tests__/vendorfields.test.d.ts.map +1 -0
  81. package/dist/esm/__tests__/vendorfields.test.js +41 -0
  82. package/dist/esm/__tests__/vendorfields.test.js.map +1 -0
  83. package/dist/esm/__tests__/zones.test.js +12 -13
  84. package/dist/esm/__tests__/zones.test.js.map +1 -1
  85. package/dist/esm/funcs/usersGetCurrentUser.d.ts +4 -2
  86. package/dist/esm/funcs/usersGetCurrentUser.d.ts.map +1 -1
  87. package/dist/esm/funcs/usersGetCurrentUser.js +19 -4
  88. package/dist/esm/funcs/usersGetCurrentUser.js.map +1 -1
  89. package/dist/esm/funcs/vendorFieldsCreateVendorField.d.ts +23 -0
  90. package/dist/esm/funcs/vendorFieldsCreateVendorField.d.ts.map +1 -0
  91. package/dist/esm/funcs/vendorFieldsCreateVendorField.js +86 -0
  92. package/dist/esm/funcs/vendorFieldsCreateVendorField.js.map +1 -0
  93. package/dist/esm/funcs/vendorFieldsUpdateVendorField.d.ts +21 -0
  94. package/dist/esm/funcs/vendorFieldsUpdateVendorField.d.ts.map +1 -0
  95. package/dist/esm/funcs/vendorFieldsUpdateVendorField.js +90 -0
  96. package/dist/esm/funcs/vendorFieldsUpdateVendorField.js.map +1 -0
  97. package/dist/esm/lib/config.d.ts +3 -3
  98. package/dist/esm/lib/config.js +3 -3
  99. package/dist/esm/lib/encodings.d.ts.map +1 -1
  100. package/dist/esm/lib/encodings.js +20 -5
  101. package/dist/esm/lib/encodings.js.map +1 -1
  102. package/dist/esm/models/components/productvariant.d.ts +10 -0
  103. package/dist/esm/models/components/productvariant.d.ts.map +1 -1
  104. package/dist/esm/models/components/productvariant.js +9 -0
  105. package/dist/esm/models/components/productvariant.js.map +1 -1
  106. package/dist/esm/models/operations/createvendorfield.d.ts +39 -0
  107. package/dist/esm/models/operations/createvendorfield.d.ts.map +1 -0
  108. package/dist/esm/models/operations/createvendorfield.js +29 -0
  109. package/dist/esm/models/operations/createvendorfield.js.map +1 -0
  110. package/dist/esm/models/operations/getcurrentuser.d.ts +16 -0
  111. package/dist/esm/models/operations/getcurrentuser.d.ts.map +1 -0
  112. package/dist/esm/models/operations/getcurrentuser.js +13 -0
  113. package/dist/esm/models/operations/getcurrentuser.js.map +1 -0
  114. package/dist/esm/models/operations/index.d.ts +3 -0
  115. package/dist/esm/models/operations/index.d.ts.map +1 -1
  116. package/dist/esm/models/operations/index.js +3 -0
  117. package/dist/esm/models/operations/index.js.map +1 -1
  118. package/dist/esm/models/operations/updatevendorfield.d.ts +49 -0
  119. package/dist/esm/models/operations/updatevendorfield.d.ts.map +1 -0
  120. package/dist/esm/models/operations/updatevendorfield.js +45 -0
  121. package/dist/esm/models/operations/updatevendorfield.js.map +1 -0
  122. package/dist/esm/react-query/index.d.ts +2 -0
  123. package/dist/esm/react-query/index.d.ts.map +1 -1
  124. package/dist/esm/react-query/index.js +2 -0
  125. package/dist/esm/react-query/index.js.map +1 -1
  126. package/dist/esm/react-query/usersGetCurrentUser.core.d.ts +6 -3
  127. package/dist/esm/react-query/usersGetCurrentUser.core.d.ts.map +1 -1
  128. package/dist/esm/react-query/usersGetCurrentUser.core.js +12 -7
  129. package/dist/esm/react-query/usersGetCurrentUser.core.js.map +1 -1
  130. package/dist/esm/react-query/usersGetCurrentUser.d.ts +17 -6
  131. package/dist/esm/react-query/usersGetCurrentUser.d.ts.map +1 -1
  132. package/dist/esm/react-query/usersGetCurrentUser.js +21 -8
  133. package/dist/esm/react-query/usersGetCurrentUser.js.map +1 -1
  134. package/dist/esm/react-query/vendorFieldsCreateVendorField.d.ts +34 -0
  135. package/dist/esm/react-query/vendorFieldsCreateVendorField.d.ts.map +1 -0
  136. package/dist/esm/react-query/vendorFieldsCreateVendorField.js +51 -0
  137. package/dist/esm/react-query/vendorFieldsCreateVendorField.js.map +1 -0
  138. package/dist/esm/react-query/vendorFieldsUpdateVendorField.d.ts +32 -0
  139. package/dist/esm/react-query/vendorFieldsUpdateVendorField.d.ts.map +1 -0
  140. package/dist/esm/react-query/vendorFieldsUpdateVendorField.js +49 -0
  141. package/dist/esm/react-query/vendorFieldsUpdateVendorField.js.map +1 -0
  142. package/dist/esm/sdk/sdk.d.ts +3 -0
  143. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  144. package/dist/esm/sdk/sdk.js +4 -0
  145. package/dist/esm/sdk/sdk.js.map +1 -1
  146. package/dist/esm/sdk/users.d.ts +3 -2
  147. package/dist/esm/sdk/users.d.ts.map +1 -1
  148. package/dist/esm/sdk/users.js +4 -3
  149. package/dist/esm/sdk/users.js.map +1 -1
  150. package/dist/esm/sdk/vendorfields.d.ts +27 -0
  151. package/dist/esm/sdk/vendorfields.d.ts.map +1 -0
  152. package/dist/esm/sdk/vendorfields.js +36 -0
  153. package/dist/esm/sdk/vendorfields.js.map +1 -0
  154. package/examples/{vendorsCreateVendorRegistration.example.ts → vendorFieldsCreateVendorField.example.ts} +9 -9
  155. package/jsr.json +1 -1
  156. package/package.json +1 -1
  157. package/src/__tests__/vendorfields.test.ts +47 -0
  158. package/src/__tests__/zones.test.ts +12 -13
  159. package/src/funcs/usersGetCurrentUser.ts +25 -1
  160. package/src/funcs/vendorFieldsCreateVendorField.ts +174 -0
  161. package/src/funcs/vendorFieldsUpdateVendorField.ts +177 -0
  162. package/src/lib/config.ts +3 -3
  163. package/src/lib/encodings.ts +23 -4
  164. package/src/models/components/productvariant.ts +18 -0
  165. package/src/models/operations/createvendorfield.ts +87 -0
  166. package/src/models/operations/getcurrentuser.ts +35 -0
  167. package/src/models/operations/index.ts +3 -0
  168. package/src/models/operations/updatevendorfield.ts +122 -0
  169. package/src/react-query/index.ts +2 -0
  170. package/src/react-query/usersGetCurrentUser.core.ts +15 -3
  171. package/src/react-query/usersGetCurrentUser.ts +35 -4
  172. package/src/react-query/vendorFieldsCreateVendorField.ts +120 -0
  173. package/src/react-query/vendorFieldsUpdateVendorField.ts +118 -0
  174. package/src/sdk/sdk.ts +6 -0
  175. package/src/sdk/users.ts +4 -1
  176. package/src/sdk/vendorfields.ts +53 -0
@@ -4,10 +4,19 @@
4
4
 
5
5
  import * as z from "zod/v3";
6
6
  import { safeParse } from "../../lib/schemas.js";
7
+ import * as openEnums from "../../types/enums.js";
8
+ import { OpenEnum } from "../../types/enums.js";
7
9
  import { Result as SafeParseResult } from "../../types/fp.js";
8
10
  import * as types from "../../types/primitives.js";
9
11
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
12
 
13
+ export const Recurrence = {
14
+ Monthly: "monthly",
15
+ Yearly: "yearly",
16
+ Once: "once",
17
+ } as const;
18
+ export type Recurrence = OpenEnum<typeof Recurrence>;
19
+
11
20
  /**
12
21
  * Reduced list of attributes of Variant record
13
22
  */
@@ -15,8 +24,16 @@ export type ProductVariant = {
15
24
  id?: number | undefined;
16
25
  price?: number | undefined;
17
26
  title?: string | null | undefined;
27
+ recurrence?: Recurrence | null | undefined;
18
28
  };
19
29
 
30
+ /** @internal */
31
+ export const Recurrence$inboundSchema: z.ZodType<
32
+ Recurrence,
33
+ z.ZodTypeDef,
34
+ unknown
35
+ > = openEnums.inboundSchema(Recurrence);
36
+
20
37
  /** @internal */
21
38
  export const ProductVariant$inboundSchema: z.ZodType<
22
39
  ProductVariant,
@@ -26,6 +43,7 @@ export const ProductVariant$inboundSchema: z.ZodType<
26
43
  id: types.optional(types.number()),
27
44
  price: types.optional(types.number()),
28
45
  title: z.nullable(types.string()).optional(),
46
+ recurrence: z.nullable(Recurrence$inboundSchema).optional(),
29
47
  });
30
48
 
31
49
  export function productVariantFromJSON(
@@ -0,0 +1,87 @@
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
+ export type CreateVendorFieldRequestBody = {
13
+ /**
14
+ * The company ID for this vendor field
15
+ */
16
+ companyId: number;
17
+ /**
18
+ * Display name for the vendor field
19
+ */
20
+ name: string;
21
+ /**
22
+ * Required for API users. The user ID to act on behalf of (e.g. company manager).
23
+ *
24
+ * @remarks
25
+ * The marketplace app must be activated for this user.
26
+ */
27
+ sourceUserId?: number | undefined;
28
+ };
29
+
30
+ /**
31
+ * The vendor field was created successfully.
32
+ */
33
+ export type CreateVendorFieldResponseBody = {
34
+ id?: number | undefined;
35
+ };
36
+
37
+ /** @internal */
38
+ export type CreateVendorFieldRequestBody$Outbound = {
39
+ company_id: number;
40
+ name: string;
41
+ source_user_id?: number | undefined;
42
+ };
43
+
44
+ /** @internal */
45
+ export const CreateVendorFieldRequestBody$outboundSchema: z.ZodType<
46
+ CreateVendorFieldRequestBody$Outbound,
47
+ z.ZodTypeDef,
48
+ CreateVendorFieldRequestBody
49
+ > = z.object({
50
+ companyId: z.number().int(),
51
+ name: z.string(),
52
+ sourceUserId: z.number().int().optional(),
53
+ }).transform((v) => {
54
+ return remap$(v, {
55
+ companyId: "company_id",
56
+ sourceUserId: "source_user_id",
57
+ });
58
+ });
59
+
60
+ export function createVendorFieldRequestBodyToJSON(
61
+ createVendorFieldRequestBody: CreateVendorFieldRequestBody,
62
+ ): string {
63
+ return JSON.stringify(
64
+ CreateVendorFieldRequestBody$outboundSchema.parse(
65
+ createVendorFieldRequestBody,
66
+ ),
67
+ );
68
+ }
69
+
70
+ /** @internal */
71
+ export const CreateVendorFieldResponseBody$inboundSchema: z.ZodType<
72
+ CreateVendorFieldResponseBody,
73
+ z.ZodTypeDef,
74
+ unknown
75
+ > = z.object({
76
+ id: types.optional(types.number()),
77
+ });
78
+
79
+ export function createVendorFieldResponseBodyFromJSON(
80
+ jsonString: string,
81
+ ): SafeParseResult<CreateVendorFieldResponseBody, SDKValidationError> {
82
+ return safeParse(
83
+ jsonString,
84
+ (x) => CreateVendorFieldResponseBody$inboundSchema.parse(JSON.parse(x)),
85
+ `Failed to parse 'CreateVendorFieldResponseBody' from JSON`,
86
+ );
87
+ }
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import * as components from "../components/index.js";
7
+
8
+ export type GetCurrentUserRequest = {
9
+ /**
10
+ * An array-style parameter to identify which sections of an object to expand. See documentation for the endpoint for a list of valid expansion values.
11
+ */
12
+ expand?: Array<components.Expand> | undefined;
13
+ };
14
+
15
+ /** @internal */
16
+ export type GetCurrentUserRequest$Outbound = {
17
+ expand?: Array<string> | undefined;
18
+ };
19
+
20
+ /** @internal */
21
+ export const GetCurrentUserRequest$outboundSchema: z.ZodType<
22
+ GetCurrentUserRequest$Outbound,
23
+ z.ZodTypeDef,
24
+ GetCurrentUserRequest
25
+ > = z.object({
26
+ expand: z.array(components.Expand$outboundSchema).optional(),
27
+ });
28
+
29
+ export function getCurrentUserRequestToJSON(
30
+ getCurrentUserRequest: GetCurrentUserRequest,
31
+ ): string {
32
+ return JSON.stringify(
33
+ GetCurrentUserRequest$outboundSchema.parse(getCurrentUserRequest),
34
+ );
35
+ }
@@ -17,6 +17,7 @@ export * from "./createinvoice.js";
17
17
  export * from "./createnewvendorcredentialversion.js";
18
18
  export * from "./createorupdatebcr.js";
19
19
  export * from "./createvendorcompany.js";
20
+ export * from "./createvendorfield.js";
20
21
  export * from "./createvendorregistration.js";
21
22
  export * from "./declineinvitation.js";
22
23
  export * from "./declinevendorcredential.js";
@@ -28,6 +29,7 @@ export * from "./deletevendormanagedbycompany.js";
28
29
  export * from "./downloadinvoicesexport.js";
29
30
  export * from "./expeditetimeremaining.js";
30
31
  export * from "./getcompany.js";
32
+ export * from "./getcurrentuser.js";
31
33
  export * from "./getfacility.js";
32
34
  export * from "./getfhirconfig.js";
33
35
  export * from "./getinvoicesexportstatus.js";
@@ -99,6 +101,7 @@ export * from "./updateuseralerts.js";
99
101
  export * from "./updatevendorcredentialdata.js";
100
102
  export * from "./updatevendorcredentialfile.js";
101
103
  export * from "./updatevendordetails.js";
104
+ export * from "./updatevendorfield.js";
102
105
  export * from "./updatevendormanagedbycompany.js";
103
106
  export * from "./updatevendorscrubdetails.js";
104
107
  export * from "./vendorscanout.js";
@@ -0,0 +1,122 @@
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
+ export type UpdateVendorFieldRequestBody = {
13
+ /**
14
+ * Whether to show this field to vendors
15
+ */
16
+ showToVendor: boolean;
17
+ /**
18
+ * Required for API users. The user ID to act on behalf of.
19
+ *
20
+ * @remarks
21
+ */
22
+ sourceUserId?: number | undefined;
23
+ };
24
+
25
+ export type UpdateVendorFieldRequest = {
26
+ /**
27
+ * The identifier of the object
28
+ */
29
+ id: number;
30
+ requestBody: UpdateVendorFieldRequestBody;
31
+ };
32
+
33
+ /**
34
+ * The vendor field was updated successfully.
35
+ */
36
+ export type UpdateVendorFieldResponseBody = {
37
+ id?: number | undefined;
38
+ showToVendor?: boolean | undefined;
39
+ };
40
+
41
+ /** @internal */
42
+ export type UpdateVendorFieldRequestBody$Outbound = {
43
+ show_to_vendor: boolean;
44
+ source_user_id?: number | undefined;
45
+ };
46
+
47
+ /** @internal */
48
+ export const UpdateVendorFieldRequestBody$outboundSchema: z.ZodType<
49
+ UpdateVendorFieldRequestBody$Outbound,
50
+ z.ZodTypeDef,
51
+ UpdateVendorFieldRequestBody
52
+ > = z.object({
53
+ showToVendor: z.boolean(),
54
+ sourceUserId: z.number().int().optional(),
55
+ }).transform((v) => {
56
+ return remap$(v, {
57
+ showToVendor: "show_to_vendor",
58
+ sourceUserId: "source_user_id",
59
+ });
60
+ });
61
+
62
+ export function updateVendorFieldRequestBodyToJSON(
63
+ updateVendorFieldRequestBody: UpdateVendorFieldRequestBody,
64
+ ): string {
65
+ return JSON.stringify(
66
+ UpdateVendorFieldRequestBody$outboundSchema.parse(
67
+ updateVendorFieldRequestBody,
68
+ ),
69
+ );
70
+ }
71
+
72
+ /** @internal */
73
+ export type UpdateVendorFieldRequest$Outbound = {
74
+ id: number;
75
+ RequestBody: UpdateVendorFieldRequestBody$Outbound;
76
+ };
77
+
78
+ /** @internal */
79
+ export const UpdateVendorFieldRequest$outboundSchema: z.ZodType<
80
+ UpdateVendorFieldRequest$Outbound,
81
+ z.ZodTypeDef,
82
+ UpdateVendorFieldRequest
83
+ > = z.object({
84
+ id: z.number().int(),
85
+ requestBody: z.lazy(() => UpdateVendorFieldRequestBody$outboundSchema),
86
+ }).transform((v) => {
87
+ return remap$(v, {
88
+ requestBody: "RequestBody",
89
+ });
90
+ });
91
+
92
+ export function updateVendorFieldRequestToJSON(
93
+ updateVendorFieldRequest: UpdateVendorFieldRequest,
94
+ ): string {
95
+ return JSON.stringify(
96
+ UpdateVendorFieldRequest$outboundSchema.parse(updateVendorFieldRequest),
97
+ );
98
+ }
99
+
100
+ /** @internal */
101
+ export const UpdateVendorFieldResponseBody$inboundSchema: z.ZodType<
102
+ UpdateVendorFieldResponseBody,
103
+ z.ZodTypeDef,
104
+ unknown
105
+ > = z.object({
106
+ id: types.optional(types.number()),
107
+ show_to_vendor: types.optional(types.boolean()),
108
+ }).transform((v) => {
109
+ return remap$(v, {
110
+ "show_to_vendor": "showToVendor",
111
+ });
112
+ });
113
+
114
+ export function updateVendorFieldResponseBodyFromJSON(
115
+ jsonString: string,
116
+ ): SafeParseResult<UpdateVendorFieldResponseBody, SDKValidationError> {
117
+ return safeParse(
118
+ jsonString,
119
+ (x) => UpdateVendorFieldResponseBody$inboundSchema.parse(JSON.parse(x)),
120
+ `Failed to parse 'UpdateVendorFieldResponseBody' from JSON`,
121
+ );
122
+ }
@@ -54,6 +54,8 @@ export * from "./usersPasswordResetRequest.js";
54
54
  export * from "./usersPostAuthenticate.js";
55
55
  export * from "./usersRotateApiKey.js";
56
56
  export * from "./usersSwitchAccount.js";
57
+ export * from "./vendorFieldsCreateVendorField.js";
58
+ export * from "./vendorFieldsUpdateVendorField.js";
57
59
  export * from "./vendorsAcceptVendorCredential.js";
58
60
  export * from "./vendorsAddVendorCredentialFile.js";
59
61
  export * from "./vendorsAddVendorManagedByCompany.js";
@@ -12,17 +12,20 @@ import { usersGetCurrentUser } from "../funcs/usersGetCurrentUser.js";
12
12
  import { combineSignals } from "../lib/primitives.js";
13
13
  import { RequestOptions } from "../lib/sdks.js";
14
14
  import * as components from "../models/components/index.js";
15
+ import * as operations from "../models/operations/index.js";
15
16
  import { unwrapAsync } from "../types/fp.js";
16
17
  export type UsersGetCurrentUserQueryData = components.User;
17
18
 
18
19
  export function prefetchUsersGetCurrentUser(
19
20
  queryClient: QueryClient,
20
21
  client$: GreenSecurityCore,
22
+ request: operations.GetCurrentUserRequest,
21
23
  options?: RequestOptions,
22
24
  ): Promise<void> {
23
25
  return queryClient.prefetchQuery({
24
26
  ...buildUsersGetCurrentUserQuery(
25
27
  client$,
28
+ request,
26
29
  options,
27
30
  ),
28
31
  });
@@ -30,6 +33,7 @@ export function prefetchUsersGetCurrentUser(
30
33
 
31
34
  export function buildUsersGetCurrentUserQuery(
32
35
  client$: GreenSecurityCore,
36
+ request: operations.GetCurrentUserRequest,
33
37
  options?: RequestOptions,
34
38
  ): {
35
39
  queryKey: QueryKey;
@@ -38,7 +42,7 @@ export function buildUsersGetCurrentUserQuery(
38
42
  ) => Promise<UsersGetCurrentUserQueryData>;
39
43
  } {
40
44
  return {
41
- queryKey: queryKeyUsersGetCurrentUser(),
45
+ queryKey: queryKeyUsersGetCurrentUser({ expand: request.expand }),
42
46
  queryFn: async function usersGetCurrentUserQueryFn(
43
47
  ctx,
44
48
  ): Promise<UsersGetCurrentUserQueryData> {
@@ -55,12 +59,20 @@ export function buildUsersGetCurrentUserQuery(
55
59
 
56
60
  return unwrapAsync(usersGetCurrentUser(
57
61
  client$,
62
+ request,
58
63
  mergedOptions,
59
64
  ));
60
65
  },
61
66
  };
62
67
  }
63
68
 
64
- export function queryKeyUsersGetCurrentUser(): QueryKey {
65
- return ["@greensecurity/javascript-sdk", "users", "getCurrentUser"];
69
+ export function queryKeyUsersGetCurrentUser(
70
+ parameters: { expand?: Array<components.Expand> | undefined },
71
+ ): QueryKey {
72
+ return [
73
+ "@greensecurity/javascript-sdk",
74
+ "users",
75
+ "getCurrentUser",
76
+ parameters,
77
+ ];
66
78
  }
@@ -10,6 +10,7 @@ import {
10
10
  useSuspenseQuery,
11
11
  UseSuspenseQueryResult,
12
12
  } from "@tanstack/react-query";
13
+ import * as components from "../models/components/index.js";
13
14
  import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
14
15
  import {
15
16
  ConnectionError,
@@ -21,8 +22,13 @@ import {
21
22
  import * as errors from "../models/errors/index.js";
22
23
  import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
23
24
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
24
26
  import { useGreenSecurityContext } from "./_context.js";
25
- import { QueryHookOptions, SuspenseQueryHookOptions } from "./_types.js";
27
+ import {
28
+ QueryHookOptions,
29
+ SuspenseQueryHookOptions,
30
+ TupleToPrefixes,
31
+ } from "./_types.js";
26
32
  import {
27
33
  buildUsersGetCurrentUserQuery,
28
34
  prefetchUsersGetCurrentUser,
@@ -51,9 +57,11 @@ export type UsersGetCurrentUserQueryError =
51
57
  * Get current user
52
58
  *
53
59
  * @remarks
54
- * Returns a user object for the user represented by the authorization token
60
+ * Returns a user object for the user represented by the authorization token.
61
+ * For Company Manager users, the `company` object supports expand. Available values: company.vendor_fields, company.location, company.vendor_type_restrictions.
55
62
  */
56
63
  export function useUsersGetCurrentUser(
64
+ request: operations.GetCurrentUserRequest,
57
65
  options?: QueryHookOptions<
58
66
  UsersGetCurrentUserQueryData,
59
67
  UsersGetCurrentUserQueryError
@@ -63,6 +71,7 @@ export function useUsersGetCurrentUser(
63
71
  return useQuery({
64
72
  ...buildUsersGetCurrentUserQuery(
65
73
  client,
74
+ request,
66
75
  options,
67
76
  ),
68
77
  ...options,
@@ -73,9 +82,11 @@ export function useUsersGetCurrentUser(
73
82
  * Get current user
74
83
  *
75
84
  * @remarks
76
- * Returns a user object for the user represented by the authorization token
85
+ * Returns a user object for the user represented by the authorization token.
86
+ * For Company Manager users, the `company` object supports expand. Available values: company.vendor_fields, company.location, company.vendor_type_restrictions.
77
87
  */
78
88
  export function useUsersGetCurrentUserSuspense(
89
+ request: operations.GetCurrentUserRequest,
79
90
  options?: SuspenseQueryHookOptions<
80
91
  UsersGetCurrentUserQueryData,
81
92
  UsersGetCurrentUserQueryError
@@ -88,6 +99,7 @@ export function useUsersGetCurrentUserSuspense(
88
99
  return useSuspenseQuery({
89
100
  ...buildUsersGetCurrentUserQuery(
90
101
  client,
102
+ request,
91
103
  options,
92
104
  ),
93
105
  ...options,
@@ -96,13 +108,32 @@ export function useUsersGetCurrentUserSuspense(
96
108
 
97
109
  export function setUsersGetCurrentUserData(
98
110
  client: QueryClient,
111
+ queryKeyBase: [parameters: { expand?: Array<components.Expand> | undefined }],
99
112
  data: UsersGetCurrentUserQueryData,
100
113
  ): UsersGetCurrentUserQueryData | undefined {
101
- const key = queryKeyUsersGetCurrentUser();
114
+ const key = queryKeyUsersGetCurrentUser(...queryKeyBase);
102
115
 
103
116
  return client.setQueryData<UsersGetCurrentUserQueryData>(key, data);
104
117
  }
105
118
 
119
+ export function invalidateUsersGetCurrentUser(
120
+ client: QueryClient,
121
+ queryKeyBase: TupleToPrefixes<
122
+ [parameters: { expand?: Array<components.Expand> | undefined }]
123
+ >,
124
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
125
+ ): Promise<void> {
126
+ return client.invalidateQueries({
127
+ ...filters,
128
+ queryKey: [
129
+ "@greensecurity/javascript-sdk",
130
+ "users",
131
+ "getCurrentUser",
132
+ ...queryKeyBase,
133
+ ],
134
+ });
135
+ }
136
+
106
137
  export function invalidateAllUsersGetCurrentUser(
107
138
  client: QueryClient,
108
139
  filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
@@ -0,0 +1,120 @@
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 { vendorFieldsCreateVendorField } from "../funcs/vendorFieldsCreateVendorField.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 VendorFieldsCreateVendorFieldMutationVariables = {
31
+ request: operations.CreateVendorFieldRequestBody;
32
+ options?: RequestOptions;
33
+ };
34
+
35
+ export type VendorFieldsCreateVendorFieldMutationData =
36
+ operations.CreateVendorFieldResponseBody;
37
+
38
+ export type VendorFieldsCreateVendorFieldMutationError =
39
+ | errors.ApiErrorResponse
40
+ | GreenSecurityError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError;
48
+
49
+ /**
50
+ * Create vendor field
51
+ *
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.
55
+ * Requires access to the company (company manager, admin, or API user with company scope).
56
+ *
57
+ * For API users: source_user_id is required. The API user acts on behalf of that user
58
+ * (e.g. a company manager). The app must be activated for that user via MarketplaceAppActivation.
59
+ */
60
+ export function useVendorFieldsCreateVendorFieldMutation(
61
+ options?: MutationHookOptions<
62
+ VendorFieldsCreateVendorFieldMutationData,
63
+ VendorFieldsCreateVendorFieldMutationError,
64
+ VendorFieldsCreateVendorFieldMutationVariables
65
+ >,
66
+ ): UseMutationResult<
67
+ VendorFieldsCreateVendorFieldMutationData,
68
+ VendorFieldsCreateVendorFieldMutationError,
69
+ VendorFieldsCreateVendorFieldMutationVariables
70
+ > {
71
+ const client = useGreenSecurityContext();
72
+ return useMutation({
73
+ ...buildVendorFieldsCreateVendorFieldMutation(client, options),
74
+ ...options,
75
+ });
76
+ }
77
+
78
+ export function mutationKeyVendorFieldsCreateVendorField(): MutationKey {
79
+ return [
80
+ "@greensecurity/javascript-sdk",
81
+ "vendor-fields",
82
+ "createVendorField",
83
+ ];
84
+ }
85
+
86
+ export function buildVendorFieldsCreateVendorFieldMutation(
87
+ client$: GreenSecurityCore,
88
+ hookOptions?: RequestOptions,
89
+ ): {
90
+ mutationKey: MutationKey;
91
+ mutationFn: (
92
+ variables: VendorFieldsCreateVendorFieldMutationVariables,
93
+ ) => Promise<VendorFieldsCreateVendorFieldMutationData>;
94
+ } {
95
+ return {
96
+ mutationKey: mutationKeyVendorFieldsCreateVendorField(),
97
+ mutationFn: function vendorFieldsCreateVendorFieldMutationFn({
98
+ request,
99
+ options,
100
+ }): Promise<VendorFieldsCreateVendorFieldMutationData> {
101
+ const mergedOptions = {
102
+ ...hookOptions,
103
+ ...options,
104
+ fetchOptions: {
105
+ ...hookOptions?.fetchOptions,
106
+ ...options?.fetchOptions,
107
+ signal: combineSignals(
108
+ hookOptions?.fetchOptions?.signal,
109
+ options?.fetchOptions?.signal,
110
+ ),
111
+ },
112
+ };
113
+ return unwrapAsync(vendorFieldsCreateVendorField(
114
+ client$,
115
+ request,
116
+ mergedOptions,
117
+ ));
118
+ },
119
+ };
120
+ }