@greensecurity/javascript-sdk 0.45.0-beta.7 → 0.45.0-beta.8

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 (89) hide show
  1. package/README.md +4 -1
  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__/vendors.test.js +1 -1
  5. package/dist/commonjs/__tests__/webhooks.test.js +5 -4
  6. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  7. package/dist/commonjs/__tests__/zones.test.js +59 -3
  8. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  9. package/dist/commonjs/funcs/invoicesConvertQuote.d.ts +33 -0
  10. package/dist/commonjs/funcs/invoicesConvertQuote.d.ts.map +1 -0
  11. package/dist/commonjs/funcs/invoicesConvertQuote.js +138 -0
  12. package/dist/commonjs/funcs/invoicesConvertQuote.js.map +1 -0
  13. package/dist/commonjs/lib/config.d.ts +2 -2
  14. package/dist/commonjs/lib/config.js +2 -2
  15. package/dist/commonjs/models/operations/convertquote.d.ts +46 -0
  16. package/dist/commonjs/models/operations/convertquote.d.ts.map +1 -0
  17. package/dist/commonjs/models/operations/convertquote.js +69 -0
  18. package/dist/commonjs/models/operations/convertquote.js.map +1 -0
  19. package/dist/commonjs/models/operations/createinvoice.d.ts +85 -0
  20. package/dist/commonjs/models/operations/createinvoice.d.ts.map +1 -1
  21. package/dist/commonjs/models/operations/createinvoice.js +56 -1
  22. package/dist/commonjs/models/operations/createinvoice.js.map +1 -1
  23. package/dist/commonjs/models/operations/index.d.ts +1 -0
  24. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  25. package/dist/commonjs/models/operations/index.js +1 -0
  26. package/dist/commonjs/models/operations/index.js.map +1 -1
  27. package/dist/commonjs/react-query/index.d.ts +1 -0
  28. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  29. package/dist/commonjs/react-query/index.js +1 -0
  30. package/dist/commonjs/react-query/index.js.map +1 -1
  31. package/dist/commonjs/react-query/invoicesConvertQuote.d.ts +42 -0
  32. package/dist/commonjs/react-query/invoicesConvertQuote.d.ts.map +1 -0
  33. package/dist/commonjs/react-query/invoicesConvertQuote.js +60 -0
  34. package/dist/commonjs/react-query/invoicesConvertQuote.js.map +1 -0
  35. package/dist/commonjs/sdk/invoices.d.ts +20 -0
  36. package/dist/commonjs/sdk/invoices.d.ts.map +1 -1
  37. package/dist/commonjs/sdk/invoices.js +23 -0
  38. package/dist/commonjs/sdk/invoices.js.map +1 -1
  39. package/dist/esm/__tests__/invoices.test.js +18 -0
  40. package/dist/esm/__tests__/invoices.test.js.map +1 -1
  41. package/dist/esm/__tests__/vendors.test.js +1 -1
  42. package/dist/esm/__tests__/webhooks.test.js +5 -4
  43. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  44. package/dist/esm/__tests__/zones.test.js +59 -3
  45. package/dist/esm/__tests__/zones.test.js.map +1 -1
  46. package/dist/esm/funcs/invoicesConvertQuote.d.ts +33 -0
  47. package/dist/esm/funcs/invoicesConvertQuote.d.ts.map +1 -0
  48. package/dist/esm/funcs/invoicesConvertQuote.js +102 -0
  49. package/dist/esm/funcs/invoicesConvertQuote.js.map +1 -0
  50. package/dist/esm/lib/config.d.ts +2 -2
  51. package/dist/esm/lib/config.js +2 -2
  52. package/dist/esm/models/operations/convertquote.d.ts +46 -0
  53. package/dist/esm/models/operations/convertquote.d.ts.map +1 -0
  54. package/dist/esm/models/operations/convertquote.js +31 -0
  55. package/dist/esm/models/operations/convertquote.js.map +1 -0
  56. package/dist/esm/models/operations/createinvoice.d.ts +85 -0
  57. package/dist/esm/models/operations/createinvoice.d.ts.map +1 -1
  58. package/dist/esm/models/operations/createinvoice.js +55 -0
  59. package/dist/esm/models/operations/createinvoice.js.map +1 -1
  60. package/dist/esm/models/operations/index.d.ts +1 -0
  61. package/dist/esm/models/operations/index.d.ts.map +1 -1
  62. package/dist/esm/models/operations/index.js +1 -0
  63. package/dist/esm/models/operations/index.js.map +1 -1
  64. package/dist/esm/react-query/index.d.ts +1 -0
  65. package/dist/esm/react-query/index.d.ts.map +1 -1
  66. package/dist/esm/react-query/index.js +1 -0
  67. package/dist/esm/react-query/index.js.map +1 -1
  68. package/dist/esm/react-query/invoicesConvertQuote.d.ts +42 -0
  69. package/dist/esm/react-query/invoicesConvertQuote.d.ts.map +1 -0
  70. package/dist/esm/react-query/invoicesConvertQuote.js +55 -0
  71. package/dist/esm/react-query/invoicesConvertQuote.js.map +1 -0
  72. package/dist/esm/sdk/invoices.d.ts +20 -0
  73. package/dist/esm/sdk/invoices.d.ts.map +1 -1
  74. package/dist/esm/sdk/invoices.js +23 -0
  75. package/dist/esm/sdk/invoices.js.map +1 -1
  76. package/jsr.json +1 -1
  77. package/package.json +1 -1
  78. package/src/__tests__/invoices.test.ts +21 -0
  79. package/src/__tests__/vendors.test.ts +1 -1
  80. package/src/__tests__/webhooks.test.ts +5 -4
  81. package/src/__tests__/zones.test.ts +59 -3
  82. package/src/funcs/invoicesConvertQuote.ts +190 -0
  83. package/src/lib/config.ts +2 -2
  84. package/src/models/operations/convertquote.ts +94 -0
  85. package/src/models/operations/createinvoice.ts +124 -0
  86. package/src/models/operations/index.ts +1 -0
  87. package/src/react-query/index.ts +1 -0
  88. package/src/react-query/invoicesConvertQuote.ts +124 -0
  89. package/src/sdk/invoices.ts +31 -0
@@ -33,10 +33,27 @@ export type CreateInvoiceRequestBodyInvoicesRequestLines = {
33
33
  paymentHandlerData?: string | undefined;
34
34
  };
35
35
 
36
+ /**
37
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
38
+ */
39
+ export const CreateInvoiceRequestBodyInvoicesRequestInvoiceType = {
40
+ Quote: "quote",
41
+ } as const;
42
+ /**
43
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
44
+ */
45
+ export type CreateInvoiceRequestBodyInvoicesRequestInvoiceType = ClosedEnum<
46
+ typeof CreateInvoiceRequestBodyInvoicesRequestInvoiceType
47
+ >;
48
+
36
49
  export type Five = {
37
50
  vendorCredentialId: number;
38
51
  lines?: Array<CreateInvoiceRequestBodyInvoicesRequestLines> | undefined;
39
52
  credentialPricingIds?: Array<number> | null | undefined;
53
+ /**
54
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
55
+ */
56
+ invoiceType?: CreateInvoiceRequestBodyInvoicesRequestInvoiceType | undefined;
40
57
  };
41
58
 
42
59
  export const CreateInvoiceRequestBodyInvoicesPaymentHandler = {
@@ -59,10 +76,27 @@ export type CreateInvoiceRequestBodyInvoicesLines = {
59
76
  paymentHandlerData?: string | undefined;
60
77
  };
61
78
 
79
+ /**
80
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
81
+ */
82
+ export const CreateInvoiceRequestBodyInvoicesInvoiceType = {
83
+ Quote: "quote",
84
+ } as const;
85
+ /**
86
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
87
+ */
88
+ export type CreateInvoiceRequestBodyInvoicesInvoiceType = ClosedEnum<
89
+ typeof CreateInvoiceRequestBodyInvoicesInvoiceType
90
+ >;
91
+
62
92
  export type Four = {
63
93
  systemId: number;
64
94
  lines?: Array<CreateInvoiceRequestBodyInvoicesLines> | undefined;
65
95
  credentialPricingIds?: Array<number> | null | undefined;
96
+ /**
97
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
98
+ */
99
+ invoiceType?: CreateInvoiceRequestBodyInvoicesInvoiceType | undefined;
66
100
  };
67
101
 
68
102
  export const CreateInvoiceRequestBodyPaymentHandler = {
@@ -85,10 +119,27 @@ export type CreateInvoiceRequestBodyLines = {
85
119
  paymentHandlerData?: string | undefined;
86
120
  };
87
121
 
122
+ /**
123
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
124
+ */
125
+ export const CreateInvoiceRequestBodyInvoiceType = {
126
+ Quote: "quote",
127
+ } as const;
128
+ /**
129
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
130
+ */
131
+ export type CreateInvoiceRequestBodyInvoiceType = ClosedEnum<
132
+ typeof CreateInvoiceRequestBodyInvoiceType
133
+ >;
134
+
88
135
  export type Three = {
89
136
  facilityId: number;
90
137
  lines?: Array<CreateInvoiceRequestBodyLines> | undefined;
91
138
  credentialPricingIds?: Array<number> | null | undefined;
139
+ /**
140
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
141
+ */
142
+ invoiceType?: CreateInvoiceRequestBodyInvoiceType | undefined;
92
143
  };
93
144
 
94
145
  export const RequestBodyPaymentHandler = {
@@ -111,10 +162,25 @@ export type RequestBodyLines = {
111
162
  paymentHandlerData?: string | undefined;
112
163
  };
113
164
 
165
+ /**
166
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
167
+ */
168
+ export const RequestBodyInvoiceType = {
169
+ Quote: "quote",
170
+ } as const;
171
+ /**
172
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
173
+ */
174
+ export type RequestBodyInvoiceType = ClosedEnum<typeof RequestBodyInvoiceType>;
175
+
114
176
  export type CreateInvoiceRequestBody2 = {
115
177
  companyId: number;
116
178
  lines?: Array<RequestBodyLines> | undefined;
117
179
  credentialPricingIds?: Array<number> | null | undefined;
180
+ /**
181
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
182
+ */
183
+ invoiceType?: RequestBodyInvoiceType | undefined;
118
184
  };
119
185
 
120
186
  export const PaymentHandler = {
@@ -135,10 +201,25 @@ export type Lines = {
135
201
  paymentHandlerData?: string | undefined;
136
202
  };
137
203
 
204
+ /**
205
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
206
+ */
207
+ export const InvoiceType = {
208
+ Quote: "quote",
209
+ } as const;
210
+ /**
211
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
212
+ */
213
+ export type InvoiceType = ClosedEnum<typeof InvoiceType>;
214
+
138
215
  export type RequestBody1 = {
139
216
  vendorId: number;
140
217
  lines?: Array<Lines> | undefined;
141
218
  credentialPricingIds?: Array<number> | null | undefined;
219
+ /**
220
+ * Set to `quote` to create a non-chargeable quote, used to preview an invoice's calculated totals before committing to it. Convert the quote into the real invoice with `POST /invoices/{id}/convert`. Omit this field to create a chargeable invoice directly.
221
+ */
222
+ invoiceType?: InvoiceType | undefined;
142
223
  };
143
224
 
144
225
  export type CreateInvoiceRequestBody =
@@ -218,6 +299,11 @@ export function createInvoiceRequestBodyInvoicesRequestLinesToJSON(
218
299
  );
219
300
  }
220
301
 
302
+ /** @internal */
303
+ export const CreateInvoiceRequestBodyInvoicesRequestInvoiceType$outboundSchema:
304
+ z.ZodNativeEnum<typeof CreateInvoiceRequestBodyInvoicesRequestInvoiceType> = z
305
+ .nativeEnum(CreateInvoiceRequestBodyInvoicesRequestInvoiceType);
306
+
221
307
  /** @internal */
222
308
  export type Five$Outbound = {
223
309
  vendor_credential_id: number;
@@ -225,6 +311,7 @@ export type Five$Outbound = {
225
311
  | Array<CreateInvoiceRequestBodyInvoicesRequestLines$Outbound>
226
312
  | undefined;
227
313
  credential_pricing_ids?: Array<number> | null | undefined;
314
+ invoice_type?: string | undefined;
228
315
  };
229
316
 
230
317
  /** @internal */
@@ -235,10 +322,14 @@ export const Five$outboundSchema: z.ZodType<Five$Outbound, z.ZodTypeDef, Five> =
235
322
  z.lazy(() => CreateInvoiceRequestBodyInvoicesRequestLines$outboundSchema),
236
323
  ).optional(),
237
324
  credentialPricingIds: z.nullable(z.array(z.number().int())).optional(),
325
+ invoiceType:
326
+ CreateInvoiceRequestBodyInvoicesRequestInvoiceType$outboundSchema
327
+ .optional(),
238
328
  }).transform((v) => {
239
329
  return remap$(v, {
240
330
  vendorCredentialId: "vendor_credential_id",
241
331
  credentialPricingIds: "credential_pricing_ids",
332
+ invoiceType: "invoice_type",
242
333
  });
243
334
  });
244
335
 
@@ -304,11 +395,17 @@ export function createInvoiceRequestBodyInvoicesLinesToJSON(
304
395
  );
305
396
  }
306
397
 
398
+ /** @internal */
399
+ export const CreateInvoiceRequestBodyInvoicesInvoiceType$outboundSchema:
400
+ z.ZodNativeEnum<typeof CreateInvoiceRequestBodyInvoicesInvoiceType> = z
401
+ .nativeEnum(CreateInvoiceRequestBodyInvoicesInvoiceType);
402
+
307
403
  /** @internal */
308
404
  export type Four$Outbound = {
309
405
  system_id: number;
310
406
  lines?: Array<CreateInvoiceRequestBodyInvoicesLines$Outbound> | undefined;
311
407
  credential_pricing_ids?: Array<number> | null | undefined;
408
+ invoice_type?: string | undefined;
312
409
  };
313
410
 
314
411
  /** @internal */
@@ -319,10 +416,13 @@ export const Four$outboundSchema: z.ZodType<Four$Outbound, z.ZodTypeDef, Four> =
319
416
  z.lazy(() => CreateInvoiceRequestBodyInvoicesLines$outboundSchema),
320
417
  ).optional(),
321
418
  credentialPricingIds: z.nullable(z.array(z.number().int())).optional(),
419
+ invoiceType: CreateInvoiceRequestBodyInvoicesInvoiceType$outboundSchema
420
+ .optional(),
322
421
  }).transform((v) => {
323
422
  return remap$(v, {
324
423
  systemId: "system_id",
325
424
  credentialPricingIds: "credential_pricing_ids",
425
+ invoiceType: "invoice_type",
326
426
  });
327
427
  });
328
428
 
@@ -389,11 +489,18 @@ export function createInvoiceRequestBodyLinesToJSON(
389
489
  );
390
490
  }
391
491
 
492
+ /** @internal */
493
+ export const CreateInvoiceRequestBodyInvoiceType$outboundSchema:
494
+ z.ZodNativeEnum<typeof CreateInvoiceRequestBodyInvoiceType> = z.nativeEnum(
495
+ CreateInvoiceRequestBodyInvoiceType,
496
+ );
497
+
392
498
  /** @internal */
393
499
  export type Three$Outbound = {
394
500
  facility_id: number;
395
501
  lines?: Array<CreateInvoiceRequestBodyLines$Outbound> | undefined;
396
502
  credential_pricing_ids?: Array<number> | null | undefined;
503
+ invoice_type?: string | undefined;
397
504
  };
398
505
 
399
506
  /** @internal */
@@ -406,10 +513,12 @@ export const Three$outboundSchema: z.ZodType<
406
513
  lines: z.array(z.lazy(() => CreateInvoiceRequestBodyLines$outboundSchema))
407
514
  .optional(),
408
515
  credentialPricingIds: z.nullable(z.array(z.number().int())).optional(),
516
+ invoiceType: CreateInvoiceRequestBodyInvoiceType$outboundSchema.optional(),
409
517
  }).transform((v) => {
410
518
  return remap$(v, {
411
519
  facilityId: "facility_id",
412
520
  credentialPricingIds: "credential_pricing_ids",
521
+ invoiceType: "invoice_type",
413
522
  });
414
523
  });
415
524
 
@@ -472,11 +581,17 @@ export function requestBodyLinesToJSON(
472
581
  );
473
582
  }
474
583
 
584
+ /** @internal */
585
+ export const RequestBodyInvoiceType$outboundSchema: z.ZodNativeEnum<
586
+ typeof RequestBodyInvoiceType
587
+ > = z.nativeEnum(RequestBodyInvoiceType);
588
+
475
589
  /** @internal */
476
590
  export type CreateInvoiceRequestBody2$Outbound = {
477
591
  company_id: number;
478
592
  lines?: Array<RequestBodyLines$Outbound> | undefined;
479
593
  credential_pricing_ids?: Array<number> | null | undefined;
594
+ invoice_type?: string | undefined;
480
595
  };
481
596
 
482
597
  /** @internal */
@@ -488,10 +603,12 @@ export const CreateInvoiceRequestBody2$outboundSchema: z.ZodType<
488
603
  companyId: z.number().int(),
489
604
  lines: z.array(z.lazy(() => RequestBodyLines$outboundSchema)).optional(),
490
605
  credentialPricingIds: z.nullable(z.array(z.number().int())).optional(),
606
+ invoiceType: RequestBodyInvoiceType$outboundSchema.optional(),
491
607
  }).transform((v) => {
492
608
  return remap$(v, {
493
609
  companyId: "company_id",
494
610
  credentialPricingIds: "credential_pricing_ids",
611
+ invoiceType: "invoice_type",
495
612
  });
496
613
  });
497
614
 
@@ -554,11 +671,16 @@ export function linesToJSON(lines: Lines): string {
554
671
  return JSON.stringify(Lines$outboundSchema.parse(lines));
555
672
  }
556
673
 
674
+ /** @internal */
675
+ export const InvoiceType$outboundSchema: z.ZodNativeEnum<typeof InvoiceType> = z
676
+ .nativeEnum(InvoiceType);
677
+
557
678
  /** @internal */
558
679
  export type RequestBody1$Outbound = {
559
680
  vendor_id: number;
560
681
  lines?: Array<Lines$Outbound> | undefined;
561
682
  credential_pricing_ids?: Array<number> | null | undefined;
683
+ invoice_type?: string | undefined;
562
684
  };
563
685
 
564
686
  /** @internal */
@@ -570,10 +692,12 @@ export const RequestBody1$outboundSchema: z.ZodType<
570
692
  vendorId: z.number().int(),
571
693
  lines: z.array(z.lazy(() => Lines$outboundSchema)).optional(),
572
694
  credentialPricingIds: z.nullable(z.array(z.number().int())).optional(),
695
+ invoiceType: InvoiceType$outboundSchema.optional(),
573
696
  }).transform((v) => {
574
697
  return remap$(v, {
575
698
  vendorId: "vendor_id",
576
699
  credentialPricingIds: "credential_pricing_ids",
700
+ invoiceType: "invoice_type",
577
701
  });
578
702
  });
579
703
 
@@ -15,6 +15,7 @@ export * from "./cancelhandoff.js";
15
15
  export * from "./changepassword.js";
16
16
  export * from "./changesubscription.js";
17
17
  export * from "./checkdownloadcode.js";
18
+ export * from "./convertquote.js";
18
19
  export * from "./createcompanytargetfacility.js";
19
20
  export * from "./createevent.js";
20
21
  export * from "./createinvoice.js";
@@ -33,6 +33,7 @@ export * from "./fhirConfigsDeleteFhirConfigById.js";
33
33
  export * from "./fhirConfigsGetFhirConfig.js";
34
34
  export * from "./fhirConfigsListOfFhirConfigurations.js";
35
35
  export * from "./fhirConfigsUpdateFhirConfigById.js";
36
+ export * from "./invoicesConvertQuote.js";
36
37
  export * from "./invoicesCreateInvoice.js";
37
38
  export * from "./invoicesDownloadInvoicesExport.js";
38
39
  export * from "./invoicesGetInvoice.js";
@@ -0,0 +1,124 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ MutationKey,
7
+ useMutation,
8
+ UseMutationResult,
9
+ } from "@tanstack/react-query";
10
+ import { GreenSecurityCore } from "../core.js";
11
+ import { invoicesConvertQuote } from "../funcs/invoicesConvertQuote.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { unwrapAsync } from "../types/fp.js";
27
+ import { useGreenSecurityContext } from "./_context.js";
28
+ import { MutationHookOptions } from "./_types.js";
29
+
30
+ export type InvoicesConvertQuoteMutationVariables = {
31
+ request: operations.ConvertQuoteRequest;
32
+ options?: RequestOptions;
33
+ };
34
+
35
+ export type InvoicesConvertQuoteMutationData =
36
+ operations.ConvertQuoteConvertQuoteOk;
37
+
38
+ export type InvoicesConvertQuoteMutationError =
39
+ | errors.ApiErrorResponse
40
+ | GreenSecurityError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError;
48
+
49
+ /**
50
+ * Convert a quote into an invoice
51
+ *
52
+ * @remarks
53
+ * Converts a quote into the real invoice its caller will be charged for, and
54
+ * returns the new invoice with its calculated totals. Any `VendorCredential`
55
+ * linked to the quote is re-pointed at the new invoice.
56
+ *
57
+ * The operation is idempotent: converting a quote that has already been
58
+ * processed returns the invoice previously created from it rather than
59
+ * creating a second one, so a retried request is safe.
60
+ *
61
+ * The referenced invoice must actually be a quote — a non-quote invoice id
62
+ * responds `400`. Requires a caller whose access scope permits creating
63
+ * invoices; a caller allowed to create the invoice but not to update the
64
+ * linked `VendorCredential` responds `401`.
65
+ *
66
+ * Takes no request body.
67
+ */
68
+ export function useInvoicesConvertQuoteMutation(
69
+ options?: MutationHookOptions<
70
+ InvoicesConvertQuoteMutationData,
71
+ InvoicesConvertQuoteMutationError,
72
+ InvoicesConvertQuoteMutationVariables
73
+ >,
74
+ ): UseMutationResult<
75
+ InvoicesConvertQuoteMutationData,
76
+ InvoicesConvertQuoteMutationError,
77
+ InvoicesConvertQuoteMutationVariables
78
+ > {
79
+ const client = useGreenSecurityContext();
80
+ return useMutation({
81
+ ...buildInvoicesConvertQuoteMutation(client, options),
82
+ ...options,
83
+ });
84
+ }
85
+
86
+ export function mutationKeyInvoicesConvertQuote(): MutationKey {
87
+ return ["@greensecurity/javascript-sdk", "invoices", "convertQuote"];
88
+ }
89
+
90
+ export function buildInvoicesConvertQuoteMutation(
91
+ client$: GreenSecurityCore,
92
+ hookOptions?: RequestOptions,
93
+ ): {
94
+ mutationKey: MutationKey;
95
+ mutationFn: (
96
+ variables: InvoicesConvertQuoteMutationVariables,
97
+ ) => Promise<InvoicesConvertQuoteMutationData>;
98
+ } {
99
+ return {
100
+ mutationKey: mutationKeyInvoicesConvertQuote(),
101
+ mutationFn: function invoicesConvertQuoteMutationFn({
102
+ request,
103
+ options,
104
+ }): Promise<InvoicesConvertQuoteMutationData> {
105
+ const mergedOptions = {
106
+ ...hookOptions,
107
+ ...options,
108
+ fetchOptions: {
109
+ ...hookOptions?.fetchOptions,
110
+ ...options?.fetchOptions,
111
+ signal: combineSignals(
112
+ hookOptions?.fetchOptions?.signal,
113
+ options?.fetchOptions?.signal,
114
+ ),
115
+ },
116
+ };
117
+ return unwrapAsync(invoicesConvertQuote(
118
+ client$,
119
+ request,
120
+ mergedOptions,
121
+ ));
122
+ },
123
+ };
124
+ }
@@ -2,6 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { invoicesConvertQuote } from "../funcs/invoicesConvertQuote.js";
5
6
  import { invoicesCreateInvoice } from "../funcs/invoicesCreateInvoice.js";
6
7
  import {
7
8
  DownloadInvoicesExportAcceptEnum,
@@ -152,6 +153,36 @@ export class Invoices extends ClientSDK {
152
153
  ));
153
154
  }
154
155
 
156
+ /**
157
+ * Convert a quote into an invoice
158
+ *
159
+ * @remarks
160
+ * Converts a quote into the real invoice its caller will be charged for, and
161
+ * returns the new invoice with its calculated totals. Any `VendorCredential`
162
+ * linked to the quote is re-pointed at the new invoice.
163
+ *
164
+ * The operation is idempotent: converting a quote that has already been
165
+ * processed returns the invoice previously created from it rather than
166
+ * creating a second one, so a retried request is safe.
167
+ *
168
+ * The referenced invoice must actually be a quote — a non-quote invoice id
169
+ * responds `400`. Requires a caller whose access scope permits creating
170
+ * invoices; a caller allowed to create the invoice but not to update the
171
+ * linked `VendorCredential` responds `401`.
172
+ *
173
+ * Takes no request body.
174
+ */
175
+ async convertQuote(
176
+ request: operations.ConvertQuoteRequest,
177
+ options?: RequestOptions,
178
+ ): Promise<operations.ConvertQuoteConvertQuoteOk> {
179
+ return unwrapAsync(invoicesConvertQuote(
180
+ this,
181
+ request,
182
+ options,
183
+ ));
184
+ }
185
+
155
186
  /**
156
187
  * Export invoices to csv (async)
157
188
  *