@greensecurity/javascript-sdk 0.37.1 → 0.37.5

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 (106) hide show
  1. package/README.md +3 -0
  2. package/bin/mcp-server.js +888 -738
  3. package/bin/mcp-server.js.map +11 -8
  4. package/dist/commonjs/__tests__/organizations.test.d.ts +2 -0
  5. package/dist/commonjs/__tests__/organizations.test.d.ts.map +1 -0
  6. package/dist/commonjs/__tests__/organizations.test.js +39 -0
  7. package/dist/commonjs/__tests__/organizations.test.js.map +1 -0
  8. package/dist/commonjs/__tests__/zones.test.js +13 -27
  9. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  10. package/dist/commonjs/funcs/organizationsListOrSearchDepartments.d.ts +21 -0
  11. package/dist/commonjs/funcs/organizationsListOrSearchDepartments.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/organizationsListOrSearchDepartments.js +163 -0
  13. package/dist/commonjs/funcs/organizationsListOrSearchDepartments.js.map +1 -0
  14. package/dist/commonjs/lib/config.d.ts +3 -3
  15. package/dist/commonjs/lib/config.js +3 -3
  16. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  17. package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
  18. package/dist/commonjs/mcp-server/server.js +3 -1
  19. package/dist/commonjs/mcp-server/server.js.map +1 -1
  20. package/dist/commonjs/mcp-server/tools/organizationsListOrSearchDepartments.d.ts +8 -0
  21. package/dist/commonjs/mcp-server/tools/organizationsListOrSearchDepartments.d.ts.map +1 -0
  22. package/dist/commonjs/mcp-server/tools/organizationsListOrSearchDepartments.js +64 -0
  23. package/dist/commonjs/mcp-server/tools/organizationsListOrSearchDepartments.js.map +1 -0
  24. package/dist/commonjs/models/operations/index.d.ts +1 -0
  25. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  26. package/dist/commonjs/models/operations/index.js +1 -0
  27. package/dist/commonjs/models/operations/index.js.map +1 -1
  28. package/dist/commonjs/models/operations/listorsearchdepartments.d.ts +116 -0
  29. package/dist/commonjs/models/operations/listorsearchdepartments.d.ts.map +1 -0
  30. package/dist/commonjs/models/operations/listorsearchdepartments.js +155 -0
  31. package/dist/commonjs/models/operations/listorsearchdepartments.js.map +1 -0
  32. package/dist/commonjs/models/operations/updatevendordetails.d.ts +5 -0
  33. package/dist/commonjs/models/operations/updatevendordetails.d.ts.map +1 -1
  34. package/dist/commonjs/models/operations/updatevendordetails.js +4 -0
  35. package/dist/commonjs/models/operations/updatevendordetails.js.map +1 -1
  36. package/dist/commonjs/react-query/index.d.ts +1 -0
  37. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  38. package/dist/commonjs/react-query/index.js +1 -0
  39. package/dist/commonjs/react-query/index.js.map +1 -1
  40. package/dist/commonjs/react-query/organizationsListOrSearchDepartments.d.ts +80 -0
  41. package/dist/commonjs/react-query/organizationsListOrSearchDepartments.d.ts.map +1 -0
  42. package/dist/commonjs/react-query/organizationsListOrSearchDepartments.js +162 -0
  43. package/dist/commonjs/react-query/organizationsListOrSearchDepartments.js.map +1 -0
  44. package/dist/commonjs/sdk/organizations.d.ts +9 -0
  45. package/dist/commonjs/sdk/organizations.d.ts.map +1 -1
  46. package/dist/commonjs/sdk/organizations.js +10 -0
  47. package/dist/commonjs/sdk/organizations.js.map +1 -1
  48. package/dist/esm/__tests__/organizations.test.d.ts +2 -0
  49. package/dist/esm/__tests__/organizations.test.d.ts.map +1 -0
  50. package/dist/esm/__tests__/organizations.test.js +37 -0
  51. package/dist/esm/__tests__/organizations.test.js.map +1 -0
  52. package/dist/esm/__tests__/zones.test.js +13 -27
  53. package/dist/esm/__tests__/zones.test.js.map +1 -1
  54. package/dist/esm/funcs/organizationsListOrSearchDepartments.d.ts +21 -0
  55. package/dist/esm/funcs/organizationsListOrSearchDepartments.d.ts.map +1 -0
  56. package/dist/esm/funcs/organizationsListOrSearchDepartments.js +127 -0
  57. package/dist/esm/funcs/organizationsListOrSearchDepartments.js.map +1 -0
  58. package/dist/esm/lib/config.d.ts +3 -3
  59. package/dist/esm/lib/config.js +3 -3
  60. package/dist/esm/mcp-server/mcp-server.js +1 -1
  61. package/dist/esm/mcp-server/server.d.ts.map +1 -1
  62. package/dist/esm/mcp-server/server.js +3 -1
  63. package/dist/esm/mcp-server/server.js.map +1 -1
  64. package/dist/esm/mcp-server/tools/organizationsListOrSearchDepartments.d.ts +8 -0
  65. package/dist/esm/mcp-server/tools/organizationsListOrSearchDepartments.d.ts.map +1 -0
  66. package/dist/esm/mcp-server/tools/organizationsListOrSearchDepartments.js +28 -0
  67. package/dist/esm/mcp-server/tools/organizationsListOrSearchDepartments.js.map +1 -0
  68. package/dist/esm/models/operations/index.d.ts +1 -0
  69. package/dist/esm/models/operations/index.d.ts.map +1 -1
  70. package/dist/esm/models/operations/index.js +1 -0
  71. package/dist/esm/models/operations/index.js.map +1 -1
  72. package/dist/esm/models/operations/listorsearchdepartments.d.ts +116 -0
  73. package/dist/esm/models/operations/listorsearchdepartments.d.ts.map +1 -0
  74. package/dist/esm/models/operations/listorsearchdepartments.js +113 -0
  75. package/dist/esm/models/operations/listorsearchdepartments.js.map +1 -0
  76. package/dist/esm/models/operations/updatevendordetails.d.ts +5 -0
  77. package/dist/esm/models/operations/updatevendordetails.d.ts.map +1 -1
  78. package/dist/esm/models/operations/updatevendordetails.js +4 -0
  79. package/dist/esm/models/operations/updatevendordetails.js.map +1 -1
  80. package/dist/esm/react-query/index.d.ts +1 -0
  81. package/dist/esm/react-query/index.d.ts.map +1 -1
  82. package/dist/esm/react-query/index.js +1 -0
  83. package/dist/esm/react-query/index.js.map +1 -1
  84. package/dist/esm/react-query/organizationsListOrSearchDepartments.d.ts +80 -0
  85. package/dist/esm/react-query/organizationsListOrSearchDepartments.d.ts.map +1 -0
  86. package/dist/esm/react-query/organizationsListOrSearchDepartments.js +149 -0
  87. package/dist/esm/react-query/organizationsListOrSearchDepartments.js.map +1 -0
  88. package/dist/esm/sdk/organizations.d.ts +9 -0
  89. package/dist/esm/sdk/organizations.d.ts.map +1 -1
  90. package/dist/esm/sdk/organizations.js +10 -0
  91. package/dist/esm/sdk/organizations.js.map +1 -1
  92. package/jsr.json +1 -1
  93. package/package.json +3 -3
  94. package/src/__tests__/organizations.test.ts +40 -0
  95. package/src/__tests__/zones.test.ts +13 -27
  96. package/src/funcs/organizationsListOrSearchDepartments.ts +256 -0
  97. package/src/lib/config.ts +3 -3
  98. package/src/mcp-server/mcp-server.ts +1 -1
  99. package/src/mcp-server/server.ts +3 -1
  100. package/src/mcp-server/tools/organizationsListOrSearchDepartments.ts +39 -0
  101. package/src/models/operations/index.ts +1 -0
  102. package/src/models/operations/listorsearchdepartments.ts +259 -0
  103. package/src/models/operations/updatevendordetails.ts +9 -0
  104. package/src/react-query/index.ts +1 -0
  105. package/src/react-query/organizationsListOrSearchDepartments.ts +354 -0
  106. package/src/sdk/organizations.ts +20 -0
@@ -30,6 +30,7 @@ export * from "./getvendorsdetails.js";
30
30
  export * from "./getwebhookendpoint.js";
31
31
  export * from "./listallwebhookendpoints.js";
32
32
  export * from "./listorsearchcompanies.js";
33
+ export * from "./listorsearchdepartments.js";
33
34
  export * from "./listorsearchfacilities.js";
34
35
  export * from "./listorsearchsecurityzones.js";
35
36
  export * from "./listorsearchsupportarticles.js";
@@ -0,0 +1,259 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
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 ListOrSearchDepartmentsRequest = {
13
+ /**
14
+ * The identifier of the object
15
+ */
16
+ id: number;
17
+ /**
18
+ * A comma-separated list of object attributes to sort on.
19
+ */
20
+ sort?: string | null | undefined;
21
+ /**
22
+ * Sort desc
23
+ */
24
+ desc?: components.Desc | undefined;
25
+ /**
26
+ * A 1-based offset for which page to request (defaults to 1)
27
+ */
28
+ page?: number | undefined;
29
+ /**
30
+ * Number of items to show in a given page
31
+ */
32
+ itemsPerPage?: number | undefined;
33
+ /**
34
+ * A partial string to search in the object name. Do not include any wildcard characters. Searches are not case-sensitive by default.
35
+ */
36
+ nameLike?: string | undefined;
37
+ };
38
+
39
+ /**
40
+ * The request was successful, and the server has returned the requested resource in the response body.
41
+ */
42
+ export type ListOrSearchDepartmentsResponseBody = {
43
+ /**
44
+ * Pagination information for a pageable list
45
+ */
46
+ pager: components.Pager;
47
+ items: Array<components.Department | null>;
48
+ };
49
+
50
+ export type ListOrSearchDepartmentsResponse = {
51
+ result: ListOrSearchDepartmentsResponseBody;
52
+ };
53
+
54
+ /** @internal */
55
+ export const ListOrSearchDepartmentsRequest$inboundSchema: z.ZodType<
56
+ ListOrSearchDepartmentsRequest,
57
+ z.ZodTypeDef,
58
+ unknown
59
+ > = z.object({
60
+ id: z.number().int(),
61
+ sort: z.nullable(z.string()).optional(),
62
+ desc: components.Desc$inboundSchema.optional(),
63
+ page: z.number().int().optional(),
64
+ items_per_page: z.number().int().optional(),
65
+ name_like: z.string().optional(),
66
+ }).transform((v) => {
67
+ return remap$(v, {
68
+ "items_per_page": "itemsPerPage",
69
+ "name_like": "nameLike",
70
+ });
71
+ });
72
+
73
+ /** @internal */
74
+ export type ListOrSearchDepartmentsRequest$Outbound = {
75
+ id: number;
76
+ sort?: string | null | undefined;
77
+ desc?: components.Desc$Outbound | undefined;
78
+ page?: number | undefined;
79
+ items_per_page?: number | undefined;
80
+ name_like?: string | undefined;
81
+ };
82
+
83
+ /** @internal */
84
+ export const ListOrSearchDepartmentsRequest$outboundSchema: z.ZodType<
85
+ ListOrSearchDepartmentsRequest$Outbound,
86
+ z.ZodTypeDef,
87
+ ListOrSearchDepartmentsRequest
88
+ > = z.object({
89
+ id: z.number().int(),
90
+ sort: z.nullable(z.string()).optional(),
91
+ desc: components.Desc$outboundSchema.optional(),
92
+ page: z.number().int().optional(),
93
+ itemsPerPage: z.number().int().optional(),
94
+ nameLike: z.string().optional(),
95
+ }).transform((v) => {
96
+ return remap$(v, {
97
+ itemsPerPage: "items_per_page",
98
+ nameLike: "name_like",
99
+ });
100
+ });
101
+
102
+ /**
103
+ * @internal
104
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
105
+ */
106
+ export namespace ListOrSearchDepartmentsRequest$ {
107
+ /** @deprecated use `ListOrSearchDepartmentsRequest$inboundSchema` instead. */
108
+ export const inboundSchema = ListOrSearchDepartmentsRequest$inboundSchema;
109
+ /** @deprecated use `ListOrSearchDepartmentsRequest$outboundSchema` instead. */
110
+ export const outboundSchema = ListOrSearchDepartmentsRequest$outboundSchema;
111
+ /** @deprecated use `ListOrSearchDepartmentsRequest$Outbound` instead. */
112
+ export type Outbound = ListOrSearchDepartmentsRequest$Outbound;
113
+ }
114
+
115
+ export function listOrSearchDepartmentsRequestToJSON(
116
+ listOrSearchDepartmentsRequest: ListOrSearchDepartmentsRequest,
117
+ ): string {
118
+ return JSON.stringify(
119
+ ListOrSearchDepartmentsRequest$outboundSchema.parse(
120
+ listOrSearchDepartmentsRequest,
121
+ ),
122
+ );
123
+ }
124
+
125
+ export function listOrSearchDepartmentsRequestFromJSON(
126
+ jsonString: string,
127
+ ): SafeParseResult<ListOrSearchDepartmentsRequest, SDKValidationError> {
128
+ return safeParse(
129
+ jsonString,
130
+ (x) => ListOrSearchDepartmentsRequest$inboundSchema.parse(JSON.parse(x)),
131
+ `Failed to parse 'ListOrSearchDepartmentsRequest' from JSON`,
132
+ );
133
+ }
134
+
135
+ /** @internal */
136
+ export const ListOrSearchDepartmentsResponseBody$inboundSchema: z.ZodType<
137
+ ListOrSearchDepartmentsResponseBody,
138
+ z.ZodTypeDef,
139
+ unknown
140
+ > = z.object({
141
+ pager: components.Pager$inboundSchema,
142
+ items: z.array(z.nullable(components.Department$inboundSchema)),
143
+ });
144
+
145
+ /** @internal */
146
+ export type ListOrSearchDepartmentsResponseBody$Outbound = {
147
+ pager: components.Pager$Outbound;
148
+ items: Array<components.Department$Outbound | null>;
149
+ };
150
+
151
+ /** @internal */
152
+ export const ListOrSearchDepartmentsResponseBody$outboundSchema: z.ZodType<
153
+ ListOrSearchDepartmentsResponseBody$Outbound,
154
+ z.ZodTypeDef,
155
+ ListOrSearchDepartmentsResponseBody
156
+ > = z.object({
157
+ pager: components.Pager$outboundSchema,
158
+ items: z.array(z.nullable(components.Department$outboundSchema)),
159
+ });
160
+
161
+ /**
162
+ * @internal
163
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
164
+ */
165
+ export namespace ListOrSearchDepartmentsResponseBody$ {
166
+ /** @deprecated use `ListOrSearchDepartmentsResponseBody$inboundSchema` instead. */
167
+ export const inboundSchema =
168
+ ListOrSearchDepartmentsResponseBody$inboundSchema;
169
+ /** @deprecated use `ListOrSearchDepartmentsResponseBody$outboundSchema` instead. */
170
+ export const outboundSchema =
171
+ ListOrSearchDepartmentsResponseBody$outboundSchema;
172
+ /** @deprecated use `ListOrSearchDepartmentsResponseBody$Outbound` instead. */
173
+ export type Outbound = ListOrSearchDepartmentsResponseBody$Outbound;
174
+ }
175
+
176
+ export function listOrSearchDepartmentsResponseBodyToJSON(
177
+ listOrSearchDepartmentsResponseBody: ListOrSearchDepartmentsResponseBody,
178
+ ): string {
179
+ return JSON.stringify(
180
+ ListOrSearchDepartmentsResponseBody$outboundSchema.parse(
181
+ listOrSearchDepartmentsResponseBody,
182
+ ),
183
+ );
184
+ }
185
+
186
+ export function listOrSearchDepartmentsResponseBodyFromJSON(
187
+ jsonString: string,
188
+ ): SafeParseResult<ListOrSearchDepartmentsResponseBody, SDKValidationError> {
189
+ return safeParse(
190
+ jsonString,
191
+ (x) =>
192
+ ListOrSearchDepartmentsResponseBody$inboundSchema.parse(JSON.parse(x)),
193
+ `Failed to parse 'ListOrSearchDepartmentsResponseBody' from JSON`,
194
+ );
195
+ }
196
+
197
+ /** @internal */
198
+ export const ListOrSearchDepartmentsResponse$inboundSchema: z.ZodType<
199
+ ListOrSearchDepartmentsResponse,
200
+ z.ZodTypeDef,
201
+ unknown
202
+ > = z.object({
203
+ Result: z.lazy(() => ListOrSearchDepartmentsResponseBody$inboundSchema),
204
+ }).transform((v) => {
205
+ return remap$(v, {
206
+ "Result": "result",
207
+ });
208
+ });
209
+
210
+ /** @internal */
211
+ export type ListOrSearchDepartmentsResponse$Outbound = {
212
+ Result: ListOrSearchDepartmentsResponseBody$Outbound;
213
+ };
214
+
215
+ /** @internal */
216
+ export const ListOrSearchDepartmentsResponse$outboundSchema: z.ZodType<
217
+ ListOrSearchDepartmentsResponse$Outbound,
218
+ z.ZodTypeDef,
219
+ ListOrSearchDepartmentsResponse
220
+ > = z.object({
221
+ result: z.lazy(() => ListOrSearchDepartmentsResponseBody$outboundSchema),
222
+ }).transform((v) => {
223
+ return remap$(v, {
224
+ result: "Result",
225
+ });
226
+ });
227
+
228
+ /**
229
+ * @internal
230
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
231
+ */
232
+ export namespace ListOrSearchDepartmentsResponse$ {
233
+ /** @deprecated use `ListOrSearchDepartmentsResponse$inboundSchema` instead. */
234
+ export const inboundSchema = ListOrSearchDepartmentsResponse$inboundSchema;
235
+ /** @deprecated use `ListOrSearchDepartmentsResponse$outboundSchema` instead. */
236
+ export const outboundSchema = ListOrSearchDepartmentsResponse$outboundSchema;
237
+ /** @deprecated use `ListOrSearchDepartmentsResponse$Outbound` instead. */
238
+ export type Outbound = ListOrSearchDepartmentsResponse$Outbound;
239
+ }
240
+
241
+ export function listOrSearchDepartmentsResponseToJSON(
242
+ listOrSearchDepartmentsResponse: ListOrSearchDepartmentsResponse,
243
+ ): string {
244
+ return JSON.stringify(
245
+ ListOrSearchDepartmentsResponse$outboundSchema.parse(
246
+ listOrSearchDepartmentsResponse,
247
+ ),
248
+ );
249
+ }
250
+
251
+ export function listOrSearchDepartmentsResponseFromJSON(
252
+ jsonString: string,
253
+ ): SafeParseResult<ListOrSearchDepartmentsResponse, SDKValidationError> {
254
+ return safeParse(
255
+ jsonString,
256
+ (x) => ListOrSearchDepartmentsResponse$inboundSchema.parse(JSON.parse(x)),
257
+ `Failed to parse 'ListOrSearchDepartmentsResponse' from JSON`,
258
+ );
259
+ }
@@ -49,6 +49,10 @@ export type UpdateVendorDetailsRequestBody = {
49
49
  * list of the vendor supervisor attributes
50
50
  */
51
51
  supervisor?: components.Supervisor | null | undefined;
52
+ /**
53
+ * The vendor's primary department id value to set
54
+ */
55
+ primaryDepartmentId?: number | undefined;
52
56
  };
53
57
 
54
58
  export type UpdateVendorDetailsRequest = {
@@ -92,11 +96,13 @@ export const UpdateVendorDetailsRequestBody$inboundSchema: z.ZodType<
92
96
  title: z.string().optional(),
93
97
  location: z.nullable(components.UserLocation$inboundSchema).optional(),
94
98
  supervisor: z.nullable(components.Supervisor$inboundSchema).optional(),
99
+ primary_department_id: z.number().int().optional(),
95
100
  }).transform((v) => {
96
101
  return remap$(v, {
97
102
  "qr_code": "qrCode",
98
103
  "email_recepient": "emailRecepient",
99
104
  "send_weekly_summary_email": "sendWeeklySummaryEmail",
105
+ "primary_department_id": "primaryDepartmentId",
100
106
  });
101
107
  });
102
108
 
@@ -108,6 +114,7 @@ export type UpdateVendorDetailsRequestBody$Outbound = {
108
114
  title?: string | undefined;
109
115
  location?: components.UserLocation$Outbound | null | undefined;
110
116
  supervisor?: components.Supervisor$Outbound | null | undefined;
117
+ primary_department_id?: number | undefined;
111
118
  };
112
119
 
113
120
  /** @internal */
@@ -122,11 +129,13 @@ export const UpdateVendorDetailsRequestBody$outboundSchema: z.ZodType<
122
129
  title: z.string().optional(),
123
130
  location: z.nullable(components.UserLocation$outboundSchema).optional(),
124
131
  supervisor: z.nullable(components.Supervisor$outboundSchema).optional(),
132
+ primaryDepartmentId: z.number().int().optional(),
125
133
  }).transform((v) => {
126
134
  return remap$(v, {
127
135
  qrCode: "qr_code",
128
136
  emailRecepient: "email_recepient",
129
137
  sendWeeklySummaryEmail: "send_weekly_summary_email",
138
+ primaryDepartmentId: "primary_department_id",
130
139
  });
131
140
  });
132
141
 
@@ -13,6 +13,7 @@ export * from "./invoicesCreateInvoice.js";
13
13
  export * from "./invoicesMakePayment.js";
14
14
  export * from "./invoicesUpdateInvoice.js";
15
15
  export * from "./organizationsGetFacility.js";
16
+ export * from "./organizationsListOrSearchDepartments.js";
16
17
  export * from "./organizationsListOrSearchFacilities.js";
17
18
  export * from "./supportArticlesGetSupportArticle.js";
18
19
  export * from "./supportArticlesListOrSearchSupportArticles.js";
@@ -0,0 +1,354 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ InfiniteData,
7
+ InvalidateQueryFilters,
8
+ QueryClient,
9
+ QueryFunctionContext,
10
+ QueryKey,
11
+ useInfiniteQuery,
12
+ UseInfiniteQueryResult,
13
+ useQuery,
14
+ UseQueryResult,
15
+ useSuspenseInfiniteQuery,
16
+ UseSuspenseInfiniteQueryResult,
17
+ useSuspenseQuery,
18
+ UseSuspenseQueryResult,
19
+ } from "@tanstack/react-query";
20
+ import { GreenSecurityCore } from "../core.js";
21
+ import { organizationsListOrSearchDepartments } from "../funcs/organizationsListOrSearchDepartments.js";
22
+ import { combineSignals } from "../lib/primitives.js";
23
+ import { RequestOptions } from "../lib/sdks.js";
24
+ import * as components from "../models/components/index.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { unwrapAsync } from "../types/fp.js";
27
+ import { PageIterator, unwrapResultIterator } from "../types/operations.js";
28
+ import { useGreenSecurityContext } from "./_context.js";
29
+ import {
30
+ InfiniteQueryHookOptions,
31
+ QueryHookOptions,
32
+ SuspenseInfiniteQueryHookOptions,
33
+ SuspenseQueryHookOptions,
34
+ TupleToPrefixes,
35
+ } from "./_types.js";
36
+
37
+ export type OrganizationsListOrSearchDepartmentsQueryData =
38
+ operations.ListOrSearchDepartmentsResponse;
39
+
40
+ export type OrganizationsListOrSearchDepartmentsInfiniteQueryData =
41
+ PageIterator<operations.ListOrSearchDepartmentsResponse, { page: number }>;
42
+
43
+ export type OrganizationsListOrSearchDepartmentsPageParams = PageIterator<
44
+ operations.ListOrSearchDepartmentsResponse,
45
+ { page: number }
46
+ >["~next"];
47
+
48
+ /**
49
+ * List or search departments
50
+ *
51
+ * @remarks
52
+ * List or search departments.
53
+ */
54
+ export function useOrganizationsListOrSearchDepartments(
55
+ request: operations.ListOrSearchDepartmentsRequest,
56
+ options?: QueryHookOptions<OrganizationsListOrSearchDepartmentsQueryData>,
57
+ ): UseQueryResult<OrganizationsListOrSearchDepartmentsQueryData, Error> {
58
+ const client = useGreenSecurityContext();
59
+ return useQuery({
60
+ ...buildOrganizationsListOrSearchDepartmentsQuery(
61
+ client,
62
+ request,
63
+ options,
64
+ ),
65
+ ...options,
66
+ });
67
+ }
68
+
69
+ /**
70
+ * List or search departments
71
+ *
72
+ * @remarks
73
+ * List or search departments.
74
+ */
75
+ export function useOrganizationsListOrSearchDepartmentsSuspense(
76
+ request: operations.ListOrSearchDepartmentsRequest,
77
+ options?: SuspenseQueryHookOptions<
78
+ OrganizationsListOrSearchDepartmentsQueryData
79
+ >,
80
+ ): UseSuspenseQueryResult<
81
+ OrganizationsListOrSearchDepartmentsQueryData,
82
+ Error
83
+ > {
84
+ const client = useGreenSecurityContext();
85
+ return useSuspenseQuery({
86
+ ...buildOrganizationsListOrSearchDepartmentsQuery(
87
+ client,
88
+ request,
89
+ options,
90
+ ),
91
+ ...options,
92
+ });
93
+ }
94
+
95
+ /**
96
+ * List or search departments
97
+ *
98
+ * @remarks
99
+ * List or search departments.
100
+ */
101
+ export function useOrganizationsListOrSearchDepartmentsInfinite(
102
+ request: operations.ListOrSearchDepartmentsRequest,
103
+ options?: InfiniteQueryHookOptions<
104
+ OrganizationsListOrSearchDepartmentsInfiniteQueryData
105
+ >,
106
+ ): UseInfiniteQueryResult<
107
+ InfiniteData<
108
+ OrganizationsListOrSearchDepartmentsInfiniteQueryData,
109
+ OrganizationsListOrSearchDepartmentsPageParams
110
+ >,
111
+ Error
112
+ > {
113
+ const client = useGreenSecurityContext();
114
+ return useInfiniteQuery<
115
+ OrganizationsListOrSearchDepartmentsInfiniteQueryData,
116
+ Error,
117
+ InfiniteData<
118
+ OrganizationsListOrSearchDepartmentsInfiniteQueryData,
119
+ OrganizationsListOrSearchDepartmentsPageParams
120
+ >,
121
+ QueryKey,
122
+ OrganizationsListOrSearchDepartmentsPageParams
123
+ >({
124
+ ...buildOrganizationsListOrSearchDepartmentsInfiniteQuery(
125
+ client,
126
+ request,
127
+ options,
128
+ ),
129
+ initialPageParam: options?.initialPageParam,
130
+ getNextPageParam: (previousPage) => previousPage["~next"],
131
+ ...options,
132
+ });
133
+ }
134
+
135
+ /**
136
+ * List or search departments
137
+ *
138
+ * @remarks
139
+ * List or search departments.
140
+ */
141
+ export function useOrganizationsListOrSearchDepartmentsInfiniteSuspense(
142
+ request: operations.ListOrSearchDepartmentsRequest,
143
+ options?: SuspenseInfiniteQueryHookOptions<
144
+ OrganizationsListOrSearchDepartmentsInfiniteQueryData
145
+ >,
146
+ ): UseSuspenseInfiniteQueryResult<
147
+ InfiniteData<
148
+ OrganizationsListOrSearchDepartmentsInfiniteQueryData,
149
+ OrganizationsListOrSearchDepartmentsPageParams
150
+ >,
151
+ Error
152
+ > {
153
+ const client = useGreenSecurityContext();
154
+ return useSuspenseInfiniteQuery<
155
+ OrganizationsListOrSearchDepartmentsInfiniteQueryData,
156
+ Error,
157
+ InfiniteData<
158
+ OrganizationsListOrSearchDepartmentsInfiniteQueryData,
159
+ OrganizationsListOrSearchDepartmentsPageParams
160
+ >,
161
+ QueryKey,
162
+ OrganizationsListOrSearchDepartmentsPageParams
163
+ >({
164
+ ...buildOrganizationsListOrSearchDepartmentsInfiniteQuery(
165
+ client,
166
+ request,
167
+ options,
168
+ ),
169
+ initialPageParam: options?.initialPageParam,
170
+ getNextPageParam: (previousPage) => previousPage["~next"],
171
+ ...options,
172
+ });
173
+ }
174
+
175
+ export function prefetchOrganizationsListOrSearchDepartments(
176
+ queryClient: QueryClient,
177
+ client$: GreenSecurityCore,
178
+ request: operations.ListOrSearchDepartmentsRequest,
179
+ ): Promise<void> {
180
+ return queryClient.prefetchQuery({
181
+ ...buildOrganizationsListOrSearchDepartmentsQuery(
182
+ client$,
183
+ request,
184
+ ),
185
+ });
186
+ }
187
+
188
+ export function setOrganizationsListOrSearchDepartmentsData(
189
+ client: QueryClient,
190
+ queryKeyBase: [
191
+ id: number,
192
+ parameters: {
193
+ sort?: string | null | undefined;
194
+ desc?: components.Desc | undefined;
195
+ page?: number | undefined;
196
+ itemsPerPage?: number | undefined;
197
+ nameLike?: string | undefined;
198
+ },
199
+ ],
200
+ data: OrganizationsListOrSearchDepartmentsQueryData,
201
+ ): OrganizationsListOrSearchDepartmentsQueryData | undefined {
202
+ const key = queryKeyOrganizationsListOrSearchDepartments(...queryKeyBase);
203
+
204
+ return client.setQueryData<OrganizationsListOrSearchDepartmentsQueryData>(
205
+ key,
206
+ data,
207
+ );
208
+ }
209
+
210
+ export function invalidateOrganizationsListOrSearchDepartments(
211
+ client: QueryClient,
212
+ queryKeyBase: TupleToPrefixes<
213
+ [
214
+ id: number,
215
+ parameters: {
216
+ sort?: string | null | undefined;
217
+ desc?: components.Desc | undefined;
218
+ page?: number | undefined;
219
+ itemsPerPage?: number | undefined;
220
+ nameLike?: string | undefined;
221
+ },
222
+ ]
223
+ >,
224
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
225
+ ): Promise<void> {
226
+ return client.invalidateQueries({
227
+ ...filters,
228
+ queryKey: [
229
+ "@greensecurity/javascript-sdk",
230
+ "organizations",
231
+ "listOrSearchDepartments",
232
+ ...queryKeyBase,
233
+ ],
234
+ });
235
+ }
236
+
237
+ export function invalidateAllOrganizationsListOrSearchDepartments(
238
+ client: QueryClient,
239
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
240
+ ): Promise<void> {
241
+ return client.invalidateQueries({
242
+ ...filters,
243
+ queryKey: [
244
+ "@greensecurity/javascript-sdk",
245
+ "organizations",
246
+ "listOrSearchDepartments",
247
+ ],
248
+ });
249
+ }
250
+
251
+ export function buildOrganizationsListOrSearchDepartmentsQuery(
252
+ client$: GreenSecurityCore,
253
+ request: operations.ListOrSearchDepartmentsRequest,
254
+ options?: RequestOptions,
255
+ ): {
256
+ queryKey: QueryKey;
257
+ queryFn: (
258
+ context: QueryFunctionContext,
259
+ ) => Promise<OrganizationsListOrSearchDepartmentsQueryData>;
260
+ } {
261
+ return {
262
+ queryKey: queryKeyOrganizationsListOrSearchDepartments(request.id, {
263
+ sort: request.sort,
264
+ desc: request.desc,
265
+ page: request.page,
266
+ itemsPerPage: request.itemsPerPage,
267
+ nameLike: request.nameLike,
268
+ }),
269
+ queryFn: async function organizationsListOrSearchDepartmentsQueryFn(
270
+ ctx,
271
+ ): Promise<OrganizationsListOrSearchDepartmentsQueryData> {
272
+ const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
273
+ const mergedOptions = {
274
+ ...options,
275
+ fetchOptions: { ...options?.fetchOptions, signal: sig },
276
+ };
277
+
278
+ return unwrapAsync(organizationsListOrSearchDepartments(
279
+ client$,
280
+ request,
281
+ mergedOptions,
282
+ ));
283
+ },
284
+ };
285
+ }
286
+
287
+ export function buildOrganizationsListOrSearchDepartmentsInfiniteQuery(
288
+ client$: GreenSecurityCore,
289
+ request: operations.ListOrSearchDepartmentsRequest,
290
+ options?: RequestOptions,
291
+ ): {
292
+ queryKey: QueryKey;
293
+ queryFn: (
294
+ context: QueryFunctionContext<
295
+ QueryKey,
296
+ OrganizationsListOrSearchDepartmentsPageParams
297
+ >,
298
+ ) => Promise<OrganizationsListOrSearchDepartmentsInfiniteQueryData>;
299
+ } {
300
+ return {
301
+ queryKey: queryKeyOrganizationsListOrSearchDepartments(request.id, {
302
+ sort: request.sort,
303
+ desc: request.desc,
304
+ page: request.page,
305
+ itemsPerPage: request.itemsPerPage,
306
+ nameLike: request.nameLike,
307
+ }),
308
+ queryFn: async function organizationsListOrSearchDepartmentsQuery(
309
+ ctx,
310
+ ): Promise<OrganizationsListOrSearchDepartmentsInfiniteQueryData> {
311
+ const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
312
+ const mergedOptions = {
313
+ ...options,
314
+ fetchOptions: { ...options?.fetchOptions, signal: sig },
315
+ };
316
+
317
+ if (!ctx.pageParam) {
318
+ return unwrapResultIterator(organizationsListOrSearchDepartments(
319
+ client$,
320
+ request,
321
+ mergedOptions,
322
+ ));
323
+ }
324
+
325
+ return unwrapResultIterator(organizationsListOrSearchDepartments(
326
+ client$,
327
+ {
328
+ ...request,
329
+ page: ctx.pageParam.page,
330
+ },
331
+ mergedOptions,
332
+ ));
333
+ },
334
+ };
335
+ }
336
+
337
+ export function queryKeyOrganizationsListOrSearchDepartments(
338
+ id: number,
339
+ parameters: {
340
+ sort?: string | null | undefined;
341
+ desc?: components.Desc | undefined;
342
+ page?: number | undefined;
343
+ itemsPerPage?: number | undefined;
344
+ nameLike?: string | undefined;
345
+ },
346
+ ): QueryKey {
347
+ return [
348
+ "@greensecurity/javascript-sdk",
349
+ "organizations",
350
+ "listOrSearchDepartments",
351
+ id,
352
+ parameters,
353
+ ];
354
+ }
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { organizationsGetFacility } from "../funcs/organizationsGetFacility.js";
6
+ import { organizationsListOrSearchDepartments } from "../funcs/organizationsListOrSearchDepartments.js";
6
7
  import { organizationsListOrSearchFacilities } from "../funcs/organizationsListOrSearchFacilities.js";
7
8
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
8
9
  import * as components from "../models/components/index.js";
@@ -59,4 +60,23 @@ export class Organizations extends ClientSDK {
59
60
  options,
60
61
  ));
61
62
  }
63
+
64
+ /**
65
+ * List or search departments
66
+ *
67
+ * @remarks
68
+ * List or search departments.
69
+ */
70
+ async listOrSearchDepartments(
71
+ request: operations.ListOrSearchDepartmentsRequest,
72
+ options?: RequestOptions,
73
+ ): Promise<
74
+ PageIterator<operations.ListOrSearchDepartmentsResponse, { page: number }>
75
+ > {
76
+ return unwrapResultIterator(organizationsListOrSearchDepartments(
77
+ this,
78
+ request,
79
+ options,
80
+ ));
81
+ }
62
82
  }