@clientcasa/sdk 0.6.5 → 0.7.1

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 (182) hide show
  1. package/README.md +7 -0
  2. package/esm/funcs/payments-list.js +1 -0
  3. package/esm/funcs/payments-list.js.map +1 -1
  4. package/esm/funcs/sales-get.d.ts +16 -0
  5. package/esm/funcs/sales-get.d.ts.map +1 -0
  6. package/esm/funcs/sales-get.js +107 -0
  7. package/esm/funcs/sales-get.js.map +1 -0
  8. package/esm/funcs/sales-list.d.ts +18 -0
  9. package/esm/funcs/sales-list.d.ts.map +1 -0
  10. package/esm/funcs/sales-list.js +141 -0
  11. package/esm/funcs/sales-list.js.map +1 -0
  12. package/esm/funcs/transactions-create.d.ts +3 -0
  13. package/esm/funcs/transactions-create.d.ts.map +1 -1
  14. package/esm/funcs/transactions-create.js +3 -0
  15. package/esm/funcs/transactions-create.js.map +1 -1
  16. package/esm/funcs/transactions-update.d.ts +1 -1
  17. package/esm/funcs/transactions-update.js +1 -1
  18. package/esm/lib/config.d.ts +3 -3
  19. package/esm/lib/config.js +3 -3
  20. package/esm/lib/encodings.d.ts +10 -9
  21. package/esm/lib/encodings.d.ts.map +1 -1
  22. package/esm/lib/encodings.js +29 -13
  23. package/esm/lib/encodings.js.map +1 -1
  24. package/esm/models/api-error.d.ts +25 -3
  25. package/esm/models/api-error.d.ts.map +1 -1
  26. package/esm/models/api-error.js +25 -1
  27. package/esm/models/api-error.js.map +1 -1
  28. package/esm/models/catalog-item-create.d.ts +5 -0
  29. package/esm/models/catalog-item-create.d.ts.map +1 -1
  30. package/esm/models/catalog-item-create.js +1 -0
  31. package/esm/models/catalog-item-create.js.map +1 -1
  32. package/esm/models/catalog-item-update.d.ts +4 -4
  33. package/esm/models/catalog-item-update.d.ts.map +1 -1
  34. package/esm/models/catalog-item-update.js +4 -4
  35. package/esm/models/catalog-item-update.js.map +1 -1
  36. package/esm/models/catalog-item.d.ts +4 -0
  37. package/esm/models/catalog-item.d.ts.map +1 -1
  38. package/esm/models/catalog-item.js +1 -0
  39. package/esm/models/catalog-item.js.map +1 -1
  40. package/esm/models/client-create.d.ts +5 -0
  41. package/esm/models/client-create.d.ts.map +1 -1
  42. package/esm/models/client-create.js +1 -0
  43. package/esm/models/client-create.js.map +1 -1
  44. package/esm/models/client-update.d.ts +1 -1
  45. package/esm/models/client-update.d.ts.map +1 -1
  46. package/esm/models/client-update.js +1 -1
  47. package/esm/models/client-update.js.map +1 -1
  48. package/esm/models/client.d.ts +4 -0
  49. package/esm/models/client.d.ts.map +1 -1
  50. package/esm/models/client.js +1 -0
  51. package/esm/models/client.js.map +1 -1
  52. package/esm/models/contact-update.d.ts +2 -2
  53. package/esm/models/contact-update.d.ts.map +1 -1
  54. package/esm/models/contact-update.js +2 -2
  55. package/esm/models/contact-update.js.map +1 -1
  56. package/esm/models/index.d.ts +2 -0
  57. package/esm/models/index.d.ts.map +1 -1
  58. package/esm/models/index.js +2 -0
  59. package/esm/models/index.js.map +1 -1
  60. package/esm/models/operations/get-sale.d.ts +27 -0
  61. package/esm/models/operations/get-sale.d.ts.map +1 -0
  62. package/esm/models/operations/get-sale.js +20 -0
  63. package/esm/models/operations/get-sale.js.map +1 -0
  64. package/esm/models/operations/index.d.ts +2 -0
  65. package/esm/models/operations/index.d.ts.map +1 -1
  66. package/esm/models/operations/index.js +2 -0
  67. package/esm/models/operations/index.js.map +1 -1
  68. package/esm/models/operations/list-payments.d.ts +5 -0
  69. package/esm/models/operations/list-payments.d.ts.map +1 -1
  70. package/esm/models/operations/list-payments.js +1 -0
  71. package/esm/models/operations/list-payments.js.map +1 -1
  72. package/esm/models/operations/list-sales.d.ts +75 -0
  73. package/esm/models/operations/list-sales.d.ts.map +1 -0
  74. package/esm/models/operations/list-sales.js +60 -0
  75. package/esm/models/operations/list-sales.js.map +1 -0
  76. package/esm/models/operations/list-webhooks.d.ts +15 -2
  77. package/esm/models/operations/list-webhooks.d.ts.map +1 -1
  78. package/esm/models/operations/list-webhooks.js +15 -2
  79. package/esm/models/operations/list-webhooks.js.map +1 -1
  80. package/esm/models/payment.d.ts +5 -1
  81. package/esm/models/payment.d.ts.map +1 -1
  82. package/esm/models/payment.js +2 -1
  83. package/esm/models/payment.js.map +1 -1
  84. package/esm/models/project-update.d.ts +1 -1
  85. package/esm/models/project-update.d.ts.map +1 -1
  86. package/esm/models/project-update.js +1 -1
  87. package/esm/models/project-update.js.map +1 -1
  88. package/esm/models/project.d.ts +5 -1
  89. package/esm/models/project.d.ts.map +1 -1
  90. package/esm/models/project.js +2 -1
  91. package/esm/models/project.js.map +1 -1
  92. package/esm/models/sale-list.d.ts +13 -0
  93. package/esm/models/sale-list.d.ts.map +1 -0
  94. package/esm/models/sale-list.js +17 -0
  95. package/esm/models/sale-list.js.map +1 -0
  96. package/esm/models/sale.d.ts +76 -0
  97. package/esm/models/sale.d.ts.map +1 -0
  98. package/esm/models/sale.js +58 -0
  99. package/esm/models/sale.js.map +1 -0
  100. package/esm/models/time-entry-update.d.ts +2 -2
  101. package/esm/models/time-entry-update.d.ts.map +1 -1
  102. package/esm/models/time-entry-update.js +2 -2
  103. package/esm/models/time-entry-update.js.map +1 -1
  104. package/esm/models/time-entry.d.ts +3 -3
  105. package/esm/models/time-entry.d.ts.map +1 -1
  106. package/esm/models/time-entry.js +3 -3
  107. package/esm/models/time-entry.js.map +1 -1
  108. package/esm/models/transaction-create.d.ts +5 -0
  109. package/esm/models/transaction-create.d.ts.map +1 -1
  110. package/esm/models/transaction-create.js +1 -0
  111. package/esm/models/transaction-create.js.map +1 -1
  112. package/esm/models/transaction-update.d.ts +3 -3
  113. package/esm/models/transaction-update.d.ts.map +1 -1
  114. package/esm/models/transaction-update.js +3 -3
  115. package/esm/models/transaction-update.js.map +1 -1
  116. package/esm/models/transaction.d.ts +4 -0
  117. package/esm/models/transaction.d.ts.map +1 -1
  118. package/esm/models/transaction.js +1 -0
  119. package/esm/models/transaction.js.map +1 -1
  120. package/esm/models/webhook-create.d.ts +15 -2
  121. package/esm/models/webhook-create.d.ts.map +1 -1
  122. package/esm/models/webhook-create.js +15 -2
  123. package/esm/models/webhook-create.js.map +1 -1
  124. package/esm/models/webhook-update.d.ts +15 -2
  125. package/esm/models/webhook-update.d.ts.map +1 -1
  126. package/esm/models/webhook-update.js +15 -2
  127. package/esm/models/webhook-update.js.map +1 -1
  128. package/esm/models/webhook.d.ts +15 -2
  129. package/esm/models/webhook.d.ts.map +1 -1
  130. package/esm/models/webhook.js +15 -2
  131. package/esm/models/webhook.js.map +1 -1
  132. package/esm/sdk/sales.d.ts +17 -0
  133. package/esm/sdk/sales.d.ts.map +1 -0
  134. package/esm/sdk/sales.js +23 -0
  135. package/esm/sdk/sales.js.map +1 -0
  136. package/esm/sdk/sdk.d.ts +3 -0
  137. package/esm/sdk/sdk.d.ts.map +1 -1
  138. package/esm/sdk/sdk.js +5 -0
  139. package/esm/sdk/sdk.js.map +1 -1
  140. package/esm/sdk/transactions.d.ts +4 -1
  141. package/esm/sdk/transactions.d.ts.map +1 -1
  142. package/esm/sdk/transactions.js +4 -1
  143. package/esm/sdk/transactions.js.map +1 -1
  144. package/jsr.json +1 -1
  145. package/package.json +2 -2
  146. package/src/funcs/payments-list.ts +1 -0
  147. package/src/funcs/sales-get.ts +202 -0
  148. package/src/funcs/sales-list.ts +277 -0
  149. package/src/funcs/transactions-create.ts +3 -0
  150. package/src/funcs/transactions-update.ts +1 -1
  151. package/src/lib/config.ts +3 -3
  152. package/src/lib/encodings.ts +58 -23
  153. package/src/models/api-error.ts +46 -2
  154. package/src/models/catalog-item-create.ts +6 -0
  155. package/src/models/catalog-item-update.ts +8 -9
  156. package/src/models/catalog-item.ts +5 -0
  157. package/src/models/client-create.ts +6 -0
  158. package/src/models/client-update.ts +2 -2
  159. package/src/models/client.ts +5 -0
  160. package/src/models/contact-update.ts +4 -4
  161. package/src/models/index.ts +2 -0
  162. package/src/models/operations/get-sale.ts +55 -0
  163. package/src/models/operations/index.ts +2 -0
  164. package/src/models/operations/list-payments.ts +6 -0
  165. package/src/models/operations/list-sales.ts +159 -0
  166. package/src/models/operations/list-webhooks.ts +15 -2
  167. package/src/models/payment.ts +7 -2
  168. package/src/models/project-update.ts +2 -2
  169. package/src/models/project.ts +7 -2
  170. package/src/models/sale-list.ts +35 -0
  171. package/src/models/sale.ts +124 -0
  172. package/src/models/time-entry-update.ts +4 -4
  173. package/src/models/time-entry.ts +6 -6
  174. package/src/models/transaction-create.ts +6 -0
  175. package/src/models/transaction-update.ts +6 -6
  176. package/src/models/transaction.ts +5 -0
  177. package/src/models/webhook-create.ts +15 -2
  178. package/src/models/webhook-update.ts +15 -2
  179. package/src/models/webhook.ts +15 -2
  180. package/src/sdk/sales.ts +45 -0
  181. package/src/sdk/sdk.ts +6 -0
  182. package/src/sdk/transactions.ts +4 -1
@@ -0,0 +1,159 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdk-validation-error.js";
11
+ import * as models from "../index.js";
12
+
13
+ export type ListSalesSecurity = {
14
+ apiKey?: string | undefined;
15
+ bearer?: string | undefined;
16
+ };
17
+
18
+ export const ListSalesStatus = {
19
+ Completed: "completed",
20
+ Refunded: "refunded",
21
+ PartiallyRefunded: "partially-refunded",
22
+ Voided: "voided",
23
+ } as const;
24
+ export type ListSalesStatus = ClosedEnum<typeof ListSalesStatus>;
25
+
26
+ export const Channel = {
27
+ Pos: "pos",
28
+ Manual: "manual",
29
+ Stripe: "stripe",
30
+ Shopify: "shopify",
31
+ Etsy: "etsy",
32
+ SquareImport: "square-import",
33
+ Api: "api",
34
+ } as const;
35
+ export type Channel = ClosedEnum<typeof Channel>;
36
+
37
+ export type ListSalesRequest = {
38
+ page?: number | undefined;
39
+ pageSize?: number | undefined;
40
+ status?: ListSalesStatus | undefined;
41
+ channel?: Channel | undefined;
42
+ /**
43
+ * UUID v4
44
+ */
45
+ clientId?: string | undefined;
46
+ /**
47
+ * UUID v4
48
+ */
49
+ businessId?: string | undefined;
50
+ saleDateFrom?: Date | undefined;
51
+ saleDateTo?: Date | undefined;
52
+ };
53
+
54
+ export type ListSalesResponse = {
55
+ result: models.SaleList;
56
+ };
57
+
58
+ /** @internal */
59
+ export type ListSalesSecurity$Outbound = {
60
+ apiKey?: string | undefined;
61
+ bearer?: string | undefined;
62
+ };
63
+
64
+ /** @internal */
65
+ export const ListSalesSecurity$outboundSchema: z.ZodMiniType<
66
+ ListSalesSecurity$Outbound,
67
+ ListSalesSecurity
68
+ > = z.object({
69
+ apiKey: z.optional(z.string()),
70
+ bearer: z.optional(z.string()),
71
+ });
72
+
73
+ export function listSalesSecurityToJSON(
74
+ listSalesSecurity: ListSalesSecurity,
75
+ ): string {
76
+ return JSON.stringify(
77
+ ListSalesSecurity$outboundSchema.parse(listSalesSecurity),
78
+ );
79
+ }
80
+
81
+ /** @internal */
82
+ export const ListSalesStatus$outboundSchema: z.ZodMiniEnum<
83
+ typeof ListSalesStatus
84
+ > = z.enum(ListSalesStatus);
85
+
86
+ /** @internal */
87
+ export const Channel$outboundSchema: z.ZodMiniEnum<typeof Channel> = z.enum(
88
+ Channel,
89
+ );
90
+
91
+ /** @internal */
92
+ export type ListSalesRequest$Outbound = {
93
+ page: number;
94
+ pageSize: number;
95
+ status?: string | undefined;
96
+ channel?: string | undefined;
97
+ clientId?: string | undefined;
98
+ businessId?: string | undefined;
99
+ saleDateFrom?: string | undefined;
100
+ saleDateTo?: string | undefined;
101
+ };
102
+
103
+ /** @internal */
104
+ export const ListSalesRequest$outboundSchema: z.ZodMiniType<
105
+ ListSalesRequest$Outbound,
106
+ ListSalesRequest
107
+ > = z.object({
108
+ page: z._default(z.int(), 1),
109
+ pageSize: z._default(z.int(), 25),
110
+ status: z.optional(ListSalesStatus$outboundSchema),
111
+ channel: z.optional(Channel$outboundSchema),
112
+ clientId: z.optional(z.string()),
113
+ businessId: z.optional(z.string()),
114
+ saleDateFrom: z.optional(
115
+ z.pipe(
116
+ z.date(),
117
+ z.transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)),
118
+ ),
119
+ ),
120
+ saleDateTo: z.optional(
121
+ z.pipe(
122
+ z.date(),
123
+ z.transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)),
124
+ ),
125
+ ),
126
+ });
127
+
128
+ export function listSalesRequestToJSON(
129
+ listSalesRequest: ListSalesRequest,
130
+ ): string {
131
+ return JSON.stringify(
132
+ ListSalesRequest$outboundSchema.parse(listSalesRequest),
133
+ );
134
+ }
135
+
136
+ /** @internal */
137
+ export const ListSalesResponse$inboundSchema: z.ZodMiniType<
138
+ ListSalesResponse,
139
+ unknown
140
+ > = z.pipe(
141
+ z.object({
142
+ Result: models.SaleList$inboundSchema,
143
+ }),
144
+ z.transform((v) => {
145
+ return remap$(v, {
146
+ "Result": "result",
147
+ });
148
+ }),
149
+ );
150
+
151
+ export function listSalesResponseFromJSON(
152
+ jsonString: string,
153
+ ): SafeParseResult<ListSalesResponse, SDKValidationError> {
154
+ return safeParse(
155
+ jsonString,
156
+ (x) => ListSalesResponse$inboundSchema.parse(JSON.parse(x)),
157
+ `Failed to parse 'ListSalesResponse' from JSON`,
158
+ );
159
+ }
@@ -23,7 +23,6 @@ export const Event = {
23
23
  InvoicePaymentFailed: "invoice_payment_failed",
24
24
  InvoiceDisputed: "invoice_disputed",
25
25
  InvoicePaymentReminder: "invoice_payment_reminder",
26
- InvoiceViewed: "invoice_viewed",
27
26
  PaymentReceived: "payment_received",
28
27
  PaymentRefunded: "payment_refunded",
29
28
  PaymentApplied: "payment_applied",
@@ -48,6 +47,7 @@ export const Event = {
48
47
  ClientWon: "client_won",
49
48
  ClientLost: "client_lost",
50
49
  LeadStatusChanged: "lead_status_changed",
50
+ InvoiceViewed: "invoice_viewed",
51
51
  MilestoneApproaching: "milestone_approaching",
52
52
  TimerRunningReminder: "timer_running_reminder",
53
53
  ContractSent: "contract_sent",
@@ -58,12 +58,12 @@ export const Event = {
58
58
  ContractCompleted: "contract_completed",
59
59
  ContractExpired: "contract_expired",
60
60
  ContractVoided: "contract_voided",
61
+ FormSubmissionCompleted: "form_submission_completed",
61
62
  SmartFileSent: "smart_file_sent",
62
63
  SmartFileViewed: "smart_file_viewed",
63
64
  SmartFileAccepted: "smart_file_accepted",
64
65
  SmartFileCompleted: "smart_file_completed",
65
66
  SmartFileExpired: "smart_file_expired",
66
- FormSubmissionCompleted: "form_submission_completed",
67
67
  SubscriptionPaymentFailed: "subscription_payment_failed",
68
68
  PayoutPaid: "payout_paid",
69
69
  PayoutFailed: "payout_failed",
@@ -72,6 +72,19 @@ export const Event = {
72
72
  EventDayArchived: "event_day_archived",
73
73
  TimelineItemCompleted: "timeline_item_completed",
74
74
  TimelineReminderSent: "timeline_reminder_sent",
75
+ InvoiceRefunded: "invoice_refunded",
76
+ ContractAmended: "contract_amended",
77
+ ReceiptViewed: "receipt_viewed",
78
+ FollowUpDue: "follow_up_due",
79
+ PaymentProcessing: "payment_processing",
80
+ ClientReply: "client_reply",
81
+ ClientRevisionRequested: "client_revision_requested",
82
+ EmailDeliveryFailed: "email_delivery_failed",
83
+ SaleCompleted: "sale_completed",
84
+ SaleRefunded: "sale_refunded",
85
+ SaleVoided: "sale_voided",
86
+ SaleReceiptSent: "sale_receipt_sent",
87
+ SaleViewed: "sale_viewed",
75
88
  } as const;
76
89
  export type Event = ClosedEnum<typeof Event>;
77
90
 
@@ -48,11 +48,15 @@ export type Payment = {
48
48
  /**
49
49
  * UUID v4
50
50
  */
51
- clientId: string;
51
+ clientId: string | null;
52
52
  /**
53
53
  * UUID v4
54
54
  */
55
55
  invoiceId: string | null;
56
+ /**
57
+ * UUID v4
58
+ */
59
+ saleId: string | null;
56
60
  amount: number;
57
61
  currency: string;
58
62
  receivedDate: Date;
@@ -99,8 +103,9 @@ export const PaymentKind$inboundSchema: z.ZodMiniType<PaymentKind, unknown> =
99
103
  /** @internal */
100
104
  export const Payment$inboundSchema: z.ZodMiniType<Payment, unknown> = z.object({
101
105
  id: types.string(),
102
- clientId: types.string(),
106
+ clientId: types.nullable(types.string()),
103
107
  invoiceId: types.nullable(types.string()),
108
+ saleId: types.nullable(types.string()),
104
109
  amount: types.number(),
105
110
  currency: types.string(),
106
111
  receivedDate: types.date(),
@@ -38,7 +38,7 @@ export const ProjectUpdateStatus$outboundSchema: z.ZodMiniEnum<
38
38
  export type ProjectUpdate$Outbound = {
39
39
  name?: string | undefined;
40
40
  clientId?: string | undefined;
41
- status: string;
41
+ status?: string | undefined;
42
42
  pipelineStageId?: string | undefined;
43
43
  startDate?: string | undefined;
44
44
  endDate?: string | undefined;
@@ -53,7 +53,7 @@ export const ProjectUpdate$outboundSchema: z.ZodMiniType<
53
53
  > = z.object({
54
54
  name: z.optional(z.string()),
55
55
  clientId: z.optional(z.string()),
56
- status: z._default(ProjectUpdateStatus$outboundSchema, "active"),
56
+ status: z.optional(ProjectUpdateStatus$outboundSchema),
57
57
  pipelineStageId: z.optional(z.string()),
58
58
  startDate: z.optional(
59
59
  z.pipe(
@@ -26,7 +26,11 @@ export type Project = {
26
26
  /**
27
27
  * UUID v4
28
28
  */
29
- clientId: string;
29
+ clientId: string | null;
30
+ /**
31
+ * UUID v4
32
+ */
33
+ businessId: string;
30
34
  status: ProjectStatus;
31
35
  /**
32
36
  * UUID v4
@@ -56,7 +60,8 @@ export const ProjectStatus$inboundSchema: z.ZodMiniType<
56
60
  export const Project$inboundSchema: z.ZodMiniType<Project, unknown> = z.object({
57
61
  id: types.string(),
58
62
  name: types.string(),
59
- clientId: types.string(),
63
+ clientId: types.nullable(types.string()),
64
+ businessId: types.string(),
60
65
  status: ProjectStatus$inboundSchema,
61
66
  pipelineStageId: types.nullable(types.string()),
62
67
  startDate: types.nullable(types.date()),
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../types/fp.js";
8
+ import { SDKValidationError } from "./errors/sdk-validation-error.js";
9
+ import {
10
+ PaginationMeta,
11
+ PaginationMeta$inboundSchema,
12
+ } from "./pagination-meta.js";
13
+ import { Sale, Sale$inboundSchema } from "./sale.js";
14
+
15
+ export type SaleList = {
16
+ data: Array<Sale>;
17
+ pagination: PaginationMeta;
18
+ };
19
+
20
+ /** @internal */
21
+ export const SaleList$inboundSchema: z.ZodMiniType<SaleList, unknown> = z
22
+ .object({
23
+ data: z.array(Sale$inboundSchema),
24
+ pagination: PaginationMeta$inboundSchema,
25
+ });
26
+
27
+ export function saleListFromJSON(
28
+ jsonString: string,
29
+ ): SafeParseResult<SaleList, SDKValidationError> {
30
+ return safeParse(
31
+ jsonString,
32
+ (x) => SaleList$inboundSchema.parse(JSON.parse(x)),
33
+ `Failed to parse 'SaleList' from JSON`,
34
+ );
35
+ }
@@ -0,0 +1,124 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import * as openEnums from "../types/enums.js";
8
+ import { OpenEnum } from "../types/enums.js";
9
+ import { Result as SafeParseResult } from "../types/fp.js";
10
+ import * as types from "../types/primitives.js";
11
+ import { SDKValidationError } from "./errors/sdk-validation-error.js";
12
+
13
+ export const Channel = {
14
+ Pos: "pos",
15
+ Manual: "manual",
16
+ Stripe: "stripe",
17
+ Shopify: "shopify",
18
+ Etsy: "etsy",
19
+ SquareImport: "square-import",
20
+ Api: "api",
21
+ } as const;
22
+ export type Channel = OpenEnum<typeof Channel>;
23
+
24
+ export const SaleStatus = {
25
+ Completed: "completed",
26
+ Refunded: "refunded",
27
+ PartiallyRefunded: "partially-refunded",
28
+ Voided: "voided",
29
+ } as const;
30
+ export type SaleStatus = OpenEnum<typeof SaleStatus>;
31
+
32
+ export type Sale = {
33
+ /**
34
+ * UUID v4
35
+ */
36
+ id: string;
37
+ saleNumber: string;
38
+ /**
39
+ * UUID v4
40
+ */
41
+ businessId: string | null;
42
+ /**
43
+ * UUID v4
44
+ */
45
+ clientId: string | null;
46
+ /**
47
+ * UUID v4
48
+ */
49
+ contactId: string | null;
50
+ channel: Channel;
51
+ externalId: string | null;
52
+ saleDate: Date;
53
+ currency: string;
54
+ status: SaleStatus;
55
+ /**
56
+ * ISO 8601 timestamp (UTC)
57
+ */
58
+ voidedAt: Date | null;
59
+ voidReason: string | null;
60
+ taxJurisdiction: string | null;
61
+ taxInclusive: boolean;
62
+ subtotal: number | null;
63
+ discountPercent: number | null;
64
+ discountAmount: number | null;
65
+ taxRate: number | null;
66
+ taxAmount: number | null;
67
+ total: number | null;
68
+ amountRefunded: number;
69
+ notes: string | null;
70
+ /**
71
+ * ISO 8601 timestamp (UTC)
72
+ */
73
+ createdAt: Date;
74
+ /**
75
+ * ISO 8601 timestamp (UTC)
76
+ */
77
+ updatedAt: Date;
78
+ };
79
+
80
+ /** @internal */
81
+ export const Channel$inboundSchema: z.ZodMiniType<Channel, unknown> = openEnums
82
+ .inboundSchema(Channel);
83
+
84
+ /** @internal */
85
+ export const SaleStatus$inboundSchema: z.ZodMiniType<SaleStatus, unknown> =
86
+ openEnums.inboundSchema(SaleStatus);
87
+
88
+ /** @internal */
89
+ export const Sale$inboundSchema: z.ZodMiniType<Sale, unknown> = z.object({
90
+ id: types.string(),
91
+ saleNumber: types.string(),
92
+ businessId: types.nullable(types.string()),
93
+ clientId: types.nullable(types.string()),
94
+ contactId: types.nullable(types.string()),
95
+ channel: Channel$inboundSchema,
96
+ externalId: types.nullable(types.string()),
97
+ saleDate: types.date(),
98
+ currency: types.string(),
99
+ status: SaleStatus$inboundSchema,
100
+ voidedAt: types.nullable(types.date()),
101
+ voidReason: types.nullable(types.string()),
102
+ taxJurisdiction: types.nullable(types.string()),
103
+ taxInclusive: types.boolean(),
104
+ subtotal: types.nullable(types.number()),
105
+ discountPercent: types.nullable(types.number()),
106
+ discountAmount: types.nullable(types.number()),
107
+ taxRate: types.nullable(types.number()),
108
+ taxAmount: types.nullable(types.number()),
109
+ total: types.nullable(types.number()),
110
+ amountRefunded: types.number(),
111
+ notes: types.nullable(types.string()),
112
+ createdAt: types.date(),
113
+ updatedAt: types.date(),
114
+ });
115
+
116
+ export function saleFromJSON(
117
+ jsonString: string,
118
+ ): SafeParseResult<Sale, SDKValidationError> {
119
+ return safeParse(
120
+ jsonString,
121
+ (x) => Sale$inboundSchema.parse(JSON.parse(x)),
122
+ `Failed to parse 'Sale' from JSON`,
123
+ );
124
+ }
@@ -51,8 +51,8 @@ export type TimeEntryUpdate$Outbound = {
51
51
  date?: string | undefined;
52
52
  hours?: number | undefined;
53
53
  description?: string | undefined;
54
- billable: boolean;
55
- rateType: string;
54
+ billable?: boolean | undefined;
55
+ rateType?: string | undefined;
56
56
  customMultiplierName?: string | undefined;
57
57
  rateOverride?: number | undefined;
58
58
  workerName?: string | undefined;
@@ -74,8 +74,8 @@ export const TimeEntryUpdate$outboundSchema: z.ZodMiniType<
74
74
  ),
75
75
  hours: z.optional(z.number()),
76
76
  description: z.optional(z.string()),
77
- billable: z._default(z.boolean(), true),
78
- rateType: z._default(TimeEntryUpdateRateType$outboundSchema, "standard"),
77
+ billable: z.optional(z.boolean()),
78
+ rateType: z.optional(TimeEntryUpdateRateType$outboundSchema),
79
79
  customMultiplierName: z.optional(z.string()),
80
80
  rateOverride: z.optional(z.number()),
81
81
  workerName: z.optional(z.string()),
@@ -26,15 +26,15 @@ export type TimeEntry = {
26
26
  /**
27
27
  * UUID v4
28
28
  */
29
- projectId: string;
29
+ projectId: string | null;
30
30
  /**
31
31
  * UUID v4
32
32
  */
33
- clientId: string;
33
+ clientId: string | null;
34
34
  /**
35
35
  * UUID v4
36
36
  */
37
- memberId: string;
37
+ memberId: string | null;
38
38
  /**
39
39
  * UUID v4
40
40
  */
@@ -68,9 +68,9 @@ export const TimeEntryRateType$inboundSchema: z.ZodMiniType<
68
68
  export const TimeEntry$inboundSchema: z.ZodMiniType<TimeEntry, unknown> = z
69
69
  .object({
70
70
  id: types.string(),
71
- projectId: types.string(),
72
- clientId: types.string(),
73
- memberId: types.string(),
71
+ projectId: types.nullable(types.string()),
72
+ clientId: types.nullable(types.string()),
73
+ memberId: types.nullable(types.string()),
74
74
  catalogItemId: types.nullable(types.string()),
75
75
  date: types.date(),
76
76
  hours: types.number(),
@@ -57,6 +57,10 @@ export type TransactionCreateStatus = ClosedEnum<
57
57
 
58
58
  export type TransactionCreate = {
59
59
  name: string;
60
+ /**
61
+ * UUID v4
62
+ */
63
+ businessId?: string | undefined;
60
64
  /**
61
65
  * UUID v4
62
66
  */
@@ -150,6 +154,7 @@ export const TransactionCreateStatus$outboundSchema: z.ZodMiniEnum<
150
154
  /** @internal */
151
155
  export type TransactionCreate$Outbound = {
152
156
  name: string;
157
+ businessId?: string | undefined;
153
158
  catalogItemId?: string | undefined;
154
159
  taxCategoryId?: string | undefined;
155
160
  amount: number;
@@ -175,6 +180,7 @@ export const TransactionCreate$outboundSchema: z.ZodMiniType<
175
180
  TransactionCreate
176
181
  > = z.object({
177
182
  name: z.string(),
183
+ businessId: z.optional(z.string()),
178
184
  catalogItemId: z.optional(z.string()),
179
185
  taxCategoryId: z.optional(z.string()),
180
186
  amount: z.number(),
@@ -153,9 +153,9 @@ export type TransactionUpdate$Outbound = {
153
153
  catalogItemId?: string | undefined;
154
154
  taxCategoryId?: string | undefined;
155
155
  amount?: number | undefined;
156
- frequency: string;
156
+ frequency?: string | undefined;
157
157
  direction?: string | undefined;
158
- mode: string;
158
+ mode?: string | undefined;
159
159
  splitEvenly?: boolean | undefined;
160
160
  assignments?: Array<TransactionUpdateAssignment$Outbound> | undefined;
161
161
  passThrough?: boolean | undefined;
@@ -166,7 +166,7 @@ export type TransactionUpdate$Outbound = {
166
166
  vendorName?: string | undefined;
167
167
  vendorEmail?: string | undefined;
168
168
  vendorTaxId?: string | undefined;
169
- status: string;
169
+ status?: string | undefined;
170
170
  };
171
171
 
172
172
  /** @internal */
@@ -178,9 +178,9 @@ export const TransactionUpdate$outboundSchema: z.ZodMiniType<
178
178
  catalogItemId: z.optional(z.string()),
179
179
  taxCategoryId: z.optional(z.string()),
180
180
  amount: z.optional(z.number()),
181
- frequency: z._default(TransactionUpdateFrequency$outboundSchema, "one-time"),
181
+ frequency: z.optional(TransactionUpdateFrequency$outboundSchema),
182
182
  direction: z.optional(TransactionUpdateDirection$outboundSchema),
183
- mode: z._default(TransactionUpdateMode$outboundSchema, "each"),
183
+ mode: z.optional(TransactionUpdateMode$outboundSchema),
184
184
  splitEvenly: z.optional(z.boolean()),
185
185
  assignments: z.optional(
186
186
  z.array(z.lazy(() => TransactionUpdateAssignment$outboundSchema)),
@@ -203,7 +203,7 @@ export const TransactionUpdate$outboundSchema: z.ZodMiniType<
203
203
  vendorName: z.optional(z.string()),
204
204
  vendorEmail: z.optional(z.string()),
205
205
  vendorTaxId: z.optional(z.string()),
206
- status: z._default(TransactionUpdateStatus$outboundSchema, "active"),
206
+ status: z.optional(TransactionUpdateStatus$outboundSchema),
207
207
  });
208
208
 
209
209
  export function transactionUpdateToJSON(
@@ -60,6 +60,10 @@ export type Transaction = {
60
60
  */
61
61
  id: string;
62
62
  name: string;
63
+ /**
64
+ * UUID v4
65
+ */
66
+ businessId: string;
63
67
  /**
64
68
  * UUID v4
65
69
  */
@@ -148,6 +152,7 @@ export const Transaction$inboundSchema: z.ZodMiniType<Transaction, unknown> = z
148
152
  .object({
149
153
  id: types.string(),
150
154
  name: types.string(),
155
+ businessId: types.string(),
151
156
  catalogItemId: types.nullable(types.string()),
152
157
  taxCategoryId: types.nullable(types.string()),
153
158
  amount: types.nullable(types.number()),
@@ -13,7 +13,6 @@ export const WebhookCreateEvent = {
13
13
  InvoicePaymentFailed: "invoice_payment_failed",
14
14
  InvoiceDisputed: "invoice_disputed",
15
15
  InvoicePaymentReminder: "invoice_payment_reminder",
16
- InvoiceViewed: "invoice_viewed",
17
16
  PaymentReceived: "payment_received",
18
17
  PaymentRefunded: "payment_refunded",
19
18
  PaymentApplied: "payment_applied",
@@ -38,6 +37,7 @@ export const WebhookCreateEvent = {
38
37
  ClientWon: "client_won",
39
38
  ClientLost: "client_lost",
40
39
  LeadStatusChanged: "lead_status_changed",
40
+ InvoiceViewed: "invoice_viewed",
41
41
  MilestoneApproaching: "milestone_approaching",
42
42
  TimerRunningReminder: "timer_running_reminder",
43
43
  ContractSent: "contract_sent",
@@ -48,12 +48,12 @@ export const WebhookCreateEvent = {
48
48
  ContractCompleted: "contract_completed",
49
49
  ContractExpired: "contract_expired",
50
50
  ContractVoided: "contract_voided",
51
+ FormSubmissionCompleted: "form_submission_completed",
51
52
  SmartFileSent: "smart_file_sent",
52
53
  SmartFileViewed: "smart_file_viewed",
53
54
  SmartFileAccepted: "smart_file_accepted",
54
55
  SmartFileCompleted: "smart_file_completed",
55
56
  SmartFileExpired: "smart_file_expired",
56
- FormSubmissionCompleted: "form_submission_completed",
57
57
  SubscriptionPaymentFailed: "subscription_payment_failed",
58
58
  PayoutPaid: "payout_paid",
59
59
  PayoutFailed: "payout_failed",
@@ -62,6 +62,19 @@ export const WebhookCreateEvent = {
62
62
  EventDayArchived: "event_day_archived",
63
63
  TimelineItemCompleted: "timeline_item_completed",
64
64
  TimelineReminderSent: "timeline_reminder_sent",
65
+ InvoiceRefunded: "invoice_refunded",
66
+ ContractAmended: "contract_amended",
67
+ ReceiptViewed: "receipt_viewed",
68
+ FollowUpDue: "follow_up_due",
69
+ PaymentProcessing: "payment_processing",
70
+ ClientReply: "client_reply",
71
+ ClientRevisionRequested: "client_revision_requested",
72
+ EmailDeliveryFailed: "email_delivery_failed",
73
+ SaleCompleted: "sale_completed",
74
+ SaleRefunded: "sale_refunded",
75
+ SaleVoided: "sale_voided",
76
+ SaleReceiptSent: "sale_receipt_sent",
77
+ SaleViewed: "sale_viewed",
65
78
  } as const;
66
79
  export type WebhookCreateEvent = ClosedEnum<typeof WebhookCreateEvent>;
67
80
 
@@ -13,7 +13,6 @@ export const WebhookUpdateEvent = {
13
13
  InvoicePaymentFailed: "invoice_payment_failed",
14
14
  InvoiceDisputed: "invoice_disputed",
15
15
  InvoicePaymentReminder: "invoice_payment_reminder",
16
- InvoiceViewed: "invoice_viewed",
17
16
  PaymentReceived: "payment_received",
18
17
  PaymentRefunded: "payment_refunded",
19
18
  PaymentApplied: "payment_applied",
@@ -38,6 +37,7 @@ export const WebhookUpdateEvent = {
38
37
  ClientWon: "client_won",
39
38
  ClientLost: "client_lost",
40
39
  LeadStatusChanged: "lead_status_changed",
40
+ InvoiceViewed: "invoice_viewed",
41
41
  MilestoneApproaching: "milestone_approaching",
42
42
  TimerRunningReminder: "timer_running_reminder",
43
43
  ContractSent: "contract_sent",
@@ -48,12 +48,12 @@ export const WebhookUpdateEvent = {
48
48
  ContractCompleted: "contract_completed",
49
49
  ContractExpired: "contract_expired",
50
50
  ContractVoided: "contract_voided",
51
+ FormSubmissionCompleted: "form_submission_completed",
51
52
  SmartFileSent: "smart_file_sent",
52
53
  SmartFileViewed: "smart_file_viewed",
53
54
  SmartFileAccepted: "smart_file_accepted",
54
55
  SmartFileCompleted: "smart_file_completed",
55
56
  SmartFileExpired: "smart_file_expired",
56
- FormSubmissionCompleted: "form_submission_completed",
57
57
  SubscriptionPaymentFailed: "subscription_payment_failed",
58
58
  PayoutPaid: "payout_paid",
59
59
  PayoutFailed: "payout_failed",
@@ -62,6 +62,19 @@ export const WebhookUpdateEvent = {
62
62
  EventDayArchived: "event_day_archived",
63
63
  TimelineItemCompleted: "timeline_item_completed",
64
64
  TimelineReminderSent: "timeline_reminder_sent",
65
+ InvoiceRefunded: "invoice_refunded",
66
+ ContractAmended: "contract_amended",
67
+ ReceiptViewed: "receipt_viewed",
68
+ FollowUpDue: "follow_up_due",
69
+ PaymentProcessing: "payment_processing",
70
+ ClientReply: "client_reply",
71
+ ClientRevisionRequested: "client_revision_requested",
72
+ EmailDeliveryFailed: "email_delivery_failed",
73
+ SaleCompleted: "sale_completed",
74
+ SaleRefunded: "sale_refunded",
75
+ SaleVoided: "sale_voided",
76
+ SaleReceiptSent: "sale_receipt_sent",
77
+ SaleViewed: "sale_viewed",
65
78
  } as const;
66
79
  export type WebhookUpdateEvent = ClosedEnum<typeof WebhookUpdateEvent>;
67
80