@greensecurity/javascript-sdk 0.44.0-beta.1 → 0.44.0-beta.3

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 (144) hide show
  1. package/README.md +3 -0
  2. package/dist/commonjs/__tests__/companies.test.js +34 -0
  3. package/dist/commonjs/__tests__/companies.test.js.map +1 -1
  4. package/dist/commonjs/__tests__/zones.test.js +6 -27
  5. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  6. package/dist/commonjs/funcs/companiesListCompanyCredits.d.ts +23 -0
  7. package/dist/commonjs/funcs/companiesListCompanyCredits.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/companiesListCompanyCredits.js +167 -0
  9. package/dist/commonjs/funcs/companiesListCompanyCredits.js.map +1 -0
  10. package/dist/commonjs/funcs/usersGetCurrentUser.d.ts +1 -0
  11. package/dist/commonjs/funcs/usersGetCurrentUser.d.ts.map +1 -1
  12. package/dist/commonjs/funcs/usersGetCurrentUser.js +1 -0
  13. package/dist/commonjs/funcs/usersGetCurrentUser.js.map +1 -1
  14. package/dist/commonjs/lib/config.d.ts +3 -3
  15. package/dist/commonjs/lib/config.js +3 -3
  16. package/dist/commonjs/models/components/expand.d.ts +2 -0
  17. package/dist/commonjs/models/components/expand.d.ts.map +1 -1
  18. package/dist/commonjs/models/components/expand.js +2 -0
  19. package/dist/commonjs/models/components/expand.js.map +1 -1
  20. package/dist/commonjs/models/components/paymentprofile.d.ts +8 -8
  21. package/dist/commonjs/models/components/paymentprofile.d.ts.map +1 -1
  22. package/dist/commonjs/models/components/paymentprofile.js +12 -13
  23. package/dist/commonjs/models/components/paymentprofile.js.map +1 -1
  24. package/dist/commonjs/models/components/userdetails.d.ts +36 -0
  25. package/dist/commonjs/models/components/userdetails.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/userdetails.js +50 -1
  27. package/dist/commonjs/models/components/userdetails.js.map +1 -1
  28. package/dist/commonjs/models/components/zone.d.ts +5 -5
  29. package/dist/commonjs/models/components/zone.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/zone.js +10 -8
  31. package/dist/commonjs/models/components/zone.js.map +1 -1
  32. package/dist/commonjs/models/operations/index.d.ts +1 -0
  33. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  34. package/dist/commonjs/models/operations/index.js +1 -0
  35. package/dist/commonjs/models/operations/index.js.map +1 -1
  36. package/dist/commonjs/models/operations/listcompanycredits.d.ts +127 -0
  37. package/dist/commonjs/models/operations/listcompanycredits.d.ts.map +1 -0
  38. package/dist/commonjs/models/operations/listcompanycredits.js +128 -0
  39. package/dist/commonjs/models/operations/listcompanycredits.js.map +1 -0
  40. package/dist/commonjs/react-query/companiesListCompanyCredits.core.d.ts +38 -0
  41. package/dist/commonjs/react-query/companiesListCompanyCredits.core.d.ts.map +1 -0
  42. package/dist/commonjs/react-query/companiesListCompanyCredits.core.js +95 -0
  43. package/dist/commonjs/react-query/companiesListCompanyCredits.core.js.map +1 -0
  44. package/dist/commonjs/react-query/companiesListCompanyCredits.d.ts +62 -0
  45. package/dist/commonjs/react-query/companiesListCompanyCredits.d.ts.map +1 -0
  46. package/dist/commonjs/react-query/companiesListCompanyCredits.js +104 -0
  47. package/dist/commonjs/react-query/companiesListCompanyCredits.js.map +1 -0
  48. package/dist/commonjs/react-query/index.d.ts +1 -0
  49. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  50. package/dist/commonjs/react-query/index.js +1 -0
  51. package/dist/commonjs/react-query/index.js.map +1 -1
  52. package/dist/commonjs/react-query/usersGetCurrentUser.d.ts +2 -0
  53. package/dist/commonjs/react-query/usersGetCurrentUser.d.ts.map +1 -1
  54. package/dist/commonjs/react-query/usersGetCurrentUser.js +2 -0
  55. package/dist/commonjs/react-query/usersGetCurrentUser.js.map +1 -1
  56. package/dist/commonjs/sdk/companies.d.ts +9 -0
  57. package/dist/commonjs/sdk/companies.d.ts.map +1 -1
  58. package/dist/commonjs/sdk/companies.js +10 -0
  59. package/dist/commonjs/sdk/companies.js.map +1 -1
  60. package/dist/commonjs/sdk/users.d.ts +1 -0
  61. package/dist/commonjs/sdk/users.d.ts.map +1 -1
  62. package/dist/commonjs/sdk/users.js +1 -0
  63. package/dist/commonjs/sdk/users.js.map +1 -1
  64. package/dist/esm/__tests__/companies.test.js +34 -0
  65. package/dist/esm/__tests__/companies.test.js.map +1 -1
  66. package/dist/esm/__tests__/zones.test.js +6 -27
  67. package/dist/esm/__tests__/zones.test.js.map +1 -1
  68. package/dist/esm/funcs/companiesListCompanyCredits.d.ts +23 -0
  69. package/dist/esm/funcs/companiesListCompanyCredits.d.ts.map +1 -0
  70. package/dist/esm/funcs/companiesListCompanyCredits.js +131 -0
  71. package/dist/esm/funcs/companiesListCompanyCredits.js.map +1 -0
  72. package/dist/esm/funcs/usersGetCurrentUser.d.ts +1 -0
  73. package/dist/esm/funcs/usersGetCurrentUser.d.ts.map +1 -1
  74. package/dist/esm/funcs/usersGetCurrentUser.js +1 -0
  75. package/dist/esm/funcs/usersGetCurrentUser.js.map +1 -1
  76. package/dist/esm/lib/config.d.ts +3 -3
  77. package/dist/esm/lib/config.js +3 -3
  78. package/dist/esm/models/components/expand.d.ts +2 -0
  79. package/dist/esm/models/components/expand.d.ts.map +1 -1
  80. package/dist/esm/models/components/expand.js +2 -0
  81. package/dist/esm/models/components/expand.js.map +1 -1
  82. package/dist/esm/models/components/paymentprofile.d.ts +8 -8
  83. package/dist/esm/models/components/paymentprofile.d.ts.map +1 -1
  84. package/dist/esm/models/components/paymentprofile.js +9 -10
  85. package/dist/esm/models/components/paymentprofile.js.map +1 -1
  86. package/dist/esm/models/components/userdetails.d.ts +36 -0
  87. package/dist/esm/models/components/userdetails.d.ts.map +1 -1
  88. package/dist/esm/models/components/userdetails.js +45 -0
  89. package/dist/esm/models/components/userdetails.js.map +1 -1
  90. package/dist/esm/models/components/zone.d.ts +5 -5
  91. package/dist/esm/models/components/zone.d.ts.map +1 -1
  92. package/dist/esm/models/components/zone.js +8 -6
  93. package/dist/esm/models/components/zone.js.map +1 -1
  94. package/dist/esm/models/operations/index.d.ts +1 -0
  95. package/dist/esm/models/operations/index.d.ts.map +1 -1
  96. package/dist/esm/models/operations/index.js +1 -0
  97. package/dist/esm/models/operations/index.js.map +1 -1
  98. package/dist/esm/models/operations/listcompanycredits.d.ts +127 -0
  99. package/dist/esm/models/operations/listcompanycredits.d.ts.map +1 -0
  100. package/dist/esm/models/operations/listcompanycredits.js +88 -0
  101. package/dist/esm/models/operations/listcompanycredits.js.map +1 -0
  102. package/dist/esm/react-query/companiesListCompanyCredits.core.d.ts +38 -0
  103. package/dist/esm/react-query/companiesListCompanyCredits.core.d.ts.map +1 -0
  104. package/dist/esm/react-query/companiesListCompanyCredits.core.js +87 -0
  105. package/dist/esm/react-query/companiesListCompanyCredits.core.js.map +1 -0
  106. package/dist/esm/react-query/companiesListCompanyCredits.d.ts +62 -0
  107. package/dist/esm/react-query/companiesListCompanyCredits.d.ts.map +1 -0
  108. package/dist/esm/react-query/companiesListCompanyCredits.js +89 -0
  109. package/dist/esm/react-query/companiesListCompanyCredits.js.map +1 -0
  110. package/dist/esm/react-query/index.d.ts +1 -0
  111. package/dist/esm/react-query/index.d.ts.map +1 -1
  112. package/dist/esm/react-query/index.js +1 -0
  113. package/dist/esm/react-query/index.js.map +1 -1
  114. package/dist/esm/react-query/usersGetCurrentUser.d.ts +2 -0
  115. package/dist/esm/react-query/usersGetCurrentUser.d.ts.map +1 -1
  116. package/dist/esm/react-query/usersGetCurrentUser.js +2 -0
  117. package/dist/esm/react-query/usersGetCurrentUser.js.map +1 -1
  118. package/dist/esm/sdk/companies.d.ts +9 -0
  119. package/dist/esm/sdk/companies.d.ts.map +1 -1
  120. package/dist/esm/sdk/companies.js +10 -0
  121. package/dist/esm/sdk/companies.js.map +1 -1
  122. package/dist/esm/sdk/users.d.ts +1 -0
  123. package/dist/esm/sdk/users.d.ts.map +1 -1
  124. package/dist/esm/sdk/users.js +1 -0
  125. package/dist/esm/sdk/users.js.map +1 -1
  126. package/jsr.json +1 -1
  127. package/package.json +1 -1
  128. package/src/__tests__/companies.test.ts +37 -0
  129. package/src/__tests__/zones.test.ts +6 -27
  130. package/src/funcs/companiesListCompanyCredits.ts +261 -0
  131. package/src/funcs/usersGetCurrentUser.ts +1 -0
  132. package/src/lib/config.ts +3 -3
  133. package/src/models/components/expand.ts +2 -0
  134. package/src/models/components/paymentprofile.ts +22 -19
  135. package/src/models/components/userdetails.ts +116 -0
  136. package/src/models/components/zone.ts +20 -14
  137. package/src/models/operations/index.ts +1 -0
  138. package/src/models/operations/listcompanycredits.ts +233 -0
  139. package/src/react-query/companiesListCompanyCredits.core.ts +197 -0
  140. package/src/react-query/companiesListCompanyCredits.ts +268 -0
  141. package/src/react-query/index.ts +1 -0
  142. package/src/react-query/usersGetCurrentUser.ts +2 -0
  143. package/src/sdk/companies.ts +20 -0
  144. package/src/sdk/users.ts +1 -0
@@ -0,0 +1,233 @@
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 * as openEnums from "../../types/enums.js";
9
+ import { ClosedEnum, OpenEnum } from "../../types/enums.js";
10
+ import { Result as SafeParseResult } from "../../types/fp.js";
11
+ import * as types from "../../types/primitives.js";
12
+ import * as components from "../components/index.js";
13
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
14
+
15
+ /**
16
+ * Field to sort results by.
17
+ */
18
+ export const QueryParamSort = {
19
+ Id: "id",
20
+ Date: "date",
21
+ Action: "action",
22
+ Amount: "amount",
23
+ FromCompanyId: "from_company_id",
24
+ ToCompanyId: "to_company_id",
25
+ } as const;
26
+ /**
27
+ * Field to sort results by.
28
+ */
29
+ export type QueryParamSort = ClosedEnum<typeof QueryParamSort>;
30
+
31
+ export type ListCompanyCreditsRequest = {
32
+ /**
33
+ * The identifier of the object
34
+ */
35
+ id: number;
36
+ /**
37
+ * Field to sort results by.
38
+ */
39
+ sort?: QueryParamSort | undefined;
40
+ /**
41
+ * Sort desc
42
+ */
43
+ desc?: components.Desc | undefined;
44
+ /**
45
+ * A 1-based offset for which page to request (defaults to 1)
46
+ */
47
+ page?: number | undefined;
48
+ /**
49
+ * Number of items to show in a given page
50
+ */
51
+ itemsPerPage?: number | undefined;
52
+ /**
53
+ * 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.
54
+ */
55
+ expand?: Array<components.Expand> | undefined;
56
+ };
57
+
58
+ export const Action = {
59
+ Credit: "credit",
60
+ Debit: "debit",
61
+ Transfer: "transfer",
62
+ } as const;
63
+ export type Action = OpenEnum<typeof Action>;
64
+
65
+ export type ListCompanyCreditsItems = {
66
+ id?: number | undefined;
67
+ date?: string | null | undefined;
68
+ action?: Action | undefined;
69
+ amount?: number | undefined;
70
+ balance?: number | undefined;
71
+ from?: string | null | undefined;
72
+ to?: string | null | undefined;
73
+ invoiceNumber?: string | null | undefined;
74
+ /**
75
+ * Expanded entity payload when `expand=entity` is requested.
76
+ */
77
+ entity?: { [k: string]: any } | undefined;
78
+ /**
79
+ * Expanded source entity payload when `expand=from_entity` is requested.
80
+ */
81
+ fromEntity?: { [k: string]: any } | undefined;
82
+ /**
83
+ * Expanded destination entity payload when `expand=to_entity` is requested.
84
+ */
85
+ toEntity?: { [k: string]: any } | undefined;
86
+ };
87
+
88
+ /**
89
+ * The request was successful, and the server has returned the requested resource in the response body.
90
+ *
91
+ * @remarks
92
+ *
93
+ * Available `expand` scopes are:
94
+ *
95
+ * - entity
96
+ * - from_entity
97
+ * - to_entity
98
+ */
99
+ export type ListCompanyCreditsListCompanyCreditsOk = {
100
+ /**
101
+ * Pagination information for a pageable list
102
+ */
103
+ pager: components.Pager;
104
+ items: Array<ListCompanyCreditsItems>;
105
+ };
106
+
107
+ export type ListCompanyCreditsResponse = {
108
+ result: ListCompanyCreditsListCompanyCreditsOk;
109
+ };
110
+
111
+ /** @internal */
112
+ export const QueryParamSort$outboundSchema: z.ZodNativeEnum<
113
+ typeof QueryParamSort
114
+ > = z.nativeEnum(QueryParamSort);
115
+
116
+ /** @internal */
117
+ export type ListCompanyCreditsRequest$Outbound = {
118
+ id: number;
119
+ sort?: string | undefined;
120
+ desc?: components.Desc$Outbound | undefined;
121
+ page?: number | undefined;
122
+ items_per_page?: number | undefined;
123
+ expand?: Array<string> | undefined;
124
+ };
125
+
126
+ /** @internal */
127
+ export const ListCompanyCreditsRequest$outboundSchema: z.ZodType<
128
+ ListCompanyCreditsRequest$Outbound,
129
+ z.ZodTypeDef,
130
+ ListCompanyCreditsRequest
131
+ > = z.object({
132
+ id: z.number().int(),
133
+ sort: QueryParamSort$outboundSchema.optional(),
134
+ desc: components.Desc$outboundSchema.optional(),
135
+ page: z.number().int().optional(),
136
+ itemsPerPage: z.number().int().optional(),
137
+ expand: z.array(components.Expand$outboundSchema).optional(),
138
+ }).transform((v) => {
139
+ return remap$(v, {
140
+ itemsPerPage: "items_per_page",
141
+ });
142
+ });
143
+
144
+ export function listCompanyCreditsRequestToJSON(
145
+ listCompanyCreditsRequest: ListCompanyCreditsRequest,
146
+ ): string {
147
+ return JSON.stringify(
148
+ ListCompanyCreditsRequest$outboundSchema.parse(listCompanyCreditsRequest),
149
+ );
150
+ }
151
+
152
+ /** @internal */
153
+ export const Action$inboundSchema: z.ZodType<Action, z.ZodTypeDef, unknown> =
154
+ openEnums.inboundSchema(Action);
155
+
156
+ /** @internal */
157
+ export const ListCompanyCreditsItems$inboundSchema: z.ZodType<
158
+ ListCompanyCreditsItems,
159
+ z.ZodTypeDef,
160
+ unknown
161
+ > = z.object({
162
+ id: types.optional(types.number()),
163
+ date: z.nullable(types.string()).optional(),
164
+ action: types.optional(Action$inboundSchema),
165
+ amount: types.optional(types.number()),
166
+ balance: types.optional(types.number()),
167
+ from: z.nullable(types.string()).optional(),
168
+ to: z.nullable(types.string()).optional(),
169
+ invoice_number: z.nullable(types.string()).optional(),
170
+ entity: types.optional(z.record(z.any())),
171
+ from_entity: types.optional(z.record(z.any())),
172
+ to_entity: types.optional(z.record(z.any())),
173
+ }).transform((v) => {
174
+ return remap$(v, {
175
+ "invoice_number": "invoiceNumber",
176
+ "from_entity": "fromEntity",
177
+ "to_entity": "toEntity",
178
+ });
179
+ });
180
+
181
+ export function listCompanyCreditsItemsFromJSON(
182
+ jsonString: string,
183
+ ): SafeParseResult<ListCompanyCreditsItems, SDKValidationError> {
184
+ return safeParse(
185
+ jsonString,
186
+ (x) => ListCompanyCreditsItems$inboundSchema.parse(JSON.parse(x)),
187
+ `Failed to parse 'ListCompanyCreditsItems' from JSON`,
188
+ );
189
+ }
190
+
191
+ /** @internal */
192
+ export const ListCompanyCreditsListCompanyCreditsOk$inboundSchema: z.ZodType<
193
+ ListCompanyCreditsListCompanyCreditsOk,
194
+ z.ZodTypeDef,
195
+ unknown
196
+ > = z.object({
197
+ pager: components.Pager$inboundSchema,
198
+ items: z.array(z.lazy(() => ListCompanyCreditsItems$inboundSchema)),
199
+ });
200
+
201
+ export function listCompanyCreditsListCompanyCreditsOkFromJSON(
202
+ jsonString: string,
203
+ ): SafeParseResult<ListCompanyCreditsListCompanyCreditsOk, SDKValidationError> {
204
+ return safeParse(
205
+ jsonString,
206
+ (x) =>
207
+ ListCompanyCreditsListCompanyCreditsOk$inboundSchema.parse(JSON.parse(x)),
208
+ `Failed to parse 'ListCompanyCreditsListCompanyCreditsOk' from JSON`,
209
+ );
210
+ }
211
+
212
+ /** @internal */
213
+ export const ListCompanyCreditsResponse$inboundSchema: z.ZodType<
214
+ ListCompanyCreditsResponse,
215
+ z.ZodTypeDef,
216
+ unknown
217
+ > = z.object({
218
+ Result: z.lazy(() => ListCompanyCreditsListCompanyCreditsOk$inboundSchema),
219
+ }).transform((v) => {
220
+ return remap$(v, {
221
+ "Result": "result",
222
+ });
223
+ });
224
+
225
+ export function listCompanyCreditsResponseFromJSON(
226
+ jsonString: string,
227
+ ): SafeParseResult<ListCompanyCreditsResponse, SDKValidationError> {
228
+ return safeParse(
229
+ jsonString,
230
+ (x) => ListCompanyCreditsResponse$inboundSchema.parse(JSON.parse(x)),
231
+ `Failed to parse 'ListCompanyCreditsResponse' from JSON`,
232
+ );
233
+ }
@@ -0,0 +1,197 @@
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 { companiesListCompanyCredits } from "../funcs/companiesListCompanyCredits.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import * as components from "../models/components/index.js";
15
+ import * as operations from "../models/operations/index.js";
16
+ import { unwrapAsync } from "../types/fp.js";
17
+ import { PageIterator, unwrapResultIterator } from "../types/operations.js";
18
+ import { pageIteratorToJSON } from "./_types.js";
19
+ export type CompaniesListCompanyCreditsQueryData =
20
+ operations.ListCompanyCreditsResponse;
21
+
22
+ export type CompaniesListCompanyCreditsInfiniteQueryData = PageIterator<
23
+ operations.ListCompanyCreditsResponse,
24
+ { page: number }
25
+ >;
26
+
27
+ export type CompaniesListCompanyCreditsPageParams = PageIterator<
28
+ operations.ListCompanyCreditsResponse,
29
+ { page: number }
30
+ >["~next"];
31
+
32
+ export function prefetchCompaniesListCompanyCredits(
33
+ queryClient: QueryClient,
34
+ client$: GreenSecurityCore,
35
+ request: operations.ListCompanyCreditsRequest,
36
+ options?: RequestOptions,
37
+ ): Promise<void> {
38
+ return queryClient.prefetchQuery({
39
+ ...buildCompaniesListCompanyCreditsQuery(
40
+ client$,
41
+ request,
42
+ options,
43
+ ),
44
+ });
45
+ }
46
+
47
+ export function prefetchCompaniesListCompanyCreditsInfinite(
48
+ queryClient: QueryClient,
49
+ client$: GreenSecurityCore,
50
+ request: operations.ListCompanyCreditsRequest,
51
+ options?: RequestOptions,
52
+ ): Promise<void> {
53
+ return queryClient.prefetchInfiniteQuery({
54
+ ...buildCompaniesListCompanyCreditsInfiniteQuery(
55
+ client$,
56
+ request,
57
+ options,
58
+ ),
59
+ initialPageParam: undefined as CompaniesListCompanyCreditsPageParams,
60
+ getNextPageParam: (
61
+ previousPage: CompaniesListCompanyCreditsInfiniteQueryData,
62
+ ) => previousPage["~next"],
63
+ });
64
+ }
65
+
66
+ export function buildCompaniesListCompanyCreditsQuery(
67
+ client$: GreenSecurityCore,
68
+ request: operations.ListCompanyCreditsRequest,
69
+ options?: RequestOptions,
70
+ ): {
71
+ queryKey: QueryKey;
72
+ queryFn: (
73
+ context: QueryFunctionContext,
74
+ ) => Promise<CompaniesListCompanyCreditsQueryData>;
75
+ } {
76
+ return {
77
+ queryKey: queryKeyCompaniesListCompanyCredits(request.id, {
78
+ sort: request.sort,
79
+ desc: request.desc,
80
+ page: request.page,
81
+ itemsPerPage: request.itemsPerPage,
82
+ expand: request.expand,
83
+ }),
84
+ queryFn: async function companiesListCompanyCreditsQueryFn(
85
+ ctx,
86
+ ): Promise<CompaniesListCompanyCreditsQueryData> {
87
+ const sig = combineSignals(
88
+ ctx.signal,
89
+ options?.signal,
90
+ options?.fetchOptions?.signal,
91
+ );
92
+ const mergedOptions = {
93
+ ...options?.fetchOptions,
94
+ ...options,
95
+ signal: sig,
96
+ };
97
+
98
+ return unwrapAsync(companiesListCompanyCredits(
99
+ client$,
100
+ request,
101
+ mergedOptions,
102
+ ));
103
+ },
104
+ };
105
+ }
106
+
107
+ export function buildCompaniesListCompanyCreditsInfiniteQuery(
108
+ client$: GreenSecurityCore,
109
+ request: operations.ListCompanyCreditsRequest,
110
+ options?: RequestOptions,
111
+ ): {
112
+ queryKey: QueryKey;
113
+ queryFn: (
114
+ context: QueryFunctionContext<
115
+ QueryKey,
116
+ CompaniesListCompanyCreditsPageParams
117
+ >,
118
+ ) => Promise<CompaniesListCompanyCreditsInfiniteQueryData>;
119
+ } {
120
+ return {
121
+ queryKey: queryKeyCompaniesListCompanyCreditsInfinite(request.id, {
122
+ sort: request.sort,
123
+ desc: request.desc,
124
+ page: request.page,
125
+ itemsPerPage: request.itemsPerPage,
126
+ expand: request.expand,
127
+ }),
128
+ queryFn: async function companiesListCompanyCreditsQuery(
129
+ ctx,
130
+ ): Promise<CompaniesListCompanyCreditsInfiniteQueryData> {
131
+ const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
132
+ const mergedOptions = {
133
+ ...options,
134
+ fetchOptions: { ...options?.fetchOptions, signal: sig },
135
+ };
136
+
137
+ if (!ctx.pageParam) {
138
+ const pageResult = await unwrapResultIterator(
139
+ companiesListCompanyCredits(
140
+ client$,
141
+ request,
142
+ mergedOptions,
143
+ ),
144
+ );
145
+ return pageIteratorToJSON(pageResult);
146
+ }
147
+ const pageResult = await unwrapResultIterator(companiesListCompanyCredits(
148
+ client$,
149
+ {
150
+ ...request,
151
+ page: ctx.pageParam.page,
152
+ },
153
+ mergedOptions,
154
+ ));
155
+ return pageIteratorToJSON(pageResult);
156
+ },
157
+ };
158
+ }
159
+
160
+ export function queryKeyCompaniesListCompanyCredits(
161
+ id: number,
162
+ parameters: {
163
+ sort?: operations.QueryParamSort | undefined;
164
+ desc?: components.Desc | undefined;
165
+ page?: number | undefined;
166
+ itemsPerPage?: number | undefined;
167
+ expand?: Array<components.Expand> | undefined;
168
+ },
169
+ ): QueryKey {
170
+ return [
171
+ "@greensecurity/javascript-sdk",
172
+ "companies",
173
+ "listCompanyCredits",
174
+ id,
175
+ parameters,
176
+ ];
177
+ }
178
+
179
+ export function queryKeyCompaniesListCompanyCreditsInfinite(
180
+ id: number,
181
+ parameters: {
182
+ sort?: operations.QueryParamSort | undefined;
183
+ desc?: components.Desc | undefined;
184
+ page?: number | undefined;
185
+ itemsPerPage?: number | undefined;
186
+ expand?: Array<components.Expand> | undefined;
187
+ },
188
+ ): QueryKey {
189
+ return [
190
+ "@greensecurity/javascript-sdk",
191
+ "companies",
192
+ "listCompanyCredits",
193
+ "infinite",
194
+ id,
195
+ parameters,
196
+ ];
197
+ }
@@ -0,0 +1,268 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ InfiniteData,
7
+ InvalidateQueryFilters,
8
+ QueryClient,
9
+ QueryKey,
10
+ useInfiniteQuery,
11
+ UseInfiniteQueryResult,
12
+ useQuery,
13
+ UseQueryResult,
14
+ useSuspenseInfiniteQuery,
15
+ UseSuspenseInfiniteQueryResult,
16
+ useSuspenseQuery,
17
+ UseSuspenseQueryResult,
18
+ } from "@tanstack/react-query";
19
+ import * as components from "../models/components/index.js";
20
+ import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
21
+ import {
22
+ ConnectionError,
23
+ InvalidRequestError,
24
+ RequestAbortedError,
25
+ RequestTimeoutError,
26
+ UnexpectedClientError,
27
+ } from "../models/errors/httpclienterrors.js";
28
+ import * as errors from "../models/errors/index.js";
29
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
30
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
31
+ import * as operations from "../models/operations/index.js";
32
+ import { useGreenSecurityContext } from "./_context.js";
33
+ import {
34
+ InfiniteQueryHookOptions,
35
+ QueryHookOptions,
36
+ SuspenseInfiniteQueryHookOptions,
37
+ SuspenseQueryHookOptions,
38
+ TupleToPrefixes,
39
+ } from "./_types.js";
40
+ import {
41
+ buildCompaniesListCompanyCreditsInfiniteQuery,
42
+ buildCompaniesListCompanyCreditsQuery,
43
+ CompaniesListCompanyCreditsInfiniteQueryData,
44
+ CompaniesListCompanyCreditsPageParams,
45
+ CompaniesListCompanyCreditsQueryData,
46
+ prefetchCompaniesListCompanyCredits,
47
+ prefetchCompaniesListCompanyCreditsInfinite,
48
+ queryKeyCompaniesListCompanyCredits,
49
+ queryKeyCompaniesListCompanyCreditsInfinite,
50
+ } from "./companiesListCompanyCredits.core.js";
51
+ export {
52
+ buildCompaniesListCompanyCreditsInfiniteQuery,
53
+ buildCompaniesListCompanyCreditsQuery,
54
+ type CompaniesListCompanyCreditsInfiniteQueryData,
55
+ type CompaniesListCompanyCreditsPageParams,
56
+ type CompaniesListCompanyCreditsQueryData,
57
+ prefetchCompaniesListCompanyCredits,
58
+ prefetchCompaniesListCompanyCreditsInfinite,
59
+ queryKeyCompaniesListCompanyCredits,
60
+ queryKeyCompaniesListCompanyCreditsInfinite,
61
+ };
62
+
63
+ export type CompaniesListCompanyCreditsQueryError =
64
+ | errors.ApiErrorResponse
65
+ | GreenSecurityError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError;
73
+
74
+ /**
75
+ * List credits related to a company
76
+ *
77
+ * @remarks
78
+ * Returns a paginated list of credits associated with the specified company, including incoming and outgoing transactions.
79
+ */
80
+ export function useCompaniesListCompanyCredits(
81
+ request: operations.ListCompanyCreditsRequest,
82
+ options?: QueryHookOptions<
83
+ CompaniesListCompanyCreditsQueryData,
84
+ CompaniesListCompanyCreditsQueryError
85
+ >,
86
+ ): UseQueryResult<
87
+ CompaniesListCompanyCreditsQueryData,
88
+ CompaniesListCompanyCreditsQueryError
89
+ > {
90
+ const client = useGreenSecurityContext();
91
+ return useQuery({
92
+ ...buildCompaniesListCompanyCreditsQuery(
93
+ client,
94
+ request,
95
+ options,
96
+ ),
97
+ ...options,
98
+ });
99
+ }
100
+
101
+ /**
102
+ * List credits related to a company
103
+ *
104
+ * @remarks
105
+ * Returns a paginated list of credits associated with the specified company, including incoming and outgoing transactions.
106
+ */
107
+ export function useCompaniesListCompanyCreditsSuspense(
108
+ request: operations.ListCompanyCreditsRequest,
109
+ options?: SuspenseQueryHookOptions<
110
+ CompaniesListCompanyCreditsQueryData,
111
+ CompaniesListCompanyCreditsQueryError
112
+ >,
113
+ ): UseSuspenseQueryResult<
114
+ CompaniesListCompanyCreditsQueryData,
115
+ CompaniesListCompanyCreditsQueryError
116
+ > {
117
+ const client = useGreenSecurityContext();
118
+ return useSuspenseQuery({
119
+ ...buildCompaniesListCompanyCreditsQuery(
120
+ client,
121
+ request,
122
+ options,
123
+ ),
124
+ ...options,
125
+ });
126
+ }
127
+
128
+ /**
129
+ * List credits related to a company
130
+ *
131
+ * @remarks
132
+ * Returns a paginated list of credits associated with the specified company, including incoming and outgoing transactions.
133
+ */
134
+ export function useCompaniesListCompanyCreditsInfinite(
135
+ request: operations.ListCompanyCreditsRequest,
136
+ options?: InfiniteQueryHookOptions<
137
+ CompaniesListCompanyCreditsInfiniteQueryData,
138
+ CompaniesListCompanyCreditsQueryError
139
+ >,
140
+ ): UseInfiniteQueryResult<
141
+ InfiniteData<
142
+ CompaniesListCompanyCreditsInfiniteQueryData,
143
+ CompaniesListCompanyCreditsPageParams
144
+ >,
145
+ CompaniesListCompanyCreditsQueryError
146
+ > {
147
+ const client = useGreenSecurityContext();
148
+ return useInfiniteQuery<
149
+ CompaniesListCompanyCreditsInfiniteQueryData,
150
+ CompaniesListCompanyCreditsQueryError,
151
+ InfiniteData<
152
+ CompaniesListCompanyCreditsInfiniteQueryData,
153
+ CompaniesListCompanyCreditsPageParams
154
+ >,
155
+ QueryKey,
156
+ CompaniesListCompanyCreditsPageParams
157
+ >({
158
+ ...buildCompaniesListCompanyCreditsInfiniteQuery(
159
+ client,
160
+ request,
161
+ options,
162
+ ),
163
+ initialPageParam: options?.initialPageParam,
164
+ getNextPageParam: (previousPage) => previousPage["~next"],
165
+ ...options,
166
+ });
167
+ }
168
+
169
+ /**
170
+ * List credits related to a company
171
+ *
172
+ * @remarks
173
+ * Returns a paginated list of credits associated with the specified company, including incoming and outgoing transactions.
174
+ */
175
+ export function useCompaniesListCompanyCreditsInfiniteSuspense(
176
+ request: operations.ListCompanyCreditsRequest,
177
+ options?: SuspenseInfiniteQueryHookOptions<
178
+ CompaniesListCompanyCreditsInfiniteQueryData,
179
+ CompaniesListCompanyCreditsQueryError
180
+ >,
181
+ ): UseSuspenseInfiniteQueryResult<
182
+ InfiniteData<
183
+ CompaniesListCompanyCreditsInfiniteQueryData,
184
+ CompaniesListCompanyCreditsPageParams
185
+ >,
186
+ CompaniesListCompanyCreditsQueryError
187
+ > {
188
+ const client = useGreenSecurityContext();
189
+ return useSuspenseInfiniteQuery<
190
+ CompaniesListCompanyCreditsInfiniteQueryData,
191
+ CompaniesListCompanyCreditsQueryError,
192
+ InfiniteData<
193
+ CompaniesListCompanyCreditsInfiniteQueryData,
194
+ CompaniesListCompanyCreditsPageParams
195
+ >,
196
+ QueryKey,
197
+ CompaniesListCompanyCreditsPageParams
198
+ >({
199
+ ...buildCompaniesListCompanyCreditsInfiniteQuery(
200
+ client,
201
+ request,
202
+ options,
203
+ ),
204
+ initialPageParam: options?.initialPageParam,
205
+ getNextPageParam: (previousPage) => previousPage["~next"],
206
+ ...options,
207
+ });
208
+ }
209
+
210
+ export function setCompaniesListCompanyCreditsData(
211
+ client: QueryClient,
212
+ queryKeyBase: [
213
+ id: number,
214
+ parameters: {
215
+ sort?: operations.QueryParamSort | undefined;
216
+ desc?: components.Desc | undefined;
217
+ page?: number | undefined;
218
+ itemsPerPage?: number | undefined;
219
+ expand?: Array<components.Expand> | undefined;
220
+ },
221
+ ],
222
+ data: CompaniesListCompanyCreditsQueryData,
223
+ ): CompaniesListCompanyCreditsQueryData | undefined {
224
+ const key = queryKeyCompaniesListCompanyCredits(...queryKeyBase);
225
+
226
+ return client.setQueryData<CompaniesListCompanyCreditsQueryData>(key, data);
227
+ }
228
+
229
+ export function invalidateCompaniesListCompanyCredits(
230
+ client: QueryClient,
231
+ queryKeyBase: TupleToPrefixes<
232
+ [
233
+ id: number,
234
+ parameters: {
235
+ sort?: operations.QueryParamSort | undefined;
236
+ desc?: components.Desc | undefined;
237
+ page?: number | undefined;
238
+ itemsPerPage?: number | undefined;
239
+ expand?: Array<components.Expand> | undefined;
240
+ },
241
+ ]
242
+ >,
243
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
244
+ ): Promise<void> {
245
+ return client.invalidateQueries({
246
+ ...filters,
247
+ queryKey: [
248
+ "@greensecurity/javascript-sdk",
249
+ "companies",
250
+ "listCompanyCredits",
251
+ ...queryKeyBase,
252
+ ],
253
+ });
254
+ }
255
+
256
+ export function invalidateAllCompaniesListCompanyCredits(
257
+ client: QueryClient,
258
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
259
+ ): Promise<void> {
260
+ return client.invalidateQueries({
261
+ ...filters,
262
+ queryKey: [
263
+ "@greensecurity/javascript-sdk",
264
+ "companies",
265
+ "listCompanyCredits",
266
+ ],
267
+ });
268
+ }
@@ -9,6 +9,7 @@ export * from "./alertsListAlerts.js";
9
9
  export * from "./alertsUpdateUserAlerts.js";
10
10
  export * from "./companiesAddCompanyManager.js";
11
11
  export * from "./companiesGetCompany.js";
12
+ export * from "./companiesListCompanyCredits.js";
12
13
  export * from "./companiesListCompanyManagers.js";
13
14
  export * from "./companiesListOrSearchCompanies.js";
14
15
  export * from "./companiesLookupCompanies.js";