@greensecurity/javascript-sdk 0.43.1-beta.100 → 0.43.1-beta.104

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 (90) hide show
  1. package/README.md +3 -0
  2. package/dist/commonjs/__tests__/invoices.test.js +18 -0
  3. package/dist/commonjs/__tests__/invoices.test.js.map +1 -1
  4. package/dist/commonjs/__tests__/zones.test.js +10 -12
  5. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  6. package/dist/commonjs/funcs/invoicesGetInvoicesExportStatus.d.ts +19 -0
  7. package/dist/commonjs/funcs/invoicesGetInvoicesExportStatus.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/invoicesGetInvoicesExportStatus.js +123 -0
  9. package/dist/commonjs/funcs/invoicesGetInvoicesExportStatus.js.map +1 -0
  10. package/dist/commonjs/lib/config.d.ts +3 -3
  11. package/dist/commonjs/lib/config.js +3 -3
  12. package/dist/commonjs/lib/config.js.map +1 -1
  13. package/dist/commonjs/lib/encodings.d.ts.map +1 -1
  14. package/dist/commonjs/lib/encodings.js +20 -5
  15. package/dist/commonjs/lib/encodings.js.map +1 -1
  16. package/dist/commonjs/models/operations/getinvoicesexportstatus.d.ts +49 -0
  17. package/dist/commonjs/models/operations/getinvoicesexportstatus.d.ts.map +1 -0
  18. package/dist/commonjs/models/operations/getinvoicesexportstatus.js +72 -0
  19. package/dist/commonjs/models/operations/getinvoicesexportstatus.js.map +1 -0
  20. package/dist/commonjs/models/operations/index.d.ts +1 -0
  21. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  22. package/dist/commonjs/models/operations/index.js +1 -0
  23. package/dist/commonjs/models/operations/index.js.map +1 -1
  24. package/dist/commonjs/react-query/index.d.ts +1 -0
  25. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  26. package/dist/commonjs/react-query/index.js +1 -0
  27. package/dist/commonjs/react-query/index.js.map +1 -1
  28. package/dist/commonjs/react-query/invoicesGetInvoicesExportStatus.core.d.ts +12 -0
  29. package/dist/commonjs/react-query/invoicesGetInvoicesExportStatus.core.d.ts.map +1 -0
  30. package/dist/commonjs/react-query/invoicesGetInvoicesExportStatus.core.js +39 -0
  31. package/dist/commonjs/react-query/invoicesGetInvoicesExportStatus.core.js.map +1 -0
  32. package/dist/commonjs/react-query/invoicesGetInvoicesExportStatus.d.ts +31 -0
  33. package/dist/commonjs/react-query/invoicesGetInvoicesExportStatus.d.ts.map +1 -0
  34. package/dist/commonjs/react-query/invoicesGetInvoicesExportStatus.js +71 -0
  35. package/dist/commonjs/react-query/invoicesGetInvoicesExportStatus.js.map +1 -0
  36. package/dist/commonjs/sdk/invoices.d.ts +8 -0
  37. package/dist/commonjs/sdk/invoices.d.ts.map +1 -1
  38. package/dist/commonjs/sdk/invoices.js +11 -0
  39. package/dist/commonjs/sdk/invoices.js.map +1 -1
  40. package/dist/esm/__tests__/invoices.test.js +18 -0
  41. package/dist/esm/__tests__/invoices.test.js.map +1 -1
  42. package/dist/esm/__tests__/zones.test.js +10 -12
  43. package/dist/esm/__tests__/zones.test.js.map +1 -1
  44. package/dist/esm/funcs/invoicesGetInvoicesExportStatus.d.ts +19 -0
  45. package/dist/esm/funcs/invoicesGetInvoicesExportStatus.d.ts.map +1 -0
  46. package/dist/esm/funcs/invoicesGetInvoicesExportStatus.js +87 -0
  47. package/dist/esm/funcs/invoicesGetInvoicesExportStatus.js.map +1 -0
  48. package/dist/esm/lib/config.d.ts +3 -3
  49. package/dist/esm/lib/config.js +3 -3
  50. package/dist/esm/lib/config.js.map +1 -1
  51. package/dist/esm/lib/encodings.d.ts.map +1 -1
  52. package/dist/esm/lib/encodings.js +20 -5
  53. package/dist/esm/lib/encodings.js.map +1 -1
  54. package/dist/esm/models/operations/getinvoicesexportstatus.d.ts +49 -0
  55. package/dist/esm/models/operations/getinvoicesexportstatus.d.ts.map +1 -0
  56. package/dist/esm/models/operations/getinvoicesexportstatus.js +34 -0
  57. package/dist/esm/models/operations/getinvoicesexportstatus.js.map +1 -0
  58. package/dist/esm/models/operations/index.d.ts +1 -0
  59. package/dist/esm/models/operations/index.d.ts.map +1 -1
  60. package/dist/esm/models/operations/index.js +1 -0
  61. package/dist/esm/models/operations/index.js.map +1 -1
  62. package/dist/esm/react-query/index.d.ts +1 -0
  63. package/dist/esm/react-query/index.d.ts.map +1 -1
  64. package/dist/esm/react-query/index.js +1 -0
  65. package/dist/esm/react-query/index.js.map +1 -1
  66. package/dist/esm/react-query/invoicesGetInvoicesExportStatus.core.d.ts +12 -0
  67. package/dist/esm/react-query/invoicesGetInvoicesExportStatus.core.d.ts.map +1 -0
  68. package/dist/esm/react-query/invoicesGetInvoicesExportStatus.core.js +34 -0
  69. package/dist/esm/react-query/invoicesGetInvoicesExportStatus.core.js.map +1 -0
  70. package/dist/esm/react-query/invoicesGetInvoicesExportStatus.d.ts +31 -0
  71. package/dist/esm/react-query/invoicesGetInvoicesExportStatus.d.ts.map +1 -0
  72. package/dist/esm/react-query/invoicesGetInvoicesExportStatus.js +61 -0
  73. package/dist/esm/react-query/invoicesGetInvoicesExportStatus.js.map +1 -0
  74. package/dist/esm/sdk/invoices.d.ts +8 -0
  75. package/dist/esm/sdk/invoices.d.ts.map +1 -1
  76. package/dist/esm/sdk/invoices.js +11 -0
  77. package/dist/esm/sdk/invoices.js.map +1 -1
  78. package/jsr.json +1 -1
  79. package/package.json +1 -1
  80. package/src/__tests__/invoices.test.ts +21 -0
  81. package/src/__tests__/zones.test.ts +10 -12
  82. package/src/funcs/invoicesGetInvoicesExportStatus.ts +175 -0
  83. package/src/lib/config.ts +3 -3
  84. package/src/lib/encodings.ts +23 -4
  85. package/src/models/operations/getinvoicesexportstatus.ts +103 -0
  86. package/src/models/operations/index.ts +1 -0
  87. package/src/react-query/index.ts +1 -0
  88. package/src/react-query/invoicesGetInvoicesExportStatus.core.ts +76 -0
  89. package/src/react-query/invoicesGetInvoicesExportStatus.ts +152 -0
  90. package/src/sdk/invoices.ts +19 -0
@@ -35,27 +35,27 @@ test("Zones List Or Search Security Zones", async () => {
35
35
  useUrlParams: false,
36
36
  },
37
37
  items: [
38
+ {
39
+ facility: {},
40
+ },
38
41
  {
39
42
  facility: {
40
43
  contacts: {
41
44
  contact: {
42
- status: "Active",
43
- department: null,
44
- },
45
- adminContact: {
46
45
  status: "Deleted",
47
46
  department: null,
48
47
  },
48
+ adminContact: null,
49
49
  techContact: {
50
- status: "Inactive",
50
+ status: "Deleted",
51
51
  department: 123,
52
52
  },
53
53
  greenSecurityCsm: {
54
54
  status: "Inactive",
55
- department: 123,
55
+ department: null,
56
56
  },
57
57
  accountManager: {
58
- status: "Active",
58
+ status: "Inactive",
59
59
  department: 123,
60
60
  },
61
61
  },
@@ -66,9 +66,6 @@ test("Zones List Or Search Security Zones", async () => {
66
66
  },
67
67
  },
68
68
  },
69
- {
70
- facility: {},
71
- },
72
69
  ],
73
70
  });
74
71
  });
@@ -85,8 +82,9 @@ test("Zones Security Zone Checkin", async () => {
85
82
  });
86
83
 
87
84
  const result = await greenSecurity.zones.securityZoneCheckin({
88
- qrCode: "<value>",
89
- zoneId: 130889,
85
+ longitude: 1088.53,
86
+ latitude: 6020.88,
87
+ zoneId: 654096,
90
88
  });
91
89
  expect(result).toBeDefined();
92
90
  expect(result).toEqual({});
@@ -0,0 +1,175 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { GreenSecurityCore } from "../core.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
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 { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Get invoice export status
30
+ *
31
+ * @remarks
32
+ * Poll the status of an asynchronous invoice export job. When `ready` is true,
33
+ * the export is complete and can be downloaded via the download endpoint.
34
+ */
35
+ export function invoicesGetInvoicesExportStatus(
36
+ client: GreenSecurityCore,
37
+ request: operations.GetInvoicesExportStatusRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ operations.GetInvoicesExportStatusResponseBody,
42
+ | errors.ApiErrorResponse
43
+ | GreenSecurityError
44
+ | ResponseValidationError
45
+ | ConnectionError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | InvalidRequestError
49
+ | UnexpectedClientError
50
+ | SDKValidationError
51
+ >
52
+ > {
53
+ return new APIPromise($do(
54
+ client,
55
+ request,
56
+ options,
57
+ ));
58
+ }
59
+
60
+ async function $do(
61
+ client: GreenSecurityCore,
62
+ request: operations.GetInvoicesExportStatusRequest,
63
+ options?: RequestOptions,
64
+ ): Promise<
65
+ [
66
+ Result<
67
+ operations.GetInvoicesExportStatusResponseBody,
68
+ | errors.ApiErrorResponse
69
+ | GreenSecurityError
70
+ | ResponseValidationError
71
+ | ConnectionError
72
+ | RequestAbortedError
73
+ | RequestTimeoutError
74
+ | InvalidRequestError
75
+ | UnexpectedClientError
76
+ | SDKValidationError
77
+ >,
78
+ APICall,
79
+ ]
80
+ > {
81
+ const parsed = safeParse(
82
+ request,
83
+ (value) =>
84
+ operations.GetInvoicesExportStatusRequest$outboundSchema.parse(value),
85
+ "Input validation failed",
86
+ );
87
+ if (!parsed.ok) {
88
+ return [parsed, { status: "invalid" }];
89
+ }
90
+ const payload = parsed.value;
91
+ const body = null;
92
+
93
+ const pathParams = {
94
+ id: encodeSimple("id", payload.id, {
95
+ explode: false,
96
+ charEncoding: "percent",
97
+ }),
98
+ };
99
+ const path = pathToFunc("/invoices/export/status/{id}")(pathParams);
100
+
101
+ const headers = new Headers(compactMap({
102
+ Accept: "application/json",
103
+ }));
104
+
105
+ const securityInput = await extractSecurity(client._options.security);
106
+ const requestSecurity = resolveGlobalSecurity(securityInput);
107
+
108
+ const context = {
109
+ options: client._options,
110
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
111
+ operationID: "getInvoicesExportStatus",
112
+ oAuth2Scopes: null,
113
+
114
+ resolvedSecurity: requestSecurity,
115
+
116
+ securitySource: client._options.security,
117
+ retryConfig: options?.retries
118
+ || client._options.retryConfig
119
+ || { strategy: "none" },
120
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
121
+ };
122
+
123
+ const requestRes = client._createRequest(context, {
124
+ security: requestSecurity,
125
+ method: "GET",
126
+ baseURL: options?.serverURL,
127
+ path: path,
128
+ headers: headers,
129
+ body: body,
130
+ userAgent: client._options.userAgent,
131
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
132
+ }, options);
133
+ if (!requestRes.ok) {
134
+ return [requestRes, { status: "invalid" }];
135
+ }
136
+ const req = requestRes.value;
137
+
138
+ const doResult = await client._do(req, {
139
+ context,
140
+ errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
141
+ retryConfig: context.retryConfig,
142
+ retryCodes: context.retryCodes,
143
+ });
144
+ if (!doResult.ok) {
145
+ return [doResult, { status: "request-error", request: req }];
146
+ }
147
+ const response = doResult.value;
148
+
149
+ const responseFields = {
150
+ HttpMeta: { Response: response, Request: req },
151
+ };
152
+
153
+ const [result] = await M.match<
154
+ operations.GetInvoicesExportStatusResponseBody,
155
+ | errors.ApiErrorResponse
156
+ | GreenSecurityError
157
+ | ResponseValidationError
158
+ | ConnectionError
159
+ | RequestAbortedError
160
+ | RequestTimeoutError
161
+ | InvalidRequestError
162
+ | UnexpectedClientError
163
+ | SDKValidationError
164
+ >(
165
+ M.json(200, operations.GetInvoicesExportStatusResponseBody$inboundSchema),
166
+ M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
167
+ M.fail("4XX"),
168
+ M.fail([500, "5XX"]),
169
+ )(response, req, { extraFields: responseFields });
170
+ if (!result.ok) {
171
+ return [result, { status: "complete", request: req, response }];
172
+ }
173
+
174
+ return [result, { status: "complete", request: req, response }];
175
+ }
package/src/lib/config.ts CHANGED
@@ -80,8 +80,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
80
80
  export const SDK_METADATA = {
81
81
  language: "typescript",
82
82
  openapiDocVersion: "0.0.11",
83
- sdkVersion: "0.43.1-beta.98",
84
- genVersion: "2.869.10",
83
+ sdkVersion: "0.43.1-beta.102",
84
+ genVersion: "2.869.23",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.43.1-beta.98 2.869.10 0.0.11 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.43.1-beta.102 2.869.23 0.0.11 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -479,6 +479,23 @@ export const encodeSpaceDelimitedQuery = queryEncoder(encodeSpaceDelimited);
479
479
  export const encodePipeDelimitedQuery = queryEncoder(encodePipeDelimited);
480
480
  export const encodeDeepObjectQuery = queryEncoder(encodeDeepObject);
481
481
 
482
+ function isBlobLike(val: unknown): val is Blob {
483
+ if (val instanceof Blob) {
484
+ return true;
485
+ }
486
+
487
+ if (typeof val !== "object" || val == null || !(Symbol.toStringTag in val)) {
488
+ return false;
489
+ }
490
+
491
+ const tag = val[Symbol.toStringTag];
492
+ if (tag !== "Blob" && tag !== "File") {
493
+ return false;
494
+ }
495
+
496
+ return "stream" in val && typeof val.stream === "function";
497
+ }
498
+
482
499
  export function appendForm(
483
500
  fd: FormData,
484
501
  key: string,
@@ -487,10 +504,12 @@ export function appendForm(
487
504
  ): void {
488
505
  if (value == null) {
489
506
  return;
490
- } else if (value instanceof Blob && fileName) {
491
- fd.append(key, value, fileName);
492
- } else if (value instanceof Blob) {
493
- fd.append(key, value);
507
+ } else if (isBlobLike(value)) {
508
+ if (fileName) {
509
+ fd.append(key, value as Blob, fileName);
510
+ } else {
511
+ fd.append(key, value as Blob);
512
+ }
494
513
  } else {
495
514
  fd.append(key, String(value));
496
515
  }
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ export type GetInvoicesExportStatusRequest = {
13
+ /**
14
+ * Export status id returned by the export invoice endpoint.
15
+ */
16
+ id: string;
17
+ };
18
+
19
+ /**
20
+ * Export status
21
+ */
22
+ export type GetInvoicesExportStatusResponseBody = {
23
+ /**
24
+ * When true, the export is ready for download.
25
+ */
26
+ ready: boolean;
27
+ /**
28
+ * The export job identifier.
29
+ */
30
+ statusId: string;
31
+ /**
32
+ * URL to download the CSV (present only when ready is true).
33
+ */
34
+ downloadUrl?: string | undefined;
35
+ /**
36
+ * When the export job completed.
37
+ */
38
+ finishedAt?: string | undefined;
39
+ /**
40
+ * When the export job started.
41
+ */
42
+ startedAt?: string | undefined;
43
+ /**
44
+ * Error message if the export failed.
45
+ */
46
+ error?: string | undefined;
47
+ };
48
+
49
+ /** @internal */
50
+ export type GetInvoicesExportStatusRequest$Outbound = {
51
+ id: string;
52
+ };
53
+
54
+ /** @internal */
55
+ export const GetInvoicesExportStatusRequest$outboundSchema: z.ZodType<
56
+ GetInvoicesExportStatusRequest$Outbound,
57
+ z.ZodTypeDef,
58
+ GetInvoicesExportStatusRequest
59
+ > = z.object({
60
+ id: z.string(),
61
+ });
62
+
63
+ export function getInvoicesExportStatusRequestToJSON(
64
+ getInvoicesExportStatusRequest: GetInvoicesExportStatusRequest,
65
+ ): string {
66
+ return JSON.stringify(
67
+ GetInvoicesExportStatusRequest$outboundSchema.parse(
68
+ getInvoicesExportStatusRequest,
69
+ ),
70
+ );
71
+ }
72
+
73
+ /** @internal */
74
+ export const GetInvoicesExportStatusResponseBody$inboundSchema: z.ZodType<
75
+ GetInvoicesExportStatusResponseBody,
76
+ z.ZodTypeDef,
77
+ unknown
78
+ > = z.object({
79
+ ready: types.boolean(),
80
+ status_id: types.string(),
81
+ download_url: types.optional(types.string()),
82
+ finished_at: types.optional(types.string()),
83
+ started_at: types.optional(types.string()),
84
+ error: types.optional(types.string()),
85
+ }).transform((v) => {
86
+ return remap$(v, {
87
+ "status_id": "statusId",
88
+ "download_url": "downloadUrl",
89
+ "finished_at": "finishedAt",
90
+ "started_at": "startedAt",
91
+ });
92
+ });
93
+
94
+ export function getInvoicesExportStatusResponseBodyFromJSON(
95
+ jsonString: string,
96
+ ): SafeParseResult<GetInvoicesExportStatusResponseBody, SDKValidationError> {
97
+ return safeParse(
98
+ jsonString,
99
+ (x) =>
100
+ GetInvoicesExportStatusResponseBody$inboundSchema.parse(JSON.parse(x)),
101
+ `Failed to parse 'GetInvoicesExportStatusResponseBody' from JSON`,
102
+ );
103
+ }
@@ -30,6 +30,7 @@ export * from "./expeditetimeremaining.js";
30
30
  export * from "./getcompany.js";
31
31
  export * from "./getfacility.js";
32
32
  export * from "./getfhirconfig.js";
33
+ export * from "./getinvoicesexportstatus.js";
33
34
  export * from "./getlinkedusers.js";
34
35
  export * from "./getnextscreeningquestion.js";
35
36
  export * from "./getnextunansweredscreeningquestion.js";
@@ -30,6 +30,7 @@ export * from "./fhirConfigsListOfFhirConfigurations.js";
30
30
  export * from "./fhirConfigsUpdateFhirConfigById.js";
31
31
  export * from "./invoicesCreateInvoice.js";
32
32
  export * from "./invoicesDownloadInvoicesExport.js";
33
+ export * from "./invoicesGetInvoicesExportStatus.js";
33
34
  export * from "./invoicesInvoicesExport.js";
34
35
  export * from "./invoicesListInvoices.js";
35
36
  export * from "./invoicesMakePayment.js";
@@ -0,0 +1,76 @@
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 { invoicesGetInvoicesExportStatus } from "../funcs/invoicesGetInvoicesExportStatus.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 InvoicesGetInvoicesExportStatusQueryData =
17
+ operations.GetInvoicesExportStatusResponseBody;
18
+
19
+ export function prefetchInvoicesGetInvoicesExportStatus(
20
+ queryClient: QueryClient,
21
+ client$: GreenSecurityCore,
22
+ request: operations.GetInvoicesExportStatusRequest,
23
+ options?: RequestOptions,
24
+ ): Promise<void> {
25
+ return queryClient.prefetchQuery({
26
+ ...buildInvoicesGetInvoicesExportStatusQuery(
27
+ client$,
28
+ request,
29
+ options,
30
+ ),
31
+ });
32
+ }
33
+
34
+ export function buildInvoicesGetInvoicesExportStatusQuery(
35
+ client$: GreenSecurityCore,
36
+ request: operations.GetInvoicesExportStatusRequest,
37
+ options?: RequestOptions,
38
+ ): {
39
+ queryKey: QueryKey;
40
+ queryFn: (
41
+ context: QueryFunctionContext,
42
+ ) => Promise<InvoicesGetInvoicesExportStatusQueryData>;
43
+ } {
44
+ return {
45
+ queryKey: queryKeyInvoicesGetInvoicesExportStatus(request.id),
46
+ queryFn: async function invoicesGetInvoicesExportStatusQueryFn(
47
+ ctx,
48
+ ): Promise<InvoicesGetInvoicesExportStatusQueryData> {
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(invoicesGetInvoicesExportStatus(
61
+ client$,
62
+ request,
63
+ mergedOptions,
64
+ ));
65
+ },
66
+ };
67
+ }
68
+
69
+ export function queryKeyInvoicesGetInvoicesExportStatus(id: string): QueryKey {
70
+ return [
71
+ "@greensecurity/javascript-sdk",
72
+ "invoices",
73
+ "getInvoicesExportStatus",
74
+ id,
75
+ ];
76
+ }
@@ -0,0 +1,152 @@
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
+ buildInvoicesGetInvoicesExportStatusQuery,
33
+ InvoicesGetInvoicesExportStatusQueryData,
34
+ prefetchInvoicesGetInvoicesExportStatus,
35
+ queryKeyInvoicesGetInvoicesExportStatus,
36
+ } from "./invoicesGetInvoicesExportStatus.core.js";
37
+ export {
38
+ buildInvoicesGetInvoicesExportStatusQuery,
39
+ type InvoicesGetInvoicesExportStatusQueryData,
40
+ prefetchInvoicesGetInvoicesExportStatus,
41
+ queryKeyInvoicesGetInvoicesExportStatus,
42
+ };
43
+
44
+ export type InvoicesGetInvoicesExportStatusQueryError =
45
+ | errors.ApiErrorResponse
46
+ | GreenSecurityError
47
+ | ResponseValidationError
48
+ | ConnectionError
49
+ | RequestAbortedError
50
+ | RequestTimeoutError
51
+ | InvalidRequestError
52
+ | UnexpectedClientError
53
+ | SDKValidationError;
54
+
55
+ /**
56
+ * Get invoice export status
57
+ *
58
+ * @remarks
59
+ * Poll the status of an asynchronous invoice export job. When `ready` is true,
60
+ * the export is complete and can be downloaded via the download endpoint.
61
+ */
62
+ export function useInvoicesGetInvoicesExportStatus(
63
+ request: operations.GetInvoicesExportStatusRequest,
64
+ options?: QueryHookOptions<
65
+ InvoicesGetInvoicesExportStatusQueryData,
66
+ InvoicesGetInvoicesExportStatusQueryError
67
+ >,
68
+ ): UseQueryResult<
69
+ InvoicesGetInvoicesExportStatusQueryData,
70
+ InvoicesGetInvoicesExportStatusQueryError
71
+ > {
72
+ const client = useGreenSecurityContext();
73
+ return useQuery({
74
+ ...buildInvoicesGetInvoicesExportStatusQuery(
75
+ client,
76
+ request,
77
+ options,
78
+ ),
79
+ ...options,
80
+ });
81
+ }
82
+
83
+ /**
84
+ * Get invoice export status
85
+ *
86
+ * @remarks
87
+ * Poll the status of an asynchronous invoice export job. When `ready` is true,
88
+ * the export is complete and can be downloaded via the download endpoint.
89
+ */
90
+ export function useInvoicesGetInvoicesExportStatusSuspense(
91
+ request: operations.GetInvoicesExportStatusRequest,
92
+ options?: SuspenseQueryHookOptions<
93
+ InvoicesGetInvoicesExportStatusQueryData,
94
+ InvoicesGetInvoicesExportStatusQueryError
95
+ >,
96
+ ): UseSuspenseQueryResult<
97
+ InvoicesGetInvoicesExportStatusQueryData,
98
+ InvoicesGetInvoicesExportStatusQueryError
99
+ > {
100
+ const client = useGreenSecurityContext();
101
+ return useSuspenseQuery({
102
+ ...buildInvoicesGetInvoicesExportStatusQuery(
103
+ client,
104
+ request,
105
+ options,
106
+ ),
107
+ ...options,
108
+ });
109
+ }
110
+
111
+ export function setInvoicesGetInvoicesExportStatusData(
112
+ client: QueryClient,
113
+ queryKeyBase: [id: string],
114
+ data: InvoicesGetInvoicesExportStatusQueryData,
115
+ ): InvoicesGetInvoicesExportStatusQueryData | undefined {
116
+ const key = queryKeyInvoicesGetInvoicesExportStatus(...queryKeyBase);
117
+
118
+ return client.setQueryData<InvoicesGetInvoicesExportStatusQueryData>(
119
+ key,
120
+ data,
121
+ );
122
+ }
123
+
124
+ export function invalidateInvoicesGetInvoicesExportStatus(
125
+ client: QueryClient,
126
+ queryKeyBase: TupleToPrefixes<[id: string]>,
127
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
128
+ ): Promise<void> {
129
+ return client.invalidateQueries({
130
+ ...filters,
131
+ queryKey: [
132
+ "@greensecurity/javascript-sdk",
133
+ "invoices",
134
+ "getInvoicesExportStatus",
135
+ ...queryKeyBase,
136
+ ],
137
+ });
138
+ }
139
+
140
+ export function invalidateAllInvoicesGetInvoicesExportStatus(
141
+ client: QueryClient,
142
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
143
+ ): Promise<void> {
144
+ return client.invalidateQueries({
145
+ ...filters,
146
+ queryKey: [
147
+ "@greensecurity/javascript-sdk",
148
+ "invoices",
149
+ "getInvoicesExportStatus",
150
+ ],
151
+ });
152
+ }
@@ -7,6 +7,7 @@ import {
7
7
  DownloadInvoicesExportAcceptEnum,
8
8
  invoicesDownloadInvoicesExport,
9
9
  } from "../funcs/invoicesDownloadInvoicesExport.js";
10
+ import { invoicesGetInvoicesExportStatus } from "../funcs/invoicesGetInvoicesExportStatus.js";
10
11
  import { invoicesInvoicesExport } from "../funcs/invoicesInvoicesExport.js";
11
12
  import { invoicesListInvoices } from "../funcs/invoicesListInvoices.js";
12
13
  import { invoicesMakePayment } from "../funcs/invoicesMakePayment.js";
@@ -145,6 +146,24 @@ export class Invoices extends ClientSDK {
145
146
  ));
146
147
  }
147
148
 
149
+ /**
150
+ * Get invoice export status
151
+ *
152
+ * @remarks
153
+ * Poll the status of an asynchronous invoice export job. When `ready` is true,
154
+ * the export is complete and can be downloaded via the download endpoint.
155
+ */
156
+ async getInvoicesExportStatus(
157
+ request: operations.GetInvoicesExportStatusRequest,
158
+ options?: RequestOptions,
159
+ ): Promise<operations.GetInvoicesExportStatusResponseBody> {
160
+ return unwrapAsync(invoicesGetInvoicesExportStatus(
161
+ this,
162
+ request,
163
+ options,
164
+ ));
165
+ }
166
+
148
167
  /**
149
168
  * Download invoices CSV
150
169
  *