@greensecurity/javascript-sdk 0.17.0 → 0.18.2

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 (98) hide show
  1. package/README.md +3 -0
  2. package/bin/mcp-server.js +289 -38
  3. package/bin/mcp-server.js.map +18 -13
  4. package/funcs/supportArticlesListOrSearchSupportArticles.js +2 -0
  5. package/funcs/supportArticlesListOrSearchSupportArticles.js.map +1 -1
  6. package/funcs/vendorsGetVendorInvoiceDetails.d.ts +23 -0
  7. package/funcs/vendorsGetVendorInvoiceDetails.d.ts.map +1 -0
  8. package/funcs/vendorsGetVendorInvoiceDetails.js +130 -0
  9. package/funcs/vendorsGetVendorInvoiceDetails.js.map +1 -0
  10. package/jsr.json +1 -1
  11. package/lib/config.d.ts +3 -3
  12. package/lib/config.js +3 -3
  13. package/mcp-server/extensions.d.ts +9 -0
  14. package/mcp-server/extensions.d.ts.map +1 -0
  15. package/mcp-server/extensions.js +6 -0
  16. package/mcp-server/extensions.js.map +1 -0
  17. package/mcp-server/mcp-server.js +1 -1
  18. package/mcp-server/resources.d.ts +9 -4
  19. package/mcp-server/resources.d.ts.map +1 -1
  20. package/mcp-server/resources.js +36 -9
  21. package/mcp-server/resources.js.map +1 -1
  22. package/mcp-server/server.d.ts.map +1 -1
  23. package/mcp-server/server.js +8 -1
  24. package/mcp-server/server.js.map +1 -1
  25. package/mcp-server/tools/vendorsGetVendorInvoiceDetails.d.ts +8 -0
  26. package/mcp-server/tools/vendorsGetVendorInvoiceDetails.d.ts.map +1 -0
  27. package/mcp-server/tools/vendorsGetVendorInvoiceDetails.js +69 -0
  28. package/mcp-server/tools/vendorsGetVendorInvoiceDetails.js.map +1 -0
  29. package/models/components/expand.d.ts +3 -0
  30. package/models/components/expand.d.ts.map +1 -1
  31. package/models/components/expand.js +1 -0
  32. package/models/components/expand.js.map +1 -1
  33. package/models/components/index.d.ts +1 -0
  34. package/models/components/index.d.ts.map +1 -1
  35. package/models/components/index.js +1 -0
  36. package/models/components/index.js.map +1 -1
  37. package/models/components/invoice.d.ts +13 -2
  38. package/models/components/invoice.d.ts.map +1 -1
  39. package/models/components/invoice.js +19 -2
  40. package/models/components/invoice.js.map +1 -1
  41. package/models/components/invoiceitem.d.ts +8 -0
  42. package/models/components/invoiceitem.d.ts.map +1 -1
  43. package/models/components/invoiceitem.js +12 -0
  44. package/models/components/invoiceitem.js.map +1 -1
  45. package/models/components/invoicetransaction.d.ts +44 -0
  46. package/models/components/invoicetransaction.d.ts.map +1 -0
  47. package/models/components/invoicetransaction.js +96 -0
  48. package/models/components/invoicetransaction.js.map +1 -0
  49. package/models/operations/getvendorinvoicedetails.d.ts +38 -0
  50. package/models/operations/getvendorinvoicedetails.d.ts.map +1 -0
  51. package/models/operations/getvendorinvoicedetails.js +72 -0
  52. package/models/operations/getvendorinvoicedetails.js.map +1 -0
  53. package/models/operations/index.d.ts +1 -0
  54. package/models/operations/index.d.ts.map +1 -1
  55. package/models/operations/index.js +1 -0
  56. package/models/operations/index.js.map +1 -1
  57. package/models/operations/listorsearchsupportarticles.d.ts +10 -0
  58. package/models/operations/listorsearchsupportarticles.d.ts.map +1 -1
  59. package/models/operations/listorsearchsupportarticles.js +4 -0
  60. package/models/operations/listorsearchsupportarticles.js.map +1 -1
  61. package/package.json +1 -1
  62. package/react-query/index.d.ts +1 -0
  63. package/react-query/index.d.ts.map +1 -1
  64. package/react-query/index.js +1 -0
  65. package/react-query/index.js.map +1 -1
  66. package/react-query/supportArticlesListOrSearchSupportArticles.d.ts +6 -0
  67. package/react-query/supportArticlesListOrSearchSupportArticles.d.ts.map +1 -1
  68. package/react-query/supportArticlesListOrSearchSupportArticles.js +4 -0
  69. package/react-query/supportArticlesListOrSearchSupportArticles.js.map +1 -1
  70. package/react-query/vendorsGetVendorInvoiceDetails.d.ts +53 -0
  71. package/react-query/vendorsGetVendorInvoiceDetails.d.ts.map +1 -0
  72. package/react-query/vendorsGetVendorInvoiceDetails.js +109 -0
  73. package/react-query/vendorsGetVendorInvoiceDetails.js.map +1 -0
  74. package/sdk/vendors.d.ts +13 -0
  75. package/sdk/vendors.d.ts.map +1 -1
  76. package/sdk/vendors.js +15 -0
  77. package/sdk/vendors.js.map +1 -1
  78. package/src/__tests__/vendors.test.ts +23 -0
  79. package/src/funcs/supportArticlesListOrSearchSupportArticles.ts +2 -0
  80. package/src/funcs/vendorsGetVendorInvoiceDetails.ts +180 -0
  81. package/src/lib/config.ts +3 -3
  82. package/src/mcp-server/extensions.ts +13 -0
  83. package/src/mcp-server/mcp-server.ts +1 -1
  84. package/src/mcp-server/resources.ts +75 -14
  85. package/src/mcp-server/server.ts +18 -1
  86. package/src/mcp-server/tools/vendorsGetVendorInvoiceDetails.ts +43 -0
  87. package/src/models/components/expand.ts +1 -0
  88. package/src/models/components/index.ts +1 -0
  89. package/src/models/components/invoice.ts +36 -4
  90. package/src/models/components/invoiceitem.ts +20 -0
  91. package/src/models/components/invoicetransaction.ts +108 -0
  92. package/src/models/operations/getvendorinvoicedetails.ts +79 -0
  93. package/src/models/operations/index.ts +1 -0
  94. package/src/models/operations/listorsearchsupportarticles.ts +14 -0
  95. package/src/react-query/index.ts +1 -0
  96. package/src/react-query/supportArticlesListOrSearchSupportArticles.ts +10 -0
  97. package/src/react-query/vendorsGetVendorInvoiceDetails.ts +187 -0
  98. package/src/sdk/vendors.ts +24 -0
@@ -2,12 +2,16 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
- import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
5
+ import {
6
+ McpServer,
7
+ ResourceMetadata,
8
+ ResourceTemplate,
9
+ } from "@modelcontextprotocol/sdk/server/mcp.js";
6
10
  import { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
7
11
  import { Variables } from "@modelcontextprotocol/sdk/shared/uriTemplate.js";
8
12
  import { ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
9
13
  import { GreenSecurityCore } from "../core.js";
10
- import { Result } from "../types/fp.js";
14
+ import { ConsoleLogger } from "./console-logger.js";
11
15
  import { MCPScope } from "./scopes.js";
12
16
  import { isAsyncIterable, isBinaryData, valueToBase64 } from "./shared.js";
13
17
 
@@ -19,7 +23,8 @@ export type ReadResourceCallback = (
19
23
 
20
24
  export type ResourceDefinition = {
21
25
  name: string;
22
- description: string;
26
+ description?: string;
27
+ metadata?: ResourceMetadata;
23
28
  scopes?: MCPScope[];
24
29
  resource: string;
25
30
  read: ReadResourceCallback;
@@ -35,30 +40,27 @@ export type ReadResourceTemplateCallback = (
35
40
  export type ResourceTemplateDefinition = {
36
41
  name: string;
37
42
  description: string;
43
+ metadata?: ResourceMetadata;
38
44
  scopes?: MCPScope[];
39
45
  resource: ResourceTemplate;
40
46
  read: ReadResourceTemplateCallback;
41
47
  };
42
48
 
43
49
  export async function formatResult(
44
- result: Result<unknown, Error>,
50
+ value: unknown,
45
51
  uri: URL,
46
- init: { response?: Response | undefined },
52
+ init: { mimeType?: string | undefined; response?: Response | undefined },
47
53
  ): Promise<ReadResourceResult> {
48
- if (!result.ok) {
49
- throw result.error;
50
- }
51
-
52
- const { value } = result;
53
54
  if (typeof value === "undefined") {
54
55
  return { contents: [] };
55
56
  }
56
57
 
57
- const { response } = init;
58
- const mimeType = response?.headers.get("content-type") ?? "";
59
58
  let contents: ReadResourceResult["contents"] = [];
60
59
 
61
- if (mimeType.search(/\bjson\b/g)) {
60
+ const mimeType = init.mimeType ?? init.response?.headers.get("content-type")
61
+ ?? "";
62
+
63
+ if (mimeType.search(/\bjson\b/g) !== -1) {
62
64
  contents = [{ uri: uri.toString(), mimeType, text: JSON.stringify(value) }];
63
65
  } else if (
64
66
  mimeType.startsWith("text/event-stream")
@@ -71,7 +73,10 @@ export async function formatResult(
71
73
  text: await stringifySSEToJSON(value),
72
74
  },
73
75
  ];
74
- } else if (mimeType.startsWith("text/") && typeof value === "string") {
76
+ } else if (
77
+ (mimeType.startsWith("text/") || mimeType.startsWith("application/"))
78
+ && typeof value === "string"
79
+ ) {
75
80
  contents = [{ uri: uri.toString(), mimeType, text: value }];
76
81
  } else if (isBinaryData(value)) {
77
82
  const blob = await valueToBase64(value);
@@ -94,3 +99,59 @@ async function stringifySSEToJSON(
94
99
 
95
100
  return JSON.stringify(payloads);
96
101
  }
102
+
103
+ export function createRegisterResource(
104
+ logger: ConsoleLogger,
105
+ server: McpServer,
106
+ sdk: GreenSecurityCore,
107
+ allowedScopes: Set<MCPScope>,
108
+ ): (resource: ResourceDefinition) => void {
109
+ return (resource: ResourceDefinition): void => {
110
+ const scopes = resource.scopes ?? [];
111
+ if (!scopes.every((s: MCPScope) => allowedScopes.has(s))) {
112
+ return;
113
+ }
114
+
115
+ const metadata: ResourceMetadata = {
116
+ ...resource.metadata,
117
+ description: resource.description,
118
+ };
119
+
120
+ server.resource(
121
+ resource.name,
122
+ resource.resource,
123
+ metadata,
124
+ async (uri, ctx) => resource.read(sdk, uri, ctx),
125
+ );
126
+
127
+ logger.debug("Registered resource", { name: resource.name });
128
+ };
129
+ }
130
+
131
+ export function createRegisterResourceTemplate(
132
+ logger: ConsoleLogger,
133
+ server: McpServer,
134
+ sdk: GreenSecurityCore,
135
+ allowedScopes: Set<MCPScope>,
136
+ ): (resource: ResourceTemplateDefinition) => void {
137
+ return (resource: ResourceTemplateDefinition): void => {
138
+ const scopes = resource.scopes ?? [];
139
+ if (!scopes.every((s: MCPScope) => allowedScopes.has(s))) {
140
+ return;
141
+ }
142
+
143
+ const metadata: ResourceMetadata = {
144
+ ...resource.metadata,
145
+ description: resource.description,
146
+ };
147
+
148
+ server.resource(
149
+ resource.name,
150
+ resource.resource,
151
+ metadata,
152
+ async (uri, vars, ctx) => resource.read(sdk, uri, vars, ctx),
153
+ );
154
+
155
+ logger.debug("Registered resource template", { name: resource.name });
156
+ };
157
+ }
@@ -6,6 +6,10 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
6
  import { GreenSecurityCore } from "../core.js";
7
7
  import { SDKOptions } from "../lib/config.js";
8
8
  import type { ConsoleLogger } from "./console-logger.js";
9
+ import {
10
+ createRegisterResource,
11
+ createRegisterResourceTemplate,
12
+ } from "./resources.js";
9
13
  import { MCPScope, mcpScopes } from "./scopes.js";
10
14
  import { createRegisterTool } from "./tools.js";
11
15
  import { tool$organizationsGetFacility } from "./tools/organizationsGetFacility.js";
@@ -20,6 +24,7 @@ import { tool$usersPassword } from "./tools/usersPassword.js";
20
24
  import { tool$usersPasswordResetRequest } from "./tools/usersPasswordResetRequest.js";
21
25
  import { tool$vendorsCreateVendorRegistration } from "./tools/vendorsCreateVendorRegistration.js";
22
26
  import { tool$vendorsExpediteTimeRemaining } from "./tools/vendorsExpediteTimeRemaining.js";
27
+ import { tool$vendorsGetVendorInvoiceDetails } from "./tools/vendorsGetVendorInvoiceDetails.js";
23
28
  import { tool$vendorsListVendorCredentials } from "./tools/vendorsListVendorCredentials.js";
24
29
  import { tool$vendorsListVendorInvoices } from "./tools/vendorsListVendorInvoices.js";
25
30
  import { tool$vendorsListVendorJobTitles } from "./tools/vendorsListVendorJobTitles.js";
@@ -34,7 +39,7 @@ export function createMCPServer(deps: {
34
39
  }) {
35
40
  const server = new McpServer({
36
41
  name: "GreenSecurity",
37
- version: "0.17.0",
42
+ version: "0.18.2",
38
43
  });
39
44
 
40
45
  const client = new GreenSecurityCore({
@@ -42,7 +47,9 @@ export function createMCPServer(deps: {
42
47
  serverURL: deps.serverURL,
43
48
  serverIdx: deps.serverIdx,
44
49
  });
50
+
45
51
  const scopes = new Set(deps.scopes ?? mcpScopes);
52
+
46
53
  const allowedTools = deps.allowedTools && new Set(deps.allowedTools);
47
54
  const tool = createRegisterTool(
48
55
  deps.logger,
@@ -51,12 +58,22 @@ export function createMCPServer(deps: {
51
58
  scopes,
52
59
  allowedTools,
53
60
  );
61
+ const resource = createRegisterResource(deps.logger, server, client, scopes);
62
+ const resourceTemplate = createRegisterResourceTemplate(
63
+ deps.logger,
64
+ server,
65
+ client,
66
+ scopes,
67
+ );
68
+ const register = { tool, resource, resourceTemplate };
69
+ void register; // suppress unused warnings
54
70
 
55
71
  tool(tool$vendorsCreateVendorRegistration);
56
72
  tool(tool$vendorsListVendorJobTitles);
57
73
  tool(tool$vendorsListVendorCredentials);
58
74
  tool(tool$vendorsExpediteTimeRemaining);
59
75
  tool(tool$vendorsListVendorInvoices);
76
+ tool(tool$vendorsGetVendorInvoiceDetails);
60
77
  tool(tool$usersGetCurrentUser);
61
78
  tool(tool$usersGetUserById);
62
79
  tool(tool$usersLogsUserIntoTheSystem);
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { vendorsGetVendorInvoiceDetails } from "../../funcs/vendorsGetVendorInvoiceDetails.js";
6
+ import * as operations from "../../models/operations/index.js";
7
+ import { formatResult, ToolDefinition } from "../tools.js";
8
+
9
+ const args = {
10
+ request: operations.GetVendorInvoiceDetailsRequest$inboundSchema,
11
+ };
12
+
13
+ export const tool$vendorsGetVendorInvoiceDetails: ToolDefinition<typeof args> =
14
+ {
15
+ name: "vendors_get-vendor-invoice-details",
16
+ description: `Get vendor invoice details
17
+
18
+ Retrieve an individual vendor invoice detais.
19
+
20
+ Available \`expand\` scopes are:
21
+
22
+ invoice.line_items
23
+ invoice.invoice_transactions`,
24
+ args,
25
+ tool: async (client, args, ctx) => {
26
+ const [result, apiCall] = await vendorsGetVendorInvoiceDetails(
27
+ client,
28
+ args.request,
29
+ { fetchOptions: { signal: ctx.signal } },
30
+ ).$inspect();
31
+
32
+ if (!result.ok) {
33
+ return {
34
+ content: [{ type: "text", text: result.error.message }],
35
+ isError: true,
36
+ };
37
+ }
38
+
39
+ const value = result.value;
40
+
41
+ return formatResult(value, apiCall);
42
+ },
43
+ };
@@ -31,6 +31,7 @@ export const Expand = {
31
31
  SupportArticleNotes: "support_article.notes",
32
32
  SupportArticleSupportCategory: "support_article.support_category",
33
33
  InvoiceLineItems: "invoice.line_items",
34
+ InvoiceInvoiceTransactions: "invoice.invoice_transactions",
34
35
  } as const;
35
36
  /**
36
37
  * An expansion scope that is valid for the object being requested.
@@ -14,6 +14,7 @@ export * from "./facilitysummary.js";
14
14
  export * from "./imageset.js";
15
15
  export * from "./invoice.js";
16
16
  export * from "./invoiceitem.js";
17
+ export * from "./invoicetransaction.js";
17
18
  export * from "./loginemailandpassword.js";
18
19
  export * from "./loginrequirementsfromemail.js";
19
20
  export * from "./mfarequiredresponse.js";
@@ -13,6 +13,12 @@ import {
13
13
  InvoiceItem$Outbound,
14
14
  InvoiceItem$outboundSchema,
15
15
  } from "./invoiceitem.js";
16
+ import {
17
+ InvoiceTransaction,
18
+ InvoiceTransaction$inboundSchema,
19
+ InvoiceTransaction$Outbound,
20
+ InvoiceTransaction$outboundSchema,
21
+ } from "./invoicetransaction.js";
16
22
 
17
23
  /**
18
24
  * A simplified representation of an Invoice
@@ -23,7 +29,12 @@ export type Invoice = {
23
29
  amount?: number | null | undefined;
24
30
  status?: string | null | undefined;
25
31
  financialStatus?: string | null | undefined;
26
- items?: Array<InvoiceItem> | undefined;
32
+ amountNotPaid?: number | null | undefined;
33
+ tax?: number | null | undefined;
34
+ convenienceFee?: number | null | undefined;
35
+ shipping?: number | null | undefined;
36
+ items?: Array<InvoiceItem> | null | undefined;
37
+ transactions?: Array<InvoiceTransaction> | null | undefined;
27
38
  };
28
39
 
29
40
  /** @internal */
@@ -34,11 +45,19 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
34
45
  amount: z.nullable(z.number().int()).optional(),
35
46
  status: z.nullable(z.string()).optional(),
36
47
  financial_status: z.nullable(z.string()).optional(),
37
- items: z.array(InvoiceItem$inboundSchema).optional(),
48
+ amount_not_paid: z.nullable(z.number().int()).optional(),
49
+ tax: z.nullable(z.number().int()).optional(),
50
+ convenience_fee: z.nullable(z.number()).optional(),
51
+ shipping: z.nullable(z.number().int()).optional(),
52
+ items: z.nullable(z.array(InvoiceItem$inboundSchema)).optional(),
53
+ transactions: z.nullable(z.array(InvoiceTransaction$inboundSchema))
54
+ .optional(),
38
55
  }).transform((v) => {
39
56
  return remap$(v, {
40
57
  "invoice_number": "invoiceNumber",
41
58
  "financial_status": "financialStatus",
59
+ "amount_not_paid": "amountNotPaid",
60
+ "convenience_fee": "convenienceFee",
42
61
  });
43
62
  });
44
63
 
@@ -49,7 +68,12 @@ export type Invoice$Outbound = {
49
68
  amount?: number | null | undefined;
50
69
  status?: string | null | undefined;
51
70
  financial_status?: string | null | undefined;
52
- items?: Array<InvoiceItem$Outbound> | undefined;
71
+ amount_not_paid?: number | null | undefined;
72
+ tax?: number | null | undefined;
73
+ convenience_fee?: number | null | undefined;
74
+ shipping?: number | null | undefined;
75
+ items?: Array<InvoiceItem$Outbound> | null | undefined;
76
+ transactions?: Array<InvoiceTransaction$Outbound> | null | undefined;
53
77
  };
54
78
 
55
79
  /** @internal */
@@ -63,11 +87,19 @@ export const Invoice$outboundSchema: z.ZodType<
63
87
  amount: z.nullable(z.number().int()).optional(),
64
88
  status: z.nullable(z.string()).optional(),
65
89
  financialStatus: z.nullable(z.string()).optional(),
66
- items: z.array(InvoiceItem$outboundSchema).optional(),
90
+ amountNotPaid: z.nullable(z.number().int()).optional(),
91
+ tax: z.nullable(z.number().int()).optional(),
92
+ convenienceFee: z.nullable(z.number()).optional(),
93
+ shipping: z.nullable(z.number().int()).optional(),
94
+ items: z.nullable(z.array(InvoiceItem$outboundSchema)).optional(),
95
+ transactions: z.nullable(z.array(InvoiceTransaction$outboundSchema))
96
+ .optional(),
67
97
  }).transform((v) => {
68
98
  return remap$(v, {
69
99
  invoiceNumber: "invoice_number",
70
100
  financialStatus: "financial_status",
101
+ amountNotPaid: "amount_not_paid",
102
+ convenienceFee: "convenience_fee",
71
103
  });
72
104
  });
73
105
 
@@ -17,6 +17,10 @@ export type InvoiceItem = {
17
17
  dateEnds?: string | null | undefined;
18
18
  isSubscription?: boolean | null | undefined;
19
19
  productTitle?: string | null | undefined;
20
+ itemTitle?: string | null | undefined;
21
+ quantity?: number | null | undefined;
22
+ unitPrice?: number | null | undefined;
23
+ subtotal?: number | null | undefined;
20
24
  };
21
25
 
22
26
  /** @internal */
@@ -30,6 +34,10 @@ export const InvoiceItem$inboundSchema: z.ZodType<
30
34
  date_ends: z.nullable(z.string()).optional(),
31
35
  is_subscription: z.nullable(z.boolean()).optional(),
32
36
  product_title: z.nullable(z.string()).optional(),
37
+ item_title: z.nullable(z.string()).optional(),
38
+ quantity: z.nullable(z.number()).optional(),
39
+ unit_price: z.nullable(z.number().int()).optional(),
40
+ subtotal: z.nullable(z.number().int()).optional(),
33
41
  }).transform((v) => {
34
42
  return remap$(v, {
35
43
  "item_id": "itemId",
@@ -37,6 +45,8 @@ export const InvoiceItem$inboundSchema: z.ZodType<
37
45
  "date_ends": "dateEnds",
38
46
  "is_subscription": "isSubscription",
39
47
  "product_title": "productTitle",
48
+ "item_title": "itemTitle",
49
+ "unit_price": "unitPrice",
40
50
  });
41
51
  });
42
52
 
@@ -47,6 +57,10 @@ export type InvoiceItem$Outbound = {
47
57
  date_ends?: string | null | undefined;
48
58
  is_subscription?: boolean | null | undefined;
49
59
  product_title?: string | null | undefined;
60
+ item_title?: string | null | undefined;
61
+ quantity?: number | null | undefined;
62
+ unit_price?: number | null | undefined;
63
+ subtotal?: number | null | undefined;
50
64
  };
51
65
 
52
66
  /** @internal */
@@ -60,6 +74,10 @@ export const InvoiceItem$outboundSchema: z.ZodType<
60
74
  dateEnds: z.nullable(z.string()).optional(),
61
75
  isSubscription: z.nullable(z.boolean()).optional(),
62
76
  productTitle: z.nullable(z.string()).optional(),
77
+ itemTitle: z.nullable(z.string()).optional(),
78
+ quantity: z.nullable(z.number()).optional(),
79
+ unitPrice: z.nullable(z.number().int()).optional(),
80
+ subtotal: z.nullable(z.number().int()).optional(),
63
81
  }).transform((v) => {
64
82
  return remap$(v, {
65
83
  itemId: "item_id",
@@ -67,6 +85,8 @@ export const InvoiceItem$outboundSchema: z.ZodType<
67
85
  dateEnds: "date_ends",
68
86
  isSubscription: "is_subscription",
69
87
  productTitle: "product_title",
88
+ itemTitle: "item_title",
89
+ unitPrice: "unit_price",
70
90
  });
71
91
  });
72
92
 
@@ -0,0 +1,108 @@
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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ /**
12
+ * Reduced list of attributes of the Invoice transaction record
13
+ */
14
+ export type InvoiceTransaction = {
15
+ dateProcessed?: string | null | undefined;
16
+ payee?: string | null | undefined;
17
+ amount?: number | null | undefined;
18
+ creditId?: number | null | undefined;
19
+ transactionId?: string | null | undefined;
20
+ success?: boolean | null | undefined;
21
+ cardLast4?: string | null | undefined;
22
+ };
23
+
24
+ /** @internal */
25
+ export const InvoiceTransaction$inboundSchema: z.ZodType<
26
+ InvoiceTransaction,
27
+ z.ZodTypeDef,
28
+ unknown
29
+ > = z.object({
30
+ date_processed: z.nullable(z.string()).optional(),
31
+ payee: z.nullable(z.string()).optional(),
32
+ amount: z.nullable(z.number().int()).optional(),
33
+ credit_id: z.nullable(z.number().int()).optional(),
34
+ transaction_id: z.nullable(z.string()).optional(),
35
+ success: z.nullable(z.boolean()).optional(),
36
+ card_last4: z.nullable(z.string()).optional(),
37
+ }).transform((v) => {
38
+ return remap$(v, {
39
+ "date_processed": "dateProcessed",
40
+ "credit_id": "creditId",
41
+ "transaction_id": "transactionId",
42
+ "card_last4": "cardLast4",
43
+ });
44
+ });
45
+
46
+ /** @internal */
47
+ export type InvoiceTransaction$Outbound = {
48
+ date_processed?: string | null | undefined;
49
+ payee?: string | null | undefined;
50
+ amount?: number | null | undefined;
51
+ credit_id?: number | null | undefined;
52
+ transaction_id?: string | null | undefined;
53
+ success?: boolean | null | undefined;
54
+ card_last4?: string | null | undefined;
55
+ };
56
+
57
+ /** @internal */
58
+ export const InvoiceTransaction$outboundSchema: z.ZodType<
59
+ InvoiceTransaction$Outbound,
60
+ z.ZodTypeDef,
61
+ InvoiceTransaction
62
+ > = z.object({
63
+ dateProcessed: z.nullable(z.string()).optional(),
64
+ payee: z.nullable(z.string()).optional(),
65
+ amount: z.nullable(z.number().int()).optional(),
66
+ creditId: z.nullable(z.number().int()).optional(),
67
+ transactionId: z.nullable(z.string()).optional(),
68
+ success: z.nullable(z.boolean()).optional(),
69
+ cardLast4: z.nullable(z.string()).optional(),
70
+ }).transform((v) => {
71
+ return remap$(v, {
72
+ dateProcessed: "date_processed",
73
+ creditId: "credit_id",
74
+ transactionId: "transaction_id",
75
+ cardLast4: "card_last4",
76
+ });
77
+ });
78
+
79
+ /**
80
+ * @internal
81
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
82
+ */
83
+ export namespace InvoiceTransaction$ {
84
+ /** @deprecated use `InvoiceTransaction$inboundSchema` instead. */
85
+ export const inboundSchema = InvoiceTransaction$inboundSchema;
86
+ /** @deprecated use `InvoiceTransaction$outboundSchema` instead. */
87
+ export const outboundSchema = InvoiceTransaction$outboundSchema;
88
+ /** @deprecated use `InvoiceTransaction$Outbound` instead. */
89
+ export type Outbound = InvoiceTransaction$Outbound;
90
+ }
91
+
92
+ export function invoiceTransactionToJSON(
93
+ invoiceTransaction: InvoiceTransaction,
94
+ ): string {
95
+ return JSON.stringify(
96
+ InvoiceTransaction$outboundSchema.parse(invoiceTransaction),
97
+ );
98
+ }
99
+
100
+ export function invoiceTransactionFromJSON(
101
+ jsonString: string,
102
+ ): SafeParseResult<InvoiceTransaction, SDKValidationError> {
103
+ return safeParse(
104
+ jsonString,
105
+ (x) => InvoiceTransaction$inboundSchema.parse(JSON.parse(x)),
106
+ `Failed to parse 'InvoiceTransaction' from JSON`,
107
+ );
108
+ }
@@ -0,0 +1,79 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import * as components from "../components/index.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type GetVendorInvoiceDetailsRequest = {
12
+ /**
13
+ * The identifier of the object
14
+ */
15
+ id: number;
16
+ /**
17
+ * 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.
18
+ */
19
+ expand?: Array<components.Expand> | undefined;
20
+ };
21
+
22
+ /** @internal */
23
+ export const GetVendorInvoiceDetailsRequest$inboundSchema: z.ZodType<
24
+ GetVendorInvoiceDetailsRequest,
25
+ z.ZodTypeDef,
26
+ unknown
27
+ > = z.object({
28
+ id: z.number().int(),
29
+ expand: z.array(components.Expand$inboundSchema).optional(),
30
+ });
31
+
32
+ /** @internal */
33
+ export type GetVendorInvoiceDetailsRequest$Outbound = {
34
+ id: number;
35
+ expand?: Array<string> | undefined;
36
+ };
37
+
38
+ /** @internal */
39
+ export const GetVendorInvoiceDetailsRequest$outboundSchema: z.ZodType<
40
+ GetVendorInvoiceDetailsRequest$Outbound,
41
+ z.ZodTypeDef,
42
+ GetVendorInvoiceDetailsRequest
43
+ > = z.object({
44
+ id: z.number().int(),
45
+ expand: z.array(components.Expand$outboundSchema).optional(),
46
+ });
47
+
48
+ /**
49
+ * @internal
50
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
51
+ */
52
+ export namespace GetVendorInvoiceDetailsRequest$ {
53
+ /** @deprecated use `GetVendorInvoiceDetailsRequest$inboundSchema` instead. */
54
+ export const inboundSchema = GetVendorInvoiceDetailsRequest$inboundSchema;
55
+ /** @deprecated use `GetVendorInvoiceDetailsRequest$outboundSchema` instead. */
56
+ export const outboundSchema = GetVendorInvoiceDetailsRequest$outboundSchema;
57
+ /** @deprecated use `GetVendorInvoiceDetailsRequest$Outbound` instead. */
58
+ export type Outbound = GetVendorInvoiceDetailsRequest$Outbound;
59
+ }
60
+
61
+ export function getVendorInvoiceDetailsRequestToJSON(
62
+ getVendorInvoiceDetailsRequest: GetVendorInvoiceDetailsRequest,
63
+ ): string {
64
+ return JSON.stringify(
65
+ GetVendorInvoiceDetailsRequest$outboundSchema.parse(
66
+ getVendorInvoiceDetailsRequest,
67
+ ),
68
+ );
69
+ }
70
+
71
+ export function getVendorInvoiceDetailsRequestFromJSON(
72
+ jsonString: string,
73
+ ): SafeParseResult<GetVendorInvoiceDetailsRequest, SDKValidationError> {
74
+ return safeParse(
75
+ jsonString,
76
+ (x) => GetVendorInvoiceDetailsRequest$inboundSchema.parse(JSON.parse(x)),
77
+ `Failed to parse 'GetVendorInvoiceDetailsRequest' from JSON`,
78
+ );
79
+ }
@@ -7,6 +7,7 @@ export * from "./expeditetimeremaining.js";
7
7
  export * from "./getfacility.js";
8
8
  export * from "./getsupportarticle.js";
9
9
  export * from "./getuserbyid.js";
10
+ export * from "./getvendorinvoicedetails.js";
10
11
  export * from "./listorsearchfacilities.js";
11
12
  export * from "./listorsearchsupportarticles.js";
12
13
  export * from "./listvendorcredentials.js";
@@ -26,6 +26,14 @@ export type ListOrSearchSupportArticlesRequest = {
26
26
  * Number of items to show in a given page
27
27
  */
28
28
  itemsPerPage?: number | undefined;
29
+ /**
30
+ * Search for objects in the same category as the search string
31
+ */
32
+ category?: string | undefined;
33
+ /**
34
+ * Search for objects by the search string
35
+ */
36
+ search?: string | undefined;
29
37
  };
30
38
 
31
39
  /**
@@ -53,6 +61,8 @@ export const ListOrSearchSupportArticlesRequest$inboundSchema: z.ZodType<
53
61
  desc: components.Desc$inboundSchema.optional(),
54
62
  page: z.number().int().optional(),
55
63
  items_per_page: z.number().int().optional(),
64
+ category: z.string().optional(),
65
+ search: z.string().optional(),
56
66
  }).transform((v) => {
57
67
  return remap$(v, {
58
68
  "items_per_page": "itemsPerPage",
@@ -65,6 +75,8 @@ export type ListOrSearchSupportArticlesRequest$Outbound = {
65
75
  desc?: components.Desc$Outbound | undefined;
66
76
  page?: number | undefined;
67
77
  items_per_page?: number | undefined;
78
+ category?: string | undefined;
79
+ search?: string | undefined;
68
80
  };
69
81
 
70
82
  /** @internal */
@@ -77,6 +89,8 @@ export const ListOrSearchSupportArticlesRequest$outboundSchema: z.ZodType<
77
89
  desc: components.Desc$outboundSchema.optional(),
78
90
  page: z.number().int().optional(),
79
91
  itemsPerPage: z.number().int().optional(),
92
+ category: z.string().optional(),
93
+ search: z.string().optional(),
80
94
  }).transform((v) => {
81
95
  return remap$(v, {
82
96
  itemsPerPage: "items_per_page",
@@ -17,6 +17,7 @@ export * from "./usersPassword.js";
17
17
  export * from "./usersPasswordResetRequest.js";
18
18
  export * from "./vendorsCreateVendorRegistration.js";
19
19
  export * from "./vendorsExpediteTimeRemaining.js";
20
+ export * from "./vendorsGetVendorInvoiceDetails.js";
20
21
  export * from "./vendorsListVendorCredentials.js";
21
22
  export * from "./vendorsListVendorInvoices.js";
22
23
  export * from "./vendorsListVendorJobTitles.js";