@greensecurity/javascript-sdk 0.44.0-beta.29 → 0.44.0-beta.30

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 (146) hide show
  1. package/REACT_QUERY.md +15 -31
  2. package/README.md +6 -0
  3. package/dist/commonjs/__tests__/vendors.test.js +31 -0
  4. package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
  5. package/dist/commonjs/__tests__/zones.test.js +32 -3
  6. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  7. package/dist/commonjs/funcs/vendorsGetVendorPaymentResponsibility.d.ts +23 -0
  8. package/dist/commonjs/funcs/vendorsGetVendorPaymentResponsibility.d.ts.map +1 -0
  9. package/dist/commonjs/funcs/vendorsGetVendorPaymentResponsibility.js +129 -0
  10. package/dist/commonjs/funcs/vendorsGetVendorPaymentResponsibility.js.map +1 -0
  11. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.d.ts +1 -1
  12. package/dist/commonjs/funcs/vendorsUpdateVendorDetails.js +1 -1
  13. package/dist/commonjs/funcs/vendorsUpdateVendorPaymentResponsibility.d.ts +24 -0
  14. package/dist/commonjs/funcs/vendorsUpdateVendorPaymentResponsibility.d.ts.map +1 -0
  15. package/dist/commonjs/funcs/vendorsUpdateVendorPaymentResponsibility.js +131 -0
  16. package/dist/commonjs/funcs/vendorsUpdateVendorPaymentResponsibility.js.map +1 -0
  17. package/dist/commonjs/lib/config.d.ts +3 -3
  18. package/dist/commonjs/lib/config.js +3 -3
  19. package/dist/commonjs/models/components/index.d.ts +1 -0
  20. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  21. package/dist/commonjs/models/components/index.js +1 -0
  22. package/dist/commonjs/models/components/index.js.map +1 -1
  23. package/dist/commonjs/models/components/vendorpaymentresponsibilityassignments.d.ts +70 -0
  24. package/dist/commonjs/models/components/vendorpaymentresponsibilityassignments.d.ts.map +1 -0
  25. package/dist/commonjs/models/components/vendorpaymentresponsibilityassignments.js +71 -0
  26. package/dist/commonjs/models/components/vendorpaymentresponsibilityassignments.js.map +1 -0
  27. package/dist/commonjs/models/operations/getvendorpaymentresponsibility.d.ts +34 -0
  28. package/dist/commonjs/models/operations/getvendorpaymentresponsibility.d.ts.map +1 -0
  29. package/dist/commonjs/models/operations/getvendorpaymentresponsibility.js +70 -0
  30. package/dist/commonjs/models/operations/getvendorpaymentresponsibility.js.map +1 -0
  31. package/dist/commonjs/models/operations/index.d.ts +2 -0
  32. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  33. package/dist/commonjs/models/operations/index.js +2 -0
  34. package/dist/commonjs/models/operations/index.js.map +1 -1
  35. package/dist/commonjs/models/operations/updatevendordetails.d.ts +10 -0
  36. package/dist/commonjs/models/operations/updatevendordetails.d.ts.map +1 -1
  37. package/dist/commonjs/models/operations/updatevendordetails.js +4 -0
  38. package/dist/commonjs/models/operations/updatevendordetails.js.map +1 -1
  39. package/dist/commonjs/models/operations/updatevendorpaymentresponsibility.d.ts +74 -0
  40. package/dist/commonjs/models/operations/updatevendorpaymentresponsibility.d.ts.map +1 -0
  41. package/dist/commonjs/models/operations/updatevendorpaymentresponsibility.js +94 -0
  42. package/dist/commonjs/models/operations/updatevendorpaymentresponsibility.js.map +1 -0
  43. package/dist/commonjs/react-query/index.d.ts +2 -0
  44. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  45. package/dist/commonjs/react-query/index.js +2 -0
  46. package/dist/commonjs/react-query/index.js.map +1 -1
  47. package/dist/commonjs/react-query/vendorsGetVendorPaymentResponsibility.core.d.ts +12 -0
  48. package/dist/commonjs/react-query/vendorsGetVendorPaymentResponsibility.core.d.ts.map +1 -0
  49. package/dist/commonjs/react-query/vendorsGetVendorPaymentResponsibility.core.js +39 -0
  50. package/dist/commonjs/react-query/vendorsGetVendorPaymentResponsibility.core.js.map +1 -0
  51. package/dist/commonjs/react-query/vendorsGetVendorPaymentResponsibility.d.ts +35 -0
  52. package/dist/commonjs/react-query/vendorsGetVendorPaymentResponsibility.d.ts.map +1 -0
  53. package/dist/commonjs/react-query/vendorsGetVendorPaymentResponsibility.js +75 -0
  54. package/dist/commonjs/react-query/vendorsGetVendorPaymentResponsibility.js.map +1 -0
  55. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.d.ts +1 -1
  56. package/dist/commonjs/react-query/vendorsUpdateVendorDetails.js +1 -1
  57. package/dist/commonjs/react-query/vendorsUpdateVendorPaymentResponsibility.d.ts +33 -0
  58. package/dist/commonjs/react-query/vendorsUpdateVendorPaymentResponsibility.d.ts.map +1 -0
  59. package/dist/commonjs/react-query/vendorsUpdateVendorPaymentResponsibility.js +55 -0
  60. package/dist/commonjs/react-query/vendorsUpdateVendorPaymentResponsibility.js.map +1 -0
  61. package/dist/commonjs/sdk/vendors.d.ts +22 -1
  62. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  63. package/dist/commonjs/sdk/vendors.js +28 -1
  64. package/dist/commonjs/sdk/vendors.js.map +1 -1
  65. package/dist/esm/__tests__/vendors.test.js +31 -0
  66. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  67. package/dist/esm/__tests__/zones.test.js +32 -3
  68. package/dist/esm/__tests__/zones.test.js.map +1 -1
  69. package/dist/esm/funcs/vendorsGetVendorPaymentResponsibility.d.ts +23 -0
  70. package/dist/esm/funcs/vendorsGetVendorPaymentResponsibility.d.ts.map +1 -0
  71. package/dist/esm/funcs/vendorsGetVendorPaymentResponsibility.js +93 -0
  72. package/dist/esm/funcs/vendorsGetVendorPaymentResponsibility.js.map +1 -0
  73. package/dist/esm/funcs/vendorsUpdateVendorDetails.d.ts +1 -1
  74. package/dist/esm/funcs/vendorsUpdateVendorDetails.js +1 -1
  75. package/dist/esm/funcs/vendorsUpdateVendorPaymentResponsibility.d.ts +24 -0
  76. package/dist/esm/funcs/vendorsUpdateVendorPaymentResponsibility.d.ts.map +1 -0
  77. package/dist/esm/funcs/vendorsUpdateVendorPaymentResponsibility.js +95 -0
  78. package/dist/esm/funcs/vendorsUpdateVendorPaymentResponsibility.js.map +1 -0
  79. package/dist/esm/lib/config.d.ts +3 -3
  80. package/dist/esm/lib/config.js +3 -3
  81. package/dist/esm/models/components/index.d.ts +1 -0
  82. package/dist/esm/models/components/index.d.ts.map +1 -1
  83. package/dist/esm/models/components/index.js +1 -0
  84. package/dist/esm/models/components/index.js.map +1 -1
  85. package/dist/esm/models/components/vendorpaymentresponsibilityassignments.d.ts +70 -0
  86. package/dist/esm/models/components/vendorpaymentresponsibilityassignments.d.ts.map +1 -0
  87. package/dist/esm/models/components/vendorpaymentresponsibilityassignments.js +34 -0
  88. package/dist/esm/models/components/vendorpaymentresponsibilityassignments.js.map +1 -0
  89. package/dist/esm/models/operations/getvendorpaymentresponsibility.d.ts +34 -0
  90. package/dist/esm/models/operations/getvendorpaymentresponsibility.d.ts.map +1 -0
  91. package/dist/esm/models/operations/getvendorpaymentresponsibility.js +32 -0
  92. package/dist/esm/models/operations/getvendorpaymentresponsibility.js.map +1 -0
  93. package/dist/esm/models/operations/index.d.ts +2 -0
  94. package/dist/esm/models/operations/index.d.ts.map +1 -1
  95. package/dist/esm/models/operations/index.js +2 -0
  96. package/dist/esm/models/operations/index.js.map +1 -1
  97. package/dist/esm/models/operations/updatevendordetails.d.ts +10 -0
  98. package/dist/esm/models/operations/updatevendordetails.d.ts.map +1 -1
  99. package/dist/esm/models/operations/updatevendordetails.js +4 -0
  100. package/dist/esm/models/operations/updatevendordetails.js.map +1 -1
  101. package/dist/esm/models/operations/updatevendorpaymentresponsibility.d.ts +74 -0
  102. package/dist/esm/models/operations/updatevendorpaymentresponsibility.d.ts.map +1 -0
  103. package/dist/esm/models/operations/updatevendorpaymentresponsibility.js +55 -0
  104. package/dist/esm/models/operations/updatevendorpaymentresponsibility.js.map +1 -0
  105. package/dist/esm/react-query/index.d.ts +2 -0
  106. package/dist/esm/react-query/index.d.ts.map +1 -1
  107. package/dist/esm/react-query/index.js +2 -0
  108. package/dist/esm/react-query/index.js.map +1 -1
  109. package/dist/esm/react-query/vendorsGetVendorPaymentResponsibility.core.d.ts +12 -0
  110. package/dist/esm/react-query/vendorsGetVendorPaymentResponsibility.core.d.ts.map +1 -0
  111. package/dist/esm/react-query/vendorsGetVendorPaymentResponsibility.core.js +34 -0
  112. package/dist/esm/react-query/vendorsGetVendorPaymentResponsibility.core.js.map +1 -0
  113. package/dist/esm/react-query/vendorsGetVendorPaymentResponsibility.d.ts +35 -0
  114. package/dist/esm/react-query/vendorsGetVendorPaymentResponsibility.d.ts.map +1 -0
  115. package/dist/esm/react-query/vendorsGetVendorPaymentResponsibility.js +65 -0
  116. package/dist/esm/react-query/vendorsGetVendorPaymentResponsibility.js.map +1 -0
  117. package/dist/esm/react-query/vendorsUpdateVendorDetails.d.ts +1 -1
  118. package/dist/esm/react-query/vendorsUpdateVendorDetails.js +1 -1
  119. package/dist/esm/react-query/vendorsUpdateVendorPaymentResponsibility.d.ts +33 -0
  120. package/dist/esm/react-query/vendorsUpdateVendorPaymentResponsibility.d.ts.map +1 -0
  121. package/dist/esm/react-query/vendorsUpdateVendorPaymentResponsibility.js +50 -0
  122. package/dist/esm/react-query/vendorsUpdateVendorPaymentResponsibility.js.map +1 -0
  123. package/dist/esm/sdk/vendors.d.ts +22 -1
  124. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  125. package/dist/esm/sdk/vendors.js +28 -1
  126. package/dist/esm/sdk/vendors.js.map +1 -1
  127. package/jsr.json +1 -1
  128. package/package.json +2 -2
  129. package/src/__tests__/vendors.test.ts +39 -0
  130. package/src/__tests__/zones.test.ts +32 -3
  131. package/src/funcs/vendorsGetVendorPaymentResponsibility.ts +189 -0
  132. package/src/funcs/vendorsUpdateVendorDetails.ts +1 -1
  133. package/src/funcs/vendorsUpdateVendorPaymentResponsibility.ts +191 -0
  134. package/src/lib/config.ts +3 -3
  135. package/src/models/components/index.ts +1 -0
  136. package/src/models/components/vendorpaymentresponsibilityassignments.ts +113 -0
  137. package/src/models/operations/getvendorpaymentresponsibility.ts +93 -0
  138. package/src/models/operations/index.ts +2 -0
  139. package/src/models/operations/updatevendordetails.ts +14 -0
  140. package/src/models/operations/updatevendorpaymentresponsibility.ts +173 -0
  141. package/src/react-query/index.ts +2 -0
  142. package/src/react-query/vendorsGetVendorPaymentResponsibility.core.ts +78 -0
  143. package/src/react-query/vendorsGetVendorPaymentResponsibility.ts +156 -0
  144. package/src/react-query/vendorsUpdateVendorDetails.ts +1 -1
  145. package/src/react-query/vendorsUpdateVendorPaymentResponsibility.ts +119 -0
  146. package/src/sdk/vendors.ts +48 -1
@@ -0,0 +1,113 @@
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
+ * Records which party (vendor or company manager) is responsible for each
14
+ *
15
+ * @remarks
16
+ * payment category for a given vendor–company relationship. A `null`
17
+ * `_user_id` field means responsibility defaults to the vendor.
18
+ */
19
+ export type VendorPaymentResponsibilityAssignments = {
20
+ /**
21
+ * Unique identifier for the payment responsibility record. `null` when no record has been persisted yet.
22
+ */
23
+ id?: number | null | undefined;
24
+ /**
25
+ * ID of the vendor this record applies to.
26
+ */
27
+ vendorId: number;
28
+ /**
29
+ * ID of the managing company this record applies to.
30
+ */
31
+ companyId?: number | null | undefined;
32
+ /**
33
+ * User ID responsible for Credentialing Subscription & Expediting
34
+ *
35
+ * @remarks
36
+ * payments. `null` means the vendor is responsible.
37
+ */
38
+ credentialingSubscriptionUserId?: number | null | undefined;
39
+ /**
40
+ * User ID responsible for Scrubs Subscription payments.
41
+ *
42
+ * @remarks
43
+ * `null` means the vendor is responsible.
44
+ */
45
+ scrubsSubscriptionUserId?: number | null | undefined;
46
+ /**
47
+ * User ID responsible for Scrub Credits payments.
48
+ *
49
+ * @remarks
50
+ * `null` means the vendor is responsible.
51
+ */
52
+ scrubCreditsUserId?: number | null | undefined;
53
+ /**
54
+ * User ID responsible for Initial Hard Badge payments.
55
+ *
56
+ * @remarks
57
+ * `null` means the vendor is responsible.
58
+ */
59
+ hardBadgeInitialUserId?: number | null | undefined;
60
+ /**
61
+ * User ID responsible for Additional Hard Badge payments.
62
+ *
63
+ * @remarks
64
+ * `null` means the vendor is responsible.
65
+ */
66
+ hardBadgeExtraUserId?: number | null | undefined;
67
+ /**
68
+ * User ID responsible for all other invoice payments.
69
+ *
70
+ * @remarks
71
+ * `null` means the vendor is responsible.
72
+ */
73
+ otherInvoicesUserId?: number | null | undefined;
74
+ };
75
+
76
+ /** @internal */
77
+ export const VendorPaymentResponsibilityAssignments$inboundSchema: z.ZodType<
78
+ VendorPaymentResponsibilityAssignments,
79
+ z.ZodTypeDef,
80
+ unknown
81
+ > = z.object({
82
+ id: z.nullable(types.number()).optional(),
83
+ vendor_id: types.number(),
84
+ company_id: z.nullable(types.number()).optional(),
85
+ credentialing_subscription_user_id: z.nullable(types.number()).optional(),
86
+ scrubs_subscription_user_id: z.nullable(types.number()).optional(),
87
+ scrub_credits_user_id: z.nullable(types.number()).optional(),
88
+ hard_badge_initial_user_id: z.nullable(types.number()).optional(),
89
+ hard_badge_extra_user_id: z.nullable(types.number()).optional(),
90
+ other_invoices_user_id: z.nullable(types.number()).optional(),
91
+ }).transform((v) => {
92
+ return remap$(v, {
93
+ "vendor_id": "vendorId",
94
+ "company_id": "companyId",
95
+ "credentialing_subscription_user_id": "credentialingSubscriptionUserId",
96
+ "scrubs_subscription_user_id": "scrubsSubscriptionUserId",
97
+ "scrub_credits_user_id": "scrubCreditsUserId",
98
+ "hard_badge_initial_user_id": "hardBadgeInitialUserId",
99
+ "hard_badge_extra_user_id": "hardBadgeExtraUserId",
100
+ "other_invoices_user_id": "otherInvoicesUserId",
101
+ });
102
+ });
103
+
104
+ export function vendorPaymentResponsibilityAssignmentsFromJSON(
105
+ jsonString: string,
106
+ ): SafeParseResult<VendorPaymentResponsibilityAssignments, SDKValidationError> {
107
+ return safeParse(
108
+ jsonString,
109
+ (x) =>
110
+ VendorPaymentResponsibilityAssignments$inboundSchema.parse(JSON.parse(x)),
111
+ `Failed to parse 'VendorPaymentResponsibilityAssignments' from JSON`,
112
+ );
113
+ }
@@ -0,0 +1,93 @@
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 * as components from "../components/index.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type GetVendorPaymentResponsibilityRequest = {
14
+ /**
15
+ * ID of the vendor rep.
16
+ */
17
+ vendorId: number;
18
+ };
19
+
20
+ /**
21
+ * The request was successful, and the server has returned the requested resource in the response body.
22
+ */
23
+ export type GetVendorPaymentResponsibilityGetVendorPaymentResponsibilityOk = {
24
+ /**
25
+ * Records which party (vendor or company manager) is responsible for each
26
+ *
27
+ * @remarks
28
+ * payment category for a given vendor–company relationship. A `null`
29
+ * `_user_id` field means responsibility defaults to the vendor.
30
+ */
31
+ paymentResponsibility?:
32
+ | components.VendorPaymentResponsibilityAssignments
33
+ | undefined;
34
+ };
35
+
36
+ /** @internal */
37
+ export type GetVendorPaymentResponsibilityRequest$Outbound = {
38
+ vendor_id: number;
39
+ };
40
+
41
+ /** @internal */
42
+ export const GetVendorPaymentResponsibilityRequest$outboundSchema: z.ZodType<
43
+ GetVendorPaymentResponsibilityRequest$Outbound,
44
+ z.ZodTypeDef,
45
+ GetVendorPaymentResponsibilityRequest
46
+ > = z.object({
47
+ vendorId: z.number().int(),
48
+ }).transform((v) => {
49
+ return remap$(v, {
50
+ vendorId: "vendor_id",
51
+ });
52
+ });
53
+
54
+ export function getVendorPaymentResponsibilityRequestToJSON(
55
+ getVendorPaymentResponsibilityRequest: GetVendorPaymentResponsibilityRequest,
56
+ ): string {
57
+ return JSON.stringify(
58
+ GetVendorPaymentResponsibilityRequest$outboundSchema.parse(
59
+ getVendorPaymentResponsibilityRequest,
60
+ ),
61
+ );
62
+ }
63
+
64
+ /** @internal */
65
+ export const GetVendorPaymentResponsibilityGetVendorPaymentResponsibilityOk$inboundSchema:
66
+ z.ZodType<
67
+ GetVendorPaymentResponsibilityGetVendorPaymentResponsibilityOk,
68
+ z.ZodTypeDef,
69
+ unknown
70
+ > = z.object({
71
+ payment_responsibility: types.optional(
72
+ components.VendorPaymentResponsibilityAssignments$inboundSchema,
73
+ ),
74
+ }).transform((v) => {
75
+ return remap$(v, {
76
+ "payment_responsibility": "paymentResponsibility",
77
+ });
78
+ });
79
+
80
+ export function getVendorPaymentResponsibilityGetVendorPaymentResponsibilityOkFromJSON(
81
+ jsonString: string,
82
+ ): SafeParseResult<
83
+ GetVendorPaymentResponsibilityGetVendorPaymentResponsibilityOk,
84
+ SDKValidationError
85
+ > {
86
+ return safeParse(
87
+ jsonString,
88
+ (x) =>
89
+ GetVendorPaymentResponsibilityGetVendorPaymentResponsibilityOk$inboundSchema
90
+ .parse(JSON.parse(x)),
91
+ `Failed to parse 'GetVendorPaymentResponsibilityGetVendorPaymentResponsibilityOk' from JSON`,
92
+ );
93
+ }
@@ -63,6 +63,7 @@ export * from "./getvendorcredentialfile.js";
63
63
  export * from "./getvendorinvoicedetails.js";
64
64
  export * from "./getvendorinvoicereceipt.js";
65
65
  export * from "./getvendorlegalname.js";
66
+ export * from "./getvendorpaymentresponsibility.js";
66
67
  export * from "./getvendorscan.js";
67
68
  export * from "./getvendorscansexportstatus.js";
68
69
  export * from "./getvendorsdetails.js";
@@ -136,6 +137,7 @@ export * from "./updatevendorcustomfield.js";
136
137
  export * from "./updatevendordetails.js";
137
138
  export * from "./updatevendorfield.js";
138
139
  export * from "./updatevendormanagedbycompany.js";
140
+ export * from "./updatevendorpaymentresponsibility.js";
139
141
  export * from "./updatevendorscrubdetails.js";
140
142
  export * from "./vendorscanout.js";
141
143
  export * from "./vendorsexport.js";
@@ -82,6 +82,14 @@ export type UpdateVendorDetailsRequestBody = {
82
82
  * The vendor's primary department id value to set
83
83
  */
84
84
  primaryDepartmentId?: number | undefined;
85
+ /**
86
+ * The vendor's primary sales state as a 2-letter US state code (e.g. `TX`). Persisted to the vendor's `territory` column.
87
+ */
88
+ primarySalesState?: string | undefined;
89
+ /**
90
+ * Set to `null` to remove the vendor from its company. Company managers only; this replaces `DELETE /api/vendors/:id/company`. Only `null` is accepted — reassigning the vendor to a different company is not supported through this endpoint.
91
+ */
92
+ companyId?: any | null | undefined;
85
93
  };
86
94
 
87
95
  export type UpdateVendorDetailsRequest = {
@@ -112,6 +120,8 @@ export type UpdateVendorDetailsRequestBody$Outbound = {
112
120
  location?: components.UserLocation$Outbound | null | undefined;
113
121
  supervisor?: components.Supervisor$Outbound | null | undefined;
114
122
  primary_department_id?: number | undefined;
123
+ primary_sales_state?: string | undefined;
124
+ company_id?: any | null | undefined;
115
125
  };
116
126
 
117
127
  /** @internal */
@@ -127,12 +137,16 @@ export const UpdateVendorDetailsRequestBody$outboundSchema: z.ZodType<
127
137
  location: z.nullable(components.UserLocation$outboundSchema).optional(),
128
138
  supervisor: z.nullable(components.Supervisor$outboundSchema).optional(),
129
139
  primaryDepartmentId: z.number().int().optional(),
140
+ primarySalesState: z.string().optional(),
141
+ companyId: z.nullable(z.any()).optional(),
130
142
  }).transform((v) => {
131
143
  return remap$(v, {
132
144
  qrCode: "qr_code",
133
145
  emailRecepient: "email_recepient",
134
146
  sendWeeklySummaryEmail: "send_weekly_summary_email",
135
147
  primaryDepartmentId: "primary_department_id",
148
+ primarySalesState: "primary_sales_state",
149
+ companyId: "company_id",
136
150
  });
137
151
  });
138
152
 
@@ -0,0 +1,173 @@
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 * as components from "../components/index.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type UpdateVendorPaymentResponsibilityRequestBody = {
14
+ /**
15
+ * User ID responsible for Credentialing Subscription & Expediting payments. Pass `null` to reset responsibility to the vendor.
16
+ */
17
+ credentialingSubscriptionUserId?: number | null | undefined;
18
+ /**
19
+ * User ID responsible for Scrubs Subscription payments. Pass `null` to reset responsibility to the vendor.
20
+ */
21
+ scrubsSubscriptionUserId?: number | null | undefined;
22
+ /**
23
+ * User ID responsible for Scrub Credits payments. Pass `null` to reset responsibility to the vendor.
24
+ */
25
+ scrubCreditsUserId?: number | null | undefined;
26
+ /**
27
+ * User ID responsible for Initial Hard Badge payments. Pass `null` to reset responsibility to the vendor.
28
+ */
29
+ hardBadgeInitialUserId?: number | null | undefined;
30
+ /**
31
+ * User ID responsible for Additional Hard Badge payments. Pass `null` to reset responsibility to the vendor.
32
+ */
33
+ hardBadgeExtraUserId?: number | null | undefined;
34
+ /**
35
+ * User ID responsible for Other Invoice payments. Pass `null` to reset responsibility to the vendor.
36
+ */
37
+ otherInvoicesUserId?: number | null | undefined;
38
+ };
39
+
40
+ export type UpdateVendorPaymentResponsibilityRequest = {
41
+ /**
42
+ * ID of the vendor rep.
43
+ */
44
+ vendorId: number;
45
+ requestBody: UpdateVendorPaymentResponsibilityRequestBody;
46
+ };
47
+
48
+ /**
49
+ * The request was successful, and the server has returned the updated payment responsibility record.
50
+ */
51
+ export type UpdateVendorPaymentResponsibilityUpdateVendorPaymentResponsibilityOk =
52
+ {
53
+ /**
54
+ * Records which party (vendor or company manager) is responsible for each
55
+ *
56
+ * @remarks
57
+ * payment category for a given vendor–company relationship. A `null`
58
+ * `_user_id` field means responsibility defaults to the vendor.
59
+ */
60
+ paymentResponsibility?:
61
+ | components.VendorPaymentResponsibilityAssignments
62
+ | undefined;
63
+ };
64
+
65
+ /** @internal */
66
+ export type UpdateVendorPaymentResponsibilityRequestBody$Outbound = {
67
+ credentialing_subscription_user_id?: number | null | undefined;
68
+ scrubs_subscription_user_id?: number | null | undefined;
69
+ scrub_credits_user_id?: number | null | undefined;
70
+ hard_badge_initial_user_id?: number | null | undefined;
71
+ hard_badge_extra_user_id?: number | null | undefined;
72
+ other_invoices_user_id?: number | null | undefined;
73
+ };
74
+
75
+ /** @internal */
76
+ export const UpdateVendorPaymentResponsibilityRequestBody$outboundSchema:
77
+ z.ZodType<
78
+ UpdateVendorPaymentResponsibilityRequestBody$Outbound,
79
+ z.ZodTypeDef,
80
+ UpdateVendorPaymentResponsibilityRequestBody
81
+ > = z.object({
82
+ credentialingSubscriptionUserId: z.nullable(z.number().int()).optional(),
83
+ scrubsSubscriptionUserId: z.nullable(z.number().int()).optional(),
84
+ scrubCreditsUserId: z.nullable(z.number().int()).optional(),
85
+ hardBadgeInitialUserId: z.nullable(z.number().int()).optional(),
86
+ hardBadgeExtraUserId: z.nullable(z.number().int()).optional(),
87
+ otherInvoicesUserId: z.nullable(z.number().int()).optional(),
88
+ }).transform((v) => {
89
+ return remap$(v, {
90
+ credentialingSubscriptionUserId: "credentialing_subscription_user_id",
91
+ scrubsSubscriptionUserId: "scrubs_subscription_user_id",
92
+ scrubCreditsUserId: "scrub_credits_user_id",
93
+ hardBadgeInitialUserId: "hard_badge_initial_user_id",
94
+ hardBadgeExtraUserId: "hard_badge_extra_user_id",
95
+ otherInvoicesUserId: "other_invoices_user_id",
96
+ });
97
+ });
98
+
99
+ export function updateVendorPaymentResponsibilityRequestBodyToJSON(
100
+ updateVendorPaymentResponsibilityRequestBody:
101
+ UpdateVendorPaymentResponsibilityRequestBody,
102
+ ): string {
103
+ return JSON.stringify(
104
+ UpdateVendorPaymentResponsibilityRequestBody$outboundSchema.parse(
105
+ updateVendorPaymentResponsibilityRequestBody,
106
+ ),
107
+ );
108
+ }
109
+
110
+ /** @internal */
111
+ export type UpdateVendorPaymentResponsibilityRequest$Outbound = {
112
+ vendor_id: number;
113
+ RequestBody: UpdateVendorPaymentResponsibilityRequestBody$Outbound;
114
+ };
115
+
116
+ /** @internal */
117
+ export const UpdateVendorPaymentResponsibilityRequest$outboundSchema: z.ZodType<
118
+ UpdateVendorPaymentResponsibilityRequest$Outbound,
119
+ z.ZodTypeDef,
120
+ UpdateVendorPaymentResponsibilityRequest
121
+ > = z.object({
122
+ vendorId: z.number().int(),
123
+ requestBody: z.lazy(() =>
124
+ UpdateVendorPaymentResponsibilityRequestBody$outboundSchema
125
+ ),
126
+ }).transform((v) => {
127
+ return remap$(v, {
128
+ vendorId: "vendor_id",
129
+ requestBody: "RequestBody",
130
+ });
131
+ });
132
+
133
+ export function updateVendorPaymentResponsibilityRequestToJSON(
134
+ updateVendorPaymentResponsibilityRequest:
135
+ UpdateVendorPaymentResponsibilityRequest,
136
+ ): string {
137
+ return JSON.stringify(
138
+ UpdateVendorPaymentResponsibilityRequest$outboundSchema.parse(
139
+ updateVendorPaymentResponsibilityRequest,
140
+ ),
141
+ );
142
+ }
143
+
144
+ /** @internal */
145
+ export const UpdateVendorPaymentResponsibilityUpdateVendorPaymentResponsibilityOk$inboundSchema:
146
+ z.ZodType<
147
+ UpdateVendorPaymentResponsibilityUpdateVendorPaymentResponsibilityOk,
148
+ z.ZodTypeDef,
149
+ unknown
150
+ > = z.object({
151
+ payment_responsibility: types.optional(
152
+ components.VendorPaymentResponsibilityAssignments$inboundSchema,
153
+ ),
154
+ }).transform((v) => {
155
+ return remap$(v, {
156
+ "payment_responsibility": "paymentResponsibility",
157
+ });
158
+ });
159
+
160
+ export function updateVendorPaymentResponsibilityUpdateVendorPaymentResponsibilityOkFromJSON(
161
+ jsonString: string,
162
+ ): SafeParseResult<
163
+ UpdateVendorPaymentResponsibilityUpdateVendorPaymentResponsibilityOk,
164
+ SDKValidationError
165
+ > {
166
+ return safeParse(
167
+ jsonString,
168
+ (x) =>
169
+ UpdateVendorPaymentResponsibilityUpdateVendorPaymentResponsibilityOk$inboundSchema
170
+ .parse(JSON.parse(x)),
171
+ `Failed to parse 'UpdateVendorPaymentResponsibilityUpdateVendorPaymentResponsibilityOk' from JSON`,
172
+ );
173
+ }
@@ -109,6 +109,7 @@ export * from "./vendorsGetVendorCredentialFile.js";
109
109
  export * from "./vendorsGetVendorInvoiceDetails.js";
110
110
  export * from "./vendorsGetVendorInvoiceReceipt.js";
111
111
  export * from "./vendorsGetVendorLegalName.js";
112
+ export * from "./vendorsGetVendorPaymentResponsibility.js";
112
113
  export * from "./vendorsGetVendorsDetails.js";
113
114
  export * from "./vendorsGetVendorsExportStatus.js";
114
115
  export * from "./vendorsGetVendorUploadHistory.js";
@@ -136,6 +137,7 @@ export * from "./vendorsUpdateVendorCredentialFile.js";
136
137
  export * from "./vendorsUpdateVendorCustomField.js";
137
138
  export * from "./vendorsUpdateVendorDetails.js";
138
139
  export * from "./vendorsUpdateVendorManagedByCompany.js";
140
+ export * from "./vendorsUpdateVendorPaymentResponsibility.js";
139
141
  export * from "./vendorsUpdateVendorScrubDetails.js";
140
142
  export * from "./vendorsVendorsExport.js";
141
143
  export * from "./webhooksGetWebhookEndpoint.js";
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ QueryClient,
7
+ QueryFunctionContext,
8
+ QueryKey,
9
+ } from "@tanstack/react-query";
10
+ import { GreenSecurityCore } from "../core.js";
11
+ import { vendorsGetVendorPaymentResponsibility } from "../funcs/vendorsGetVendorPaymentResponsibility.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import * as operations from "../models/operations/index.js";
15
+ import { unwrapAsync } from "../types/fp.js";
16
+ export type VendorsGetVendorPaymentResponsibilityQueryData =
17
+ operations.GetVendorPaymentResponsibilityGetVendorPaymentResponsibilityOk;
18
+
19
+ export function prefetchVendorsGetVendorPaymentResponsibility(
20
+ queryClient: QueryClient,
21
+ client$: GreenSecurityCore,
22
+ request: operations.GetVendorPaymentResponsibilityRequest,
23
+ options?: RequestOptions,
24
+ ): Promise<void> {
25
+ return queryClient.prefetchQuery({
26
+ ...buildVendorsGetVendorPaymentResponsibilityQuery(
27
+ client$,
28
+ request,
29
+ options,
30
+ ),
31
+ });
32
+ }
33
+
34
+ export function buildVendorsGetVendorPaymentResponsibilityQuery(
35
+ client$: GreenSecurityCore,
36
+ request: operations.GetVendorPaymentResponsibilityRequest,
37
+ options?: RequestOptions,
38
+ ): {
39
+ queryKey: QueryKey;
40
+ queryFn: (
41
+ context: QueryFunctionContext,
42
+ ) => Promise<VendorsGetVendorPaymentResponsibilityQueryData>;
43
+ } {
44
+ return {
45
+ queryKey: queryKeyVendorsGetVendorPaymentResponsibility(request.vendorId),
46
+ queryFn: async function vendorsGetVendorPaymentResponsibilityQueryFn(
47
+ ctx,
48
+ ): Promise<VendorsGetVendorPaymentResponsibilityQueryData> {
49
+ const sig = combineSignals(
50
+ ctx.signal,
51
+ options?.signal,
52
+ options?.fetchOptions?.signal,
53
+ );
54
+ const mergedOptions = {
55
+ ...options?.fetchOptions,
56
+ ...options,
57
+ signal: sig,
58
+ };
59
+
60
+ return unwrapAsync(vendorsGetVendorPaymentResponsibility(
61
+ client$,
62
+ request,
63
+ mergedOptions,
64
+ ));
65
+ },
66
+ };
67
+ }
68
+
69
+ export function queryKeyVendorsGetVendorPaymentResponsibility(
70
+ vendorId: number,
71
+ ): QueryKey {
72
+ return [
73
+ "@greensecurity/javascript-sdk",
74
+ "vendors",
75
+ "getVendorPaymentResponsibility",
76
+ vendorId,
77
+ ];
78
+ }
@@ -0,0 +1,156 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ InvalidateQueryFilters,
7
+ QueryClient,
8
+ useQuery,
9
+ UseQueryResult,
10
+ useSuspenseQuery,
11
+ UseSuspenseQueryResult,
12
+ } from "@tanstack/react-query";
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 { useGreenSecurityContext } from "./_context.js";
26
+ import {
27
+ QueryHookOptions,
28
+ SuspenseQueryHookOptions,
29
+ TupleToPrefixes,
30
+ } from "./_types.js";
31
+ import {
32
+ buildVendorsGetVendorPaymentResponsibilityQuery,
33
+ prefetchVendorsGetVendorPaymentResponsibility,
34
+ queryKeyVendorsGetVendorPaymentResponsibility,
35
+ VendorsGetVendorPaymentResponsibilityQueryData,
36
+ } from "./vendorsGetVendorPaymentResponsibility.core.js";
37
+ export {
38
+ buildVendorsGetVendorPaymentResponsibilityQuery,
39
+ prefetchVendorsGetVendorPaymentResponsibility,
40
+ queryKeyVendorsGetVendorPaymentResponsibility,
41
+ type VendorsGetVendorPaymentResponsibilityQueryData,
42
+ };
43
+
44
+ export type VendorsGetVendorPaymentResponsibilityQueryError =
45
+ | errors.ApiErrorResponse
46
+ | GreenSecurityError
47
+ | ResponseValidationError
48
+ | ConnectionError
49
+ | RequestAbortedError
50
+ | RequestTimeoutError
51
+ | InvalidRequestError
52
+ | UnexpectedClientError
53
+ | SDKValidationError;
54
+
55
+ /**
56
+ * Get vendor payment responsibility
57
+ *
58
+ * @remarks
59
+ * Returns the payment responsibility record for a vendor managed by the authenticated
60
+ * company manager's company, or by the vendor themselves. Each `_user_id` field
61
+ * indicates which party is responsible for that payment category; `null` means
62
+ * responsibility defaults to the vendor.
63
+ */
64
+ export function useVendorsGetVendorPaymentResponsibility(
65
+ request: operations.GetVendorPaymentResponsibilityRequest,
66
+ options?: QueryHookOptions<
67
+ VendorsGetVendorPaymentResponsibilityQueryData,
68
+ VendorsGetVendorPaymentResponsibilityQueryError
69
+ >,
70
+ ): UseQueryResult<
71
+ VendorsGetVendorPaymentResponsibilityQueryData,
72
+ VendorsGetVendorPaymentResponsibilityQueryError
73
+ > {
74
+ const client = useGreenSecurityContext();
75
+ return useQuery({
76
+ ...buildVendorsGetVendorPaymentResponsibilityQuery(
77
+ client,
78
+ request,
79
+ options,
80
+ ),
81
+ ...options,
82
+ });
83
+ }
84
+
85
+ /**
86
+ * Get vendor payment responsibility
87
+ *
88
+ * @remarks
89
+ * Returns the payment responsibility record for a vendor managed by the authenticated
90
+ * company manager's company, or by the vendor themselves. Each `_user_id` field
91
+ * indicates which party is responsible for that payment category; `null` means
92
+ * responsibility defaults to the vendor.
93
+ */
94
+ export function useVendorsGetVendorPaymentResponsibilitySuspense(
95
+ request: operations.GetVendorPaymentResponsibilityRequest,
96
+ options?: SuspenseQueryHookOptions<
97
+ VendorsGetVendorPaymentResponsibilityQueryData,
98
+ VendorsGetVendorPaymentResponsibilityQueryError
99
+ >,
100
+ ): UseSuspenseQueryResult<
101
+ VendorsGetVendorPaymentResponsibilityQueryData,
102
+ VendorsGetVendorPaymentResponsibilityQueryError
103
+ > {
104
+ const client = useGreenSecurityContext();
105
+ return useSuspenseQuery({
106
+ ...buildVendorsGetVendorPaymentResponsibilityQuery(
107
+ client,
108
+ request,
109
+ options,
110
+ ),
111
+ ...options,
112
+ });
113
+ }
114
+
115
+ export function setVendorsGetVendorPaymentResponsibilityData(
116
+ client: QueryClient,
117
+ queryKeyBase: [vendorId: number],
118
+ data: VendorsGetVendorPaymentResponsibilityQueryData,
119
+ ): VendorsGetVendorPaymentResponsibilityQueryData | undefined {
120
+ const key = queryKeyVendorsGetVendorPaymentResponsibility(...queryKeyBase);
121
+
122
+ return client.setQueryData<VendorsGetVendorPaymentResponsibilityQueryData>(
123
+ key,
124
+ data,
125
+ );
126
+ }
127
+
128
+ export function invalidateVendorsGetVendorPaymentResponsibility(
129
+ client: QueryClient,
130
+ queryKeyBase: TupleToPrefixes<[vendorId: number]>,
131
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
132
+ ): Promise<void> {
133
+ return client.invalidateQueries({
134
+ ...filters,
135
+ queryKey: [
136
+ "@greensecurity/javascript-sdk",
137
+ "vendors",
138
+ "getVendorPaymentResponsibility",
139
+ ...queryKeyBase,
140
+ ],
141
+ });
142
+ }
143
+
144
+ export function invalidateAllVendorsGetVendorPaymentResponsibility(
145
+ client: QueryClient,
146
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
147
+ ): Promise<void> {
148
+ return client.invalidateQueries({
149
+ ...filters,
150
+ queryKey: [
151
+ "@greensecurity/javascript-sdk",
152
+ "vendors",
153
+ "getVendorPaymentResponsibility",
154
+ ],
155
+ });
156
+ }
@@ -49,7 +49,7 @@ export type VendorsUpdateVendorDetailsMutationError =
49
49
  * Update vendor details
50
50
  *
51
51
  * @remarks
52
- * It will update the vendor details
52
+ * Update an individual vendor's profile — title, location, supervisor, email preferences, primary department, and primary sales state. A company manager can also remove the vendor from their company by sending `company_id: null`.
53
53
  */
54
54
  export function useVendorsUpdateVendorDetailsMutation(
55
55
  options?: MutationHookOptions<